首页 > 解决方案 > Kaggle - 猫与狗(用户警告:在 x_col="filename" 中发现 20000 个无效图像文件名。这些文件名将被忽略。)

问题描述

我明白了

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)

测试文件夹就在文件之前。我已经搜索了很多来解决这个问题。如果代码中有任何错误,请指定或给我其他建议。

标签: machine-learningkeras

解决方案


所有 jpeg / png 名称必须按数字顺序排列,根据 ImageDataGenerator 中的 flow_from_dataframe,不允许使用字母数字标签。该图像将被忽略,并将发出该文件的警告。场景中的每个图像都有字母数字标签(csv 中的名称)。


推荐阅读