microsoft / voxelpose-pytorch

Official implementation of "VoxelPose: Towards Multi-Camera 3D Human Pose Estimation in Wild Environment"
MIT License
486 stars 92 forks source link

Getting size mismatch error when training on panoptic dataset #25

Open anthnyprschka opened 3 years ago

anthnyprschka commented 3 years ago

Hi there,

when I run python run/train_3d.py --cfg configs/panoptic/resnet50/prn64_cpn80x80x20_960x512_cam5.yaml I am getting the following error:

Traceback (most recent call last):
  File "run/train_3d.py", line 160, in <module>
    main()
  File "run/train_3d.py", line 107, in main
    config, is_train=True)
  File "/home/ubuntu/voxelpose-pytorch/run/../lib/models/multi_person_posenet.py", line 112, in get_multi_person_pose_net
    backbone = eval(cfg.BACKBONE_MODEL + '.get_pose_net')(cfg, is_train=is_train)
  File "/home/ubuntu/voxelpose-pytorch/run/../lib/models/pose_resnet.py", line 277, in get_pose_net
    model.init_weights(cfg.NETWORK.PRETRAINED_BACKBONE)
  File "/home/ubuntu/voxelpose-pytorch/run/../lib/models/pose_resnet.py", line 222, in init_weights
    self.load_state_dict(pretrained_state_dict)
  File "/home/ubuntu/voxelpose-pytorch/venv/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 PoseResNet:
    size mismatch for final_layer.weight: copying a param with shape torch.Size([17, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([15, 256, 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([15]).

Can anyone help? Is this an issue with JOINTS_DEF in lib/dataset/panoptic.py?

qbxlvnf11 commented 1 year ago

Would you change the setting of NUM_JOINTS?

Backbone of current model's number of the output joints is 15, but your loading pretrained weights of backbone is 17.