AI学习库的安装jetson-inference(国内详细教程)

源码在github上,

链接:https://github.com/dusty-nv/jetson-inference

但是在国内往往下载时会出现问题,我已经讲最新的源码项目移植到了码云,

链接:https://gitee.com/vcan123/jetson-inference

安装方式相同。

1、安装cmake

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

2、源码的获取

①github获取

先试着从GitHub上获取源码

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

②码云获取

如果GitHub上获取源码失败,可以从我的码云上获取,执行如下代码即可,一样

$git clone https://gitee.com/vcan123/jetson-inference

获取源码后

$cd jetson-inference
$git submodule update --init

在执行git submodule update --init后可能有文题可以参考GitHub登不上去问题解决办法。实在不行了留言吧,。,

3、换源

路径切换到jetson-inference/tools下

$cd jetson-inference/tools

模型下载的国内源(在以上路径下)

$sed -in-place -e 's@https://nvidia.box.com/shared/static@https://bbs.gpuworld.cn/mirror@g' download-models.sh

安装pytorch,此时只是添加了源可以在第四步build文件夹中安装(如果不会请留言,很简单)

$sed -in-place -e 's@https://nvidia.box.com/shared/static@https://bbs.gpuworld.cn/mirror@g' install-pytorch.sh
sed -in-place -e 's@https://github.com/pytorch/vision@https://gitee.com/vcan123/pytorch@g' install-pytorch.sh
$sed -in-place -e 's@https://github.com/dusty-nv/vision@https://gitee.com/vcan123/dusty-nv@g' install-pytorch.sh

4、编译安装

$sudo apt-get update
$sudo apt-get install git cmake libpython3-dev python3-numpy
$cd jetson-inference
$mkdir build
$cd build
$cmake ../
$make

执行以上过程时出现如图所示,根据自己的需要点确定就可以。

image

image

image

5、物体识别

物体识别在路径jetson-inference/build/aarch64/bin下

①静态物体识别

图片也可选,在bin路径下有images文件,橘子等的图片都在里边。

打开终端输入

c++:

$ ./imagenet-console --network = googlenet orange_0.jpg output_0.jpg   #-- network标志是可选的

python:

$ ./imagenet-console.py --network = googlenet orange_0.jpg output_0.jpg   #-- network标志是可选的

如果上边的不行的话时图片的路径不对,用images/orange_0.jpg 替换上边的orange_0.jpg 就可以了。

显示识别的图片:

$display output_0.jpg

image

静态图像识别测试脚本:

$ vi static_picture.sh

内容如下:

#!/bin/sh

 ./imagenet-console $1 output_$1

 display output_$1

添加执行权限和运行上边的脚本:

$ chmod a+x ./static_picture.sh
$ ./static_picture.sh orange_0.jpg

②动态物体识别

支持USB摄像头基本都可用,CSI摄像头(树莓派的)

$ ./imagenet-camera googlenet
$ ./imagenet-camera alexnet

如果使用USB摄像头,需要修改imagenet-camera.cpp中的宏定义DEFAULT_CAMERA,然后重新编译。

③定位对象坐标

检测出对象病提取边框

$ ./detectnet-console dog_1.jpg output_1.jpg coco-dog

image

有问题欢迎交流。

原文链接: https://www.cnblogs.com/vcan123/p/13269218.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍;

也有高质量的技术群,里面有嵌入式、搜广推等BAT大佬

    AI学习库的安装jetson-inference(国内详细教程)

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/363923

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年3月2日 下午3:17
下一篇 2023年3月2日 下午3:17

相关推荐