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

Function track_det_match

tutorials/ctracker/test.py:103–128  ·  view source on GitHub ↗
(tracklet_list, det_rect_list, min_iou = 0.5)

Source from the content-addressed store, hash-verified

101 return cal_iou(pred_rect, det_rect.curr_rect)
102
103def track_det_match(tracklet_list, det_rect_list, min_iou = 0.5):
104 num1 = len(tracklet_list)
105 num2 = len(det_rect_list)
106 cost_mat = np.zeros((num1, num2))
107 for i in range(num1):
108 for j in range(num2):
109 cost_mat[i, j] = -cal_simi_track_det(tracklet_list[i], det_rect_list[j])
110
111 match_result = linear_sum_assignment(cost_mat)
112 match_result = np.asarray(match_result)
113 match_result = np.transpose(match_result)
114
115 matches, unmatched1, unmatched2 = [], [], []
116 for i in range(num1):
117 if i not in match_result[:, 0]:
118 unmatched1.append(i)
119 for j in range(num2):
120 if j not in match_result[:, 1]:
121 unmatched2.append(j)
122 for i, j in match_result:
123 if cost_mat[i, j] > -min_iou:
124 unmatched1.append(i)
125 unmatched2.append(j)
126 else:
127 matches.append((i, j))
128 return matches, unmatched1, unmatched2
129
130def draw_caption(image, box, caption, color):
131 b = np.array(box).astype(int)

Callers 1

run_each_datasetFunction · 0.85

Calls 1

cal_simi_track_detFunction · 0.85

Tested by

no test coverage detected