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

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

Error:output is too small #15

Open Qrrrr opened 3 years ago

Qrrrr commented 3 years ago

I just followed the instruction of 'ReadMe', and run demo.py. But there comes an error: 'given input size(2048,7,7), calculate output size(2048,0,0), output is too small.' I change the size parameter from (224,224) to (512,512) and the program can finally run. So I want to ask what the proper size for the input image should be? Or are there any other solution to solve this error?

2014gaokao commented 3 years ago

https://github.com/2014gaokao/pedestrian-attribute-recognition-with-GCN/issues/6#issue-523313567 https://github.com/2014gaokao/pedestrian-attribute-recognition-with-GCN/issues/6#issuecomment-555352174 maybe the pytorch version. I have no idea.

thunanguyen commented 3 years ago

Yes, new torch version use torchvision 0.10.0 but the resnet101 in torchvision 0.3.0 is different from resnet101 in the new torchvision so it is actually the pretrained problem, you can change the line 54 in file models.py from nn.MaxPool2d(14, 14) to nn.MaxPool2d(7,7) and re-train it or it works quite well even with the provided author's pretrained model. A more complicated way in case you need to work with a new pytorch version but you want the behaviour from the old torchvision version is that you downgrade pytorch to 1.1.0 download the pretrained resnet101 and upgrade pytorch again and use the downloaded model. Sorry for my English.