【发布时间】:2017-09-09 10:56:31
【问题描述】:
我正在尝试将 datagen.flow 与 Keras 中的 ImageGenerator 类一起使用。我收到以下内存错误:
Traceback (most recent call last):
File "scratch_6.py", line 284, in <module>
history = model.fit_generator(datagen.flow(train_X, train_y,
batch_size=batch_size, save_to_dir='test_RA', save_format='png'),
File "/usr/local/lib/python3.5/dist-
packages/keras/preprocessing/image.py", line 455, in flow
save_format=save_format)
File "/usr/local/lib/python3.5/dist-
packages/keras/preprocessing/image.py", line 764, in __init__
self.x = np.asarray(x, dtype=K.floatx())
File "/usr/local/lib/python3.5/dist-packages/numpy/core/numeric.py", line 531, in asarray
return array(a, dtype, copy=False, order=order)
MemoryError
我有 128GB 的可用内存。我试过减少批量大小,但没有改变。任何帮助表示赞赏。谢谢你。
【问题讨论】:
-
你的图片尺寸是多少?
-
224 * 224。如果我编写自定义生成器,它可以正常工作,但 dataset.flow 如上所述失败。
标签: python image-processing computer-vision deep-learning keras