从机器学习到无人驾驶

从机器学习到无人驾驶"

作者:宋哲贤
ISBN:9787302552154
定价:¥99
字数:千字
页数:
出版时间:2020.05.01
开本:
版次:1-1
装帧:
出版社:清华大学出版社
简介

本书以机器学习为出发点,使用简易的代码讲解机器学习的核心算法(深度神经网络和强化学习),在算法学习的基础上使用增量方法开发包含定位、预测、路径规划和业务控制等一系列自动驾驶模块。本书代码实例涉及自动驾驶的普遍业务方法,可使读者理解自动驾驶背后的设计思想和原理,快速入门自动驾驶的算法和开发流程。

本书示例代码丰富,涵盖实际开发中所有的重要知识点,适合无人驾驶从业者、想要学习机器学习和无人驾驶的开发人员阅读,也可用作培训机构和高校相关专业的教学参考书。

前言

a前  言

机动车是灵活性高、业务环境复杂的交通工具,一直和我们的生活、工作息息相关。近年来,结合感知、融合、决策、控制的自动驾驶技术无疑是最有前景的研发领域之一。在《中国制造2025》中,已经将智能车联网提升到国家战略高度,车作为智能化终端的概念逐渐浮出水面,并在我们的心中逐渐加强。近几年,各项国家地方政策层出不穷,甚至开放了包括北京、上海部分道路在内的一部分路段进行路测。在世界范围内,围绕自动驾驶产生了多家发展迅速的独角兽企业,这些企业有的专注地图的高精化,有的设计智能化边缘计算硬件,有的则着眼于智能驾驶算法系统。智能驾驶和交通安全息息相关,虽然目前测试的结果都是很惊人的,但是大多数结果都是基于特定路段和特定环境的。在直观的理解中,自动驾驶包含车辆与环境的交互过程。这里面涉及众多环节,比如车辆定位、路径规划、状态感知、车辆控制等。如此复杂的流程必须依靠包括深度学习、强化学习等在内的机器学习技术进行支撑,机器通过大量离线和在线数据的采集与特征提取,在一定算法的基础上,模型自主地完成优化和学习,从而最终得出一个具有统计学意义的结果。这个统计学结果的得出其实是值得探讨的。由于数据量不足及模型本身的种种限制,自动驾驶还没有实现100%的全路段、全时况的无人驾驶。

汽车行业的智能化技术不同于普通的Web技术,具有很强的边缘计算结合性,需要从业人员了解车辆本身的包括运动、机械等方面的基础知识,更需要了解不同传感器的数据微观特征,通过结合近年来发展迅猛的机器学习算法(深度神经网络和强化学习)开发包含定位、预测、路径规划和业务控制等一系列自动驾驶模块,通过驾驶测试来进一步完善系统能力。想要进入此领域的初级开发人员往往因为系统繁杂而不能很快掌握开发技术的核心。本书涵盖机器学习的基本概念、神经网络算法和强化学习算法,在学习算法的基础上通过增量方式开发进行无人驾驶各个功能模块的开发学习。

本书致力于通过生动的实例讲解机器学习的核心算法,代码实例涉及自动驾驶的普遍业务方法,通过具体代码实例对自动驾驶背后的设计思想和原理进行详细分析,力图使读者通过实际操作快速入门和理解自动驾驶的算法和开发流程。

宋哲贤

2020年1月 

foreword I

by Tsinghua

This book is one of the outcomes of English Program 

of Master in Architecture (EPMA) in Tsinghua 

School of Architecture. The EPMA of Tsinghua 

University’s School of Architecture was aimed 

to create a new platform for teaching master 

courses of architecture for international students. 

We intended to enlarge the reach of our school’s 

teaching philosophy by integrating a critical understanding 

of regional conditions with a global 

and multi-disciplinary network, and to have this 

teaching environment be engaged with the international 

dialogue.Since the establishment of the 

program in 2008, we have successfully attracted 

91 international students from more than 30 

countries in all five continents in the world.

Within our international program, we combine 

the critical academic atmosphere with real-world 

issues that arise from the current process of 

China’s rapid urbanization. Students are encouraged 

