2
$\begingroup$

What is the main diffrence between flow_from_directory VS image_dataset_from_directory in keras?

which one should I use?

$\endgroup$
2
$\begingroup$

tf.keras.preprocessing.image_dataset_from_directory
Generates a tf.data.Dataset from image files in a directory.

ImageDataGenerator.flow_from_directory
Takes the path to a directory & generates batches of augmented data.

While their return type also differs but the key difference is that flow_from_directory is a method of ImageDataGenerator while image_dataset_from_directory is a preprocessing function to read image form directory.
image_dataset_from_directory will not facilitate you with augmented image generation capability on-the-fly.

which one should I use?

It's quite common to generate augmented images when working with CNN, so better to use flow_from_directory. If you do not need augmented image, you may control the same by the parameters of ImageDataGenerator

Reference - Keras docs

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.