RuntimeError: Error(s) in loading state_dict for vgg16:
While copying the parameter named "RCNN_rpn.RPN_cls_score.bias", whose dimensions in the model are torch.Size([18]) and whose dimensions in the checkpoint are torch.Size([24]).
While copying the parameter named "RCNN_rpn.RPN_cls_score.weight", whose dimensions in the model are torch.Size([18, 512, 1, 1]) and whose dimensions in the checkpoint are torch.Size([24, 512, 1, 1]).
While copying the parameter named "RCNN_rpn.RPN_bbox_pred.bias", whose dimensions in the model are torch.Size([36]) and whose dimensions in the checkpoint are torch.Size([48]).
While copying the parameter named "RCNN_rpn.RPN_bbox_pred.weight", whose dimensions in the model are torch.Size([36, 512, 1, 1]) and whose dimensions in the checkpoint are torch.Size([48, 512, 1, 1]).
While copying the parameter named "RCNN_cls_score.bias", whose dimensions in the model are torch.Size([21]) and whose dimensions in the checkpoint are torch.Size([81]).
While copying the parameter named "RCNN_cls_score.weight", whose dimensions in the model are torch.Size([21, 4096]) and whose dimensions in the checkpoint are torch.Size([81, 4096]).
While copying the parameter named "RCNN_bbox_pred.bias", whose dimensions in the model are torch.Size([84]) and whose dimensions in the checkpoint are torch.Size([324]).
While copying the parameter named "RCNN_bbox_pred.weight", whose dimensions in the model are torch.Size([84, 4096]) and whose dimensions in the checkpoint are torch.Size([324, 4096]).
RuntimeError: Error(s) in loading state_dict for vgg16:
While copying the parameter named "RCNN_rpn.RPN_cls_score.bias", whose dimensions in the model are torch.Size([18]) and whose dimensions in the checkpoint are torch.Size([24]).
While copying the parameter named "RCNN_rpn.RPN_cls_score.weight", whose dimensions in the model are torch.Size([18, 512, 1, 1]) and whose dimensions in the checkpoint are torch.Size([24, 512, 1, 1]).
While copying the parameter named "RCNN_rpn.RPN_bbox_pred.bias", whose dimensions in the model are torch.Size([36]) and whose dimensions in the checkpoint are torch.Size([48]).
While copying the parameter named "RCNN_rpn.RPN_bbox_pred.weight", whose dimensions in the model are torch.Size([36, 512, 1, 1]) and whose dimensions in the checkpoint are torch.Size([48, 512, 1, 1]).
问题原因:推理时使用的SCALES的数量和训练时不一样,将SCALES的数量改为和训练时一致,问题得到解决。
本文详细解析了在加载预训练模型时遇到的参数维度不匹配错误,并提供了具体的解决方案,指出推理时SCALES数量应与训练时保持一致。
582

被折叠的 条评论
为什么被折叠?



