本项目基于tf-pose-estimation并加入了LSTM,可对人体动作进行简单的识别
'Openpose', human pose estimation algorithm, have been implemented using Tensorflow. It also provides several variants that have 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 a descent FPS!
Original Repo(Caffe) : https://github.com/CMU-Perceptual-Computing-Lab/openpose
Implemented features are listed here : features
需要安装以下依赖
- python3
- tensorflow 1.4.1+
- keras2
- opencv3, protobuf, python3-tk
- 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.
$ git clone https://github.com/human-motion-detection/tf-pose-estimation
$ cd tf-pose-estimation
$ pip3 install -r requirements.txt
Build c++ library for post processing. See : https://github.com/human-motion-detection/tf-pose-estimation/tree/master/tf_pose/pafprocess
$ cd tf_pose/pafprocess
$ swig -python -c++ pafprocess.i && python3 setup.py build_ext --inplace
Alternatively, you can install this repo as a shared package using pip.
$ git clone https://www.github.com/ildoonet/tf-pose-estimation
$ cd tf-openpose
$ python setup.py install # Or, `pip install -e .`
See experiments.md
Before running demo, you should download graph files. You can deploy this graph on your mobile or other platforms.
- cmu (trained in 656x368)
- mobilenet_thin (trained in 432x368)
- mobilenet_v2_large (trained in 432x368)
- mobilenet_v2_small (trained in 432x368)
CMU's model graphs are too large for git, so I uploaded them on an external cloud. You should download them if you want to use cmu's original model. Download scripts are provided in the model folder.
$ cd models/graph/cmu
$ bash download.sh
使用单张图片进行测试
$ python run_img.py --model=mobilenet_thin --resize=432x368 --image=./images/p1.jpg
$ python run.py --model=mobilenet_thin --resize=432x368
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_img.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)
If you installed it as a package,
import tf_pose
coco_style = tf_pose.infer(image_path)
See : etcs/ros.md
See : etcs/training.md
See : etcs/reference.md