Data Augmentation

MixUp

Image Augmentation videos

Data augmentation works by applying various transformations to your training images (or other data types) that preserve the core content while changing superficial aspects. For image data, common augmentations include:

  1. Rotation: Turning images slightly clockwise or counterclockwise
  2. Flipping: Mirroring images horizontally (and sometimes vertically)
  3. Zooming: Cropping and resizing parts of the image
  4. Shifting: Moving the image slightly in different directions
  5. Brightness/contrast adjustments: Changing lighting conditions
  6. Warping: Slightly distorting the image geometry

In fastai, data augmentation is implemented through the aug_transforms() function, which you can include in your DataBlock:

data = DataBlock(
    blocks=(ImageBlock, CategoryBlock),
    get_items=get_image_files,
    splitter=RandomSplitter(),
    get_y=parent_label,
    item_tfms=Resize(224),
    batch_tfms=aug_transforms()
)