utils.box.box_iou

Contents

utils.box.box_iou#

box_iou(boxes1: Tensor, boxes2: Tensor) Tensor[source]#

Compute pairwise IoU across two lists of anchor or bounding boxes

Parameters:
  • boxes1 (torch.Tensor) – anchors [num_anchors, 4] - (ulw, ulh, drw, drh).

  • boxes2 (torch.Tensor) – ground truth [num_gt_box, 4] - (ulw, ulh, drw, drh).

Returns:

IoU. Element x_ij in the i-th row and j-th column is the IoU of the anchor box i and the ground-truth bounding box j.

Shape [num_anchors, num_gt_box].

Return type:

torch.Tensor