jetson nano AI環境搭建

最近在玩這個板,已經把示例跑通,先記錄一下示例

這裏是視頻,圖片,攝像頭的地點。
https://www.colabug.com/4535531.html

安裝 pycuda時的一個錯誤:

sudo pip3 install pycuda
    In file included from src/cpp/cuda.cpp:1:0:
    src/cpp/cuda.hpp:14:18: fatal error: cuda.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

解決辦法:

  1. sudo su - 進入root
  2. sudo pip3 install pycuda
    就能成功的運行了

jetson nano 查看gpu使用率
jetson nano GPU CPU 系統內存等等的查看(其他工具這裏都有)
進入網頁:https://elinux.org/Jetson_Nano
找到 System Tools 下的jetson_stats - jtop, service and other tools
點擊鏈接:jetson_stats
然後就是 git clone https://github.com/rbonghi/jetson_stats
進入root sudo su -
進入目錄:
安裝 ./jetson_stats -h ./jetson_stats -f
查看系統資源:jtop 結果如下:
在這裏插入圖片描述
20190514 :
jetson nano 切勿改源,很多的安裝包找不到。

jetson nano 跑yolov3-tiny
1.

git clone 	https://github.com/pjreddie/darknet.git

2.修改makefile,若機子裏安裝了opencv可以置1

GPU=1
CUDNN=1
OPENCV=0

3

make -j4

4
下載weight文件。

wget wget https://pjreddie.com/media/files/yolov3-tiny.weights

5.運行

./darknet detect cfg/yolov3-tiny.cfg yolov3-tiny.weights data/dog.jpg

6.結果

layer     filters    size              input                output
    0 conv     16  3 x 3 / 1   416 x 416 x   3   ->   416 x 416 x  16  0.150 BFLOPs
    1 max          2 x 2 / 2   416 x 416 x  16   ->   208 x 208 x  16
    2 conv     32  3 x 3 / 1   208 x 208 x  16   ->   208 x 208 x  32  0.399 BFLOPs
    3 max          2 x 2 / 2   208 x 208 x  32   ->   104 x 104 x  32
    4 conv     64  3 x 3 / 1   104 x 104 x  32   ->   104 x 104 x  64  0.399 BFLOPs
    5 max          2 x 2 / 2   104 x 104 x  64   ->    52 x  52 x  64
    6 conv    128  3 x 3 / 1    52 x  52 x  64   ->    52 x  52 x 128  0.399 BFLOPs
    7 max          2 x 2 / 2    52 x  52 x 128   ->    26 x  26 x 128
    8 conv    256  3 x 3 / 1    26 x  26 x 128   ->    26 x  26 x 256  0.399 BFLOPs
    9 max          2 x 2 / 2    26 x  26 x 256   ->    13 x  13 x 256
   10 conv    512  3 x 3 / 1    13 x  13 x 256   ->    13 x  13 x 512  0.399 BFLOPs
   11 max          2 x 2 / 1    13 x  13 x 512   ->    13 x  13 x 512
   12 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024  1.595 BFLOPs
   13 conv    256  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 256  0.089 BFLOPs
   14 conv    512  3 x 3 / 1    13 x  13 x 256   ->    13 x  13 x 512  0.399 BFLOPs
   15 conv    255  1 x 1 / 1    13 x  13 x 512   ->    13 x  13 x 255  0.044 BFLOPs
   16 yolo
   17 route  13
   18 conv    128  1 x 1 / 1    13 x  13 x 256   ->    13 x  13 x 128  0.011 BFLOPs
   19 upsample            2x    13 x  13 x 128   ->    26 x  26 x 128
   20 route  19 8
   21 conv    256  3 x 3 / 1    26 x  26 x 384   ->    26 x  26 x 256  1.196 BFLOPs
   22 conv    255  1 x 1 / 1    26 x  26 x 256   ->    26 x  26 x 255  0.088 BFLOPs
   23 yolo
Loading weights from yolov3-tiny.weights...Done!
data/dog.jpg: Predicted in 0.077808 seconds.
dog: 56%
car: 52%
truck: 56%
car: 62%
bicycle: 58%

這個板子跑到了80ms左右,而另一個板子跑在230ms左右,不知道爲啥,會差這麼多。

另:用jetson nano 跑yolov3的模型卻被系統自己kill掉了,用上面的jtop查看原因,是內存被吃満了,官網上說gpu與cpu用的同一個4G內存。。。就算添加swap也無濟於事。inseption-resnetv2也一樣跑不起來。

×××××××××××××××××××××××××××××××××××××××××××××××××××××
有個問題不要驚訝:
當我們禁用jetson nano 的桌面系統時:

sudo systemctl set-default multi-user.target
sudo reboot

打開桌面

sudo systemctl set-default graphical.target

剛開機時,cpu只剩下兩個核了,另兩個核off掉了。等好一會,另兩個核纔會起來。
不懂爲什麼要這樣設計,我還以爲核又掛掉了。
×××××××××××××××××××××××××××××××××××××××××××××××××××××

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章