VainF / DeepLabV3Plus-Pytorch

Pretrained DeepLabv3 and DeepLabv3+ for Pascal VOC & Cityscapes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

使用预训练加载模型,在这一行出现如下报错

wudandi opened this issue · comments

model.load_state_dict(checkpoint["model_state"])

Traceback (most recent call last):
File "main.py", line 383, in
main()
File "main.py", line 294, in main
model.load_state_dict(checkpoint["model_state"])
File "/home/ubuntu/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1483, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for DeepLabV3:
Missing key(s) in state_dict: "classifier.aspp.convs.1.0.body.0.weight", "classifier.aspp.convs.1.0.body.1.weight", "classifier.aspp.convs.2.0.body.0.weight", "classifier.aspp.convs.2.0.body.1.weight", "classifier.aspp.convs.3.0.body.0.weight", "classifier.aspp.convs.3.0.body.1.weight", "classifier.classifier.0.body.0.weight", "classifier.classifier.0.body.1.weight".
Unexpected key(s) in state_dict: "classifier.aspp.convs.1.0.weight", "classifier.aspp.convs.2.0.weight", "classifier.aspp.convs.3.0.weight", "classifier.classifier.0.weight".
size mismatch for classifier.classifier.3.weight: copying a param with shape torch.Size([21, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([2, 256, 1, 1]).
size mismatch for classifier.classifier.3.bias: copying a param with shape torch.Size([21]) from checkpoint, the shape in current model is torch.Size([2])