The website uses cookies. By using this site, you agree to our use of cookies as described in the Privacy Policy.
I Agree
blank_error__heading
blank_error__body
Text direction?

OpenPose - Installation

Contents

Windows Portable Demo

If you just want to use the OpenPose demo in Windows, simply use the latest version of the OpenPose portable binaries which you can download in the Releases section. Read the inside the downloaded files to learn to download the models required by OpenPose (about 500 Mb).Instructions.txt

The installation documentation in the following sections is only intended if you plan to modify the OpenPose code or integrate it with another library or project. You can stop reading this document if you just wanted to run OpenPose on Windows.

Installation Video Tutorials

User-created tutorial videos:

  • OpenPose + Visual Studio 2017 + CUDA 10.0 + cuDNN 7.5 (no portable demo): https://youtu.be/QC9GTb6Wsb4. For questions, post in GitHub issue #1426.

We welcome users to send us their installation videos (e.g., sharing them as GitHub issue or doing a pull request) and we will post them here.

Operating Systems

Community-Based Work

We add links to some community-based work based on OpenPose. Note: We do not support them, and we will remove GitHub issues opened asking about them as well as block those users from posting again. If you face any issue, comment only in the comment IDs especified below and/or on their respective GitHubs.

  • ROS examples:

  • Docker Images. For questions and more details, read and post ONLY on issue thread #347.

    • Dockerfile working also with CUDA 10:
      • Option 1:
          1. (if necessary) Install the latest version of docker (There are extra steps, but if you're on Ubuntu, the main one is . Other steps can be found heresudo apt-get install docker-ce )
          1. docker pull exsidius/openpose - Guide
          1. more details
      • Link 2, it claims to also include Python support. Read and post ONLY on issue thread #1102.
      • Link 3.
      • Link 4.
    • Dockerfile working only with CUDA 8:
  • Google Colab helper script: Script to install OpenPose on Google Colab. Really useful when access to a computer powerful enough to run OpenPose is not possible, so one possible way to use OpenPose is to build it on a GPU-enabled Colab runtime and then run the programs there. For questions and more details, read and post ONLY on issue thread #949.

Requirements and Dependencies

  • Requirements for the default configuration (you might need more resources with a greater and/or or less resources by reducing the net resolution and/or using the MPI and MPI_4 models): --net_resolutionscale_number
    • CUDA (Nvidia GPU) version:
      • NVIDIA graphics card with at least 1.6 GB available (the command checks the available GPU memory in Ubuntu).nvidia-smi
      • At least 2.5 GB of free RAM memory for BODY_25 model or 2 GB for COCO model (assuming cuDNN installed).
      • Highly recommended: cuDNN.
    • OpenCL (AMD GPU) version:
      • Vega series graphics card
      • At least 2 GB of free RAM memory.
    • CPU-only (no GPU) version:
      • Around 8GB of free RAM memory.
    • Highly recommended: a CPU with at least 8 cores.
  • Dependencies:
    • OpenCV (all 2.X and 3.X versions are compatible).
    • Caffe and all its dependencies. Have you ported OpenPose into another DL framework (Tensorflow, Caffe2, Pytorch, ...)?. Email us (gines@alumni.cmu.edu) or feel free to make a pull request if you implemented any of those!
    • The demo and tutorials additionally use GFlags.

Clone OpenPose

The first step is to clone the OpenPose repository.

  1. Windows: You might use GitHub Desktop.
  2. Ubuntu/Mac:
git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose

Update OpenPose

OpenPose can be easily updated by:

  1. Download the latest changes:
    1. Windows: Clicking the button at the top-right part in GitHub Desktop in Windows.synchronization
    2. Ubuntu: running .git pull origin master
  2. Perform the Reinstallation section described below.

Installation

The instructions in this section describe the steps to build OpenPose using CMake (GUI). There are 3 main steps:

Problems and Errors Installing

Any problem installing OpenPose? Check doc/faq.md and/or post a GitHub issue. We will not respond more GitHub issues about Caffe, OpenCV or CUDA errors.

Prerequisites

Make sure to download and install the prerequisites for your particular operating system following doc/prerequisites.md.

OpenPose Configuration

  1. Open CMake GUI and select the OpenPose directory as project source directory, and a non-existing or empty sub-directory (e.g., ) where the Makefile files (Ubuntu) or Visual Studio solution (Windows) will be generated. If does not exist, it will ask you whether to create it. Press .buildbuildYes

  1. Press the button, keep the generator in (Ubuntu) or set it to your 64-bit Visual Studio version (Windows), and press . Note for Windows users: CMake-GUI has changed their design after version 14. For versions older than 14, you usually select as the generator ( depends on your VS version), while the must be empty. However, new CMake versions require you to select only the VS version as the generator, e.g., , and then you must manually choose for the . See the following images as example.ConfigureUnix MakefileFinishVisual Studio XX 20XX Win64XOptional toolset to useVisual Studio 15 2017x64Optional platform for generator

  1. If this step is successful, the text will appear in the bottom box in the last line. Otherwise, some red text will appear in that same bottom box.Configuring done

  1. Press the button and proceed to OpenPose Building. You can now close CMake.Generate

Note: If you prefer to use your own custom Caffe or OpenCV versions, see Custom Caffe or Custom OpenCV respectively.

OpenPose Building

Ubuntu

Build the project by running the following commands.

cd build/
make -j`nproc`

Mac

Build the project by running the following commands (note that Mac provides both and , but we want the logical number for maximum speed).logicalcpuphysicalcpu

cd build/
make -j`sysctl -n hw.logicalcpu`

Windows

In order to build the project, select and run only one of the 2 following alternatives.

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

  2. Command-line build alternative (not recommended). NOTE: The command line alternative is not officially supported, but it was added in GitHub issue #1198. For any questions or bug report about this command-line version, comment in that GitHub issue.

    1. Run "MSVS 2017 Developer Command Console"
    openpose\mkdir  build
    cd build
    cmake .. -G "Visual Studio 15 2017 Win64" -T v140
    cmake --build . --config Release
    copy x64\Release\*  bin\
    
    1. If you want to clean build
    cmake --clean-first .
    cmake --build . --config Release
    copy x64\Release\*  bin\
    

VERY IMPORTANT NOTE: In order to use OpenPose outside Visual Studio, and assuming you have not unchecked the flag in CMake, copy all DLLs from into the folder where the generated and demos are, e.g., for the 64-bit release version.BUILD_BIN_FOLDER{build_directory}/binopenpose.dll*.exe{build_directory}x64/Release

Run OpenPose

Check OpenPose was properly installed by running it on the default images, video, or webcam: doc/quick_start.md#quick-start.

Alternative Windows Instructions

If you are facing errors with these instructions, these are a set of alternative instructions created by the community for Windows 10, Visual Studio 2019, CMake, and Nvidia GPU: https://github.com/quickgrid/Build-Guide/blob/master/README.md#windows-10-cmu-openpose-setup-visual-studio-2019-cmake-nvidia-gpu.

Reinstallation

In order to re-install OpenPose:

  1. (Ubuntu and Mac) If you ran , then run in .sudo make installsudo make uninstallbuild/
  2. Delete the folder.build/
  3. In CMake GUI, click on --> .FileDelete Cache
  4. Follow the Installation steps again.

Uninstallation

In order to uninstall OpenPose:

  1. (Ubuntu and Mac) If you ran , then run in .sudo make installsudo make uninstallbuild/
  2. Remove the OpenPose folder.

Deploying OpenPose (Exporting OpenPose to Other Projects)

See doc/deployment.md.

Optional Settings

Maximum Speed

Check the OpenPose Benchmark as well as some hints to speed up and/or reduce the memory requirements for OpenPose on doc/speed_up_openpose.md.

COCO and MPI Models

By default, the body COCO and MPI models are not downloaded. You can download them by turning on the or flags. It's slightly faster but less accurate and has less keypoints than the COCO body model.DOWNLOAD_BODY_COCO_MODELDOWNLOAD_BODY_MPI_MODEL

Note: Check the differences between these models in doc/faq.md#difference-between-body_25-vs.-coco-vs.-mpi.

Python API

To install the Python API, ensure that the flag is turned on while running CMake GUI and follow the standard installation steps. After the installation, check doc/modules/python_module.md for further details.BUILD_PYTHON

CPU Version

To manually select the CPU Version, open CMake GUI mentioned above, and set the flag to . NOTE: Accuracy of the CPU version is ~1% higher than CUDA version, so the results will vary.GPU_MODECPU_ONLY

  • On Ubuntu, OpenPose will link against the Intel MKL version (Math Kernel Library) of Caffe. Alternatively, the user can choose his own Caffe version, by unselecting and selecting his own Caffe path.USE_MKL
  • On Windows, it will use the default version of Caffe or one provided by the user on the CPU.

The default CPU version takes ~0.2 images per second on Ubuntu (~50x slower than GPU) while the MKL version provides a roughly 2x speedup at ~0.4 images per second. As of now OpenPose does not support MKL on Windows but will at a later date. Also, MKL version does not support unfixed resolution. So a folder of images of different resolutions requires a fixed net resolution (e.g., ).--net_resolution 656x368

The user can configure the environmental variables and . They are set at an optimum parameter level by default (i.e., to the number of threads of the machine). However, they can be tweak by running the following commands into the terminal window, right before running any OpenPose application. Eg:MKL_NUM_THREADSOMP_NUM_THREADS

# Optimal number = Number of threads (used by default)
export MKL_NUM_THREADS="8"
export OMP_NUM_THREADS="8"

Do note that increasing the number of threads results in more memory use. You can check the doc/speed_up_openpose.md for more information about speed and memory requirements in several CPUs and GPUs.

OpenCL Version

If you have an AMD graphics card, you can compile OpenPose with the OpenCL option. To manually select the OpenCL Version, open CMake GUI mentioned above, and set the flag to . Very important: If you compiled previously the CPU-only or CUDA versions on that same OpenPose folder, you will have to manually delete the directory and run the installation steps from scratch. Otherwise, many weird errors will appear.GPU_MODEOPENCLbuild

The OpenCL version has been tested on Ubuntu, Windows and OSX. This has been tested only on AMD Vega series and NVIDIA 10 series graphics cards. Please email us if you have issues with other operating systems or graphics cards. Running on OSX on a Mac with an AMD graphics card requires special instructions which can be seen in the section below.

Lastly, OpenCL version does not support unfixed . So a folder of images of different resolutions with OpenPose, requires the flag for example. This should be fixed by the Caffe author in a future patch.--net_resolution--net_resolution 656x368

Mac OSX Version

Mac OSX Version compiles similarly to the Ubuntu version. Take a look at the prerequisites section. For GPU acceleration, OpenPose may be built with OpenCL support (check OpenCL Version or add in CMake). If you have a Mac with an inbuilt AMD graphics card, you have to manually select your AMD GPU. To do that, first note which device your Graphics card is set under:GPU_MODE=OPENCL

clinfo

Most likely, your AMD device will be under device 2. Then run openpose with the following options to use youe AMD card for acceleration.

build/examples/openpose/openpose.bin --num_gpu 1 --num_gpu_start 2

If you only have an integrated Intel Graphics card, then it will most probably be the device 1:

build/examples/openpose/openpose.bin --num_gpu 1 --num_gpu_start 1

Also as a side note, if the default installation fails (i.e., the one explained above), install Caffe separately and set to false in the CMake config. Steps:BUILD_CAFFE

  • Re-create the build folder: .rm -rf build; mkdir build; cd build
  • brew uninstall caffe to remove the version of Caffe previously installed via cmake.
  • brew install caffe to install Caffe separately.
  • Run and make the following adjustments to the cmake config: cmake-gui
    1. BUILD_CAFFE set to false.
    2. Caffe_INCLUDE_DIRS set to ./usr/local/include/caffe
    3. Caffe_LIBS set to ./usr/local/lib/libcaffe.dylib
    4. Run and from CMake GUI.ConfigureGenerate

In addition, if you face an OpenCV error during compiling time similar to , please apply the following patch (this error has been reported in the latest OSX 10.14):fatal error: 'opencv2/highgui/highgui.hpp' file not found

cd 3rdparty/caffe; git apply ../../scripts/osx/mac_opencl_patch.txt

3D Reconstruction Module

You can include the 3D reconstruction module by:

  1. Install the FLIR camera software, Spinnaker SDK. It is a propietary software, so we cannot provide direct download link. Note: You might skip this step if you intend to use the 3-D OpenPose module with a different camera brand.
    1. Ubuntu: Get and install the latest Spinnaker SKD version in their default path. OpenPose will automatically find it. Otherwise, set the right path with CMake.
    2. Windows: Donwload the latest Spinnaker SKD version from https://www.ptgrey.com/support/downloads.
      • Copy as . You can remove all the *.exe files.{PointGreyParentDirectory}\Point Grey Research\Spinnaker\bin64\vs2015\{OpenPoseDirectory}\3rdparty\windows\spinnaker\bin\
      • Copy as .{PointGreyParentDirectory}\Point Grey Research\Spinnaker\include\{OpenPoseDirectory}\3rdparty\windows\spinnaker\include\
      • Copy and from into .Spinnaker_v140.libSpinnakerd_v140.lib{PointGreyParentDirectory}\Point Grey Research\Spinnaker\lib64\vs2015\{OpenPoseDirectory}\3rdparty\windows\spinnaker\lib\
      • (Optional) Spinnaker SDK overview: https://www.ptgrey.com/spinnaker-sdk.
  2. Install the 3D visualizer, FreeGLUT:
    1. Ubuntu: run and reboot your PC.sudo apt-get update && sudo apt-get install build-essential freeglut3 freeglut3-dev libxmu-dev libxi-dev
    2. Windows:
      1. It is automatically downloaded by the CMake installer.
      2. Alternatively, if you prefer to download it yourself, you could either:
        1. Double click on .3rdparty\windows\getFreeglut.bat
        2. Download this version from our server and unzip it in .{OpenPoseDirectory}\3rdparty\windows\freeglut\
        3. Download the latest from http://www.transmissionzero.co.uk/software/freeglut-devel/. MSVC Package
          • Copy as .{freeglutParentDirectory}\freeglut\bin\x64\{OpenPoseDirectory}\3rdparty\windows\freeglut\bin\
          • Copy as .{freeglutParentDirectory}\freeglut\include\{OpenPoseDirectory}\3rdparty\windows\freeglut\include\
          • Copy as .{freeglutParentDirectory}\freeglut\lib\x64\{OpenPoseDirectory}\3rdparty\windows\freeglut\lib\
  3. Follow the CMake installation steps. In addition, set the (only if Spinnaker was installed) and options.WITH_FLIR_CAMERAWITH_3D_RENDERER
  4. Increased accuracy with Ceres solver (Ubuntu only): For extra 3-D reconstruction accuracy, run , install Ceres solver, and enable in CMake when installing OpenPose. Ceres is harder to install in Windows, so we have not tested it so far in there. Feel free to make a pull request if you do.sudo apt-get install libeigen3-devWITH_CERES

After installation, check the doc/modules/3d_reconstruction_module.md instructions.

Calibration Module

The calibration module is included by default, but you must also enable if you intend to use the extrinsic camera parameter estimation tool. You can set that flag to 2 different values: or , check Requirements and Dependencies for more information.WITH_EIGENBUILDFIND

After installation, check the doc/modules/calibration_module.md instructions.

Unity Compatible Version

Check Unity Plugin.

However, the OpenPose Unity version will crash if if faces an error while it is not used inside Unity. Thus, do not use it without Unity. Although this version would work as long as no errors occur.

Compiling without cuDNN

The cuDNN library is not mandatory, but required for full keypoint detection accuracy. In case your graphics card is not compatible with cuDNN, you can disable it by unchecking in CMake.USE_CUDNN

Then, you would have to reduce the flag to fit the model into the GPU memory. You can try values like , , , or to see your GPU memory capabilities. After finding the maximum approximate resolution that your GPU can handle without throwing an out-of-memory error, adjust the ratio to your image or video to be processed (see the explanation from doc/demo_overview.md), or use (e.g., ).--net_resolution640x320320x240320x160160x80net_resolution--net_resolution-1--net_resolution -1x320

Custom Caffe

OpenPose uses a custom fork of Caffe (rather than the official Caffe master). Our custom fork is only updated if it works on our machines, but we try to keep it updated with the latest Caffe version. This version works on a newly formatted machine (Ubuntu 16.04 LTS) and in all our machines (CUDA 8 and 10 tested). The default GPU version is the master branch, which it is also compatible with CUDA 10 without changes (official Caffe version might require some changes for it). We also use the OpenCL and CPU tags if their CMake flags are selected. We only modified some Caffe compilation flags and minor details.

Alternatively, you can use your own Caffe distribution on Ubuntu/Mac by 1) disabling , 2) setting to , and 3) setting to , as shown in the image below. Note that cuDNN-compatible Caffe version is required in order to get the maximum possible accuracy in OpenPose.BUILD_CAFFECaffe_INCLUDE_DIRS{CAFFE_PATH}/include/caffeCaffe_LIBS{CAFFE_PATH}/build/lib/libcaffe.so

