Kaggle - Cats vs dogs (UserWarning: Found 20000 invalid image filename(s) in x_col="filename". These filename(s) will be ignored.)

Viewed 479

When I am generating the test generator, I get below error

UserWarning: Found 20000 invalid image filename(s) in x_col="filename". These filename(s) will be ignored.

Here is the code:

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)

The test folder is immediate before the file. I have searched a lot to fix this issue. If any thing wrong in the code please specify that or give me other suggestions.

1 Answers

All jpeg / png names must be in numerical order, according to the flow_from_dataframe in ImageDataGenerator, alphanumeric labels are not permitted. The image would be ignored, and a warning for that file will be issued. Every image in your scenario has alphanumeric label (name in csv).

Related