![复制代码](//assets.cnblogs.com/images/copycode.gif)
测试板载摄像头
1)方法一:视屏分辨率预览
nvgstcapture-1.0 --prev-res=3
2)方法二:指定分辨率预览
nvgstcapture-1.0 --cus-prev-res=1280x720
命令行输入“q”退出,输入“j”图片将保存在当前目录下。
初始化 Jetson Nano
https://github.com/dusty-nv/jetson-inference
[环境变量]
export PATH=/usr/local/cuda-10.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:$LD_LIBRARY_PATH
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda-10.0
export DISPLAY=:0
添加到~/.bashrc 和 /etc/profile 中
[安装软件]
$ sudo apt-get update
$ sudo apt-get install python3-pip python3-dev
$ python3 -m pip install --upgrade pip
$ sudo apt-get install git cmake libpython3-dev python3-numpy
$ git clone --recursive https://github.com/dusty-nv/jetson-inference
$ cd jetson-inference
$ mkdir build
$ cd build
$ cmake ../
$ make
$ sudo make install
$
The project will be built to jetson-inference/build/aarch64, with the following directory structure:
|-build
\aarch64
\bin where the sample binaries are built to
\networks where the network models are stored
\images where the test images are stored
\include where the headers reside
\lib where the libraries are build to
The Python bindings for the jetson.inference and jetson.utils modules also get installed during the sudo make install step under /usr/lib/python*/dist-packages/. If you update the code, remember to run it again.
[下载模型]
$cd jetson-inference/tools
$./download-models.sh
如果网络太慢,可以从以下link单独下载
https://github.com/dusty-nv/jetson-inference/releases
然后解压缩到如下目录
cd <jetson-inference>/data/networks/
tar -zxvf <model-archive-name>.tar.gz
第一次运行时加载模型时间较长,耐心等待一会儿,程序运行完成后使用如下命令打开图像文件。
$ display output_0.jpg
[Demo]
sudo apt-get install gpicview
cd ~/jetson-inference/build/aarch64/bin
[Classification Models]
./imagenet-console.py --network=resnet-18 images/jellyfish.jpg output_jellyfish.jpg
./imagenet-console.py --network=resnet-18 images/stingray.jpg output_stingray.jpg
./imagenet-console.py --network=resnet-18 images/coral.jpg output_coral.jpg
gpicview output_jellyfish.jpg
[Locating Objects with DetectNet, default is SSD-Mobilenet-v2]
./detectnet-console.py --network=ssd-mobilenet-v2 images/peds_0.jpg output0.jpg
./detectnet-console.py images/peds_1.jpg output1.jpg
./detectnet-camera.py
./detectnet-camera.py --network=facenet
[照片对象识别]
$./detectnet-console.py --network=ssd-mobilenet-v2 input.jpg output.jpg
[Camera 对象识别]
$./detectnet-camera.py # using SSD-Mobilenet-v2, default MIPI CSI camera (1280x720)
$./detectnet-camera.py --network=ssd-inception-v2 # using SSD-Inception-v2, default MIPI CSI camera (1280x720)
$./detectnet-camera.py --camera=/dev/video0 # using SSD-Mobilenet-v2, V4L2 camera /dev/video0 (1280x720)
$./detectnet-camera.py --width=640 --height=480 # using SSD-Mobilenet-v2, default MIPI CSI camera (640x480)
![复制代码](//assets.cnblogs.com/images/copycode.gif)
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步