jetson nano b01使用准备

jetson nano b01使用准备

镜像烧录

不同的第三方载板有不同的烧录方案,使用的为米文动力的载板,安装的为jetpac4.6版本系统,按照官方文档进行烧录。

http://doc.miivii.com/6717496.html#LiteNanoMini%E7%94%A8%E6%88%B7%E6%89%8B%E5%86%8C-%E9%99%842.FlashTools%EF%BC%88%E5%88%B7%E6%9C%BA%E5%B7%A5%E5%85%B7%EF%BC%89ReleaseNote

迁移系统到SSD

开发板自带的16GB的内存比较小,在安装SSD后可将系统迁移至SSD中,参考https://blog.csdn.net/m0_53408051/article/details/127655853

  • 先把nvme硬盘分区为Ext4,使用disks程序,找到安装好的SSD盘,右上角点击格式化硬盘为GPT格式,格式化后点击容量显示的左下角的加号,新加一个分区,结束后分区名显示应为p1结尾。
  • 再下载压缩包: git clone https://github.com/jetsonhacks/rootOnNVMe.git
  • 解压后, cd rootOnNVMe 进入目录,./copy-rootfs-ssd.sh 执行复制脚本
  • 安装启动脚本:./setup-service.sh 将rootfs设置为NVME,sudo reboot 重启

重启之后,则可看到你的新的机子的空间变为SD卡或者SSD的空间大小,原有的空间变成了一个盘(不要删除它,否则会出事)

PS:git clone出现 fatal: unable to access解决方案

终端执行 git config --global http.proxy 以及 git config --global http.proxy

安装常用模块

一些模块的安装可以帮助后续更好的使用,参考https://blog.csdn.net/IamYZD/article/details/119618950

apt换源

  • 备份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo gedit /etc/apt/sources.list
  • 删除所有内容,下面提供了国内几个支持arm64架构的Ubuntu镜像源,任选其一,写入文档:

清华大学镜像源:

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-proposed main restricted universe multiverse

中国科学技术大学镜像源:

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb http://mirrors.ustc.edu.cn/ubuntu-ports bionic main restricted universe multiverse
# deb-src http://mirrors.ustc.edu.cn/ubuntu-ports bionic main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu-ports bionic-updates main restricted universe multiverse
# deb-src http://mirrors.ustc.edu.cn/ubuntu-ports bionic-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu-ports bionic-backports main restricted universe multiverse
# deb-src http://mirrors.ustc.edu.cn/ubuntu-ports bionic-backports main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu-ports bionic-security main restricted universe multiverse
# deb-src http://mirrors.ustc.edu.cn/ubuntu-ports bionic-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb http://mirrors.ustc.edu.cn/ubuntu-ports bionic-proposed main restricted universe multiverse
# deb-src http://mirrors.ustc.edu.cn/ubuntu-ports bionic-proposed main restricted universe multiverse

阿里巴巴镜像站:

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.aliyun.com/ubuntu-ports/ bionic main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu-ports/ bionic main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu-ports/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu-ports/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu-ports/s bionic-backports main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu-ports/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu-ports/ bionic-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.aliyun.com/ubuntu-ports/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu-ports/ bionic-proposed main restricted universe multiverse
  • 更新
sudo apt update
sudo apt upgrade -y

pip安装换源

Ubuntu18.04自带python2和python3两个版本,但没有预安装pip,参考https://blog.csdn.net/wenwst/article/details/106982806

pip安装好后添加国内源,方便快速下载,参考https://blog.csdn.net/carrymingteng/article/details/120978053。

  • python2安装pip
sudo apt install python-pip # 安装
pip --version # 输出版本号,安装成功
pip install --upgrade pip # 保证版本最新
  • python3安装pip
sudo apt install python3-pip # 安装
pip3 --version # 输出版本号,安装成功
pip3 install --upgrade pip # 保证版本最新
  • pip换源

打开终端输入:

mkdir ~/.pip
sudo gedit ~/.pip/pip.conf

在空白文件中输入如下内容保存并退出,以下国内源可以任选其一:
以下为豆瓣源:

[global]
timeout=6000
index-url=https://pypi.doubanio.com/simple
trusted-host=pypi.doubanio.com

以下为阿里源:

[global]
index-url=http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com

以下为清华源:

