Procedure for Installing PyTorch and PyTorch Vision on Raspberry Pi 4B
1. First, update the Raspbian OS (on the terminal):
$ sudo apt-get update
$ sudo apt-get dist-upgrade
2. Install dependencies (on the terminal):
$ sudo apt install libopenblas-dev libblas-dev m4 cmake cython python3-dev python3-yaml python3-setuptools
$ sudo apt-get install libavutil-dev libavcodec-dev libavformat-dev libswscale-dev
3. You can install PyTorch and PyTorch Vision using the pre-compiled Python wheel files:
$ git clone https://github.com/sungjuGit/PyTorch-and-Vision-for-Raspberry-Pi-4B.git
$ cd PyTorch-and-Vision-for-Raspberry-Pi-4B
$ sudo pip3 install torch-1.4.0a0+f43194e-cp37-cp37m-linux_armv7l.whl
$ sudo pip3 install torchvision-0.5.0a0+9cdc814-cp37-cp37m-linux_armv7l.whl
4. Check the installation by running a simple test and confirming that Python outputs a tensor (5x3 matrix) with random number elements:
python3
(in the python shell)>>> from __future__ import print_function
(in the python shell)>>> import torch
(in the python shell)>>> a = torch.rand(5,3)
(in the python shell)>>> print (a)
'Embedded System > Raspberrypi' 카테고리의 다른 글
[Object Detection] Coral USB Accelerator + DonkeyCar(RPi4) (0) | 2020.11.21 |
---|---|
[RPi4] 라즈베리파이 4 Ubuntu 18.04.4 LTS 설치하기 (1) | 2020.05.05 |
[Raspberry pi3] 한글 입력/출력 설정하기 (0) | 2020.04.12 |
[Raspberry pi3] 무선 AP 생성 (0) | 2020.04.09 |