相关疑难解决方法(0)

Tensorflow分配内存:38535168的分配超过系统内存的10%

使用ResNet50预训练的权重我正在尝试构建一个分类器.代码库完全在Keras高级Tensorflow API中实现.完整的代码发布在下面的GitHub链接中.

源代码:使用RestNet50架构进行分类

预训练模型的文件大小为94.7mb.

我加载了预先训练好的文件

new_model = Sequential()

new_model.add(ResNet50(include_top=False,
                pooling='avg',
                weights=resnet_weight_paths))
Run Code Online (Sandbox Code Playgroud)

并适合模型

train_generator = data_generator.flow_from_directory(
    'path_to_the_training_set',
    target_size = (IMG_SIZE,IMG_SIZE),
    batch_size = 12,
    class_mode = 'categorical'
    )

validation_generator = data_generator.flow_from_directory(
    'path_to_the_validation_set',
    target_size = (IMG_SIZE,IMG_SIZE),
    class_mode = 'categorical'
    )

#compile the model

new_model.fit_generator(
    train_generator,
    steps_per_epoch = 3,
    validation_data = validation_generator,
    validation_steps = 1
)
Run Code Online (Sandbox Code Playgroud)

在训练数据集中,我有两个文件夹狗和猫,每个持有近10,000张图像.当我编译脚本时,我收到以下错误

Epoch 1/1 2018-05-12 13:04:45.847298:W tensorflow/core/framework/allocator.cc:101] 38535168的分配超过系统内存的10%.2018-05-12 13:04:46.845021:W tensorflow/core/framework/allocator.cc:101] 37171200的分配超过系统内存的10%.2018-05-12 13:04:47.552176:W tensorflow/core/framework/allocator.cc:101] 37171200的分配超过系统内存的10%.2018-05-12 13:04:48.199240:W tensorflow/core/framework/allocator.cc:101] 37171200的分配超过系统内存的10%.2018-05-12 13:04:48.918930:W tensorflow/core/framework/allocator.cc:101] 37171200的分配超过系统内存的10%.2018-05-12 13:04:49.274137:W tensorflow/core/framework/allocator.cc:101] 19267584的分配超过系统内存的10%.2018-05-12 13:04:49.647061:W tensorflow/core/framework/allocator.cc:101] 19267584的分配超过系统内存的10%.2018-05-12 …

python memory tensorflow resnet keras-layer

19
推荐指数
5
解决办法
3万
查看次数

标签 统计

keras-layer ×1

memory ×1

python ×1

resnet ×1

tensorflow ×1