X1, y1, x2, y2 in iou loss stand for TopLeft, Bottom Right of bbox?

Hello,

I was trying to use iou loss in PyTorch, but the document is not clear in terms of x1, y1, x2, y2. Do x1, y1 refer to one bbox’s top left corner while x2, y2 stand for the bottom right corner? Assume the coordinate system is as follows: x is in horizontal axis and y is in vertical axis and (0, 0) is in the top left corner of an image.

https://pytorch.org/vision/main/generated/torchvision.ops.distance_box_iou_loss.html
https://pytorch.org/vision/main/generated/torchvision.ops.generalized_box_iou_loss.html

Thanks!

The document mentioned that

Both sets of boxes are expected to be in ``(x1, y1, x2, y2)`` format with
    ``0 <= x1 < x2`` and ``0 <= y1 < y2``, and The two boxes should have the
    same dimensions.

which seems to imply that and answers my question, without explicitly specifying the top-left and bottom-right corners.

Yes. You are right. They may also be better understood as (xmin, ymin, xmax, ymax)

1 Like