multi-hmr

naver更新放缓

单张图片一次前向即可重建画面中多人的 SMPL-X 三维人体网格与姿态,提供 PyTorch 推理代码和预训练模型,适合做多人姿态估计与人体重建的落地验证。

Pytorch demo code and models for Multi-HMR

暂无版本425star36fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
python3.9 -m venv .multihmr
source .multihmr/bin/activate
pip install -r requirements.txt
python3.9 demo.py --img_folder example_data --out_folder demo_out --save_rotating_video 1 --model_name multiHMR_672_L_anny
硬件要求按 README 说明

README 未明确给出显存要求;运行时间在 V100-32GB 上测得(ViT-S 672 约 29ms,ViT-L 896 约 126ms),安装测试环境为 python3.9 + CUDA 12.1。

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

项目说明

由 README 自动翻译提炼

单张 RGB 图一次前向重建多人的全身 3D 网格,适合多人场景的人体建模

单张图片一次前向即可重建画面中多人的 SMPL-X 三维人体网格与姿态,提供 PyTorch 推理代码和预训练模型,适合做多人姿态估计与人体重建的落地验证。

核心能力

  • 单次前向从单张 RGB 图重建多人的全身网格
  • 支持 ViT-S/B/L 多种骨干与 672/896/1288 多档分辨率
  • 提供多个预训练权重,含 Anny 人体模型版本
  • 附带 BEDLAM 训练与 EHF/3DPW 评估代码
  • demo 可输出旋转视频、侧视/俯视视角与 .npy 网格

容易踩的坑