to be critical, have be able to think reflexively 

in analyzing the real situation, and to create from 

a specific cultural context. The program includes 

4 theory courses with 4 design studios. The first 

theme for theory course and design studio is local, 

with the theory course of Chinese local archicteture 

and the design studio of Architecture of 

space sprite. The second theme is contemporary, 

with the theory course of world contemporary architectural 

design trend and design studio of new 

design method including parametric design. The 

third theme is urban, with theory course of development 

of chinese cities and the urban design 

studio. The fourth theme is technology, with the 

theory course of green building and green building 

design studio. 

Urban design studio is the course facing the urban 

issues among the above studios. It is aimed 

to set up a cross-culture platform of the urban 

topics discussion for the international students. In 

recent years, Knowledge City, Ecology City, Safe 

city and Edge City are selected as the themes 

of the studio. In 2017, Sharing City is chosen as 

the theme for the joint studio set up by School 

of Architecture in Tsinghua University and School 

of Design & Environment in National University 

of Singapore. The “Sharing Cities” studio aims to 

provide solutions to emerging concept of sharing, 

and responds to the idea of public space sharing 

and sustainable urban development from social, 

economic and humanitarian perspectives. The 

success of Tsinghua-NUS joint studio pushes 

forward the international cooperation process of 

urban design studio and other studios in EPMA.

We hope the improving EPMA and urban design 

studio would act as a window for international 

exchange students from all over the world to get 

access to the Chinese architectural and urban 

knowledge base and practice.

Director of English Program of Master in Architecture 

Prof. LI Xiaodong

Director of Urban Design Studio Prof. ZHANG 

Yue

本书是清华大学建筑学院英文硕士项目(EPMA)的教学成果系列丛书之一。建筑

学院英文硕士项目旨在为国际学生搭建一个建筑学硕士课程的教学平台,致力于加

深对于整合区域环境和全球性多学科网络的批判性理解,并注重实现国际对话中的

教学环境。该项目自2008年创建以来,已成功吸引了来自5大洲30多个国家的91位

国际学生。

英文硕士项目将重要学术领域和当前高速发展的城市化进程中的现实问题结合起

来。项目鼓励学生开发批判性思维,能够独立思考实际情况,并能在特定文化背景

下有所创造。主干课程设置包括4门理论课和4门设计课,相互对应。第一组课程

主题为“乡土”,包括中国本土建筑介绍和具有场所精神的本土建筑设计课程;第

二组课程主题为“当代”,包括当今建筑设计思潮介绍和包括参数化设计在内的新

设计方法课程;第三组课程为“城市”,包括当代中国城市发展介绍和城市设计课

程;第四组课程为“技术”,包括绿色建筑理论及实践介绍和绿色建设设计课程。

城市设计课程是上述课程中面向城市问题的设计课。课程旨在建立一个跨文化的平

台,让不同国家的学生就城市发展的相关话题进行交流探讨。近年来课程选题涉

及“知识城市”“生态城市”“安全城市”“边缘城市”等。2017年城市设计课程

是与新加坡国立大学设计与环境学院共同进行的联合教学,选定“共享城市”为主

题,旨在为正在广泛兴起的共享理念提供空间解决方案,并从社会、经济和人文角

度回应公共空间的共享与城市的可持续发展。此次联合教学取得了良好的成效,为

城市设计课程以及其他英文硕士项目课程的进一步国际化合作奠定基础。

我们希望,不断探索完善中的英文硕士项目及城市设计课程,能成为世界各地的国

际交换生的窗口,使他们得以接触和了解中国城市和建筑的基础情况和实践。

 

英文硕士项目负责人 李晓东 教授 

城市设计课程负责人 张 悦 教授

清华大

foreword II

by NUS

The rapid pace of change in the cultural and economic 

landscape of China compels us to rethink 

the nature of the built environment afresh. While 

modes of production and consumption undergo 

breakneck speeds of transformation, the city and 

buildings remain unmoved, and innovations in 

building technology and perception crawl in snail 

pace by comparison. With the advent of smart 

phones ten years ago and the tens of millions of 

Apps that were developed since, urban living had 

