I didn't use this article because it was a discussion about using Openpose when I did it in the image hackathon I experienced, so I wanted to study it. In addition, I performed face recognition in Making a cat detector using OpenCV, which I posted so far, and studied whole body authentication and labeling in I tried using YOLOv3. This time I studied skeleton detection, so I will keep it as a record. Please take a look at the articles mentioned above! (20201221-5)
The article I referred to is here. [TensorFlow version] OpenPose (compatible with osx Mojave) on MacBook
OpenPose is a tool that allows you to easily display the skeleton of a person without motion capture. Macbook users have a built-in camera, so they can also draw real-time videos. This time I will try to perform skeleton detection on the image.
When executed, such an image will be created.
In this way, it is possible to embed something like a stick figure with skeletons connected in an image and output it. This can also be done with a video, so I'd like to try it next time.
First, install anaconda, which is used to create a virtual environment. Since anaconda is very convenient when using python, please check anaconda and install it if you have not installed it.
$ conda create -n pose python=3.6 anaconda
Next, let's enter the created virtual environment.
$ source activate pose
When you enter the virtual environment, the command will change as follows.
(pose) $
If this happens, use cd
to move to the directory you want to work in.
Next, clone from github and drop the repository used this time locally.
(pose) $ git clone https://github.com/ildoonet/tf-pose-estimation
Enter the file cloned on github with cd tf-pose-estimation
.
Then install the required modules.
(pose) $ pip install -r requirements.txt
(pose) $ pip install matplotlib
(pose) $ brew install swig
(pose) $ pip install numpy cython tensorflow==1.15.0 opencv-python
Up to this point, the environment has been installed and installed.
Go to the hierarchy called cmu with cd models/graph/cmu
(pose) $ bash download.sh
Install the required files with the above command.
In addition, change directory to ~/tf-pose-estimation/tf_pose/pafprocess /
.
(pose) $ swig -python -c++ pafprocess.i && python3 setup.py build_ext --inplace
(pose) $ sudo python setup.py build_ext --inplace
This is the end of setup. I didn't get an error, but some people do. The corrective action for those who have an error is described in detail in Reference article, so I will omit it. Let's do it! !!
Let's do it!
Move the directory to run.
(pose) $ cd tf-pose-estimation/src
Let's do it!
$ python run.py --model=mobilenet_thin --resize=432x368 --image=images/p1.jpg
An image called p1.jpg was included as a sample. p1.jpg is here
I tried to do that this time. The result of the execution is shown in the figure below.
In this way, it seems that it will output 4 types together, such as an image with a skeleton embedded in a color image and an image with a scale scale.
It's very interesting!
I tried skeleton detection, but I learned that there is gait authentication as an application. Gait authentication is said to distinguish people by looking at their "walking style." It is said that the way of walking is completely different depending on the person, and it seems that the authentication method to grasp the characteristics is also awkward. Next time, I would like to see gait certification!
I am very happy to be able to implement the model that was on the agenda at the hackathon I participated in and to absorb more of the hackathon experience.
Thank you for reading this far! Thank you for following and LGTM! Also, I am still studying, so please feel free to ask any questions, advice, or suggestions!
============================================= ~ List of articles posted in the past ~ [Image system] Making a cat detector with Google Colabratory (Part 1) [Python] ~ About scraping ~ Making a cat detector with Google Colabratory (Part 2) [Python] ~ Using OpenCV ~ [Python] I tried using YOLO v3
[Natural language processing] Classification of data using natural language processing
===============================================
reference [TensorFlow version] OpenPose (compatible with osx Mojave) performed on MacBook Install and run OpenPose on Mac (https://qiita.com/mml/items/8c24a5acc5f2d71b1df4)
Recommended Posts