utils

Utilities for animation data loading and dumping.

xrfeitoria.utils.anim.utils.dump_humandata(motion: SMPLXMotion, save_filepath: str | Path, meta_filepath: str | Path) None[source]

Dump human data to a file. This function must be associate with a meta file provided by SMPL-XL.

Parameters:
  • motion (SMPLXMotion) – Motion data to dump.

  • 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.

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'},  # optional
}
xrfeitoria.utils.anim.utils.load_amass_motion(input_amass_smplx_path: str | Path) SMPLXMotion[source]

Load AMASS SMPLX motion data. Only for SMPLX motion for now.

Parameters:

input_amass_smplx_path (PathLike) – Path to AMASS SMPLX motion data.

Returns:

Motion – 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.