When I was researching articles on machine learning and Deep Leaning on MacBook Pro, I wrote an article that posture detection can be done on Mac. I found some and tried various things and it worked, so I will write it as a memorandum.
As a preparation, set up a Python virtual environment.
Create a python virtual environment.
$ virtualenv mppose
Enter the python virtual environment.
$ source mppose/bin/activate
We will set OpenPose.
Install the packages required for it to work.
$ pip3 install tensorflow ipython configobj keras pillow opencv-python
Clone and move the Keras backend version of the OpenPose repository.
$ git clone https://github.com/michalfaber/keras_Realtime_Multi-Person_Pose_Estimation.git
$ cd keras_Realtime_Multi-Person_Pose_Estimation/
Go to the model directory in the repository and download the caffe and keras training models.
$ cd model
$ sh get_caffe_model.sh
$ sh get_keras_model.sh
Empty init.Create a py.(In my environment, if I do not create this, the python module under the model directory cannot be read when running the python script later, and an error occurs.)
$ touch __init.py__
Go back to the top of the repository and dump caffe's numpy training model layer.
$ cd ../
$ docker run -v `pwd`:/workspace -it bvlc/caffe:cpu python dump_caffe_layers.py
Convert the training model layer of caffe for keras.
$ python caffe_to_keras.py
This completes the settings.
Try to detect the posture of the sample photo.
$ python demo_image.py --image sample_images/ski.jpg
Start the camera and try to detect the posture.
$ python demo_camera.py
When I tried to detect the posture with the camera, it seems that it can be detected in about 0.07 sec processing time, and it seems that the CPU alone works reasonably well. There seems to be other posture detection systems, so if there is something that can be done, I will try it again.
Recommended Posts