LoginSignup
1
0

More than 1 year has passed since last update.

Jetson NanoにJetPackとjetson-inferenceをインストールしてみた

Posted at

はじめに

Jetson Nano 4GBにJetPackとjetson-inferenceをインストールしてみました。参考になればと思い、実際に私が行った作業を記録として残すことにしました。
気づいた点があればコメントをお願いします。

環境

  • Jetson Nano 4GB
  • SD Card 64GB
  • Raspberry Pi Camera V2 (一つで大丈夫です)
    DSC_0385.JPG
    Something went wrong

JetPackのインストール

最初に以下のコマンドでJetPackをインストールします。
まずは、アップデートします。

$ sudo apt update

アップデートが終わったらJetPackのインストールです。
以下のコマンドでJetPackをインストールできます。

$ sudo apt install nvidia-jetpack

JetPackのインストールをしたあと、以下のコマンドでインストールされたJetPackのバージョンを確認できます。

$ sudo apt show nvidia-jetpack

参考:
https://docs.nvidia.com/jetson/jetpack/install-jetpack/index.html#install-jetpack

jetson-inferenceをインストール

Githubからjetson-inferenceをCloneします。

$ git clone https://github.com/dusty-nv/jetson-inference.git

jetson-inferenceフォルダーに移動する。

$ cd jetson-inference/

サブモジュールのアップデートをする。これをやらなかったらcmakeでエラーになってしまった。

~/jetson-inference$ git submodule update --init

buildディレクトリーを作り、移動する。

~/jetson-inference$ mkdir build
~/jetson-inference$ cd build/

cmakeを実行して、指示に従ってオプションを設定する。私の場合は全てデフォルトを選択しました。

~/jetson-inference/build$ cmake ../

cmakeでMakefileが出来上がったら、makeでコンパイルする。オプションはCPUのcoreの数を-jオプションで設定する。このオプションはなくても動くが、遅くなるようです。

~/jetson-inference/build$ make -j$(nproc)

makeが終了したら、インストールをします。

~/jetson-inference/build$ sudo make install

で、動かす前に重たいアプリケーションなのでデフォルトのSwap領域は1.9GBしか確保されていないので拡張しないと安定して動きません。
Swapファイルを拡張する必要がある場合には次の手順で拡張ができます。

$ cd ~
$ git clone https://github.com/JetsonHacksNano/installSwapfile
$ cd installSwapfile
~/installSwapfile$ ./installSwapfile.sh

Swapサイズの確認は

$ free -h

でこんな感じで1.9GBから7.9GBに増えました。
free-h.png

参考:
https://developer.nvidia.com/blog/realtime-object-detection-in-10-lines-of-python-on-jetson-nano/
https://github.com/dusty-nv/jetson-inference/blob/master/docs/building-repo-2.md
https://github.com/dusty-nv/jetson-inference
https://zenn.dev/sumire0204/articles/43b843492afcfd

使ってみる

$ detectnet-camera.py

$ posenet.py

1
0
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
1
0