(ICCV 2021) ProHMR - Probabilistic Modeling for Human Mesh Recovery

Related tags

Deep Learning ProHMR
Overview

ProHMR - Probabilistic Modeling for Human Mesh Recovery

Code repository for the paper:
Probabilistic Modeling for Human Mesh Recovery
Nikos Kolotouros, Georgios Pavlakos, Dinesh Jayaraman, Kostas Daniilidis
ICCV 2021
[paper] [project page] [colab notebook]

teaser

Installation instructions

We recommend creating a clean conda environment and install all dependencies. You can do this as follows:

conda env create -f environment.yml

After the installation is complete you can activate the conda environment by running:

conda activate prohmr

Alternatively, you can also create a virtual environment:

python -m venv .prohmr_venv
source .prohmr_venv/bin/activate
pip install -r requirements.txt

The last step is to install prohmr as a Python package. This will allow you to import it from anywhere in your system. Since you might want to modify the code, we recommend installing as follows:

python setup.py develop

In case you want to evaluate our approach on Human3.6M, you also need to manually install the pycdf package of the spacepy library to process some of the original files. If you face difficulties with the installation, you can find more elaborate instructions here.

Fetch data

Download the pretrained model checkpoint together with some additional data (joint regressors, etc.) and place them under data/. We provide a script to fetch the necessary data for training and evaluation. You need to run:

./fetch_data.sh

Besides these files, you also need to download the SMPL model. You will need the neutral model for training and running the demo code, while the male and female models will be necessary for preprocessing the 3DPW dataset. Please go to the websites for the corresponding projects and register to get access to the downloads section. Create a folder data/smpl/ and place the models there.

Run demo code

The easiest way to try our demo is by providing images with their corresponding OpenPose detections. These are used to compute the bounding boxes around the humans and optionally fit the SMPL body model to the keypoint detections. We provide some example images in the example_data/ folder. You can test our network on these examples by running:

python demo.py --img_folder=example_data/images --keypoint_folder=example_data/keypoints --out_folder=out --run_fitting

You might see some warnings about missing keys for SMPL components, which you can ignore. The code will save the rendered results for the regression and fitting in the newly created out/ directory. By default the demo code performs the fitting in the image crop and not in the original image space. If you want to instead fit in the original image space you can pass the --full_frame flag.

Colab Notebook

We also provide a Colab Notebook here where you can test our method on videos from YouTube. Check it out!

Dataset preprocessing

Besides the demo code, we also provide code to train and evaluate our models on the datasets we employ for our empirical evaluation. Before continuing, please make sure that you follow the details for data preprocessing.

Run evaluation code

The evaluation code is contained in eval/. We provide 4 different evaluation scripts.

  • eval_regression.py is used to evaluate ProHMR as a regression model as in Table 1 of the paper.
  • eval_keypoint_fitting.py is used to evaluate the fitting on 2D keypoints as in Table 3 of the paper.
  • eval_multiview.py is used to evaluate the multi-view refinement as in Table 5 of the paper.
  • eval_skeleton.py is used to evaluate the probablistic 2D pose lifiting network similarly with Table 6 of the main paper. Example usage:
python eval/eval_keypoint_fitting.py --dataset=3DPW-TEST

Running the above command will compute the Reconstruction Error before and after the fitting on the test set of 3DPW. For more information on the available command line options you can run the command with the --help argument.

Run training code

Due to license limitiations, we cannot provide the SMPL parameters for Human3.6M (recovered using MoSh). Even if you do not have access to these parameters, you can still use our training code using data from the other datasets. Again, make sure that you follow the details for data preprocessing. Alternatively you can use the SMPLify 3D fitting code to generate SMPL parameter annotations by fitting the model to the 3D keypoints provided by the dataset. Example usage:

python train/train_prohmr.py --root_dir=prohmr_reproduce/

This will train the model using the default config file prohmr/configs/prohmr.yaml as described in the paper. It will also create the folders prohmr_reproduce/checkpoints and prohmr_reproduce/tensorboard where the model checkpoints and Tensorboard logs will be saved.

