[coursera/ConvolutionalNeuralNetworks/week1]Foundations of cnn(summary&question)
Convolutional Neural Networks
1.1 Computer Vision
why to learn cv
network for large images
1.2 Edge Detection Example
py: conv_forward
tensorflow: tf.nn.conv2d
keras: Con2D
Here are another convolutional computation:
more edge detection
Padding
nxn * fxf = (n-f+1)x(n-f+1)
p = padding
After padding n by n pixels, it turns to be n+2p by n+2p pixels
valid&same convolution(f-odd num)
f - the size of filter
Valid: n x n * f x f = (n-f+1) x (n-f+1)
Same: the output size is the same as the input size
When it is the same convolutions: p = (f - 1) / 2
Strided convolutions
stride means each step, the box will jump [stide] steps to compute the outcome
s = stride
p = padding
n x n * f x f = [(1/s)x(n+2p-f)+1] * [(1/s)x(n+2p-f)+1]
"convolution" or "criss-correlation"
but it does not matter
Convolution Over Volume
Convolutions on RGB images: N x N x 3
height x width x #channels
f(the size of the filter) x f x #channels
multiple filters
One Layer of a Convolutional Network
summary
Simple Convolutional Network Example
Pooling layer
max pooling
average pooling
CNN Example
Why Convolutions?
parameter sharing
sparsity of connections
ques:
The basics of ConvNets
What do you think applying this filter to a grayscale image will do?
[01−1013−3−113−3−101−10][Math Processing Error]
Detect vertical edges
Detect image contrast
Detect 45 degree edges
Detect horizontal edges
2. Question 2
Suppose your input is a 300 by 300 color (RGB) image, and you are not using a convolutional network. If the first hidden layer has 100 neurons, each one fully connected to the input, how many parameters does this hidden layer have (including the bias parameters)?
9,000,001
9,000,100
27,000,001
27,000,100
3. Question 3
Suppose your input is a 300 by 300 color (RGB) image, and you use a convolutional layer with 100 filters that are each 5x5. How many parameters does this hidden layer have (including the bias parameters)?
2501
2600
7500
7600
4. Question 4
You have an input volume that is 63x63x16, and convolve it with 32 filters that are each 7x7, using a stride of 2 and no padding. What is the output volume?
16x16x32
29x29x16
29x29x32
16x16x16
5. Question 5
You have an input volume that is 15x15x8, and pad it using “pad=2.” What is the dimension of the resulting volume (after padding)?
17x17x8
17x17x10
19x19x8
19x19x12
6. Question 6
You have an input volume that is 63x63x16, and convolve it with 32 filters that are each 7x7, and stride of 1. You want to use a “same” convolution. What is the padding?
1
2
3
7
7. Question 7
You have an input volume that is 32x32x16, and apply max pooling with a stride of 2 and a filter size of 2. What is the output volume?
15x15x16
16x16x8
32x32x8
16x16x16
8. Question 8
Because pooling layers do not have parameters, they do not affect the backpropagation (derivatives) calculation.
True
False
9. Question 9
In lecture we talked about “parameter sharing” as a benefit of using convolutional networks. Which of the following statements about parameter sharing in ConvNets are true? (Check all that apply.)
It allows a feature detector to be used in multiple locations throughout the whole input image/input volume.
It allows parameters learned for one task to be shared even for a different task (transfer learning).
It reduces the total number of parameters, thus reducing overfitting.
It allows gradient descent to set many of the parameters to zero, thus making the connections sparse.