> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation.md).

# Image Augmentation

Create augmented images to improve model performance, and decide which augmentations fit your data.

Image augmentation creates new, altered copies of the images in your Train set (ex: flipped, rotated, or darker versions). Your model sees more variation without you collecting or labeling more data, which helps it perform on images it has never seen.

Augmentations apply only to the Train set. Your Valid and Test sets stay unchanged, so your metrics reflect real images.

{% hint style="info" %}
Start a project with no augmentations. Train a baseline model first, so you can tell whether each augmentation helps. If the baseline performs poorly, check class balance, how well your images match production, and dataset size before you add augmentations.
{% endhint %}

Roboflow applies augmentations when you generate a dataset version ("offline augmentation"), not while the model trains. This has three benefits:

1. Results are reproducible. The version stores a copy of each augmented image and the values used to make it. If your model does better on bright images than dark ones, you can see that and collect more low-light data.
2. Training is faster. Augmentation runs on the CPU. When it runs during training, the GPU often waits for the CPU to prepare each batch.
3. Training costs less, because a rented GPU spends less time waiting.

Many models also augment images while they train ("online augmentation"). When you train in Roboflow, training setup shows these steps under "Online Augmentations". See [Train a Model](https://docs.roboflow.com/models/train/train-a-model).

## Choose Augmentations

Pick augmentations that match how your production images vary. A good augmented image still looks like a real image your model could see, with its original label still correct.

* Match real conditions. If your camera position varies, try [Rotation](https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/rotation-augmentation.md) or [Crop](https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/crop-augmentation.md). If lighting varies, try [Brightness](https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/brightness-augmentation.md) or [Exposure](https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/exposure-augmentation.md). If images can be out of focus, try [Blur](https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/blur-augmentation.md).
* Avoid changes that alter meaning. A horizontal flip turns a left arrow into a right arrow but keeps the "left" label. Hue shifts can turn a red light green.
* Keep settings modest. Extreme values create images unlike anything in production. The "Create New Version" page warns you when a setting is outside the typical range.
* Add one or two at a time, retrain, and compare against your baseline. Keep what helps and drop what does not.

See [Augmentation Types](https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types.md) for guidance on each option.

## How Augmentations Are Applied

Augmentations are always applied to training images after [preprocessing steps](https://docs.roboflow.com/datasets/versions/dataset-versions/image-preprocessing.md). Each augmented image gets every augmentation you selected, with a random value within the range you set for each one. Any images that come out as duplicates are filtered out of the version.

For example, if you select Flip with "Horizontal" and Noise, a given augmented image may be flipped horizontally or not, and receives a random amount of salt and pepper noise up to your maximum.

### Limiting Augmentations

Choose how many augmented images to create with the "Augmentation Multiplier" in the "Create" section of the "Create New Version" page. In training setup, use the multiplier next to "Train Images".

For example, 3x means your version contains each training image with [preprocessing steps](https://docs.roboflow.com/datasets/versions/dataset-versions/image-preprocessing.md) applied, plus 2 augmented copies of it.

If you had 100 images in your dataset with a train/valid/test split of 70/20/10 and selected 3x, your version would have about 210 Train, 20 Valid, and 10 Test images.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-6e1eab9e86e8e1271b32261c1f214c503ed7afc7%2Fimage%20(413).png?alt=media" alt="The augmentation multiplier and the resulting version size"><figcaption></figcaption></figure>

{% hint style="info" %}
Your version's final number of images may be smaller than this estimate, because Roboflow removes duplicate images and some steps (like Filter Null) remove images from the output.
{% endhint %}

Your plan sets the highest multiplier you can pick. The web app only offers the values your plan allows, and generating a version through the API or Python SDK fails if you ask for more. See the [pricing page](https://roboflow.com/pricing) for the limit on each plan.

## Augmentation Options

Augmentations are either "Basic" or "Enhanced", and apply at two different levels.

### Image Level Augmentations

Image level augmentations transform the whole image. They simulate changes in the scene or the camera, such as lighting, focus, and angle. Start with these.

### Bounding Box Level Augmentations

Bounding box level augmentations change only the pixels inside each annotated bounding box, and leave the rest of the image as is. This gives you control over how your objects vary without changing the background.

{% hint style="warning" %}
Bounding box level augmentations are an advanced feature and in many cases may degrade your model's performance. Train a model with image level augmentations first, and compare.
{% endhint %}

A [2019 paper](https://arxiv.org/pdf/1906.11172.pdf) from Google researchers found that augmenting only the content of bounding boxes can improve object detection models, especially models trained on small datasets.

Bounding box level augmentations are available for object detection and instance segmentation projects. On the "Create New Version" page, they are under "Bounding Box Level Augmentations" in the "Augmentation Options" list, and their settings open as "Bounding Box: Flip" and so on. Training setup shows them with a "BB:" prefix (ex: "BB: Flip"). These augmentations have a bounding box level version: Flip, 90° Rotate, Rotation, Crop, Shear, Brightness, Exposure, Blur, Noise, Motion Blur, and Camera Gain.

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-53396667f2ef438da0a234a32277a96193923fff%2Faugmentation-bounding-box-level-options.png?alt=media" alt="The Bounding Box Level Augmentations section of the Augmentation Options list, with examples where only the content of a green bounding box changes"><figcaption><p>"Bounding Box Level Augmentations" in the "Augmentation Options" list.</p></figcaption></figure>

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-d83e6eb1583b0c607158dc128ade79e3e1b348bb%2Faugmentation-bbox-flip-modal.png?alt=media" alt="The Bounding Box: Flip modal with Horizontal checked and a warning that bounding box level augmentations may degrade model performance"><figcaption><p>Each bounding box level augmentation shows this warning.</p></figcaption></figure>

{% hint style="info" %}
Enhanced Augmentations and Bounding Box Augmentations are premium features. See the [pricing page](https://roboflow.com/pricing) for the plans that include them.
{% endhint %}

<table data-search="false"><thead><tr><th></th><th data-type="checkbox">Image Level Augmentation</th><th data-type="checkbox">Bounding Box Augmentation</th><th>Augmentation Type<select><option value="Z8F06MhppTfn" label="Enhanced" color="blue"></option><option value="sdEDfdaf9Z03" label="Basic" color="blue"></option></select></th></tr></thead><tbody><tr><td><a href="https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/flip-augmentation.md">Flip Augmentation</a></td><td>true</td><td>true</td><td><span data-option="sdEDfdaf9Z03">Basic</span></td></tr><tr><td><a href="https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/90o-rotate-augmentation.md">90° Rotate Augmentation</a></td><td>true</td><td>true</td><td><span data-option="sdEDfdaf9Z03">Basic</span></td></tr><tr><td><a href="https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/crop-augmentation.md">Crop Augmentation</a></td><td>true</td><td>true</td><td><span data-option="sdEDfdaf9Z03">Basic</span></td></tr><tr><td><a href="https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/rotation-augmentation.md">Rotation Augmentation</a></td><td>true</td><td>true</td><td><span data-option="sdEDfdaf9Z03">Basic</span></td></tr><tr><td><a href="https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/shear-augmentation.md">Shear Augmentation</a></td><td>true</td><td>true</td><td><span data-option="sdEDfdaf9Z03">Basic</span></td></tr><tr><td><a href="https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/grayscale-augmentation.md">Grayscale Augmentation</a></td><td>true</td><td>false</td><td><span data-option="sdEDfdaf9Z03">Basic</span></td></tr><tr><td><a href="https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/hue-augmentation.md">Hue Augmentation</a></td><td>true</td><td>false</td><td><span data-option="sdEDfdaf9Z03">Basic</span></td></tr><tr><td><a href="https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/saturation-augmentation.md">Saturation Augmentation</a></td><td>true</td><td>false</td><td><span data-option="sdEDfdaf9Z03">Basic</span></td></tr><tr><td><a href="https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/brightness-augmentation.md">Brightness Augmentation</a></td><td>true</td><td>true</td><td><span data-option="sdEDfdaf9Z03">Basic</span></td></tr><tr><td><a href="https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/exposure-augmentation.md">Exposure Augmentation</a></td><td>true</td><td>true</td><td><span data-option="sdEDfdaf9Z03">Basic</span></td></tr><tr><td><a href="https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/blur-augmentation.md">Blur Augmentation</a></td><td>true</td><td>true</td><td><span data-option="sdEDfdaf9Z03">Basic</span></td></tr><tr><td><a href="https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/noise-augmentation.md">Noise Augmentation</a></td><td>true</td><td>true</td><td><span data-option="sdEDfdaf9Z03">Basic</span></td></tr><tr><td><a href="https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/camera-gain-augmentation.md">Camera Gain Augmentation</a></td><td>true</td><td>true</td><td><span data-option="sdEDfdaf9Z03">Basic</span></td></tr><tr><td><a href="https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/motion-blur-augmentation.md">Motion Blur Augmentation</a></td><td>true</td><td>true</td><td><span data-option="sdEDfdaf9Z03">Basic</span></td></tr><tr><td><a href="https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/cutout-augmentation.md">Cutout Augmentation</a></td><td>true</td><td>false</td><td><span data-option="Z8F06MhppTfn">Enhanced</span></td></tr><tr><td><a href="https://docs.roboflow.com/datasets/versions/dataset-versions/image-augmentation/augmentation-types/mosaic-augmentation.md">Mosaic Augmentation</a></td><td>true</td><td>false</td><td><span data-option="Z8F06MhppTfn">Enhanced</span></td></tr></tbody></table>

Training setup also offers "Affine" under "Online Augmentations", which randomly zooms, shifts, rotates, shears, and adds perspective to each image while the model trains. It is not available when you generate a version. See [Train a Model](https://docs.roboflow.com/models/train/train-a-model).

## Learn More

* [The Ultimate Guide for Data Augmentation](https://blog.roboflow.com/data-augmentation/)
* [How to Augment Images for Object Detection](https://blog.roboflow.com/object-detection-augmentation/)