We also provide the training code for the probabilistic version of Martinez et al. We are not allowed to redistribute the Stacked Hourglass keypoint detections used in training the model in the paper, so in this version of the code we replace them with the ground truth 2D keypoints of the dataset. You can train the skeleton model by running:

python train/train_skeleton.py --root_dir=skeleton_lifting/

Running this script will produce a similar output with the ProHMR training script.

Acknowledgements

Parts of the code are taken or adapted from the following repos:

Citing

If you find this code useful for your research or the use data generated by our method, please consider citing the following paper:

@Inproceedings{kolotouros2021prohmr,
  Title          = {Probabilistic Modeling for Human Mesh Recovery},
  Author         = {Kolotouros, Nikos and Pavlakos, Georgios and Jayaraman, Dinesh and Daniilidis, Kostas},
  Booktitle      = {ICCV},
  Year           = {2021}
}
Comments
  • questions about getting 3d keypoints

    questions about getting 3d keypoints

    Hi, thanks for your generous sharing of this wonderful work. I have tired on my own video and everything works fine. But when I try to extract the keypoints from theopt_out['model_joints'], all those points' coordinate values are so small and it seems these values are not the absolute 3d coordinates of those 44 points. can you help tell me how to get the correct 3d keypoints? thanks~

    opened by visonpon 9
  • Problem about transform in ProHMR

    Problem about transform in ProHMR

    Hi, thanks for your great job! But I have some questions about the transforms in ConditionalGlow. It seems that the foward and reverse of the transform in flow is not consistent.

    opened by Mercurialzhang 9
  • Normalizing Flows Module - Order of Operations

    Normalizing Flows Module - Order of Operations

    Hi @nkolot ,

    I really enjoyed this project - a very unique spin on probabilistic modeling for human 3d pose reconstruction, and the resulting context-based, strong prior seems to work great for your new version of SMPLify!

    I also am a big fan of your conditional normalizing flows approach, and I am trying to understand clearly the order of operations from noise->sample.

    In the supp material, I see that the forward mode norm flow bijector is depicted to act (for one block) in the order of z -> [ act norm -> linear layer -> conditional shift coupling ]-> pose theta. Screen Shot 2021-10-29 at 8 42 03 AM

    However, when looking through your nflows fork, I am coming out somewhere different. Allow me to walk through what I'm seeing:

    1. Arrange each glow block as [norm, linear, coupling]
    2. When sampling / computing log probs you call sample_and_log_prob which calls the inverse of the glow bijector on noise generated from standard normal
    3. The inverse mode of the CompositeTransform inverts the component bijectors and reverses the order
    4. In forward mode, smpl flow uses the sample_and_log_prob method on noise

    My understanding from the code is that it acts in the inverse way from "noise" to "theta sample" as depicted in the supp materials (i.e., order of operations for "sampling phase" vs "evaluation phase" are flipped).

    Do you know if I am missing something ? I'd really appreciate your help!

    Alex

    opened by areiner222 5
  • Keypoints Optimization errors are not reduce

    Keypoints Optimization errors are not reduce

    Keypoint optimization errors are not reduced

    Hello. Thanks for sharing your greate job.

    However, when I inferenced keypoint fitting as a downstream task on my own dataset, I found that the reproject error and total loss did not decrease from a certain iteration.

    To be precise, even when I output the video, I think that the output smpl pose of Pro_HMR and the optimized output pose are so similar that it is difficult to distinguish them with the naked eye.

    Is this a limitation of this model? Or am I missing something?

    I look forward to your reply. thank you

    opened by Realdr4g0n 5
  • about other code(SPIN)

    about other code(SPIN)

    Hello, I want to add up3d dataset to your spin code framework for training, but I find that after I add it, 2D joint points cannot correspond. Do you need special settings?

    opened by zhangzhenyu-zzy 3
  • train with only coco problem

    train with only coco problem

    hello, I want to use COCO only to train . I change the dataset.yaml and prohmr.yaml as following:

    COCO-TRAIN-2014:
        TYPE: ImageDataset
        DATASET_FILE: data/datasets/coco_2014_train_spin.npz
        IMG_DIR: C:/Users/DM/Documents/Code/common_data/train_datasets/COCO/train2014
    COCO-VAL:
        TYPE: ImageDataset
        DATASET_FILE: data/datasets/coco_val.npz
        IMG_DIR: C:/Users/DM/Documents/Code/common_data/train_datasets/COCO/val2017
    CMU-MOCAP:
        DATASET_FILE: data/datasets/cmu_mocap.npz
    
    DATASETS:
      TRAIN: 
        COCO-TRAIN-2014:
          WEIGHT: 1.0
      VAL:
        COCO-VAL:
          WEIGHT: 1.0
      MOCAP: CMU-MOCAP
    

    and there is error : TypeError: cannot serialize '_io.BufferedReader' object which is caused by File "train/train_prohmr.py", line 63, in trainer.fit(model, datamodule=data_module)

    My environment is Win10

    opened by zhaishengfu 3
  • Number of sampling when i evaluate on regression model

    Number of sampling when i evaluate on regression model

    HI. Thank you for good research and code sharing!

    I have a question about regression performance.

    How much the number of generated samples affects to performance?

    In your code, default setting is 4096 for evaluation, but my 24GB GPU memory cannot hold it during evaluation(OOM problem)

    So, i tried to evaluate with 2048 samples. Would it affect on performance? On 3DPW, i got .. mode_re: 59.83 mm min_re: 41.92 mm (* Paper performance) mode_re : 59.8 / min_re : 40.8 On MPII3DHP, mode_re: 64.68 mm min_re: 50.29 mm (* Paper performance) mode_re : 65.0 / min_re : Not reported?

    Actually, mode reconstruction and min reconstruction performance are pretty close. But i'm curious.

    Thanks!

    opened by markkim1115 2
  • Spin get smpl parameters

    Spin get smpl parameters

    Hello, Another question . In you data processing page, you said: 9ddbe80f6097e7323f6e022278a3861

    If I understant correctly,what you mean is “ you use SPIN method to generate SMPL parameters for datasets including MPII, COCO and MPI-INF-3DHP", right?

    If so, as I know SPIN will get some wrong estimation for some picture, and we will get wrong labels for training? Will this be bad for training?

    opened by zhaishengfu 2
  • cannot import name 'ConditionalGlow' from 'nflows.flows'

    cannot import name 'ConditionalGlow' from 'nflows.flows'

    Hi. I followed the install instruction. But when I run the demo.py , the error "cannot import name 'ConditionalGlow' from 'nflows.flows'" has occurred. I go to https://github.com/nkolot/nflows/tree/master and do not find any module about ConditionalGlow. Did I install nflows incorrectly? Sorry for the novice question.

    opened by qihangran 2
  • Question about Condition Normalizing Flows

    Question about Condition Normalizing Flows

    Thanks for sharing your work. @nkolot I have this question during using demo.py. Hope you can help me to understand normalizing flow a bit more, thank you.

    During stage-2(fitting), I can get an adequate vector Z for a specific image. And I can use pretrained condition normalizing flow to convert such a vector Z into corresponding smpl pose parameters(body_pose and global_orient). But I do a bit more to using normalizing flow in reverse direction to convert smpl parameters back to vector Z(using this function). However, the output vector Z is not even close to the origin adequate vector Z. I was doing this to test if normalizing flow is a revertable function. But the experiment result is not as expected. Maybe I used normalizing flow in the wrong way? Could you please help me out here?

    opened by yanhn 2
  • "coco_val.npz"

    Hi! In “Data preparation”, you mentioned that the coco image version is coco2014(training phase).
    But when I loaded 'coco_val.npz' file you provided, I found the version is val2017.
    SO you did use coco val2017 datasets, did you?

    opened by qihangran 1
  • Can't reproduce results on Human3.6 (Table 1)

    Can't reproduce results on Human3.6 (Table 1)

    Hi, thanks for the good job.

    I tried to run:

    python train/train_prohmr.py --root_dir=prohmr_reproduce/
    

    to re-trained the model myself. By evaluating the last checkpoint (iteration=500k), I got the performance:

    Screen Shot 2022-10-12 at 6 21 39 PM

    However, the PA-MPJPE reported in the Table 1 of the paper is 41.2, which is lower than 42.8 as I got. Moreover, the evaluation from the given data/checkpoint.pt is

    Screen Shot 2022-10-12 at 6 15 37 PM

    which is actually better than the reported number and thus shows a larger gap with my re-trained weights.

    Have I missed any details here to reproduce the performance reported in the paper?

    opened by noahcao 0
  • label file of COCO2014 validation set

    label file of COCO2014 validation set

    Thanks for your great job! Could you please share the label file (npz file) of the COCO2014 validation set for the validation step during model training?

    opened by pineapple-king 0
  • Why use a different J_extra_regressor?

    Why use a different J_extra_regressor?

    It seems like many of the 3D human mesh recovery paper codes uses J_extra_regressor with size(9, 6890) to output 9 extra joints. However, you use a different regressor J19 to output 19 extra joints.

    1. Why do you choose a different set of joints?
    2. Should this be a problem when prepocessing the datasets?
    3. If I want to use the keypoints data you provided to train other models that output 49 joints (yours is 44 joints), how to convert it? Thanks alot.
    opened by mimiliaogo 0
  • joint3d's z coordinate change largely

    joint3d's z coordinate change largely

    Hi, Thank you for sharing such excellent research. I try to infer my own video and obtain model_joints after the run-fitting phase, unfortunately, it's strange that model joints' z coordinate change largely when the video's motion move in the x, y direction not z.

    Please tell me how to resolve this problem, Thanks! @nkolot @geopavlakos

    opened by qinb 1
  • Not normalize 3d keypoint?

    Not normalize 3d keypoint?

    Hi,

    I noticed in the data loading, the 2d keypoint coordinates are normalized like here. Is there any reason why 3d keypoints are not normalized?

    Given a set of keypoints_2d of [Nx3] and the corresponding keypoints_3d of [Nx4], I think their first two colomuns should be the same: keypoints_2d[:,:2] == keypoints_3d[:,:2]. Not normalizing 3d keypoints may introduce some noise here?

    opened by noahcao 0
  • About mode computation from model

    About mode computation from model

    Hello, These days, i'm researching based on your ProHMR idea.

    I have a question. As far as I understand from the paper, z=0 mapped to a mode of body pose distribution conditioned on input image.

    So, variable θ from z=0 may have highest likelihood in distribution p(θ).

    But from the result, we can see the best result comes from many samplings.

    image

    Why the mode still does not give best reconstruction error? How do you think about this?

    May be dumb question, forgive me. Thanks!

    opened by markkim1115 0
