Free regularization that actually works
Data augmentation is the single most effective regularizer for image models — it teaches the model that "rotated cat" and "flipped cat" are still cats. Keras provides preprocessing layers you can drop directly into your model graph or apply via tf.data.
The standard augmentation set for image classification:
RandomFlip('horizontal')— most images are symmetric horizontallyRandomRotation(0.1)— small rotations (±10%)RandomZoom(0.1)— slight zoom in/outRandomBrightness(0.1),RandomContrast(0.1)
Don't include vertical flip for natural images — upside-down cats are not cats. Don't include color shifts that change semantics — a green stop sign is not a stop sign.
Augmentation only runs during training. The layers respect the training flag automatically — no augmentation during inference. This means you can include them as part of the model itself, simplifying deployment.