首次运行 demo 会自动下载权重到 $HOME/models/multiHMR,需联网;跑 demo 还需自行注册下载 SMPLX 中性模型并放到 ./models/smplx/;训练/评估 3DPW 还需额外下载 SMPL male/female 模型和 smplx2smpl.pkl。

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

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

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

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

    README 原文

    未翻译

    News

    • 2026/02/17: Release of checkpoint with Anny body model.
    • 2024/07/03: Release of training-evaluation code.
    • 2024/07/01: Multi-HMR is accepted to ECCV'24.
    • 2024/06/17: Multi-HMR won Robin Challenge @CVPR'24: 3D human reconstruction track.
    • 2024/02/22: Release of demo code.

    Installation

    First, you need to clone the repo.

    We recommand to use virtual enviroment for running MultiHMR. Please run the following lines for creating the environment with venv:

    python3.9 -m venv .multihmr
    source .multihmr/bin/activate
    pip install -r requirements.txt
    

    Otherwise you can also create a conda environment.

    conda env create -f conda.yaml
    conda activate multihmr
    

    The installation has been tested with python3.9 and CUDA 12.1.

    Checkpoints will automatically be downloaded to $HOME/models/multiHMR the first time you run the demo code.

    Run Multi-HMR on images

    The following command will run Multi-HMR on all images in the specified --img_folder, and save renderings of the reconstructions in --out_folder. The --model_name flag specifies the model to use. The --extra_views flags additionally renders the side and bev view of the reconstructed scene, --save_mesh saves meshes as in a '.npy' file.

    python3.9 demo.py \
        --img_folder example_data \
        --out_folder demo_out \
        --save_rotating_video 1 \
        --model_name multiHMR_672_L_anny
    

    Pre-trained models

    We provide multiple pre-trained checkpoints. Here is a list of their associated features. Once downloaded you need to place them into $HOME/models/multiHMR.

    modelnametraining databackboneresolutionruntime (ms)PVE-3PDW-testPVE-EHFPVE-BEDLAM-valcomment
    multiHMR_896_L HuggingFace modelBEDLAM+AGORA+CUFFS+UBodyViT-L896x89612689.942.256.7initial ckpt
    multiHMR_672_L_annyBEDLAM+ITW+AnnyOneViT-L672x672
    multiHMR_672_LBEDLAM+AGORA+CUFFS+UBodyViT-L672x6727494.137.058.6longer training
    multiHMR_672_BBEDLAM+AGORA+CUFFS+UBodyViT-B672x6724394.043.667.2longer training
    multiHMR_672_SBEDLAM+AGORA+CUFFS+UBodyViT-S672x67229102.449.378.9longer training
    multiHMR_1288_L_bedlamBEDLAM(train+val)ViT-L1288x1288???ckpt used for BEDLAM leaderboard
    multiHMR_1288_L_agoraBEDLAM(train+val)+AGORA(train+val)ViT-L1288x1288???ckpt used for AGORA leaderboard

    We compute the runtime on GPU V100-32GB.

    Training Multi-HMR

    We provide code for training Multi-HMR using a single GPU on BEDLAM-training and evaluating it on BEDLAM-validation, EHF and 3DPW-test.

    Activate environnement

    source .multihmr/bin/activate
    export PYTHONPATH=`pwd`
    

    Preprocessing BEDLAM

    The first thing that you need to do is to download the BEDLAM dataset (6fps version) and place the files into data/BEDLAM The data structure of the directory should look like this:

    data/BEDLAM
          |
          |---validation
                      |
                      |---20221018_1_250_batch01hand_zoom_suburb_b_6fps
                                                                  |
                                                                  |---png
                                                                      |
                                                                      |---seq_000000
                                                                                  |
                                                                                  |---seq_000000_0000.png
                                                                                  ...
                                                                                  |---seq_000000_0235.png
                                                                      ...
                                                                      |---seq_000249
                      ...
                      |---20221019_3-8_250_highbmihand_orbit_stadium_6fps
          |---training
                  |
                  |---20221010_3_1000_batch01hand_6fps
                  ...
                  |---20221024_3-10_100_batch01handhair_static_highSchoolGym_30fps
          |---all_npz_12_training
                  |
                  |---20221010_3_1000_batch01hand_6fps.npz
                  ...
                  |---20221024_3-10_100_batch01handhair_static_highSchoolGym_30fps.npz
          |---all_npz_12_validation
                |
                |---20221018_1_250_batch01hand_zoom_suburb_b_6fps.npz
                ...
                |---20221019_3-8_250_highbmihand_orbit_stadium_6fps.npz
    

    We need to build the annotation files for the training and validation sets. It may takes around 20 minutes for bulding the pkl files depending on your CPU.

    python3.9 datasets/bedlam.py "create_annots(['validation', 'training'])"
    

    You will get two files data/bedlam_validation.pkl and data/bedlam_training.pkl.

    Checking annotations

    Visualize the annotation of a specific image.

    python3.9 datasets/bedlam.py "visualize(split='validation', i=1500)"
    

    It will create a file bedlam_validation_15000.jpg where you can see the RGB image on the left side and the RGB image with meshes overlayed on the right side.

    (Optional) Creating jpg files to fast data-loading

    BEDLAM is composed of PNG files and loading them could be a bit slow depending our your infrastucture. The following command will generate one jpg file for each png file with maximal resolution of 1280. It may take a while because BEDLAM has more than 300k images. You can run the command lines on some specific subdirectories to speed-up the generation of jpg files. You can chose the target size of your choice.

    # Can be slow
    python3.9 datasets/bedlam.py "create_jpeg(root_dir='data/BEDLAM', target_size=1280)
    
    # Or parallelize
    python3.9 datasets/bedlam.py "create_jpeg(root_dir='data/BEDLAM/validation/20221019_3-8_250_highbmihand_orbit_stadium_6fps', target_size=1280)
    ...
    python3.9 datasets/bedlam.py "create_jpeg(root_dir='data/BEDLAM/training/20221010_3-10_500_batch01hand_zoom_suburb_d_6fps', target_size=1280)
    

    Checking the data-loading time

    You can check the quality of your dataloader by running the command above. It will use the png version of BEDLAM.

    python3.9 datasets/bedlam.py "dataloader(split='validation', batch_size=16, num_workers=4, extension='png', img_size=1280, n_iter=100)"
    

    Preprocessing additional validation sets

    We also provide code for evaluating on EHF and 3DPW. Run the command for bulding the annotation fiel for EHF.

    python3.9 datasets/ehf.py "create_annots()"
    python3.9 datasets/ehf.py "visualize(i=10)"
    

    And for 3DPW. Please download SMPL-male and SMPL-female models, put them into models/smpl/SMPL_MALE.pkl and models/smpl/SMPL_FEMALE.pkl. And smplx2smpl.pkl is mandatory for moving from SMPLX to SMPL.

    python3.9 datasets/threedpw.py "create_annots()"
    python3.9 datasets/threedpw.py "visualize(i=1011)"
    

    Training on BEDLAM-train

    We provide the command for training on BEDLAM-train at resolution 336 on a single GPU.

    # python command
    CUDA_VISIBLE_DEVICES=1 python3.9 train.py \
    --backbone dinov2_vits14 \
    --img_size 336 \
    -j 4 \
    --batch_size 32 \
    -iter 10000 \
    --max_iter 500000 \
    --name multi-hmr_s_336
    

    To decrease data-loading time use --extension jpg --res 1280

    Evaluating BEDLAM-val / EHF-test / 3DPW-test

    Above command is for evaluating a pretrained ckpt on validation sets.

    CUDA_VISIBLE_DEVICES=0 python3.9 train.py \
    --eval_only 1 \
    --backbone dinov2_vitl14 \
    --img_size 896 \
    --val_data EHF THREEDPW BEDLAM \
    --val_split test test validation \
    --val_subsample 1 20 25 \
    --pretrained models/multiHMR/multiHMR_896_L.pt
    

    Either check the log or open the tensorboard for checking the results.

    CUFFS dataset

    The Close-Up Frames of Full-Body Subjects dataset, containing humans close to the camera with diverse hand poses is available here(LICENSE). More information about how to use it will be given soon, stay tuned.

    License

    Code and checkpoints are provided under the terms of this LICENSE and accompanying NOTICE. The licence for the Multi-HMR checkpoint with the Anny body model is here: LICENSE

    Citing

    If you find this code useful for your research, please consider citing the following paper:

    @inproceedings{multi-hmr2024,
        title={Multi-HMR: Multi-Person Whole-Body Human Mesh Recovery in a Single Shot},
        author={Baradel*, Fabien and 
                Armando, Matthieu and 
                Galaaoui, Salma and 
                Br{\'e}gier, Romain and 
                Weinzaepfel, Philippe and 
                Rogez, Gr{\'e}gory and
                Lucas*, Thomas
                },
        booktitle={ECCV},
        year={2024}
    }