關(guān)于我們
書單推薦
新書推薦
|
TensorFlow程序設(shè)計(jì) 讀者對(duì)象:本書適合作為人工智能相關(guān)學(xué)科本科生和研究生的教材,也適合作為機(jī)器學(xué)習(xí)和深度學(xué)習(xí)研究與開發(fā)人員的入門書籍。
本書全面介紹TensorFlow 2.x 框架及其在深度學(xué)習(xí)中的應(yīng)用,內(nèi)容包括TensorFlow 簡介、Python 語 言基礎(chǔ)、環(huán)境搭建與入門、TensorBoard 可視化、多層感知機(jī)實(shí)現(xiàn)、卷積神經(jīng)網(wǎng)絡(luò)實(shí)現(xiàn)、循環(huán)神經(jīng)網(wǎng)絡(luò)實(shí) 現(xiàn)、強(qiáng)化學(xué)習(xí)、遷移學(xué)習(xí)、生成對(duì)抗網(wǎng)絡(luò)和GPU 并行計(jì)算等。
馬斌,副教授,博士,主要承擔(dān)網(wǎng)絡(luò)工程專業(yè)的《網(wǎng)絡(luò)應(yīng)用開發(fā)與系統(tǒng)集成》、《網(wǎng)絡(luò)測(cè)試與評(píng)價(jià)》、《計(jì)算機(jī)網(wǎng)絡(luò)計(jì)算》、《面向?qū)ο蟪绦蛟O(shè)計(jì)》、《物聯(lián)網(wǎng)概論》等本科課程;承擔(dān)《軟件體系結(jié)構(gòu)》、《網(wǎng)絡(luò)編程》、《農(nóng)業(yè)推廣理論與實(shí)踐》等研究生課程。承擔(dān)或參與了國家自然科學(xué)基金青年基金、國家高技術(shù)研究發(fā)展計(jì)劃(863計(jì)劃)、國家自然科學(xué)基金面上基金等項(xiàng)目。
第1 章 TensorFlow 簡介 ·············································································.1
1.1 人工智能的編程框架 ................................................................................................. 1 1.1.1 人工智能的發(fā)展 ............................................................................................. 1 1.1.2 人工智能、機(jī)器學(xué)習(xí)和深度學(xué)習(xí)之間的關(guān)系 ............................................. 2 1.2 TensorFlow 與人工智能 ............................................................................................ 3 1.3 TensorFlow 數(shù)據(jù)模型 ................................................................................................ 4 1.4 TensorFlow 計(jì)算模型和運(yùn)行模型 ............................................................................ 5 1.5 實(shí)驗(yàn):矩陣運(yùn)算 ......................................................................................................... 9 1.5.1 實(shí)驗(yàn)?zāi)康?......................................................................................................... 9 1.5.2 實(shí)驗(yàn)要求 ......................................................................................................... 9 1.5.3 實(shí)驗(yàn)原理 ......................................................................................................... 9 1.5.4 實(shí)驗(yàn)步驟 ....................................................................................................... 10 習(xí)題 .................................................................................................................................... 10 第2 章 Python 語言基礎(chǔ) ············································································.11 2.1 Python 語言 ............................................................................................................... 11 2.1.1 Python 語言的發(fā)展 ....................................................................................... 11 2.1.2 Python 安裝 ................................................................................................... 12 2.2 基礎(chǔ)語法 ................................................................................................................... 13 2.2.1 基礎(chǔ)知識(shí) ....................................................................................................... 13 2.2.2 基本程序編寫 ............................................................................................... 15 2.2.3 條件語句 ....................................................................................................... 16 2.2.4 循環(huán)語句 ....................................................................................................... 17 2.3 數(shù)據(jù)結(jié)構(gòu) ................................................................................................................... 18 2.4 面向?qū)ο筇匦?........................................................................................................... 21 2.4.1 類和對(duì)象 ....................................................................................................... 21 2.4.2 類的定義 ....................................................................................................... 22 2.4.3 根據(jù)類創(chuàng)建對(duì)象 ........................................................................................... 22 2.4.4 構(gòu)造方法與析構(gòu)方法 ................................................................................... 23 2.5 其他高級(jí)特性 ........................................................................................................... 24 2.5.1 函數(shù)高級(jí)特性 ............................................................................................... 24 2.5.2 閉包 ............................................................................................................... 25 2.6 實(shí)驗(yàn):Python 基本語法的實(shí)現(xiàn) ............................................................................... 26 2.6.1 實(shí)驗(yàn)?zāi)康?....................................................................................................... 26 2.6.2 實(shí)驗(yàn)要求 ....................................................................................................... 26 2.6.3 實(shí)驗(yàn)題目 ....................................................................................................... 26 2.6.4 實(shí)驗(yàn)步驟 ....................................................................................................... 27 習(xí)題 .................................................................................................................................... 28 第3 章 環(huán)境搭建與入門 ·············································································.30 3.1 開發(fā)平臺(tái)簡介 ........................................................................................................... 30 3.2 開發(fā)環(huán)境部署 ........................................................................................................... 30 3.2.1 安裝Anaconda .............................................................................................. 30 3.2.2 安裝TensorFlow ........................................................................................... 32 3.2.3 PyCharm 下載與安裝 ................................................................................... 32 3.3 一個(gè)簡單的實(shí)例 ....................................................................................................... 34 習(xí)題 .................................................................................................................................... 36 第4 章 TensorBoard 可視化 ········································································.37 4.1 什么是TensorBoard.................................................................................................. 37 4.2 基本流程與結(jié)構(gòu) ....................................................................................................... 37 4.3 圖表的可視化 ........................................................................................................... 39 4.3.1 計(jì)算圖和會(huì)話 ............................................................................................... 39 4.3.2 可視化過程 ................................................................................................... 40 4.4 監(jiān)控指標(biāo)的可視化 ................................................................................................... 41 4.4.1 Scalar ............................................................................................................. 41 4.4.2 Images ........................................................................................................... 41 4.4.3 Histogram ...................................................................................................... 41 4.4.4 Merge_all....................................................................................................... 42 4.5 學(xué)習(xí)過程的可視化 ................................................................................................... 42 4.5.1 數(shù)據(jù)序列化 ................................................................................................... 43 4.5.2 啟動(dòng)TensorBoard ......................................................................................... 43 4.6 實(shí)驗(yàn):TensorBoard 可視化實(shí)現(xiàn) .............................................................................. 44 4.6.1 實(shí)驗(yàn)?zāi)康?....................................................................................................... 44 4.6.2 實(shí)驗(yàn)要求 ....................................................................................................... 44 4.6.3 實(shí)驗(yàn)原理 ....................................................................................................... 45 4.6.4 實(shí)驗(yàn)步驟 ....................................................................................................... 45 習(xí)題 .................................................................................................................................... 49 第5 章 多層感知機(jī)實(shí)現(xiàn) ·············································································.50 5.1 感知機(jī) ....................................................................................................................... 50 5.1.1 感知機(jī)的定義 ............................................................................................... 50 5.1.2 感知機(jī)的神經(jīng)元模型 ................................................................................... 51 5.1.3 感知機(jī)的學(xué)習(xí)算法 ....................................................................................... 51 5.1.4 感知機(jī)的性質(zhì) ............................................................................................... 52 5.2 多層感知機(jī)與前向傳播 ........................................................................................... 53 5.2.1 多層感知機(jī)基本結(jié)構(gòu) ................................................................................... 53 5.2.2 多層感知機(jī)的特點(diǎn) ....................................................................................... 54 5.3 前向傳播 ................................................................................................................... 55 5.3.1 前向傳播的計(jì)算過程 ................................................................................... 55 5.3.2 前向傳播算法 ............................................................................................... 57 5.4 梯度下降 ................................................................................................................... 57 5.4.1 梯度 ............................................................................................................... 57 5.4.2 梯度下降的直觀解釋 ................................................................................... 58 5.4.3 梯度下降法的相關(guān)概念 ............................................................................... 58 5.4.4 梯度下降法的數(shù)學(xué)描述 ............................................................................... 59 5.4.5 梯度下降法的算法調(diào)優(yōu) ............................................................................... 60 5.4.6 常見的梯度下降法 ....................................................................................... 60 5.5 反向傳播 ................................................................................................................... 61 5.5.1 反向傳播算法要解決的問題 ....................................................................... 61 5.5.2 反向傳播算法的基本思路 ........................................................................... 61 5.5.3 反向傳播算法的流程 ................................................................................... 63 5.6 數(shù)據(jù)集 ....................................................................................................................... 64 5.6.1 訓(xùn)練集、測(cè)試集和驗(yàn)證集 ........................................................................... 64 5.6.2 MNIST 數(shù)據(jù)集 ............................................................................................. 64 5.7 多層感知機(jī)的實(shí)現(xiàn) ................................................................................................... 66 5.7.1 NumPy 多層感知機(jī)的實(shí)現(xiàn) .......................................................................... 66 5.7.2 TensorFlow 多層感知機(jī)的實(shí)現(xiàn) ................................................................... 69 5.8 實(shí)驗(yàn):基于Keras 多層感知機(jī)的MNIST 手寫數(shù)字識(shí)別 ...................................... 72 5.8.1 Keras 簡介 ..................................................................................................... 72 5.8.2 實(shí)驗(yàn)?zāi)康?....................................................................................................... 73 5.8.3 實(shí)驗(yàn)要求 ....................................................................................................... 73 5.8.4 實(shí)驗(yàn)步驟 ....................................................................................................... 73 習(xí)題 .................................................................................................................................... 77 第6 章 卷積神經(jīng)網(wǎng)絡(luò)實(shí)現(xiàn) ··········································································.78 6.1 CNN 基本原理 .......................................................................................................... 78 6.2 CNN 的卷積操作 ...................................................................................................... 80 6.3 CNN 的池化操作 ...................................................................................................... 82 6.4 使用簡單的CNN 實(shí)現(xiàn)手寫字符識(shí)別 ..................................................................... 84 6.5 AlexNet ..................................................................................................................... 85 6.6 實(shí)驗(yàn):基于VGG16 模型的圖像分類實(shí)現(xiàn) ............................................................. 87 6.6.1 實(shí)驗(yàn)?zāi)康?....................................................................................................... 87 6.6.2 實(shí)驗(yàn)要求 ....................................................................................................... 87 6.6.3 實(shí)驗(yàn)原理 ....................................................................................................... 88 6.6.4 實(shí)驗(yàn)步驟 ....................................................................................................... 88 習(xí)題 .................................................................................................................................... 93 第7 章 循環(huán)神經(jīng)網(wǎng)絡(luò)實(shí)現(xiàn) ··········································································.94 7.1 RNN 簡介 .................................................................................................................. 94 7.1.1 為什么使用RNN.......................................................................................... 94 7.1.2 RNN 的網(wǎng)絡(luò)結(jié)構(gòu)及原理 .............................................................................. 96 7.1.3 RNN 的實(shí)現(xiàn) ................................................................................................. 99 7.2 長短時(shí)記憶網(wǎng)絡(luò) ..................................................................................................... 100 7.2.1 長期依賴問題 ............................................................................................. 100 7.2.2 長短時(shí)記憶網(wǎng)絡(luò) ......................................................................................... 101 7.2.3 LSTM 的實(shí)現(xiàn) ............................................................................................. 105 7.3 雙向RNN ................................................................................................................ 106 7.3.1 雙向RNN 的結(jié)構(gòu)及原理 ........................................................................... 106 7.3.2 雙向RNN 的實(shí)現(xiàn)....................................................................................... 107 7.4 深層RNN ................................................................................................................ 108 7.5 實(shí)驗(yàn):基于LSTM 的股票預(yù)測(cè) ............................................................................. 110 7.5.1 實(shí)驗(yàn)?zāi)康?..................................................................................................... 110 7.5.2 實(shí)驗(yàn)要求 ..................................................................................................... 110 7.5.3 實(shí)驗(yàn)原理 ..................................................................................................... 111 7.5.4 實(shí)驗(yàn)步驟 ..................................................................................................... 111 習(xí)題 .................................................................................................................................. 114 第8 章 強(qiáng)化學(xué)習(xí) ····················································································.115 8.1 強(qiáng)化學(xué)習(xí)原理 ......................................................................................................... 115 8.2 馬爾可夫決策過程實(shí)現(xiàn) ......................................................................................... 117 8.2.1 馬爾可夫決策過程 ..................................................................................... 117 8.2.2 馬爾可夫決策過程的形式化 ..................................................................... 118 8.3 基于價(jià)值的強(qiáng)化學(xué)習(xí)方法 ..................................................................................... 120 8.3.1 基于價(jià)值的方法中的策略優(yōu)化 ................................................................. 120 8.3.2 基于價(jià)值的方法中的策略評(píng)估 ................................................................. 120 8.3.3 Q-Learning .................................................................................................. 122 8.4 Gym 的簡單使用 .................................................................................................... 123 8.5 實(shí)驗(yàn):基于強(qiáng)化學(xué)習(xí)的小車爬山游戲 ................................................................. 125 8.5.1 實(shí)驗(yàn)?zāi)康?..................................................................................................... 125 8.5.2 實(shí)驗(yàn)要求 ..................................................................................................... 125 8.5.3 實(shí)驗(yàn)原理 ..................................................................................................... 125 8.5.4 實(shí)驗(yàn)步驟 ..................................................................................................... 127 習(xí)題 .................................................................................................................................. 130 第9 章 遷移學(xué)習(xí) ····················································································.131 9.1 遷移學(xué)習(xí)原理 ......................................................................................................... 131 9.1.1 什么是遷移學(xué)習(xí) ......................................................................................... 131 9.1.2 遷移學(xué)習(xí)的基本概念 ................................................................................. 131 9.1.3 遷移學(xué)習(xí)的基本方法 ................................................................................. 133 9.2 基于模型的遷移學(xué)習(xí)方法實(shí)現(xiàn) ............................................................................. 134 9.2.1 導(dǎo)入已有的預(yù)訓(xùn)練模型 ............................................................................. 134 9.2.2 模型的復(fù)用 ................................................................................................. 134 9.2.3 基于新模型的預(yù)測(cè) ..................................................................................... 135 9.3 基于VGG-19 的遷移學(xué)習(xí)實(shí)現(xiàn) ............................................................................. 135 9.3.1 VGG-19 的原理 .......................................................................................... 135 9.3.2 基于VGG-19 的遷移學(xué)習(xí)的原理及實(shí)現(xiàn) ................................................. 136 9.4 實(shí)驗(yàn):基于Inception V3 的遷移學(xué)習(xí) .................................................................. 138 9.4.1 實(shí)驗(yàn)?zāi)康?..................................................................................................... 138 9.4.2 實(shí)驗(yàn)要求 ..................................................................................................... 138 9.4.3 實(shí)驗(yàn)原理 ..................................................................................................... 139 9.4.4 實(shí)驗(yàn)步驟 ..................................................................................................... 140 習(xí)題 .................................................................................................................................. 143 第10 章 生成對(duì)抗網(wǎng)絡(luò) ·············································································.144 10.1 GAN 概述 ............................................................................................................. 144 10.2 GAN 的目標(biāo)函數(shù) ................................................................................................. 144 10.3 GAN 的實(shí)現(xiàn) ......................................................................................................... 145 10.4 深度卷積生成對(duì)抗網(wǎng)絡(luò) ....................................................................................... 149 10.4.1 DCGAN 結(jié)構(gòu)圖 ........................................................................................ 150 10.4.2 DCGAN 的實(shí)現(xiàn) ........................................................................................ 150 10.5 GAN 的衍生模型 ................................................................................................. 153 10.5.1 基于網(wǎng)絡(luò)結(jié)構(gòu)的衍生模型 ....................................................................... 154 10.5.2 基于優(yōu)化方法的衍生模型 ....................................................................... 155 習(xí)題 .................................................................................................................................. 156 第11 章 GPU 并行計(jì)算 ············································································.157 11.1 并行計(jì)算技術(shù) ....................................................................................................... 157 11.1.1 單機(jī)并行計(jì)算 ........................................................................................... 157 11.1.2 分布式并行計(jì)算 ....................................................................................... 158 11.1.3 GPU 并行計(jì)算技術(shù) .................................................................................. 159 11.1.4 TensorFlow 與GPU .................................................................................. 160 11.2 TensorFlow 加速方法 ........................................................................................... 163 11.3 單GPU 并行加速的實(shí)現(xiàn) ..................................................................................... 170 11.4 多GPU 并行加速的實(shí)現(xiàn) ..................................................................................... 173 11.5 實(shí)驗(yàn):基于GPU 的矩陣乘法 ............................................................................. 175 11.5.1 安裝GPU 版本的TensorFlow ................................................................. 175 11.5.2 一個(gè)GPU 程序 ......................................................................................... 176 11.5.3 使用GPU 完成矩陣乘法 ......................................................................... 176 習(xí)題 .................................................................................................................................. 177
你還可能感興趣
我要評(píng)論
|