bounding box
A bounding box is the simplest possible description of where an object is: the smallest axis-aligned rectangle that fully contains it. 'Axis-aligned' means its sides are parallel to the image edges (no rotation), which keeps the math cheap and the annotation easy. It trades precision for simplicity — a diagonal pencil gets a loose box with lots of empty corners — but for most detection tasks a rectangle is enough to say 'the object is here'.
A box needs exactly four numbers to pin down, but there are several common encodings, and mixing them up is a classic bug. Corner form gives the top-left and bottom-right pixels: (x_min, y_min, x_max, y_max). Center form gives the center plus size: (c_x, c_y, w, h). COCO-style annotation uses (x_min, y_min, w, h). They all describe the same rectangle; you just have to convert consistently. Detectors usually regress in center form because center and size behave more independently than two corners.
Networks almost never predict raw pixel coordinates. Instead they predict offsets relative to a reference box (an anchor or a proposal), and these offsets are parameterized and normalized so the targets have a comfortable scale for a neural net. The classic R-CNN/Faster R-CNN encoding is t_x = (x − x_a)/w_a, t_y = (y − y_a)/h_a, t_w = log(w/w_a), t_h = log(h/h_a), where the subscript a denotes the reference box. The center offsets are divided by the reference size so a shift means 'a fraction of a box-width', and the size uses a logarithm so that doubling and halving are symmetric and width stays positive after the exponential is applied back.
For training, the regression loss compares predicted offsets to the offsets that would map the reference box onto the matched ground-truth box. Smooth L1 (Huber) loss is the traditional choice because it is robust to the occasional large error; modern detectors often optimize an IoU-based loss (GIoU, DIoU, CIoU) directly, since the ultimate metric is overlap, not coordinate distance.
A box with corners (x_min=40, y_min=60, x_max=140, y_max=210) has width 100, height 150, and center (90, 135). In center form it is (90, 135, 100, 150) — same rectangle, different four numbers.
The most common bug in a detection pipeline is silently mixing (x1,y1,x2,y2) with (x,y,w,h). Always check whether a library expects corners or center-plus-size, and whether coordinates are absolute pixels or normalized to [0,1].