当我生成测试生成器时,出现以下错误
UserWarning: Found 20000 invalid image filename(s) in x_col="filename". These filename(s) will be ignored.
代码如下:
test_datagen = ImageDataGenerator(rotation_range=15,
rescale=1./255,
shear_range=0.1,
zoom_range=0.2,
horizontal_flip=True,
width_shift_range=0.1,
height_shift_range=0.1)
test_generator = train_datagen.flow_from_dataframe(train_df,
"./test/",x_col='filename',y_col='category',
target_size=Image_Size,
class_mode='categorical',
batch_size=batch_size)
测试文件夹就在文件之前。我已经搜索了很多来解决这个问题。如果代码中有任何错误,请指出或给我其他建议。
最佳答案
所有 jpeg/png 名称必须按数字顺序排列,根据 ImageDataGenerator 中的 flow_from_dataframe,不允许使用字母数字标签。该图像将被忽略,并且将发出该文件的警告。 您场景中的每个图像都有字母数字标签(csv 格式的名称)。
关于machine-learning - Kaggle - 猫与狗(用户警告 : Found 20000 invalid image filename(s) in x_col ="filename". 这些文件名将被忽略。),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66402140/