25
21

More than 5 years have passed since last update.

Jetson Nano Developer Kitの初期設定とUSBカメラを使う

Last updated at Posted at 2019-06-11

NVIDIA Jetson Nano Developer Kitの基本的な初期設定とUSBカメラの使う場合の注意点をメモしておきます。

Jetson Nano Developer Kitのセットアップ

以下のページに従いSDカードイメージを作成する。特に問題はないはず。
Getting Started With Jetson Nano Developer Kit

1. MicroSDカード

余っていたSanDiskの128GBを利用。32GBが無かったので128GBで作成。(少しもったいないが)

2. Micro-USB Power Supply

RaspberryPiで利用していたMicro-USB電源があったので流用してみた。5V 1Aと5V 2Aを発見。ただWiFiアダプタとUSBカメラをつける予定なので、設定のみに使用し、外径 5.5 mm の丸ピンの電源は別途Amazonで購入。

3. Wireless Networking Adapter

こちらもRaspberryPiで利用していたBaffaloのWiFIアダプタを流用。

4. イメージファイルをダウンロードしMicro SDカードを作成

Write Image to the microSD Card からJetson Nano Developer Kit SD Card Imageをクリックするとダウンロードが始まる(5.5GB)のでダウンロードする。
あとはEtcherを使ってMicro SDカードにコピーして完了。

5. Building the Repo from Source

GitHubからリポジトリをクローンしてコンパイルするため必要なソフトをインストール。
(ブートした直後はいきなり以下のコマンドをコピーしてもcmakeがないといわれるのでupdateを忘れずに。)

$ sudo apt-get update
$ sudo apt-get install git cmake

あとはチュートリアルに従って以下のコマンドを実行。

$ git clone https://github.com/dusty-nv/jetson-inference
$ cd jetson-inference
$ git submodule update --init
$ mkdir build
$ cd build
$ cmake ../
$ cd jetson-inference/build         
$ make
$ sudo make install

USBカメラの設定

Running the Live Camera Recognition DemoRunning the Live Camera Detection Demoを参照。
CSIカメラのインターフェースがあり、RaspberryPiのカメラが流用できるかと思っていらがV2のみしか動作しないと判明。
Raspberry Pi Version 1 camera does not work

The Raspberry Pi Camera Module v1 uses the OV5647 sensor, which isn't supported by the drivers.
Support is built-in for the IMX219 sensor, which the Raspberry Pi Camera Module v2 uses, so that should work out of the box for you.

V1を持っている人が多数いるはずなのにどうやらV2しかサポートしないらしい。

The OV5647 sensor is discontinued by Omnivision, and we don't have plans to develop support for it.

note: by default, the Jetson's onboard CSI camera will be used as the video source. If you wish to use a USB webcam instead, change the DEFAULT_CAMERA define at the top of detectnet-camera.cpp to reflect the /dev/video V4L2 device of your USB camera and recompile. The webcam model it's tested with is Logitech C920.

C920はないがLogitech C910 があったのでこれを使うことに。

$ cd jetson-inference/imagenet-camera

imagenet-camera.cppの値を-1から0に変更してコンパイルする。

imagenet-camera.cpp
#define DEFAULT_CAMERA 0    // -1 for onboard camera, or change to index of /dev/video V4L2 camera (>=0)    
$ cd jetson-inference/build         
$ make
$ sudo make install

プログラム実行中にシステムが停止する

上記のコンパイルをして少しほっておくとシステムが停止している場面に3回遭遇。ヒートシンクが熱かったのでジップロックに氷を入れてヒートシンクの上に置いて直接冷やしてみた。

が、電源の問題の可能性が高いため、マイクロUSB電源からJ25電源ジャックに接続する5V-4Aの電源アダプタをAmazonで購入。

USB電源からの変更

Amazonで購入した電源はこちら。SMAKN DC 5V/4A 20W Switching Power Supply Adapter 100-240 Ac(US) ($8.99でした。)

外部電源(from JETSON NANO DEVELOPER KIT USER GUIDE)

"connect the J48 Power Select Header pins to disable power supply via Micro-USB and enable 5V⎓4A via the J25 power jack."

JumperピンをJ48にさす。(Jumperピンは古い3.5インチハードディスクをあさり発見)

USBカメラでサンプルを試す

以下のコマンドでライブカメラを使った「物体認識」のサンプルを実行。

$ cd jetson-inference/build/aarch64/bin         
$ ./imagenet-camera googlenet           # to run using googlenet

カメラから入ってくるストリーミング映像をTensorRTで認識するデモを試す。カメラには様々なものが映るので物体の認識はめまぐるしく変化していく。カメラの前でバナナを静止して移すとさすがに90%以上の精度で認識。

以下のコマンドでライブカメラを使った「人の顔を検知する」プログラムを実行。

$ cd jetson-inference/build/aarch64/bin         
$ ./detectnet-camera facenet        # run using facial recognition network

以下のコマンドでライブカメラを使った「ボトルを検知する」プログラムを実行。
マグカップはボトルとして検知されていない。

$ cd jetson-inference/build/aarch64/bin         
$ ./detectnet-camera coco-bottle    # detect bottles/soda cans in the camera

参考

Nvidia Developer Forum
本家のDeveloper Forum。質問がある場合におすすめ。割と直ぐに誰かが反応してくれる。

Jetson Hacks
いろいろな実験をやっています。

25
21
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
25
21