utils
Utilities for animation data loading and dumping.
- xrfeitoria.utils.anim.utils.dump_humandata(motion: SMPLMotion | SMPLXMotion, save_filepath: str | Path, meta_filepath: str | Path, actor_name: str | None = None) None[source]
Dump human data to a file. This function must be associate with a meta file provided by SMPL-XL.
- Parameters:
motion (Union[SMPLMotion, SMPLXMotion]) – The motion data to be dumped.
save_filepath (PathLike) – The file path to save the dumped data.
meta_filepath (PathLike) – The file path to the meta information, storing the parameters of the SMPL-XL model.
actor_name (Optional[str], optional) – The name of the actor. Defaults to None.
Note
HumanData is a structure of smpl/smplx data defined in https://github.com/open-mmlab/mmhuman3d/blob/main/docs/human_data.md
The humandata file is a npz file containing the following keys:
humandata = { '__data_len__': n_frames, 'smplx': { 'betas': betas, # (1, 10) 'transl': transl, # (n_frames, 3) 'global_orient': global_orient, # (n_frames, 3) 'body_pose': body_pose, # (n_frames, 63) 'jaw_pose': jaw_pose, # (n_frames, 3) 'leye_pose': leye_pose, # (n_frames, 3) 'reye_pose': reye_pose, # (n_frames, 3) 'left_hand_pose': left_hand_pose, # (n_frames, 45) 'right_hand_pose': right_hand_pose, # (n_frames, 45) 'expression': expression, # (n_frames, 10) }, 'meta': {'gender': 'neutral', 'actor_name': '(XF)actor-001'}, # optional }
- xrfeitoria.utils.anim.utils.load_amass_motion(input_amass_smpl_x_path: str | Path, is_smplx: bool = True) SMPLMotion | SMPLXMotion[source]
Load AMASS SMPLX motion data. Only for SMPLX motion for now.
- Parameters:
input_amass_smpl_x_path (PathLike) – Path to AMASS SMPL/SMPLX motion data.
- Returns:
Union[SMPLMotion, SMPLXMotion] – Motion data, which consists of data read from AMASS file.
- xrfeitoria.utils.anim.utils.load_humandata_motion(input_humandata_path: str | Path) SMPLMotion | SMPLXMotion[source]
Load humandata SMPL / SMPLX motion data.
HumanData is a structure of smpl/smplx data defined in https://github.com/open-mmlab/mmhuman3d/blob/main/docs/human_data.md
- Parameters:
input_humandata_path (PathLike) – Path to humandata SMPL / SMPLX motion data.
- Returns:
Union[SMPLMotion, SMPLXMotion] – Motion data, which consists of data read from humandata file.
- xrfeitoria.utils.anim.utils.refine_smpl_x(smpl_x_filepath: Path, meta_filepath: Path, replace_smpl_x_file: bool = False, offset_location: ndarray = array([0., 0., 0.]), offset_rotation: ndarray = array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])) None[source]
Refine translation and rotation of SMPL-X parameters.