空飛ぶロボットのつくりかた

ロボットをつくるために必要な技術をまとめます。ロボットの未来についても考えたりします。

TX2を動かしてみる(JetPack3.1トライ)

やりたいこと

TX2でDeepLearningの何かしらのフレームワークとROSを動かす

結果

以下の記事を参考にtensorflowのインストールとOpenPoseの動作確認。

mobilenetのモデルでTX2でも8fpsくらいでる。

NVIDIA Jetson TX2でTensorFlowによる人体姿勢推定プログラムを動かせるようになるまで - Qiita

f:id:robonchu:20180107113020j:plain

以下を参考にROSのインストール。超簡単。

Install Robot Operating System (ROS) on NVIDIA Jetson TX2 - YouTube

Wiki

Jetson TX2 - eLinux.org

JetPack

Version 3.1を用いる

  • HPからダウンロード:

Jetson Download Center | NVIDIA Developer

手順

以下を参照

  1. NVIDIA JetPack Documentation

  2. JetPack 3.0 - NVIDIA Jetson TX2 - YouTube

  3. Force USB Recovery Modeの仕方はQuick Start Guide参照

参考:

Double Your Deep Learning Performance with JetPack 2.3 - YouTube

TX2のモード選択

用途に応じて消費電力と性能を選択するモードが用意されている

NVPModel - NVIDIA Jetson TX2 Development Kit - JetsonHacks

CSI camera

開発キットにはCSIカメラが取り付けられており、USBカメラに比べて処理がはやい

CSI Cameras on the TX2 (The Easy Way) - Peter Moran's Blog

https://devtalk.nvidia.com/default/topic/1005345/examples-on-how-to-use-the-jetson-carrier-board-camera-module-/

JetsonTX2 OnBoardCam · eiichiromomma/CVMLAB Wiki · GitHub

ROSでCSIカメラをlaunch

GitHub - peter-moran/jetson_csi_cam: A ROS package making it simple to use CSI cameras on the Nvidia Jetson TK1, TX1, or TX2 with ROS.

キャリアボード

価格

性能比較

f:id:robonchu:20180107151419p:plain

Deep Learning フレームワーク&OpenCV&ROSインストール

Caffe install

Caffe Deep Learning Framework - NVIDIA Jetson TX2 - YouTube

Tensorflow install

TensorFlow Install on NVIDIA Jetson TX2 - YouTube

JetsonTX2 Tensorflow · eiichiromomma/CVMLAB Wiki · GitHub

How to install TensorFlow on the NVIDIA Jetson TX2? · NVIDIA Jetson TX2 Recipes

GitHub - jetsonhacks/installTensorFlowTX2: Install TensorFlow on the NVIDIA Jetson TX2 Development Kit

Keras

Jetson TX2にKerasをインストールする - Qiita

Pytorch install

GitHub - andrewadare/jetson-tx2-pytorch: Installing PyTorch on the Nvidia Jetson TX1/TX2

Install procedure for pyTorch on NVIDIA Jetson TX1/TX2 · GitHub

OpenCV install

TensorFlow Install on NVIDIA Jetson TX2 - YouTube

ROS install

Install Robot Operating System (ROS) on NVIDIA Jetson TX2 - YouTube

OpenPoseインストール

OpenCV3を使うときはMakefieのOPENCV_VERSIONの設定を3にしてアンコメント

Tensorflow

NVIDIA Jetson TX2でTensorFlowによる人体姿勢推定プログラムを動かせるようになるまで - Qiita

GitHub - ildoonet/tf-pose-estimation: Openpose from CMU implemented using Tensorflow with Custom Architecture for fast inference.

Caffe

JetsonTX2 OpenPose · eiichiromomma/CVMLAB Wiki · GitHub

Issue

can't find hdf5.h when build caffe · Issue #156 · NVIDIA/DIGITS · GitHub

caffe fails with error undefined reference to `cv::imread(cv::String const&, int)' and undefined reference to `cv::imdecode(cv::_InputArray const&, int) · Issue #3700 · BVLC/caffe · GitHub

TX2用のinstall scriptsを使わない場合はMakefileを以下の用に書き換える必要がある↓

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

YOLOインストール

JetsonTX2 Yolo · eiichiromomma/CVMLAB Wiki · GitHub

CUDA8.0のインストール

https://devtalk.nvidia.com/default/topic/1001520/setting-up-cuda-manually-on-tx2/

参考

JetsonTX2 · eiichiromomma/CVMLAB Wiki · GitHub

https://devtalk.nvidia.com/default/topic/1027463/jetson-tx2/jetpack-3-2-installation-on-tx2-stops/

JetsonTX2初期セットアップ(Jetpack)からサンプルのコンパイルまでの手順 - Qiita

bash: cannot create temp file for here-document: No space left on device · GitHub