pairwise_ioa
-
Description:
pairwise_ioais a function used to calculate the Intersection over Area (IoA) between two lists of bounding boxes. This function computes the IoA for all N x M pairs of bounding boxes. The input bounding boxes must be of typeBoxes. -
Parameters
- boxes1 (
Boxes): The first list of bounding boxes, containing N bounding boxes. - boxes2 (
Boxes): The second list of bounding boxes, containing M bounding boxes.
- boxes1 (
-
Returns
- np.ndarray: IoA matrix with shape
[N, M].
- np.ndarray: IoA matrix with shape
-
Notes
- IoA is defined as
intersection(boxes1, boxes2) / area(boxes2).
- IoA is defined as
-
Exceptions
- TypeError:
boxes1orboxes2is notBoxes. - ValueError: Empty boxes exist (width/height
<= 0).
- TypeError:
-
Example
import capybara as cb
boxes1 = cb.Boxes([[10, 20, 50, 80], [20, 30, 60, 90]])
boxes2 = cb.Boxes([[20, 30, 60, 90], [30, 40, 70, 100]])
ioa = cb.pairwise_ioa(boxes1, boxes2)
print(ioa)
# >>> [[0.625 0.33333334]
# [1.0 0.625]]