MCPcopy Create free account
hub / github.com/Vegetebird/GraphMLP / iou

Function iou

demo/lib/sort/sort.py:16–30  ·  view source on GitHub ↗

Computes IUO between two bboxes in the form [x1,y1,x2,y2]

(bb_test, bb_gt)

Source from the content-addressed store, hash-verified

14
15@jit
16def iou(bb_test, bb_gt):
17 """
18 Computes IUO between two bboxes in the form [x1,y1,x2,y2]
19 """
20 xx1 = np.maximum(bb_test[0], bb_gt[0])
21 yy1 = np.maximum(bb_test[1], bb_gt[1])
22 xx2 = np.minimum(bb_test[2], bb_gt[2])
23 yy2 = np.minimum(bb_test[3], bb_gt[3])
24 w = np.maximum(0., xx2 - xx1)
25 h = np.maximum(0., yy2 - yy1)
26 wh = w * h
27 o = wh / ((bb_test[2] - bb_test[0]) * (bb_test[3] - bb_test[1])
28 + (bb_gt[2] - bb_gt[0]) * (bb_gt[3] - bb_gt[1]) - wh)
29
30 return o
31
32
33def convert_bbox_to_z(bbox):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected