nwojke / deep_sort

Simple Online Realtime Tracking with a Deep Association Metric
GNU General Public License v3.0
5.27k stars 1.47k forks source link

Module Error? #208

Open AegonLin opened 4 years ago

AegonLin commented 4 years ago

When I execute "python deep_sort_app.py -h" in cmd error is "Traceback (most recent call last): File "deep_sort_app.py", line 14, in from deep_sort.tracker import Tracker File "C:\Users\user\Downloads\deep_sort-master\deep_sort\tracker.py", line 5, in from . import linear_assignment File "C:\Users\user\Downloads\deep_sort-master\deep_sort\linear_assignment.py", line 4, in from sklearn.utils.linearassignment import linear_assignment ModuleNotFoundError: No module named 'sklearn.utils.linearassignment"

honeyshine75 commented 4 years ago

C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\sklearn\utils\linearassignment.py:21: DeprecationWarning: The linearassignment module is deprecated in 0.21 and will be removed from 0.23. Use scipy.optimize.linear_sum_assignment instead. DeprecationWarning)

so you should reinstall a lower sklearn

xingkongliang commented 4 years ago
from scipy.optimize import linear_sum_assignment as linear_assignment

    # indices = linear_assignment(cost_matrix)
    row_indices, col_indices = linear_assignment(cost_matrix)

    matches, unmatched_tracks, unmatched_detections = [], [], []
    for col, detection_idx in enumerate(detection_indices):
        if col not in col_indices:
            unmatched_detections.append(detection_idx)
    for row, track_idx in enumerate(track_indices):
        if row not in row_indices:
            unmatched_tracks.append(track_idx)
    for row, col in zip(row_indices, col_indices):
        track_idx = track_indices[row]
        detection_idx = detection_indices[col]
        if cost_matrix[row, col] > max_distance:
            unmatched_tracks.append(track_idx)
            unmatched_detections.append(detection_idx)
        else:
            matches.append((track_idx, detection_idx))