Three common encodings
| Format | Values | Units |
|---|---|---|
| Pascal VOC | xmin, ymin, xmax, ymax | Pixels, corners |
| COCO | x, y, width, height | Pixels, from the top-left corner |
| YOLO | x_center, y_center, width, height | Fractions of the image size |
Worked conversion
Take a COCO box [100, 50, 200, 80] in a 640 × 480 image.
- Pascal VOC: xmax = 100 + 200 = 300, ymax = 50 + 80 = 130, so
100, 50, 300, 130. - YOLO: the center is (200, 90); dividing by the image size gives
0.3125, 0.1875, 0.3125, 0.1667.
Forgetting the image size, or treating a YOLO center as a corner, is the classic bug when moving labels between tools. Converting COCO to YOLO walks through it.
Drawing good boxes
- Tight to the visible pixels of the object, with no margin. Loose boxes teach loose predictions and lower IoU scores.
- One rule for occluded objects: box the visible part or the estimated whole, written into the guidelines.
- Objects cut by the image edge are boxed up to the edge, often with a "truncated" tag.
- Long diagonal objects waste most of a box on background; an oriented bounding box or a polygon fits them better.
In Supervisely
The bounding box tool of the image labeling toolbox places boxes one after another without switching tools, and AI assistants and pre-labeling models can draft them for you. Boxes export to COCO, YOLO and Pascal VOC. The blog has a practical guide to bounding box annotation, and the YOLO and RT-DETR pages show detectors that train on boxes.