Data augmentation
train_datagen = ImageDataGenerator(
rotation_range=40,
width_shift_range=0.2,
height_shift_range=0.2,
shear_range=0.2,
zoom_range=0.2,
horizontal_flip=True,
fill_mode='nearest')
rotation_range
is a value in degrees (0–180) within which to randomly rotate pictures.
width_shift
and height_shift
are ranges (as a fraction of total width or height) within which to randomly translate pictures vertically or horizontally.
shear_range
is for randomly applying shearing transformations.
zoom_range
is for randomly zooming inside pictures.
horizontal_flip
is for randomly flipping half of the images horizontally. This is relevant when there are no assumptions of horizontal assymmetry (e.g. real-world pictures).
fill_mode
is the strategy used for filling in newly created pixels, which can appear after a rotation or a width/height shift.