THuman2.0-Dataset icon indicating copy to clipboard operation
THuman2.0-Dataset copied to clipboard

mesh_smplx.obj is not aligned with smplx_param.pkl on THuman2.1 dataset

Open TiantianWang opened this issue 10 months ago • 2 comments

Dear all,

I have extracted the smplx mesh ('mesh_smplx_myself.obj') from the smplx_param.pkl. However it seems that the mesh extracted by myself is not aligned with the given mesh_smplx.obj. Please see the visualization and code below on 0527. Could you give some insight about how to extract the same mesh as mesh_smplx.obj from .pkl ?

Thanks

fig1 fig2

model_init_params = dict(
    gender='male',
    model_type='smplx',
    model_path=SMPLX().model_dir,
    create_global_orient=False,
    create_body_pose=False,
    create_betas=False,
    create_left_hand_pose=False,
    create_right_hand_pose=False,
    create_expression=False,
    create_jaw_pose=False,
    create_leye_pose=False,
    create_reye_pose=False,
    create_transl=False,
    num_pca_comps=45, # 45 or 12
)

smpl_model = smplx.create(**model_init_params)

model_forward_params = dict(
    betas=param['betas'],
    global_orient=param['global_orient'],
    body_pose=param['body_pose'],
    left_hand_pose=param['left_hand_pose'],
    right_hand_pose=param['right_hand_pose'],
    jaw_pose=param['jaw_pose'],
    leye_pose=param['leye_pose'],
    reye_pose=param['reye_pose'],
    expression=param['expression'],
    transl=param['transl'],
    return_verts=True
)
smpl_out = smpl_model(**model_forward_params)
smpl_verts = ((smpl_out.vertices[0] * param['scale']) * scale).detach()
smpl_joints = ((smpl_out.joints[0] * param['scale']) * scale).detach()
rescale_fitted_body = trimesh.Trimesh(smpl_verts, smpl_model.faces, process=False, maintain_order=True)
scale = 100
smplx_file = 'mesh_smplx_myself.obj'
trimesh.Trimesh(rescale_fitted_body.vertices / scale,
                rescale_fitted_body.faces).export(smplx_file)

TiantianWang avatar Apr 15 '24 04:04 TiantianWang