Lavender105 / DFF

Code for Dynamic Feature Fusion for Semantic Edge Detection https://arxiv.org/abs/1902.09104
MIT License
218 stars 51 forks source link

RuntimeError: Error(s) in loading state_dict for ResNet: #12

Open achreff opened 4 years ago

achreff commented 4 years ago

Hi Have you an idea about this problem ? I think is about the size input compared to size input architecture Thank you Capture du 2019-12-20 16-58-09

griffintin commented 4 years ago

@achreff Have you solved the problem? I tried to test using provided whole model, and met similar error.

python test.py \ --eval \ --dataset cityscapes \ --model dff \ --checkname dff \ --resume-dir ../coef/dff_cityscapes_resnet101.pth.tar \ --workers 4 \ --backbone resnet101

the error is:

File "test.py", line 83, in test model.load_state_dict(checkpoint['state_dict'], strict=False) File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 769, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for DFF: size mismatch for pretrained.bn1.running_var: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for pretrained.bn1.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for pretrained.bn1.weight: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for pretrained.bn1.running_mean: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for pretrained.layer1.0.conv1.weight: copying a param with shape torch.Size([64, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([64, 128, 1, 1]). size mismatch for pretrained.layer1.0.downsample.0.weight: copying a param with shape torch.Size([256, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 128, 1, 1]).

griffintin commented 4 years ago

@Lavender105

Could take a look at the size mismatch problem, is there anything that i did in a wrong way?

achreff commented 4 years ago

Hi @griffintin I have solved this problem by using resnet152

I have some questions Could you please cite to me the version of cuda that you used (for me 10.2) On training I install torch and torch-encoding using pip3 and not using the install DFF project because the pytorch can't compile

but the prediction was not good at final on validation Can you send to me your configuration.