Concept
Bounding Box Format Conversion
It is often necessary to convert bounding box coordinates between the two-corner format and the center-width-height format. Computationally, bounding boxes are processed as a two-dimensional tensor of shape , where is the number of bounding boxes. To convert from the two-corner representation to the center-width-height representation, the center coordinates are calculated by finding the midpoint between the upper-left and lower-right corners, and the dimensions are determined by taking the coordinate differences: , , , and . The reverse conversion involves adding or subtracting half of the width and height from the center coordinates to recover the corner positions.
0
1
Updated 2026-05-19
Tags
D2L
Dive into Deep Learning @ D2L