(tracklet_list, det_rect_list, min_iou = 0.5)
| 101 | return cal_iou(pred_rect, det_rect.curr_rect) |
| 102 | |
| 103 | def 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 | |
| 130 | def draw_caption(image, box, caption, color): |
| 131 | b = np.array(box).astype(int) |
no test coverage detected