【发布时间】:2021-07-19 21:17:47
【问题描述】:
我正在尝试在自定义图像上运行 Resnet 模型(迁移学习)。
我的目录树如下所示:
|-train
| |-class1
| | |-image1
| | |-image2
| | |-....
| |-class2
| |-image1
| |-image2
| |-....
|-val
|-class1
| |-image1
| |-image2
| |-....
|-class2
|-image1
|-image2
|-....
我创建了这样的 tensorflow 数据集:
train_ds = tf.keras.preprocessing.image_dataset_from_directory( "train", labels='inferred', label_mode='int', image_size=(img_height, img_width), batch_size=batch_size)
val_ds = tf.keras.preprocessing.image_dataset_from_directory( "val", labels='inferred', label_mode='int', image_size=(img_height, img_width), batch_size=batch_size)
但是当我训练或测试数据集时,在几张图片之后它给了我一个错误:
InvalidArgumentError: Input is empty [[{{node decode_image/DecodeImage}}]] [Op:IteratorGetNext]
<Figure size 720x720 with 0 Axes>.
我使用的数据集在这里 - https://github.com/xuequanlu/I-Nema - 我已将所有 .tif 图像转换为 .jpg。这可能是什么原因造成的?
提前致谢!
编辑:这是错误日志:https://pastecode.io/s/82hk68ar
【问题讨论】:
标签: python tensorflow keras image-classification