sam-body4d

gaomingqiMIT更新放缓

无需训练即可从视频中恢复人体网格模型,结合 SAM-3、Diffusion-VAS 和 SAM-3D-Body 实现 4D 人体重建,适合快速做视频人体建模。

🏂 Training-Free Human Mesh Recovery from Videos, based on SAM-3, Diffusion-VAS, and SAM-3D-Body.

v0.2.0发布于 2026-03-21 09:03 UTC418star39fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
conda create -n body4d python=3.12 -y
conda activate body4d
pip install -e .
python scripts/setup.py --ckpt-root /path/to/checkpoints
python app.py
硬件要求按 README 说明

README 未说明具体显存要求,仅指向 resources.md 查看 GPU/CPU 资源与峰值内存统计;安装步骤按 CUDA 版本选择 PyTorch,示例使用 cu118。

支持 Apple Silicon需要 CUDA
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

免训练的视频 4D 人体网格恢复工具,靠像素级分割保证时序一致与遮挡鲁棒

无需训练即可从视频中恢复人体网格模型,结合 SAM-3、Diffusion-VAS 和 SAM-3D-Body 实现 4D 人体重建,适合快速做视频人体建模。

核心能力

  • 利用可提示视频分割保持像素级人体连续性
  • 支持遮挡场景下的多人稳健恢复
  • 相机运动下仍能稳定重建 4D 人体
  • 提供 Gradio 演示与单命令端到端视频流水线
  • 自动检测首帧人体并作为全片跟踪目标

容易踩的坑

SAM 3 与 SAM 3D Body 权重需先在 Hugging Face 申请并接受访问权限,再执行 huggingface-cli login;setup 脚本需指定 ckpt-root,手动下载时须按 README 的目录结构放置各权重;Detectron2 需按指定 commit 用 --no-build-isolation --no-deps 安装,PyTorch 版本需与本地 CUDA 匹配。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

2 个版本v0.2.0
  1. v0.2.0v0.2.0 - support smpl-x export最新正式版2026-03-21 · 2026-03-21 09:03 UTC

    support smpl-x export.

  2. v0.1.0v0.1.0 – Automated Setup & Reproducible Config2025-12-12 · 2025-12-12 23:30 UTC
    查看更新说明

    Adds automated setup via setup script.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    🏂 SAM-Body4D

    Mingqi Gao, Yunqi Miao, Jungong Han

    SAM-Body4D is a training-free method for temporally consistent and robust 4D human mesh recovery from videos. By leveraging pixel-level human continuity from promptable video segmentation together with occlusion recovery, it reliably preserves identity and full-body geometry in challenging in-the-wild scenes.

    [ 📄 Paper] [ 🌐 Project Page] [ 📝 BibTeX]

    ✨ Key Features

    • Temporally consistent human meshes across the entire video
    • Robust multi-human recovery under heavy occlusions
    • Robust 4D reconstruction under camera motion

    🕹️ Gradio Demo

    https://github.com/user-attachments/assets/07e49405-e471-40a0-b491-593d97a95465

    📊 Resource & Profiling Summary

    For detailed GPU/CPU resource usage, peak memory statistics, and runtime profiling, please refer to:

    👉 resources.md

    🖥️ Installation

    1. Create and Activate Environment
    conda create -n body4d python=3.12 -y
    conda activate body4d
    
    2. Install PyTorch (choose the version that matches your CUDA), Detectron, and SAM3
    pip install torch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1 --index-url https://download.pytorch.org/whl/cu118
    pip install 'git+https://github.com/facebookresearch/detectron2.git@a1ce2f9' --no-build-isolation --no-deps
    pip install -e models/sam3
    

    If you are using a different CUDA version, please select the matching PyTorch build from the official download page: https://pytorch.org/get-started/previous-versions/

    3. Install Dependencies
    pip install -e .
    

    🚀 Run the Demo

    1. Setup checkpoints & config (recommended)

    We provide an automated setup script that:

    • generates configs/body4d.yaml from a release template,
    • downloads all required checkpoints (existing files will be skipped).

    Some checkpoints (SAM 3 and SAM 3D Body) require prior access approval on Hugging Face. Before running the setup script, please make sure you have accepted access on their Hugging Face pages.

    If you plan to use these checkpoints, login once:

    huggingface-cli login
    

    Then run the setup script:

    python scripts/setup.py --ckpt-root /path/to/checkpoints
    
    2. Run
    python app.py
    
    Manual checkpoint setup (optional)

    If you prefer to download checkpoints manually (SAM 3, SAM 3D Body, MoGe-2, Diffusion-VAS, Depth-Anything V2), please place them under the directory with the following structure:

    ${CKPT_ROOT}/
    ├── sam3/                                
    │   └── sam3.pt
    ├── sam-3d-body-dinov3/
    │   ├── model.ckpt
    │   └── assets/
    │       └── mhr_model.pt
    ├── moge-2-vitl-normal/
    │   └── model.pt
    ├── diffusion-vas-amodal-segmentation/
    │   └── (directory contents)
    ├── diffusion-vas-content-completion/
    │   └── (directory contents)
    └── depth_anything_v2_vitl.pth
    

    After placing the files correctly, you can run the setup script again. Existing files will be detected and skipped automatically.

    🤖 Auto Run

    Run the full end-to-end video pipeline with a single command:

    python scripts/offline_app.py --input_video <path>
    

    where the input can be a directory of frames or an .mp4 file. The pipeline automatically detects humans in the initial frame, treats all detected humans as targets, and performs temporally consistent 4D reconstruction over the video.

    📝 Citation

    If you find this repository useful, please consider giving a star ⭐ and citation.

    @article{gao2025sambody4d,
      title   = {SAM-Body4D: Training-Free 4D Human Body Mesh Recovery from Videos},
      author  = {Gao, Mingqi and Miao, Yunqi and Han, Jungong},
      journal = {arXiv preprint arXiv:2512.08406},
      year    = {2025},
      url     = {https://arxiv.org/abs/2512.08406}
    }
    

    👏 Acknowledgements

    The project is built upon SAM-3, Diffusion-VAS and SAM-3D-Body. We sincerely thank the original authors for their outstanding work and contributions.