Problems with the Cats and dogs classifier

Tell us what’s happening:
The third cell in the project asks us to create an image generator and data generator. The output of which should be as shown below

Found 2000 images belonging to 2 classes.
Found 1000 images belonging to 2 classes.
Found 50 images belonging to 1 classes.

instead it is of the form,
Found 2000 images belonging to 2 classes.
Found 1000 images belonging to 2 classes.
Found 0 images belonging to 0 classes.

my code so far is listed below,
train_image_generator = ImageDataGenerator(rescale=1/225)
validation_image_generator = ImageDataGenerator(rescale=1/225)
test_image_generator = ImageDataGenerator(1/225)

train_data_gen = train_image_generator.flow_from_directory(
directory=train_dir,
target_size=(IMG_HEIGHT, IMG_WIDTH),
color_mode=“rgb”,
batch_size=batch_size,
class_mode=“binary”,
shuffle=True,
seed=None
)
val_data_gen =validation_image_generator.flow_from_directory(
directory=validation_dir,
target_size=(IMG_HEIGHT, IMG_WIDTH),
color_mode=“rgb”,
batch_size=batch_size,
class_mode=“binary”,
shuffle=True,
seed=None
)
test_data_gen = test_image_generator.flow_from_directory(
directory=test_dir,
target_size=(IMG_HEIGHT, IMG_WIDTH),
color_mode=“rgb”,
batch_size=batch_size,
class_mode=“input”,
shuffle=False,
seed=None
)

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36.

Challenge: Cat and Dog Image Classifier

Link to the challenge:

Welcome to the forums @sushthefreak.

The test data only has one directory (class) of images, not two like the training and validation sets. You will need something like

testing_data = \
    testing_images.flow_from_directory(batch_size=batch,
                                       target_size=dim,
                                       directory=PATH,
                                       classes=['test'],
                                       shuffle=False)

with classes matching the subdirectory containing the images. That method usually expects one directory per class of images.

1 Like

Thank you for your assistance!! it was really helpful.