HomeLearnCoursesHackathonsAccount
Object Detection & Tracking
The Anatomy of a Bounding Box · 1/2

Two ways to describe the same rectangle

A bounding box is just a rectangle drawn tightly around an object, but a model has to output it as numbers, not a drawing. There are two common ways to encode it. The first is corner format: the pixel coordinates of the top-left corner and the bottom-right corner, which directly describes the rectangle's extent. The second is center format: the x and y coordinates of the box's center point, plus its width and height, which describes the same rectangle but anchored at its middle instead of its edge.

Neither format is objectively better, they're just more convenient at different stages. Center format tends to be easier for a model to predict when it's working from a grid of candidate positions, since the center point can be expressed as a small offset from a known grid cell, while corner format is often more convenient once you need to compare boxes or crop the actual pixels out. Most detection pipelines convert between the two as needed.