TransWikia.com

image_dataset_from_directory VS flow_from_directory

Data Science Asked on September 28, 2021

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

which one should I use?

One Answer

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

Correct answer by 10xAI on September 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP