> 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/augmentation-types/mosaic-augmentation.md).

# Mosaic Augmentation

Combine four training images into one to help your model perform better on small objects.

{% hint style="info" %}
Mosaic is an Enhanced Augmentation, a premium feature. See the [pricing page](https://roboflow.com/pricing) for the plans that include it.
{% endhint %}

Mosaic combines four training images into one. Each image is cropped and placed in one corner of the output, and the four meet at a random point. The result has more objects per image, at smaller sizes and in new surroundings, which helps your model find small objects and rely less on context.

{% hint style="warning" %}
Many modern models apply Mosaic during training. Applying it twice can cause undesirable results, so the app does not recommend Mosaic for models trained in Roboflow or for YOLOv8.
{% endhint %}

## Settings

Mosaic has no settings when you generate a version. Turn it on to use it.

In training setup, "Online Augmentations" for object detection adds an "Expanded canvas" option to Mosaic. It places the four images whole on a canvas twice the training size, instead of cropping each one to a quarter of the image. Use it with the "Affine" step, which zooms and crops the canvas back to the training size. See [Train a Model](https://docs.roboflow.com/models/train/train-a-model).

Mosaic is not available for classification or keypoint detection.

## When to Use

* Your objects are small, or you want the model to see objects in many different surroundings.
* You train a model outside Roboflow whose training pipeline does not already apply Mosaic.

## When Not to Use

* You train in Roboflow or with YOLOv8, which already apply Mosaic while training.
* Where an object sits in the full scene matters to your task.

## Example

<figure><img src="https://2252499186-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVfRxNsvCh4GOyqrjmzX%2Fuploads%2Fgit-blob-001ac236338540658ff60457d8ed3003398007ef%2Faugmentation-example-mosaic.png?alt=media" alt="Four annotated input images and the mosaic output made from a piece of each, with boxes trimmed at the piece edges"><figcaption><p>Example: four images from the dataset become one 1280 x 720 image. Each quarter is cut from one image, and boxes are trimmed where they cross a cut.</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-6a3309d63385328d9ce3efc9f3ec940eb98cb92f%2Faugmentation-mosaic-modal.png?alt=media" alt="The Mosaic modal with a static example of four jellyfish photos combined into one image and the warning not to use it with Roboflow Train or YOLOv8"><figcaption><p>The Mosaic settings show a static example of four images combined into one.</p></figcaption></figure>
