Keras ImageDataGenerator.flow_from_directory doesn't find images I'm working on a deep learning (CNN) problem. I have structured my images into folders correctly (I think), like this:

train_dir:
   - class 1
   - class 2
validation_dir:
   - class 1
   - class 2
test_dir:
   - class 1
   - class 2


The images are PNG in a (196,256,3) format but will I'd like to convert them to (196,256,1) because they are grayscale. I do this with the flow_from_directory argument color_mode='grayscale'

As such the code I have so far to get on with this is:

train_datagen = ImageDataGenerator(rescale=1./255) # re-scale pixel values between [0,1]
test_datagen = ImageDataGenerator(rescale=1./255)

train_generator = train_datagen.flow_from_directory(
        train_dir,
        target_size = (196,256),
        color_mode='grayscale',
        batch_size=20,
        class_mode='binary')

validation_generator = test_datagen.flow_from_directory(
        validation_dir,
        target_size = (196,256),
        color_mode='grayscale',
        batch_size=20,
        class_mode='binary')


With train_dir and validation_dir being strings with the equivalent path of the correct folders I mentioned earlier above.

However I get this error when running this section of the code:

Found 0 images belonging to 2 classes


After trying for sometime I can't figure out what's wrong. Does anyone have a clue?
SOLVED!

Always be sure you have '.png' or whatever other file extension you are using at the end of your filename