Giter Site home page Giter Site logo

sunrisefly / pymaf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hongwenzhang/pymaf

0.0 0.0 0.0 7.32 MB

[ICCV 2021, Oral] PyMAF: 3D Human Pose and Shape Regression with Pyramidal Mesh Alignment Feedback Loop

Home Page: https://hongwenzhang.github.io/pymaf

License: Other

Shell 0.11% Python 99.89%

pymaf's Introduction

๐Ÿšฉ [Update] The compatible EFT label files are now available here, which helps to train a much stronger HMR baseline. See issue #58.

PyMAF & PyMAF-X

This repository contains the code for the following papers:

PyMAF-X: Towards Well-aligned Full-body Model Regression from Monocular Images
Hongwen Zhang, Yating Tian, Yuxiang Zhang, Mengcheng Li, Liang An, Zhenan Sun, Yebin Liu

arXiv, 2022

[Project Page] [Paper] [Code: smplx branch]

PyMAF: 3D Human Pose and Shape Regression with Pyramidal Mesh Alignment Feedback Loop
Hongwen Zhang*, Yating Tian*, Xinchi Zhou, Wanli Ouyang, Yebin Liu, Limin Wang, Zhenan Sun

* Equal contribution

ICCV, 2021 (Oral Paper)

[Project Page] [Paper] [Code: smpl branch]

Instruction for PyMAF

Preview of demo results:


Frame by frame reconstruction. Video clipped from here.


Frame by frame reconstruction. Video from here.

More results: Click Here

Requirements

  • Python 3.8
conda create --no-default-packages -n pymafx python=3.8
conda activate pymafx

packages

conda install pytorch==1.9.0 torchvision==0.10.0 cudatoolkit=11.1 -c pytorch -c conda-forge
pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable"
  • other packages listed in requirements.txt
pip install -r requirements.txt

necessary files

mesh_downsampling.npz & DensePose UV data

  • Run the following script to fetch mesh_downsampling.npz & DensePose UV data from other repositories.
bash fetch_data.sh

SMPL model files

Fetch preprocessed data from SPIN.

Fetch final_fits data from SPIN. [important note: using EFT fits for training is much better. Compatible npz files are available here]

Download the pre-trained model and put it into the ./data/pretrained_model directory.

After collecting the above necessary files, the directory structure of ./data is expected as follows.

./data
โ”œโ”€โ”€ dataset_extras
โ”‚   โ””โ”€โ”€ .npz files
โ”œโ”€โ”€ J_regressor_extra.npy
โ”œโ”€โ”€ J_regressor_h36m.npy
โ”œโ”€โ”€ mesh_downsampling.npz
โ”œโ”€โ”€ pretrained_model
โ”‚   โ””โ”€โ”€ PyMAF_model_checkpoint.pt
โ”œโ”€โ”€ smpl
โ”‚   โ”œโ”€โ”€ SMPL_FEMALE.pkl
โ”‚   โ”œโ”€โ”€ SMPL_MALE.pkl
โ”‚   โ””โ”€โ”€ SMPL_NEUTRAL.pkl
โ”œโ”€โ”€ smpl_mean_params.npz
โ”œโ”€โ”€ final_fits
โ”‚   โ””โ”€โ”€ .npy files
โ””โ”€โ”€ UV_data
    โ”œโ”€โ”€ UV_Processed.mat
    โ””โ”€โ”€ UV_symmetry_transforms.mat

Demo

You can first give it a try on Google Colab using the notebook we have prepared, which is no need to prepare the environment yourself: Open In Colab

Run the demo code.

For image input:

python3 demo.py --checkpoint=data/pretrained_model/PyMAF_model_checkpoint.pt --img_file examples/COCO_val2014_000000019667.jpg

For video input:

# video with single person
python3 demo.py --checkpoint=data/pretrained_model/PyMAF_model_checkpoint.pt --vid_file examples/dancer.mp4
# video with multiple persons
python3 demo.py --checkpoint=data/pretrained_model/PyMAF_model_checkpoint.pt --vid_file examples/flashmob.mp4

Evaluation

COCO Keypoint Localization

  1. Download the preprocessed data coco_2014_val.npz. Put it into the ./data/dataset_extras directory.

  2. Run the COCO evaluation code.

python3 eval_coco.py --checkpoint=data/pretrained_model/PyMAF_model_checkpoint.pt

3DPW

Run the evaluation code. Using --dataset to specify the evaluation dataset.

# Example usage:
# 3DPW
python3 eval.py --checkpoint=data/pretrained_model/PyMAF_model_checkpoint.pt --dataset=3dpw --log_freq=20

Training

๐Ÿš€ [Important update]: Using EFT fits is recommended, as it can significantly improve the baseline. Compatible data is available here. See issue #58 for more training details using the EFT labels.

Below messages are the training details of the conference version of PyMAF.

To perform training, we need to collect preprocessed files of training datasets at first.

The preprocessed labels have the same format as SPIN and can be retrieved from here. Please refer to SPIN for more details about data preprocessing.

PyMAF is trained on Human3.6M at the first stage and then trained on the mixture of both 2D and 3D datasets at the second stage. Example usage:

# training on COCO
CUDA_VISIBLE_DEVICES=0 python3 train.py --regressor pymaf_net --single_dataset --misc TRAIN.BATCH_SIZE 64
# training on mixed datasets
CUDA_VISIBLE_DEVICES=0 python3 train.py --regressor pymaf_net --pretrained_checkpoint path/to/checkpoint_file.pt --misc TRAIN.BATCH_SIZE 64

Running the above commands will use Human3.6M or mixed datasets for training, respectively. We can monitor the training process by setting up a TensorBoard at the directory ./logs.

Citation

If this work is helpful in your research, please cite the following paper.

@inproceedings{pymaf2021,
  title={PyMAF: 3D Human Pose and Shape Regression with Pyramidal Mesh Alignment Feedback Loop},
  author={Zhang, Hongwen and Tian, Yating and Zhou, Xinchi and Ouyang, Wanli and Liu, Yebin and Wang, Limin and Sun, Zhenan},
  booktitle={Proceedings of the IEEE International Conference on Computer Vision},
  year={2021}
}

@article{pymafx2022,
  title={PyMAF-X: Towards Well-aligned Full-body Model Regression from Monocular Images},
  author={Zhang, Hongwen and Tian, Yating and Zhang, Yuxiang and Li, Mengcheng and An, Liang and Sun, Zhenan and Liu, Yebin},
  journal={arXiv preprint arXiv:2207.06400},
  year={2022}
}

Acknowledgments

The code is developed upon the following projects. Many thanks to their contributions.

pymaf's People

Contributors

hongwenzhang avatar tinatiansjz avatar tdelort avatar yw0208 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.