Data Augmentation

Updated at 2023-12-24 09:39

Data augmentation is extending your training dataset with generated variations of the original data samples.

image =
rotated_img = image.rotate(85)
blurred_img = image.filter(PIL.ImageFilter.BLUR)
darker_img = PIL.Image.fromarray(
    (numpy.array(image) / 2).astype('uint8')

# now you have a total of 4 training images instead of 1

Data augmentation helps machine learning models to generalize various situations better, e.g. brightness difference or object orientation in the image.