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

cv2.error #4

Closed
Kerwin0621 opened this issue Jul 6, 2022 · 5 comments
Closed

cv2.error #4

Kerwin0621 opened this issue Jul 6, 2022 · 5 comments

Comments

@Kerwin0621
Copy link

Thanks for your excellent work. I test the BoT-SORT on MOT17 and MOT20. It works and shows good results. But when I test on my own video dataset, it shows errors.
My video format is mp4, 3.6MiB, dimension is 1920 x 1080, 1.01 Mbits/s with 25fps. Here is the error:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------python tools/demo.py video -f yolox/exps/example/mot/yolox_x_mix_det.py -c yolox/pretrained/bytetrack_x_mot17.pth.tar --path ./videos/C06_1606.mp4 --with-reid --fp16 --fuse --save_result
2022-07-06 12:27:41.536 | INFO | main:main:305 - Args: Namespace(ablation=False, appearance_thresh=0.2, aspect_ratio_thresh=1.6, camid=0, ckpt='yolox/pretrained/bytetrack_x_mot17.pth.tar', cmc_method='orb', conf=None, demo='video', device=device(type='cuda'), exp_file='yolox/exps/example/mot/yolox_x_mix_det.py', experiment_name='yolox_x_mix_det', fast_reid_config='fast_reid/configs/MOT17/sbs_S50.yml', fast_reid_weights='fast_reid/pretrained/mot17_ablation_sbs_S50.pth', fp16=True, fps=30, fuse=True, fuse_score=False, match_thresh=0.8, min_box_area=10, mot20=True, name=None, new_track_thresh=0.7, nms=None, path='./videos/C06_1606.mp4', proximity_thresh=0.5, save_result=True, track_buffer=30, track_high_thresh=0.6, track_low_thresh=0.1, trt=False, tsize=None, with_reid=True)
/home/kerwin/miniconda3/envs/FairMOT/lib/python3.8/site-packages/torch/functional.py:568: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at /opt/conda/conda-bld/pytorch_1646755903507/work/aten/src/ATen/native/TensorShape.cpp:2228.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
2022-07-06 12:27:47.778 | INFO | main:main:315 - Model Summary: Params: 99.00M, Gflops: 793.21
2022-07-06 12:27:47.780 | INFO | main:main:323 - loading checkpoint
2022-07-06 12:27:49.678 | INFO | main:main:327 - loaded checkpoint done.
2022-07-06 12:27:49.678 | INFO | main:main:330 - Fusing model...
/home/kerwin/miniconda3/envs/FairMOT/lib/python3.8/site-packages/torch/_tensor.py:1104: UserWarning: The .grad attribute of a Tensor that is not a leaf Tensor is being accessed. Its .grad attribute won't be populated during autograd.backward(). If you indeed want the .grad field to be populated for a non-leaf Tensor, use .retain_grad() on the non-leaf Tensor. If you access the non-leaf Tensor by mistake, make sure you access the leaf Tensor instead. See github.com/pytorch/pytorch/pull/30531 for more informations. (Triggered internally at /opt/conda/conda-bld/pytorch_1646755903507/work/build/aten/src/ATen/core/TensorBody.h:475.)
return self._grad
2022-07-06 12:27:50.370 | INFO | main:imageflow_demo:228 - video save_path is ./YOLOX_outputs/yolox_x_mix_det/track_vis/2022_07_06_12_27_50/C06_1606.mp4
Skip loading parameter 'heads.weight' to the model due to incompatible shapes: (487, 2048) in the checkpoint but (0, 2048) in the model! You might want to double check if this is expected.
2022-07-06 12:27:51.439 | INFO | main:imageflow_demo:238 - Processing frame 0 (100000.00 fps)
Traceback (most recent call last):
File "tools/demo.py", line 366, in
main(exp, args)
File "tools/demo.py", line 354, in main
imageflow_demo(predictor, vis_folder, current_time, args)
File "tools/demo.py", line 251, in imageflow_demo
online_targets = tracker.update(detections, img_info)
File "/home/kerwin/temp/BoT-SORT/tracker/bot_sort.py", line 286, in update
warp = self.gmc.apply(img, dets)
File "/home/kerwin/temp/BoT-SORT/tracker/gmc.py", line 62, in apply
return self.applyFeaures(raw_frame, detections)
File "/home/kerwin/temp/BoT-SORT/tracker/gmc.py", line 205, in applyFeaures
H, inliesrs = cv2.estimateAffinePartial2D(prevPoints, currPoints, cv2.RANSAC)
cv2.error: OpenCV(4.6.0) /io/opencv/modules/calib3d/src/ptsetreg.cpp:1108: error: (-215:Assertion failed) count >= 0 && to.checkVector(2) == count in function 'estimateAffinePartial2D'

@NirAharon NirAharon reopened this Jul 6, 2022
@NirAharon
Copy link
Owner

Hi, please try to use the demo.py I uploaded today.
Please let me know if errors occur.

@ajtao
Copy link

ajtao commented Jul 7, 2022

In code just pulled right now, seeing same error after a few hundred frames of tracking successfully.

@NirAharon
Copy link
Owner

I found out that for cmc-method with ORB flag, the OpenCV function estimateAffinePartial2D could get too few matching points, which lead to an error.
I just updated the gmc.py code.
Thank you for your help.

@ajtao
Copy link

ajtao commented Jul 7, 2022

Thanks @NirAharon , this is almost exactly what i ended up doing too. Appreciate your quick help.

BotSORT has been quite a nice improvement for me on challenging sports tracking cases. Thank you for the great tech!

@duckaivn
Copy link

Hi @NirAharon , I just clone new code today, when demo I keep getting the same error. Can anyone help me figure out why?

[6:14 PM] Nguyen Minh Duc (QAI.DEL)
File "tools/demo.py", line 371, in
main(exp, args)
File "tools/demo.py", line 359, in main
imageflow_demo(predictor, vis_folder, current_time, args)
File "tools/demo.py", line 255, in imageflow_demo
online_targets = tracker.update(detections, img_info["raw_img"])
File "/home/Akacam/ducnm57/akacam_tracking/bot_tracking/tracker/bot_sort.py", line 285, in update
warp = self.gmc.apply(img, dets)
File "/home/Akacam/ducnm57/akacam_tracking/bot_tracking/tracker/gmc.py", line 62, in apply
return self.applyFeaures(raw_frame, detections)
File "/home/Akacam/ducnm57/akacam_tracking/bot_tracking/tracker/gmc.py", line 205, in applyFeaures
H, inliesrs = cv2.estimateAffinePartial2D(prevPoints, currPoints, cv2.RANSAC)
cv2.error: OpenCV(4.6.0) /io/opencv/modules/calib3d/src/ptsetreg.cpp:1108: error: (-215:Assertion failed) count >= 0 && to.checkVector(2) == count in function 'estimateAffinePartial2D

My command: python3 tools/demo.py video --path ./videos/cam1_ds.mp4 -f yolox/exps/example/mot/yolox_s_mix_det.py -c pretrained/bytetrack_s_mot17.pth.tar --with-reid --fuse-score --fp16 --fuse --save_result

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

4 participants