Coder Social home page Coder Social logo

ysterin / straps-3dhumanshapepose Goto Github PK

View Code? Open in Web Editor NEW

This project forked from akashsengupta1997/straps-3dhumanshapepose

0.0 0.0 0.0 9.37 MB

Code repository for the paper: Synthetic Training for Accurate 3D Human Pose and Shape Estimation in the Wild (BMVC 2020)

License: MIT License

Python 100.00%

straps-3dhumanshapepose's Introduction

STRAPS - Synthetic Training for Real Accurate Pose and Shape

Code repository for the paper:
Synthetic Training for Accurate 3D Human Pose and Shape Estimation in the Wild
Akash Sengupta, Ignas Budvytis, Roberto Cipolla
BMVC 2020
[paper][supplementary][SSP-3D dataset]
teaser

Installation

Requirements

  • Linux or macOS
  • Python ≥ 3.6

Instructions

We recommend using a virtual environment to install relevant dependencies:

python3 -m venv STRAPS
source STRAPS/bin/activate

After creating a virtual environment, first install torch and torchvision: pip install torch==1.4.0 torchvision==0.5.0

Then install (my fork of) detectron2 and its dependencies (cython and pycocotools):

pip install cython
pip install 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'
pip install 'git+https://github.com/akashsengupta1997/detectron2.git'

The remaining dependencies can be installed by simply running: pip install -r requirements.txt. This will be sufficient for inference. If you wish run model training, you will require the PyTorch port of Neural Mesh Renderer: pip install neural_renderer_pytorch==1.1.3.

Additional files

You will need to download the SMPL model. The neutral model is required for training and running the demo code. If you want to evaluate the model on datasets with gendered SMPL labels (such as 3DPW and SSP-3D), the male and female models are available here. You will need to convert the SMPL model files to be compatible with python3 by removing any chumpy objects. To do so, please follow the instructions here.

Download the required additional files here. Place both the SMPL model and the additional files in the additional directory such that they have the following structure and filenames:

STRAPS-3DHumanShapePose
├── additional                                # Folder with additional files
│   ├── smpl
│       ├── SMPL_NEUTRAL.pkl                  # Gender-neutral SMPL model 
│   ├── cocoplus_regressor.npy                # Cocoplus joints regressor
│   ├── J_regressor_h36m.npy                  # Human3.6M joints regressor
│   ├── J_regressor_extra.npy                 # Extra joints regressor
│   ├── neutral_smpl_mean_params_6dpose.npz   # Mean gender-neutral SMPL parameters
│   ├── smpl_faces.npy                        # SMPL mesh faces
│   ├── cube_parts.npy
│   └── vertex_texture.npy                    
└── ...

Model checkpoints

Download pre-trained model checkpoints for our SMPL regressor, as well as for PointRend and DensePose (via detectron2) from here. Place these files in the checkpoints directory.

Training data

If you wish to train using the STRAPS framework, we provide pre-processed npz files with training and validation pose parameters here. Place these files in the data directory. Note that the model described in the STRAPS paper was trained on SMPL poses from Human3.6M (obtained using MoSh). We cannot distribute these due to license limitations. However, we have prepared npz files with SMPL poses from the AMASS dataset to replace H3.6M, which should provide similar performance.

Inference

run_predict.py is used to run inference on a given folder of input images. For example, to run inference on the demo folder, do:

python run_predict.py --input ./demo --checkpoint checkpoints/straps_model_checkpoint.tar --silh_from pointrend

You can choose between using --silh_from pointrend and --silh_from densepose to obtain human silhouettes. PointRend provides more accurate silhouettes for easy body poses but DensePose is more robust to challenging body poses. Best results are achieved when the image is roughly cropped and centred around the subject person.

To test STRAPS against a wide range of body shapes, we recommend checking out the SSP-3D dataset.

If you are running inference on a remote machine, you might run into problems getting pyrender to run off-screen/headless rendering. If you have EGL installed, uncommenting the appropriate line in run_predict.py might work. If not, simply disable pyrender rendering during inference.

NOTE: STRAPS requires inputs to be cropped around the predicted silhouette, with the tight bounding box scaled up by a factor of 1.2. I forgot to add the cropping step to the inference code in this repo, it will be added soon! In the meantime, note that using non-cropped inputs can result in worse 3D reconstructions.

Training

The training options within the run_train.py file can be edited as desired. Since STRAPS does not require image data, the only training data you are required to download are the pre-processed npz files (above). Then, simply do python run_train.py.

Citations

If you find this code useful in your research, please cite the following publication:

@InProceedings{STRAPS2020BMVC,
               author = {Sengupta, Akash and Budvytis, Ignas and Cipolla, Roberto},
               title = {Synthetic Training for Accurate 3D Human Pose and Shape Estimation in the Wild},
               booktitle = {British Machine Vision Conference (BMVC)},
               month = {September},
               year = {2020}                         
}

Acknowledgments

Code was adapted from/influenced by the following repos - thanks to the authors!

straps-3dhumanshapepose's People

Contributors

akashsengupta1997 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.