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

[Bug] Unexpected prediction dimension (1x86) when nothing is detected (e.g., scream.jpg) #66

Closed
bearpaw opened this issue Jan 24, 2019 · 1 comment · May be fixed by #69
Closed

[Bug] Unexpected prediction dimension (1x86) when nothing is detected (e.g., scream.jpg) #66

bearpaw opened this issue Jan 24, 2019 · 1 comment · May be fixed by #69

Comments

@bearpaw
Copy link

bearpaw commented Jan 24, 2019

Hi, when I run python detect.py --images imgs --det det an error occurs when the input image is scream.jpg. The dimension of prediction is (1, 86)

$ python detect.py --images imgs --det det 
Loading network.....
Network successfully loaded
/home/weiy/anaconda2/envs/py37/lib/python3.7/site-packages/torch/nn/modules/upsampling.py:129: UserWarning: nn.Upsample is deprecated. Use nn.functional.interpolate instead.
  warnings.warn("nn.{} is deprecated. Use nn.functional.interpolate instead.".format(self.name))
messi.jpg            predicted in  0.028 seconds
Objects Detected:    person person person sports ball
----------------------------------------------------------
Traceback (most recent call last):
  File "detect.py", line 234, in <module>
    output = torch.cat((output,prediction))
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 86 and 8 in dimension 1 at /opt/conda/conda-bld/pytorch_1544202130060/work/aten/src/THC/generic/THCTensorMath.cu:83

It is fine if I test on scream.jpg only. But it is impossible to concat two predictions together (e.g., 4x8 tensor with 1x86 tensor).

I am using PyTorch 1.0. Therefore it might be caused by the updated version of pytorch.

------------------------------ UPDATE

Seems this problem happens when nothing is detected in the image. I use a blank image to test and got the same result.

download.jpg         predicted in  6.025 seconds
Objects Detected:    person
----------------------------------------------------------

SUMMARY
----------------------------------------------------------
Task                     : Time Taken (in seconds)

Reading addresses        : 0.000
Loading batch            : 0.098
Detection (1 images)     : 6.028
Output Processing        : 0.000
Drawing Boxes            : 0.007
Average time_per_img     : 6.133
----------------------------------------------------------

It's also interesting that there will be always a person detected in such kind of situation.

@bearpaw bearpaw changed the title [Bug] Unexpected prediction dimension (1x86) for scream.jpg [Bug] Unexpected prediction dimension (1x86) when nothing is detected (e.g., scream.jpg) Jan 24, 2019
@kickers18
Copy link

I met the same condition, so how to solve it? thx

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

Successfully merging a pull request may close this issue.

2 participants