For Windows, simply replace the OpenCV DLLs and include folder for your custom one.

Custom NVIDIA NVCaffe

This functionality was added by the community, and we do not officially support it. New pull requests with additional functionality or fixing any bug are welcome!

It has been tested with the official Nvidia Docker image nvcr.io/nvidia/caffe:18.12-py2.

For questions and issues, please only post on the related Pull Request #1169. New GitHub issues about this topic (i.e., outside PR #1169) will be automatically closed with no answer.

Windows support has not been added. Replace by in if you intend to use it for Windows, and feel free to do a pull request of it working!set_property(CACHE DL_FRAMEWORK PROPERTY STRINGS CAFFE)set_property(CACHE DL_FRAMEWORK PROPERTY STRINGS CAFFE NV_CAFFE)CMakeLists.txt

To use a NVIDIA's NVCaffe docker image instead of the standard Caffe, set the following CMake flags:

  1. Set the variable to .DL_FRAMEWORKNV_CAFFE
  2. Set the variable to .BUILD_CAFFEOFF
  3. Set the correct and paths following Custom Caffe.Caffe_INCLUDE_DIRSCaffe_LIBS

In addition, peter-uhrig.de/openpose-with-nvcaffe-in-a-singularity-container-with-support-for-multiple-architectures/ contains a detailed step-by-step guide to install a portable container with NVCaffe and support for multiple NVidia cards as well as CPU.

