在好例子网,分享、交流、成长!
您当前所在位置:首页Python 开发实例Python GUI开发 → 吴恩达 Programming Assignments of Deep Learning Sp.pdf

吴恩达 Programming Assignments of Deep Learning Sp.pdf

Python GUI开发

下载此实例
  • 开发语言:Python
  • 实例大小:23.45M
  • 下载次数:13
  • 浏览次数:119
  • 发布时间:2020-05-09
  • 实例类别:Python GUI开发
  • 发 布 人:andyz
  • 文件格式:.pdf
  • 所需积分:2
 相关标签: nts en Pr ss mm

实例介绍

【实例简介】

【实例截图】

from clipboard

【核心代码】

Contents
1 Neural Networks and Deep Learning 1
1.1 Python Basics with numpy (optional) . . . . . . . . . . . . . . . . . . . . 1
1.1.1 About iPython Notebooks . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.2 Building basic functions with numpy . . . . . . . . . . . . . . . . . 2
1.1.2.1 sigmoid function, np.exp() . . . . . . . . . . . . . . . . . 2
1.1.2.2 Sigmoid gradient . . . . . . . . . . . . . . . . . . . . . . . 4
1.1.2.3 Reshaping arrays . . . . . . . . . . . . . . . . . . . . . . . 5
1.1.2.4 Normalizing rows . . . . . . . . . . . . . . . . . . . . . . 6
1.1.2.5 Broadcasting and the softmax function . . . . . . . . . . 7
1.1.3 Vectorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.1.3.1 Implement the L1 and L2 loss functions . . . . . . . . . . 12
1.2 Logistic Regression with a Neural Network mindset . . . . . . . . . . . . . 14
1.2.1 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.2.2 Overview of the Problem set . . . . . . . . . . . . . . . . . . . . . 15
1.2.3 General Architecture of the learning algorithm . . . . . . . . . . . 18
1.2.4 Building the parts of our algorithm . . . . . . . . . . . . . . . . . . 19
1.2.4.1 Helper functions . . . . . . . . . . . . . . . . . . . . . . . 19
1.2.4.2 Initializing parameters . . . . . . . . . . . . . . . . . . . . 19
1.2.4.3 Forward and Backward propagation . . . . . . . . . . . . 20
1.2.4.4 Optimization . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.2.5 Merge all functions into a model . . . . . . . . . . . . . . . . . . . 25
1.2.6 Further analysis (optional/ungraded exercise) . . . . . . . . . . . . 28
1.2.7 Test with your own image (optional/ungraded exercise) . . . . . . 30
1.2.8 Code of Logistic Regression with a Neural Network . . . . . . . . . 31
1.3 Planar data classification with a hidden layer . . . . . . . . . . . . . . . . 37
1.3.1 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
1.3.2 Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
1.3.3 Simple Logistic Regression . . . . . . . . . . . . . . . . . . . . . . . 39
1.3.4 Neural Network model . . . . . . . . . . . . . . . . . . . . . . . . . 40
1.3.4.1 Defining the neural network structure . . . . . . . . . . . 41
1.3.4.2 Initialize the model’s parameters . . . . . . . . . . . . . . 42
1.3.4.3 The Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
1.3.4.4 Integrate parts 1.3.4.1, 1.3.4.2 and 1.3.4.3 in nn_model() 48
1.3.4.5 Tuning hidden layer size (optional/ungraded exercise) . . 51
1.3.5 Code of Neural Network With a Hidden Layer . . . . . . . . . . . 54
1.4 Building your Deep Neural Network: Step by Step . . . . . . . . . . . . . 61
1.4.1 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
1.4.2 Outline of the Assignment . . . . . . . . . . . . . . . . . . . . . . . 62
1.4.3 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
1.4.3.1 2-layer Neural Network . . . . . . . . . . . . . . . . . . . 63
1.4.3.2 L-layer Neural Network . . . . . . . . . . . . . . . . . . . 64
1.4.4 Forward propagation module . . . . . . . . . . . . . . . . . . . . . 66
1.4.4.1 Linear Forward . . . . . . . . . . . . . . . . . . . . . . . . 66
1.4.4.2 Linear-Activation Forward . . . . . . . . . . . . . . . . . 67
1.4.4.3 L-Layer Model . . . . . . . . . . . . . . . . . . . . . . . . 68
1.4.5 Cost function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
1.4.6 Backward propagation module . . . . . . . . . . . . . . . . . . . . 71
1.4.6.1 Linear backward . . . . . . . . . . . . . . . . . . . . . . . 71
1.4.6.2 Linear-Activation backward . . . . . . . . . . . . . . . . . 73
1.4.6.3 L-Model Backward . . . . . . . . . . . . . . . . . . . . . . 74
1.4.6.4 Update Parameters . . . . . . . . . . . . . . . . . . . . . 76
1.4.6.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . 77
1.4.7 Code of Deep Neural Network . . . . . . . . . . . . . . . . . . . . . 78
1.5 Deep Neural Network for Image Classification: Application . . . . . . . . 86
1.5.1 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
1.5.2 Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
1.5.3 Architecture of your model . . . . . . . . . . . . . . . . . . . . . . 88
1.5.3.1 2-layer neural network . . . . . . . . . . . . . . . . . . . . 88
1.5.3.2 L-layer deep neural network . . . . . . . . . . . . . . . . 89
1.5.3.3 General methodology . . . . . . . . . . . . . . . . . . . . 90
1.5.4 Two-layer neural network . . . . . . . . . . . . . . . . . . . . . . . 90
1.5.5 L-layer Neural Network . . . . . . . . . . . . . . . . . . . . . . . . 94
1.5.6 Results Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
1.5.7 Test with your own image (optional/ungraded exercise) . . . . . . 97
1.5.8 Code of Deep Neural Network for Image Classification: Application 99
2 Improving Deep Neural Networks: Hyperparameter tuning, Regularization and Optimization 104
2.1 Practical aspects of Deep Learning . . . . . . . . . . . . . . . . . . . . . . 104
2.1.1 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
2.1.1.1 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
2.1.1.2 Neural Network model . . . . . . . . . . . . . . . . . . . . 105
2.1.1.3 Zero initialization . . . . . . . . . . . . . . . . . . . . . . 107
2.1.1.4 Random initialization . . . . . . . . . . . . . . . . . . . . 111
2.1.1.5 He initialization . . . . . . . . . . . . . . . . . . . . . . . 114
2.1.1.6 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . 117
2.1.1.7 Code of initialization . . . . . . . . . . . . . . . . . . . . 118
2.1.2 Regularization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
2.1.2.1 Non-regularized model . . . . . . . . . . . . . . . . . . . . 124
2.1.2.2 L2 Regularization . . . . . . . . . . . . . . . . . . . . . . 128
2.1.2.3 Dropout . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
2.1.2.4 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . 139
2.1.3 Gradient Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
2.1.3.1 How does gradient checking work? . . . . . . . . . . . . . 140
2.1.3.2 1-dimensional gradient checking . . . . . . . . . . . . . . 141
2.1.3.3 N-dimensional gradient checking . . . . . . . . . . . . . . 144
2.2 Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
2.2.1 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
2.2.2 Gradient Descent . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
2.2.3 Mini-Batch Gradient descent . . . . . . . . . . . . . . . . . . . . . 155
2.2.4 Momentum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
2.2.5 Adam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
2.2.6 Model with different optimization algorithms . . . . . . . . . . . . 165
2.2.6.1 Mini-batch Gradient descent . . . . . . . . . . . . . . . . 168
2.2.6.2 Mini-batch gradient descent with momentum . . . . . . . 169
2.2.6.3 Mini-batch with Adam mode . . . . . . . . . . . . . . . . 170
2.2.6.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
2.3 Tensorflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
2.3.1 Exploring the Tensorflow Library . . . . . . . . . . . . . . . . . . . 173
2.3.1.1 Linear function . . . . . . . . . . . . . . . . . . . . . . . . 175
2.3.1.2 Computing the sigmoid . . . . . . . . . . . . . . . . . . . 176
2.3.1.3 Computing the Cost . . . . . . . . . . . . . . . . . . . . . 178
2.3.1.4 Using One Hot encodings . . . . . . . . . . . . . . . . . . 179
2.3.1.5 Initialize with zeros and ones . . . . . . . . . . . . . . . . 180
2.3.2 Building your first neural network in tensorflow . . . . . . . . . . . 181
2.3.2.1 Problem statement: SIGNS Dataset . . . . . . . . . . . . 182
2.3.2.2 Create placeholders . . . . . . . . . . . . . . . . . . . . . 184
2.3.2.3 Initializing the parameters . . . . . . . . . . . . . . . . . 185
2.3.2.4 Forward propagation in tensorflow . . . . . . . . . . . . . 186
2.3.2.5 Compute cost . . . . . . . . . . . . . . . . . . . . . . . . 187
2.3.2.6 Backward propagation & parameter updates . . . . . . . 189
2.3.2.7 Building the model . . . . . . . . . . . . . . . . . . . . . 189
2.3.2.8 Test with your own image (optional / ungraded exercise) 193
2.3.2.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
3 Convolutional Neural Networks 195
3.1 Convolutional Neural Networks: Step by Step . . . . . . . . . . . . . . . . 195
3.1.1 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
3.1.2 Outline of the Assignment . . . . . . . . . . . . . . . . . . . . . . . 196
3.1.3 Convolutional Neural Networks . . . . . . . . . . . . . . . . . . . . 196
3.1.3.1 Zero-Padding . . . . . . . . . . . . . . . . . . . . . . . . . 197
3.1.3.2 Single step of convolution . . . . . . . . . . . . . . . . . . 199
3.1.3.3 Convolutional Neural Networks - Forward pass . . . . . . 201
3.1.4 Pooling layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
3.1.4.1 Forward Pooling . . . . . . . . . . . . . . . . . . . . . . . 205
3.1.5 Backpropagation in convolutional neural networks (OPTIONAL /
UNGRADED) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
3.1.5.1 Convolutional layer backward pass . . . . . . . . . . . . . 207
3.1.5.2 Pooling layer - backward pass . . . . . . . . . . . . . . . 210
3.2 Convolutional Neural Networks: Application . . . . . . . . . . . . . . . . 215
3.2.1 TensorFlow model . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
3.2.2 Create placeholders . . . . . . . . . . . . . . . . . . . . . . . . . . 217
3.2.3 Initialize parameters . . . . . . . . . . . . . . . . . . . . . . . . . . 218
3.2.4 Forward propagation . . . . . . . . . . . . . . . . . . . . . . . . . . 219
3.2.5 Compute cost . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
3.2.6 Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
3.3 Keras Tutorial - The Happy House (not graded) . . . . . . . . . . . . . . 226
3.3.1 The Happy House . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
3.3.2 Building a model in Keras . . . . . . . . . . . . . . . . . . . . . . . 228
3.3.3 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
3.3.4 Test with your own image (Optional) . . . . . . . . . . . . . . . . 234
3.3.5 Other useful functions in Keras (Optional) . . . . . . . . . . . . . 235
3.4 Residual Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
3.4.1 The problem of very deep neural networks . . . . . . . . . . . . . . 237
3.4.2 Building a Residual Network . . . . . . . . . . . . . . . . . . . . . 238
3.4.2.1 The identity block . . . . . . . . . . . . . . . . . . . . . . 239
3.4.2.2 The convolutional block . . . . . . . . . . . . . . . . . . . 242
3.4.3 Building your first ResNet model (50 layers) . . . . . . . . . . . . . 245
3.4.4 Test on your own image (Optional/Ungraded) . . . . . . . . . . . . 250
3.5 Car detection with YOLOv2 . . . . . . . . . . . . . . . . . . . . . . . . . . 253
3.5.1 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
3.5.2 YOLO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
3.5.2.1 Model details . . . . . . . . . . . . . . . . . . . . . . . . . 255
3.5.2.2 Filtering with a threshold on class scores . . . . . . . . . 258
3.5.2.3 Non-max suppression . . . . . . . . . . . . . . . . . . . . 260
3.5.2.4 Wrapping up the filtering . . . . . . . . . . . . . . . . . . 263
3.5.3 Test YOLO pretrained model on images . . . . . . . . . . . . . . . 265
3.5.3.1 Defining classes, anchors and image shape . . . . . . . . . 265
3.5.3.2 Loading a pretrained model . . . . . . . . . . . . . . . . . 265
3.5.3.3 Convert output of the model to usable bounding box tensors266
3.5.3.4 Filtering boxes . . . . . . . . . . . . . . . . . . . . . . . . 266
3.5.3.5 Run the graph on an image . . . . . . . . . . . . . . . . . 267
3.6 Face Recognition for the Happy House . . . . . . . . . . . . . . . . . . . . 271
3.6.1 Naive Face Verification . . . . . . . . . . . . . . . . . . . . . . . . . 272
3.6.2 Encoding face images into a 128-dimensional vector . . . . . . . . 273
3.6.2.1 Using an ConvNet to compute encodings . . . . . . . . . 273
3.6.2.2 The Triplet Loss . . . . . . . . . . . . . . . . . . . . . . . 274
3.6.3 Loading the trained model . . . . . . . . . . . . . . . . . . . . . . . 276
3.6.4 Applying the model . . . . . . . . . . . . . . . . . . . . . . . . . . 277
3.6.4.1 Face Verification . . . . . . . . . . . . . . . . . . . . . . . 277
3.6.4.2 Face Recognition . . . . . . . . . . . . . . . . . . . . . . . 280
3.7 Art generation with Neural Style Transfer . . . . . . . . . . . . . . . . . . 283
3.7.1 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
3.7.2 Transfer Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
3.7.3 Neural Style Transfer . . . . . . . . . . . . . . . . . . . . . . . . . 284
3.7.3.1 Computing the content cost . . . . . . . . . . . . . . . . . 284
3.7.3.2 Computing the style cost . . . . . . . . . . . . . . . . . . 287
3.7.3.3 Defining the total cost to optimize . . . . . . . . . . . . . 292
3.7.4 Solving the optimization problem . . . . . . . . . . . . . . . . . . . 292
3.7.5 Test with your own image (Optional/Ungraded) . . . . . . . . . . 298
3.7.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299

标签: nts en Pr ss mm

实例下载地址

吴恩达 Programming Assignments of Deep Learning Sp.pdf

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警