Machine Learning with Python Projects - Cat and Dog Image Classifier

Tell us what’s happening:
What’s wrong with my code? I don’t get the desired output.
I got this:
Found 2000 images belonging to 2 classes.
Found 1000 images belonging to 2 classes.
Found 0 images belonging to 0 classes.
But the desired is this:
Found 2000 images belonging to 2 classes.
Found 1000 images belonging to 2 classes.
Found 50 images belonging to 1 classes.

Your code so far

train_image_generator = ImageDataGenerator(rescale=1./255)
validation_image_generator = ImageDataGenerator(rescale=1./255)
test_image_generator = ImageDataGenerator(rescale=1./255)

train_data_gen = train_image_generator.flow_from_directory(batch_size=batch_size,
                                                           directory=train_dir,
                                                           target_size=(IMG_HEIGHT, IMG_WIDTH),
                                                           class_mode='binary',
                                                           shuffle=True)
val_data_gen = validation_image_generator.flow_from_directory(batch_size=batch_size,
                                                              directory=validation_dir,
                                                              target_size=(IMG_HEIGHT, IMG_WIDTH),
                                                              class_mode='binary')
test_data_gen = test_image_generator.flow_from_directory(batch_size=1,
                                                         directory=test_dir,
                                                         target_size=(IMG_HEIGHT, IMG_WIDTH),
                                                         class_mode=None,
                                                         shuffle=False)

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0

Challenge: Machine Learning with Python Projects - Cat and Dog Image Classifier

Link to the challenge:

There’s several posts and answers about this issue in the forums. You’ll need to look at the documentation for flow_from_directory and note that the directory structure of the image files is different for the training/validation images and the testing images (download and unzip the image archive to examine locally if necessary).

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