/caffe2-pose-estimation

Caffe2 implementation of Realtime Multi-Person Pose Estimation

Primary LanguagePythonApache License 2.0Apache-2.0

caffe2-pose-estimation

This repo is a caffe2 implementation of Realtime Multi-Person Pose Estimation.

Prerequisites

Tested on Ubuntu 16.04 LTS with CUDA 8.0, Cudnn5.1 and Python 2.7.

Assuming the NVIDIA drivers, CUDA 8.0, and Cudnn5.1.10 are installed successfully. Installing some dependencies for the installation of Caffe2 framework. Please refer to the installation steps in the Caffe2 guide.

Install

Clone the repo.

$ git clone https://www.github.com/eddieyi/caffe2-pose-estimation
$ cd caffe2-pose-estimation

Download Pretrained Model

Then go to folder 'models/' and run the download script:

$ cd models/
$ bash download.sh

If the automatic download fails, you may manually download the model from GoogleDrive or BaiduYun and then put it in the folder 'models/'.

The pretrained model is converted from the original Caffe model using the converting tool of Detectron.

Inference

To run inference on a directory of image files, you can use the 'infer.py' script. For example, execute the following commands (in the main folder):

python2 infer.py --image-ext jpg

Notes: The first inference will be slower than the rest due to the program needs to load the model to the GPU memory.

Saving GPU Memory Consumption

To reduce the GPU memory consumption, the function 'optimize_memory' is implemented in the script 'infer.py'. It deploys the library 'memonger' of Caffe2, which can release the blob of an OP when the computation of this OP is finished. With this function, for an image with the height of 368, the GPU memory utilization should be around 1.2 GB, which is about 2~3 times less than the original Caffe implementation.

Here's an example of a prediction you should expect to see.

Example pose estimation output

References

[1] https://github.com/facebookresearch/Detectron

[2] https://github.com/ZheC/Realtime_Multi-Person_Pose_Estimation

[3] https://github.com/kevinlin311tw/keras-openpose-reproduce

[4] https://caffe2.ai/