MCG-NJU/MixFormerV2

Inference Error

MUHAMMEDZEYN opened this issue · 3 comments

I managed to run video_demo.py and it is tracking very well but when it reaches frame 201 it crashes with this error:

`

Traceback (most recent call last):
File "/homeMixFormerV2/tracking/video_demo.py", line 53, in
main()
File "/homeMixFormerV2/tracking/video_demo.py", line 48, in main
run_video(args.tracker_name, args.tracker_param, args.videofile, args.optional_box, args.debug,
File "/homeMixFormerV2/tracking/video_demo.py", line 21, in run_video
tracker.run_video(videofilepath=videofile, optional_box=optional_box, debug=debug, save_results=save_results)
File "/homeMixFormerV2/tracking/../lib/test/evaluation/tracker.py", line 230, in run_video
out = tracker.track(frame)
File "/homeMixFormerV2/tracking/../lib/test/tracker/mixformer2_vit_online.py", line 98, in track
out_dict = self.network(self.template, self.online_template, search, softmax=True, run_score_head=True)
File "/home/pc4193/miniconda3/envs/mix2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/homeMixFormerV2/tracking/../lib/models/mixformer2_vit/mixformer2_vit_online.py", line 325, in forward
template, online_template, search, reg_tokens, distill_feat_list = self.backbone(template, online_template, search)
File "/home/pc4193/miniconda3/envs/mix2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/homeMixFormerV2/tracking/../lib/models/mixformer2_vit/mixformer2_vit_online.py", line 230, in forward
x = torch.cat([x_t, x_ot, x_s, reg_tokens], dim=1) # (b, hw+hw+HW+4, embed_dim)
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 1 but got size 2 for tensor number 1 in the list.`

I believe it is doing sth wrong when the template is updated but I could not figure it out, would you help me please with this ?

What's your running script?
I guess it is mainly because that current version of code does not support multiple online templates, so you should set the online_size parameter as 1.

Hi, I have fixed some setting, you can git pull to update the code. You can refer the new script in run_video_demo.py and try again.
Keep the --param___online_size 1. I'm examing multi-templates version and will release it when ready.

Thanks for your fast reply, it is working now.
I will be waiting for your update