1.运行getget_map.py出现类似的问题:
Unexpected key(s) in state_dict: “backbone.backbone.stem.conv.conv.weight”,
…
size mismatch for module_list.88.Conv2d.weight: copying a param with shape torch.Size([256, 128, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 256 1, 1]).
解决办法:在加载模型的语句self.net.load_state_dict(torch.load(self.model_path, map_location=device))
之前加入self.net = torch.nn.DataParallel(self.net,device_ids=range(torch.cuda.device_count()))
2.在加入上述语句之后运行get_map.py时出现以下问题:
RuntimeError: Error(s) in loading state_dict for DataParallel:
Missing key(s) in state_dict: “module.backbone.backbone.stem.conv.conv.weight”, “module.backbone.backbone.dark3.1.m.7.conv1.bn.bias”,
解决办法:self.net.load_state_dict(torch.load(self.model_path, map_location=device))
3.前两个问题出现了新的问题:ValueError: not enough values to unpack (expected 2, got 0)
尚未解决,待续。。。。。
版权声明:本文为CSDN博主「zhangkik」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_42854823/article/details/122108668
暂无评论