您的当前位置:首页正文

【总结经验】炼丹路上的坑与经验

来源:要发发知识网
  • 用Keras(后端是TensorFlow)跑一个epoch时报错:IOError: image file is truncated
    解决办法: 在*.py文件最上方加入:

    from PIL import Image
    from PIL import ImageFile
    ImageFile.LOAD_TRUNCATED_IMAGES = True
    
  • 在二分类问题中,最后一层的激活函数用sigmodsoftmax要提升正确率约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')