Building the operating environment of yolov5 on jetson orin nx

1. Install jtop

sudo apt install python3-pip
sudo -H pip3 install -U jetson-stats
reboot

After restarting, enter jtop in the terminal (ctrl+alt+t) to see various information

2. Install jetpack

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install nvidia-jetpack

After the installation is complete, open jtop and you can see
Insert image description here

3. Install torch and torchvision

Install torch:
Select the version of pytorch you need in PyTorch for Jetson and download it. I installed the v1.12.0 version.

sudo apt-get install -y libopenblas-base libopenmpi-dev
pip3 install torch-1.12.0a0+2c916ef.nv22.3-cp38-cp38-linux_aarch64.whl

Open a new terminal on the desktop (ctrl+alt+t) and enter

python3
import torch
print(torch.__version__)

Check whether the installation is successful.
View version correspondence
Insert image description here

The torch version is v1.12.0
and the corresponding torchvision version is v0.13.0

Install torchvision:

sudo apt-get install libjpeg-dev zlib1g-dev libpython3-dev libavcodec-dev libavformat-dev libswscale-dev
git clone --branch v0.13.0 https://github.com/pytorch/vision torchvision
cd torchvision
export BUILD_VERSION=0.13.0
python3 setup.py install --user

Installation takes a while.
After completion, open a new terminal on the desktop (ctrl+alt+t) and enter:

python3
import torchvision
print(torchvision.__version__)

The version of torchvision will be displayed. Continue to enter the following commands in this terminal:

python3
import torch
print(torch.cuda.is_available())

Return true
Insert image description here
4. Configure the requirements of yolov5. Download yolov5
from github . I am using the yolov5-7 version. Open requirements and comment out lines 9, 16, and 17 with #.
Insert image description here

python3 -m pip install --upgrade pip
cd yolov5
pip3 install -r requirements.txt

After the package is installed,

cd yolov5
python detect.py --source data/images --weight yolov5m.pt --view-img

It will be displayed in the terminal and the running results are saved in runs/detect/exp.
The environment of yolov5 has been initially set up.
Insert image description here

Continuously updated. . .

Guess you like

Origin blog.csdn.net/weixin_42283539/article/details/130867469