RandAugment Augmentation
Skip the search. Pick N random operations at strength M for every image. Two knobs replace a thousand GPU hour policy hunt.
Why Does This Exist?
AutoAugment works but its search costs more than many final runs. Teams with one deadline cannot afford thousands of proxy hours to find 25 subpolicies, and borrowed policies often mismatch the new domain anyway.
RandAugment removes the search and keeps the gains. Fix a pool of operations, pick uniformly per image, and apply each at global magnitude on a to scale. Tuning and by short runs replaces searching thousands of combos. The family overview is image augmentation.
You need one idea first. Randomness with two knobs beats a searched recipe when budgets are tight.
Think of It Like This
A spice rack with two dials
You stop following 25 exact recipes and set two dials: how many spices per dish and how heavy each shake. Every dish differs, but the dials stay put for the week.
is the spice count, is the shake strength. Where the analogy stops: dishes tolerate any combo, while images do not, so needs a ceiling.
How It Actually Works
The two knobs
Pool holds ops: shear, translate, rotate, contrast, solarize, posterize and friends. For each image, sample ops uniformly with replacement and apply each at magnitude . Ordered pairs for total combos, plenty of variety from two integers.
A worked magnitude
Rotate max is degrees. At :
So , applies two random ops near full strength, one possibly a degree turn. Common starts are , for ImageNet scale and , for small photos.
Tuning order
Fix , sweep from to on short runs, then try and at the best . Larger images tolerate larger . Keep color critical tasks at modest because strong posterize erases tints.
Code
import random
def randaugment_ops(pool: list, n: int, seed: int = 0) -> list: """Sample N ops uniformly. Magnitude M is applied later by each op.""" rng = random.Random(seed) # fixed seed makes the demo repeatable return [rng.choice(pool) for _ in range(n)]
pool = ["rotate", "contrast", "shear", "translate"] * 4 # 16 stand insprint(len(randaugment_ops(pool, 2))) # -> 2Watch Out For
Magnitude that deletes the subject
shear or large translate can push a small bird fully out of frame while keeping its tag. The symptom is tail classes collapsing after RandAugment helps head classes. Cap near on small images and verify with visual spot checks.
Stacking too many ops
at high compounds distortions until images leave the natural manifold. Training loss looks regularized while clean validation stalls. Start at and raise only with evidence.
The Quick Version
- RandAugment samples N operations per image at global magnitude M with no search.
- N equals 2 from 14 ops gives 196 ordered pairs of variety from two knobs.
- Magnitude 9 turns a 30 degree rotate into 27 degrees.
- Start at N equals 2, sweep M first, and cap M on small or color critical images.