NirAharon/BoT-SORT

Bug Report: duplicate STracks in the list tracker.removed_stracks

QiuZuowei opened this issue · 0 comments

I found duplicate STracks in the list tracker.removed_stracks after tracking a video with mc_bot_sort.py.
1703558864221

From the picture, it can be seen that except for the STracks with a length of only 1 frame, all other STracks will repeat once, which I believe is caused by this part of the code:

        """ Merge """
        self.tracked_stracks = [t for t in self.tracked_stracks if t.state == TrackState.Tracked]
        self.tracked_stracks = joint_stracks(self.tracked_stracks, activated_starcks)
        self.tracked_stracks = joint_stracks(self.tracked_stracks, refind_stracks)
        self.lost_stracks = sub_stracks(self.lost_stracks, self.tracked_stracks)
        self.lost_stracks.extend(lost_stracks)
        self.lost_stracks = sub_stracks(self.lost_stracks, self.removed_stracks)
        self.removed_stracks.extend(removed_stracks)
        self.tracked_stracks, self.lost_stracks = remove_duplicate_stracks(self.tracked_stracks, self.lost_stracks)

I think the sixth line in this part of the code should be changed to self.lost_stracks = sub_stracks(self.lost_stracks, removed_stracks)
Because in the current frame, the STracks marked as removed due to lost exceeding max_time_lost has not been updated to self.removed_stracks yet, self.lost_stracks = sub_stracks(self.lost_stracks, self.removed_stracks) cannot remove the STracks marked as removed from self.lost_stracks, resulting in being added to the self.removed_stracks again in the next frame.

According to my test, this change is effective.
image

I'm not sure if my change is correct. If there are any mistakes, I hope you can let me know.