Skip to main content

MHR - Momentum Human Rig

A minimal Python package for the Momentum Human Rig - a parametric 3D human body model with identity, pose, and facial expression parameterization.

arXiv

Overview

MHR teaser

MHR (Momentum Human Rig) is a high-fidelity 3D human body model that provides:

  • Identity Parameterization: 45 shape parameters controlling body identity
  • Pose Parameterization: 204 model parameters for full-body articulation
  • Facial Expression: 72 expression parameters for detailed face animation
  • Multiple LOD Levels: 7 levels of detail (LOD 0-6) for different performance requirements
  • Non-linear Pose Correctives: Neural network-based pose-dependent deformations
  • PyTorch Integration: Differentiable inference and optimization on CPU or GPU
  • PyMomentum Integration: Compatible with fast CPU solver

Installation

Pixi is a conda-based package manager. This is the recommended installation method as it provides the most reliable environment setup.

# Clone the repository
git clone git@github.com:facebookresearch/MHR.git
cd MHR

# Install dependencies with Pixi
pixi install

# Download and unzip the model assets
pixi run download-assets

# Activate the environment
pixi shell

Option 2. Using the TorchScript model

# Install MHR
pip install mhr

# Download the torchscript model
mhr-download-assets --member assets/mhr_model.pt --output mhr_model.pt

# Start using the torchscript model

New to TorchScript model? In short it's a Graph mode of pytorch models. More details here. You can take ./demo.py as a reference to start using the torchscript model.

  • Advantage: no codebase or model assets are required.
  • Disadvantage: Currently only support for LOD 1; limited access to model properties.

Python 3.14: loading the TorchScript model works there with PyTorch 2.14 and gives the same output as on Python 3.12, but PyTorch marks TorchScript as not guaranteed to work on Python 3.14 (PyTorch 2.10 release notes). On Python 3.14, prefer MHR.from_files (Option 1).

Option 3. Using pip

