1

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.

Bia
  • 305
  • 3
  • 10
  • Does [plot-images-from-image-generator](https://stackoverflow.com/questions/59217031/plot-images-from-image-generator) answer your question? – Frightera Mar 09 '21 at 21:40
  • ah yes, @Frightera thanks. On another note, in the case I don't want to change the images, can I still use the functions above described? – Bia Mar 10 '21 at 00:05
  • You can use ImageDataGenerator to load your images also, that would be no problem. – Frightera Mar 10 '21 at 07:22

0 Answers0