官方镜像文件地址:
Jetson Download Center | NVIDIA Developer
我选择的是4.6.1版本:
官方zip地址:https://developer.download.nvidia.cn/embedded/L4T/r32_Release_v7.1/JP_4.6.1_b110_SD_Card/Jeston_Nano/jetson-nano-jp461-sd-card-image.zip?0BuIlHOrU40zizluGaGPHJWzeFxUh7h5zfH0w1EMDbK8vvJgxUh7gEA-M0lCbt5D58uMxximO5wUz1Xa8Up_ds9LCcxjHYqLGBkSTq4LNYS-lihm0sd4LJRY5JqPBHL750Kg9uk0FW2KYQcyEomWeRFBvpKxh38fTD4af6h8t-vlyFIOqgJM5DcdKBSrwCC6OcImg69Dm9E-XREmursmsbRt&t=eyJscyI6InJlZiIsImxzZCI6IlJFRi1ibG9nLnJvYm9mbG93LmNvbVwvZGVwbG95LXlvbG92NS10by1qZXRzb24tbnhcLyJ9
解压之后会有一个img文件
使用烧录工具将镜像烧录到SD卡中:
烧录工具我选择的是:win32Disk Imager
win32Disk Imager下载地址:Win32 Disk Imager download | SourceForge.net
开机系统配置:一路默认就可以
sudo apt-get update
sudo apt-get full-upgrade
sudo apt-get install ibus
sudo apt-get install ibus ibus-clutter ibus-gtk ibus-gtk3 ibus-qt4
im-config -s ibus
sudo apt-get install ibus-pinyin
ibus-setup # 进入到配置界面
将pinyin添加到input Method
回到桌面点击右上方的语言选择工具--->点击到最下方的Text Entry Settings,进入到如下界面
点击+号将English和pinyin都添加到Input Source to use:中
回到桌面:
点击右上方的语言选择工具选择拼音即可
sudo apt install curl
curl https://bootstrap.pypa.io/pip/3.6/get-pip.py -o get-pip.py
sudo python3 get-pip.py
jetpack自带cuda10.2和cudnn只需要将它添加到环境变量:
cuda查看路径 ls /usr/local/cuda-10.2
nvcc查看路径 ls /usr/local/cuda/bin
配置环境变量:
sudo vim ~/.bashrc
将下边两行添加到末尾:
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
使得变量生效:
source ~/.bashrc
cd /usr/src/cudnn_samples_v8/mnistCUDNN/
sudo apt-get install libfreeimage3 libfreeimage-dev
sudo make
./mnistCUDNN
如果执行不了可执行文件提示权限问题则:
sudo chmod a+x mnistCUDNN
执行./mnistCUDNN后最终出现passed!则说明没有问题
本节引自:Jetson nano部署Yolov5 ——从烧录到运行 1:1复刻全过程_IamYZD的博客-CSDN博客_jetsonnano部署yolov5
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
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
torch地址为:
PyTorch for Jetson - version 1.11 now available - Jetson Nano - NVIDIA Developer Forums
我选择的是1.8.0:
(起初选择的是1.11.0, 但是在运行和配置torchvision的时候遇到些问题,参考别人的方案降为1.8.0)
安装torch:
sudo pip3 install torch-1.8.0-cp36-cp36m-linux_aarch64.whl
测试torch:
python3
import torch
torch.cuda.is_available()
print(torch.zeros(2).cuda())
都正常的话会显示下面的界面:
关于torch和torchvision的版本对应关系可在https://github.com/pytorch/vision的README中查看
此处需要注意的是安装的torch一定要和torchvision对应,否则在运行代码的时候则会提示二者不兼容,实测直接使用pip3 install安装调用出错,因此下边从源码进行安装。
git clone --branch v0.9.0 https://github.com/pytorch/vision.git torchvision
如果github地址clone比较慢的话,我在gitee上看到有一份别人提供的直接就拿过来用了
git clone --branch v0.9.0 https://gitee.com/ycp1027/vision.git torchvision
安装:
cd torchvision
sudo apt-get install libopenmpi2 libopenblas-dev libjpeg-dev zlib1g-dev
export BUILD_VERSION=0.9.0
sudo python3 setup.py install
关于yolov5的源码:
官方地址:
https://github.com/ultralytics/yolov5/releases
我选择的是v5.0版本, 源码和s模型权重.zip地址:
https://codeload.github.com/ultralytics/yolov5/zip/refs/tags/v5.0
https://github.com/ultralytics/yolov5/releases/download/v5.0/yolov5s.pt
完成源码配置后进入到yolov5目录可直接运行:
python3 detect.py
提示缺少包的话可以直接sudo pip install xxx,
可能会遇到的matplotlib, numpy, seaborn, pyyaml相关的问题:
(此处参考:Jetson nano部署Yolov5 ——从烧录到运行 1:1复刻全过程_IamYZD的博客-CSDN博客_jetsonnano部署yolov5)
matplotlib问题解决(仅供参考):
sudo pip3 install --upgrade Cython
sudo pip3 install matplotlib==3.2.2
numpy问题解决(仅供参考):
sudo apt-get remove python-numpy
sudo pip3 install numpy==1.19.4
sudo pip3 install scipy==1.4.1.
seaborn问题解决(仅供参考):
sudo pip3 install seaborn==0.11.1
pyyaml问题解决(仅供参考):
sudo -H pip3 install --upgrade PyYAML
正常测试完整pip3包如下, 如果出现版本问题可参考以下各个包的版本:
absl-py==1.0.0
apt-clone==0.2.1
apturl==0.5.2
asn1crypto==0.24.0
beautifulsoup4==4.6.0
blinker==1.4
Brlapi==0.6.6
cachetools==4.2.4
certifi==2018.1.18
chardet==3.0.4
charset-normalizer==2.0.12
click==6.7
colorama==0.3.7
cryptography==2.1.4
cupshelpers==1.0
cycler==0.10.0
Cython==0.29.30
dataclasses==0.8
decorator==4.1.2
defer==1.0.6
distro==1.7.0
distro-info===0.18ubuntu0.18.04.1
feedparser==5.2.1
google-auth==1.35.0
google-auth-oauthlib==0.4.6
graphsurgeon==0.4.5
grpcio==1.46.3
html5lib==0.999999999
httplib2==0.9.2
idna==2.6
importlib-metadata==4.8.3
importlib-resources==5.4.0
install==1.3.5
jetson-stats==3.1.4
Jetson.GPIO==2.0.17
keyring==10.6.0
keyrings.alt==3.0
kiwisolver==1.3.1
language-selector==0.1
launchpadlib==1.10.6
lazr.restfulclient==0.13.5
lazr.uri==1.0.3
louis==3.5.0
lxml==4.2.1
macaroonbakery==1.1.3
Mako==1.0.7
Markdown==3.3.7
MarkupSafe==1.0
matplotlib==3.2.2
numpy==1.19.4
oauth==1.0.1
oauthlib==3.2.0
olefile==0.45.1
onboard==1.4.1
opencv-python==4.5.3.56
packaging==21.3
PAM==0.4.2
pandas==1.1.5
patsy==0.4.1+dev
Pillow==8.4.0
protobuf==3.19.4
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycairo==1.16.2
pycocotools==2.0.3
pycrypto==2.6.1
pycups==1.9.73
PyGObject==3.26.1
PyICU==1.9.8
PyJWT==1.5.3
pymacaroons==0.13.0
PyNaCl==1.1.2
pyparsing==2.2.0
pyRFC3339==1.0
python-apt==1.6.5+ubuntu0.7
python-dateutil==2.8.2
python-debian==0.1.32
pytz==2018.3
pyxattr==0.6.0
pyxdg==0.25
PyYAML==6.0
requests==2.27.1
requests-oauthlib==1.3.1
requests-unixsocket==0.1.5
rsa==4.8
scikit-build==0.11.1
scipy==1.4.1
seaborn==0.11.1
SecretStorage==2.3.1
simplejson==3.13.2
six==1.11.0
ssh-import-id==5.7
system-service==0.3
systemd-python==234
tensorboard==2.5.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.1
tensorrt==8.2.1.8
thop==0.0.31.post2005241907
torctorch-1.8.0-cp36-cp36m-linux_aarch64.whl
torchvision==0.9.0a0
tqdm==4.61.2
typing_extensions==4.1.1
ubuntu-drivers-common==0.0.0
uff==0.6.9
unity-scope-calculator==0.1
unity-scope-chromiumbookmarks==0.1
unity-scope-colourlovers==0.1
unity-scope-devhelp==0.1
unity-scope-firefoxbookmarks==0.1
unity-scope-manpages==0.1
unity-scope-openclipart==0.1
unity-scope-texdoc==0.1
unity-scope-tomboy==0.1
unity-scope-virtualbox==0.1
unity-scope-yelp==0.1
unity-scope-zotero==0.1
urllib3==1.22
urwid==2.0.1
wadllib==1.3.2
webencodings==0.5
Werkzeug==2.0.3
xkit==0.0.0
youtube_dl==2018.3.14
zipp==3.6.0
zope.interface==4.3.2
(注:1.以上涉及的命令我均是在root用户下执行的;2.文件传输使用xftp)
参考:
Jetson nano部署Yolov5 ——从烧录到运行 1:1复刻全过程_IamYZD的博客-CSDN博客_jetsonnano部署yolov5
Jetson nano安装Pytorch详解_ooMelloo的博客-CSDN博客_jetson pytorch
Jetson Nano安装pytorch 基于torch1.6和torchvision0.7_零壹博弈的博客-CSDN博客_jetson nano安装torchvision
Jetson Nano 开发环境检查
JETSON NANO 4GB(B01公版/SUB版)
pip - How to upgrade disutils package PyYAML? - Stack Overflow