py-soma-x 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. py_soma_x-0.1.3/LICENSE +201 -0
  2. py_soma_x-0.1.3/MANIFEST.in +6 -0
  3. py_soma_x-0.1.3/PKG-INFO +403 -0
  4. py_soma_x-0.1.3/README.md +358 -0
  5. py_soma_x-0.1.3/py_soma_x.egg-info/PKG-INFO +403 -0
  6. py_soma_x-0.1.3/py_soma_x.egg-info/SOURCES.txt +33 -0
  7. py_soma_x-0.1.3/py_soma_x.egg-info/dependency_links.txt +1 -0
  8. py_soma_x-0.1.3/py_soma_x.egg-info/requires.txt +30 -0
  9. py_soma_x-0.1.3/py_soma_x.egg-info/top_level.txt +1 -0
  10. py_soma_x-0.1.3/pyproject.toml +21 -0
  11. py_soma_x-0.1.3/setup.cfg +62 -0
  12. py_soma_x-0.1.3/setup.py +7 -0
  13. py_soma_x-0.1.3/soma/__init__.py +49 -0
  14. py_soma_x-0.1.3/soma/assets.py +32 -0
  15. py_soma_x-0.1.3/soma/correctives_model.py +252 -0
  16. py_soma_x-0.1.3/soma/geometry/__init__.py +2 -0
  17. py_soma_x-0.1.3/soma/geometry/_utils.py +40 -0
  18. py_soma_x-0.1.3/soma/geometry/_warp_init.py +41 -0
  19. py_soma_x-0.1.3/soma/geometry/align_vectors_warp.py +996 -0
  20. py_soma_x-0.1.3/soma/geometry/barycentric_interp.py +257 -0
  21. py_soma_x-0.1.3/soma/geometry/batched_skinning.py +321 -0
  22. py_soma_x-0.1.3/soma/geometry/chamfer_warp.py +215 -0
  23. py_soma_x-0.1.3/soma/geometry/interpolate.py +208 -0
  24. py_soma_x-0.1.3/soma/geometry/laplacian.py +550 -0
  25. py_soma_x-0.1.3/soma/geometry/lbs.py +108 -0
  26. py_soma_x-0.1.3/soma/geometry/lbs_warp.py +299 -0
  27. py_soma_x-0.1.3/soma/geometry/rig_utils.py +564 -0
  28. py_soma_x-0.1.3/soma/geometry/skeleton_transfer.py +821 -0
  29. py_soma_x-0.1.3/soma/geometry/transforms.py +384 -0
  30. py_soma_x-0.1.3/soma/identity_model.py +538 -0
  31. py_soma_x-0.1.3/soma/io.py +155 -0
  32. py_soma_x-0.1.3/soma/pose_inversion.py +1235 -0
  33. py_soma_x-0.1.3/soma/soma.py +397 -0
  34. py_soma_x-0.1.3/soma/units.py +26 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,6 @@
