其他分享
首页 > 其他分享> > Deep Learning Specialization 4: Convolutional Neural Networks - Week 1

Deep Learning Specialization 4: Convolutional Neural Networks - Week 1

作者:互联网

温故而知新,笔记拖了一个多月了。

如果没有图像处理经验,那么在理解卷积神经网络的起点上会有一些麻烦,使用算子做边缘检测并不是在神经网络应用在图像上才有的,卷积、填充也不是。只要多看几遍视频,理解也不是什么难事。

1. 卷积神经网络的起点

Edge Detection - Filter/Kernel:深度网络之前特殊设计的filter可以用于检测比如竖直/水平方向的边界(比如Sobel算子),深度网络中并不需要手工指定,filter本身也是可以学习的。

符号约定:

nn​n​: 图像大小,nhn_h​nh​​ nwn_w​nw​​和ncn_c​nc​​分别代别高宽和channel(比如RGB)

fff: filter大小,(f×f×ncf \times f \times n_cf×f×nc​),fff一般是奇数,ncn_cnc​与待卷积的输入一致

ppp: padding大小

2. 卷积操作

3. 卷积神经网络的基本组织

3.1 One Layer of a Convolutional Network

设l是卷积层,约定:

f[l]f^{[l]}f[l] = filter size, each filter is: f[l]×f[l]×nc[l1]f^{[l]} \times f^{[l]} \times n_c^{[l-1]}f[l]×f[l]×nc[l−1]​

p[l]p^{[l]}p[l] = padding

s[l]s^{[l]}s[l] = stride

nH[l1]×nW[l1]×nc[l1]n_H^{[l-1]} \times n_W^{[l-1]} \times n_c^{[l-1]}nH[l−1]​×nW[l−1]​×nc[l−1]​ = 当前卷积层的输入

那么,

  1. 卷积层的参数数量 (f[l]×f[l]×nc[l1]+1)×nc[l](f^{[l]} \times f^{[l]} \times n_c^{[l-1]} + 1) \times n_c^{[l]}(f[l]×f[l]×nc[l−1]​+1)×nc[l]​

  2. 卷积层的输出
    nH[l]=nH[l1]+2p[l]f[l]s[l]+1 n_H^{[l]} = \lfloor \frac {n_H^{[l-1]} + 2p^{[l]} - f^{[l]}} {s^{[l]}} + 1 \rfloor nH[l]​=⌊s[l]nH[l−1]​+2p[l]−f[l]​+1⌋

    nW[l]=nW[l1]+2p[l]f[l]s[l]+1 n_W^{[l]} = \lfloor \frac {n_W^{[l-1]} + 2p^{[l]} - f^{[l]}} {s^{[l]}} + 1 \rfloor nW[l]​=⌊s[l]nW[l−1]​+2p[l]−f[l]​+1⌋

    nc[l]=number of filters n_c^{[l]} = \text{number of filters} nc[l]​=number of filters

  3. Activation

    1. a[l]nH[l]×nW[l]×nc[l]a^{[l]} \rightarrow n_H^{[l]} \times n_W^{[l]} \times n_c^{[l]}a[l]→nH[l]​×nW[l]​×nc[l]​
    2. m个样本的向量化表示:A[l]m×nH[l]×nW[l]×nc[l]A^{[l]} \rightarrow m \times n_H^{[l]} \times n_W^{[l]}\times n_c^{[l]}A[l]→m×nH[l]​×nW[l]​×nc[l]​

多卷积层组合:一般地,逐层nHn_H \downarrownH​↓,ncn_c \uparrownc​↑

3.2 网络组件

Convolutional Layer(CONV)

Pooling Layer (POOL)

Fully Connected Layer (FC)

Pooling layer中一般使用Max pooling:

  1. 对于每个channel,与卷积类似,但是只取区域最大值
  2. 输出的ncn_cnc​保持不变

It helps reduce computation, as well as helps make feature detectors more invariant to its position in the input

3.3 一个用于图像分类的示例网络组合

CONV1 \rightarrow→ POOL1 \rightarrow→ CONV2 \rightarrow→ POOL2 \rightarrow→ FC3 \rightarrow→ FC4\rightarrow→Softmax

4. Why Convolutions?

Parameter sharing: A feature detector (such as a vertical edge detector) that’s usefull in one part of the image is probably useful in another part of the image.

Sparsity of connections: In each layer, each output value depends only on a small number of input. (图像的像素之间只有局部相关性)

标签:Convolutional,Week,nH,2p,Specialization,卷积,nc,times,100
来源: https://blog.csdn.net/duh2so4/article/details/102768208