COCO vs YOLO vs Pascal VOC: annotation formats explained
By the Annoting team · Updated · 5 min read
COCO stores a whole dataset's annotations in one JSON file with pixel coordinates (x, y, width, height); YOLO uses one TXT file per image with normalised center-x, center-y, width and height; Pascal VOC uses one XML file per image with pixel corner coordinates (xmin, ymin, xmax, ymax). Request the format your training framework reads — YOLO for Ultralytics, COCO for Detectron2 and MMDetection.
The three formats at a glance
| COCO | YOLO | Pascal VOC | |
|---|---|---|---|
| File layout | One JSON per split | One .txt per image + class list | One .xml per image |
| Box encoding | x, y, w, h (pixels, top-left) | cx, cy, w, h (0–1, normalised) | xmin, ymin, xmax, ymax (pixels) |
| Segmentation | Polygons or RLE masks | Polygon points (YOLO-seg) | Not native (separate PNG masks) |
| Keypoints | Yes | Yes (YOLO-pose) | No |
| Read by | Detectron2, MMDetection, torchvision | Ultralytics YOLO | Older pipelines, TF Object Detection |
COCO JSON
COCO keeps three linked lists — images, annotations and categories — in a single file. Each annotation points to an image ID and a category ID and carries a bbox, an optional segmentation and an area. It is the richest of the three formats and the default for segmentation and keypoint work.
Watch for: category IDs that do not start at 0 or 1 consistently, and the iscrowd flag, which switches segmentation from polygons to RLE.
YOLO TXT
Each image has a text file with one line per object: class index, then the box center and size as fractions of image width and height. Segmentation and pose variants append polygon points or keypoints on the same line. A dataset YAML lists class names in index order.
Watch for: class order — the YAML order is the contract, and reordering it silently relabels the dataset. For pose datasets, flip_idx must match the keypoint order.
Pascal VOC XML
Each image has an XML file listing objects with a class name and corner coordinates, plus flags for truncated and difficult objects. It is human-readable and easy to parse, but has no native polygons or keypoints.
Which one should you ask for?
Ask for the format your training code reads, so delivery is a download and not a conversion project. If you are unsure or use several frameworks, COCO is the safest master format because it holds the most information and converts cleanly to the others. Annoting also delivers CVAT XML, Datumaro and custom schemas.
Annoting services mentioned in this guide