Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions SFSORT.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,12 @@ def update(self, boxes, scores):

# Add unmatched tracks to the lost list
unmatched_track_pool = []
for track_address in unmatched_tracks:
unmatched_track_pool.append(track_pool[track_address])
if high_score.any():
for track_address in unmatched_tracks:
unmatched_track_pool.append(track_pool[track_address])
else:
unmatched_track_pool = track_pool

next_lost_tracks = unmatched_track_pool.copy()

# Try to associate remained tracks with intermediate score detections
Expand Down Expand Up @@ -331,10 +335,10 @@ def linear_assignment(cost_matrix, thresh):
else:
row_ind, col_ind = linear_sum_assignment(cost_matrix)
matches = np.array([[row, col] for row, col in zip(row_ind, col_ind) if cost_matrix[row, col] <= thresh])
matched_rows = set(row_ind)
matched_cols = set(col_ind)
matched_rows = set(matches[:, 0]) if matches.size > 0 else set()
matched_cols = set(matches[:, 1]) if matches.size > 0 else set()
unmatched_a = np.array([i for i in range(cost_matrix.shape[0]) if i not in matched_rows])
unmatched_b = np.array([j for j in range(cost_matrix.shape[1]) if j not in matched_cols])

return matches, unmatched_a, unmatched_b