Run Openpose on Python (Windows)

Let's run Openpose on Windows 10 using Python It seems that the Python API can be used with OpenPose, so I tried it

Please note that the explanations written in the introductory explanations and tutorials are omitted.

For the time being, the official explanation is given in the tutorial below, but I will explain it because it did not go well according to the procedure. https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/modules/python_module.md#introduction

Step 1: Get OpenPose

https://github.com/CMU-Perceptual-Computing-Lab/openpose.git Clone

Step 2: Get pybind

openpose/3rdparty I think there is a folder called pybind11 inside, but I think it's empty That folder https://github.com/pybind/pybind11.git Let's replace it with a cloned one

Step 3: Create project file (Cmake)

https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation.md

Follow the Installation section here to finish before the Open Pose Building Please proceed firmly so that there are no mistakes I used the Cmake GUI as in the tutorial ** The important thing is to check BUILD_PYTHON on the way ** (Unchecked by default)

image.png

Step 4: Build (using Visual Studio)

Next, start OpenPose.sln in the completed openpose / build folder in Visual Studio. I used Visual Studio 2017 (I use the one set in CMake)

Here is one caveat For the official tutorial

CMake-GUI alternative (recommended): Open the Visual Studio solution (Windows), called build/OpenPose.sln. Then, set the configuration from Debug to Release and press the green triangle icon (alternatively press F5).

It says, but this wasn't enough to use the Python API. (Only minimal builds were done to get OpenPose working)

So, in the toolbar above Visual Studio Build-Build the solution Select to build. image.png

At this time, let's build in Release mode image.png

Step 5: Check if the Python module is generated

After the build is finished openpose\build\python\openpose\Release Please Confirm.

pyopenpose.cp37-win_amd64.pyd pyopenpose.exp pyopenpose.lib

I think that has been generated. (The file name may be slightly different depending on the environment. If there is no Release folder in the first place, what is wrong.)

This time,

pyopenpose.cp37-win_amd64.pyd

Cp37 shows that it is for python 3.7. If I try to load this with another python version, it probably won't load (I was really into it here)

So

  1. Match the pyhon version cp ○○ when executing the python script (next step)
  2. Change the Python version specified during CMake (the part of cp ○○ will change)

You need to do either. (I didn't know the method of 2, so if you can understand it, please let me know in the comments.)

Step 6: Run the Python file

openpose\build\examples\tutorial_api_python

Go to and run the sample file as appropriate (01_body_from_image.py etc.)

At this time, numpy and opencv-python are required Also be aware of the Python version, as mentioned in the previous step

If all goes well, the posture estimation result with the sample image will be displayed as shown below.

image.png

I would like to add a method to read pyopenpose other than this directory later.

Recommended Posts

Run Openpose on Python (Windows)
Python on Windows
Run servo with Python on ESP32 (Windows)
python basic on windows ②
Install python on windows
Install and run Python3.5 + NumPy + SciPy on Windows 10
Put MicroPython on Windows to run ESP32 on Python
Set-enable Python virtualenv on Windows
Run python with PyCharm (Windows)
Install watchdog on Windows + Python 3.3
Python + Kivy development on Windows
Sphinx-autobuild (0.5.2) on Windows7, Python 3.5.1, Sphinx 1.3.5
Fastest Python installation on Windows
Build Python environment on Windows
Run Tensorflow 2.x on Python 3.7
Run Python CGI on CORESERVER
Run unix command on python
Build python environment on windows
I ran python on windows
[Python] [Chainer] [Windows] Install Chainer on Windows
Use Python on Windows (PyCharm)
Run Jupyter Notebook on windows
Python environment construction memo on Windows 10
Python 3.6 on Windows ... and to Xamarin.
Installing Kivy on Windows10 64bit Python3.5
Anaconda python environment construction on Windows 10
Install python2.7 on windows 32bit environment
Install xgboost (python version) on Windows
Install Python on Windows + pip + virtualenv
Run Tensorflow natively supported on windows
Install Pytorch on Blender 2.90 python on Windows
Integrate Modelica and Python on Windows
Run Python on Schedule on AWS Lambda
Run TensorFlow Docker Image on Python3
Run SwitchBot on Windows 10 with Bleak
Installing Kivy-Designer on Windows10 64bit Python3.5
Mecab / Cabocha / KNP on Python + Windows
Run XGBoost on Bash on Ubuntu on Windows
Install Python development environment on Windows 10
Python CGI file created on Windows
Getting started with Python 3.8 on Windows
Reproduce One-Touch Search on Python 3.7.3. (Windows 10)
Periodically run Python on Heroku Scheduler
Notes for using OpenCV on Windows10 Python 3.8.3.
Run Radeon GPU on Windows on QEMU / KVM
Python 2.7, 3.4, 3.5 extension module build environment on Windows
twitter on python3
[Kivy] How to install Kivy on Windows [Python]
python windows environment
[Python] Run Flask on Google App Engine
Python installation (Windows)
Virtualenv does not work on Python3.5 (Windows)
Run AzureKinect in Python on Christmas Eve.
Creating a python virtual environment on Windows
Use without installing python 2.x on Windows
python on mac
Run servomotor on Raspberry Pi 3 using python
[Python] Run Headless Chrome on AWS Lambda
Run py.test on Windows Anaconda and MinGW
Run Python code on A2019 Community Edition
Python on Windbg