2014gaokao / pedestrian-attribute-recognition-with-GCN

Pytorch implementation of pedestrian attribute recognition with graph convolutional network
77 stars 17 forks source link

RuntimeError: Given input size: (2048x7x7). Calculated output size: (2048x0x0). Output size is too small #6

Closed kHarshit closed 4 years ago

kHarshit commented 4 years ago

Hi, I'm getting the following error on testing inference on an image.

Traceback (most recent call last):
  File "demo.py", line 34, in <module>
    score=model(img_trans,inp)
  File "/nfs/interns/kharshit/miniconda3/envs/pylatest/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in __call__
    result = self.forward(*input, **kwargs)
  File "/nfs/interns/kharshit/pedestrian-attribute-recognition-with-GCN/models.py", line 68, in forward
    feature = self.pooling(feature)
  File "/nfs/interns/kharshit/miniconda3/envs/pylatest/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in __call__
    result = self.forward(*input, **kwargs)
  File "/nfs/interns/kharshit/miniconda3/envs/pylatest/lib/python3.7/site-packages/torch/nn/modules/pooling.py", line 141, in forward
    self.return_indices)
  File "/nfs/interns/kharshit/miniconda3/envs/pylatest/lib/python3.7/site-packages/torch/_jit_internal.py", line 134, in fn
    return if_false(*args, **kwargs)
  File "/nfs/interns/kharshit/miniconda3/envs/pylatest/lib/python3.7/site-packages/torch/nn/functional.py", line 487, in _max_pool2d
    input, kernel_size, stride, padding, dilation, ceil_mode)
RuntimeError: Given input size: (2048x7x7). Calculated output size: (2048x0x0). Output size is too small

I don't understand why would the error come if the image is being resized to (224, 224) in demo.py.

Mantha-Cheung commented 4 years ago

I haven't run the demo.py,maybe you can print the output of layers,like the input tensor‘s shape.

kHarshit commented 4 years ago

Solved it by using pytorch 1.1. I was using pytorch 1.2 earlier.