Bug fix of cat and dog image classifier

Hi, I don’t really know if this is a bug or it’s part of the challenge

When you use the method flow_from_directory to pre process the images the output not match with the expect output, after I take somedays to find the answer, the problem it’s the directorio of the images.

before / after

So it would be interesting to change the files to fix that.
Sorry if I say something that sounds rude, my English is not very good.

Link of dataset

Some dudes handled by calling the class like this:

test_data_gen = test_image_generator.flow_from_directory(PATH,batch_size=batch_size,target_size=(IMG_HEIGHT, IMG_WIDTH),class_mode="binary",shuffle=False,classes=['test'])

and ongoing according to this way.
I am not the person in charge for this case but maybe this answer can help u.
cheers

2 Likes

Not that it’s terribly easy to find if I remember correctly, but this is the documented behavior of flow_from_directory(). It converts subdirectories of the provided directory into different classes (like cats or dogs). There’s no subdirectory if you use the directory cats_and_dogs/test, so you need to back up a level and provide the class subdirectory ([test]) and directory="cats_and_dogs" to work correctly. You could also use the python file manipulation utilities and rearrange the data so that the test directory had a test subdirectory and then you could load the test data the same way you load the training and validation data.

Not obvious, not convenient, but not a bug.

1 Like

Hi tb47,
I tried it and it worked, I had been looking for it before and I couldn’t find a way to do it as easy as yours,
Thanks :smiley:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.