Data augmentation with tf.data and TensorFlow
Data augmentation with tf.data and TensorFlow – PyImageSearch
“How can we apply data augmentation inside a tf.data pipeline?
Data augmentation is a critical aspect of training neural networks that are to be deployed in real-world scenarios. By applying data augmentation we can increase the ability of our model to generalize and make better, more accurate predictions on data it was not trained on.
TensorFlow provides us with two methods we can use to apply data augmentation to our tf.data pipelines:
Use the Sequential class and the preprocessing module to build a series of data augmentation operations, similar to Keras’ ImageDataGenerator class
Apply tf.image functions to manually create the data augmentation routine
The first method is much easier and requires less effort. The second method is slightly more complex (typically because you need to read the TensorFlow documentation to find the exact functions you need), but allows for more fine-grained control over the data augmentation process.
Inside this tutorial, you’ll learn how to use both data augmentation procedures with tf.data…”