当前位置:网站首页>[raspberry pie 4B deep learning garbage classification] Chap.1 configure the raspberry pie with keras+tensorflow [deep learning moves]
[raspberry pie 4B deep learning garbage classification] Chap.1 configure the raspberry pie with keras+tensorflow [deep learning moves]
2022-06-09 06:29:00 【Jie_ MSD】
【 Raspberry pie 4B Realize garbage classification 】Chap.1 Make raspberry pie keras+tensorflow【 Deep learning Moves chapter 】
System environment :2020-08-20-raspios-buster-armhf-full
Engineering requirements :Tensorflow 1.14.0 + Keras 2.2.4 + Python 3.7
Explain the video :https://www.bilibili.com/video/BV1ab4y117jV?spm_id_from=333.999.0.0
Package image file : Please talk about me in private , Free to share ~
1. Good configuration ssh and vnc after , Source change :
First step , Back up the source file first
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo cp /etc/apt/sources.list.d/raspi.list /etc/apt/sources.list.d/raspi.list.bak
The second step , Edit system source files
sudo nano /etc/apt/sources.list
The third step , Use the initial source # Comment out , Add the following two lines of image source .Ctrl+O ++ Ctrl+X
【 Be careful 】 The raspberry pie system here is Raspbian-buster System , When writing system source links, you should pay attention to buster, Many online tutorials are before stretch edition , It's easy to make mistakes !
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main contrib non-free rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main contrib non-free rpi
Step four , Save and execute the following command sudo apt-get update, Complete the update package index of the source .
sudo apt-get update&&upgrade
Step five , You also need to change the system source
sudo nano /etc/apt/sources.list.d/raspi.list
use # Comment out the contents of the original document , Replace... With the following : use # Comment out the contents of the original document , Replace... With the following :
deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui
Step six , Configure the source change script , change pip Source
New folder :
mkdir ~/.pip
sudo nano ~/.pip/pip.conf
stay pip.conf Enter the following in the file :
timeout=100
index-url=https://pypi.tuna.tsinghua.edu.cn/simple/
extra-index-url= http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=
pypi.tuna.tsinghua.edu.cn
mirrors.aliyun.com
2.python Virtual environment configuration
First, update the system software package
sudo apt-get update
sudo apt-get upgrade
sudo rpi-update
Then update your own pip, because Raspbian Self contained pip3 by 9.0.1 edition , Rather old , We use the following command to update pip3:
python3 -m pip install --upgrade pip
Try after the update pip3 after , Enter command :
pip3 list
Create a new folder ( For virtual environment )
cd Desktop
mkdir tf_pi
cd tf_pi
Install the virtual environment
python3 -m pip install virtualenv
Add environment variables , So that the good thing can be used
sudo chmod -R 777 /root/.bashrc
sudo nano ~/.bashrc
hold
export PATH=/home/pi/.local/bin/:$PATH
To the end , Add environment variables
source ~/.bashrc
After success : Entire virtual environment
virtualenv env
source env/bin/activate
)
3. install tensorflow1.14.0
Download it from your computer :( link )python3.7 Version can only be installed 1.14.0-Buster Version of TensorFlow
link
use U Copy this file to raspberry pie , To build a bag Folder storage 
Install dependency packages :
sudo apt install libatlas-base-dev
Install some environment
sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev
python3 -m pip install keras_applications==1.0.8 --no-deps
python3 -m pip install keras_preprocessing==1.1.0 --no-deps
python3 -m pip install h5py==2.9.0
sudo apt-get install -y openmpi-bin libopenmpi-dev
sudo apt-get install -y libatlas-base-dev
python3 -m pip install -U six wheel mock
install tensorflow
cd env
cd bag
pip3 install tensorflow-1.14.0-cp37-none-linux_armv7l.whl

It will take 20 minutes to install here ... If something goes wrong, just do it again ..
Test for success and view the version :
python
import tensorflow as tf
tf.__version__

