dyhBUPT / StrongSORT

[TMM 2023] StrongSORT: Make DeepSORT Great Again
GNU General Public License v3.0
708 stars 75 forks source link

StrongSORT for known fixed number of objects to track #75

Closed ChrCoello closed 1 year ago

ChrCoello commented 1 year ago

Hi, I have a use case where I know the amount of objects to track at all time (N). There can be occlusions, but if waiting long enough, the objects we track will always reappear. I am trying to understand how to modify StrongSORT / SORT tracker to not create new tracks . I initialise the tracks with a certain number of frames where I know all N objects are visible.

The first try was to impeach the creation of any track after the first: Line 103 of tracker.py

for detection_idx in unmatched_detections:
    if self._next_id < (self.n_init+1):
        self._initiate_track(detections[detection_idx], classes[detection_idx].item(), confidences[detection_idx].item())

But this seems to be too stringent, as I only get 2 tracks as output, instead of N.

I see that some discussions in the SORT page relate to this, but there is no clear answer/tip into how to implement (https://github.com/abewley/sort/issues/157).

Any help is very appreciated, thanks in advance.

dyhBUPT commented 1 year ago

Hi, that's a new problem for me.

I may suggest the following methods upon StrongSORT:

  1. Limit the number of tracks matched or initialized per frame using N. For example N=5, at frame t, you have 3 tracked tracks and 3 new detections. Then you should delete one detection.
  2. Becasue objects will always reappear, you can add an extra matching procedure, which only uses appearance information.

Best wishes.

ChrCoello commented 1 year ago

@dyhBUPT very useful answer. I just had some time to implement the point 1. I indeed now only get N tracks, which is what I hoped to achieve. I am still trying to understand the point 2. of your answer, but for this I need to read more details about DeepSORT / StrongSORT. Thanks again for your answer.

dyhBUPT commented 1 year ago

Glad to hear that~