HybrIK icon indicating copy to clipboard operation
HybrIK copied to clipboard

how to obtain pose and shape from the hybrik output

Open Holmes-Alan opened this issue 1 year ago • 7 comments

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.

Holmes-Alan avatar Jul 22 '22 00:07 Holmes-Alan

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

NewCoderQ avatar Jul 22 '22 01:07 NewCoderQ

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) pred_pose, _, _ = rotmat_to_aa(pred_pose)

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

Holmes-Alan avatar Jul 28 '22 05:07 Holmes-Alan

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

dongyangcai avatar Aug 18 '22 13:08 dongyangcai

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

luoww1992 avatar Sep 01 '22 08:09 luoww1992

@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))

kaufManu avatar Oct 20 '22 09:10 kaufManu

@kaufManu , i test it , you are right

luoww1992 avatar Oct 20 '22 09:10 luoww1992

@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?

freedom521jin avatar Oct 17 '23 09:10 freedom521jin