【中英】【吴恩达课后测验】Course 4 -卷积神经网络 - 第一周测验
【中英】【吴恩达课后测验】Course 4 -卷积神经网络 - 第一周测验 - 卷积神经网络的基本知识上一篇:【课程3 - 第二周测验】※※※※※ 【回到目录】※※※※※下一篇:【课程4 -第一周编程作业】第一周测验 - 卷积神经网络的基本知识1. 问题 1你认为把下面这个过滤器应用到灰度图像会怎么样?⎡⎣⎢⎢⎢01101331−1−3−3−10−1−10⎤⎦⎥⎥...
【中英】【吴恩达课后测验】Course 4 -卷积神经网络 - 第一周测验 - 卷积神经网络的基本知识
第一周测验 - 卷积神经网络的基本知识
1. 问题 1
你认为把下面这个过滤器应用到灰度图像会怎么样?
⎡⎣⎢⎢⎢01101331−1−3−3−10−1−10⎤⎦⎥⎥⎥ [ 0 1 − 1 0 1 3 − 3 − 1 1 3 − 3 − 1 0 1 − 1 0 ] <script type="math/tex" id="MathJax-Element-71"> \begin{bmatrix} 0 & 1 & -1 & 0 \\ 1 & 3 & -3 & -1 \\ 1 & 3 & -3 & -1 \\ 0 & 1 & -1 & 0 \end{bmatrix}</script>
-
【 】 会检测45度边缘
-
【
★
】 会检测垂直边缘 -
【 】 会检测水平边缘
-
【 】 会检测图像对比度
Because the left part is positive, and the right part is negative.
因为因为左边的部分是正的,右边的部分是负的。(博主注:左边亮,右边暗)
2. 问题 2
假设你的输入是一个300×300的彩色(RGB)图像,而你没有使用卷积神经网络。 如果第一个隐藏层有100个神经元,每个神经元与输入层进行全连接,那么这个隐藏层有多少个参数(包括偏置参数)?
-
【 】 9,000,001
-
【 】 9,000,100
-
【 】 27,000,001
-
【
★
】 27,000,100
博主注:先计算 W[1]=[l[1],X]=[100,300∗300∗3]=100∗300∗300∗3=27,000,000 W [ 1 ] = [ l [ 1 ] , X ] = [ 100 , 300 ∗ 300 ∗ 3 ] = 100 ∗ 300 ∗ 300 ∗ 3 = 27 , 000 , 000 <script type="math/tex" id="MathJax-Element-72">W^{[1]} = [l^{[1]},X] = [100,300*300*3] = 100*300*300*3 = 27,000,000</script>,然后计算偏置 b b <script type="math/tex" id="MathJax-Element-73">b</script>,因为第一隐藏层有100个节点,每个节点有1个偏置参数,所以 <script type="math/tex" id="MathJax-Element-74">b = 100</script>,加起来就是 27,000,000+100=27,000,100 27 , 000 , 000 + 100 = 27 , 000 , 100 <script type="math/tex" id="MathJax-Element-75">27,000,000 + 100 = 27,000,100</script>。
3. 问题 3
假设你的输入是300×300彩色(RGB)图像,并且你使用卷积层和100个过滤器,每个过滤器都是5×5的大小,请问这个隐藏层有多少个参数(包括偏置参数)?
-
【 】 2501
-
【 】 2600
-
【 】 7500
-
【
★
】 7600
博主注:视频【1.7单层卷积网络】,05:10处。首先,参数和输入的图片大小是没有关系的,无论你给的图像像素有多大,参数值都是不变的,在这个题中,参数值只与过滤器有关。我们来看一下怎么算:单片过滤器的大小是 5∗5 5 ∗ 5 <script type="math/tex" id="MathJax-Element-76">5 * 5</script>,由于输入的是RGB图像,所以信道 nc=3 n c = 3 <script type="math/tex" id="MathJax-Element-77">n_c = 3</script>,由此可见,一个完整的过滤器的组成是: 5∗5∗nc=5∗5∗3 5 ∗ 5 ∗ n c = 5 ∗ 5 ∗ 3 <script type="math/tex" id="MathJax-Element-78">5 * 5 * n_c = 5 * 5 *3</script>,每一个完整的过滤器只有一个偏置参数 b b <script type="math/tex" id="MathJax-Element-79">b</script>,所以,每一个完整的过滤器拥有 <script type="math/tex" id="MathJax-Element-80">5 * 5 * 3 + 1 = 76</script>个参数,而此题中使用了 100 100 <script type="math/tex" id="MathJax-Element-81">100</script>个过滤器,所以这个隐藏层包含了 76∗100=7600 76 ∗ 100 = 7600 <script type="math/tex" id="MathJax-Element-82">76*100 = 7600</script>个参数。
4. 问题 4
你有一个63x63x16的输入,并使用大小为7x7的32个过滤器进行卷积,使用步幅为2和无填充,请问输出是多少?
-
【
★
】 29x29x32 -
【 】 16x16x32
-
【 】 29x29x16
-
【 】 16x16x16
n = 63, f = 7, s = 2, p = 0, 32 filters.
博主注:我们先来看一下这个输出尺寸的公式: ⌊nh+2p−fs+1⌋×⌊nw+2p−fs+1⌋ ⌊ n h + 2 p − f s + 1 ⌋ × ⌊ n w + 2 p − f s + 1 ⌋ <script type="math/tex" id="MathJax-Element-83">\left \lfloor \frac{n_h + 2p - f}{s} + 1 \right \rfloor \times \left \lfloor \frac{n_w + 2p - f}{s} + 1 \right \rfloor </script>,我们就直接代入公式: ⌊63+2×0−72+1⌋×⌊63+2×0−72+1⌋=⌊562+1⌋×⌊562+1⌋=29×29 ⌊ 63 + 2 × 0 − 7 2 + 1 ⌋ × ⌊ 63 + 2 × 0 − 7 2 + 1 ⌋ = ⌊ 56 2 + 1 ⌋ × ⌊ 56 2 + 1 ⌋ = 29 × 29 <script type="math/tex" id="MathJax-Element-84">\left \lfloor \frac {63 + 2\times0 - 7}{2} + 1 \right \rfloor \times \left \lfloor \frac {63 + 2\times0 - 7}{2} + 1 \right \rfloor = \left \lfloor \frac{56}{2} + 1 \right \rfloor \times \left \lfloor \frac{56}{2} + 1 \right \rfloor = 29 \times 29</script>,由于有32个过滤器,所以输出为 29×29×32 29 × 29 × 32 <script type="math/tex" id="MathJax-Element-85">29 \times 29 \times 32</script>。
5. 问题 5
你有一个15x15x8的输入,并使用“pad = 2”进行填充,填充后的尺寸是多少?
-
【 】 17x17x10
-
【
★
】 19x19x8 -
【 】 19x19x12
-
【 】 17x17x8
6. 问题 6
你有一个63x63x16的输入,有32个过滤器进行卷积,每个过滤器的大小为7x7,步幅为1,你想要使用“same”的卷积方式,请问pad的值是多少?
-
【 】 1
-
【 】 2
-
【
★
】 3 -
【 】 7
博主注:“same”的卷积方式就是卷积前后的大小不变,也就是63x63x16的输入进行卷积后的大小依旧为63x63x16,这需要我们对输入过来的数据进行填充处理。我们来看一下这个输出尺寸的公式(假设输入图像的宽、高相同): ⌊n+2p−fs+1⌋ ⌊ n + 2 p − f s + 1 ⌋ <script type="math/tex" id="MathJax-Element-86">\left \lfloor \frac{n + 2p - f}{s} + 1 \right \rfloor </script>,由此我们可以推出来 p p <script type="math/tex" id="MathJax-Element-87">p</script>的值: <script type="math/tex" id="MathJax-Element-88">p = \frac {s \times n - n - s + f}{2} = \frac{1 \times 63 - 63 -1 + 7}{2} = \frac{6}{2} = 3</script>。
7. 问题 7
你有一个32x32x16的输入,并使用步幅为2、过滤器大小为2的最大化池,请问输出是多少?
-
【 】 15x15x16
-
【 】 16x16x8
-
【
★
】 16x16x16 -
【 】 32x32x8
8. 问题 8
因为池化层不具有参数,所以它们不影响反向传播的计算。
-
【 】 正确
-
【
★
】 错误
博主注:由卷积层->池化层作为一个layer,在前向传播过程中,池化层里保存着卷积层的各个部分的最大值/平均值,然后由池化层传递给下一层,在反向传播过程中,由下一层传递梯度过来,“不影响反向传播的计算”这意味着池化层到卷积层(反向)没有梯度变化,梯度值就为0,既然梯度值为0,那么例如在 W[l]=W[l]−α×dW[l] W [ l ] = W [ l ] − α × d W [ l ] <script type="math/tex" id="MathJax-Element-89">W^{[l]} = W^{[l]} - \alpha \times dW^{[l]}</script>的过程中,参数 W[l]=W[l]−α×0 W [ l ] = W [ l ] − α × 0 <script type="math/tex" id="MathJax-Element-90">W^{[l]} = W^{[l]} - \alpha \times 0</script>,也就是说它不再更新,那么反向传播到此中断。所以池化层会影响反向传播的计算。
9. 问题 9
在视频中,我们谈到了“参数共享”是使用卷积网络的好处。关于参数共享的下列哪个陈述是正确的?(检查所有选项。)
-
【 】 它减少了参数的总数,从而减少过拟合。
-
【
★
】 它允许在整个输入值的多个位置使用特征检测器。 -
【 】 它允许为一项任务学习的参数即使对于不同的任务也可以共享(迁移学习)。
-
【
★
】 它允许梯度下降将许多参数设置为零,从而使得连接稀疏。
10. 问题 10
在课堂上,我们讨论了“稀疏连接”是使用卷积层的好处。这是什么意思?
-
【 】 正则化导致梯度下降将许多参数设置为零。
-
【 】 每个过滤器都连接到上一层的每个通道。
-
【
★
】 下一层中的每个激活只依赖于前一层的少量激活。 -
【 】 卷积网络中的每一层只连接到另外两层。
Week 1 quiz - The basics of ConvNets
1. Question 1
What do you think applying this filter to a grayscale image will do?
⎡⎣⎢⎢⎢01101331−1−3−3−10−1−10⎤⎦⎥⎥⎥ [ 0 1 − 1 0 1 3 − 3 − 1 1 3 − 3 − 1 0 1 − 1 0 ] <script type="math/tex" id="MathJax-Element-91"> \begin{bmatrix} 0 & 1 & -1 & 0 \\ 1 & 3 & -3 & -1 \\ 1 & 3 & -3 & -1 \\ 0 & 1 & -1 & 0 \end{bmatrix}</script>
-
[ ] Detect 45 degree edges
-
[x] Detect vertical edges
-
[ ] Detect horizontal edges
-
[ ] Detect image contrast
Because the left part is positive, and the right part is negative.
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
-
[x] 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
-
[x] 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?
-
[x] 29x29x32
-
[ ] 16x16x32
-
[ ] 29x29x16
-
[ ] 16x16x16
n = 63, f = 7, s = 2, p = 0, 32 filters.
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)?
-
[ ] 17x17x10
-
[x] 19x19x8
-
[ ] 19x19x12
-
[ ] 17x17x8
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
-
[x] 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
-
[x] 16x16x16
-
[ ] 32x32x8
8. Question 8
Because pooling layers do not have parameters, they do not affect the backpropagation (derivatives) calculation.
-
[ ] True
-
[x] False
Go to this page for further information.
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 reduces the total number of parameters, thus reducing overfitting.
-
[x] 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).
-
[x] It allows gradient descent to set many of the parameters to zero, thus making the connections sparse.
10. Question 10
In lecture we talked about “sparsity of connections” as a benefit of using convolutional layers. What does this mean?
-
[ ] Regularization causes gradient descent to set many of the parameters to zero.
-
[ ] Each filter is connected to every channel in the previous layer.
-
[x] Each activation in the next layer depends on only a small number of activations from the previous layer.
-
[ ] Each layer in a convolutional network is connected only to two other layers
更多推荐
所有评论(0)