Zhongdao / UniTrack

[NeurIPS'21] Unified tracking framework with a single appearance model. It supports Single Object Tracking (SOT), Video Object Segmentation (VOS), Multi-Object Tracking (MOT), Multi-Object Tracking and Segmentation (MOTS), Pose Tracking, Video Instance Segmentation (VIS), and class-agnostic MOT (e.g. TAO dataset).
MIT License
334 stars 35 forks source link

Tensor size mismatch when running mot_demo.py with custom test image size #31

Closed UKeyboard closed 2 years ago

UKeyboard commented 2 years ago

I'd like to give it a try to run mot_demo.py with a custom test image size --tsize 800 600. Exception arises in this case and the message said: Sizes of tensors must match except in dimension 2. Got 75 and 76 (The offending index is 0)

No additional debug information is available, so it is difficult for me to find out which line of code throws this exception.

Here is my exp arguments and logs:

2022-04-04 01:35:38.341 | INFO     | __main__:main:135 - Args: Namespace(
asso_with_motion=True, 
ckpt='detector/YOLOX/weights/yolox_m.pth', 
classes=[0], conf=0.65, conf_thres=0.65, 
config='./config/imagenet_resnet18_s3.yaml', 
confirm_iou_thres=0.7, demo='video', device='cuda', 
down_factor=8, dup_iou_thres=0.15, 
exp_file='detector/YOLOX/exps/default/yolox_m.py', 
exp_name='imagenet_resnet18_s3', 
feat_size=[4, 10], gpu_id=0, 
im_mean=[0.485, 0.456, 0.406], im_std=[0.229, 0.224, 0.225], 
img_size=[800, 600], 
infer2D=True, iou_thres=0.5, min_box_area=200, 
model_type='imagenet18', 
mot_root='/home/wangzd/datasets/MOT/MOT16', 
motion_gated=True, motion_lambda=0.98, 
nms=0.3, nms_thres=0.4, 
nopadding=False, obid='FairMOT', 
output_root='./results/mot_demo', 
path='/workspace/project/samples/videos/G175647144539.mp4', 
prop_flag=False, remove_layers=['layer4'], 
resume='None', save_images=False, save_result=False, 
save_videos=True, test_mot16=False, track_buffer=30, 
tsize=[800, 600], use_kalman=True, workers=4)
[NULL @ 0x55b86843db00] PPS id out of range: 0
[hevc @ 0x55b86843db00] PPS id out of range: 0
Lenth of the video: 1107126 frames
2022-04-04 01:35:40.498 | INFO     | __main__:main:147 - Model Summary: Params: 25.33M, Gflops: 86.43
2022-04-04 01:35:45.542 | INFO     | __main__:main:150 - loading checkpoint
2022-04-04 01:35:45.888 | INFO     | __main__:main:154 - loaded checkpoint done.
[hevc @ 0x55b868566400] Could not find ref with POC 4
2022-04-04 01:35:46.662 | INFO     | __main__:eval_seq:100 - Processing frame 0 (100000.00 fps)
Sizes of tensors must match except in dimension 2. Got 75 and 76 (The offending index is 0)
...
UKeyboard commented 2 years ago

I found the way to work around this issue.

This is not a bug and it has nothing to do with UniTrack project. The exception arise because YOLOX requires its input has a 32x size, that is the input to YOLOx should have a size [32xn, 32xm].

So, in my case, I just have to set --tsize 800 608.

Plz refer https://github.com/Megvii-BaseDetection/YOLOX/issues/851 for more information.