Augmenting images?

I apologize. I am new to tensorflow. My question is most likely obvious (but not to me). I have seen a lot of image augmentation that uses tf.keras.preprocessing.image.ImageGenerator(). In a tensorflow hub example, the author used:

do_data_augmentation = False
if do_data_augmentation:
      tf.keras.layers.RandomTranslation(0, 0.2))

The other notes the ImageDataGenerator() method is “old”. Why is it old? Why is the new method better? Thank you.


Welcome to the Tensorflow Forum!

tf.keras.preprocessing.image.ImageDataGenerator is obsolete, which is not recommended in the new code. Prefer loading images with tf.keras.utils.image_dataset_from_directory and transforming the output with preprocessing layers. For more information, see the tutorials for loading images and augmenting images as well as the preprocessing layer guide.

Thank you!