zaki1003 / YOLO-CROWD

YOLO-CROWD is a lightweight crowd counting and face detection model that is based on Yolov5s and can run on edge devices, as well as fixing the problems of face occlusion, varying face scales, and other challenges of crowd counting
MIT License
16 stars 6 forks source link

Inconsistent Prediction #1

Open mru4913 opened 9 months ago

mru4913 commented 9 months ago
image 3/3 /YOLO-CROWD/../p2pnet/crowd_counting/test3.jpg: 
torch.Size([1, 3, 304, 640]) # resize by yolo code 
Traceback (most recent call last):
  File "detect.py", line 282, in <module>
    detect()
  File "detect.py", line 103, in detect
    pred = model(img, augment=opt.augment)[0]
  File "/home/casxm/anaconda3/envs/prod_env2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/casxm/albert/YOLO-CROWD/models/yolo.py", line 124, in forward
    return self.forward_once(x, profile, visualize)  # single-scale inference, train
  File "/home/casxm/albert/YOLO-CROWD/models/yolo.py", line 140, in forward_once
    x = m(x)  # run
  File "/home/casxm/anaconda3/envs/prod_env2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "/xxxx/YOLO-CROWD/models/common.py", line 714, in forward
    return torch.cat(x, self.d)
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 20 but got size 19 for tensor number 1 in the list.

The error appears when I detect some images from the Internet. So far I haven't located the bug. I'll continue dig into this issue. If you know anything about this, please let me now.

Abdulwadood39 commented 4 months ago

@mru4913 Did you find any solution for this?

newmg commented 3 months ago
    # self.stride = int(self.model.stride.max())
    self.stride = max(32,int(self.model.stride.max()))