Developer and Text Tools

How to Augment and Split a YOLO or COCO Image Dataset Without Data Leakage

Augment labelled photos with flips, rotation, crops and colour changes, move the boxes exactly, and split into train, val and test folders as a ZIP.

Saizul Amin
Saizul Amin7 Nov 2026 · 4 min read
How to Augment and Split a YOLO or COCO Image Dataset Without Data Leakage

Small object detection projects live and die by their data. A model trained on 150 photos of shelf products, insects or road signs sees the same lighting, angles and backgrounds over and over, and it learns those instead of the objects. Augmentation adds variety by flipping, turning, cropping and recolouring the photos you already have. Splitting sets aside photos the model never trains on, so you can tell whether it really works. Both steps are easy to get subtly wrong. The Image Dataset Augmenter and Splitter does them in the browser, with the boxes moved exactly and the split done safely.

Load images with their labels

Select the images together with the label files. For YOLO that means one .txt file per image with the same base name, plus classes.txt, obj.names or data.yaml for the class names. For COCO it is one instances JSON. The page matches labels to images, counts boxes per class and lists images without labels; those are kept as background examples with empty label files, which helps a model learn what is not an object. YOLO segmentation polygons are turned into boxes.

Check the class list. A class with very few boxes will be weak whatever you do, and the counts show it at once. You can rename classes here, which is handy when the label tool used names like class_0.

Split first, augment second

The most common mistake in small datasets is leakage: augmented copies of a photo end up in both the training and the validation set. The model has then already seen a near-twin of the validation image, and the score looks better than it is.

The tool avoids that by splitting source photos, not files. Set the training and validation shares and the rest becomes the test set. With a seed, the shuffle is the same every time. By default only the training photos are augmented, and every copy stays with its original. Validation and test images stay untouched, as they should.

Choose augmentations that make sense

Pick a preset or set each option:

  • mirror flips for most everyday photos;
  • upside-down flips and quarter turns only when objects can appear that way, such as in aerial, satellite or microscope images;
  • small rotations of 5 to 15 degrees for hand-held photos;
  • crops that keep at least 70 to 90 percent of the picture, for scale and position variety;
  • brightness, contrast, saturation and hue changes for different lighting and cameras;
  • blur and noise for motion and cheap sensors.

Avoid flips for anything where direction matters, like text, arrows or left and right hands. The documents preset leaves them off.

How the boxes move

Each copy follows a plan drawn from the seed, and the boxes go through exactly the same geometry as the pixels. Each corner of a box is mapped, the new box is drawn around the mapped corners and clipped to the picture, and boxes that keep less than the visibility share you set are dropped. A box half cut off by a crop is still useful; a sliver at the edge is noise.

Rotation makes boxes a little larger than the object, because the box around a rotated rectangle is bigger than the rectangle. Keep rotations small when tight boxes matter. Use the preview to look at a few random copies with their boxes drawn before you build the whole set.

Build the ZIP

Choose YOLO, which writes the Ultralytics folder layout with images and labels for train, val and test and a data.yaml, or COCO, which writes an images folder and an instances JSON per split. Optionally resize the longer side to 416, 640, 1024 or 1280 pixels, which keeps the ZIP small and matches common training sizes. A README records the counts, the seed, the settings and how many boxes were dropped, so the dataset can be rebuilt exactly.

What stays for training time

Some augmentations work better on the fly during training, such as mosaic, mix-up and random scale jitter in each epoch; training libraries do those themselves. Masks, keypoints and oriented boxes are not augmented here. For the common case, a few hundred to a few thousand box-labelled photos, the tool gives you a clean, reproducible, leak-free dataset without uploading a single image.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages