I have a problem in which there are 8 classes with approximately 2000 images. I want to get the images from the folder to later use them in a neural network. There only is one class per image.
In a dataframe variable called training_set
I have a column with the name of the images and in the other its label. This was made using the csv given to me. Per example one line of the dataframe would be: img001.jpg cat
After creating the variable training_set
(which has the 2000 images names and labels), I use the function ImageDataGenerator
and flow_from_dataframe
to fetch the images to the program as you can see below.
train_dataGen = ImageDataGenerator(rescale = 1/2)
train_generator = train_dataGen.flow_from_dataframe(dataframe = training_set, directory="",x_col="Images", y_col="Labels", class_mode="categorical",
target_size=(224,224), batch_size=32)
The variable train_generator
is of type python.keras.preprocessing.image.DataFrameIterator
.
My question is does train_generator
have all the 2000 images? How could I plot only one of those images? If by any means I should use other functions instead of the ones I mentioned please say.