changed dramatically. Is it possible for the physical 

environment to re-conceive in tandem with 

such changes in lifestyle, habit, social cohesion 

and other pertinent issues. How can we conceptualize 

the city of today and perhaps of tomorrow?

These are the questions grappled by architecture 

students from Tsinghua University and National 

University of Singapore in the Sharing Cities 

workshops and studios. The collaboration not 

only brings students from different international 

backgrounds together, but also young talents to 

imagine the future. They share the concerns of 

the current development in Beijing and Singapore 

as two of the most exciting and rapidly developing 

mega cities in the world and also project the 

future of urban and building designs in these cities 

that would embrace co-sharing as a practice 

for urban life. Studio is the key arena for postulations, 

debates, expressions and substantiations 

of ideas and collaborative studio, such as this one 

presented in the book, deepens the experience 

further. 

The choice for the topic and format of the studio 

are relevant to the issues at hand, the real life 

situation that we are living in, and the method 

for eliciting and producing innovative ideas and 

proposals. The students have been investigating 

the nature of co-sharing as well as the myths surrounding 

this mode of consumption. They have 

explored different options and provided design 

solutions that would facilitate various forms of 

sharing: culture, heritage, transport, to name a 

few. Through research, case studies and design 

activities, the students collectively and individually 

have gained awareness and insights in this 

fast growing living pattern. They are able to hone 

their design skill too to facilitate and inspire the 

increasing popular lifestyle. This book bears witness 

to their achievement.

Head of Department of Architecture 

Prof. Puay-Peng HO

中国文化和经济格局的快速变化促使我们重新思考建成环境的本质。相较于生产和

消费方式经历的急速变革,城市和建筑仍然止步不前,建筑技术和观念的创新也进

展缓慢。随着十年前智能手机的出现,以及随之而生的数以千万计的应用程序,城

市生活发生了巨大的变化。物质环境是否可以随着生活方式、习惯、社会凝聚力和

其他相关问题的变化而重新建构?我们又应该如何概念化今天或许明天的城市?

这些问题正是清华大学-新加坡国立大学建筑系的共享城市合作设计课程和设计工

作坊的关注所在。这一合作不仅集结了不同国际背景的学生,并且为这些年轻人才

提供了一个畅想未来的机会。以世界上发展最活跃、最迅速的两座特大城市——北

京和新加坡为对象,他们共同关注城市当前的发展状况,并探讨了未来的城市和建

筑设计如何承载并推动共享作为城市生活的一种实践。设计课是思想形成、论辩、

表达及深化的重要平台,而正如此书所呈现的,联合设计课恰恰将这一经验进一步

深化。

设计课主题和形式的选择脱离不开我们当前需要面对的问题和所处的现实生活,同

时也关系到激发和产生创新想法和方案的方法。学生们针对共享的本质以及围绕这

一消费模式的诸多疑惑进行了深入的研究。他们探索了不同的可能性,并提出了能

够促进不同类型如文化、遗产、交通等共享活动的一系列方案。通过研究、案例学

习和设计探索,无论是在整体还是个人层面,学生们都强化了对这一迅速普及的生

活模式的认识。他们也磨炼了自己的设计技能,并以此来推动这一日益流行的生活

方式。这本书见证了他们取得的成绩。

 

建筑系系主任 何培斌 教授 

新加坡国立大

1

目录

目  录

第一篇  机器学习基础

第1章  机器学习与无人驾驶 1

1.1  机器学习简介 1

1.1.1  机器学习 1

1.1.2  深度学习 5

1.1.3  强化学习 6

1.2  无人驾驶与机器学习 7

1.2.1  无人驾驶的历史 7

1.2.2  为什么要在无人驾驶中应用机器学习 9

1.2.3  无人驾驶商业化的优势 10

1.2.4  无人驾驶商业化的进展 11

参考文献 13

第2章  TensorFlow基础 15

2.1  机器学习主流框架简介 15

2.2  TensorFlow开发环境搭建 19

2.2.1  基于Python语言框架的Virtualenv方案 19

2.2.2  基于应用容器化的Docker方案 23

2.3  Hello TensorFlow—一个简单的例子 23

2.4  TensorFlow架构 26

2.4.1  TensorFlow架构概述 26

2.4.2  TensorFlow客户端架构 27

2.4.3  TensorFlow分布式主服务架构 28

2.4.4  TensorFlow工作器服务架构 29

2.4.5  TensorFlow内核架构 30

2.5  TensorFlow核心API 30

2.5.1  TensorFlow低级API 31

2.5.2  TensorFlow高级API 35

2.6  扩展:使用tensorflow.js进行机器学习 38

参考文献 40

第3章  线性回归 41

3.1  什么是线性回归 41

3.1.1  线性回归的概念 41

3.1.2  线性回归的历史 42

3.1.3  线性回归模型 42

3.2  线性回归中的最小二乘法模型 43

3.3  最小二乘法模型实例 45

3.4  线性回归的梯度下降模型 47

3.5  梯度下降模型实例 48

参考文献 51

第4章  逻辑回归 52

4.1  逻辑回归简介 52

4.2  逻辑回归模型 54

4.3  泛逻辑回归 55

4.4  实例:股价预测 56

参考文献 64

第二篇  机器学习进阶

第5章  神经网络 65

5.1  神经元模型 65

5.1.1  神经网络的灵感来源 65

5.1.2  感知器模型概述 66

5.2  单神经元模型实例 67

5.2.1  验证码概述 68

5.2.2  开发实例代码详解 69

5.3  激活函数 76

5.3.1  常用激活函数 76

5.3.2  Sigmoid函数 77

5.3.3  tanh函数 79

5.3.4  ReLU函数以及变式 79

5.4  全连接神经网络模型 80

5.4.1  多层感知器神经网络结构 80

5.4.2  BP算法 82

5.5  全连接神经网络实例 82

参考文献 84

第6章  卷积神经网络 85

6.1  卷积神经网络概述 85

6.1.1  卷积神经网络架构 85

6.1.2  卷积操作 86

6.1.3  池化操作 87

6.1.4  卷积神经网络的特点 88

6.2  实例1:验证码识别 89

6.2.1  神经网络的具体设计 89

6.2.2  卷积过程分析 91

6.2.3  池化过程分析 92

6.2.4  完整学习过程分析 93

6.3  实例2:过拟合和欠拟合 95

6.3.1  下载 IMDB 数据集 96

6.3.2  构建模型 99

6.3.3  训练模型 101

6.3.4  过拟合过程实践 106

6.3.5  过拟合应对策略 115

参考文献 120

第7章  循环神经网络 121

7.1  循环神经网络概述 121

7.1.1  时序数据 121

7.1.2  循环神经网络模型 122

7.2  长短时记忆神经网络架构 123

7.3  实例:仿写西游记 126

7.3.1  文本的读取和分段 126

7.3.2  循环神经网络模型定义 130

7.3.3  模型训练和结果分析 132

参考文献 134

第8章  强化学习 136

8.1  强化学习概述 136

8.1.1  强化学习简史 136

8.1.2  强化学习的特点 137

8.1.3  强化学习模型 138

8.1.4  强化学习分类 139

8.2  Q-Learning架构 140

8.2.1  Q-Learning数学模型 140

8.2.2  Q-Learning算法伪代码 141

8.3  实例:贪吃蛇人工智能 142

8.3.1  Pygame框架 142

8.3.2  游戏功能实现 143

8.3.3  强化学习功能实现 151

参考文献 160

第三篇  无人驾驶

第9章  无人驾驶系统 161

9.1  无人驾驶系统概述 161

9.1.1  环境感知概述 162

9.1.2  车辆定位概述 163

9.1.3  路径规划概述 164

9.1.4  车辆控制概述 164

9.2  Apollo简介 165

9.2.1  Apollo架构概述 165

9.2.2  Apollo子系统交互关系 167

9.3  Apollo开发环境搭建 169

9.3.1  软件系统代码本地安装 170

9.3.2  开发环境搭建中的注意事项 171

参考文献 173

第10章  Cyber基础 174

10.1  Cyber简介(包括和ROS的对比) 174

10.1.1  什么是Apollo Cyber RT 174

10.1.2  ROS系统 175

10.1.3  Cyber RT的架构及核心软件模块分析 176

10.2  Cyber API和API Demo 177

10.2.1  Talker-Listener(简单对话系统) 178

10.2.2  Cyber服务 181

10.2.3  日志类库 188

10.2.4  Cyber模组 189

10.2.5  Timer计时器 194

10.2.6  时间(Time)类 195

10.2.7  Apollo记录文件的读写操作 196

10.3  Apollo 模块启动源码分析 199

10.3.1  Apollo模块启动流程 199

10.3.2  Apollo模块注册及动态创建 217

参考文献 222

第11章  无人驾驶地图技术 223

11.1  高精地图 223

11.1.1  高精地图在自动驾驶子系统中的应用 223

11.1.2  高精地图的解决方案 224

11.1.3  OpenDrive地图格式简介 227

11.1.4  百度Apollo相关源代码分析 234

11.2  PncMap 264

11.3  Relative Map模块 281

参考文献 303

第12章  无人驾驶定位技术 304

12.1  RTK定位技术 304

12.2  多传感器融合定位技术 307

12.2.1  激光雷达简介 307

12.2.2  扩展卡尔曼滤波原理 308

12.2.3  百度Apollo相关源码分析 309

参考文献 322

第13章  无人驾驶预测技术 323

13.1  预测模块简介 323

13.2  成本评估器:由一组成本函数计算概率 327

13.3  MLP评估器:用MLP模型计算概率 329

13.4  RNN评估器:用RNN模型计算概率 343

参考文献 350

第14章  无人驾驶规划策略 351

14.1  规划模块简介 351

14.1.1  规划业务流程分析 351

14.1.2  Frenet坐标系 352

14.1.3  路径-速度解耦 352

14.1.4  三维轨迹生成Lattice 353

14.1.5  车辆状态 353

14.2  路径规划 353

14.3  障碍物规划 363

14.4  速度规划 373

参考文献 392

第15章  无人驾驶控制策略 394

15.1  车辆模型 394

15.1.1  运动学模型 394

15.1.2  动力学模型 396

15.2  PID控制算法 397

15.2.1  比例控制算法 397

15.2.2  积分控制算法 397

15.2.3  微分控制算法 398

15.2.4  百度Apollo相关源码分析 398

15.3  MPC控制算法 408

15.3.1  MPC的控制原理 409

15.3.2  百度Apollo相关源码分析 409

参考文献 414

附录A  强化学习:贪吃蛇AI完整游戏逻辑代码 416

附录B  CyberRT系统核心API字典 423

作者简介

编辑推荐

本书是自动驾驶方面的专著,自动驾驶需要开发人员了解车辆本身的包括运动、机械等方面的基础知识,更需要了解不同传感器的数据微观特征,想要进入此领域的开发人员往往因为系统繁杂而不能很快掌握核心开发技术。

本书以机器学习为出发点,给想要进入此领域的初级开发人员搭建了一条从机器学习到无人驾驶的基础学习路径。本书结合近年来发展迅猛的机器学习算法(深度神经网络、强化学习)详细介绍了包含定位、预测、路径规划和车辆控制等一系列自动驾驶模块。

全书通过核心代码深入浅出地讲解机器学习的核心算法,通过实例分析代码本身的逻辑关系以及自动驾驶背后的设计思想和原理,利用开源机器学习和无人驾驶系统架构作为学习的背景蓝图,代码实例涉及自动驾驶的普遍业务方法,力图使读者能够通过实际操作快速入门和理解自动驾驶的算法和开发流程。

本书主要面向希望从事人工智能和智能驾驶工作的学生和工程师朋友。

作者寄语

宋哲贤,多年互联网和机器学习开发经历,在著名车企从事车辆智能化算法架构研发,对于人工智能应用有较强的实践经验,目前专注于迁移学习的工程化实践。

慕课网高级讲师,热爱分享,开发多门人工智能的入门和进阶课程,擅长实例的类比讲解。

获得车辆智能化国家专利1项。

电子资料

www.luweidong.cn

下一个