Owner
Nikos Kolotouros
I am a CS PhD student at the University of Pennsylvania working on Computer Vision and Machine Learning.
Nikos Kolotouros
Mesh Graphormer is a new transformer-based method for human pose and mesh reconsruction from an input image

MeshGraphormer ✨ ✨ This is our research code of Mesh Graphormer. Mesh Graphormer is a new transformer-based method for human pose and mesh reconsructi

Microsoft 251 Jan 8, 2023
A repo that contains all the mesh keys needed for mesh backend, along with a code example of how to use them in python

Mesh-Keys A repo that contains all the mesh keys needed for mesh backend, along with a code example of how to use them in python Have been seeing alot

Joseph 53 Dec 13, 2022
CoSMA: Convolutional Semi-Regular Mesh Autoencoder. From Paper "Mesh Convolutional Autoencoder for Semi-Regular Meshes of Different Sizes"

Mesh Convolutional Autoencoder for Semi-Regular Meshes of Different Sizes Implementation of CoSMA: Convolutional Semi-Regular Mesh Autoencoder arXiv p

Fraunhofer SCAI 10 Oct 11, 2022
Given a 2D triangle mesh, we could randomly generate cloud points that fill in the triangle mesh

generate_cloud_points Given a 2D triangle mesh, we could randomly generate cloud points that fill in the triangle mesh. Run python disp_mesh.py Or you

