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

which one should I use?


Generates a tf.data.Dataset from image files in a 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


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.