SMPL-X

repository·main·Indexed 25 days ago

https://github.com/vchoutas/smplx

A unified 3D body model that jointly represents the human body, face, and hands using linear blend skinning. The smplx package provides a framework for expressive human shape and pose modeling, including utilities to load SMPL-X, SMPL+H, and SMPL models, and a transfer_model module for converting meshes and parameters between these different model types.

Tokens
2.9K
Snippets
14
Records
22
Agent score
82%

What's inside smplx

  1. Convert SMPL meshes to SMPL+H parameters

    main

    To convert SMPL meshes (in .ply or .obj format) to SMPL+H parameters, use the transfer_model module with the smpl2smplh.yaml configuration.

    Note: This command must be run from the top directory of the repository. Update the path in the .yaml config to point to your SMPL meshes.

    python -m transfer_model --exp-cfg config_files/smpl2smplh.yaml
  2. Install the smplx package

    main

    You can install the smplx package via PyPI or by cloning the repository and using setup.py.

    Option 1: PyPI (Recommended)

    pip install smplx[all]

    Option 2: From Source

    git clone https://github.com/vchoutas/smplx
    python setup.py install
    pip install smplx[all]
  3. Remove Chumpy objects from model data

    main

    If you are working in a Python 2 virtual environment with Chumpy installed, you can use tools/clean_ch.py to remove any Chumpy objects from your model data files.

    python tools/clean_ch.py --input-models path-to-models/*.pkl --output-folder output-folder
  4. Prepare SMPL-H models for AMASS compatibility

    main

    To use the SMPL-H version required by AMASS (which uses 16 betas), follow these steps to merge the specific model versions:

    1. Download the zip folder from "Models & Code" and extract it to obtain the mano_v1_2 folder.
    2. Download the zip folder from "Extended SMPL+H model" and extract it to obtain the smplh folder.
    3. Run the merge script using the paths from the extracted folders.
    4. Copy the resulting .pkl file to your smplx_models/smplh/ directory.
    $ git clone https://github.com/vchoutas/smplx.git
    $ cd smplx
    $ python tools/merge_smplh_mano.py \
    --smplh-fn /path/to/smplh/female/model.npz \
    --mano-left-fn /path/to/mano_v1_2/models/MANO_LEFT.pkl \
    --mano-right-fn /path/to/mano_v1_2/models/MANO_RIGHT.pkl \
    --output-folder /path/to/smplh/merged
    
    cp /path/to/smplh/merged/model.pkl /path/to/smplx_models/smplh/SMPLH_FEMALE.pkl
  5. Convert SMPL-X meshes to SMPL parameters

    main

    To convert SMPL-X meshes (in .ply or .obj format) to SMPL parameters, use the main.py script with the smplx2smpl.yaml configuration.

    Important Constraints:

    • Update the path in smplx2smpl.yaml to point to your SMPL-X meshes.
    • When generating the input SMPL-X meshes, do not use hand and face parameters, as SMPL cannot model them and this information will be lost.
    python main.py --exp-cfg config_files/smplx2smpl.yaml
  6. Merge SMPL-H and MANO parameters

    main

    To use the PyTorch SMPL-H module, you must first merge the SMPL-H and MANO parameters into a single file. This requires having the SMPL-H files and the MANO files (left and right) available locally.

    python tools/merge_smplh_mano.py --smplh-fn SMPLH_FOLDER/SMPLH_GENDER.pkl \
     --mano-left-fn MANO_FOLDER/MANO_LEFT.pkl \
     --mano-right-fn MANO_FOLDER/MANO_RIGHT.pkl \
     --output-folder OUTPUT_FOLDER
  7. Convert SMPL-X meshes to SMPL+H parameters

    main

    To convert SMPL-X meshes (in .ply or .obj format) to SMPL+H parameters, use the transfer_model module with the smplx2smplh.yaml configuration.

    Important Constraints:

    • Update the path in the .yaml config to point to your SMPL-X meshes.
    • When generating the input SMPL-X meshes, do not use jaw pose and expression parameters.
    python -m transfer_model --exp-cfg config_files/smplx2smplh.yaml
  8. Convert SMPL+H meshes to SMPL-X parameters

    main

    To convert SMPL+H meshes (in .ply or .obj format) to SMPL-X parameters, use the transfer_model module with the smplh2smplx.yaml configuration.

    Note: This command must be run from the top directory of the repository. Update the path in the .yaml config to point to your SMPL+H meshes.

    python -m transfer_model --exp-cfg config_files/smplh2smplx.yaml
  9. Convert SMPL+H to SMPL-X

    main
    Since SMPL and SMPL+H share the same topology, the conversion process is simplified. To transfer SMPL+H annotations (such as AMASS motion capture data) to SMPL-X, use the existing correspondences established in the SMPL to SMPL-X mapping to estimate the SMPL-X parameters.
  10. Install the Model Parameter Transfer utility

    main

    To use the model parameter transfer tools, follow these steps:

    1. Install mesh.
    2. Clone the SMPL-X repository:
      git clone https://github.com/vchoutas/smplx.git
    3. Install Python dependencies:
      pip install -r requirements.txt
    4. Install the Torch Trust Region optimizer.
    5. Install the following additional packages:
      • loguru
      • open3d
      • omegaconf
    git clone https://github.com/vchoutas/smplx.git
    pip install -r requirements.txt
  11. Convert SMPL+H meshes to SMPL parameters

    main

    To convert SMPL+H meshes (in .ply or .obj format) to SMPL parameters, use the transfer_model module with the smplh2smpl.yaml configuration.

    Note: This command must be run from the top directory of the repository. Using this direction results in the loss of hand information.

    python -m transfer_model --exp-cfg config_files/smplh2smpl.yaml