Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
anjugopinath opened this issue Mar 3, 2021 · 8 comments
Open

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

anjugopinath opened this issue Mar 3, 2021 · 8 comments

Comments

@anjugopinath
Copy link

On running the command, I am getting the below error:

File "/home/anju/CodeSpace/GanHand/utils/forward_kinematics_3dof.py", line 297, in get_hand
MANO.th_posedirs, th_pose_map.transpose(0, 1)).permute(2, 0, 1)
RuntimeError: mat1 dim 1 must match mat2 dim 0

@enriccorona
Copy link
Owner

Hi,
I updated the forward kinematics file and the model file with the last versions that I'm able to run at my PC. Could you try it again?
I think it's a matter of tensor shapes in the matmul operation. So, if it fails, could you look at the tensor shapes of MANO.th_posedirs and th_pose_map?

@hatimwen
Copy link

Hi,
I updated the forward kinematics file and the model file with the last versions that I'm able to run at my PC. Could you try it again?
I think it's a matter of tensor shapes in the matmul operation. So, if it fails, could you look at the tensor shapes of MANO.th_posedirs and th_pose_map?

Thanks a lot for your work. And when I try to run the latest test code you provided, this error also occurs.
And the tensor shapes you mentioned are as follows.

  • The tensor shapes of MANO.th_posedirs: torch.Size([778, 3, 135])
  • The tensor shapes of th_pose_map: torch.Size([51, 144])

@anjugopinath
Copy link
Author

Hi,
I updated the forward kinematics file and the model file with the last versions that I'm able to run at my PC. Could you try it again?
I think it's a matter of tensor shapes in the matmul operation. So, if it fails, could you look at the tensor shapes of MANO.th_posedirs and th_pose_map?

Hi,

I replaced the repo with the latest files. But, I am getting this error:

Traceback (most recent call last):
File "test.py", line 443, in
Test()
File "test.py", line 257, in init
self._display_visualizer_test(20, self._total_steps)
File "test.py", line 321, in _display_visualizer_test
self._model.forward(keep_data_for_visuals=True)
File "/home/anju/CodeSpace/GanHand/models/ganhand.py", line 229, in forward
handfullpose_list, touching_indexs, loss_distance, loss_angle, loss_angle_2ndjoint, loss_angle_3rdjoint = fk.optimize_hand(handfullpose[i].unsqueeze(0), R[i].unsqueeze(0), T[i].unsqueeze(0), self._input_obj_resampled_verts[i][self._input_object_id[i]])
File "/home/anju/CodeSpace/GanHand/utils/forward_kinematics_3dof.py", line 494, in optimize_hand
meshes, _ = get_hand(handfullpose_repeated, R.repeat(num_samples, 1), T.repeat(num_samples, 1))
File "/home/anju/CodeSpace/GanHand/utils/forward_kinematics_3dof.py", line 299, in get_hand
MANO.th_posedirs, th_pose_map.transpose(0, 1)).permute(2, 0, 1)
RuntimeError: mat1 dim 1 must match mat2 dim 0

So, I printed the shape

print( MANO.th_posedirs.shape,th_pose_map.shape,th_pose_map.transpose(0, 1).shape)

This is the result I got
torch.Size([778, 3, 135]) torch.Size([51, 144]) torch.Size([144, 51])

Could you tell me how to fix it please?

@yimingli1998
Copy link

Hi, I meet the same problem. Did you fix it?

@SeanChenxy
Copy link

Solved by issue #3

@lihuanihao
Copy link

Hi, I also encounter the same problem, how to solve it?

@lxhy9799
Copy link

Hi, I meet the same problem, can you help me?

@rather1015
Copy link

I solved this error. I found MANO.th_posedirs.shape is [778, 3, 135] and th_pose_map.shape is [51,144]. If th_pose_map.shape become [51,135], then the malmul is right. So I refered the hassony/manopth code, and found there are some different details in function manolayer.forward() , hassony'manolayer.forward() did 'th_pose_map = th_pose_map[:, 9:]',make th_pose_map.shape [1,144] become [1,135]. Now I can run the test.py. But I still don't get the right result until now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants