enriccorona / GanHand

PyTorch implementation for the paper GanHand: Predicting Human Grasp Affordances in Multi-Object Scenes (CVPR 2020 Oral)
72 stars 4 forks source link

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

Open anjugopinath opened 3 years ago

anjugopinath commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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.

anjugopinath commented 3 years ago

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 optimizehand 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 commented 3 years ago

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

SeanChenxy commented 3 years ago

Solved by issue #3

lihuanihao commented 2 years ago

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

lxhy9799 commented 2 years ago

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

rather1015 commented 8 months ago

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.