Semantic segmentation study notes 2-Jetson Xavier install pytorch

Semantic segmentation study notes 2-Jetson Xavier install pytorch

To run the code of semantic segmentation, you need to install pytorch first. The following are the steps for me to install semantic segmentation on Xavier.
Description of my environment:

nameversion
Hardware :Nvidia Jetson Xavier AGX
CUDA version :10.2
Jetpack version :JP 4.5
python version :python2.7 python3.6
deepstream-app version5.0.0
TensorRT Version :7.1
cuDNN Version :8.0

One, whl file install pytorch

Download the arm version compiled by Nvidia corresponding to your system at Jetson Zoo officially provided by Nvidia. The whl package installed under normal linux system is different here. Jetson Xavier is arm environment not x86.
For example, the file I downloaded is

Then follow the following four steps to install pytorch. Note here that instead of running
pip install torch-1.6.0-cp36-cp36m-linux_aarch64.whl directly,
you need to run the following four steps to succeed.


Install OpenBLAS and OpenMPI

sudo apt-get install libopenblas-base libopenmpi-dev
sudo apt-get install python3-pip
pip3 install Cython
pip3 install numpy torch-1.6.0-cp36-cp36m-linux_aarch64.whl
Insert picture description here

Whether the test runs successfully

python3
import torch
Insert picture description here

Two, install torchvision

Correspondence between pytorch and torchvision versions The
following versions are as of March 24,

Insert picture description here


2021. The corresponding torchvision version of pytorch 1.6.0 is 0.7.0

git clone -b v0.7.0 https://github.com/pytorch/vision
cd vision
sudo python3 setup.py install
Insert picture description here

Reference:
https://blog.csdn.net/u013595260/article/details/107180928/

Three, test whether the installation is successful

import torch
import torchvision

print(torch.__version__)
print(torch.version.cuda)
print(torchvision.__version__)

run

python3 test_pytorch.py
Insert picture description here

That's it!