Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demo_track.py 球员id的问题 #16

Open
Accept-AI opened this issue Sep 19, 2024 · 1 comment
Open

demo_track.py 球员id的问题 #16

Accept-AI opened this issue Sep 19, 2024 · 1 comment

Comments

@Accept-AI
Copy link

您好,我在多个视频上运行demo_track.py时,发现不同视频的球员id是连续的。也就是说,第一个视频最后一个球员id是10的话,下一个视频的第一个球员id是11。请问如何调试代码,使得在跟踪新的视频时,球员id还是从1开始的?期待您的帮助,谢谢您

@ret-1
Copy link
Collaborator

ret-1 commented Oct 7, 2024

Hello @Xiyu-AI ,

You could refer to following functions:

for cur_iter, (origin_imgs, imgs, _, info_imgs, ids) in enumerate(
progress_bar(self.dataloader)
):
with torch.no_grad():
# init tracker
frame_id = info_imgs[2].item()
video_id = info_imgs[3].item()
img_file_name = info_imgs[4]
video_name = img_file_name[0].split('/')[0]
if video_name not in video_names:
video_names[video_id] = video_name
if frame_id == 1:
self.args = set_args(self.args, video_name)
if 'MOT17' in video_name:
self.args.alpha = 0.8778
self.args.iou_thresh = 0.2217
self.args.match_thresh = 0.7986
tracker.re_init(self.args)

While encountering a new video (L334), tracker.re_init is called to reset the variables.

def re_init(self, args, frame_rate=30):
BaseTrack._count = 0 # set to 0 for new video
self.tracked_stracks = [] # type: list[STrack]
self.lost_stracks = [] # type: list[STrack]
self.removed_stracks = [] # type: list[STrack]

To use our tracker, you need to modify demo_track.py since it remains the same as in original repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants