Original Git here
'Openpose' for human pose estimation have been implemented using Tensorflow. It also provides several variants that have made some changes to the network structure for real-time processing on the CPU or low-power embedded devices.
You can even run this on your macbook with descent FPS!
Original Repo(Caffe) : https://github.com/CMU-Perceptual-Computing-Lab/openpose
Implemented features are listed here : features
2018.5.21 Post-processing part is implemented in c++. It is required compiling the part. See: https://github.com/ildoonet/tf-pose-estimation/tree/master/src/pafprocess 2018.2.7 Arguments in run.py script changed. Support dynamic input size.
You need dependencies below.
- python
- tensorflow 1.4.1
- opencv, protobuf, python-tk
- slim
- slidingwindow
- https://github.com/adamrehn/slidingwindow
- I copied from the above git repo to modify few things.
Clone the repo and install 3rd-party libraries.
$ pip install tensorflow==1.4.1
$ pip install matplotlib==2.0.0
# apt install python-tk swig
$ pip install psutil scipy
$ git clone https://www.github.com/k5iogura/tf-pose-estimation_fs
$ cd tf-pose-estimation_fs
$ pip install -r requirements.txt
Build c++ library for post processing. See : https://github.com/ildoonet/tf-pose-estimation/tree/master/tf_pose/pafprocess
$ cd tf_pose/pafprocess
$ swig -python -c++ pafprocess.i && python setup.py build_ext --inplace
$ cd tf-pose-estimation_fs
$ python -c 'import tf_pose; tf_pose.infer(image="./images/p1.jpg")'
[2019-01-21 17:15:12,966] [TfPoseEstimator] [INFO] loading graph from
tf-pose-estimation_fs/models/graph/mobilenet_thin/graph_opt.pb(default size=432x368)
$
Notice: No more original cmu and mobilenet .pb file on dropbox area.
Use Download script on models/pretrained.
Dataset | Model | Inference Time Macbook Pro i5 3.1G |
Inference Time Jetson TX2 |
---|---|---|---|
Coco | cmu | 10.0s @ 368x368 | OOM @ 368x368 5.5s @ 320x240 |
Coco | dsconv | 1.10s @ 368x368 | |
Coco | mobilenet_accurate | 0.40s @ 368x368 | 0.18s @ 368x368 |
Coco | mobilenet | 0.24s @ 368x368 | 0.10s @ 368x368 |
Coco | mobilenet_fast | 0.16s @ 368x368 | 0.07s @ 368x368 |
You can test the inference feature with a single image.
$ python run.py --model=mobilenet_thin --resize=432x368 --image=./images/p1.jpg
The image flag MUST be relative to the src folder with no "~", i.e:
--image ../../Desktop
Then you will see the screen as below with pafmap, heatmap, result and etc.
$ python run_webcam.py --model=mobilenet_thin --resize=432x368 --camera=0
Then you will see the realtime webcam screen with estimated poses as below. This Realtime Result was recored on macbook pro 13" with 3.1Ghz Dual-Core CPU.
This pose estimator provides simple python classes that you can use in your applications.
See run.py or run_webcam.py as references.
e = TfPoseEstimator(get_graph_path(args.model), target_size=(w, h))
humans = e.inference(image)
image = TfPoseEstimator.draw_humans(image, humans, imgcopy=False)
See : etcs/ros.md
See : etcs/training.md
[1] https://github.com/CMU-Perceptual-Computing-Lab/openpose
[2] Training Codes : https://github.com/ZheC/Realtime_Multi-Person_Pose_Estimation
[3] Custom Caffe by Openpose : https://github.com/CMU-Perceptual-Computing-Lab/caffe_train
[4] Keras Openpose : https://github.com/michalfaber/keras_Realtime_Multi-Person_Pose_Estimation
[5] Keras Openpose2 : https://github.com/kevinlin311tw/keras-openpose-reproduce
[1] Arxiv Paper : https://arxiv.org/abs/1701.00295
[2] https://github.com/DenisTome/Lifting-from-the-Deep-release
[1] Original Paper : https://arxiv.org/abs/1704.04861
[2] Pretrained model : https://github.com/tensorflow/models/blob/master/slim/nets/mobilenet_v1.md
[1] Tensorpack : https://github.com/ppwwyyxx/tensorpack
[1] Freeze graph : https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/freeze_graph.py
[2] Optimize graph : https://codelabs.developers.google.com/codelabs/tensorflow-for-poets-2