Open yasutomo57jp opened 4 years ago
Thirding this, however I'd personally recommend changing it to be something more like the following to avoid the unnecessary np.vstack().T
:
from scipy.optimize import linear_sum_assignment
indices_rows, indices_cols = linear_sum_assignment(cost_matrix)
matches, unmatched_tracks, unmatched_detections = [], [], []
for col, detection_idx in enumerate(detection_indices):
if col not in indices_cols:
unmatched_detections.append(detection_idx)
for row, track_idx in enumerate(track_indices):
if row not in indices_rows:
unmatched_tracks.append(track_idx)
for row, col in zip(indices_rows, indices_cols):
Seconding this. Reference here: https://stackoverflow.com/questions/62390517/no-module-named-sklearn-utils-linear-assignment