nicetoolbox.detectors.method_detectors.body_joints.mmpose_inference.calculate_iou

nicetoolbox.detectors.method_detectors.body_joints.mmpose_inference.calculate_iou(box1, box2)[source]

Calculate the Intersection over Union (IoU) of two bounding boxes.

Parameters:
  • box1 (array_like) – Bounding box coordinates of the first box in the format [x1, y1, x2, y2]. (x1, y1) represents the top-left coordinate and (x2, y2) represents the bottom-right coordinate.

  • box2 (array_like) – Bounding box coordinates of the second box in the format [x1, y1, x2, y2]. (x1, y1) represents the top-left coordinate and (x2, y2) represents the bottom-right coordinate.

Returns:

The Intersection over Union (IoU) overlap between the two bounding boxes.

Returns 0 if there is no overlap.

Return type:

float

Notes

IoU = Area of Overlap / Area of Union