weixin_39806065
weixin_39806065
2021-01-08 22:00

size mismatch for prediction_layers.0.conf_layer.weight

hi dbolya I had trained the model with custom data set,with 6 classes. i had made the alteration in config.py file, which was given in the Readme, and i successfully completed the training process for 800 iteration and i got the weight files also yolact_base_133_800.pth

config.py ` Training params

'lr_steps': (280, 600, 700, 750),
'max_iter': 800,`

While Evaluating it with the script eval.py with the trained weight file it showing the error

Loading model...Traceback (most recent call last): File "eval.py", line 1098, in net.load_weights(args.trained_model) File "/home/user_reorder01/Sai_Subramani/Programs/YOLACT/yolact/yolact.py", line 490, in load_weights self.load_state_dict(state_dict) File "/home/user_reorder01/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 830, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for Yolact: size mismatch for prediction_layers.0.conf_layer.weight: copying a param with shape torch.Size([21, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([24, 256, 3, 3]). size mismatch for prediction_layers.0.conf_layer.bias: copying a param with shape torch.Size([21]) from checkpoint, the shape in current model is torch.Size([24]). size mismatch for semantic_seg_conv.weight: copying a param with shape torch.Size([6, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([7, 256, 1, 1]). size mismatch for semantic_seg_conv.bias: copying a param with shape torch.Size([6]) from checkpoint, the shape in current model is torch.Size([7]).

Originally posted by in https://github.com/dbolya/yolact/issues/200#issuecomment-579623536

该提问来源于开源项目:dbolya/yolact

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

5条回答

  • adamlambert1 adamlambert1 1月前

    我的报错和您一样,请问您解决了吗

    点赞 评论 复制链接分享
  • weixin_39547298 weixin_39547298 3月前

    Have you added a class after training or something? It looks like you originally had 6 (+1) classes and now you have 7 (+1). (+1s for the extra background class)

    点赞 评论 复制链接分享
  • weixin_39806065 weixin_39806065 3月前

    No i too had that doubt, but i cross checked with that and it has only 6 classes

    点赞 评论 复制链接分享
  • weixin_39806065 weixin_39806065 3月前

    Have you added a class after training or something? It looks like you originally had 6 (+1) classes and now you have 7 (+1). (+1s for the extra background class)

    thanks for the reply

    点赞 评论 复制链接分享
  • weixin_39806065 weixin_39806065 3月前

    ya in config file the labels are not added. thanks for the reply

    点赞 评论 复制链接分享

为你推荐