:param tracks: list[STrack] :param detections: list[BaseTrack] :param metric: :return: cost_matrix np.ndarray
(tracks, detections, metric='cosine')
| 100 | return cost_matrix |
| 101 | |
| 102 | def embedding_distance(tracks, detections, metric='cosine'): |
| 103 | """ |
| 104 | :param tracks: list[STrack] |
| 105 | :param detections: list[BaseTrack] |
| 106 | :param metric: |
| 107 | :return: cost_matrix np.ndarray |
| 108 | """ |
| 109 | |
| 110 | cost_matrix = np.zeros((len(tracks), len(detections)), dtype=np.float) |
| 111 | if cost_matrix.size == 0: |
| 112 | return cost_matrix |
| 113 | det_features = np.asarray([track.curr_feat for track in detections], dtype=np.float) |
| 114 | #for i, track in enumerate(tracks): |
| 115 | #cost_matrix[i, :] = np.maximum(0.0, cdist(track.smooth_feat.reshape(1,-1), det_features, metric)) |
| 116 | track_features = np.asarray([track.smooth_feat for track in tracks], dtype=np.float) |
| 117 | cost_matrix = np.maximum(0.0, cdist(track_features, det_features, metric)) # Nomalized features |
| 118 | return cost_matrix |
| 119 | |
| 120 | def embedding_distance2(tracks, detections, metric='cosine'): |
| 121 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected