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掉了。等好一会,另两个核才会起来。
不懂为什么要这样设计,我还以为核又挂掉了。
×××××××××××××××××××××××××××××××××××××××××××××××××××××

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