sort
sort copied to clipboard
SORT ID for new detection between other old detections
Assume a scenario where SORT tracks by giving 2 IDs to 2 detections as shown.
now there is a new detection in blue, SORT returns tracking ID in this sequence. How do i get 1,3,2 instead of 1,2,3 shown?
# SORT parameters
max_age = 300 # Maximum number of frames to keep alive a track without associated detections
min_hits = 0 # Minimum number of associated detections before track is initialised; 0 so any new detections also counted as a track
iou_threshold = 0.3 # Minimum IOU for match
# create instance of the SORT tracker
sort_tracker = sort.Sort(max_age=max_age,
min_hits=min_hits,
iou_threshold=iou_threshold)
faces = detection.get(frame)
faces = sorted(faces , key = lambda x : x.bbox[0])
dets = np.asarray([np.append(face['bbox'].astype(int).tolist(), face['det_score']).tolist() for face in faces])
track_bbs_ids = sort_tracker.update(dets)
================== Update: I realised that passing all the detections into SORT to update gives a sorted list based on their tracking ID. Is there a way to have them be arranged based on the order of detections instead? Besides passing detections into SORT update 1-by-1.