bharat-b7 / RVH_Mesh_Registration

Code to fit SMPL model to scans
179 stars 21 forks source link

RuntimeError: mat1 dim 1 must match mat2 dim 0 #16

Closed JudCF closed 1 year ago

JudCF commented 1 year ago

Hi, I am getting the following error when trying to run fit_SMPLH_IPNet.py on the test scan:

Optimizing SMPL global orientation: 0%| | 0/30 [00:00<?, ?it/s] Traceback (most recent call last): File "smpl_registration/fit_SMPLH_IPNet.py", line 325, in main(args) File "smpl_registration/fit_SMPLH_IPNet.py", line 289, in main fitter.fit([args.scan_path], None, None, args.gender, args.save_path) File "smpl_registration/fit_SMPLH_IPNet.py", line 109, in fit self.optimize_pose_only(th_scan_meshes, smpl, iterations, steps_per_iter, parts_th, smpl_part_labels) File "smpl_registration/fit_SMPLH_IPNet.py", line 152, in optimize_pose_only loss_dict = self.forward_step(th_scan_meshes, split_smpl, scan_parts, smpl_parts) File "smpl_registration/fit_SMPLH_IPNet.py", line 221, in forwardstep verts, , , = smpl() File "/home/user1/.conda/envs/testenv/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, *kwargs) File "/home/user1/Documents/MeshReg2/RVH_Mesh_Registration/lib/smpl/wrapper_pytorch.py", line 180, in forward th_offsets=self.offsets) File "/home/user1/.conda/envs/testenv/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(input, **kwargs) File "/home/user1/Documents/MeshReg2/RVH_Mesh_Registration/lib/smpl/smplpytorch/smplpytorch/pytorch/smpl_layer.py", line 111, in forward th_v_shaped = self.th_v_template + torch.matmul(self.th_shapedirs, th_betas.transpose(1, 0)).permute(2, 0, 1) RuntimeError: mat1 dim 1 must match mat2 dim 0

I figured that it must be related to the dimension of th_betas in smpl_layer.py (which is [1,10], although I think that it should be [1,300]).

Could you please point out if I am doing something wrong or if there is anything I should adjust within the code?

jizhu1023 commented 1 year ago

same problem

JudCF commented 1 year ago

The SMPL model version from their instructions is wrong. I used the same solution as proposed in issue #9