jordan chris

Posted on 23rd June 2024|390 views


Flow From Directory Keras

What are the commonly used attributes along with flow_from_directory()?

1 answers
naveen nani

Posted on 23rd June 2024| views

I will show you all the commonly used attributes by the following example

train_generator = train_datagen.flow_from_directory(


   target_size=(230, 230),







The directory should be set to the path where the classes of the folder are there. 

The target size is the size of our input image.

The color mode is to determine the color of the image whether black, white or grayscale if the image is grayscale then set "grayscale" or else is the image contain the three colors then set "rgb".  

The batch size is the number of images to be produced from the generator.

The class mode has to be set "binary" if there are just two classes if not, we can set it to "categorical".

The shuffle if we want to shuffle the order of the image then we can set the shuffle as "true", or else we can set if as "false".

Seed random seed for implementing the random image.


Write your answer


Get a Live FREE Demo

  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos
Course *
Email *
Phone Number