声明:本文非笔者原创,转载自https://www.jianshu.com/p/bb4587014349,仅供学习参考使用
1 准备工作
- 必备材料:
Jetson TX2、原装数据线和电源线(电源公头需要自备)、搭载Ubuntu 64位系统的PC(仅支持Ubuntu14.04/16.04,我找了一台18.04的机器也是各种报错,报错内容就是18.04版本不是官方支持的版本,所以建议直接用推荐的版本)、路由器(强烈建议,后面会介绍)、三根网线、各种线。 - 注意:
笔者使用的是VMware+Ubuntu 16.04的虚拟机环境成功对Jetson TX2刷机到Jetpack 3.3
可以看到,官网推荐使用14.04版本的linux系统刷Jetpack的工具包: - 刷机软件和相关的数据包,Jetpack、CUDA、cuDNN、OPENCV、OpenGL、Nsight、TensorRT等。(其实你直接选择all即可,以免后期又要重新配置jetpack里的各种工具,实在是麻烦,大佬随意)
2 注意事项
- 准备好主机和TX2,连接网络,插上路由器(外网进一根线,两根线分别接主机和TX2),从官网下载最新的Jetpack 3.3
- JetPack是一个x86二进制文件,不能在基于ARM的机器上运行,需要通过宿主机烧录到ARM构架的TX2中。
- 运行时注意路径问题,在相同路径下进行JetPack操作
- 如果是使用虚拟机作为host PC,请保证虚拟机硬盘在40G以上,且虚拟机的网络选择桥接。(笔者使用的以往的虚拟机,直接分配了100GB的内存)
3 刷机步骤
- 在虚拟机(主机)上运行JetPack
- 选择Jetson TX2开发板
- 选择Jetpack刷机包(不断点击next,有问题解决问题,差环境配置环境)
- 在开发板上一顿操作然后在Post Installation上按下Enter键就可以等待安装了(等待下载,下载时间由本地网速决定)
4 详细步骤
由于网上太多关于Jetson TX2开发板刷机的文章,我这里不再整理阐述,建议先阅读参考2、3、4,最后按照官网提供的How to Install JetPack文档进行安装。
- 官网的是最值得参考的:
How to Install JetPack - 主要参考(讲的很详细,这个人的简书号可以关注一下):
这是大佬关于本文的教程:https://www.jianshu.com/p/bb4587014349
这是大佬的主页:Website - 其他参考
# 1 # Jetson TX2配置--简书
# 2 # Jetson TX2刷机--CSDN
# 3 # TX2从入门到放弃学习笔记(1)基础--CSDN
4 可能遇到的问题
坑#1 虚拟机网络不好
虚拟机网络不好 --> 解决办法:VM虚拟机桥接模式无法联网解决办法
除了Jetson TX2之外,您还需要另一台带有Intel或AMD x86处理器的台式机或笔记本电脑。(我是win 10 专业版系统,安装VMware workstation 12 Pro 虚拟机,并在虚拟机上安装Ubuntu -14.04 64 位操作系统,虚拟机一定要将网络设置为桥接模式,复制物理地址)
坑#2 Error: non_EN locale
因为是以前用过的ubuntu,为了方便换成中文版的系统了,Jetpack不能在中文环境(non_EN locale)下进行installation,所以我们需要在ubuntu的设置中将整个系统的语言支持修改成美国(EN)状态。
坑#3 Error: Please run JetPack as a non-elevated user.
解决办法:普通权限运行Jetpack,不用sudo或者root用户,直接运行
./{Jetpack}
- 1
坑#4 ERROR:return code:127 /bin/bash: xterm: command not found
- xterm官网,安装即可:
apt install xterm
- 1
坑#7 桥接模式的设置
点击虚拟机–>设置,将网络适配器中的网络连接改为桥接模式,并勾选复制物理网络连接状态(我相信这也是大多数人所遇到的坑)
如果修改之后桥接模式不能联网,那就试试下面方法
VM虚拟机桥接模式无法联网解决办法
然后再重新执行一遍就好了!
坑#6
- 一定要买个USBhub插tx2上,不然刷机很不方便,需要接鼠标键盘甚至U盘
- 连接主机和tx2到一起时一定要用网线,不要指望板子的无线,可能会出点小问题。
5 Demo
参考文章:https://www.cnblogs.com/Mufasa/p/8414376.html
5.1 OceanTTF demo
The CUDA samples directory is copied to the home directory on the device by JetPack. The built binaries are in the following directory:
/home/ubuntu/NVIDIA_CUDA-_Samples/bin/armv7l/linux/release/gnueabihf/
这里的version需要看你自己安装的CUDA版本而定
Run the samples at the command line or by double-clicking on them in the file browser. For example, when you run the oceanFFT sample, the following screen is displayed.
5.2 车辆检测demo
nvidia@tegra-ubuntu:~$ cd ~/tegra_multimedia_api/samples/backend/
nvidia@tegra-ubuntu:~/tegra_multimedia_api/samples/backend$ ./backend 1 ../../data/Video/sample_outdoor_car_1080p_10fps.h264 H264 --trt-deployfile ../../data/Model/GoogleNet_one_class/GoogleNet_modified_oneClass_halfHD.prototxt --trt-modelfile ../../data/Model/GoogleNet_one_class/GoogleNet_modified_oneClass_halfHD.caffemodel --trt-forcefp32 0 --trt-proc-interval 1 -fps 10
Net has batch_size, channel, net_height, net_width:1 3 540 960
forced_fp32 has been set to 0(using fp16)i/samples/backend$ ./backend 1 ../../data/Video/sample_outdoor_car_1080p_10fps.h264 H264 --trt-deployfile ../../data/Model/GoogleNet_one_class/GoogleNet_modified_ooutputs coverage
outputs bboxes
Create TRT model cache
outputDim c 1 w 240 h 132
outputDimsBBOX.c() 4 w 240 h 132
Failed to query video capabilities: Inappropriate ioctl for device
NvMMLiteOpen : Block : BlockType = 261
TVMR: NvMMLiteTVMRDecBlockOpen: 7647: NvMMLiteBlockOpen
NvMMLiteBlockCreate : Block : BlockType = 261
Failed to query video capabilities: Inappropriate ioctl for device
Failed to query video capabilities: Inappropriate ioctl for device
Starting decoder capture loop thread
TVMR: cbBeginSequence: 1179: BeginSequence 1920x1088, bVPR = 0
TVMR: LowCorner Frequency = 0
TVMR: cbBeginSequence: 1529: DecodeBuffers = 5, pnvsi->eCodec = 4, codec = 0
TVMR: cbBeginSequence: 1600: Display Resolution : (1920x1080)
TVMR: cbBeginSequence: 1601: Display Aspect Ratio : (1920x1080)
TVMR: cbBeginSequence: 1669: ColorFormat : 5
TVMR: cbBeginSequence:1683 ColorSpace = NvColorSpace_YCbCr601
TVMR: cbBeginSequence: 1809: SurfaceLayout = 3
TVMR: cbBeginSequence: 1902: NumOfSurfaces = 12, InteraceStream = 0, InterlaceEnabled = 0, bSecure = 0, MVC = 0 Semiplanar = 1, bReinit = 1, BitDepthForSurface = 8 LumaBitDepth = 8, ChromaBitDepth = 8, ChromaFormat = 5
TVMR: cbBeginSequence: 1904: BeginSequence ColorPrimaries = 2, TransferCharacteristics = 2, MatrixCoefficients = 2
[INFO] (NvEglRenderer.cpp:109) <renderer0> Setting Screen width 1920 height 1080
libv4l2_nvvidconv (0):(792) (INFO) : Allocating (17) OUTPUT PLANE BUFFERS Layout=1
libv4l2_nvvidconv (0):(808) (INFO) : Allocating (17) CAPTURE PLANE BUFFERS Layout=0
libv4l2_nvvidconv (0):(792) (INFO) : Allocating (17) OUTPUT PLANE BUFFERS Layout=0
libv4l2_nvvidconv (0):(808) (INFO) : Allocating (17) CAPTURE PLANE BUFFERS Layout=0
Query and set capture successful
Time elapsed:60 ms per frame in past 100 frames
TVMR: FrameRate = 10.000000
Time elapsed:62 ms per frame in past 100 frames
TVMR: FrameRate = 10.000000
Time elapsed:62 ms per frame in past 100 frames
TVMR: FrameRate = 10.000000
Time elapsed:65 ms per frame in past 100 frames
TVMR: FrameRate = 10.000000
Time elapsed:61 ms per frame in past 100 frames
Could not read nal unit from file. EOF or file corrupted
Input file read complete
TVMR: NvMMLiteTVMRDecDoWork: 6531: NVMMLITE_TVMR: EOS detected
TVMR: TVMRBufferProcessing: 5486: Processing of EOS
TVMR: TVMRBufferProcessing: 5563: Processing of EOS Done
Exiting decoder capture loop thread
Time elapsed:64 ms per frame in past 100 frames
TVMR: TVMRFrameStatusReporting: 6132: Closing TVMR Frame Status Thread -------------
TVMR: TVMRVPRFloorSizeSettingThread: 5942: Closing TVMRVPRFloorSizeSettingThread -------------
TVMR: TVMRFrameDelivery: 5982: Closing TVMR Frame Delivery Thread -------------
TVMR: NvMMLiteTVMRDecBlockClose: 7815: Done
App run was successful
6 Appendix
DIY一个亚克力板作为防尘,后期会跑一个目标检测的demo作为实验品。
7 Referencec
- Jetson TX2入门之开箱刷机跑demo
https://blog.csdn.net/Q_QuanTing/article/details/81017717