Jetson TX2 Setup Introduction
2021-04-25 本文已影响0人
红薯爱帅
1. 准备工作
- Jetson TX2一台,最新AI model和my_backup.img.raw
- 下载Jetpack 3.1安装包:JetPack-L4T-3.1-linux-x64.run
Jetson Download Center
https://developer.nvidia.com/embedded/downloads - PC机:Ubuntu 16.04,或者Ubuntu 14.04,暂时不支持Ubuntu 18.04
- PC机Proxy:由于安装过程中,需要下载安装一堆软件,最好有一个代理,这样快一些。推荐Proxychains4+Shadowsocks,其中Proxychains4可以配置内网环境跳过代理
- Proxychains4的安装和测试,可以参看章节5
2. 初始化Jetson TX2
- 在PC机,运行下面命令,list all machines in LAN,获取nvidia名称的IP,即为Jetson TX2的IP
$ sudo arp-scan -l --interface=wlp3s0
- 在Jetson上,运行下面命令。检查Jetson TX2里面安装的Jetpack版本号,R28对应Jetpack 3.1。账号密码都是nvidia
$ head -n 1 /etc/nv_tegra_release
# R28 (release), REVISION: 1.0, GCID: 9379712, BOARD: t186ref, EABI: aarch64, DATE: Thu Jul 20 07:59:31 UTC 2017
- 在PC机,执行Jetpack,下载安装包,并Copy到JetSon,配置免密登录(都是自动化完成)。软件只用安装下面四个:
- CUDA Toolkit
- TensorRT
- OpenCV for Tegra
- cuDNN Package
$ ./JetPack-L4T-3.1-linux-x64.run
# 如果网络不给力,可以执行
$ proxychains4 ./JetPack-L4T-3.1-linux-x64.run
image.png
image.png
3. 安装部署
- 在Jetson上,创建文件夹
$ ssh nvidia@10.30.4.216
$ mkdir -p /home/nvidia/xray /pai
$ sudo chown nvidia:nvidia /pai
- 在PC机,Copy文件到Jetson
$ sudo mount -t ext4 -o loop my_backup.img.raw /mnt
$ scp -r /mnt/home/nvidia/xray/release nvidia@10.30.4.216:/home/nvidia/xray
$ sudo scp -r /mnt/pai nvidia@10.30.4.216:/
$ sudo scp /mnt/etc/matplotlibrc nvidia@10.30.4.216:/pai
# 在Jetson将matplotlibrc剪切到/etc目录
$ sudo mv /pai/matplotlibrc /etc/
4. 启动测试
- 在Jetson上,启动服务
$ sudo sh /home/nvidia/xray/release/run-detector.sh
- 在PC机,测试服务
$ sudo apt-get install httpie
$ cd /mnt/pai/data/models/detector/xray/tests
$ http -f http://10.30.4.216:8080/service/detect/xray search@00001.png
$ http -f http://10.30.4.216:8080/service/detect/xray search@00002.png
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Length: 684
Content-Type: application/json
Server: TornadoServer/4.5.2
{
"boxes_detected": [
{
"box": [
0.2646198830409357,
0.546875,
0.1827485380116959,
0.26875
],
"puid": "Phone",
"score": 0.9966097474098206,
"type": "Phone"
},
{
"box": [
0.3538011695906433,
0.4875,
0.0847953216374269,
0.25625
],
"puid": "Key_Chain",
"score": 0.7923935055732727,
"type": "Key_Chain"
}
],
"detecttime": "1.822",
"get_image_time": "0.020",
"image_id": "135846_938112_3ba655f8-59b9-11e8-ab1a-00044ba51739",
"request_id": "3ba655f8-59b9-11e8-ab1a-00044ba51739",
"time": "1.843",
"ver": "2.2.11"
}
- 在Jetson上,设置开机启动,并重启后测试
$ cd /etc/init.d
$ sudo touch start-detector
$ sudo chmod +x start-detector
$ sudo update-rc.d start-detector defaults
--- Content as below ---
#!/bin/sh
cd /home/nvidia/xray/release
sh run-detector.sh
------------------------
5. 安装proxychains4
5.1. Compile and install proxychains4
$ git clone https://github.com/rofl0r/proxychains
$ cd proxychains
$ git checkout v4.5
$ ./configure
$ make
$ sudo make install
$ sudo rm /usr/local/etc/proxychains.conf
5.2. Create the following config file in /etc/proxychains.conf
strict_chain
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 127.0.0.0/255.0.0.0
localnet 10.0.0.0/255.0.0.0
localnet 192.168.0.0/255.255.0.0
[ProxyList]
socks5 127.0.0.1 1080
5.3. Test
- 单条命令使用proxychains
$ proxychains4 wget http://www.google.com
$ proxychains4 curl ip.cn
- 代理Bash,所有在这个终端的命令都走proxychins
$ proxychains4 bash
$ curl ip.cn