Custom OpenCV

If you have built OpenCV from source and OpenPose cannot find it automatically, you can set the variable to the directory where you build OpenCV (Ubuntu and Mac). For Windows, simply replace the OpenCV DLLs and include folder for your custom one.OPENCV_DIR

Doxygen Documentation Autogeneration (Ubuntu Only)

You can generate the documentation by setting the flag. The documentation will be generated in . You can simply open it with double-click (your default browser should automatically display it).BUILD_DOCSdoc/doxygen/html/index.html

CMake Command Line Configuration (Ubuntu Only)

Note that this step is unnecessary if you already used the CMake GUI alternative.

Create a folder in the root OpenPose folder, where you will build the library --build

cd openpose
mkdir build
cd build

The next step is to generate the Makefiles. Now there can be multiple scenarios based on what the user already has e.x. Caffe might be already installed and the user might be interested in building OpenPose against that version of Caffe instead of requiring OpenPose to build Caffe from scratch.

Scenario 1 - Caffe not installed and OpenCV installed using apt-get

In the build directory, run the below command --

cmake ..
Scenario 2 - Caffe installed and OpenCV build from source

In this example, we assume that Caffe and OpenCV are already present. The user needs to supply the paths of the libraries and the include directories to CMake. For OpenCV, specify the include directories and the libraries directory using and variables respectively. Alternatively, the user can also specify the path to the file by setting the variable. For Caffe, specify the include directory and library using the and variables. This will be where you installed Caffe. Below is an example of the same.OpenCV_INCLUDE_DIRSOpenCV_LIBS_DIROpenCVConfig.cmakeOpenCV_CONFIG_FILECaffe_INCLUDE_DIRSCaffe_LIBS

