coursera Deeplearning_4

4Convolutional Neural Networks

4.1Edge detection example

kernel = filter

CNN的计算过程:

计算元素积

将权重矩阵中的每一个元素和6x6的矩阵中的元素做乘积,可以得到4x4矩阵中的目标值,比如第一个乘积是

3x1 + 0 + (-1x1) + 1x1 + 0x5 + (-1x8) + 2x1 + 0 + (-1x2) = -5, so the first block of the 4x4 matrix is -5

4.2more edge detection

horizontal edge detection and vertical detection

sobel filter and scharr filter as well as the self-definded filter w1-w9

 

4.3padding

use 0 to pad the extra blanks

n + 2p - f + 1

n is the length/width of the original matrix

p is the extra blanks on the single edge

f is the length/width of the kernel

according to this equation, the size of final width / length of the matrix can be computed.

in order to keep input size same as the output size, p and f should be well computed.

common kernel size like 1x1,3x3,5x5,7x7

4.4stride convolutions

for the summary of convolutions of the structure

such as there is an image of 7x7, and the stride is 2, the filter is 3x3, the padding is 0

so (7+2x0-3)/2+1=3, the final matrix is 3x3

4.5convolutions over volume

4.6simple convolutional example

given a input image and set the f, s, p and the number of filters, we can use the formula (n+2p-f)/s+1 to get the next image size and the corresponding parameters.

channe l is the same as the previous channel l

Convolution = CONV

Pooling = POOL

Fully connected = FC

4.7CNN_example

卷积层和池化层可以被视为同一层

5个层的卷积层

随着卷积层的深化,宽度和高度会不断减小,通道数会不断增加

可以参见下表参数,如何算parameters,需要算(l-1)层image大小*l层的通道数

比如CONV1的parameters计算为(5*5*3+1)*8 = 608,以下同理

计算公式为(consider the full layer)

 

4.8为什么要做卷积操作

如何训练一个猫图像系统探测器:

输入一张图片-----卷积层-----拉层和全连接层(W,b)-----软件输出控制y_hat,接着就是对比训练集中设置的y标记(0/1)来计算cost值,并使用gradient descent来最小化这个cost值。

 

posted on 2020-04-11 23:41  yukun093  阅读(152)  评论(0编辑  收藏  举报

导航