Sub topic 2
Drawing and Storing Bounding Boxes
This chapter assumes you know Python lists and dictionaries, can read JSON, and know that an image is a grid of pixels with a width and height. It covers how boxes are stored, how polygons become masks, and how three common formats encode both.
Drawing and storing bounding boxes
A bounding box is the smallest axis-aligned rectangle that contains an object. Pixel coordinates start at (0, 0) in the top-left corner, and x grows to the right while y grows downward.
COCO stores a box as [x_min, y_min, width, height] in pixels. Pascal VOC stores the two corners instead, as xmin, ymin, xmax, ymax. Always confirm which convention a tool exports before you train on the data.
{
"id": 1,
"image_id": 1,
"category_id": 1,
"bbox": [50, 40, 100, 50],
"area": 5000,
"iscrowd": 0
}