Raspberry Pi 4b deep learning experience


Raspberry Pi 4b deep learning experience avoiding pits guide


Software experience`

Insert picture description here

Raspberry Pi image burning

Insert the picture here to describe the
Insert picture description herelatest official version of 2020.8.20 as an example.

First download the burning software Raspberry Pi Imager on the official website, and then download the system image file with the recommended software
[add link description](https://www.ras https://www.raspberrypi.org/downloads/pberrypi.org/downloads/)

Configuration

  1. Open ssh
    and create a new blank file in the root directory of the boot partition in MircoSD that has just been burned, and rename it to ssh, all in lowercase and no extension.

  2. Configure Wifi
    also in the root directory, create a new wpa_supplicant.conf file, the content is as follows:

country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
 
network={
ssid="SSID"
psk="PASSWORD"
key_mgmt=WPA-PSK
priority=1
}

Configure Raspberry Pi
Now you can pull out the MircoSD card, insert the Raspberry Pi, and then power on and boot normally.

Tip:

Pay attention to the two indicator lights on the Raspberry Pi. Red represents power, and green generally represents SD read and write. Under normal circumstances, the red light is always on and the green flashes every few seconds, indicating that the network connection is successful; while the green light flashes regularly, indicating that the SD card is not inserted properly or is invalid.

1. Query the IP address of Raspberry Pi

Insert picture description here

You can use the LAN scanning tool Advanced IP Scanner to obtain the corresponding information
. 2. SSH login Once you
have an IP address, you can use ssh to log in. input the command

ssh [email protected]

Then enter the default password raspberry, you can log in normally.

  1. Configure Raspberry Pi
    In the login ssh connection, enter the command

sudo raspi-config

config

Select 1 Change User Password to modify the current user password;

Select 5 Interfacing Options --> P1 Camera to enable the camera;

Select 5 Interfacing Options --> P2 SSH to enable SSH (already enabled);

Select 5 Interfacing Options --> P3 VNC to enable VNC;

Select 7 Advanced Option --> A1 Expand Filesystem to expand the available space;

Select 7 Advanced Option --> A5 Resolution to modify the screen resolution.

Connect to Raspberry Pi remotely

Use VNC remote desktop

Install VNC-Viewer-6.20.113-Windows, create a new connection, fill in the IP address of the Raspberry Pi, enter the user name pi, and the password raspberry to log in.

VNC

Tip:

After the VNC connection shows "Cannot currently show the desktop", just modify the screen resolution and restart it.

Modify the Raspberry Pi to a fixed IP address

Every time the Raspberry Pi is powered on, the IP address assigned by the router DHCP sometimes changes. Here we set a fixed address to facilitate the next connection.

After connecting with VNC, you can see the desktop of the Raspberry Pi. Right-click the Wifi icon in the upper right corner of the screen and select Wireless & Wired Network Settings.

Bind IP

Select SSID for Configure, bind only the specified Wifi connection, and fill in the corresponding network segment:

IPv4 address: 192.168.1.101

Router:192.168.1.1

DNS Servers: 192.168.1.1

Bind IP2

Update Raspberry Pi system

1. Change the mirror source

Due to well-known reasons, the update server of the Raspberry Pi cannot be accessed in China, so you can change to a domestic mirror station as the update point
`sudo nano /etc/apt/sources.list

`Comment the first line, then add Tsinghua source, the file content is as follows:
press ctrl + o to write, and then press ctrl + x to exit

#deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi

2. Replace the pip source

Also replace Aliyuan and Doubanyuan with pipsudo mkdir ~/.pip ls .pip sudo nano pip.conf

Write the following content into the configuration file
[global]
timeout = 10
index-url = http://mirrors.aliyun.com/pypi/simple/
extra-index-url = http://pypi.douban.com/simple/
[ install]
trusted-host =
mirrors.aliyun.com
pypi.douban.com

3. Use VPN to connect to official sources

After entering the directory, install the vpn client;

cd Downloads/
sudo dpkg -i expressVPN_xv_2.6.3.3-1_armhf.deb
1
2
Activate the software
expressvpn activate
1
Connect VPN
expressvpn connect # Connect VPN
expressvpn list # View server available list
expressvpn status # View connection status
expressvpn disconnect # Disconnect link
*

I didn't succeed

Insert picture description here

4. Update system

After the connection problem is resolved, the system can be updated.

sudo apt-get update
sudo apt-get upgrade
pip3 install -U pip

There is no problem and the update is successful

Insert picture description here

Raspberry Pi 4b build a deep learning application OpenCV learning experience

One, OpenCV installation and compilation of basic libraries

Install some dependency libraries needed for compilation:

sudo apt-get -y install build-essential cmake unzip pkg-config
sudo apt-get -y install libjpeg-dev libpng-dev libtiff-dev
sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get -y install libxvidcore-dev libx264-dev
sudo apt-get -y install libgtk-3-dev
sudo apt-get -y install libcanberra-gtk*
sudo apt-get -y install libatlas-base-dev gfortran

Compilation problem is not big

Install Python virtual environment

The official image of the Raspberry Pi comes with two versions, python 2.7.16 and python 3.7.3. In order to isolate the package conflicts in each environment, clarify the required python version. Let's install a virtual environment management package first, which will provide good support for the subsequent environment dependencies of Tensorflow and Pytorch. (Because I only left one python3.7.6 before, I gave up this question)

sudo pip3 install -U virtualenv
virtualenv -p python3 ~/my_envs/opencv
source ~/my_envs/opencv/bin/activate
# 安装 numpy
pip3 install numpy

Insert picture description here
But due to network problems, my process has been cruel,
Insert picture description here
and it still doesn’t work after repeated retries.

Guess you like

Origin blog.csdn.net/weixin_47772846/article/details/109403305