MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / is_overlap_v1

Function is_overlap_v1

flow-python/examples/application/utils.py:97–108  ·  view source on GitHub ↗
(rect1, rect2, iou_threshold)

Source from the content-addressed store, hash-verified

95
96
97def is_overlap_v1(rect1, rect2, iou_threshold):
98 xx1 = max(rect1[0], rect2[0])
99 yy1 = max(rect1[1], rect2[1])
100 xx2 = min(rect1[2], rect2[2])
101 yy2 = min(rect1[3], rect2[3])
102 dx = max(0, xx2 - xx1 + 1)
103 dy = max(0, yy2 - yy1 + 1)
104 i = dx * dy
105 u = (rect1[2] - rect1[0] + 1) * (rect1[3] - rect1[1] + 1) + (
106 rect2[2] - rect2[0] + 1) * (rect2[3] - rect2[1] + 1) - i
107 ov = i / u
108 return ov >= iou_threshold
109
110
111def IoB(rect1, rect2, iob_threshold):

Callers 1

raw_nmsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected