- Operating Systems, Requirements, and Dependencies
- Windows Portable Demo
- Compiling and Running OpenPose from Source
- Compiling and Running OpenPose from Source on ROS, Docker, and Google Colab - Community-Based Work
- Uninstalling, Reinstalling, or Updating OpenPose
- Additional Settings (Optional)
- Operating Systems
- Windows 10.
- Ubuntu 20.
- Mac OSX Mavericks and above.
- Ubuntu 14, 16 and 18 as well as Windows 7 and 8 are no longer officially maintained. However, they should still work (but might require minor changes).
- Nvidia Jetson TX1 (for JetPack 3.1), installation instructions in doc/installation/jetson_tx/installation_jetson_tx1.md.
- Nvidia Jetson TX2 (for JetPack 3.1 or 3.3), installation instructions in doc/installation/jetson_tx/installation_jetson_tx2_jetpack3.1.md and doc/installation/jetson_tx/installation_jetson_tx2_jetpack3.3.md respectively.
- OpenPose has also been used on CentOS and other Nvidia Jetson (TK1) embedded systems. However, we do not officially support them at the moment.
- Requirements for the default configuration
- CUDA (Nvidia GPU) version:
- NVIDIA graphics card with at least 1.6 GB available (the
nvidia-smi
command checks the available GPU memory in Ubuntu). - 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.
- NVIDIA graphics card with at least 1.6 GB available (the
- 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.
- CUDA (Nvidia GPU) version:
- Advanced tip: You might need more resources with a greater
--net_resolution
and/orscale_number
or less resources by reducing the net resolution and/or using the MPI and MPI_4 models. - 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.
If you just want to use OpenPose without compiling or writing any code, simply use the latest portable version of OpenPose for Windows.
- For maximum speed, you should use OpenPose in a machine with a Nvidia GPU version. If so, you must upgrade your Nvidia drivers to the latest version (in the Nvidia "GeForce Experience" software or its website).
- Download the latest OpenPose version from the Releases section.
- Follow the
Instructions.txt
file inside the downloaded zip file to download the models required by OpenPose (about 500 Mb). - Then, you can run OpenPose from the PowerShell command-line by following doc/01_demo.md.
Note: If you are using the GPU-accelerated version and are seeing Cuda check failed (3 vs. 0): initialization error
when running OpenPose, you can fix it by doing one of these:
- Upgrade your Nvidia drivers. If the error persists, make sure your machine does not contain any CUDA version (or if so, that it's the same than the OpenPose portable demo files). Otherwise, uninstall that CUDA version. If you need to keep that CUDA version installed, follow Compiling and Running OpenPose from Source for that particular CUDA version instead.
- Download an older OpenPose version (v1.6.0 does not show this error).
The instructions in the following subsections describe the steps to build OpenPose using CMake-GUI. These instructions are only recommended 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 without compiling or modifying any code.
Any problem installing OpenPose while following this guidelines? Check doc/05_faq.md and/or check existing GitHub issues. If you do you find your issue, post a new one. We will not respond to duplicated issues, as well as GitHub issues about Caffe, OpenCV or CUDA installation errors, as well as issues that do not fill all the information that the GitHub template asks for.
Make sure to download and install the prerequisites for your particular operating system.
The first step is to clone the OpenPose repository.
- Windows: You might use GitHub Desktop or clone it from Powershell.
- Ubuntu, Mac, or Windows Powershell:
git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose
cd openpose/
git submodule update --init --recursive --remote
- Go to the OpenPose folder and open CMake-GUI from it. On Windows, double click on CMake-gui. On Ubuntu, Mac, or Windows Powershell:
cd {OpenPose_folder}
mkdir build/
cd build/
cmake-gui ..
- Select the OpenPose directory as project source directory, and a non-existing or empty sub-directory (e.g.,
build
) where the Makefile files (Ubuntu) or Visual Studio solution (Windows) will be generated. Ifbuild
does not exist, it will ask you whether to create it. PressYes
.
- Press the
Configure
button, keep the generator inUnix Makefiles
(Ubuntu) or set it to your 64-bit Visual Studio version (Windows), and pressFinish
. Note for Windows users: CMake-GUI has changed their design after version 14. For versions older than 14, you usually selectVisual Studio XX 20XX Win64
as the generator (X
depends on your VS version), while theOptional toolset to use
must be empty. However, new CMake versions require you to select only the VS version as the generator, e.g.,Visual Studio 16 2019
, and then you must manually choosex64
for theOptional platform for generator
. See the following images as example.
-
Enabling Python (optional step, only apply it if you plan to use the Python API): Enable the
BUILD_PYTHON
flag and clickConfigure
again. -
Set the
GPU_MODE
flag to the proper value and clickConfigure
again:- If your machine has an Nvidia GPU, you should most probably not modify this flag and skip this step. Cases in which you might have to change it:
- If you have a Nvidia GPU with 2GB of memory or less: Then you will have to follow some of the tricks in doc/06_maximizing_openpose_speed.md or change
GPU_MODE
back toCPU_ONLY
. - If you cannot install CUDA, then you can also set
GPU_MODE
toCPU_ONLY
.
- If you have a Nvidia GPU with 2GB of memory or less: Then you will have to follow some of the tricks in doc/06_maximizing_openpose_speed.md or change
- Mac OSX and machines with a non-Nvidia GPU (Intel or AMD GPUs): Set the
GPU_MODE
flag toCPU_ONLY
(easier to install but slower runtime) orOPENCL
(GPU-accelerated, it is harder to install but provides a faster runtime speed). For more details on OpenCV support, see doc/1_prerequisites.md and OpenCL Version. - If your machine does not have any GPU, set the
GPU_MODE
flag toCPU_ONLY
.
- If your machine has an Nvidia GPU, you should most probably not modify this flag and skip this step. Cases in which you might have to change it:
-
If this step is successful, the
Configuring done
text will appear in the bottom box in the last line. Otherwise, some red text will appear in that same bottom box.
- Press the
Generate
button and proceed to Compilation. You can now close CMake.
Note: For other optional and custom options (e.g., using your custom Caffe or OpenCV versions), see the Additional Settings (Optional) documentation.
Run the following commands in your terminal.
cd build/
make -j`nproc`
Run the following commands in your terminal:
cd build/
make -j`sysctl -n hw.logicalcpu`
Advanced tip: Mac provides both logicalcpu
and physicalcpu
, but we want the logical number for maximum speed.
If the default compilation fails with Caffe errors, install Caffe separately and set BUILD_CAFFE
to false in the CMake config. Steps:
- 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
cmake-gui
and make the following adjustments to the cmake config:BUILD_CAFFE
set to false.Caffe_INCLUDE_DIRS
set to/usr/local/include/caffe
.Caffe_LIBS
set to/usr/local/lib/libcaffe.dylib
.- Run
Configure
andGenerate
from CMake GUI.
If you face an OpenCV error during compiling time similar to fatal error: 'opencv2/highgui/highgui.hpp' file not found
, please apply the following patch (this error has been reported in the latest OSX 10.14):
cd 3rdparty/caffe; git apply ../../scripts/osx/mac_opencl_patch.txt
In order to build the project, select and run only one of the 2 following alternatives.
-
CMake-GUI alternative (recommended):
- Open the Visual Studio solution (Windows) by clicking in
Open Project
in CMake (or alternativelybuild/OpenPose.sln
). Then, set the configuration fromDebug
toRelease
. - Press F7 (or
Build
menu and click onBuild Solution
). - Important for Python version: Make sure not to skip step 2, it is not enough to click on F5 (Run), you must also
Build Solution
for the Python bindings to be generated. - After it has compiled, and if you have a webcam, you can press the green triangle icon (alternatively F5) to run the OpenPose demo with the default settings on the webcam.
- Open the Visual Studio solution (Windows) by clicking in
-
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.
- Run "MSVS 2019 Developer Command Console"
openpose\mkdir build cd build cmake .. -G "Visual Studio 16 2019" -A x64 -T v142 cmake --build . --config Release copy x64\Release\* bin\
- 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 BUILD_BIN_FOLDER
flag in CMake, copy all DLLs from {build_directory}/bin
into the folder where the generated openpose.dll
and *.exe
demos are, e.g., {build_directory}x64/Release
for the 64-bit release version.
If you are facing errors with these instructions, these are a set of alternative instructions created by the community:
- OpenPose 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.
- Video-tutorial: 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.
Check OpenPose was properly installed by running any demo example: doc/01_demo.md.
You can quickly add your custom code so that quick prototypes can be easily tested without having to create a whole new project just for it. See examples/user_code/README.md for more details.
If you do not want to use the Windows portable binaries nor compile it from source code, we add links to some community-based work based on OpenPose. Note: We do not support them, and we will remove new GitHub issues opened asking about them as well as block those users from posting again. If you face any issue, comment only in the GitHub issues links especified below, or ask the owner of them.
-
ROS examples:
- ROS example 1. For questions and more details, read and post ONLY on issue thread #891.
- ROS example 2 (based on a very old OpenPose version). For questions and more details, read and post ONLY on issue thread #51.
-
Docker Images. For questions and more details, read and post ONLY on issue thread #347.
- Dockerfile working also with CUDA 10:
- Option 1:
- 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:
- Dockerfile working also with CUDA 10:
-
Google Colab helper scripts: 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.
- Google Colab with Openpose 1.7.0: For questions and more details, read and post ONLY on issue thread #949.
- Google Colab 2/3: For questions and more details, read and post ONLY on issue thread #1736.
- Google Colab 3/3: For questions and more details, read and post ONLY on issue thread #949.
OpenPose can be easily uninstalled:
- (Ubuntu and Mac) If you ran
sudo make install
(which we do not recommend), then runsudo make uninstall
inbuild/
. - Remove the OpenPose folder.
In order to update it or reinstall it:
- Follow the above steps to uninstall it.
- Follow the Compiling and Running OpenPose from Source steps again.
Check the Additional Settings (Optional) documentation if you want to:
- Deploy or Export OpenPose to Other Projects
- Maximum Speed
- Faster CPU Version (Ubuntu Only)
- OpenCL Version
- COCO and MPI Models
- 3D Reconstruction Module
- Calibration Module
- Unity Compatible Version
- Compile without cuDNN
- Custom Caffe
- Custom NVIDIA NVCaffe
- Custom OpenCV
- Doxygen Documentation Autogeneration (Ubuntu Only)
- CMake Command Line Configuration (Ubuntu Only)