stefanopini / simple-HRNet

Multi-person Human Pose Estimation with HRNet in Pytorch
GNU General Public License v3.0
579 stars 108 forks source link

RuntimeError: Error(s) in loading state_dict for HRNet: #103

Closed HanSeulChung closed 1 year ago

HanSeulChung commented 1 year ago

RuntimeError: Error(s) in loading state_dict for HRNet: size mismatch for final_layer.weight: copying a param with shape torch.Size([17, 48, 1, 1]) from checkpoint, the shape in current model is torch.Size([5, 48, 1, 1]). size mismatch for final_layer.bias: copying a param with shape torch.Size([17]) from checkpoint, the shape in current model is torch.Size([5]).

During transfer learning with a pretrained model, I received an error that the output layer stored in the check point is 17 by default and the number of keypoints I want to detect is 5, so it is different. The error doesn't go away even with strict=False. What should I do?

stefanopini commented 1 year ago

Hi @HanSeulChung , apologies for the late reply. Setting the parameter nof_joints to 5 should solve the issue, please comment and reopen the issue if that doesn't work.