Mosaic is a data augmentation method for object detection that stitches four training images into one and moves each object's bounding box along with it for training. It was introduced as a new data augmentation in the 2020 YOLOv4 paper (Bochkovskiy et al.). According to the paper's acknowledgments, the idea came from Glenn Jocher, who created the Ultralytics YOLOv3 implementation.
Whereas CutMix mixes two images, Mosaic mixes four. Because one training image contains four different scenes (contexts), the model practices finding objects without relying on their "usual background."
The paper summarizes the benefits of Mosaic in two points.
- The model learns to detect objects outside their normal context: Because the four scenes sit next to each other, objects appear beside backgrounds where they would not normally be seen.
- Training works well even with small mini-batches: Batch normalization ends up computing statistics in each layer from the four images contained in a single training image. The paper says this greatly reduces the need for a large mini-batch.
As an analogy, it is like making a collage out of four photos and practicing finding everything in it. Objects are sometimes cut off at the seams between photos, which also builds the ability to find objects from only part of them.
Unlike CutMix for classification, Mosaic does not compute a ratio for mixing labels. In object detection, the ground truth is a list of boxes saying "what is where," so the boxes of the four images are shifted to match where each image was pasted and combined into the ground truth for one image.

