Bounding box

A bounding box is the smallest axis-aligned rectangle that encloses an object in an image, stored as two corners or as one point plus width and height. It is the label object detectors are trained and evaluated on. In Supervisely, boxes are drawn with the bounding box tool and export to COCO, YOLO or Pascal VOC.

AnnotationAlso called bbox, box annotation

Three common encodings

FormatValuesUnits
Pascal VOCxmin, ymin, xmax, ymaxPixels, corners
COCOx, y, width, heightPixels, from the top-left corner
YOLOx_center, y_center, width, heightFractions 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.

Frequently asked questions.

What is a bounding box in image processing?

The smallest axis-aligned rectangle that encloses an object, stored as two corners or as one point plus width and height. Object detectors learn from bounding boxes and predict them.

What are the bounding box formats of COCO, YOLO and Pascal VOC?

COCO stores x, y of the top-left corner plus width and height in pixels; YOLO stores the box center and size, normalized by the image size; Pascal VOC stores the top-left and bottom-right corners in pixels.