smpl2bvh

repository·main·Indexed 42 days ago

https://github.com/kosukefukazawa/smpl2bvh

A utility script to convert SMPL (Skinned Multi-Person Linear) model motion data from .npz or .pkl files into BVH (Biovision Hierarchy) animation files. Supports AIST++ dataset formats and requires the smplx package.

Tokens
390
Snippets
2
Records
3
Agent score
3%

What's inside smpl2bvh

  1. Install requirements for smpl2bvh

    main

    To use this tool, you must install the smplx package with all dependencies via PyPi. Additionally, you must manually download the SMPL models and place them in the ./data/smpl/smpl/ directory.

    pip install smplx[all]
  2. Input file formats for --poses

    main

    The --poses argument accepts two types of files, each requiring specific internal keys and array shapes:

    1. .npz file

    Must contain the following keys:

    • rotations: An np.array of shape [fnum, 24, 3].
    • trans: An np.array of shape [fnum, 3] representing the root transition.

    2. .pkl file

    Must follow the AIST++ dataset format and contain:

    • smpl_poses: An np.array of shape [fnum, 72].
    • smpl_scaling: The scaling parameter.
    • smpl_trans: An np.array of shape [fnum, 3] representing the root transition.

    Note: fnum refers to the frame number.

  3. Convert SMPL to BVH using the CLI

    main

    Run the smpl2bvh.py script to convert SMPL motion data (from .npz or .pkl files) into a .bvh file.

    Arguments:

    • --gender: Specify the gender (e.g., MALE).
    • --poses: Path to the input .npz or .pkl file.
    • --fps: The frame rate for the output.
    • --output: Path where the resulting .bvh file will be saved.
    • --mirror: (Optional) If included, the mirrored motion will also be saved.
    python smpl2bvh.py --gender MALE --poses ${PATH_TO_Y0UR_INPUT} --fps 60 --output ${PATH_TO_SAVE} --mirror