ImageDataGenerator directory

525 Views Asked by At

I am working with te ImageDataGenerator in Tensorflow for labeling images.

I seem to be doing something wrong trying to point into my trainning directory, any ideas?

Thanks in advance

  from tensorflow.keras.preprocessing.image import ImageDataGenerator
    train_datagen =ImageDataGenerator(rescale=1./255)
    train_generator = train_datagen.flow_from_directory(
            'C:\Users\Ignacio\Documents\Python for Data Science\Tensorflow Exam\Horses or humans\train',
            target_size=(150, 150),
            batch_size=32,
            class_mode='binary')
1

There are 1 best solutions below

2
On

Check instructions here.

Your directory should have the structure:

main_directory/
...class_a/
......a_image_1.jpg
......a_image_2.jpg
...class_b/
......b_image_1.jpg
......b_image_2.jpg