jetjodh commited on
Commit
6ae58cf
·
verified ·
1 Parent(s): 7d304f5

Upload 5 files

Browse files
Files changed (5) hide show
  1. LICENSE +52 -0
  2. README.md +133 -0
  3. assets/mhr_model.pt +3 -0
  4. model.ckpt +3 -0
  5. model_config.yaml +73 -0
LICENSE ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ SAM License
2
+ Last Updated: November 19, 2025
3
+
4
+ “Agreement” means the terms and conditions for use, reproduction, distribution and modification of the SAM Materials set forth herein.
5
+
6
+ “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.
7
+
8
+ “Documentation” means the specifications, manuals and documentation accompanying
9
+ SAM Materials distributed by Meta.
10
+
11
+ “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.
12
+
13
+ “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).
14
+
15
+ “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.
16
+
17
+ “Trade Controls” means any of the following: Sanctions and applicable export and import controls.
18
+
19
+ By using or distributing any portion or element of the SAM Materials, you agree to be bound by this Agreement.
20
+
21
+ 1. License Rights and Redistribution.
22
+
23
+ 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.
24
+
25
+ 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.
26
+
27
+ b. Redistribution and Use.
28
+
29
+ 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.
30
+
31
+ 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.
32
+
33
+ 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.
34
+ 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.
35
+ 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.
36
+ 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.
37
+
38
+ 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.
39
+
40
+ 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.
41
+
42
+ 5. Intellectual Property.
43
+
44
+ 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.
45
+
46
+ 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.
47
+
48
+ 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.
49
+
50
+ 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.
51
+
52
+ 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.
README.md ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: sam-license
4
+ license_link: https://huggingface.co/facebook/sam-3d-body-vith/blob/main/LICENSE
5
+ extra_gated_fields:
6
+ First Name: text
7
+ Last Name: text
8
+ Date of birth: date_picker
9
+ Country: country
10
+ Affiliation: text
11
+ Job title:
12
+ type: select
13
+ options:
14
+ - Student
15
+ - Research Graduate
16
+ - AI researcher
17
+ - AI developer/engineer
18
+ - Reporter
19
+ - Other
20
+ geo: ip_location
21
+ By clicking Submit below I accept the terms of the license and acknowledge that the information I provide will be collected stored processed and shared in accordance with the Meta Privacy Policy: checkbox
22
+ extra_gated_description: >-
23
+ The information you provide will be collected, stored, processed and shared in
24
+ accordance with the [Meta Privacy
25
+ Policy](https://www.facebook.com/privacy/policy/).
26
+ extra_gated_button_content: Submit
27
+
28
+ language:
29
+ - en
30
+ tags:
31
+ - sam-3d
32
+ - sam-3d-body
33
+ - 3d-human-mesh-recovery
34
+ - human-pose-estimation
35
+ - meta
36
+ ---
37
+
38
+
39
+ # SAM 3D Body: Robust Full-Body Human Mesh Recovery
40
+
41
+ **Meta Superintelligence Labs**
42
+
43
+ **SAM 3D Body (3DB)** is a promptable model for single-image full-body 3D human mesh recovery (HMR). Our method demonstrates state-of-the-art performance, with strong generalization and consistent accuracy in diverse in-the-wild conditions. 3DB estimates the human pose of the body, feet, and hands based on the [Momentum Human Rig](https://github.com/facebookresearch/MHR) (MHR), a new parametric mesh representation that decouples skeletal structure and surface shape for improved accuracy and interpretability.
44
+
45
+ 3DB employs an encoder-decoder architecture and supports auxiliary prompts, including 2D keypoints and masks, enabling user-guided inference similar to the SAM family of models. Our model is trained on high-quality annotations from a multi-stage annotation pipeline using differentiable optimization, multi-view geometry, dense keypoint detection, and a data engine to collect and annotated data covering both common and rare poses across a wide range of viewpoints.
46
+
47
+ ## Key Features
48
+
49
+ - **Robust Full-Body Performance**: Superior handling of occlusions, hard poses, and challenging viewpoints
50
+ - **Promptable Model**: Supports auxiliary prompts including 2D keypoints and masks for user-guided inference
51
+ - **Momentum Human Rig (MHR)**: New parametric mesh representation that decouples skeletal structure and surface shape
52
+ - **Large-Scale and High-Quality Data**: Multi-stage annotation pipeline for large-scale, diverse, and high-quality data
53
+
54
+ ## Quick Start
55
+
56
+ ### Installation
57
+
58
+ Please refer to [INSTALL.md](https://github.com/facebookresearch/sam-3d-body/blob/main/INSTALL.md) for detailed installation guidelines.
59
+
60
+ ### Inference
61
+
62
+ ```bash
63
+ # Download assets from HuggingFace
64
+ hf download facebook/sam-3d-body-dinov3 --local-dir checkpoints/sam-3d-body-dinov3
65
+
66
+ # Run demo script
67
+ python demo.py \
68
+ --image_folder <path_to_images> \
69
+ --output_folder <path_to_output> \
70
+ --checkpoint_path ./checkpoints/sam-3d-body-dinov3/model.ckpt \
71
+ --mhr_path ./checkpoints/sam-3d-body-dinov3/assets/mhr_model.pt
72
+ ```
73
+
74
+ You can also try the following lines of code with models loaded directly from [Hugging Face](https://huggingface.co/facebook)
75
+
76
+ ```python
77
+ import cv2
78
+ import numpy as np
79
+ from notebook.utils import setup_sam_3d_body
80
+ from tools.vis_utils import visualize_sample_together
81
+
82
+ # Set up the estimator
83
+ estimator = setup_sam_3d_body(hf_repo_id="facebook/sam-3d-body-dinov3")
84
+
85
+ # Load and process image
86
+ img_bgr = cv2.imread("path/to/image.jpg")
87
+ outputs = estimator.process_one_image(cv2.cvtColor(img_bgr, cv2.COLOR_BGR2RGB))
88
+
89
+ # Visualize and save results
90
+ rend_img = visualize_sample_together(img_bgr, outputs, estimator.faces)
91
+ cv2.imwrite("output.jpg", rend_img.astype(np.uint8))
92
+ ```
93
+
94
+ For a complete demo with visualization, see [demo_human.ipynb](https://github.com/facebookresearch/sam-3d-body/blob/main/notebook/demo_human.ipynb).
95
+
96
+ ## Output Format
97
+
98
+ Each detected person returns a dictionary containing:
99
+
100
+ - `pred_vertices`: 3D mesh vertices in camera coordinates
101
+ - `pred_keypoints_3d`: 3D pose keypoints
102
+ - `pred_keypoints_2d`: 2D pose keypoints projected to image
103
+ - `pred_cam_t`: Camera translation parameters
104
+ - `focal_length`: Estimated focal length
105
+ - `body_pose_params`: Body pose parameters
106
+ - `hand_pose_params`: Hand pose parameters
107
+ - `shape_params`: Body shape parameters
108
+
109
+
110
+ ## Citation
111
+
112
+ If you use SAM 3D Body or the SAM 3D Body dataset in your research, please use the following BibTeX entry.
113
+
114
+ ```bibtex
115
+ @article{yang2025sam3dbody,
116
+ title={SAM 3D Body: Robust Full-Body Human Mesh Recovery},
117
+ author={Yang, Xitong and Kukreja, Devansh and Pinkus, Don and Sagar, Anushka and Fan, Taosha and Park, Jinhyung and Shin, Soyong and Cao, Jinkun and Liu, Jiawei and Ugrinovic, Nicolas and Feiszli, Matt and Malik, Jitendra and Dollar, Piotr and Kitani, Kris},
118
+ journal={arXiv preprint; identifier to be added},
119
+ year={2025}
120
+ }
121
+ ```
122
+
123
+ ## License
124
+
125
+ The SAM 3D Body model is licensed under [SAM License](https://huggingface.co/facebook/sam-3d-body-vith/blob/main/README.md).
126
+
127
+ ## Links
128
+
129
+ - **Paper**: [https://ai.meta.com/research/publications/sam-3d-body-robust-full-body-human-mesh-recovery/](https://ai.meta.com/research/publications/sam-3d-body-robust-full-body-human-mesh-recovery/)
130
+ - **Code**: [https://github.com/facebookresearch/sam-3d-body](https://github.com/facebookresearch/sam-3d-body)
131
+ - **Demo**: [https://www.aidemos.meta.com/segment-anything/editor/convert-body-to-3d](https://www.aidemos.meta.com/segment-anything/editor/convert-body-to-3d)
132
+ - **Website**: [https://ai.meta.com/sam3d/](https://ai.meta.com/sam3d/)
133
+ - **Dataset**: [https://huggingface.co/datasets/facebook/sam-3d-body-dataset](https://huggingface.co/datasets/facebook/sam-3d-body-dataset)
assets/mhr_model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:352e271a6c42729c68554ceaea0c955e866970160c31e35506d782dc0f7377bc
3
+ size 696110248
model.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b1cb897f4bbd977bf81cbb0b30780a9582681ac642ee112865790ceb4d66056
3
+ size 1691205237
model_config.yaml ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ TRAIN:
2
+ USE_FP16: true
3
+ FP16_TYPE: bfloat16
4
+ MODEL:
5
+ IMAGE_SIZE:
6
+ - 512
7
+ - 512
8
+ IMAGE_MEAN:
9
+ - 0.485
10
+ - 0.456
11
+ - 0.406
12
+ IMAGE_STD:
13
+ - 0.229
14
+ - 0.224
15
+ - 0.225
16
+ BACKBONE:
17
+ TYPE: vit_hmr_512_384
18
+ PRETRAINED_WEIGHTS: ''
19
+ FROZEN_STAGES: -1
20
+ DROP_PATH_RATE: 0.0
21
+ DECODER:
22
+ TYPE: sam
23
+ DIM: 1024
24
+ DEPTH: 6
25
+ HEADS: 8
26
+ MLP_DIM: 1024
27
+ DIM_HEAD: 64
28
+ LAYER_SCALE_INIT: 0.0
29
+ DROP_RATE: 0.0
30
+ ATTN_DROP_RATE: 0.0
31
+ DROP_PATH_RATE: 0.0
32
+ FFN_TYPE: origin
33
+ ENABLE_TWOWAY: false
34
+ REPEAT_PE: true
35
+ FROZEN: false
36
+ CONDITION_TYPE: cliff
37
+ USE_INTRIN_CENTER: true
38
+ DO_INTERM_PREDS: true
39
+ DO_INTERM_SUP: true
40
+ DO_KEYPOINT_TOKENS: true
41
+ DO_HAND_DETECT_TOKENS: true
42
+ KEYPOINT_TOKEN_UPDATE: v2
43
+ KEYPOINT_TOKEN_UPDATE_COORD_EMB_USE_MLP: true
44
+ DO_KEYPOINT3D_TOKENS: true
45
+ PROMPT_ENCODER:
46
+ ENABLE: true
47
+ MAX_NUM_CLICKS: 2
48
+ PROMPT_KEYPOINTS: mhr70
49
+ FROZEN: false
50
+ KEYPOINT_SAMPLER:
51
+ TYPE: v1
52
+ WORST_RATIO: 0.8
53
+ KEYBODY_RATIO: 0.8
54
+ NEGATIVE_RATIO: 0.1
55
+ DUMMY_RATIO: 0.1
56
+ DISTANCE_THRESH: 0.0001
57
+ MASK_EMBED_TYPE: v2
58
+ MASK_PROMPT: v1
59
+ PERSON_HEAD:
60
+ POSE_TYPE: mhr
61
+ CAMERA_ENABLE: true
62
+ CAMERA_TYPE: perspective
63
+ ZERO_POSE_INIT: true
64
+ ZERO_POSE_INIT_BODY_FACTOR: 1
65
+ MHR_HEAD:
66
+ MLP_DEPTH: 2
67
+ MLP_CHANNEL_DIV_FACTOR: 1
68
+ CAMERA_HEAD:
69
+ MLP_DEPTH: 2
70
+ MLP_CHANNEL_DIV_FACTOR: 1
71
+ DEFAULT_SCALE_FACTOR_HAND: 10
72
+ ENABLE_BODY: true
73
+ ENABLE_HAND: true