data augmentation - taoualiw/My-Knowledge-Base GitHub Wiki
Data augmentation:
- is almost always recommended and leads to models that generalize better.
- involves adding applying random rotations, shifts, shears, and scaling to existing training data.
- You won’t see a bunch of new .png and .jpg files — it is done on the fly as the script executes
from keras.preprocessing.image import ImageDataGenerator
# construct the image generator for data augmentation
aug = ImageDataGenerator(rotation_range=30, width_shift_range=0.1,
height_shift_range=0.1, shear_range=0.2, zoom_range=0.2,
horizontal_flip=True, fill_mode="nearest")