cmake -DOpenCV_INCLUDE_DIRS=/home/"${USER}"/softwares/opencv/build/install/include \
  -DOpenCV_LIBS_DIR=/home/"${USER}"/softwares/opencv/build/install/lib \
  -DCaffe_INCLUDE_DIRS=/home/"${USER}"/softwares/caffe/build/install/include \
  -DCaffe_LIBS=/home/"${USER}"/softwares/caffe/build/install/lib/libcaffe.so -DBUILD_CAFFE=OFF ..
cmake -DOpenCV_CONFIG_FILE=/home/"${USER}"/softwares/opencv/build/install/share/OpenCV/OpenCVConfig.cmake \
  -DCaffe_INCLUDE_DIRS=/home/"${USER}"/softwares/caffe/build/install/include \
  -DCaffe_LIBS=/home/"${USER}"/softwares/caffe/build/install/lib/libcaffe.so -DBUILD_CAFFE=OFF ..
Scenario 3 - OpenCV already installed

If Caffe is not already present but OpenCV is, then use the below command.

cmake -DOpenCV_INCLUDE_DIRS=/home/"${USER}"/softwares/opencv/build/install/include \
  -DOpenCV_LIBS_DIR=/home/"${USER}"/softwares/opencv/build/install/lib ..
cmake -DOpenCV_CONFIG_FILE=/home/"${USER}"/softwares/opencv/build/install/share/OpenCV/OpenCVConfig.cmake ..
Any Other Scenario

You can check the CMake online documentation to check all the options that CMake provides and its analogs to the CMake-gui ones that we show on this document.

Measure
Measure
Related Notes
Get a free MyMarkup account to save this article and view it later on any device.
Create account

End User License Agreement

Summary | 1 Annotation
e Instructions.txt
2020/03/25 01:48