sudo apt-get update
sudo apt-get install git cmake
sudo apt-get install python3-dev
sudo apt-get install libhdf5-serial-dev hdf5-tools
sudo apt-get install libatlas-base-dev gfortran
sudo apt install python3-pip
sudo -H pip3 install -U jetson-stats
sudo reboot
gsettings set org.gnome.desktop.session idle-delay 0
按理说出厂或刷机后应该装好,但我现在这个没有装,有的跳过即可
sudo apt-get install cuda-toolkit-10-2
下载好后配置环境
sudo 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
链接:https://pan.baidu.com/s/1AlsKa2esktaFxwUI768BSQ
提取码:1998
运行下述
sudo dpkg -i libcudnn8_8.0.0.180-1+cuda10.2_arm64.deb
sudo dpkg -i libcudnn8-dev_8.0.0.180-1+cuda10.2_arm64.deb
sudo dpkg -i libcudnn8-doc_8.0.0.180-1+cuda10.2_arm64.deb
安装完成后,其实是直接安装到了默认安装路径usr/include和usr/lib下的,因此需要将其拷贝到cuda安装路径下:
sudo cp /usr/include/cudnn.h /usr/local/cuda/include/
sudo cp /usr/lib/aarch64-linux-gnu/libcudnn* /usr/local/cuda/lib64/
下载地址:nvidia.box.com/shared/static/p57jwntv436lfrd78inwl7iml6p13fzh.whl
pip3更换清华源(若报错ERROR: unknown command "config"先运行sudo -H pip3 install -U pip)
sudo pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
sudo apt-get install python3-pip libopenblas-base libopenmpi-dev
pip3 install Cython
pip3 install numpy
pip3 install torch-1.8.0-cp36-cp36m-linux_aarch64.whl
sudo apt-get install libjpeg-dev zlib1g-dev libpython3-dev libavcodec-dev libavformat-dev libswscale-dev
git clone --branch v0.9.0 https://github.com/pytorch/vision torchvision #下载torchvision,会下载一个文件夹
cd torchvision #或者进入到这个文件夹,右键打开终端
export BUILD_VERSION=0.9.0
python3 setup.py install --user #时间较久
#验证torch和torchvision这两个模块是否安装成功
python3
import torch
print(torch.__version__) #注意version前后都是有两个横杠
#如果安装成功会打印出版本号
import torchvision
print(torchvision.__version__)
#如果安装成功会打印出版本号
若git clone过慢,参考https://segmentfault.com/a/1190000039768491
git clone https://github.com/ultralytics/yolov5.git #因为不开VPN很容易下载出错,建议在电脑中下载后拷贝到jetson nano中
python3 -m pip install --upgrade pip
cd yolov5 #如果是手动下载的,文件名称为yolov5-master.zip压缩包格式,所以要对用unzip yolov5-master.zip进行解压,然后再进入到该文件夹
pip3 install -r requirements.txt
一般情况下不能完全装上,所以挨个版本装出来的,我下载的是YOLOv5 6.0版本的,其中配置文件如下
# YOLOv5 requirements
# Usage: pip install -r requirements.txt
# Base ------------------------------------------------------------------------
gitpython>=3.1.30
matplotlib>=3.3
numpy>=1.18.5
opencv-python>=4.1.1
Pillow>=7.1.2
psutil # system resources
PyYAML>=5.3.1
requests>=2.23.0
scipy>=1.4.1
thop>=0.1.1 # FLOPs computation
torch>=1.7.0 # see https://pytorch.org/get-started/locally (recommended)
torchvision>=0.8.1
tqdm>=4.64.0
# ultralytics>=8.0.100
# protobuf<=3.20.1 # https://github.com/ultralytics/yolov5/issues/8012
# Logging ---------------------------------------------------------------------
# tensorboard>=2.4.1
# clearml>=1.2.0
# comet
# Plotting --------------------------------------------------------------------
pandas>=1.1.4
seaborn>=0.11.0
# Export ----------------------------------------------------------------------
# coremltools>=6.0 # CoreML export
# onnx>=1.10.0 # ONNX export
# onnx-simplifier>=0.4.1 # ONNX simplifier
# nvidia-pyindex # TensorRT export
# nvidia-tensorrt # TensorRT export
# scikit-learn<=1.1.2 # CoreML quantization
# tensorflow>=2.4.0 # TF exports (-cpu, -aarch64, -macos)
# tensorflowjs>=3.9.0 # TF.js export
# openvino-dev # OpenVINO export
# Deploy ----------------------------------------------------------------------
setuptools>=65.5.1 # Snyk vulnerability fix
# tritonclient[all]~=2.24.0
# Extras ----------------------------------------------------------------------
# ipython # interactive notebook
# mss # screenshots
# albumentations>=1.0.3
# pycocotools>=2.0.6 # COCO mAP
对应jetson中的安装命令如下
pip3 install gitpython==3.1.20
pip3 install matplotlib==3.2.2 #这里一般都会有问题,直接pip3 install matplotlib即可,一般会默认2.2版本,装不上也没事,后续装seaborn时会继续装合适的版本
pip3 install numpy==1.19.5
pip3 install opencv-python==4.5.3.56
pip3 install Pillow>=7.1.2
pip3 install psutil
pip3 install PyYAML
pip3 install requests
pip3 install scipy==1.4.1
pip3 install thop
#torch>=1.7.0 上面已经装过 1.8
#torchvision>=0.8.1 上面已经装过 0.9.0
pip3 install tqdm==4.61.2
pip3 install pandas>=1.1.4
pip3 install seaborn
pip3 install setuptools==59.6.0
pip3 install scikit-build==0.11.1
pip3 install tensorboard==2.5.0
若gitpython报错直接把train那里的代码删了也没影响。
python3 -m pip list #可查看python中安装的包
以下指令可以用来测试yolov5
python3 detect.py --source data/images/bus.jpg --weights yolov5s.pt --img 640 #图片测试
参考
[1]: https://blog.csdn.net/GNNUXXL/article/details/119246587
[2]: https://blog.csdn.net/weixin_44017159/article/details/122279665
[3]: https://www.modb.pro/db/398404
[4]: http://adrai.github.io/flowchart.js/