PoolNet icon indicating copy to clipboard operation
PoolNet copied to clipboard

RuntimeError: Error(s) in loading state_dict for PoolNet

Open czHappy opened this issue 4 years ago • 3 comments

When I run test: python main.py --mode='test' --model='results/run-1/models/final.pth' --test_fold='results/run-1-sal-e' --sal_mode='e'

RuntimeError: Error(s) in loading state_dict for PoolNet: Unexpected key(s) in state_dict: "block.0.block_in1.0.weight", "block.0.block_in2.0.weight", "block.0.block_mid1.0.0.weight"... size mismatch for score.score.weight: copying a param with shape torch.Size([1, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([1, 128, 1, 1]).

my environment: torch=0.4.1 python=3.6.7

When I use pre-trained model of results/run-0/models/final.pth, no errors occur. Were the pre-trained models trained in the same pytorch version?

czHappy avatar Sep 02 '20 12:09 czHappy

Facing the same issue while testing the pre-trained model of joint training.

torch: 1.6.0 python: 3.6.9

Siddharth-Shrivastava7 avatar Sep 03 '20 17:09 Siddharth-Shrivastava7

Duplicate of #59

backseason avatar Sep 04 '20 02:09 backseason

Thank you, it worked out. Really appreciate your fast response!

Siddharth-Shrivastava7 avatar Sep 04 '20 03:09 Siddharth-Shrivastava7