Skip to content

Latest commit

 

History

History
166 lines (110 loc) · 6.05 KB

installation_cmake.md

File metadata and controls

166 lines (110 loc) · 6.05 KB

OpenPose - Installation using CMake

Contents

  1. Operating Systems
  2. Requirements
  3. Clone and Update the Repository
  4. Installation
    1. Caffe Prerequisites (Ubuntu Only)
    2. OpenPose Configuration
    3. OpenPose Building
    4. Run OpenPose
  5. Reinstallation
  6. Optional Settings
    1. Doxygen Documentation Autogeneration
    2. Custom Caffe
    3. Custom OpenCV
    4. MPI Model
    5. CMake Command Line Configuration

Operating Systems

  • Ubuntu 14 and 16.

Requirements

See doc/quick_start.md#requirements.

Clone and Update the Repository

See doc/quick_start.md#clone-and-update-the-repository.

Installation

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

  1. Caffe Prerequisites (Ubuntu Only)
  2. OpenPose Configuration
  3. OpenPose Building

Caffe Prerequisites (Ubuntu Only)

By default, OpenPose uses Caffe under the hood. If you have not used Caffe previously, install its dependencies by running:

bash ./ubuntu/install_cmake.sh

OpenPose Configuration

Note: If you prefer to use CMake though the command line, see Cmake Command Line Build.

  1. Install CMake GUI.

    1. Ubuntu: run sudo apt-get install cmake-qt-gui.
    2. Windows: download and install the latest Windows win64-x64 msi installer from the CMake website.
  2. Open CMake GUI and select the project source directory and a sub-directory where the Makefiles will be generated. We will first select the openpose directory and then we will select a build directory in the project root directory as shown in the image below (See the red rectangle). If the build directory does not exists, CMake will create it.

  1. Next press the Configure button in the GUI. It will first ask you to create the build directory, if it already did not exist. Press Yes.

  1. Next a new dialog box will appear, press the Finish button here.

  1. If this step is successful, in the bottom box it will show "Configuring done" (in the last line) as shown below.

  1. Press the Generate button and proceed to OpenPose Building.

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

OpenPose Building

Finally, build the project by running the following commands.

cd build/
no_cores=`cat /proc/cpuinfo | grep processor | wc -l`
make -j${no_cores}

Run OpenPose

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

Reinstallation

In order to re-install OpenPose:

  1. Delete the build/ folder.
  2. In CMake GUI, click on File --> Delete Cache.
  3. Follow the Installation steps again.

Optional Settings

Doxygen Documentation Autogeneration

You can generate the documentation by setting the BUILD_DOCS flag.

Custom Caffe

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.

Custom OpenCV

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.

MPI Model

By default, the body MPI model is not downloaded. You can download it by turning on the DOWNLOAD_MPI_MODEL.

CMake Command Line Configuration

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.

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 library to CMake. For OpenCV, specify the OpenCV_DIR which is where the user build OpenCV. 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_DIR=/home/"${USER}"/softwares/opencv/build \
  -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_DIR=/home/"${USER}"/softwares/opencv/build