openpose icon indicating copy to clipboard operation
openpose copied to clipboard

What are the minimum requirements? Required Python Version?

Open TheConceptBoy opened this issue 2 years ago • 14 comments

I'm trying to set this up to test but I'm getting an error: Error: OpenPose library could not be found. Did you enable BUILD_PYTHON in CMake and have this Python script in the right folder? No module named 'pyopenpose'

This library is pretty old, with the last update in 2020 so it could be that it is not supported on the latest version of python. What version is required?

TheConceptBoy avatar May 12 '23 03:05 TheConceptBoy

I'm currently using 3.8.10 and it works fine with the python wrapper. Most probably in your python script the path you provided to the openpose_python.so file is wrong.

This is how i imported it

try:
    # Import Openpose (Windows/Ubuntu/OSX)
    dir_path = os.path.dirname(os.path.realpath(__file__))
    try:
        sys.path.append('/home/<path_to_openposefolder>/openpose/build/python')
        from openpose import pyopenpose as op
    except ImportError as e:
        logger.error('Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?')
        raise e

    # Custom Params (refer to include/openpose/flags.hpp for more parameters)
    params = dict()
    params["model_folder"] = "/home/<path_to_openposefolder>/openpose/models/"
    opWrapper = op.WrapperPython()
    opWrapper.configure(params)
    opWrapper.start()
    datum = op.Datum()
except Exception as e:
    logger.error("Failed to start Openpose wrapper, Ending current process...")
    sys.exit(-1)

JJLimmm avatar May 12 '23 03:05 JJLimmm

Also to add to this:

The release has the python version mentioned in the file name: openpose-1.7.0-binaries-win64-gpu-python3.7-flir-3d_recommended.zip

TheConceptBoy avatar May 12 '23 03:05 TheConceptBoy

Also the instructions page mentions: Python code example. But the example isn't python code but a cmd directory navigation and python file execution commnd:

image

TheConceptBoy avatar May 12 '23 03:05 TheConceptBoy

Also the instructions page mentions: Python code example. But the example isn't python code but a cmd directory navigation and python file execution commnd:

image

the python code example the authors were referring to is the one being run with the bash command... Go check out the openpose_python.py script to see the python code.

JJLimmm avatar May 12 '23 03:05 JJLimmm

Actually, this was the file I was attempting to run for the first time to test this out.

https://github.com/CMU-Perceptual-Computing-Lab/openpose/assets/52581279/7cc7b365-c6f7-4267-9eb0-453708325f19

Are we not supposed to run this fire directly? The Instructions.txt mentions it for a test.

TheConceptBoy avatar May 12 '23 03:05 TheConceptBoy

# Change these variables to point to the correct folder (Release/x64 etc.) 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

It is using relative directory to point itself to the location of the release. Which is correct and was included in the same zip file from the releases page. I'm not sure what else it wants to be pointed to.

sys.path.append(dir_path + '/../bin/python/openpose/Release'); specifically exists the python folder, and enters bin / python etc to reach the Release.

BUT this was executed by python 3.11. Maybe I need to run from python 3.7 or 3.8?

TheConceptBoy avatar May 12 '23 03:05 TheConceptBoy

Did you follow all the steps for building python? Did you check if you have a *.so file within your /openpose/build/python/ folder?

JJLimmm avatar May 12 '23 03:05 JJLimmm

# Change these variables to point to the correct folder (Release/x64 etc.) 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

It is using relative directory to point itself to the location of the release. Which is correct and was included in the same zip file from the releases page. I'm not sure what else it wants to be pointed to.

sys.path.append(dir_path + '/../bin/python/openpose/Release'); specifically exists the python folder, and enters bin / python etc to reach the Release.

BUT this was executed by python 3.11. Maybe I need to run from python 3.7 or 3.8?

probably, you can try with older versions of python and build the openpose python wrapper again. (PS noticed that you were using windows. I'm using Linux so the code snippet i showed above does not apply to your case.)

JJLimmm avatar May 12 '23 03:05 JJLimmm

Did you follow all the steps for building python? Did you check if you have a *.so file within your /openpose/build/python/ folder?

I only have what came with the openpose-1.7.0-binaries-win64-gpu-python3.7-flir-3d_recommended.zip Release file. This is on Windows 10. I was under impression that this did not require building anything as it came with binaries.

The instructions.txt also didn't mention building.

TheConceptBoy avatar May 12 '23 03:05 TheConceptBoy

Did you follow all the steps for building python? Did you check if you have a *.so file within your /openpose/build/python/ folder?

I only have what came with the openpose-1.7.0-binaries-win64-gpu-python3.7-flir-3d_recommended.zip Release file. This is on Windows 10. I was under impression that this did not require building anything as it came with binaries.

I think you should follow the instructions laid out by the authors for installing openpose on your system (Windows)

JJLimmm avatar May 12 '23 03:05 JJLimmm

Indeed I did.

`1. Double click on "models/getBaseModels.bat" to download the required body, face, and hand models. - Optional: Double click on "models/getCOCO_and_MPII_optional.bat" to download the COCO and MPII models (slower and less accurate, only download them if you really have a reason to do so). 2. Check all the info in: - https://github.com/CMU-Perceptual-Computing-Lab/openpose/tree/v1.7.0 - https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/v1.7.0/doc/ 3. Specially, the C++ quick start guide: - https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/v1.7.0/doc/quick_start.md 4. For Python, check both the C++ quick start guide (same flags) and the Python testing doc: - https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/v1.7.0/doc/quick_start.md - https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/v1.7.0/doc/modules/python_module.md#testing, but replace "cd build/examples/tutorial_api_python" by "cd python/". - NOTE: The rest of the python_module.md instructions are for the GitHub source code library, you can ignore them here. - Python code example:

cd {OpenPose_root_path} cd python/ python openpose_python.py

`

Is this not it? It doesn't mention a specific OS and cd is present on both Linux and Windows terminals

TheConceptBoy avatar May 12 '23 03:05 TheConceptBoy

I think the one you are trying to use is the Quick start windows portable demo version. The instructions you should follow is from here for the commands Windows Portable demo

JJLimmm avatar May 12 '23 03:05 JJLimmm

OR if you want to run the python wrapper, you would have to build the openpose files from source Follow this link here for the instructions which would tell you which commands you have to run for your specific system (Windows) : https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation/0_index.md#compiling-and-running-openpose-from-source:~:text=show%20this%20error).-,Compiling%20and%20Running%20OpenPose%20from%20Source,-The%20instructions%20in

JJLimmm avatar May 12 '23 03:05 JJLimmm

I think the one you are trying to use is the Quick start windows portable demo version. The instructions you should follow is from here for the commands Windows Portable demo

Aah there we go ok. Now I got the demo bat files to run at least. But of course next step is interfacing and extracting the bone data. I can go from here and try to figure out how to run the python script instead.

TheConceptBoy avatar May 12 '23 03:05 TheConceptBoy