关于我们
书单推荐
新书推荐
|
TensorFlow程序设计 读者对象:本书适合作为人工智能相关学科本科生和研究生的教材,也适合作为机器学习和深度学习研究与开发人员的入门书籍。
本书全面介绍TensorFlow 2.x 框架及其在深度学习中的应用,内容包括TensorFlow 简介、Python 语 言基础、环境搭建与入门、TensorBoard 可视化、多层感知机实现、卷积神经网络实现、循环神经网络实 现、强化学习、迁移学习、生成对抗网络和GPU 并行计算等。
马斌,副教授,博士,主要承担网络工程专业的《网络应用开发与系统集成》、《网络测试与评价》、《计算机网络计算》、《面向对象程序设计》、《物联网概论》等本科课程;承担《软件体系结构》、《网络编程》、《农业推广理论与实践》等研究生课程。承担或参与了国家自然科学基金青年基金、国家高技术研究发展计划(863计划)、国家自然科学基金面上基金等项目。
第1 章 TensorFlow 简介 ·············································································.1
1.1 人工智能的编程框架 ................................................................................................. 1 1.1.1 人工智能的发展 ............................................................................................. 1 1.1.2 人工智能、机器学习和深度学习之间的关系 ............................................. 2 1.2 TensorFlow 与人工智能 ............................................................................................ 3 1.3 TensorFlow 数据模型 ................................................................................................ 4 1.4 TensorFlow 计算模型和运行模型 ............................................................................ 5 1.5 实验:矩阵运算 ......................................................................................................... 9 1.5.1 实验目的 ......................................................................................................... 9 1.5.2 实验要求 ......................................................................................................... 9 1.5.3 实验原理 ......................................................................................................... 9 1.5.4 实验步骤 ....................................................................................................... 10 习题 .................................................................................................................................... 10 第2 章 Python 语言基础 ············································································.11 2.1 Python 语言 ............................................................................................................... 11 2.1.1 Python 语言的发展 ....................................................................................... 11 2.1.2 Python 安装 ................................................................................................... 12 2.2 基础语法 ................................................................................................................... 13 2.2.1 基础知识 ....................................................................................................... 13 2.2.2 基本程序编写 ............................................................................................... 15 2.2.3 条件语句 ....................................................................................................... 16 2.2.4 循环语句 ....................................................................................................... 17 2.3 数据结构 ................................................................................................................... 18 2.4 面向对象特性 ........................................................................................................... 21 2.4.1 类和对象 ....................................................................................................... 21 2.4.2 类的定义 ....................................................................................................... 22 2.4.3 根据类创建对象 ........................................................................................... 22 2.4.4 构造方法与析构方法 ................................................................................... 23 2.5 其他高级特性 ........................................................................................................... 24 2.5.1 函数高级特性 ............................................................................................... 24 2.5.2 闭包 ............................................................................................................... 25 2.6 实验:Python 基本语法的实现 ............................................................................... 26 2.6.1 实验目的 ....................................................................................................... 26 2.6.2 实验要求 ....................................................................................................... 26 2.6.3 实验题目 ....................................................................................................... 26 2.6.4 实验步骤 ....................................................................................................... 27 习题 .................................................................................................................................... 28 第3 章 环境搭建与入门 ·············································································.30 3.1 开发平台简介 ........................................................................................................... 30 3.2 开发环境部署 ........................................................................................................... 30 3.2.1 安装Anaconda .............................................................................................. 30 3.2.2 安装TensorFlow ........................................................................................... 32 3.2.3 PyCharm 下载与安装 ................................................................................... 32 3.3 一个简单的实例 ....................................................................................................... 34 习题 .................................................................................................................................... 36 第4 章 TensorBoard 可视化 ········································································.37 4.1 什么是TensorBoard.................................................................................................. 37 4.2 基本流程与结构 ....................................................................................................... 37 4.3 图表的可视化 ........................................................................................................... 39 4.3.1 计算图和会话 ............................................................................................... 39 4.3.2 可视化过程 ................................................................................................... 40 4.4 监控指标的可视化 ................................................................................................... 41 4.4.1 Scalar ............................................................................................................. 41 4.4.2 Images ........................................................................................................... 41 4.4.3 Histogram ...................................................................................................... 41 4.4.4 Merge_all....................................................................................................... 42 4.5 学习过程的可视化 ................................................................................................... 42 4.5.1 数据序列化 ................................................................................................... 43 4.5.2 启动TensorBoard ......................................................................................... 43 4.6 实验:TensorBoard 可视化实现 .............................................................................. 44 4.6.1 实验目的 ....................................................................................................... 44 4.6.2 实验要求 ....................................................................................................... 44 4.6.3 实验原理 ....................................................................................................... 45 4.6.4 实验步骤 ....................................................................................................... 45 习题 .................................................................................................................................... 49 第5 章 多层感知机实现 ·············································································.50 5.1 感知机 ....................................................................................................................... 50 5.1.1 感知机的定义 ............................................................................................... 50 5.1.2 感知机的神经元模型 ................................................................................... 51 5.1.3 感知机的学习算法 ....................................................................................... 51 5.1.4 感知机的性质 ............................................................................................... 52 5.2 多层感知机与前向传播 ........................................................................................... 53 5.2.1 多层感知机基本结构 ................................................................................... 53 5.2.2 多层感知机的特点 ....................................................................................... 54 5.3 前向传播 ................................................................................................................... 55 5.3.1 前向传播的计算过程 ................................................................................... 55 5.3.2 前向传播算法 ............................................................................................... 57 5.4 梯度下降 ................................................................................................................... 57 5.4.1 梯度 ............................................................................................................... 57 5.4.2 梯度下降的直观解释 ................................................................................... 58 5.4.3 梯度下降法的相关概念 ............................................................................... 58 5.4.4 梯度下降法的数学描述 ............................................................................... 59 5.4.5 梯度下降法的算法调优 ............................................................................... 60 5.4.6 常见的梯度下降法 ....................................................................................... 60 5.5 反向传播 ................................................................................................................... 61 5.5.1 反向传播算法要解决的问题 ....................................................................... 61 5.5.2 反向传播算法的基本思路 ........................................................................... 61 5.5.3 反向传播算法的流程 ................................................................................... 63 5.6 数据集 ....................................................................................................................... 64 5.6.1 训练集、测试集和验证集 ........................................................................... 64 5.6.2 MNIST 数据集 ............................................................................................. 64 5.7 多层感知机的实现 ................................................................................................... 66 5.7.1 NumPy 多层感知机的实现 .......................................................................... 66 5.7.2 TensorFlow 多层感知机的实现 ................................................................... 69 5.8 实验:基于Keras 多层感知机的MNIST 手写数字识别 ...................................... 72 5.8.1 Keras 简介 ..................................................................................................... 72 5.8.2 实验目的 ....................................................................................................... 73 5.8.3 实验要求 ....................................................................................................... 73 5.8.4 实验步骤 ....................................................................................................... 73 习题 .................................................................................................................................... 77 第6 章 卷积神经网络实现 ··········································································.78 6.1 CNN 基本原理 .......................................................................................................... 78 6.2 CNN 的卷积操作 ...................................................................................................... 80 6.3 CNN 的池化操作 ...................................................................................................... 82 6.4 使用简单的CNN 实现手写字符识别 ..................................................................... 84 6.5 AlexNet ..................................................................................................................... 85 6.6 实验:基于VGG16 模型的图像分类实现 ............................................................. 87 6.6.1 实验目的 ....................................................................................................... 87 6.6.2 实验要求 ....................................................................................................... 87 6.6.3 实验原理 ....................................................................................................... 88 6.6.4 实验步骤 ....................................................................................................... 88 习题 .................................................................................................................................... 93 第7 章 循环神经网络实现 ··········································································.94 7.1 RNN 简介 .................................................................................................................. 94 7.1.1 为什么使用RNN.......................................................................................... 94 7.1.2 RNN 的网络结构及原理 .............................................................................. 96 7.1.3 RNN 的实现 ................................................................................................. 99 7.2 长短时记忆网络 ..................................................................................................... 100 7.2.1 长期依赖问题 ............................................................................................. 100 7.2.2 长短时记忆网络 ......................................................................................... 101 7.2.3 LSTM 的实现 ............................................................................................. 105 7.3 双向RNN ................................................................................................................ 106 7.3.1 双向RNN 的结构及原理 ........................................................................... 106 7.3.2 双向RNN 的实现....................................................................................... 107 7.4 深层RNN ................................................................................................................ 108 7.5 实验:基于LSTM 的股票预测 ............................................................................. 110 7.5.1 实验目的 ..................................................................................................... 110 7.5.2 实验要求 ..................................................................................................... 110 7.5.3 实验原理 ..................................................................................................... 111 7.5.4 实验步骤 ..................................................................................................... 111 习题 .................................................................................................................................. 114 第8 章 强化学习 ····················································································.115 8.1 强化学习原理 ......................................................................................................... 115 8.2 马尔可夫决策过程实现 ......................................................................................... 117 8.2.1 马尔可夫决策过程 ..................................................................................... 117 8.2.2 马尔可夫决策过程的形式化 ..................................................................... 118 8.3 基于价值的强化学习方法 ..................................................................................... 120 8.3.1 基于价值的方法中的策略优化 ................................................................. 120 8.3.2 基于价值的方法中的策略评估 ................................................................. 120 8.3.3 Q-Learning .................................................................................................. 122 8.4 Gym 的简单使用 .................................................................................................... 123 8.5 实验:基于强化学习的小车爬山游戏 ................................................................. 125 8.5.1 实验目的 ..................................................................................................... 125 8.5.2 实验要求 ..................................................................................................... 125 8.5.3 实验原理 ..................................................................................................... 125 8.5.4 实验步骤 ..................................................................................................... 127 习题 .................................................................................................................................. 130 第9 章 迁移学习 ····················································································.131 9.1 迁移学习原理 ......................................................................................................... 131 9.1.1 什么是迁移学习 ......................................................................................... 131 9.1.2 迁移学习的基本概念 ................................................................................. 131 9.1.3 迁移学习的基本方法 ................................................................................. 133 9.2 基于模型的迁移学习方法实现 ............................................................................. 134 9.2.1 导入已有的预训练模型 ............................................................................. 134 9.2.2 模型的复用 ................................................................................................. 134 9.2.3 基于新模型的预测 ..................................................................................... 135 9.3 基于VGG-19 的迁移学习实现 ............................................................................. 135 9.3.1 VGG-19 的原理 .......................................................................................... 135 9.3.2 基于VGG-19 的迁移学习的原理及实现 ................................................. 136 9.4 实验:基于Inception V3 的迁移学习 .................................................................. 138 9.4.1 实验目的 ..................................................................................................... 138 9.4.2 实验要求 ..................................................................................................... 138 9.4.3 实验原理 ..................................................................................................... 139 9.4.4 实验步骤 ..................................................................................................... 140 习题 .................................................................................................................................. 143 第10 章 生成对抗网络 ·············································································.144 10.1 GAN 概述 ............................................................................................................. 144 10.2 GAN 的目标函数 ................................................................................................. 144 10.3 GAN 的实现 ......................................................................................................... 145 10.4 深度卷积生成对抗网络 ....................................................................................... 149 10.4.1 DCGAN 结构图 ........................................................................................ 150 10.4.2 DCGAN 的实现 ........................................................................................ 150 10.5 GAN 的衍生模型 ................................................................................................. 153 10.5.1 基于网络结构的衍生模型 ....................................................................... 154 10.5.2 基于优化方法的衍生模型 ....................................................................... 155 习题 .................................................................................................................................. 156 第11 章 GPU 并行计算 ············································································.157 11.1 并行计算技术 ....................................................................................................... 157 11.1.1 单机并行计算 ........................................................................................... 157 11.1.2 分布式并行计算 ....................................................................................... 158 11.1.3 GPU 并行计算技术 .................................................................................. 159 11.1.4 TensorFlow 与GPU .................................................................................. 160 11.2 TensorFlow 加速方法 ........................................................................................... 163 11.3 单GPU 并行加速的实现 ..................................................................................... 170 11.4 多GPU 并行加速的实现 ..................................................................................... 173 11.5 实验:基于GPU 的矩阵乘法 ............................................................................. 175 11.5.1 安装GPU 版本的TensorFlow ................................................................. 175 11.5.2 一个GPU 程序 ......................................................................................... 176 11.5.3 使用GPU 完成矩阵乘法 ......................................................................... 176 习题 .................................................................................................................................. 177
你还可能感兴趣
我要评论
|