Post

KerasKeras

j
jordan chris

Posted on 27th February 2024|376 views

0
votes

Flow From Directory Keras

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

Answers
P
naveen nani

Posted on 27th February 2024

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

train_generator = train_datagen.flow_from_directory(

   directory=r"./train/",

   target_size=(230, 230),

   color_mode="rgb",

   batch_size=32,

   class_mode="categorical",

   shuffle=True,

   seed=40

)

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

STILL GOT QUERIES?

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