NVlabs/SOMA-X
GitHub: NVlabs/SOMA-X
SOMA-X 是 NVIDIA 提出的一种统一的参数化人体模型拓扑与绑定框架,旨在消除 SMPL、SMPL-X 等主流人体模型之间的不兼容问题。
Stars: 579 | Forks: 38
开发者安装(使用 Git LFS 克隆)
### 使用 Git LFS 克隆(Assets 必需) 此仓库对大型 asset 文件(例如 assets/Nova_neutral.npz)使用了 Git LFS。你必须安装 Git LFS 才能下载实际数据;否则,你将遇到文件加载错误。 1. 安装 Git LFS(如果尚未安装): ``` git lfs install ``` 2. 克隆并拉取数据: ``` git clone https://github.com/NVlabs/SOMA-X.git cd SOMA-X git lfs pull ``` _(如果你已经克隆了仓库,只需运行 `git lfs pull` 即可获取缺失的 assets。)_ ### 准备 Python 环境 **Linux:** ``` pip install uv uv venv .venv source .venv/bin/activate # or: . .venv/bin/activate # 安装带有 CUDA 的 PyTorch — 调整版本 (cu124, cu126, cu130, …) # 以匹配你的 GPU 和驱动。参见 https://pytorch.org/get-started/locally/ uv pip install torch --index-url https://download.pytorch.org/whl/cu124 uv pip install ".[dev]" ``` **Windows (PowerShell):** ``` pip install uv uv venv .venv Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser # one-time setup .\.venv\Scripts\activate # 安装带有 CUDA 的 PyTorch — 调整版本 (cu124, cu126, cu130, …) # 以匹配你的 GPU 和驱动。参见 https://pytorch.org/get-started/locally/ uv pip install torch --index-url https://download.pytorch.org/whl/cu124 uv pip install ".[dev]" ``` 然后运行测试:`pytest tests/ -v`。 ### 可选依赖项 **对于 SMPL 和 SMPLX 支持:** ``` uv pip install ".[smpl]" pip install --no-build-isolation chumpy ``` _注意:`chumpy`(在 runtime 被 `smplx` 需要)的 PyPI 构建版本已损坏,必须使用 `--no-build-isolation` 安装。如果失败,请从源码安装:`pip install --no-build-isolation git+https://github.com/mattloper/chumpy@580566eafc9ac68b2614b64d6f7aaa8`_ 你还需要单独下载 `SMPL_NEUTRAL.pkl` 或 `SMPLX_NEUTRAL.npz`: 1. 访问 [SMPL](https://smpl.is.tue.mpg.de/) 或 [SMPLX](https://smpl-x.is.tue.mpg.de/) 网站。 2. 注册并下载 SMPL(适用于 Python 的 v1.1.0 版本)或 [SMPL-X](https://download.is.tue.mpg.de/download.php?domain=smplx&sfile=smplx_lockedhead_20230207.zip)(已移除头部发髻)模型文件。 3. 解压并将 `SMPL_NEUTRAL.pkl` 复制到 `./assets/SMPL/SMPL_NEUTRAL.pkl`,将 `SMPLX_NEUTRAL.npz` 复制到 `./assets/SMPLX/SMPLX_NEUTRAL.npz`。 **注意:** SMPL 模型受单独的许可证约束,不能随此仓库一起重新分发。 **对于 [Anny](https://github.com/naver/anny) 支持:** ``` uv pip install ".[anny]" ``` **对于 [GarmentMeasurements](https://github.com/mbotsch/GarmentMeasurements) 支持:** ``` git clone https://github.com/mbotsch/GarmentMeasurements python tools/convert_gm_pca_to_npz.py ./GarmentMeasurements/data/pca/point.pca assets/GarmentMeasurements/point.npz rm -rf GarmentMeasurements ```
```
# 将 SMPL 动画转换为 SOMA(渲染对比视频)
python -m tools.smpl2soma
# 将 SOMA poses 导出为 .npz
python -m tools.smpl2soma --output-npz out/smpl_soma.npz
# 调整 analytical 迭代次数(默认:--body-iters 2 --full-iters 1)
python -m tools.smpl2soma --body-iters 3 --full-iters 1 --batch-size 64
# Analytical + autograd FK 优化(最佳精度)
python -m tools.smpl2soma --body-iters 2 --full-iters 1 --autograd-iters 10
```
**基准测试**(402 帧 SMPL 帧,RTX 5000 Ada):
| 方法 | 速度 | 平均值 | 中位数 | 最大值 |
|---|---|---|---|---|
| Analytical (body=2, full=1) — **默认** | **1279 FPS** | 0.65 cm | 0.52 cm | 17.8 cm |
| Autograd FK (10 iters, lr=5e-3) | 199 FPS | 1.04 cm | 0.97 cm | 18.1 cm |
| Autograd FK (100 iters) | 18 FPS | 0.49 cm | 0.39 cm | 16.8 cm |
### MHR 到 SOMA
适用于 [SAM 3D Body](https://huggingface.co/datasets/facebook/sam-3d-body-dataset) 或类似的 MHR 格式数据。
```
# 转换包含 SAM 3D Body parquet 文件的目录
python -m tools.mhr2soma --input path/to/sam_3d_body/data/coco_train
# 转换并导出为 .npz
python -m tools.mhr2soma --input path/to/parquet_dir --output-npz out/mhr_soma.npz
# 调整 analytical 迭代次数(默认:--body-iters 2 --full-iters 1)
python -m tools.mhr2soma --input path/to/parquet_dir --max-samples 100 --body-iters 3
# Analytical + autograd FK 优化(最佳精度)
python -m tools.mhr2soma --input path/to/parquet_dir --autograd-iters 10
```
**基准测试**(200 个 SAM 3D Body 样本,RTX 5000 Ada):
| 方法 | 速度 | 平均值 | 中位数 | 最大值 |
|---|---|---|---|---|
| Analytical (body=2, full=1) — **默认** | **342 FPS** | 0.61 cm | 0.34 cm | 14.8 cm |
| Autograd FK (10 iters, lr=5e-3) | 161 FPS | 1.05 cm | 0.76 cm | 13.5 cm |
| Autograd FK (100 iters) | 16 FPS | 0.48 cm | 0.22 cm | 13.3 cm |
### AMASS 数据集到 SOMA
将 [AMASS](https://amass.is.tue.mpg.de/) 运动序列(SMPL 格式的 `.npz` 文件)转换为 SOMA。
```
# 单个文件 — 转换并渲染对比视频
python -m tools.convert_amass_to_soma --input path/to/amass_sequence.npz
# 单个文件 — 仅导出 .npz(跳过渲染)
python -m tools.convert_amass_to_soma --input path/to/amass_sequence.npz --output-npz out/soma.npz --no-render
# 批量转换整个数据集(镜像文件夹结构)
python -m tools.convert_amass_to_soma --input-dir /data/amass/ --output-dir out/amass_soma/
# 打乱文件顺序(在并行运行多个 worker 时很有用)
python -m tools.convert_amass_to_soma --input-dir /data/amass/ --output-dir out/amass_soma/ --shuffle
# 调整 analytical 迭代次数
python -m tools.convert_amass_to_soma --input path/to/seq.npz --body-iters 3 --full-iters 1
# Analytical + autograd FK 优化(最佳精度)
python -m tools.convert_amass_to_soma --input path/to/seq.npz --autograd-iters 10
```
输出的 `.npz` 文件包含:
- `poses`:每个关节的 `(N, J, 3)` 旋转向量
- `root_translation`:以米为单位的 `(N, 3)` 根节点位置
- `joint_names`:SOMA 关节名称列表
- `per_vertex_error`:每个顶点的 `(N, V)` 重建误差
- `identity_coeffs` / `scale_params`:使用的 identity 参数
**基准测试** (A100):
| 方法 | 速度 | 平均值 | 中位数 | 最大值 |
|---|---|---|---|---|
| Analytical (body=2, full=1) — **默认** | **17393 FPS** | 0.53 cm | 0.32 cm | 8.8 cm |
| Autograd FK (10 iters, lr=5e-3) | 435 FPS | 0.78 cm | 0.64 cm | 8.8 cm |
## 引用
如果你在你的工作中使用了此代码,请引用:
```
@article{soma2026,
title={SOMA: Unifying Parametric Human Body Models},
author={Jun Saito and Jiefeng Li and Michael de Ruyter and Miguel Guerrero and Edy Lim and Ehsan Hassani and Roger Blanco Ribera and Hyejin Moon and Magdalena Dadela and Marco Di Lucca and Qiao Wang and Xueting Li and Jan Kautz and Simon Yuen and Umar Iqbal},
eprint={2603.16858},
archivePrefix={arXiv},
year={2026},
url={https://arxiv.org/abs/2603.16858},
}
```
## 致谢
- [SMPL-Body](https://smpl.is.tue.mpg.de/bodylicense.html) 用于创建 SMPL 和 SOMA 网格拓扑之间的插值器,由马克斯·普朗克智能系统研究所提供。
- [MHR](https://github.com/facebookresearch/MHR) 用于学习 pose 修正模型。
- [Anny](https://github.com/naver/anny) 提供了基于 [WARP](https://github.com/NVIDIA/warp) 的稀疏线性混合蒙皮。
- [GarmentMeasurements](https://github.com/mbotsch/GarmentMeasurements) 用于扩充我们 shape 模型中的数据。
## 许可证
此代码库采用 [Apache-2.0](LICENSE) 许可。
本项目将下载并安装额外的第三方开源软件项目。在使用前,请查阅这些开源项目的许可条款。标签:3D动画, Python, Vectored Exception Handling, 凭据扫描, 参数化人体模型, 无后门, 计算机图形学, 计算机视觉, 逆向工具