In the deep learning applications, generally, the more data you have, the better. Deep neural networks usually have a lot of parameters, so on the small datasets they overfit easily. We can generate more training samples from the samples we already have by using the technique called data augmentation. The idea is to change samples at random. With the face photos, we could, for example, flip faces horizontally, shift them a bit, or add some rotations:
from keras.preprocessing.image import ImageDataGenerator datagen = ImageDataGenerator( rotation_range=25, width_shift_range=0.2, height_shift_range=0.2, horizontal_flip=True)
Compute quantities required for featurewise normalization (std, mean, and principal components, if ZCA whitening is applied):
datagen.fit(X_train)
batch_size = 32
At each iteration, we will consider 32 training examples...