MCPcopy Create free account
hub / github.com/FoundationVision/ByteTrack / matrix_iou

Function matrix_iou

yolox/utils/boxes.py:101–111  ·  view source on GitHub ↗

return iou of a and b, numpy version for data augenmentation

(a, b)

Source from the content-addressed store, hash-verified

99
100
101def matrix_iou(a, b):
102 """
103 return iou of a and b, numpy version for data augenmentation
104 """
105 lt = np.maximum(a[:, np.newaxis, :2], b[:, :2])
106 rb = np.minimum(a[:, np.newaxis, 2:], b[:, 2:])
107
108 area_i = np.prod(rb - lt, axis=2) * (lt < rb).all(axis=2)
109 area_a = np.prod(a[:, 2:] - a[:, :2], axis=1)
110 area_b = np.prod(b[:, 2:] - b[:, :2], axis=1)
111 return area_i / (area_a[:, np.newaxis] + area_b - area_i + 1e-12)
112
113
114def adjust_box_anns(bbox, scale_ratio, padw, padh, w_max, h_max):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected