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

Inconsistent Prediction #1

Open
mru4913 opened this issue Dec 12, 2023 · 2 comments
Open

Inconsistent Prediction #1

mru4913 opened this issue Dec 12, 2023 · 2 comments

Comments

@mru4913
Copy link

mru4913 commented Dec 12, 2023

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
Copy link

Abdulwadood39 commented May 7, 2024

@mru4913
Did you find any solution for this?

@newmg
Copy link

newmg commented Jun 14, 2024

    # self.stride = int(self.model.stride.max())
    self.stride = max(32,int(self.model.stride.max()))

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

3 participants