【发布时间】:2020-09-15 17:05:57
【问题描述】:
我想从我有大约 5000 张图像的目录中加载数据(输入“png”)。但它返回给我一个错误,说当明显有图像时没有图像。 这段代码:
width=int(wb-wa)
height=int(hb-ha)
directory = '/content/drive/My Drive/Colab Notebooks/Hair/Images'
train_ds = tf.keras.preprocessing.image_dataset_from_directory(
directory, labels=densitat, label_mode='int',
color_mode='rgb', batch_size=32, image_size=(width, height), shuffle=True, seed=1,
validation_split=0.2, subset='training', follow_links = False)
返回:
ValueError: Expected the lengths of `labels` to match the number of files in the target directory. len(labels) is 5588 while we found 0 files in /content/drive/My Drive/Colab Notebooks/Hair/Images.
我可以看到图像: Colab view of the folder structure with the images
问题出在哪里?我有一个大数据集,我需要使用这个函数来批量加载数据
【问题讨论】:
标签: tensorflow keras tensorflow-datasets image-preprocessing