Python
Weights, mhr_cont.py and training/assets under the SAM License; add LICENSE-SAM.
mohamdev40e8df2f65d2
diff --git a/LICENSE b/LICENSEindex 0b55932..3294f5b 100644--- a/LICENSE+++ b/LICENSE@@ -202,15 +202,48 @@================================================================================-THIRD-PARTY NOTICES----------------------The InstantHMR model weights distributed at-https://huggingface.co/momolesang/InstantHMR are released under the SAM-license, since the model is a distillation of Meta's SAM 3D Body-(https://github.com/facebookresearch/sam-3d-body). Refer to that-repository for the full SAM license text and applicable use restrictions.--The demo uses Roboflow's RF-DETR for person detection, which is-distributed under its own license. See https://github.com/roboflow/rf-detr+FILES UNDER OTHER LICENCES, AND THIRD-PARTY NOTICES+---------------------------------------------------++The Apache License above covers this repository except the files listed+below.++SAM License. These files are derived from Meta's SAM 3D Body+(https://github.com/facebookresearch/sam-3d-body) and from its annotations+(https://huggingface.co/datasets/facebook/sam-3d-body-dataset), which Meta+distributes under the SAM License. They are distributed under the SAM+License, whose full text is in LICENSE-SAM:++ training/mhr_cont.py transcribed from sam_3d_body/models/modules/+ mhr_utils.py and geometry_utils.py,+ Copyright (c) Meta Platforms, Inc. and affiliates+ training/assets/ tables extracted from the SAM 3D Body checkpoint+ (mhr_cont_head.npz, mhr_landmarks70.npz), or fitted+ to or measured on its annotations+ (mhr_j127_to_kp70.npy, mhr_size_bounds.npz,+ adapter_j14_h36m.npz)++Model weights. The InstantHMR weights at+https://huggingface.co/momolesang/InstantHMR are not part of this+repository. They are trained on the SAM 3D Body annotations and contain+tables from the SAM 3D Body checkpoint, so they are distributed under the+SAM License. The nano, tiny, small and medium weights are, in addition,+for non-commercial use only, because some of their training images (SA-1B,+AI Challenger, and COCO photos under non-commercial Flickr licences) are+licensed for research or non-commercial use only.++MHR. The body model is Meta's Momentum Human Rig+(https://github.com/facebookresearch/MHR), Copyright (c) Meta Platforms,+Inc. and affiliates, licensed under the Apache License 2.0. This repository+does not include it; the training and benchmark instructions download it+from the MHR release. mhr-body.onnx on Hugging Face contains it.++COCO. datasets_pipeline/assets/coco2014_train_licenses.csv lists the+licence id of COCO 2014 training images, taken from the COCO annotations,+which the COCO Consortium licenses under CC BY 4.0+(https://creativecommons.org/licenses/by/4.0/). The photos themselves keep+their own Flickr licences.++RF-DETR. The demo uses Roboflow's RF-DETR for person detection, which is+distributed under its own licence. See https://github.com/roboflow/rf-detrfor terms.diff --git a/LICENSE-SAM b/LICENSE-SAMnew file mode 100644index 0000000..e58d758--- /dev/null+++ b/LICENSE-SAM@@ -0,0 +1,52 @@+SAM License+Last Updated: November 19, 2025++“Agreement” means the terms and conditions for use, reproduction, distribution and modification of the SAM Materials set forth herein.++“SAM Materials” means, collectively, Documentation and the models, software and algorithms, including machine-learning model code, trained model weights, inference-enabling code, training-enabling code, fine-tuning enabling code, and other elements of the foregoing distributed by Meta and made available under this Agreement.++“Documentation” means the specifications, manuals and documentation accompanying+SAM Materials distributed by Meta.++“Licensee” or “you” means you, or your employer or any other person or entity (if you are entering into this Agreement on such person or entity’s behalf), of the age required under applicable laws, rules or regulations to provide legal consent and that has legal authority to bind your employer or such other person or entity if you are entering in this Agreement on their behalf.++“Meta” or “we” means Meta Platforms Ireland Limited (if you are located in or, if you are an entity, your principal place of business is in the EEA or Switzerland) or Meta Platforms, Inc. (if you are located outside of the EEA or Switzerland).++“Sanctions” means any economic or trade sanctions or restrictions administered or enforced by the United States (including the Office of Foreign Assets Control of the U.S. Department of the Treasury (“OFAC”), the U.S. Department of State and the U.S. Department of Commerce), the United Nations, the European Union, or the United Kingdom.++“Trade Controls” means any of the following: Sanctions and applicable export and import controls.++By using or distributing any portion or element of the SAM Materials, you agree to be bound by this Agreement.++1. License Rights and Redistribution.++a. Grant of Rights. You are granted a non-exclusive, worldwide, non-transferable and royalty-free limited license under Meta’s intellectual property or other rights owned by Meta embodied in the SAM Materials to use, reproduce, distribute, copy, create derivative works of, and make modifications to the SAM Materials.++i. Grant of Patent License. Subject to the terms and conditions of this License, you are granted a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by Meta that are necessarily infringed alone or by combination of their contribution(s) with the SAM 3 Materials. If you institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the SAM 3 Materials incorporated within the work constitutes direct or contributory patent infringement, then any patent licenses granted to you under this License for that work shall terminate as of the date such litigation is filed.++b. Redistribution and Use.++i. Distribution of SAM Materials, and any derivative works thereof, are subject to the terms of this Agreement. If you distribute or make the SAM Materials, or any derivative works thereof, available to a third party, you may only do so under the terms of this Agreement and you shall provide a copy of this Agreement with any such SAM Materials.++ii. If you submit for publication the results of research you perform on, using, or otherwise in connection with SAM Materials, you must acknowledge the use of SAM Materials in your publication.++iii. Your use of the SAM Materials must comply with applicable laws and regulations, including Trade Control Laws and applicable privacy and data protection laws.+iv. Your use of the SAM Materials will not involve or encourage others to reverse engineer, decompile or discover the underlying components of the SAM Materials.+v. You are not the target of Trade Controls and your use of SAM Materials must comply with Trade Controls. You agree not to use, or permit others to use, SAM Materials for any activities subject to the International Traffic in Arms Regulations (ITAR) or end uses prohibited by Trade Controls, including those related to military or warfare purposes, nuclear industries or applications, espionage, or the development or use of guns or illegal weapons.+2. User Support. Your use of the SAM Materials is done at your own discretion; Meta does not process any information nor provide any service in relation to such use. Meta is under no obligation to provide any support services for the SAM Materials. Any support provided is “as is”, “with all faults”, and without warranty of any kind.++3. Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE SAM MATERIALS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, AND META DISCLAIMS ALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE SAM MATERIALS AND ASSUME ANY RISKS ASSOCIATED WITH YOUR USE OF THE SAM MATERIALS AND ANY OUTPUT AND RESULTS.++4. Limitation of Liability. IN NO EVENT WILL META OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, FOR ANY LOST PROFITS OR ANY DIRECT OR INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR PUNITIVE DAMAGES, EVEN IF META OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING.++5. Intellectual Property.++a. Subject to Meta’s ownership of SAM Materials and derivatives made by or for Meta, with respect to any derivative works and modifications of the SAM Materials that are made by you, as between you and Meta, you are and will be the owner of such derivative works and modifications.++b. If you institute litigation or other proceedings against Meta or any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the SAM Materials, outputs or results, or any portion of any of the foregoing, constitutes infringement of intellectual property or other rights owned or licensable by you, then any licenses granted to you under this Agreement shall terminate as of the date such litigation or claim is filed or instituted. You will indemnify and hold harmless Meta from and against any claim by any third party arising out of or related to your use or distribution of the SAM Materials.++6. Term and Termination. The term of this Agreement will commence upon your acceptance of this Agreement or access to the SAM Materials and will continue in full force and effect until terminated in accordance with the terms and conditions herein. Meta may terminate this Agreement if you are in breach of any term or condition of this Agreement. Upon termination of this Agreement, you shall delete and cease use of the SAM Materials. Sections 3, 4 and 7 shall survive the termination of this Agreement.++7. Governing Law and Jurisdiction. This Agreement will be governed and construed under the laws of the State of California without regard to choice of law principles, and the UN Convention on Contracts for the International Sale of Goods does not apply to this Agreement. The courts of California shall have exclusive jurisdiction of any dispute arising out of this Agreement.++8. Modifications and Amendments. Meta may modify this Agreement from time to time; provided that they are similar in spirit to the current version of the Agreement, but may differ in detail to address new problems or concerns. All such changes will be effective immediately. Your continued use of the SAM Materials after any modification to this Agreement constitutes your agreement to such modification. Except as provided in this Agreement, no modification or addition to any provision of this Agreement will be binding unless it is in writing and signed by an authorized representative of both you and Meta.diff --git a/README.md b/README.mdindex ab80015..a50ab48 100644--- a/README.md+++ b/README.md@@ -24,11 +24,11 @@ up to a 6,890-vertex mesh).| Model | Parameters | EMDB-1 (mm) | 3DPW (mm) | RTX 4070, TensorRT (ms) | Galaxy S23 NPU (ms) | Licence ||---|---|---|---|---|---|---|-| `nano` | 20.0 M | 61.7 | 46.6 | 0.70 | 4.60 | CC BY-NC 4.0 |-| `tiny` | 20.3 M | 58.0 | 44.0 | 0.73 | 4.84 | CC BY-NC 4.0 |-| `small` | 24.4 M | 53.3 | 41.7 | 0.84 | 5.38 | CC BY-NC 4.0 |-| `medium` (default) | 32.2 M | 48.8 | 40.0 | 0.98 | 5.49 | CC BY-NC 4.0 |-| `medium-commercial` | 32.2 M | 72.2 | 50.7 | 0.98 | 5.49 | Apache-2.0 |+| `nano` | 20.0 M | 61.7 | 46.6 | 0.70 | 4.60 | SAM License, non-commercial |+| `tiny` | 20.3 M | 58.0 | 44.0 | 0.73 | 4.84 | SAM License, non-commercial |+| `small` | 24.4 M | 53.3 | 41.7 | 0.84 | 5.38 | SAM License, non-commercial |+| `medium` (default) | 32.2 M | 48.8 | 40.0 | 0.98 | 5.49 | SAM License, non-commercial |+| `medium-commercial` | 32.2 M | 72.2 | 50.7 | 0.98 | 5.49 | SAM License |`medium-commercial` is the medium model trained only on images that allow commercial use(Harmony4D and part of COCO). The weights download automatically from@@ -126,9 +126,19 @@ either way.## Licence-The code is under the [Apache-2.0](LICENSE) licence. The `nano`, `tiny`, `small` and `medium`-weights are under [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/), for-non-commercial use only, because some of their training images (SA-1B, AI Challenger) are; `medium-commercial` and the MHR body graph are under Apache-2.0. The body model is Meta's+The code is under the [Apache-2.0](LICENSE) licence, except+[`training/mhr_cont.py`](training/mhr_cont.py) and [`training/assets/`](training/assets/), which+are derived from SAM 3D Body and are under the [SAM License](LICENSE-SAM).++The weights, all five models and the shared `mhr-body.onnx`, are under the+[SAM License](LICENSE-SAM): they are trained on the SAM 3D Body annotations, which Meta releases+under that licence, and they contain tables from the SAM 3D Body checkpoint. The SAM License+allows commercial use, under the conditions it lists (trade controls, no military use, among+others). In addition, the `nano`, `tiny`, `small` and `medium` weights are for non-commercial+use only, because some of their training images (SA-1B, AI Challenger, and COCO photos under+non-commercial Flickr licences) are licensed for research or non-commercial use only.+`medium-commercial` was trained only on images that allow commercial use and has no such+restriction. The body model inside `mhr-body.onnx` is Meta's[MHR](https://github.com/facebookresearch/MHR) (Apache-2.0).## Acknowledgementsdiff --git a/training/README.md b/training/README.mdindex d75850f..9e739f5 100644--- a/training/README.md+++ b/training/README.md@@ -10,11 +10,16 @@ the labels are the dataset's, not a teacher model's output.| `train.py` | The trainer: dataset, augmentation, model, MHR forward pass, losses, metrics, and a single-GPU loop. It also holds the self-checks (`--self-test`, `--overfit-test`). || `train_ddp.py` | The entry point for real runs. It imports `train.py` and adds multi-GPU training (torchrun or Slurm), per-dataset mixture sampling, resume, and 3DPW validation. Without a launcher it runs as one process on one GPU. || `val3dpw.py` | 3DPW validation used by `train_ddp.py --val-3dpw`. |-| `mhr_cont.py` | The continuous MHR head (`--cont-head`). |+| `mhr_cont.py` | The continuous MHR head (`--cont-head`), transcribed from SAM 3D Body. || `assets/` | Small files the trainer reads: the keypoint regressor, the body-size bounds, the continuous-head and landmark tables, and the MHR-to-J14 adapter for 3DPW validation. |A change to the model or a loss goes in `train.py`, so both entry points get it.+`mhr_cont.py` and `assets/` are derived from SAM 3D Body and are under the+[SAM License](../LICENSE-SAM), not Apache-2.0. A model trained with this folder+inherits it: it learns from annotations Meta releases under that licence, and+`--cont-head` stores SAM 3D Body tables in its weights.+## Setup```bashdiff --git a/training/assets/LICENSE b/training/assets/LICENSEnew file mode 100644index 0000000..d046069--- /dev/null+++ b/training/assets/LICENSE@@ -0,0 +1,12 @@+The files in this folder are derived from Meta's SAM 3D Body+(https://github.com/facebookresearch/sam-3d-body) and its annotations+(https://huggingface.co/datasets/facebook/sam-3d-body-dataset):++ mhr_cont_head.npz extracted from the SAM 3D Body checkpoint+ mhr_landmarks70.npz extracted from the SAM 3D Body checkpoint+ mhr_j127_to_kp70.npy fitted to the SAM 3D Body annotations+ mhr_size_bounds.npz measured on the SAM 3D Body annotations+ adapter_j14_h36m.npz fitted to the SAM 3D Body annotations++They are distributed under the SAM License, not under the repository's+Apache-2.0 licence. The full text is in LICENSE-SAM at the repository root.diff --git a/training/mhr_cont.py b/training/mhr_cont.pyindex 80f561a..72df43e 100644--- a/training/mhr_cont.py+++ b/training/mhr_cont.py@@ -1,3 +1,6 @@+# Transcribed from SAM 3D Body (sam_3d_body/models/modules/mhr_utils.py and geometry_utils.py),+# Copyright (c) Meta Platforms, Inc. and affiliates. This file is distributed under the SAM License+# (LICENSE-SAM at the repository root), not under the repository's Apache-2.0 licence."""SAM 3D Body's continuous MHR pose space, vendored for the student.The teacher's head does not emit the rig-native 204-vector. It emits a