JetsonTX2 OpenPose - eiichiromomma/CVMLAB GitHub Wiki

(JetsonTX2, DeepLearning) OpenPose

OpenPoseをJetson TX2で。

インストール

Caffeベースなので、かなり素直に入る。 ただし、OpenCVについてはopencv4tegra以外では謎エラーが出てビルドが通らなかった。

git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose.git
cd openpose/
cp ubuntu/install_caffe_and_openpose_if_cuda8.sh ./

設定ファイルubuntu/Makefile.config.Ubuntu16_cuda8.example, Makefile, 3rdparty/caffe/Makefile.config.Ubuntu16_cuda8.example, 3rdparty/caffe/Makefileを下記の通り編集する。hdf5のライブラリ名とアーキテクチャ名を変えるだけ。

diff --git a/3rdparty/caffe/Makefile b/3rdparty/caffe/Makefile
index 8674f3a..46028f7 100644
--- a/3rdparty/caffe/Makefile
+++ b/3rdparty/caffe/Makefile
@@ -181,7 +181,7 @@ ifneq ($(CPU_ONLY), 1)
 	LIBRARIES := cudart cublas curand
 endif
 
-LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5
+LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial
 
 # handle IO dependencies
 USE_LEVELDB ?= 1
diff --git a/3rdparty/caffe/Makefile.config.Ubuntu16_cuda8.example b/3rdparty/caffe/Makefile.config.Ubuntu16_cuda8.example
index fb92360..1f62114 100644
--- a/3rdparty/caffe/Makefile.config.Ubuntu16_cuda8.example
+++ b/3rdparty/caffe/Makefile.config.Ubuntu16_cuda8.example
@@ -100,7 +100,7 @@ PYTHON_LIB := /usr/lib /usr/local/lib
 
 # Whatever else you find you need goes here.
 INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
-LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial
+LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/aarch64-linux-gnu /usr/lib/aarch64-linux-gnu/hdf5/serial
 
 # If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
 # INCLUDE_DIRS += $(shell brew --prefix)/include
diff --git a/Makefile b/Makefile
index 8e2109b..32a093e 100644
--- a/Makefile
+++ b/Makefile
@@ -146,7 +146,7 @@ ifneq ($(CPU_ONLY), 1)
 endif
 
 # LIBRARIES += glog gflags boost_system boost_filesystem m hdf5_hl hdf5 caffe
-LIBRARIES += glog gflags boost_system boost_filesystem m hdf5_hl hdf5
+LIBRARIES += glog gflags boost_system boost_filesystem m hdf5_serial_hl hdf5_serial
 
 # handle IO dependencies
 USE_LEVELDB ?= 1
diff --git a/ubuntu/Makefile.config.Ubuntu16_cuda8.example b/ubuntu/Makefile.config.Ubuntu16_cuda8.example
index c2940dc..053da67 100644
--- a/ubuntu/Makefile.config.Ubuntu16_cuda8.example
+++ b/ubuntu/Makefile.config.Ubuntu16_cuda8.example
@@ -78,7 +78,7 @@ CAFFE_DIR := 3rdparty/caffe/distribute
 
 # Whatever else you find you need goes here.
 INCLUDE_DIRS := /usr/local/include /usr/include/hdf5/serial
-LIBRARY_DIRS := /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial
+LIBRARY_DIRS := /usr/local/lib /usr/lib /usr/lib/aarch64-linux-gnu /usr/lib/aarch64-linux-gnu/hdf5/serial
 
 # If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
 # INCLUDE_DIRS += $(shell brew --prefix)/include

あとはスクリプトに任せる。

./install_caffe_and_openpose_if_cuda8.sh

使い方

Webcamを接続(理由はOnBoardCam参照)して/dev/video1を使う。 但し、そのまま起動するとメモリ不足でエラーが発生する。

nvidia@tegra-ubuntu:~/openpose$ ./build/examples/openpose/openpose.bin --camera 1
HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP
HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP
Desired webcam resolution 1280x720 could not being set. Final resolution: 640x480 in src/openpose/producer/webcamReader.cpp:WebcamReader():23
F0719 11:10:47.497596  3852 syncedmem.cpp:71] Check failed: error == cudaSuccess (2 vs. 0)  out of memory

net_resolutionを削ると動く。

Webcamのリアルタイム処理(1.2~1.4FPSくらい)

.build_release/examples/openpose/openpose.bin --camera 1 --process_real_time  --logging_level 4 -net_resolution 560x256 --resolution 640x480

動画ファイルの処理

./build/examples/openpose/openpose.bin -video examples/media/video.avi -net_resolution 560x256