4. install keras
Install some dependencies
sudo apt-get install libhdf5-serial-dev
pip3 install h5py
sudo apt-get install gfortran
sudo apt install libopenblas-dev
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple/ pillow
sudo pip3 install pybind11
First download numpy: The first time I found that the installation was successful but the call failed , I think it is numpy The version is too high, resulting in an error
download keras still tensorflow Will automatically download when numpy( It existed before , It will uninstall and then install a higher version of numpy, It didn't exist before , It will directly install the higher version numpy), So download keras, And then unload numpy, Then install the lower version numpy
Take a look numpy edition , It's too high 
reinstall
pip3 uninstall numpy
pip3 install numpy==1.16.0
Second download scipy【 direct pip Ninety nine percent of the installations are likely to fail . So download first and then install ... First download this link and copy it to raspberry pie , Then extract it to the specified folder /home/pi/Desktop/tf_pi/env/lib/python3.7/site-packages Next 】
link

cd /home/pi/Desktop/tf_pi/env/bag
tar -zxvf scipy-1.5.4.tar.gz -C /home/pi/Desktop/tf_pi/env/lib/python3.7/site-packages
Then go to this folder to open the installation :【 Various fancy code configurations , It will be installed for about 30 minutes 】
cd /home/pi/Desktop/tf_pi/env/lib/python3.7/site-packages/scipy-1.5.4
python setup.py install

pip3 list Have a look :【 Too six , It's a success 】
Then use this command to install keras:
pip3 install keras\=\=2.2.4
Please note that ; Because in virtualenv Inside , Be sure to avoid sudo pip3 install, Otherwise, it will be installed in the default path ! Find out keras The installation to _ Default The environment , So the call was unsuccessful ,pip list No,


Solution reinstall
<font color=red>pip3 install keras\=\=2.2.4</font>

Remember... After installation reboot Restart for a while .
5. Start testing ;import keras Add in front import os You can ignore the prompt .
because keras It can work with many frameworks , We use tf So there will be backend A hint of
Enter the virtual environment :
cd ~/Desktop/tf_pi
source env/bin/activate
python
import tensorflow as tf
tf.__version__
import keras
print(keras.__version__)

Problems encountered since work ,64 Bit base system installation tensorflow No success , I think the problem is as follows :
①tensorflow And 64 position linux System
②python Language and arm7 And onboard hardware cpu broadcom BCM2711 Problems corresponding to version
③ Various dependencies and arm Hardware correspondence 
边栏推荐
- Binary tree
- Principales différences entre CMS et G1
- 无需剪辑软件,教你简单快速进行剪辑视频
- Quanzhi t7/t507 qt5.12.5 transplantation record
- RuntimeError: Dataset not found or corrupted. You can use download=True to download it
- The performance comparison of Quanzhi T3 (a40i) /t5 (t507) is better than that of the previous generation
- ping: XXX: 未知的名称或服务原因分析
- uniapp引入线上js
- Text preprocessing of natural language
- Quanzhi v3s learning record (11) audio and video Usage Summary
猜你喜欢

Chapter_05 使用Opencv相加(融合)两个图像

全志V3s学习记录(9)buildroot文件系统构建

指数移动加权平均

Banana pie bpi-m2 ultra miniaturized version -com-x40i core board

Codeblocks项目窗口管理

LDAP application: openldap integrated into jumpserver

Exponential moving weighted average

Bladed sequential wind configuration method

Chapter_03 矩阵的掩膜操作

MySQL version 8.0.28 installation and configuration method graphic tutorial
随机推荐
Office software batch startup procedure
Comparison between ZGC and G1 and the meaning of color points
Coredns part 3-access Prometheus monitoring
Main differences between CMS and G1
error: subprocess-exited-with-error(fasttext)
Uniapp introduces online JS
CodeBlocks always repeat the last result
Unity3d various paths & permissions
zgc的Allocate stall原理
二叉 树
性价比最高处理器和国产处理器I.MX6UL/A40I/T3对比
Sudo: GEDIT: command not found
你真的懂熵了吗(含交叉熵)
MySQL 5.7 installation tutorial (full step, nanny level tutorial)
Banana pie bpi-m2 ultra miniaturized version -com-x40i core board
MySQL federated query (multi table query)
Svn account password search
Common ideas of sparksql dealing with data skew
量化交易之MySql篇 - mysql数据库 事件
mysql 8.0.28版本安装配置方法图文教程