Are you sure you want to delete this access key?
This installation section is only intended if you plan to modify the OpenPose code or integrate it with another library or project. If you just want to use the OpenPose demo in Windows, simply use the latest version of the OpenPose binaries which you can find in the Releases section.
NOTE: Read the Instructions.txt
to learn to download the models required by OpenPose (about 500 Mb).
Requirements for the default configuration (you might need more resources with a greater --net_resolution
and/or scale_number
or less resources by reducing the net resolution and/or using the MPI and MPI_4 models):
nvidia-smi
command checks the available GPU memory in Ubuntu).The first step is to clone the OpenPose repository.
git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose
OpenPose can be easily updated by:
synchronization
button at the top-right part in GitHub Desktop in Windows.git pull origin master
.The instructions in this section describe the steps to build OpenPose using CMake (GUI). There are 3 main steps:
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.
sudo apt-get install cmake-qt-gui
. Note: If you prefer to use CMake through the command line, see Cmake Command Line Build.cmake-X.X.X-win64-x64.msi
.brew cask install cmake
..vcxproj
file and changing the necessary paths from CUDA 8 to 9.sudo ubuntu/install_cuda.sh
or alternatively download and install it from their website.CUDA_TOOLKIT_ROOT_DIR not found or specified
or any other CUDA component missing, then: 1) Re-install Visual Studio 2015; 2) Reboot your PC; 3) Re-install CUDA.sudo ubuntu/install_cudnn.sh
or alternatively download and install it from their website./usr/local/cuda/
in Ubuntu and C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0
in Windows.sudo apt-get install libviennacl-dev
. This comes packaged inside OpenPose for Windows.sudo bash ./ubuntu/install_cmake.sh
.apt-get install libopencv-dev
. You can also use your own compiled OpenCV version.models/pose/coco/
.models/pose/mpi/
.models/face/
.models/hand/
.3rdparty/windows/
so that CMake does not try to download them again.3rdparty/windows/caffe/
.3rdparty/windows/caffe3rdparty/
.3rdparty/windows/opencv/
.bash 3rdparty/osx/install_deps.sh
on your terminal.WITH_EIGEN
flag when running CMake. You can either:
WITH_EIGEN
flag to BUILD
, CMake will automatically download Eigen. Alternatively, you might prefer to download it manually:
3rdparty/eigen/
.sudo apt-get install libeigen3-dev
(Ubuntu only) if you prefer to set WITH_EIGEN
to APT_GET
(Ubuntu only).WITH_EIGEN
to BUILD
, run CMake so that OpenPose downloads the zip file, and then replace the contents of 3rdparty/eigen/
by your own version.build
) where the Makefile files (Ubuntu) or Visual Studio solution (Windows) will be generated. If build
does not exist, it will ask you whether to create it. Press Yes
.
Configure
button, keep the generator in Unix Makefile
(Ubuntu) or set it to Visual Studio 14 2015 Win64
(Windows), and press Finish
.
Configuring done
text will appear in the bottom box in the last line. Otherwise, some red text will appear in that same bottom box.
Generate
button and proceed to OpenPose Building. You can now close CMake.Note: If you prefer to use your own custom Caffe or OpenCV versions, see Custom Caffe or Custom OpenCV respectively.
Finally, build the project by running the following commands.
cd build/
make -j`nproc`
In order to build the project, 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).
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.
Check OpenPose was properly installed by running it on the default images, video, or webcam: doc/quick_start.md#quick-start.
If you only intend to use the OpenPose demo, you might skip this step. This step is only recommended if you plan to use the OpenPose API from other projects.
To install the OpenPose headers and libraries into the system environment path (e.g. /usr/local/
or /usr/
), run the following command.
cd build/
sudo make install
Once the installation is completed, you can use OpenPose in your other project using the find_package
cmake command. Below, is a small example CMakeLists.txt
. In order to use this script, you also need to copy FindGFlags.cmake
and FindGlog.cmake
into your <project_root_directory>/cmake/Modules/
(create the directory if necessary).
cmake_minimum_required(VERSION 2.8.7)
add_definitions(-std=c++11)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
find_package(GFlags)
find_package(Glog)
find_package(OpenCV)
find_package(OpenPose REQUIRED)
include_directories(${OpenPose_INCLUDE_DIRS} ${GFLAGS_INCLUDE_DIR} ${GLOG_INCLUDE_DIR} ${OpenCV_INCLUDE_DIRS})
add_executable(example.bin example.cpp)
target_link_libraries(example.bin ${OpenPose_LIBS} ${GFLAGS_LIBRARY} ${GLOG_LIBRARY} ${OpenCV_LIBS})
If Caffe was built with OpenPose, it will automatically find it. Otherwise, you will need to link Caffe again as shown below (otherwise, you might get an error like /usr/bin/ld: cannot find -lcaffe
).
link_directories(<path_to_caffe_installation>/caffe/build/install/lib)
In order to re-install OpenPose:
sudo make install
, then run sudo make uninstall
in build/
.build/
folder.File
--> Delete Cache
.In order to uninstall OpenPose:
sudo make install
, then run sudo make uninstall
in build/
.OpenPose displays the FPS in the basic GUI. However, more complex speed metrics can be obtained from the command line while running OpenPose. In order to obtain those, compile OpenPose with the PROFILER_ENABLED
flag. OpenPose will automatically display time measurements for each subthread after processing F
frames (by default F = 1000
, but it can be modified with the --profile_speed
flag).
FPS = 1000/millisecond_measurement
.n
graphic cards, you will have to wait up to n
x F
frames to visualize each graphic card speed (as the frames are splitted among them). In addition, the FPS would be: FPS = minFPS(speed_per_GPU/n, worst_time_measurement_other_than_GPUs)
. For < 4 GPUs, this is usually FPS = speed_per_GPU/n
.By default, the body COCO and MPI models are not downloaded. You can download them by turning on the DOWNLOAD_BODY_COCO_MODEL
or DOWNLOAD_BODY_MPI_MODEL
flags. It's slightly faster but less accurate and has less keypoints than the COCO body model.
To install the Python API, ensure that the BUILD_PYTHON
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.
To manually select the CPU Version, open CMake GUI mentioned above, and set the GPU_MODE
flag to CPU_ONLY
. NOTE: Accuracy of the CPU version is ~1% higher than CUDA version, so the results will vary.
USE_MKL
and selecting his own Caffe path.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 MKL_NUM_THREADS
and OMP_NUM_THREADS
. 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:
# 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 OpenPose benchmark for more information about speed and memory requirements in several CPUs and GPUs.
Note: Current OSX has only been tested with the CPU Version, and hence must be compiled with the CPU_ONLY
flag, which is set by default for Mac devices. If you want to test our Mac GPU version, email gines@cmu.edu and ryaadhav@andrew.cmu.edu with your Mac model and hardware configuration (OS version, GPU and CPU model, and total RAM memory).
If the default installation fails (i.e., the one explained above), instal Caffe separately and set BUILD_CAFFE
to false in the CMake config. Steps:
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.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
.Configure
and Generate
from CMake GUI.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 GPU_MODE
flag to OPENCL
.
The OpenCL version has been tested on Ubuntu and Windows. 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.
Lastly, OpenCL version does not support unfixed --net_resolution
. So a folder of images of different resolutions with OpenPose, requires the --net_resolution 656x368
flag for example. This should be fixed by the Caffe author in a future patch.
You can include the 3D reconstruction module by:
{PointGreyParentDirectory}\Point Grey Research\Spinnaker\bin64\vs2015\
as {OpenPoseDirectory}\3rdparty\windows\spinnaker\bin\
. You can remove all the *.exe files.{PointGreyParentDirectory}\Point Grey Research\Spinnaker\include\
as {OpenPoseDirectory}\3rdparty\windows\spinnaker\include\
.Spinnaker_v140.lib
and Spinnakerd_v140.lib
from {PointGreyParentDirectory}\Point Grey Research\Spinnaker\lib64\vs2015\
into {OpenPoseDirectory}\3rdparty\windows\spinnaker\lib\
.sudo apt-get update && sudo apt-get install build-essential freeglut3 freeglut3-dev libxmu-dev libxi-dev
and reboot your PC.3rdparty\windows\getFreeglut.bat
.{OpenPoseDirectory}\3rdparty\windows\freeglut\
.MSVC Package
from http://www.transmissionzero.co.uk/software/freeglut-devel/.
{freeglutParentDirectory}\freeglut\bin\x64\
as {OpenPoseDirectory}\3rdparty\windows\freeglut\bin\
.{freeglutParentDirectory}\freeglut\include\
as {OpenPoseDirectory}\3rdparty\windows\freeglut\include\
.{freeglutParentDirectory}\freeglut\lib\x64\
as {OpenPoseDirectory}\3rdparty\windows\freeglut\lib\
.WITH_FLIR_CAMERA
(only if Spinnaker was installed) and WITH_3D_RENDERER
options.sudo apt-get install libeigen3-dev
, install Ceres solver, and enable WITH_CERES
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.After installation, check the doc/modules/3d_reconstruction_module.md instructions.
The calibration module is included by default, but you must also enable WITH_EIGEN
if you intend to use the extrinsic camera parameter estimation tool. You can set that flag to 2 different values: APT_GET
or BUILD
, check Requirements for more information.
After installation, check the doc/modules/calibration_module.md instructions.
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 USE_CUDNN
in CMake.
Then, you would have to reduce the --net_resolution
flag to fit the model into the GPU memory. You can try values like 640x320
, 320x240
, 320x160
, or 160x80
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 net_resolution
ratio to your image or video to be processed (see the --net_resolution
explanation from doc/demo_overview.md), or use -1
(e.g. --net_resolution -1x320
).
We only modified some Caffe compilation flags and minor details. You can use your own Caffe distribution, simply specify the Caffe include path and the library as shown below. You will also need to turn off the BUILD_CAFFE
variable. Note that cuDNN is required in order to get the maximum possible accuracy in OpenPose.
If you have built OpenCV from source and OpenPose cannot find it automatically, you can set the OPENCV_DIR
variable to the directory where you build OpenCV.
You can generate the documentation by setting the BUILD_DOCS
flag. The documentation will be generated in doc/doxygen/html/index.html
. You can simply open it with double-click (your default browser should automatically display it).
Note that this step is unnecessary if you already used the CMake GUI alternative.
Create a build
folder in the root OpenPose folder, where you will build the library --
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.
apt-get
In the build directory, run the below command --
cmake ..
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 OpenCV_INCLUDE_DIRS
and OpenCV_LIBS_DIR
variables respectively. Alternatively, the user can also specify the path to the OpenCVConfig.cmake
file by setting the OpenCV_CONFIG_FILE
variable. For Caffe, specify the include directory and library using the Caffe_INCLUDE_DIRS
and Caffe_LIBS
variables. This will be where you installed Caffe. Below is an example of the same.
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 ..
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 ..
Press p or to see the previous file or, n or to see the next file
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?