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

Tensor size mismatch #32

Closed
Gateway2745 opened this issue Jun 3, 2022 · 1 comment
Closed

Tensor size mismatch #32

Gateway2745 opened this issue Jun 3, 2022 · 1 comment

Comments

@Gateway2745
Copy link

Gateway2745 commented Jun 3, 2022

@datvuthanh @xoiga123
Hi. I am receiving this error when I pass a .jpg input image of size (2160,4096,3) for testing. Can you please help me resolve this issue? Thank you!

Command I ran - python hybridnets_test.py -w weights/hybridnets.pth --source demo/image --output demo_result --imshow False --imwrite True

Traceback (most recent call last):
  File "hybridnets_test.py", line 121, in <module>
    features, regression, classification, anchors, seg = model(x)
  File "env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "folder/HybridNets/backbone.py", line 104, in forward
    features = self.bifpn(features)
  File "env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "env/lib/python3.8/site-packages/torch/nn/modules/container.py", line 141, in forward
    input = module(input)
  File "env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "folder/HybridNets/hybridnets/model.py", line 179, in forward
    outs = self._forward_fast_attention(inputs)
  File "folder/HybridNets/hybridnets/model.py", line 211, in _forward_fast_attention
    p5_up = self.conv5_up(self.swish(weight[0] * p5_in + weight[1] * self.p5_upsample(p6_up)))
RuntimeError: The size of tensor a (11) must match the size of tensor b (12) at non-singleton dimension 2
@datvuthanh
Copy link
Owner

Hi @Gateway2745 , this is because the input size need to have the ratio 32x. 2160 : 32 = 67.5 not integer. So, you must resize your input (my suggestion is the input is 640,384).

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

2 participants