MCPcopy Index your code
hub / github.com/FoundationVision/ByteTrack / cal_iou

Function cal_iou

tutorials/ctracker/test.py:78–88  ·  view source on GitHub ↗
(rect1, rect2)

Source from the content-addressed store, hash-verified

76
77
78def cal_iou(rect1, rect2):
79 x1, y1, x2, y2 = rect1
80 x3, y3, x4, y4 = rect2
81 i_w = min(x2, x4) - max(x1, x3)
82 i_h = min(y2, y4) - max(y1, y3)
83 if(i_w <= 0 or i_h <= 0):
84 return 0
85 i_s = i_w * i_h
86 s_1 = (x2 - x1) * (y2 - y1)
87 s_2 = (x4 - x3) * (y4 - y3)
88 return float(i_s) / (s_1 + s_2 - i_s)
89
90def cal_simi(det_rect1, det_rect2):
91 return cal_iou(det_rect1.next_rect, det_rect2.curr_rect)

Callers 2

cal_simiFunction · 0.85
cal_simi_track_detFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected