Lensa ML
Lensa ML

Data Augmentation

Step 1 of 6

Why Augment?

Small datasets overfit — augmentation multiplies your data

Training Set Size50
EpochLossTrainValAug
Dataset Size
50
Overfit Gap
6.49
Effective Size
250
Aug Gap
1.79

With so few samples, the model memorizes training data. Validation loss diverges sharply from training loss — classic overfitting. Augmentation (orange line) narrows the gap by creating diverse variations.

Step 1 of 6: Why Augment?

Small datasets overfit — augmentation multiplies your data

Training Set Size50
EpochLossTrainValAug
Dataset Size
50
Overfit Gap
6.49
Effective Size
250
Aug Gap
1.79

With so few samples, the model memorizes training data. Validation loss diverges sharply from training loss — classic overfitting. Augmentation (orange line) narrows the gap by creating diverse variations.

Step 2 of 6: Geometric Transforms

Rotate, flip, crop — spatial invariances

Rotation Angle (degrees)0
OriginalTransformedCommon geometric transforms:Rotate Flip Crop Shear Scale TranslateEach creates a valid new training sample from existing data
Angle
Flipped
No
|Rotation|

Small rotations (< 30°) are the safest geometric augmentation. They preserve the object's natural orientation while adding useful variation for the model to learn invariance.

Step 3 of 6: Color & Intensity

Brightness, contrast, and color jitter

Brightness Shift0.00
Simulated image pixelsPixel intensity distribution0265177102128154179205230No changeAlso: contrast, saturation, hue jitter, color dropout
Brightness
0.00
Avg Original
127
Avg Adjusted
127

Subtle color shifts simulate natural lighting variation. The histogram barely changes, keeping pixel statistics close to the original — low-risk, high-value augmentation.

Step 4 of 6: Cutout & Mixup

Occlusion and interpolation strategies

Cutout Size / Mixup Ratio20
CutoutMasks out a 20% regionMixup (alpha=0.40)Blends two images & labelsCutout: forces model to use non-local featuresMixup: smooths decision boundaries between classesCutMix combines both: paste a patch from another image
Cutout %
20%
Mixup Alpha
0.40
Visible %
80%

Moderate cutout (10-30%) forces the model to attend to broader features rather than fixating on one discriminative region. Mixup blending creates soft label targets that improve calibration.

Step 5 of 6: Augmentation Probability

How often to apply each transform

Augmentation Probability0.50
Training batch — augmented samples highlightedAUGorigorigAUGorigAUGorigAUGorigAUGAUGorig
Probability
0.50
Augmented
6/12
Multiplier
1.50x
Diversity
1.00

Moderate probability (0.2-0.7) gives a healthy mix of original and augmented samples. Each epoch sees different variations, maximizing the effective training set diversity.

Step 6 of 6: When Augmentation Hurts

Too much augmentation degrades performance

Augmentation Strength0.30
Augmentation StrengthVal Accuracy0.950.50no augsweet spotunderover-aug
Strength
0.30
Val Accuracy
0.920
vs Baseline
+10.0%
Regime
Sweet spot

The sweet spot: enough augmentation to teach useful invariances without distorting the data distribution. Validation accuracy peaks here, well above the no-augmentation baseline.