Peng Yu 2 Dec 24, 2021
AI Face Mesh: This is a simple face mesh detection program based on Artificial intelligence.

AI Face Mesh: This is a simple face mesh detection program based on Artificial Intelligence which made with Python. It's able to detect 468 different

Md. Rakibul Islam 1 Jan 13, 2022
[ICCV'21] PlaneTR: Structure-Guided Transformers for 3D Plane Recovery

PlaneTR: Structure-Guided Transformers for 3D Plane Recovery This is the official implementation of our ICCV 2021 paper News There maybe some bugs in

null 73 Nov 30, 2022
Research code for CVPR 2021 paper "End-to-End Human Pose and Mesh Reconstruction with Transformers"

MeshTransformer ✨ This is our research code of End-to-End Human Pose and Mesh Reconstruction with Transformers. MEsh TRansfOrmer is a simple yet effec

Microsoft 473 Dec 31, 2022
ILVR: Conditioning Method for Denoising Diffusion Probabilistic Models (ICCV 2021 Oral)

ILVR + ADM This is the implementation of ILVR: Conditioning Method for Denoising Diffusion Probabilistic Models (ICCV 2021 Oral). This repository is h

Jooyoung Choi 225 Dec 28, 2022
DeFMO: Deblurring and Shape Recovery of Fast Moving Objects (CVPR 2021)

Evaluation, Training, Demo, and Inference of DeFMO DeFMO: Deblurring and Shape Recovery of Fast Moving Objects (CVPR 2021) Denys Rozumnyi, Martin R. O

Denys Rozumnyi 139 Dec 26, 2022
InferPy: Deep Probabilistic Modeling with Tensorflow Made Easy

InferPy: Deep Probabilistic Modeling Made Easy InferPy is a high-level API for probabilistic modeling written in Python and capable of running on top

PGM-Lab 141 Oct 13, 2022
A Python library for Deep Probabilistic Modeling

Abstract DeeProb-kit is a Python library that implements deep probabilistic models such as various kinds of Sum-Product Networks, Normalizing Flows an

DeeProb-org 46 Dec 26, 2022
Implementation based on Paper - Learning a Probabilistic Latent Space of Object Shapes via 3D Generative-Adversarial Modeling

Implementation based on Paper - Learning a Probabilistic Latent Space of Object Shapes via 3D Generative-Adversarial Modeling

HamasKhan 3 Jul 8, 2022
Generative Flow Networks for Discrete Probabilistic Modeling

Energy-based GFlowNets Code for Generative Flow Networks for Discrete Probabilistic Modeling by Dinghuai Zhang, Nikolay Malkin, Zhen Liu, Alexandra Vo

Narsil-Dinghuai Zhang 51 Dec 20, 2022
Code for "3D Human Pose and Shape Regression with Pyramidal Mesh Alignment Feedback Loop"

PyMAF This repository contains the code for the following paper: 3D Human Pose and Shape Regression with Pyramidal Mesh Alignment Feedback Loop Hongwe

Hongwen Zhang 450 Dec 28, 2022
[CVPR'21] Locally Aware Piecewise Transformation Fields for 3D Human Mesh Registration

Locally Aware Piecewise Transformation Fields for 3D Human Mesh Registration This repository contains the implementation of our paper Locally Aware Pi

sfwang 70 Dec 19, 2022
Out-of-Domain Human Mesh Reconstruction via Dynamic Bilevel Online Adaptation

DynaBOA Code repositoty for the paper: Out-of-Domain Human Mesh Reconstruction via Dynamic Bilevel Online Adaptation Shanyan Guan, Jingwei Xu, Michell

null 197 Jan 7, 2023
Accelerated SMPL operation, commonly used in generate 3D human mesh, STAR included.

SMPL2 An enchanced and accelerated SMPL operation which commonly used in 3D human mesh generation. It takes a poses, shapes, cam_trans as inputs, outp

JinTian 20 Oct 17, 2022
Official Pytorch implementation of "Learning to Estimate Robust 3D Human Mesh from In-the-Wild Crowded Scenes", CVPR 2022

Learning to Estimate Robust 3D Human Mesh from In-the-Wild Crowded Scenes / 3DCrowdNet News ?? 3DCrowdNet achieves the state-of-the-art accuracy on 3D

Hongsuk Choi 113 Dec 21, 2022
This repository is the offical Pytorch implementation of ContextPose: Context Modeling in 3D Human Pose Estimation: A Unified Perspective (CVPR 2021).

Context Modeling in 3D Human Pose Estimation: A Unified Perspective (CVPR 2021) Introduction This repository is the offical Pytorch implementation of

null 37 Nov 21, 2022