ByteTrack icon indicating copy to clipboard operation
ByteTrack copied to clipboard

demo_track error with the custom dataset!!!help

Open Double-zh opened this issue 4 years ago • 6 comments

python3 demo_track.py video -f exps/example/custom/yolox_s.py -c YOLOX_outputs/yolox_s/best_ckpt.pth --fp16 --fuse --save_result

2021-10-27 21:24:20.586 | INFO | main:main:298 - Args: Namespace(camid=-1, ckpt='YOLOX_outputs/yolox_s/best_ckpt.pth', conf=None, demo='video', device='gpu', exp_file='exps/example/custom/yolox_s.py', experiment_name='yolox_s', fp16=True, fuse=True, match_thresh=0.8, min_box_area=10, mot20=False, name=None, nms=None, path='/home/xjt/zzh/pitaya_pic/big_6_3_1.MOV', save_result=True, track_buffer=30, track_thresh=0.5, trt=False, tsize=None)

2021-10-27 21:24:21.170 | INFO | main:main:308 - Model Summary: Params: 8.94M, Gflops: 26.64 2021-10-27 21:24:36.146 | INFO | main:main:319 - loading checkpoint 2021-10-27 21:24:37.293 | INFO | main:main:323 - loaded checkpoint done. 2021-10-27 21:24:37.293 | INFO | main:main:326 - Fusing model...

/home/xjt/anaconda3/envs/zzh/lib/python3.8/site-packages/torch/nn/modules/module.py:390: 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 gradient 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. if param.grad is not None: 2021-10-27 21:24:38.603 | INFO | main:imageflow_demo:238 - video save_path is ./YOLOX_outputs/yolox_s/track_vis/2021_10_27_21_24_37/big_6_3_1.MOV 2021-10-27 21:24:38.607 | INFO | main:imageflow_demo:248 - Processing frame 0 (100000.00 fps) Traceback (most recent call last):

File "demo_track.py", line 357, in main(exp, args) File "demo_track.py", line 350, in main imageflow_demo(predictor, vis_folder, current_time, args) File "demo_track.py", line 257, in imageflow_demo online_targets = tracker.update(outputs[0], [img_info['height'], img_info['width']], exp.test_size) File "/home/xjt/zzh/ByteTrack-main/yolox/tracker/byte_tracker.py", line 166, in update if output_results.shape[1] == 5: AttributeError: 'NoneType' object has no attribute 'shape'

Double-zh avatar Oct 27 '21 13:10 Double-zh

Thank you very much for pointing out the error. It is caused by empty outputs of the detection results. I have fixed it now!

ifzhang avatar Oct 28 '21 04:10 ifzhang

I am still running into the same error. I am using ByteTracker with the Docker container. I was able to succesfully build the container, execute the docker run command and enter the container.

From within the container, I am trying to either run the demo or run ByteTracker on a custom video like this:

python3 tools/demo_track.py video -f exps/example/mot/yolox_x_mix_det.py -c pretrained/bytetrack_x_mot17.pth.tar --fp16 --fuse --save_result

I get the same error even though I cloned the repository today... Any suggestions?

2021-11-23 02:23:58.609 | INFO     | __main__:main:291 - Args: Namespace(camid=0, ckpt='pretrained/bytetrack_x_mot17.pth.tar', conf=None, demo='video', device='gpu', exp_file='exps/example/mot/yolox_x_mix_det.py', experiment_name='yolox_x_mix_det', fp16=True, fuse=True, match_thresh=0.8, min_box_area=10, mot20=False, name=None, nms=None, path='./videos/palace.mp4', save_result=True, track_buffer=30, track_thresh=0.5, trt=False, tsize=None)
2021-11-23 02:23:59.242 | INFO     | __main__:main:301 - Model Summary: Params: 99.00M, Gflops: 791.73
2021-11-23 02:24:01.371 | INFO     | __main__:main:312 - loading checkpoint
2021-11-23 02:24:01.705 | INFO     | __main__:main:316 - loaded checkpoint done.
2021-11-23 02:24:01.705 | INFO     | __main__:main:319 - 	Fusing model...
/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py:561: 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 gradient 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 information.
  if param.grad is not None:
2021-11-23 02:24:02.216 | INFO     | __main__:imageflow_demo:236 - video save_path is ./YOLOX_outputs/yolox_x_mix_det/track_vis/2021_11_23_02_24_02/palace.mp4
2021-11-23 02:24:02.217 | INFO     | __main__:imageflow_demo:246 - Processing frame 0 (100000.00 fps)
Traceback (most recent call last):
  File "tools/demo_track.py", line 350, in <module>
    main(exp, args)
  File "tools/demo_track.py", line 343, in main
    imageflow_demo(predictor, vis_folder, current_time, args)
  File "tools/demo_track.py", line 250, in imageflow_demo
    online_targets = tracker.update(outputs[0], [img_info['height'], img_info['width']], exp.test_size)
  File "/workspace/ByteTrack/yolox/tracker/byte_tracker.py", line 166, in update
    if output_results.shape[1] == 5:
AttributeError: 'NoneType' object has no attribute 'shape'

FloWuenne avatar Nov 23 '21 02:11 FloWuenne

@ifzhang Any news on why this error still occurs?

FloWuenne avatar Nov 25 '21 21:11 FloWuenne

@ifzhang I get same error. I think If the detection model doesn't detect any region proposal, output of detection model is None and this None cause this error.

FUJITASHONO avatar Dec 01 '21 12:12 FUJITASHONO

Same error with empty output from custom detector.

kompaso avatar Mar 30 '22 07:03 kompaso

Fast fix: if custom_detector_res: online_targets = tracker.update(custom_detector_res, [img_info['height'], img_info['width']], exp.test_size) You can update tracker only if your detector returns anything.

kompaso avatar Mar 30 '22 07:03 kompaso