ImageDataGenerator() is deprecated in Tensorflow 2.9

tf.keras.utils.image_dataset_from_directory can replace ImageDataGenerator in many cases. When it comes to week 4 assignment, it can replace ImageDataGenerator since the only operation done is rescaling the image.

The reason I say it can mostly replace ImageDataGenerator is because some functions like shear seem missing from tensorflow.

tf.keras.utils.image_dataset_from_directory returns a Dataset. You can either use a map method in the dataset or use tf.keras.layers.Rescaling directly in the model.