[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple/
[install]
trusted-host=https://pypi.tuna.tsinghua.edu.cn

jtop安装

jetpack系统不能使用nvidia-smi来查看显卡使用情况,需要安装jtop来查看机器状态

sudo pip3 install jetson-stats  # 安装jtop
sudo jtop  # 运行jtop
# 可以查看cpu,gpu,内存,以及硬盘的使用情况,还能够调整jetson nano的运行模式
# 以及查看系统的cuda,cudnn,tensorRT的版本等情况

jetson nano b01使用准备_第1张图片
jetson nano b01使用准备_第2张图片

pytorch安装

jetson 预装了cuda版本,想要使用gup算力需要安装pytorch等模块

  • 添加cuda到环境
# jetson nano内置好了cuda,但需要配置环境变量才能使用,打开命令行添加环境变量即可
gedit ~/.bashrc
# 在最后添加这些
export PATH=/usr/local/cuda-10.2/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CUDA_ROOT=/usr/local/cuda

source ~/.bashrc  # 应用当前配置

nvcc -V  # 查看是否配置成功
  • 安装torch依赖

    sudo apt-get install libopenblas-base libopenmpi-dev 
    
  • 官网下载torch1.7及torchvision0.8.0,外网速度慢,已上传https://download.csdn.net/download/qq_37527608/86991829,0积分下载,下载完成后解压。

  • 安装torch和torchvision

pip3 install Cython
pip3 install numpy torch-1.7.0-cp36-cp36m-linux_aarch64.whl
pip3 install torchvision-0.8.0a0+291f7e2-cp36-cp36m-linux_aarch64.whl
  • 验证安装是否成功
# 在终端输入运行python3,进入python环境
import torch
torch.__version__
torch.cuda.is_available()
import torchvision
torchvision.__version__
# 输出如下图所示则安装成功

jetson nano b01使用准备_第3张图片

PS:torchvision报错:UserWarning: Failed to load image Python extension解决方案

如果torch版本与torchvision版本不对应,更换为对应版本,如果版本对应可卸载当前版本,更换更低版本的torch和torchvision。

PS:pip安装警告: which is not on PATH解决方案

# 配置路径
gedit ~/.bashrc
# 在文件最后添加路径,该路径来源于第一步中安装 pip 时发出的警告
export PATH=/home/xxxx/.local/bin:$PATH
source ~/.bashrc

U盘兼容安装

之后的步骤可能需要使用U盘把文件拷入开发板,但是对于大容量设备可能会出现无法挂载,一条安装命令解决

sudo apt-get install exfat-utils

各种环境依赖安装

来自参考博客https://blog.csdn.net/IamYZD/article/details/119618950,不安装可能没问题,但还是安了,万一呢

# 配置需要用到的库
sudo apt-get install build-essential make cmake cmake-curses-gui -y
sudo apt-get install git g++ pkg-config curl -y
sudo apt-get install libatlas-base-dev gfortran libcanberra-gtk-module libcanberra-gtk3-module -y
sudo apt-get install libhdf5-serial-dev hdf5-tools -y
sudo apt-get install nano locate screen -y

# 安装所需要的依赖环境
sudo apt-get install libfreetype6-dev -y
sudo apt-get install protobuf-compiler libprotobuf-dev openssl -y
sudo apt-get install libssl-dev libcurl4-openssl-dev -y
sudo apt-get install cython3 -y

# 安装opencv的系统级依赖,一些编解码的库
sudo apt-get install build-essential -y
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev -y
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff5-dev libdc1394-22-dev -y
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev liblapacke-dev -y
sudo apt-get install libxvidcore-dev libx264-dev -y
sudo apt-get install libatlas-base-dev gfortran -y
sudo apt-get install ffmpeg -y

# 更新cmake
wget http://www.cmake.org/files/v3.13/cmake-3.13.0.tar.gz
tar xpvf cmake-3.13.0.tar.gz cmake-3.13.0/  #解压
cd cmake-3.13.0/
./bootstrap --system-curl	# 漫长的等待,做一套眼保健操...
make -j4 #编译  同样是漫长的等待...
echo 'export PATH=~/cmake-3.13.0/bin/:$PATH' >> ~/.bashrc
source ~/.bashrc #更新.bashrc

# torchvision 0.9.0版本需要的依赖
sudo apt-get install libopenmpi2
sudo apt-get install libopenblas-dev
sudo apt-get install libjpeg-dev zlib1g-dev

ssh连接

使用ssh能够在同一网络下的另一台设备上登录jetson终端,更方便的进行操作和文件传输

  • 查看jetson的ip
ifconfig -a
  • 在另一台设备打开终端,进行连接
ssh nvidia@192.168.0.101   # 用户名@ip地址
# 输入登录密码,即可登录
  • 使用ssh传输文件
# 从服务器上下载文件
scp nvidia@192.168.0.101:/xxx/test.txt  ./test

# 上传本地文件到服务器
scp ./test.txt  nvidia@192.168.0.101:/xxx/test/ 

# 从服务器下载整个目录
scp -r nvidia@192.168.0.101:/xxx/test  ./test/  

# 上传目录到服务器
scp -r ./test  nvidia@192.168.0.101:/xxx/test/ 

你可能感兴趣的:(jetson,深度学习,android,jetpack)