2020년 7월 11일 토요일

Jetson Nano - JetPack 4.4(production release) and Pytorch 1.6.0 installation

I explained how to install PyTorch 1.5 from JetPack 4.4 DP version at https://spyjetson.blogspot.com/2020/06/jetson-nano-jetpack-44-dp-and-pytorch.html.
Recently, Jetpack 4.4 Production version has been released. And PyTorch can also install version 1.6.
In this article, we will see how to install the Jetpack 4.4 production version and install PyTorch 1.6.




The title of the article is version 1.5.0 of PyTorch, but version 1.6 was released in the download link of the text.

JetPack 4.4 Production Installation

Make SD Card

Download the SD Card image from the https://developer.nvidia.com/embedded/downloads.


After downloading the image file, burn a SD Card image of JetPack 4.4 Production version using Echer. If you use Echer, you don't have to unzip the zip image file. Just select the zip file as an image file. It is recommended to prepare an SD card with a storage space of 64 GB or more.

Headless setup

Now it's time to setup the Jetson Nano. And I would not use a monitor. I'm going to get it all done at once on a Windows machine.

First, connect the PC and the Jetson Nano with a USB cable.


Insert the SD card with JetPack 4.4 installed.
Next connect the 5V power cable to the Jetson Nano. Jetson Nano will boot now.
On  your PC, open the "Windows Device Manager" and then, search for serial devices.


You can see that the new serial device is connected as shown above. Jetson Nano is connected on COM10 port.
Now you can access the Jetson Nano with a serial console using a tool like putty.



If everything is fine, the serial console window in the following figure will open.


Now, you can proceed with the setting in the order according to the contents of the screen. The network settings appear at the end of the setting. After completing this setting, you can connect using ssh. If you can't have a ssh connection, you can connect the serial console to the Jetson Nano at any time using a usb cable. And check the ssh configuration. If the ssh service is not running, activate and start the ssh service.

Finally I can connect the Jetson Nano with Jetpack 4.4 using ssh.



PyTorch 1.6.0 Installation

If you have already installed another version of PyTorch on your Jetpack 4.4 SD card, delete the old version first.

Delete old versions of PyTorch

First check pre-installed PyTorch. If there is no PyTorch version already installed, proceed to the next step.

root@spypiggy-nano:/usr/local/src/detr# pip3 freeze|grep torch
torch==1.1.0
torchvision==0.3.0

root@spypiggy-nano:/usr/local/src/detr# pip3 uninstall  torchvision==0.3.0
root@spypiggy-nano:/usr/local/src/detr# pip3 uninstall  torch==1.1.0

Download PyTorch for Jetson Nano

We always use Python 3.X. Therefore, download the whl file that can be used in Python 3.6. And install the necessary packages as follows. JetPack 4.3 and later comes with OpenCV 4.1.1 and numpy. So you don't have to install numpy anymore.

sudo apt-get update
wget https://nvidia.box.com/shared/static/yr6sjswn25z7oankw8zy1roow9cy5ur1.whl -O torch-1.6.0-cp36-cp36m-linux_aarch64.whl sudo apt-get install python3-pip libopenblas-base libopenmpi-dev pip3 install Cython pip3 install torch-1.6.0-cp36-cp36m-linux_aarch64.whl

Download Torchvision for Jetson Nano

If you have successfully installed PyTorch 1.6.0, install Torchvision 0.6.1. The latest version of torchvision can be found at https://github.com/pytorch/vision/releases.

sudo apt-get install libjpeg-dev zlib1g-dev
wget https://github.com/pytorch/vision/archive/v0.6.1.tar.gz
tar -xvzf v0.6.1.tar.gz
cd v0.6.1 sudo python3 setup.py install
apt-get install libfreetype6-dev
pip3 uninstall pillow
pip3 install --no-cache-dir pillow

Be Careful : You must use python3, pip3 commands. PyTorch 1.5 and later, Python 2 is no longer supported.

Let's check whether the installation is correct.
If you see the screen like this, the installation is successful. I have installed torchvision 0.6.1, but the version info says 0.6.0.a0.

root@jetpack-4:/usr/local/src/torchvision# python3
Python 3.6.9 (default, Apr 18 2020, 01:56:04)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> import torchvision
>>> torch.__version__
'1.6.0'
>>> torchvision.__version__
'0.6.0a0
>>>













댓글 없음:

댓글 쓰기