1
+ include LICENSE
2
+ include README.md
3
+ recursive-include soma *.py
4
+ prune assets
5
+ prune tools
6
+ prune tests
@@ -0,0 +1,403 @@
1
+ Metadata-Version: 2.4
2
+ Name: py-soma-x
3
+ Version: 0.1.3
4
+ Summary: SOMA body layer
5
+ Home-page: https://github.com/NVlabs/SOMA-X
6
+ Author: NVIDIA Corporation
7
+ License: Apache-2.0
8
+ Project-URL: Bug Tracker, https://github.com/NVlabs/SOMA-X/issues
9
+ Project-URL: Source Code, https://github.com/NVlabs/SOMA-X
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Scientific/Engineering
16
+ Requires-Python: >=3.8
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: numpy
20
+ Requires-Dist: scipy
21
+ Requires-Dist: torch
22
+ Requires-Dist: trimesh
23
+ Requires-Dist: warp-lang
24
+ Requires-Dist: rtree
25
+ Requires-Dist: cholespy
26
+ Requires-Dist: huggingface_hub
27
+ Provides-Extra: smpl
28
+ Requires-Dist: smplx; extra == "smpl"
29
+ Provides-Extra: anny
30
+ Requires-Dist: anny; extra == "anny"
31
+ Requires-Dist: Pillow; extra == "anny"
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest; extra == "dev"
34
+ Requires-Dist: ruff; extra == "dev"
35
+ Requires-Dist: pre-commit; extra == "dev"
36
+ Provides-Extra: demo
37
+ Requires-Dist: pyrender; extra == "demo"
38
+ Requires-Dist: tqdm; extra == "demo"
39
+ Requires-Dist: imageio[ffmpeg]; extra == "demo"
40
+ Provides-Extra: all
41
+ Requires-Dist: smplx; extra == "all"
42
+ Requires-Dist: anny; extra == "all"
43
+ Requires-Dist: Pillow; extra == "all"
44
+ Dynamic: license-file
45
+
46
+
47
+
48
+ <p align="center">
49
+ <img src="./assets/images/banner.png" alt="Banner" width="100%">
50
+ </p>
51
+
52
+
53
+ ## Overview
54
+
55
+ Parametric human body models, including SMPL, SMPL-X, MHR, Anny, and GarmentMeasurements, are central to a wide range of tasks in human reconstruction, animation, and simulation. However, these models are inherently incompatible: each defines its own mesh topology, joint hierarchy, and parameterization, precluding seamless integration. As a result, leveraging complementary strengths across models (such as combining Anny’s age-range control with SMPL-based motion data) necessitates bespoke adapters for every model pair, hindering interoperability and limiting practical applications.
56
+
57
+ We present **SOMA**—a canonical body topology and rig that acts as a universal pivot for all supported parametric human body models. Instead of replacing existing models, **SOMA unifies them** by mapping their diverse rest shapes onto a single, shared representation. This approach allows any supported identity model to be animated with a unified animation pipeline, eliminating the need for custom adapters or model-specific retargeting. With SOMA, you can mix and match identity sources and pose data at inference time without additional engineering. The entire pipeline remains end-to-end differentiable and GPU-accelerated via NVIDIA Warp.
58
+
59
+ See SOMA in action:
60
+
61
+ <p align="center">
62
+ <img src="assets/images/soma-in-action.gif" alt="SOMA in Action" width="1000"/>
63
+ </p>
64
+
65
+ ## Supported Identity Models
66
+
67
+ SOMA currently supports five distinct identity models, each offering unique capabilities:
68
+
69
+ 1. [MHR](https://github.com/facebookresearch/MHR): The default identity model in SOMA, providing high-fidelity body shape representation.
70
+ 2. [Anny](https://github.com/naver/anny): Particularly well-suited for modeling children, broadening applicability to younger subjects.
71
+ 3. [SMPL-Family](https://smpl.is.tue.mpg.de/): Supports both SMPL and SMPL-X models, enabling interoperability with established standards in the field.
72
+ 4. **SOMA-shape**: A proprietary PCA-based model developed as part of this project, designed to offer SMPL-like functionality with 128 PCA coefficients for identity representation.
73
+ 5. [GarmentMeasurement](https://github.com/mbotsch/GarmentMeasurements): A PCA-based identity model trained on the CASERS dataset, suitable for specialized use cases involving garment fitting and measurement.
74
+
75
+ We welcome community contributions to extend support for additional identity models.
76
+
77
+ ## Unified Pose Correctives (Beta)
78
+ Thanks to SOMA's unified framework, pose-dependent corrective deformations that mitigate LBS artifacts are seamlessly available for all supported identity models, including those that do not provide correctives themselves (e.g., Anny and GarmentMeasurement).
79
+ <p align="center">
80
+ <img src="assets/images/soma_correctives.gif" alt="SOMA Pose Correctives" width="800"/>
81
+ </p>
82
+
83
+
84
+
85
+ ## Installation
86
+
87
+ ### Install from PyPI
88
+
89
+ ```bash
90
+ pip install py-soma-x
91
+ ```
92
+
93
+ With optional extras:
94
+ ```bash
95
+ pip install "py-soma-x[smpl]" # SMPL/SMPL-X support
96
+ pip install "py-soma-x[anny]" # Anny support
97
+ ```
98
+
99
+ Assets are automatically downloaded from HuggingFace on first use (cached in `~/.cache/huggingface/hub/`).
100
+
101
+ > **Note:** SMPL/SMPL-X requires `chumpy`, which must be installed separately:
102
+ > ```bash
103
+ > pip install --no-build-isolation chumpy
104
+ > ```
105
+ > If that fails, install from source:
106
+ > ```bash
107
+ > pip install --no-build-isolation git+https://github.com/mattloper/chumpy@580566eafc9ac68b2614b64d6f7aaa8
108
+ > ```
109
+ >
110
+ > SMPL/SMPL-X model files (`SMPL_NEUTRAL.pkl`, `SMPLX_NEUTRAL.npz`) require a separate license and must be downloaded from [SMPL](https://smpl.is.tue.mpg.de/) / [SMPL-X](https://smpl-x.is.tue.mpg.de/). Pass the model path explicitly:
111
+ > ```python
112
+ > soma = SOMALayer(
113
+ > identity_model_type="smpl",
114
+ > identity_model_kwargs={"model_path": "/path/to/SMPL_NEUTRAL.pkl"},
115
+ > )
116
+ > ```
117
+
118
+ <details>
119
+
120
+ <summary>Developer installation (clone with Git LFS)</summary>
121
+
122
+ ### Clone with Git LFS (Required for Assets)
123
+ This repository uses Git LFS for large asset files (e.g., assets/Nova_neutral.npz). You must install Git LFS to download the actual data; otherwise, you will encounter file loading errors.
124
+
125
+ 1. Install Git LFS (if not installed):
126
+ ````bash
127
+ git lfs install
128
+ ````
129
+
130
+ 2. Clone and Pull Data:
131
+ ```bash
132
+ git clone https://github.com/NVlabs/SOMA-X.git
133
+ cd SOMA-X
134
+ git lfs pull
135
+ ```
136
+ _(If you already cloned the repo, just run `git lfs pull` to fetch the missing assets.)_
137
+
138
+ ### Prepare Python environment
139
+
140
+ **Linux:**
141
+ ```bash
142
+ pip install uv
143
+ uv venv .venv
144
+ source .venv/bin/activate # or: . .venv/bin/activate
145
+ # Install PyTorch with CUDA — adjust the version (cu124, cu126, cu130, …)
146
+ # to match your GPU and driver. See https://pytorch.org/get-started/locally/
147
+ uv pip install torch --index-url https://download.pytorch.org/whl/cu124
148
+ uv pip install ".[dev]"
149
+ ```
150
+
151
+ **Windows (PowerShell):**
152
+ ```powershell
153
+ pip install uv
154
+ uv venv .venv
155
+ Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser # one-time setup
156
+ .\.venv\Scripts\activate
157
+ # Install PyTorch with CUDA — adjust the version (cu124, cu126, cu130, …)
158
+ # to match your GPU and driver. See https://pytorch.org/get-started/locally/
159
+ uv pip install torch --index-url https://download.pytorch.org/whl/cu124
160
+ uv pip install ".[dev]"
161
+ ```
162
+ Then run tests: `pytest tests/ -v`.
163
+
164
+ ### Optional Dependencies
165
+
166
+ **For SMPL and SMPLX support:**
167
+
168
+ ```bash
169
+ uv pip install ".[smpl]"
170
+ pip install --no-build-isolation chumpy
171
+ ```
172
+ _NOTE: `chumpy` (required by `smplx` at runtime) has a broken PyPI build and must be installed with `--no-build-isolation`. If that fails, install from source: `pip install --no-build-isolation git+https://github.com/mattloper/chumpy@580566eafc9ac68b2614b64d6f7aaa8`_
173
+
174
+ You also need to download `SMPL_NEUTRAL.pkl` or `SMPLX_NEUTRAL.npz` separately:
175
+ 1. Visit the [SMPL](https://smpl.is.tue.mpg.de/) or [SMPLX](https://smpl-x.is.tue.mpg.de/) website.
176
+ 2. Register and download the SMPL (v1.1.0 for Python) or [SMPL-X](https://download.is.tue.mpg.de/download.php?domain=smplx&sfile=smplx_lockedhead_20230207.zip) (with removed head bun) model files.
177
+ 3. Extract and copy `SMPL_NEUTRAL.pkl` to `./assets/SMPL/SMPL_NEUTRAL.pkl` and `SMPLX_NEUTRAL.npz` to `./assets/SMPLX/SMPLX_NEUTRAL.npz`.
178
+
179
+ **Note:** The SMPL models are subject to a separate license and cannot be redistributed with this repository.
180
+
181
+ **For [Anny](https://github.com/naver/anny) support:**
182
+ ```bash
183
+ uv pip install ".[anny]"
184
+ ```
185
+
186
+ **For [GarmentMeasurement](https://github.com/mbotsch/GarmentMeasurements) support:**
187
+ ```bash
188
+ git clone https://github.com/mbotsch/GarmentMeasurements
189
+ python tools/convert_gm_pca_to_npz.py ./GarmentMeasurements/data/pca/point.pca assets/GarmentMeasurements/point.npz
190
+ rm -rf GarmentMeasurements
191
+ ```
192
+ </details>
193
+
194
+
195
+ ## Usage
196
+
197
+ ```python
198
+ import torch
199
+ from soma import SOMALayer
200
+
201
+ # Initialize the layer — assets are auto-downloaded from HuggingFace
202
+ soma = SOMALayer(
203
+ identity_model_type="mhr", # or "soma" "smpl", "smplx", "anny", "garment"
204
+ device="cuda"
205
+ )
206
+
207
+ # Or use a local assets directory
208
+ # soma = SOMALayer(data_root="./assets", identity_model_type="mhr", device="cuda")
209
+
210
+ # Forward pass
211
+ # poses: (B, num_joints, 3)
212
+ # identity: (B, num_coeffs)
213
+ # scale_params: (B, num_scales) - Optional, depending on model type (required for MHR)
214
+ output = soma(poses, identity, scale_params=scale_params)
215
+ vertices = output["vertices"]
216
+ ```
217
+
218
+ ## Running the Demo
219
+
220
+ Install the demo environment (includes pyrender, tqdm, imageio with ffmpeg for video output):
221
+
222
+ ```bash
223
+ uv pip install ".[demo]"
224
+ ```
225
+
226
+ If you want to run all identity models (soma, mhr, anny, smpl, smplx, garment), install the full set and use the same build steps as for tests:
227
+
228
+ ```bash
229
+ uv pip install -e ".[all,demo]"
230
+ pip install --no-build-isolation chumpy
231
+ ```
232
+
233
+ Then run the demo script:
234
+
235
+ ```bash
236
+ # Run all models (default: soma, mhr, anny, smpl, smplx, garment)
237
+ python tools/demo_soma_vis.py --data-root ./assets --output-dir ./out
238
+
239
+ # Run specific models only
240
+ python tools/demo_soma_vis.py --data-root ./assets --output-dir ./out --identity-model-type soma, mhr, smplx
241
+
242
+ # Run a single model
243
+ python tools/demo_soma_vis.py --data-root ./assets --output-dir ./out --identity-model-type anny
244
+
245
+ # Run MHR with random shapes
246
+ python tools/demo_soma_vis.py --data-root ./assets --output-dir ./out --identity-model-type mhr --random-shape
247
+ ```
248
+
249
+ This will generate example animation videos for the selected models in the `out/` directory.
250
+
251
+ **Demo Options:**
252
+ - `--identity-model-type`: Comma-separated list of models to use (options: `soma`, `mhr`, `anny`, `smplx`, `smpl`, `garment`, default: `soma,mhr,anny,smpl,smplx,garment`)
253
+ - `--random-shape`: Generate random body shapes instead of using neutral shapes
254
+ - `--motion-file`: Path to custom motion file (default: `assets/ROM5.npy`)
255
+ - `--image-size`: Render resolution (default: 1920)
256
+ - `--device`: Device to use (default: `cuda:0`)
257
+
258
+ ## Conversion of pose parameters from other models to SOMA
259
+ We provide conversion tools for converting from SMPL and MHR pose parameters to SOMA.
260
+ Both tools use `PoseInversion.fit()`, which supports two complementary solvers — both initialized by a single-pass skeleton transfer fit for fast convergence:
261
+
262
+ - **Analytical** (default): iterative inverse-LBS with Newton-Schulz refinement. Extremely fast (~1200 FPS) with comparable accuracy.
263
+ - **Autograd FK**: 6D rotation optimization by backpropagating FK + LBS. Slow but controllable (e.g. extra weights on extremities).
264
+
265
+ The two can be combined: the analytical solve warm-starts autograd refinement — best of both worlds.
266
+
267
+ ### SMPL to SOMA
268
+
269
+ <img src="assets/images/smpl2soma.gif" alt="SMPL to SOMA conversion" width="400"/>
270
+
271
+ ```bash
272
+ # Convert SMPL animation to SOMA (renders comparison video)
273
+ python -m tools.smpl2soma
274
+
275
+ # Export SOMA poses as .npz
276
+ python -m tools.smpl2soma --output-npz out/smpl_soma.npz
277
+
278
+ # Tune analytical iterations (defaults: --body-iters 2 --full-iters 1)
279
+ python -m tools.smpl2soma --body-iters 3 --full-iters 1 --batch-size 64
280
+
281
+ # Analytical + autograd FK refinement (best accuracy)
282
+ python -m tools.smpl2soma --body-iters 2 --full-iters 1 --autograd-iters 10
283
+ ```
284
+
285
+ **Benchmark** (402 SMPL frames, RTX 5000 Ada):
286
+
287
+ | Method | Speed | Mean | Median | Max |
288
+ |---|---|---|---|---|
289
+ | Analytical (body=2, full=1) — **default** | **1279 FPS** | 0.65 cm | 0.52 cm | 17.8 cm |
290
+ | Autograd FK (10 iters, lr=5e-3) | 199 FPS | 1.04 cm | 0.97 cm | 18.1 cm |
291
+ | Autograd FK (100 iters) | 18 FPS | 0.49 cm | 0.39 cm | 16.8 cm |
292
+
293
+ ### MHR to SOMA
294
+
295
+ <img src="assets/images/mhr2soma.gif" alt="MHR to SOMA conversion" width="400"/>
296
+
297
+ For [SAM 3D Body](https://huggingface.co/datasets/facebook/sam-3d-body-dataset) or similar MHR-format data.
298
+
299
+ ```bash
300
+ # Convert a directory of SAM 3D Body parquet files
301
+ python -m tools.mhr2soma --input path/to/sam_3d_body/data/coco_train
302
+
303
+ # Convert and export as .npz
304
+ python -m tools.mhr2soma --input path/to/parquet_dir --output-npz out/mhr_soma.npz
305
+
306
+ # Tune analytical iterations (defaults: --body-iters 2 --full-iters 1)
307
+ python -m tools.mhr2soma --input path/to/parquet_dir --max-samples 100 --body-iters 3
308
+
309
+ # Analytical + autograd FK refinement (best accuracy)
310
+ python -m tools.mhr2soma --input path/to/parquet_dir --autograd-iters 10
311
+ ```
312
+
313
+ **Benchmark** (200 SAM 3D Body samples, RTX 5000 Ada):
314
+
315
+ | Method | Speed | Mean | Median | Max |
316
+ |---|---|---|---|---|
317
+ | Analytical (body=2, full=1) — **default** | **342 FPS** | 0.61 cm | 0.34 cm | 14.8 cm |
318
+ | Autograd FK (10 iters, lr=5e-3) | 161 FPS | 1.05 cm | 0.76 cm | 13.5 cm |
319
+ | Autograd FK (100 iters) | 16 FPS | 0.48 cm | 0.22 cm | 13.3 cm |
320
+
321
+ > **Note:** The `mhr2soma` tool's end-to-end throughput (~50 samp/s) is dominated by MHR identity model evaluation, not SOMA inversion. The MHR TorchScript model is called twice per sample (once to produce the rest shape, once for posed vertices). The SOMA inversion itself runs at 342 FPS.
322
+
323
+ ### AMASS dataset to SOMA
324
+
325
+ Convert [AMASS](https://amass.is.tue.mpg.de/) motion sequences (SMPL format `.npz` files) to SOMA.
326
+
327
+ > **Prerequisites:** Download the AMASS dataset from [amass.is.tue.mpg.de](https://amass.is.tue.mpg.de/) and place `SMPL_NEUTRAL.pkl` in `assets/SMPL/` (see SMPL installation above).
328
+
329
+ ```bash
330
+ # Single file — converts and renders a comparison video
331
+ python -m tools.convert_amass_to_soma --input path/to/amass_sequence.npz
332
+
333
+ # Single file — export .npz only (skip rendering)
334
+ python -m tools.convert_amass_to_soma --input path/to/amass_sequence.npz --output-npz out/soma.npz --no-render
335
+
336
+ # Batch convert entire dataset (mirrors folder structure)
337
+ python -m tools.convert_amass_to_soma --input-dir /data/amass/ --output-dir out/amass_soma/
338
+
339
+ # Shuffle file order (useful when running multiple workers in parallel)
340
+ python -m tools.convert_amass_to_soma --input-dir /data/amass/ --output-dir out/amass_soma/ --shuffle
341
+
342
+ # Tune analytical iterations
343
+ python -m tools.convert_amass_to_soma --input path/to/seq.npz --body-iters 3 --full-iters 1
344
+
345
+ # Analytical + autograd FK refinement (best accuracy)
346
+ python -m tools.convert_amass_to_soma --input path/to/seq.npz --autograd-iters 10
347
+ ```
348
+
349
+ The output `.npz` files contain:
350
+ - `poses`: `(N, J, 3)` rotation vectors per joint
351
+ - `root_translation`: `(N, 3)` root position in meters
352
+ - `joint_names`: list of SOMA joint names
353
+ - `per_vertex_error`: `(N, V)` reconstruction error per vertex
354
+ - `identity_coeffs` / `scale_params`: identity parameters used
355
+
356
+
357
+ **Benchmark** (A100):
358
+
359
+ | Method | Speed | Mean | Median | Max |
360
+ |---|---|---|---|---|
361
+ | Analytical (body=2, full=1) — **default** | **17393 FPS** | 0.53 cm | 0.32 cm | 8.8 cm |
362
+ | Autograd FK (10 iters, lr=5e-3) | 435 FPS | 0.78 cm | 0.64 cm | 8.8 cm |
363
+
364
+
365
+ ## Related Human(oid) Work at NVIDIA
366
+ SOMA is part of a larger effort to enable human animation, robotics, physical AI, and other applications.
367
+
368
+ Check out these related works that already support SOMA:
369
+ * [GEM](https://github.com/NVlabs/GEM-X) - SOMA-based video pose estimation.
370
+ * [Kimodo](https://github.com/nv-tlabs/kimodo) - SOMA-based controllable text-to-motion generation method for **human(oid)s**.
371
+ * [BONES-SEED Dataset](https://huggingface.co/datasets/bones-studio/seed) - a large scale human(oid) motion capture dataset in SOMA format. Also provides retargeted G1 data.
372
+ * [SOMA Retargeter](https://github.com/NVIDIA/soma-retargeter) - for SOMA to G1 retargeting.
373
+ * [ProtoMotion](https://github.com/NVlabs/ProtoMotions) - simulation and learning framework for training physically simulated digital human(oid)s
374
+ * [GEAR SONIC](https://github.com/NVlabs/GR00T-WholeBodyControl) - a humanoid behavior foundation model. (coming soon)
375
+
376
+
377
+
378
+ ## Citation
379
+ If you use this code in your work, please cite:
380
+
381
+ ```bibtex
382
+ @article{soma2026,
383
+ title={SOMA: Unifying Parametric Human Body Models},
384
+ author={[AUTHORS TO BE FILLED]},
385
+ eprint={2603.XXXXX},
386
+ archivePrefix={arXiv},
387
+ year={2026},
388
+ url={https://arxiv.org/abs/2603.XXXXX},
389
+ }
390
+ ```
391
+
392
+ ## Acknowledgements
393
+ - [SMPL-Body](https://smpl.is.tue.mpg.de/bodylicense.html) was used to create an interpolator between SMPL and SOMA mesh topologies, courtesy of the Max Planck Institute for Intelligent Systems.
394
+ - [MHR](https://github.com/facebookresearch/MHR) was used to learn the pose corrective model.
395
+ - [Anny](https://github.com/naver/anny) for [WARP](https://github.com/NVIDIA/warp)-based sparse linear blend skinning.
396
+ - [GarmentMeasurement](https://github.com/mbotsch/GarmentMeasurements) was used to augment the data in our shape model.
397
+
398
+
399
+ ## License
400
+
401
+ This codebase is licensed under [Apache-2.0](LICENSE).
402
+
403
+ This project will download and install additional third-party open source software projects. Review the license terms of these open source projects before use.