Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Showing the model what does not matter
If every training photo of a car shows it facing left, a model may decide that cars always face left. Augmentation fixes this cheaply: during training we flip, crop, rotate, recolour or partly cover each image, keeping its label, so the model learns that those changes do not matter. The danger is a change that does matter: flipping a picture of the digit 2 or of a left-hand part produces something else. The demo transforms an ‘L’ and warns when the label would change.
Satellite and aerial images have no natural ‘up’, so rotating them by 90° multiplies the training data for free; for cockpit displays, text or chiral parts the same trick would teach the model wrong answers.
- 1. Augmentation creates…
- 2. A safe augmentation for aerial images is…
- 3. Flipping is unsafe when…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Geometric: random resized crop (Szegedy et al., 2015; scale 0.08–1, aspect 3/4–4/3, the ImageNet default), horizontal flip, rotations, affine and perspective warps, elastic distortions (Simard et al., 2003). For overhead imagery the 8 symmetries of the square (dihedral group D4) are usually label-preserving.
- Photometric: brightness, contrast, saturation and hue jitter; PCA colour noise (Krizhevsky et al., 2012); gamma, blur, sharpening, JPEG compression, sensor noise. For multispectral data, jitter per band within physical ranges rather than hue.
- Occlusion: Cutout (DeVries and Taylor, 2017) and random erasing (Zhong et al., 2020) hide rectangles so the model uses the whole object.
- Mixing: mixup (Zhang et al., 2018) blends images and labels; CutMix (Yun et al., 2019) pastes a patch and mixes labels by area; copy-paste (Ghiasi et al., 2021) pastes segmented instances for detection and segmentation.
- Automated policies: AutoAugment (Cubuk et al., 2019) searched policies; RandAugment (2020) applies N random operations at magnitude M; TrivialAugment (Müller and Hutter, 2021) one random operation at random strength; AugMix (Hendrycks et al., 2020) mixes augmentation chains for robustness.
- Dense labels: boxes, masks and keypoints must be transformed with the image (torchvision.transforms.v2, Albumentations, Kornia); crops can cut objects, so drop or clip boxes by a visibility rule.
- Test-time augmentation (TTA): average predictions over flips, rotations or crops at inference.
- Generative augmentation (2023–2026): diffusion models synthesise extra training images or edit backgrounds; useful for rare classes but prone to label noise and distribution shift.
- 1. CutMix mixes labels in proportion to…
- 2. RandAugment has two main hyperparameters:
- 3. When augmenting for detection, boxes must…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.Augmentation pipelines that respect labels
Exercise 1.
- Flipping and rotating bounding boxes.
- mixup.
- CutMix with area-weighted labels.
Practice.
- List the transformations your labels are truly invariant to, and test each one: train with and without it and look at per-class errors.
- Match augmentation strength to model capacity and dataset size; large models on small data need strong augmentation, small models can be hurt by it.
- Use torchvision.transforms.v2 or Albumentations so masks, boxes and keypoints stay aligned; visualise a batch after augmentation.
- Run augmentation on the CPU workers or on the GPU (Kornia, DALI) so it does not starve training.
- Keep validation and test data unaugmented (except for deliberate TTA), and do not tune augmentation on the test set.
import torch
from torchvision.transforms import v2
train_tf = v2.Compose([
v2.RandomResizedCrop(224, scale=(0.5, 1.0), antialias=True),
v2.RandomChoice([v2.RandomRotation((a, a)) for a in (0, 90, 180, 270)]), # overhead imagery
v2.ColorJitter(0.2, 0.2), v2.RandAugment(num_ops=2, magnitude=9),
v2.ToDtype(torch.float32, scale=True), v2.RandomErasing(p=0.25)])
img, boxes = train_tf(img, boxes) # tv_tensors.BoundingBoxes are transformed with the image
cutmix_or_mixup = v2.RandomChoice([v2.CutMix(num_classes=10), v2.MixUp(num_classes=10)])
images, labels = cutmix_or_mixup(images, labels) # on the batch- 1. Augmentation should be tuned on…
- 2. A library that transforms masks and boxes with images:
- 3. Validation data is normally…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Augmentation as an orbit. For a group G of transforms that leave labels unchanged, augmentation replaces each example x by its orbit Gx. Training on orbits approximates minimising the risk averaged over G, which shrinks the effective hypothesis class to (approximately) G-invariant functions; Chen, Dobriban and Lee (2020) showed this reduces variance without adding bias when the invariance is true. If a transform is not a true symmetry of the labels, the same averaging adds bias: the model is forced to give the same answer to inputs that should differ.
Augmentation versus TTA versus architecture. Invariance can be learned (augmentation), imposed at test time (averaging over the orbit) or built in (group-equivariant networks with pooling over the group). For a nearest-neighbour classifier with a distance that the group preserves, d(gx, y) = d(x, g⁻¹y), so augmenting the training set and transforming the query are exactly equivalent.
Capacity. Augmentation only helps if the model can represent a function that is both invariant and discriminative. A linear classifier on pixels that must give the same score to all four rotations can only use rotation-averaged templates, which blur shapes such as L and T into similar rings.
Mixing. mixup trains on convex combinations and their mixed labels, encouraging linear behaviour between examples (vicinal risk minimisation); it improves calibration and robustness to label noise, but mixed images are not natural images.
- 1. Augmenting with a false symmetry adds…
- 2. For 1-NN with a transform-preserving distance, query transforms are…
- 3. mixup is an instance of…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.When does image augmentation help, when does it hurt, and does it need model capacity?
History.
- P. Simard, D. Steinkraus and J. Platt, “Best practices for convolutional neural networks applied to visual document analysis” (2003).
- A. Krizhevsky, I. Sutskever and G. Hinton, “ImageNet classification with deep convolutional neural networks” (2012).
- H. Zhang et al., “mixup: beyond empirical risk minimization” (2018); S. Yun et al., “CutMix” (2019).
- E. Cubuk et al., “RandAugment: practical automated data augmentation with a reduced search space” (2020).
Exercise 2. Four overhead object classes on 10 × 10 tiles: an L, its mirror image J, a T and two parallel bars, with ±1-pixel shifts and noise 0.15.
- Training: 20 tiles per class, all in one orientation, illumination gain 0.9–1.1.
- Test: 100 tiles per class in random 90° orientations (never mirrored), gain 0.6–1.4.
- Augmentations: none; the 4 rotations; rotations and flips (all 8 symmetries); rotations with gain jitter 0.6–1.4. Also rotation TTA without augmentation, and 80 real tiles per class in random orientations (the same count as the augmented set).
- Models: 1-nearest neighbour on pixels, and a linear softmax classifier on pixels.
| training data | 1-NN accuracy | L/J error | linear accuracy |
|---|---|---|---|
| no augmentation | 0.347 | 0.68 | 0.367 |
| rotations | 0.897 | 0.055 | 0.537 |
| rotations and flips | 0.738 | 0.435 | 0.535 |
| rotations and gain jitter | 0.84 | 0.15 | 0.522 |
| rotation TTA, no augmentation | 0.897 | 0.055 | – |
| 80 real rotated tiles per class | 0.94 | 0.04 | – |
- The right symmetry helped most: rotations raised 1-NN accuracy from 0.347 to 0.897 (seeds 1 and 2: 0.357 to 0.927 and 0.365 to 0.932).
- A false symmetry hurt: adding flips made L and J indistinguishable, with an L/J error of 0.435 (0.51 and 0.46 on seeds 1 and 2), close to guessing within the pair.
- TTA equalled augmentation exactly for 1-NN, as the theory predicts, and augmentation matched the same amount of real rotated data (0.897 against 0.94; on seeds 1 and 2 augmentation was ahead, 0.927 against 0.915 and 0.932 against 0.895).
- Negative result, capacity: the linear model reached only 0.525–0.537 with rotations on all seeds; it cannot be rotation-invariant and discriminative at once.
- Negative result, photometric jitter: matching the test gain range lowered 1-NN accuracy by 5.7, 8.4 and 6.9 points on seeds 0, 1 and 2, most likely because dimmed copies of one class came closer to other classes in pixel distance.
- Caveat: tiny synthetic task and simple models; with CNNs, colour jitter and mixing usually help on natural images.
Image augmentation in AI, robotics and aerospace
- Earth observation: D4 rotations and flips are standard for overhead imagery, except where shadows, sun direction or labels with handedness (runway numbers, text) break the symmetry.
- Robotics: domain randomisation (Tobin et al., 2017) randomises textures, lighting and camera poses in simulation so policies and detectors transfer to real cameras.
- Space and aviation: spacecraft pose estimation challenges (SPEED+, 2022) rely on heavy photometric and style augmentation to cross the gap between synthetic and real images.
References
- C. Shorten and T. Khoshgoftaar (2019). “A survey on image data augmentation for deep learning.” Journal of Big Data.
- H. Zhang, M. Cisse, Y. Dauphin and D. Lopez-Paz (2018). “mixup: beyond empirical risk minimization.” ICLR.
- S. Yun et al. (2019). “CutMix: regularization strategy to train strong classifiers with localizable features.” ICCV.
- E. Cubuk, B. Zoph, J. Shlens and Q. Le (2020). “RandAugment: practical automated data augmentation with a reduced search space.” CVPR Workshops.
- S. Chen, E. Dobriban and J. Lee (2020). “A group-theoretic framework for data augmentation.” JMLR.
- A. Buslaev et al. (2020). “Albumentations: fast and flexible image augmentations.” Information.