Missing key(s) in state_dict: “_conv_stem.weight”, “_bn0.weight”
Unexpected key(s) in state_dict: “module._conv_stem.weight”, “module._bn0.weight”,
生成的文件層名中多了module.前綴,原因是訓練的時候你調用了model = torch.nn.DataParallel(model).cuda()
採取多GPU訓練模型
解決方案1: 測試的時候加入model = torch.nn.DataParallel(model).cuda()
將定義的網絡結構層名前面加上module.
解決方案2:for key in state_dict.keys(): 遍歷每一層修改層名