Note: CI installs MHR with pip and checks the model on Ubuntu 22.04 and 24.04, macOS 15 (Apple silicon), and Windows with Python 3.12 and 3.13, and on Rocky Linux 9 with Python 3.12, with pymomentum-core and pymomentum-cpu, and on Linux also with CPU-only and CUDA 13 PyTorch (pip install workflow). PyMomentum 0.1.114 and older from PyPI can crash with a segmentation fault in MHR.from_files on Linux (#44); mhr[momentum] requires pymomentum-core 0.1.115 or newer. If you encounter issues, please use the recommended Pixi installation above.

PyMomentum's PyPI wheels cover Python 3.12 and 3.13 only. On Python 3.14, use Pixi or conda-forge pymomentum until PyMomentum publishes 3.14 wheels.

# Install MHR with PyMomentum (pymomentum-core, which works with any recent PyTorch)
pip install "mhr[momentum]"

# Download and unzip the model assets into ./assets
mhr-download-assets

Option 4. Using pip without PyMomentum (from v1.2.0)

From release v1.2.0 on, MHR also runs with PyTorch alone, from converted assets that each release publishes per LOD.

# Install MHR
pip install mhr

# Download the converted assets for LOD 1 into ./assets (about 25 MB)
mhr-download-assets --lod 1
import torch
from mhr import MHR  # needs no PyMomentum

mhr_model = MHR.from_files(device=torch.device("cpu"), lod=1)

mhr.MHR is the model for new code (PyTorch only). mhr.mhr.MHR is the PyMomentum-backed API that the tools use; it subclasses mhr.MHR. Both give the same vertices, skeleton states and gradients, and each loads the other's saved state. mhr.mhr and the tools that use PyMomentum directly (SMPL conversion, glTF export) still need PyMomentum.

Dependencies

  • Python >= 3.12 (CI tests 3.12, 3.13 and 3.14 with Pixi; pip needs Python 3.12 or 3.13, see Option 3)
  • PyTorch
  • pymomentum >= 0.1.89, for mhr.mhr and the tools (CI tests 0.1.114 with Pixi); with pip, pymomentum-core >= 0.1.115
  • trimesh >= 4.8.3 (for additional tools only: mhr-smpl conversion, LOD conversion and segmentation)

Quick Start

Run the Demo

python demo.py

This will generate a test MHR mesh and compare outputs with the TorchScript model.

The demo saves the mesh with trimesh. The Pixi environment includes it; with a pip install, run pip install "trimesh>=4.8.3,<6" first.

Visualization Demo

Visualization Notebook

Interactive Jupyter notebook for MHR visualization. See tools/mhr_visualization/README.md.

SMPL/SMPL-X Conversion

Conversion between MHR and SMPL/SMPL-X. See tools/mhr_smpl_conversion/README.md.

glTF Export

Export MHR poses and animations to glTF (.glb) for Blender and other tools. See tools/mhr_export/README.md.

Basic Usage

import torch
from mhr.mhr import MHR

# Load MHR model (LOD 1, on CPU)
mhr_model = MHR.from_files(device=torch.device("cpu"), lod=1)

# Define parameters
batch_size = 2
identity_coeffs = 0.8 * torch.randn(batch_size, 45)      # Identity
model_parameters = 0.2 * (torch.rand(batch_size, 204) - 0.5)  # Pose
face_expr_coeffs = 0.3 * torch.randn(batch_size, 72)     # Facial expression

# Generate mesh vertices and skeleton information (joint orientation and positions).
vertices, skeleton_state = mhr_model(identity_coeffs, model_parameters, face_expr_coeffs)

MHR.from_files() uses the first of these folders that contains the assets: assets in a source checkout, $MHR_ASSETS_DEST/assets, then ./assets, which is where mhr-download-assets extracts them. To use another folder, pass folder="path/to/assets".

Without PyMomentum, use from mhr import MHR with the converted assets instead (see Option 4); it takes the same arguments.

Computing gradients

Both the Python and TorchScript models support standard PyTorch autograd. Enable gradients only on the inputs you want to optimize before the forward pass, and keep gradient mode enabled; do not wrap the call in torch.no_grad() or torch.inference_mode():

identity_coeffs.requires_grad_()
model_parameters.requires_grad_()
face_expr_coeffs.requires_grad_()

vertices, skeleton_state = mhr_model(
    identity_coeffs,
    model_parameters,
    face_expr_coeffs,
)
loss = vertices.square().mean()
loss.backward()

The calls in demo.py use torch.no_grad() because that script performs inference only.

Model Parameters

Identity Parameters (identity_coeffs)

  • Shape: [batch_size, 45]
  • Description: The first 20 control body shape identity, second 20 control head, and the last 5 for hands.
  • Typical Range: -3 to +3 (zero-mean, unit variance)

Model Parameters (model_parameters)

  • Shape: [batch_size, 204]
  • Description: Joint angles and scalings

Expression Parameters (face_expr_coeffs)

  • Shape: [batch_size, 72]
  • Description: Artist-sculpted, sparse semantic blendshape weights that follow FACS. These are not PCA components or a one-to-one list of FACS Action Units.
  • Typical Range: -1 to +1
  • Names and indices: See the facial expression mapping, or import FACE_EXPRESSION_NAMES from mhr.

Project Structure

MHR/
├── assets                              # Assets (downloaded and unzipped from release)
│   ├── compact_v6_1.model              # Model parameterization
│   ├── corrective_activation.npz       # Pose corrective MLP sparse activations
│   ├── corrective_blendshapes_lod?.npz # Pose corrective blendshapes
│   ├── lod?.fbx                        # Rig with identity and expression blendshapes
│   └── mhr_model.pt                    # Torchscript model
├── demo.py                             # Basic demo script
├── mhr                                 # Main package
│   ├── _model.py                       # MHR model on PyTorch alone (from mhr import MHR)
│   ├── io.py                           # Asset loading utilities
│   ├── mhr.py                          # MHR model loaded with PyMomentum
│   └── utils.py                        # Helper functions
├── pyproject.toml                      # Pixi project configuration
├── tests                               # Unit tests
└── tools                               # Additional tools
    ├── mhr_export                      # glTF export
    ├── mhr_visualization               # Jupyter visualization
    └── mhr_smpl_conversion             # Conversion between MHR and SMPL/SMPL-X

Testing

Run the test suite:

# Run all tests: tests/ tests the mhr package, scripts/tests/ the maintainer scripts
pixi run test

# Run specific test
pixi run pytest tests/test_mhr.py

Inferring MHR parameters from images

If you want to do Human Motion Recovery with MHR, head to Sam3D.

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Code of Conduct

Please read our CODE_OF_CONDUCT.md before contributing.

Citation

If you use MHR in your research, please cite:

@misc{MHR:2025,
      title={MHR: Momentum Human Rig},
      author={Aaron Ferguson and Ahmed A. A. Osman and Berta Bescos and Carsten Stoll and Chris Twigg and Christoph Lassner and David Otte and Eric Vignola and Fabian Prada and Federica Bogo and Igor Santesteban and Javier Romero and Jenna Zarate and Jeongseok Lee and Jinhyung Park and Jinlong Yang and John Doublestein and Kishore Venkateshan and Kris Kitani and Ladislav Kavan and Marco Dal Farra and Matthew Hu and Matthew Cioffi and Michael Fabris and Michael Ranieri and Mohammad Modarres and Petr Kadlecek and Rawal Khirodkar and Rinat Abdrashitov and Romain Prévost and Roman Rajbhandari and Ronald Mallet and Russell Pearsall and Sandy Kao and Sanjeev Kumar and Scott Parrish and Shoou-I Yu and Shunsuke Saito and Takaaki Shiratori and Te-Li Wang and Tony Tung and Yichen Xu and Yuan Dong and Yuhua Chen and Yuanlu Xu and Yuting Ye and Zhongshi Jiang},
      year={2025},
      eprint={2511.15586},
      archivePrefix={arXiv},
      primaryClass={cs.GR},
      url={https://arxiv.org/abs/2511.15586},
}

License

MHR is licensed under the Apache Software License 2.0, as found in the LICENSE file.

Metadata

Release files for mhr 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mhr 1.2.1
File Size Uploaded Provenance Actions
mhr-1.2.1.tar.gz 5.2 MB With provenance Details for mhr-1.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mhr 1.2.1
File Interpreter ABI Platform Actions
mhr-1.2.1-py3-none-any.whl Python 3 none any Details for mhr-1.2.1-py3-none-any.whl

Total release size: 5.3 MB

Release files / mhr-1.2.1.tar.gz

Download URL mhr-1.2.1.tar.gz
Size 5.2 MB
Tags Source
SHA-256 checksum
How to use checksums
4eea76d87c4d7b1fcfabe977870c643d7e0703e803d7e0d175ef678bfa11d030
BLAKE2b-256 checksum
How to use checksums
6949a4c76589e5592620aea6ce4ac4b7d2ee05ea8326eaca6e79729fe7af83d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / mhr-1.2.1-py3-none-any.whl

Download URL mhr-1.2.1-py3-none-any.whl
Size 33.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d43f17cf0077d57ace4a6d529e6360e17da23ca897fa82d9e373b726a35d9cdb
BLAKE2b-256 checksum
How to use checksums
2680e3664cef07ac74ef7f3a63f36a732405ddd751a5f324783b8bcd04e4c94a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for mhr 1.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mhr-1.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page