戳我进入本文长期更新地址
训练的神经网络不工作?一文带你跨过这37个坑
-
用Keras(后端是TensorFlow)跑一个epoch时报错:
IOError: image file is truncated
解决办法: 在*.py文件最上方加入:from PIL import Image from PIL import ImageFile ImageFile.LOAD_TRUNCATED_IMAGES = True 用Sequential.fit_generator()时要注意steps_per_epoch的区别,keras 中 fit_generator参数steps_per_epoch已经改变含义了,目前的含义是一个epoch分成多少个batch_size。旧版的含义是一个epoch的样本数目。
https://keras.io/models/sequential/#fit_generator在二分类问题中,最后一层的激活函数用
sigmod比softmax要提升正确率约10%用两层Dense不如用一层的
keras 优化下降:multistep(没有试)
把全连接层换成全卷积
resnet的二分类class_mode选择categorical而不是binary
validation_generator=test_datagen.flow_from_directory(
validation_data_dir,
target_size=(img_width, img_height),
batch_size=batch_size,
class_mode='categorical')