data augmentation - taoualiw/My-Knowledge-Base GitHub Wiki

Data Augmentation

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

Python

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")

References

https://www.pyimagesearch.com/2018/09/10/keras-tutorial-how-to-get-started-with-keras-deep-learning-and-python/

⚠️ **GitHub.com Fallback** ⚠️