Setting up OpenPose on Jetson TX2

From RidgeRun Developer Wiki


Previous: HowTo's/How to enable A/B redundancy in TX2 Index Next: Contact_Us







Introduction to OpenPose on NVIDIA Jetson TX2

This RidgeRun Developer Wiki is intended to give a quick and easy to understand guide to the reader for setting up OpenPose and all its dependencies on either a computer with Ubuntu 16.04 or on the NVIDIA Jetson TX2 platform.

Setting up OpenPose on Ubuntu 16.04 for Desktop

Requirements

cuDNN (highly recommended)

Prerequisites

- GPU of computing capability 3.0 or higher. - CUDA - NVIDIA Graphics Drivers

Download

You can go to the CuDNN Download Page and download the latest version for your current CUDA installation.

The files you will need are:

  • cuDNN Runtime Library for Ubuntu 16.04 (Deb)
  • cuDNN Developer Library for Ubuntu 16.04 (Deb)
  • cuDNN Code Samples and User Guide for Ubuntu 16.04 (Deb)

Installation

Runtime Library:

$sudo dpkg -i libcudnn7_7.4.2.24-1+cuda9.0_amd64.deb

Developer Library:

$sudo dpkg -i libcudnn7-dev_7.4.2.24-1+cuda9.0_amd64.deb

Code Samples and the CUDNN Library User Guide:

$sudo dpkg -i libcudnn7-doc_7.4.2.24-1+cuda9.0_amd64.deb

Note that versions can be different.

Verification

$cp -r /usr/src/cudnn_samples_v7/ $HOME
$cd  $HOME/cudnn_samples_v7/mnistCUDNN
$make clean && make
$./mnistCUDNN

An output of “Test passed!” should appear.

Dependencies

OpenCV (2.X or 3.X)

$sudo apt-get install libopencv-dev

Caffe

General Dependencies

$sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
$sudo apt-get install --no-install-recommends libboost-all-dev
$sudo apt-get install libatlas-base-dev
$sudo apt-get install libopenblas-dev
$sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

Compilation

First clone Caffe repository:

$git clone https://github.com/BVLC/caffe.git

Then copy Makefile:

$cp Makefile.config.example Makefile.config

and comment this section:

-gencode arch=compute_20,code=sm_20 \
-gencode arch=compute_20,code=sm_21 \

Finally build using CMake:

$mkdir build
$cd build
$cmake ..
$make all

If it can’t find the hdf5.h file then run:

$export CPATH="/usr/include/hdf5/serial/"

$make install
$make runtest

OpenPose Installation

1. First clone the OpenPose repository:

$git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose

2. Install Caffe and dependencies with the following script:

$sudo bash ./scripts/ubuntu/install_deps.sh

3. Configure OpenPose with CMake-GUI

  • Make a “build” folder
  • Open CMake-GUI and in “Where is the source code” place the path to the cloned OpenPose folder.
  • Place in “Where to build binaries” the build directory of the OpenPose folder.
  • Press “Configure” and make sure the generator is in Unix Makefile, then click “Finish”.
  • Press “Generate” and close CMake.

OpenPose Building

Go into the build directory and run:

$make -j`nproc`
$sudo make install

Verify OpenPose Installation

1. Go to the OpenPose directory

2. For example on video run:

$./build/examples/openpose/openpose.bin --video examples/media/video.avi
$./build/examples/openpose/openpose.bin --video examples/media/video.avi --face --hand

3. For example on webcam run:

$./build/examples/openpose/openpose.bin
$./build/examples/openpose/openpose.bin --face --hand

Setting up OpenPose on NVIDIA Jetson TX2

Requirements and Dependencies

Requirements

  • It is required for the Jetson TX2 board to be flashed with either JetPack 3.1 or JetPack 3.3.
   For instructions on how to install JetPack 3.3 please refer to the NVIDIA JetPack 3.3 Installation Guide.
  • Please make sure to install CUDA and cuDNN before installing OpenPose.

Dependencies

   - OpenCV
       -> All 2.X and 3.X versions are compatible with Jetson TX2 boards flashed with JetPack 3.1.
       -> All 3.X versions are compatible with Jetson TX2 boards flashed with JetPack 3.3.
   - Caffe and all its dependencies.
   - The demo and tutorials additionally use GFlags.

1- Please make sure GStreamer is already installed in the Jetson Board.

   $sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-bad

2- Remove previous installation of OpenCV.

   $sudo apt-get purge libopencv* 

3- To rebuild OpenCV, is useful to use Jetsonhacks buildOpenCVTX2 bash script.

   $git clone https://github.com/jetsonhacks/buildOpenCVTX2.git
   $cd buildOpenCVTX2
   $./buildOpenCV.sh

4- Remove the build files after installation.

   $./removeOpenCVSources.sh 

Installing OpenPose

Once all the requirements and dependencies are ready, installing OpenPose is really easy to install.

   $git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose
   $bash ./scripts/ubuntu/install_caffe_and_openpose_JetsonTX2_JetPack3.3.sh

Verify OpenPose Installation

Testing if OpenPose was successfully installed can be done by running one of its examples.

   ./build/examples/openpose/openpose.bin -camera_resolution 640x480 -net_resolution 128x96

If OpenPose is properly installed, the example should be able to show live video from the camera with a skeleton overlay on each body on the scene.

See Also

1. https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation.md

2. https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html

3. http://caffe.berkeleyvision.org/installation.html



For direct inquiries, please refer to the contact information available on our Contact page. Alternatively, you may complete and submit the form provided at the same link. We will respond to your request at our earliest opportunity.


Links to RidgeRun Resources and RidgeRun Artificial Intelligence Solutions can be found in the footer below.




Previous: HowTo's/How to enable A/B redundancy in TX2 Index Next: Contact_Us