how do I get the true labels when I use a ImageDataGenerator.flow_from_directory

Viewed 6991

I have a code running where as data input I have two numpy array (X_train,y_true). I like the data augmentation of the ImageDataGenerator.

Can I use this for getting corresponding numpy arrays?

Here is some code:

train_data_dir="Path to directory containing for each class a directory of images"

from keras.preprocessing.image import ImageDataGenerator
datagen = ImageDataGenerator(rescale=1. / 255,
                         horizontal_flip=True,
                         rotation_range=360)
generator = datagen.flow_from_directory(
       train_data_dir,
       target_size=(img_width, img_height),
       batch_size=22,
       class_mode=None,
       shuffle=True)

x=generator.next()

Now x a a np.array, containing images of both my classes. Can I find the corresponding array with labels somewhere?

1 Answers
Related