Instructions to use YuanBaoSMadLab/velomocap-sam3d-torchscript with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- SAM 3D Body
How to use YuanBaoSMadLab/velomocap-sam3d-torchscript with SAM 3D Body:
import cv2 import numpy as np from notebook.utils import setup_sam_3d_body from tools.vis_utils import visualize_sample_together estimator = setup_sam_3d_body("YuanBaoSMadLab/velomocap-sam3d-torchscript") img_bgr = cv2.imread("path/to/image.jpg") outputs = estimator.process_one_image(cv2.cvtColor(img_bgr, cv2.COLOR_BGR2RGB)) rend_img = visualize_sample_together(img_bgr, outputs, estimator.faces) cv2.imwrite("output.jpg", rend_img.astype(np.uint8)) - Notebooks
- Google Colab
- Kaggle
SAM 3D Body - TorchScript conversion for VeloMocap
The whole SAM 3D Body pipeline traced as one TorchScript module, plus the MHR topology tables VeloMocap renders it with. Commercial use is allowed by the SAM License; the licence text must travel with the files.
Files
| File | Size | SHA-256 |
|---|---|---|
sam3d_full_b8_ts.pt |
3.3 GB | 88ca5d6e2daaf132d1e9cc26b152f0e0aa2941ed58738f5cf3c290086c8c79d4 |
sam3d_body_b8_ts.pt |
3.1 GB | 07db1c511c80ad5861f60c232f6bb1b4a4f039071e3625a01c59de8a6ae14622 |
sam3d_full_ts.pt |
3.3 GB | 476d31ee0a26f1140ffc5fd44b3e64fc7ace8da4d112a3164bff8c5f5d16d9f6 |
sam3d_faces.bin |
432.1 KB | f6748e290ef37fbb6877c4cc5bd7287105db9e98252b0ba170ae9ac3c45eacd6 |
sam3d_keypoints.bin |
6.4 KB | 532b75ddb6e1650be033b80f79545eeb54eaf05298cef0bd63b9bc36e72fc4e6 |
sam3d_skeleton.bin |
2.0 KB | bf8080b0d21e9b2469cd1b84c62da475ec560ef9743341a011aac57bc90f61e9 |
sam3d_mesh.json |
325.0 B | 04430bf3908a102f3130d660a0eed32cb6da4e53cec10d9707f0e35fbecd4e3c |
Upstream
- Model: https://huggingface.co/facebook/sam-3d-body-dinov3, files
model.ckptandassets/mhr_model.pt - Copyright: Meta Platforms, Inc. - see
LICENSE.
What changed
- Traced from
model.ckptandassets/mhr_model.ptbytools/torch/sam3d_full_jit.py: backbone, both hands, fusion and the MHR geometry in one graph, fp32. sam3d_full_b8_ts.ptis the same graph traced at--batch 8: one call reconstructs up to eight people, which is what the reference does (itsflow_sam.pypasses every box of a frame at once and itsflow_fast_sam.pybatches up to sixteen frames). VeloMocap prefers it on a card with 10 GB or more and falls back tosam3d_full_ts.ptbelow that.sam3d_body_b8_ts.ptis--hands body --batch 8: one body pass, no hand crops. VeloMocap runs it on the frames whose hand features are interpolated from a neighbour, which is the reference's video default (mocap/flow_hand_sampling.py: hands every fourth frame, body every frame).- The MHR tables were dumped by
tools/onnx/dump_mesh.py. - Nothing was retrained, fine-tuned or pruned.
Verified
Largest vertex difference 1.5e-5 m against the PyTorch reference (fp32); keypoints and camera within 1e-3. The batch-8 graph reproduces the batch-1 graph to 7.7e-7 per item.
How to use
Drop the files into models/sam3d/ of a VeloMocap install, a VeloMocap checkout or packaged install. Model weights are not part of the source repository.
Licence
SAM License - the text is in LICENSE, reproduced
verbatim from the upstream repository, and it governs these files. This
repository is a conversion, i.e. a derivative work of that model; see NOTICE.md
for which files were made here.
Loaded by LibTorch, not by ONNX Runtime. The ONNX export of this model exists in the development tree but is not used by the release and is not published here.
Disclaimer
Converted and published by VeloMocap contributors, not by the upstream authors. No warranty.
- Downloads last month
- -