DeepLabV3Plus-Pytorch icon indicating copy to clipboard operation
DeepLabV3Plus-Pytorch copied to clipboard

load pretrained model error

Open onenerve opened this issue 2 years ago • 1 comments

RuntimeError: Error(s) in loading state_dict for DeepLabV3: size mismatch for classifier.classifier.3.weight: copying a param with shape torch.Size([21, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([3, 256, 1, 1]). size mismatch for classifier.classifier.3.bias: copying a param with shape torch.Size([21]) from checkpoint, the shape in current model is torch.Size([3]).

onenerve avatar Jun 03 '22 10:06 onenerve

I think this error means that your setting of "num_classes" isn't match with the trained weight.your datasets have three class,but the trained weight has 21 weight.try to replace the num_classes to 21i in the predict,best wishes!

zhangjiaxing679 avatar Aug 15 '22 06:08 zhangjiaxing679