Cats and dogs image classifier in the machine learning course

The output expected output is " ```
Found 2000 images belonging to 2 classes.
Found 1000 images belonging to 2 classes.
Found 50 images belonging to 1 classes.

However, I am receiving after following the instructions: 
"Found 0 images belonging to 2 classes.
Found 0 images belonging to 2 classes.
Found 0 images belonging to 2 classes. "

Can anybody help? Below is my code so far: 


**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(
directory = train_dir,
 target_size = (IMG_HEIGHT, IMG_WIDTH), 
classes = ['cat', 'dog'],
 class_mode = 'categorical', 
batch_size = 128)

val_data_gen = validation_image_generator.flow_from_directory(
directory = validation_dir, 
target_size = (IMG_HEIGHT, IMG_WIDTH), 
classes = ['cat', 'dog'], 
class_mode = 'categorical', 
batch_size = 128)

test_data_gen = test_image_generator.flow_from_directory(
directory = test_dir, 
target_size = (IMG_HEIGHT, IMG_WIDTH), 
classes = ['cat', 'dog'], 
batch_size = batch_size,
 shuffle = False)



**Your browser information:**

User Agent is: <code>Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36</code>

**Challenge:**  Cat and Dog Image Classifier

**Link to the challenge:**
https://www.freecodecamp.org/learn/machine-learning-with-python/machine-learning-with-python-projects/cat-and-dog-image-classifier

There’s not enough code here to find the cause of the error, but the notebook is not finding the directory with the images for some reason.

Post a share link to the notebook and you’re more likely to get better help.

Hello Jeremy.a.gray

Here is a link to my notebook : Google Colab

Your problem is here:

train_data_gen = train_image_generator.flow_from_directory(directory = train_dir, target_size = (IMG_HEIGHT, IMG_WIDTH), color_mode = 'rgb', classes = ['cat', 'dog'], class_mode = 'categorical')

You are using the wrong classes. The files are in validation/cats and validation/dogs, etc., not cat and dog. The test images have their own issues and are discussed in several other questions about this project in the forums. Documentation here.

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