Boosting the CNN classifier with data augmentation
Data augmentation means expanding the size of an existing training dataset in order to improve the generalization performance. It overcomes the cost involved in collecting and labeling more data. In TensorFlow, we use the ImageDataGenerator module (https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image/ImageDataGenerator) from the Keras API to implement image augmentation in real time.
Horizontal flipping for data augmentation
There are many ways to augment image data. The simplest one is probably flipping an image horizontally or vertically. For instance, we will have a new image if we flip an existing image horizontally. To generate horizontal images, we should create an image data generator, as follows:
>>> import os
>>> from tensorflow.keras.preprocessing.image import ImageDataGenerator, load_img
>>> da tagen = ImageDataGenerator(horizontal_flip=True)
We will create...