樹莓派4與人工智能實戰項目
李偉斌
- 出版商: 清華大學
- 出版日期: 2022-06-01
- 售價: $474
- 貴賓價: 9.5 折 $450
- 語言: 簡體中文
- ISBN: 7302603251
- ISBN-13: 9787302603252
-
相關分類:
Raspberry Pi
立即出貨 (庫存 < 3)
買這商品的人也買了...
-
$580$522 -
$275樹莓派就這麼玩(附光盤配視頻教程)
-
$458直擊招聘 : 程序員面試筆試數據結構深度解析
-
$403深入 RabbitMQ
-
$450$383 -
$594$564 -
$658Hyperledger Fabric技術內幕:架構設計與實現原理
-
$352Hyperledger Fabric 菜鳥進階攻略
-
$454HyperledgerFabric 核心技術
-
$305Spring Boot 微服務實戰:使用 RabbitMQ、Eureka、Ribbon、Zuul 和 Cucumber 開發 RESTful 服務
-
$474$450 -
$301樹莓派趣學實戰 100例 — 網絡應用 + Python 編程 + 傳感器 + 服務器搭建
-
$254超級帳本 HyperLedger Fabric 區塊鏈開發實戰
-
$1,080$853 -
$790$751 -
$719$683 -
$560$476 -
$1,200$1,020 -
$654$621 -
$658$619 -
$620$527 -
$893$848 -
$1,200$1,020 -
$630$536 -
$650$514
相關主題
商品描述
目錄大綱
第1章 樹莓派簡介 ······················································································1
引言·················································1
1.1 樹莓派是什麽? ···························1
1.2 樹莓派周邊配件 ··························11
1.3 樹莓派能做什麽? ·······················12
第2章 樹莓派入門基礎知識 ·····································································21
2.1 系統選型 ···································21
2.2 新系統下載及燒錄 ·······················23
2.3 恢復卡製作的操作步驟 ·················24
2.3.1 方法1················································24
2.3.2 方法2················································24
2.4 燒錄系統 ···································24
2.5 初始化系統 ································29
第3章 樹莓派GPIO的使用 ·······································································46
3.1 GPIO的概念及相關庫的使用方法 ···46
3.2 樹莓派上使用wiringPi庫 ···············47
3.3 如何利用wiringPi優雅地點亮一個
LED燈 ······································51
3.3.1 硬件材料準備··································51
3.3.2 接線方式··········································51
3.3.3 編寫代碼測試··································52
3.4 玩轉流水燈和游俠燈 ····················58
3.4.1 流水燈·············································58
3.4.2 游俠燈··············································59
第4章 樹莓派中I2C功能的使用 ································································61
4.1 I2C的概念 ··································61
4.2 I2C實戰小項目 ····························62
4.2.1 接線方式··········································62
4.2.2 啟用I2C配置 ····································63
目 錄
IV 樹莓派4 與人工智能實戰項目
4.2.3 檢測Slave設備狀態 ·························65
4.2.4 查詢寄存器表並簡單測試··············65
4.2.5 編寫C語言測試代碼 ·······················66
4.2.6 編寫Python代碼進行測試 ··············68
4.2.7 關於Python中的I2C函數 ·················69
4.3 使用I2C協議的其他應用 ················70
4.3.1 點亮LCD1602液晶屏顯示樹莓派
的IP地址 ··········································70
4.3.2 利用OLED展示樹莓派磁盤狀態
信息··················································83
第5章 樹莓派SPI介紹及應用實例 ···························································· 88
5.1 SPI協議簡介 ······························88
5.1.1 SPI協議概述 ····································88
5.1.2 SPI的優缺點 ····································88
5.1.3 採用主-從模式(Master-Slave)的
控制方式··········································89
5.2 樹莓派SPI概述 ···························89
5.2.1 引腳和GPIO映射 ····························89
5.2.2 關於SPI的速度 ································90
5.3 樹莓派上啟用SPI功能 ··················90
5.3.1 通過raspi-config工具 ······················91
5.3.2 通過編輯/boot/config.txt文件 ·········93
5.3.3 通過圖形界面··································93
5.4 樹莓派SPI應用實例 ·····················95
5.4.1 檢查SPI設備狀態 ····························95
5.4.2 準備SPI外設並接入樹莓派 ············95
5.4.3 安裝Python庫文件 ··························96
5.4.4 編寫定製的測試代碼並進行測試 ····97
5.5 讓樹莓派變身為一個環境檢測站 ··· 101
5.5.1 BME280模塊介紹 ·························102
5.5.2 接線方式········································103
5.5.3 編寫代碼獲取數據························103
5.5.4 總結················································112
第6章 樹莓派UART串口介紹及應用實例 ··············································· 113
6.1 UART簡介 ······························· 113
6.2 樹莓派串口說明 ························ 114
6.3 在樹莓派上配置啟用UART ·········· 115
6.4 在樹莓派上進行串口通信 ············ 120
6.4.1 使用Python 語言實現串口
通信 ······························· 120
6.4.2 通過C語言實現串口通信 ·············123
6.4.3 拓展實例········································124
6.5 關於樹莓派串口別名及切換
硬件串口 ································· 126
6.5.1 串口別名········································126
6.5.2 更換串口埠································127
6.6 總結 ······································· 128
第7章 樹莓派PWM介紹及應用實例 ·······················································129
引言·············································· 129 7.1 PWM控制原理 ·························· 129
目錄 V
7.2 樹莓派PWM通道信息 ················· 130
7.3 wiringPi庫的PWM接口介紹 ········· 131
7.3.1 硬件PWM ······································131
7.3.2 軟件PWM ····································132
7.3.3 軟件PWM註意事項 ······················133
7.4 PWM應用項目實戰 ···················· 134
7.4.1 呼吸燈效果····································134
7.4.2 舵機控制········································138
第8章 樹莓派開源網絡應用實例 ·····························································144
引言·············································· 144
8.1 樹莓派搭建RTMP流媒體服務器 ···· 145
8.1.1 安裝Nginx及模塊··························145
8.1.2 啟用RTMP ·····································148
8.1.3 客戶端連接測試····························151
8.2 樹莓派搭建Samba文件服務器 ······· 156
8.2.1 什麽是Samba文件服務器 ·············156
8.2.2 需要準備的設備····························156
8.2.3 安裝配置Samba服務器 ·················157
8.3 樹莓派搭建NFS文件服務器 ········· 163
8.3.1 什麽是NFS文件服務器 ················163
8.3.2 需要的設備····································163
8.3.3 安裝配置NFS文件系統 ················163
8.4 樹莓派搭建日誌服務器 ··············· 169
8.4.1 什麽是日誌服務器························169
8.4.2 需要的硬件····································170
8.4.3 安裝rsyslog服務 ····························170
8.4.4 配置rsyslog作為服務器 ················170
8.4.5 創建新模板····································171
8.4.6 重啟服務並測試····························172
8.5 樹莓派搭建MariaDB數據庫
服務器 ···································· 175
8.5.1 什麽是MariaDB ····························175
8.5.2 MariaDB 和 MySQL 的區別 ········175
8.5.3 安裝MariaDB ································176
8.5.4 配置MariaDB ································176
8.5.5 創建一個數據庫····························178
8.5.6 添加一張表····································179
8.5.7 插入幾條記錄································180
8.6 樹莓派搭建PostgreSQL數據
庫服務器 ································· 182
8.6.1 什麽是PostgreSQL數據庫 ············182
8.6.2 安裝PostgreSQL ····························182
8.6.3 配置PostgreSQL ····························182
8.6.4 創建數據庫····································183
8.6.5 常見控制台命令····························184
8.6.6 基本SQL語句 ·······························185
8.7 樹莓派搭建Mosquitto MQTT
服務器 ··································· 186
8.7.1 什麽是MQTT服務器 ····················186
8.7.2 安裝Mosquitto 服務器 ··················187
8.7.3 檢測服務器狀態····························187
8.7.4 在樹莓派上測試Mosquitto代理 ···187
8.7.5 多主機測試····································189
8.7.6 嘗試使用Python的paho-mqtt庫 ····190
8.8 樹莓派搭建DHCP服務器 ············· 193
8.8.1 什麽是DHCP服務器 ·····················193
8.8.2 測試環境········································193
8.8.3 配置1號主機DHCP服務 ···············194
8.8.4 修改DHCP服務的配置 ·················194
VI 樹莓派4 與人工智能實戰項目
8.8.5 重啟服務以生效配置····················195
8.8.6 開啟路由轉發································195
8.8.7 配置IPtables實現流量路由 ···········196
8.8.8 註意事項········································196
8.9 總結 ······································· 197
第9章 樹莓派上利用TensorFlow實現對象檢測 ······································198
引言·············································· 198
9.1 軟硬件環境介紹 ························ 198
9.1.1 硬件準備········································198
9.1.2 軟件準備········································199
9.2 操作步驟 ································· 199
9.2.1 更新系統及軟件倉庫 ···················199
9.2.2 創建TensorFlow的工作目錄 ·······199
9.2.3 安裝TensorFlow的Python庫和部分
依賴················································200
9.2.4 安裝OpenCV視覺框架 ·················200
9.2.5 編譯安裝Protobuf組件··················201
9.2.6 重啟系統········································203
9.2.7 重新登錄系統並設置TensorFlow
目錄結構 ·······································203
9.2.8 下載TensorFlow模型 ····················204
9.2.9 修改用戶初始化配置文件············204
9.2.10 利用protoc編譯Protocol Buffer
文件 ·············································204
9.2.11 下載ssdlite_mobilenet_v2_coco
模型··············································205
9.3 對象檢測測試 ··························· 205
9.3.1 在樹莓派上啟用攝像頭················205
9.3.2 下載檢測腳本································205
9.3.3 接入攝像頭····································206
9.3.4 執行腳本並進行檢測····················206
9.4 總結 ······································· 208
第10章 樹莓派掃描儀—樹莓派+OpenCV ···········································209
引言·············································· 209
10.1 原理 ····································· 209
10.2 硬件準備 ······························· 210
10.3 軟件準備 ······························· 211
10.3.1 軟件包版本信息··························211
10.3.2 查看軟件版本的方法··················211
10.4 配置環境 ······························· 212
10.4.1 檢查網絡狀態······························212
10.4.2 更新軟件倉庫並安裝軟件··········212
10.4.3 創建並激活虛擬環境 ··················213
10.4.4 啟用攝像頭··································213
10.5 代碼調試 ······························· 215
10.6 應用拓展 ······························· 219
10.7 總結 ····································· 221
第11章 AI換鼻子—樹莓派+OpenCV ··················································222
引言·············································· 222 11.1 AI換鼻子的原理 ······················ 223
目錄 VII
11.2 硬件需求 ······························· 223
11.3 軟件需求 ······························· 223
11.3.1 Raspbian操作系統 ·······················223
11.3.2 Python3 環境 ·······························224
11.3.3 virtualenv環境 ·····························225
11.3.4 dlib庫 ··········································226
11.3.5 shape_predictor工具和get_frontal_
face_detector函數 ························226
11.3.6 預測模型庫下載 ·························228
11.4 操作步驟 ······························· 228
11.4.1 燒錄鏡像,啟動並完成初始化
配置··············································228
11.4.2 啟動樹莓派··································232
11.4.3 接入攝像頭·································236
11.4.4 系統初始化環境調試··················237
11.4.5 樹莓派攝像頭測試······················239
11.4.6 編寫代碼······································239
11.5 開挖腦洞,發散思維 ················ 262
11.6 總結 ····································· 262
第12章 樹莓派通過U盤啟動系統 ····························································263
引言·············································· 263
12.1 硬件需求 ······························· 263
12.2 前期準備 ······························· 264
12.3 更新升級系統 ························· 264
12.4 更新bootloader ························ 264
12.5 檢查啟動選項 ························· 265
12.6 無卡啟動測試 ························· 268
12.7 製作USB啟動盤 ······················ 268