maskrcnn报错:Error(s) in loading state_dict for GeneralizedRCNN

RuntimeError: Error(s) in loading state_dict for GeneralizedRCNN:
        size mismatch for roi_heads.box.predictor.cls_score.weight: copying a param with shape torch.Size([6, 1024]) from checkpoint, the shape in cur  File "D:\Anaconda3\envs\maskrcnn_benchmark\lib\site-packages\torch\nn\modules\module.py", line 1045,ite-packages\torch\nn\modules\module.py
    self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for GeneralizedRCNN:
        size mismatch for roi_heads.box.predictor.cls_score.weight: copying a param with shape torch.Size([6, 1024]) from checkpoint, the shape in current model is torch.Size([2, 1024]).
        size mismatch for roi_heads.box.predictor.cls_score.bias: copying a param with shape torch.Size([6]) from checkpoint, the shape in current model is torch.Size([2]).
        size mismatch for roi_heads.box.predictor.bbox_pred.weight: copying a param with shape torch.Size([24, 1024]) from checkpoint, the shape in current model is torch.Size([8, 1024]).
        size mismatch for roi_heads.box.predictor.bbox_pred.bias: copying a param with shape torch.Size([24]) from checkpoint, the shape in current model is torch.Size([8]).
        size mismatch for roi_heads.mask.predictor.mask_fcn_logits.weight: copying a param with shape torch.Size([6, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([2, 256, 1, 1]). 
        size mismatch for roi_heads.mask.predictor.mask_fcn_logits.bias: copying a param with shape torch.Size([6]) from checkpoint, the shape in current model is torch.Size([2]).

为什么我换了数据集,改了defaults.py里面的NUM_CLASS,但是还是有问题呢,仔细一想一开始一怒之下我删除了之前运行时生成的pth
maskrcnn报错:Error(s) in loading state_dict for GeneralizedRCNN_第1张图片
然后报了新的错误:

FileNotFoundError: [Errno 2] No such file or directory: '.\\model_0001400.pth'

双shfit查了查到底哪里在用这个发现了这个文件
在这里插入图片描述
删除时警告我说有些地方在用,目测是在运行新的数据集时使用了旧的网络参数
maskrcnn报错:Error(s) in loading state_dict for GeneralizedRCNN_第2张图片

你可能感兴趣的:(深度学习,pytorch,tensorflow)