m_shige1979のときどきITブログ

プログラムの勉強をしながら学習したことや経験したことをぼそぼそと書いていきます

Github(変なおっさんの顔でるので気をつけてね)

https://github.com/mshige1979

jetson nanoで物体検知を行う

jetson nanoで物体検知を試した

日本語の情報がどのあたりが最新か不明のためでいろいろ手間取った ssh経由でやVNCでやろうとしたけど結局直接端末でやらないと面倒そうなので端末で制御

パッケージインストール

sudo apt-get update
sudo apt-get install git cmake libpython3-dev python3-numpy

jetson-interfaceを利用して画像認識を行うため、git clone

git clone --recursive https://github.com/dusty-nv/jetson-inference
cd jetson-inference
mkdir build
cd build
cmake ../

↓ モデルダウンロード f:id:m_shige1979:20200621100545j:plain

# modelを選択する(デフォルトのまま)
[ ] 1  Image Recognition - all models          (2.2 GB)
[ ] 2     > AlexNet                            (244 MB)
[*] 3     > GoogleNet                          (54 MB)
[ ] 4     > GoogleNet-12                       (42 MB)
[*] 5     > ResNet-18                          (47 MB)
[ ] 6     > ResNet-50                          (102 MB)
[ ] 7     > ResNet-101                         (179 MB)
[ ] 8     > ResNet-152                         (242 MB)
[ ] 9     > VGG-16                             (554 MB)
[ ] 10    > VGG-19                             (575 MB)
[ ] 11    > Inception-V4                       (172 MB)
[ ] 12 Object Detection - all models           (395 MB) 
[ ] 13    > SSD-Mobilenet-v1                   (27 MB)
[*] 14    > SSD-Mobilenet-v2                   (68 MB)
[ ] 15    > SSD-Inception-v2                   (100 MB)
[*] 16    > PedNet                             (30 MB)
[ ] 17    > NultiPed                           (30 MB)
[*] 18    > FaceNet                            (24 MB)
[*] 19    > DetectNet-COCO-Dog                 (29 MB)
[ ] 20    > DetectNet-COCO-Bottle              (29 MB)
[ ] 21    > DetectNet-COCO-Chair               (29 MB)
[ ] 22    > DetectNet-COCO-Airplane            (29 MB)
[ ] 23 Semantic Segmentation - all             (518 MB)
[*] 24    > FCN-ResNet18-Cityscapes-512x256    (47 MB)
[*] 25    > FCN-ResNet18-Cityscapes-1024x512   (47 MB)
[ ] 26    > FCN-ResNet18-Cityscapes-2048x1024  (47 MB)
[*] 27    > FCN-ResNet18-DeepScene-576x320     (47 MB)
[ ] 28    > FCN-ResNet18-DeepScene-864x480     (47 MB)
[*] 29    > FCN-ResNet18-MHP-512x320           (47 MB)
[ ] 30    > FCN-ResNet18-MHP-512x320           (47 MB)
[*] 31    > FCN-ResNet18-Pascal-VOC-320x320    (47 MB)
[ ] 32    > FCN-ResNet18-Pascal-VOC-512x320    (47 MB)
[*] 33    > FCN-ResNet18-SUN-RGBD-512x400      (47 MB)
[ ] 34    > FCN-ResNet18-SUN-RGBD-640x512      (47 MB)
[ ] 35 Semantic SEgmentation -legacy           (1.4 GB)
[ ] 36    > FCB-Alexnet-Cityscapes-SD          (235 MB)
[ ] 37    > FCB-Alexnet-Cityscapes-HD          (235 MB)
[ ] 38    > FCB-Alexnet-Aerial-FPV             (7 MB)
[ ] 39    > FCB-Alexnet-Pascal-VOC             (235 MB)
[ ] 40    > FCB-Alexnet-Synthia-CVPR           (235 MB)
[ ] 41    > FCB-Alexnet-Synthia-Summer-SD      (235 MB)
[ ] 42    > FCB-Alexnet-Synthia-Summer-HD      (235 MB)
[ ] 43 Image Processing - all models           (138 MB)
[ ] 44    > Deep-Homography-COCO               (137 MB)
[ ] 45    > Super-Resolution-BSD500            (1MB MB)
→  了解

↓ PyTorchはスキップしても良いかも? f:id:m_shige1979:20200621101418j:plain

 [ ] 1 PyTorch v1.1.0 for Python 2.7
 [ ] 2 PyTorch v1.1.0 for Pythin 3.6
→  了解

↓ ビルド&インストール&ライブラリ登録

make
sudo make install
sudo ldconfig

動作確認

1回目(初回はいろいろ準備するものがあるようで時間がかかる)

cd $HOME/jetson-inference/build/aarch64/bin/
./detectnet-console.py images/peds_0.jpg output_0.jpg

結果 f:id:m_shige1979:20091008113933j:plainf:id:m_shige1979:20200621110117j:plain

2回目

./detectnet-console.py images/peds_1.jpg output_1.jpg

結果 f:id:m_shige1979:20130305114518j:plainf:id:m_shige1979:20200621110203j:plain

参考

www.youtube.com jetson-inference/building-repo-2.md at master · dusty-nv/jetson-inference · GitHub

補足

# ダウンロードツール起動コマンド
cd jetson-inference/tools
./download-models.sh

# PyTorchのインストーラー起動コマンド
cd jetson-inference/build
./install-pytorch.sh

# 自前マシンへコピー
scp jetson@jetson-desktop.local:/home/jetson/jetson-inference/build/aarch64/bin/images/peds_0.jpg $HOME/work/peds_0.jpg
scp jetson@jetson-desktop.local:/home/jetson/jetson-inference/build/aarch64/bin/output_0.jpg $HOME/work/output_0.jpg
scp jetson@jetson-desktop.local:/home/jetson/jetson-inference/build/aarch64/bin/images/peds_1.jpg $HOME/work/peds_1.jpg
scp jetson@jetson-desktop.local:/home/jetson/jetson-inference/build/aarch64/bin/output_1.jpg $HOME/work/output_1.jpg