Jeff-sjtu / HybrIK

Official code of "HybrIK: A Hybrid Analytical-Neural Inverse Kinematics Solution for 3D Human Pose and Shape Estimation", CVPR 2021
MIT License
1.17k stars 142 forks source link

how to obtain pose and shape from the hybrik output #92

Open Holmes-Alan opened 1 year ago

Holmes-Alan commented 1 year ago

Thanks for your codes. I try to extract shape and pose for SMPL modeling. From your code, "pose_output" contains some parameters. How should I process it to extract pose and shape? I tried with "pose_output.shape" and "pose_output.xyz_jts_24" but it did not work.

NewCoderQ commented 1 year ago

You can get the output params by key names like this, pose_output.pred_shape

Holmes-Alan commented 1 year ago

Thanks for the comment. I wonder if I am using it correctly. I try to use the following code to transfer rot_mat to pose as pred_pose = output.rot_mats.float().reshape(-1, 4) pred_pose = quat_to_rotmat(pred_pose) predpose, , _ = rotmat_to_aa(pred_pose)

But using this pose and output.shape does not give me the correct SMPL body. Is there anything wrong?

dongyangcai commented 1 year ago

hello,i meet the same question,did you sloved it? how do i obtaion pose ooutput?

luoww1992 commented 1 year ago

@Holmes-Alan have you solved it ? i have the same question.

kaufManu commented 1 year ago

@Holmes-Alan This seems to have worked for me - you might have to make sure that the w of the quaternion is in the expected position. As far as I can tell, HybrIK assumes the quaternion layout to be [w, x, y z]. If you're using scipy for the conversion, you have to move the w to the end:

from scipy.spatial.transform import Rotation as R
hybrik_poses_quat = pose_output.pred_theta_mats.reshape((batch_size, -1, 4)).detach().cpu().numpy()
hybrik_poses_quat = hybrik_poses_quat[..., [1, 2, 3, 0]]
hybrik_poses = R.as_rotvec(R.from_quat(hybrik_poses_quat.reshape((-1, 4)))).reshape((batch_size, -1))
luoww1992 commented 1 year ago

@kaufManu , i test it , you are right

freedom521jin commented 9 months ago

@kaufManu , i test it , you are right

hi,i test with the code ,but i got the shape of hybrik_poses which is (1,162) How to use the hybrik_pose to the SMPL_model?