Grad-CAM.pytorch icon indicating copy to clipboard operation
Grad-CAM.pytorch copied to clipboard

如何加载自己训练的权重文件

Open zhang0391 opened this issue 5 years ago • 4 comments

你好,请问怎么加载自己训练的模型的权重文件啊,我在输入自己的网络和权重文件路径之后,总是会出现以下错误,其中第二行很长我省略了后面的部分。 RuntimeError: Error(s) in loading state_dict for DenseNet: Missing key(s) in state_dict: "features.conv0.weight", Unexpected key(s) in state_dict: "state_dict".

zhang0391 avatar Mar 18 '20 12:03 zhang0391

@zhang0391 保持预测模型与训练模型一致。

yizt avatar Mar 19 '20 00:03 yizt

@zhang0391 https://discuss.pytorch.org/t/unexpected-key-in-state-dict-bn1-num-batches-tracked/29454/5

louis85911 avatar Apr 13 '20 10:04 louis85911

请问你是如何设置自己的网络和权重路径的,我加载模型总是出问题,非常感谢

Dtappledoghuati avatar May 16 '20 16:05 Dtappledoghuati

@Dtappledoghuati 把代码和问题都贴出来把

yizt avatar May 16 '20 23:05 yizt