Data Augmentation: Getting More Images for Free
Data augmentation creates "fake" training data by modifying existing images—flipping, rotating, or color-shifting them. This fights overfitting when your dataset is small, forcing the model to generalize.
WHY IT EXISTS Deep learning models for vision have millions of parameters. If trained on a small dataset, they won't learn general features of "a cat"; they'll just memorize the specific cats in your training images. This is called overfitting and leads to poor performance on new, unseen images.
THE MENTAL MODEL Data augmentation is like showing a child a picture of a dog, then showing them the same picture tilted, zoomed in, and in different lighting. You're teaching them that all these variations are still "dog." It manufactures variety to force a model to learn the essence of an object, not just the pixels of a specific photo.
HOW IT WORKS You define a pipeline of random transformations to apply to your training images on the fly. Each time the model sees an image, it's likely a slightly different version. Common transformations for images include: geometric changes like random rotations, horizontal flips, scaling, and crops; and color space changes like adjusting brightness, contrast, saturation, or hue.
WHEN TO USE IT Use it whenever you're training a deep learning model for a computer vision task, like classification or detection, and your dataset is limited in size or variety. It's a standard technique to improve model robustness and reduce the gap between training and validation accuracy. It is almost always a good idea to apply some form of augmentation.
WHEN NOT TO USE IT Be cautious with augmentations that alter the fundamental label of the image. For example, in digit recognition, rotating a '6' by 180 degrees creates a '9'. In medical imaging, a horizontal flip might create a biologically impossible orientation of an organ. The augmentations should always represent plausible, real-world variations. Don't over-augment to the point where the subject is unrecognizable.
ONE CANONICAL EXAMPLE To train a cat classifier, you start with 1,000 cat photos. For each image in a training batch, you might apply a random horizontal flip (50% chance), a random rotation between -10 and +10 degrees, and a random zoom of up to 20%. This means the model almost never sees the exact same image twice, forcing it to learn features that are invariant to these transformations.
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.