pythonopenpose

How to cleanly install OpenPose?


I recently needed to work on visual computing, and I went through OpenPose, which looks like a promising tool.
GitHub link to OpenPose by CMU Perceptual Computing Lab

As I'm working on a Windows 10 and developing with Python 3.7.5 (I use other libraries that require Python<3.8), I followed the instruction given for Windows.
So at first, I used the "lazy way": just download the pre-built version v1.7.0, extract it, and execute the model/getBaseModels.bat script and everything went fine. I can even run the examples from the examples directory.

But the condition is to execute python in this directory, because in the source code of the *.py (which works fine, again), we can find this code:

sys.path.append(dir_path + '/../bin/python/openpose/Release');
os.environ['PATH']  = os.environ['PATH'] + ';' + dir_path + '/../x64/Release;' +  dir_path + '/../bin;'
import pyopenpose as op

Instead of a simple and clear
import pyopenpose as op
(And I find it strange that even the examples are using a workaround)

The reason is simply that in the folder ..\binwe find about 90 DLL and in ..\bin\python\openpose\Release\ we find those 3 files:

To be sure, I copied one script in a completely different folder, copied also the DLL and the 3 last files. In this case, if I run import pyopenpose with python, I get no error but I cannot run the example scripts (for example, module 'pyopenpose' has no attribute 'WrapperPython').
But I don't want to have to include all the 90 DLL for each project I make.

So I guess if all of these files were stored in the Python installation directory, like any package installed by pip, I could import all this with a simple import pyopenpose.

So my question is: What is the good way to install the pyopenpose package once we've downloaded it?


Additional information: by "curiosity", I also tried to go build the project with CMake, but, of course, the result is the same. I don't know much about CMake, but I thought that the issue could be bypassed by changing some parameters, like turning off the BUILD_SHARED_LIBS for example. But that wasn't very smart...


Additional question: I have to also install it on the Ubuntu I have at work, and I have the same problem. Would the solution be the same?


Solution

  • I have successfully installed openpose on ubuntu 22, python3.12. Here are some note to install openpose on ubuntu.
    Highly recommend this blog to install openpose: https://amir-yazdani.github.io/post/openpose/

    You also need to install cmake.

    Important note: Check the gcc version and make sure it is version 8.. Make sure that install gcc version 8. To install gcc version 8. check this post: https://askubuntu.com/questions/1446863/trying-to-install-gcc-8-and-g-8-on-ubuntu-22-04.

    when using ssh remote server, it cannot use the cmake-gui. But cmake-gui can work when you use the computer directly not through ssh remote server. After build openpose successfull. The result looks like this enter image description here

    To run the openpose, you also need to download the model. check this post: https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/1602#issuecomment-641653411 And done !!!