CS计算机代考程序代写 deep learning Keras Tutorial Questions | Week 5

Tutorial Questions | Week 5
COSC2779 – Deep Learning

This tutorial is aimed at reviewing convolutions in deep learning. Please try the questions before
you join the session.

1. What is the output of the following convolution operation?

5 5 5 5 5 5 5
5 5 5 5 5 5 5
1 1 5 5 5 5 5
1 1 1 1 5 5 5
1 1 1 1 5 5 5
1 1 1 1 1 1 1
1 1 1 1 1 1 1

1 1 1

0 0 0

−1 −1 −1

∗ =

Solution:

5 5 5 5 5 5 5
5 5 5 5 5 5 5
1 1 5 5 5 5 5
1 1 1 1 5 5 5
1 1 1 1 5 5 5
1 1 1 1 1 1 1
1 1 1 1 1 1 1

1 1 1

0 0 0

−1 −1 −1

∗ =

8 4 0 0 0

12 12 8 4 0

4 8 8 4 0

0 0 4 8 12

0 0 4 8 12

2. What is the output of Pooling the following input with 3×3 max-pooling with stride 2?

1 6 2 8 1 2 7
1 6 2 8 1 2 5
0 5 8 1 5 7 1
1 7 1 3 5 8 0
5 2 4 4 5 8 4
8 2 3 7 3 8 2
1 2 3 6 5 9 6

Solution:

1 6 2 8 1 2 7
1 6 2 8 1 2 5
0 5 8 1 5 7 1
1 7 1 3 5 8 0
5 2 4 4 5 8 4
8 2 3 7 3 8 2
1 2 3 6 5 9 6

8 8 7

8 8 8

8 7 8

3. Calculate the output shape at the end of each layer and the number of parameters for the following network.

model = tf.keras.Sequential()
model.add(Conv2D(6, kernel_size=(5, 5), strides=(1, 1), activation=’tanh’, input_shape=(32,32,1),

padding=”valid”))
model.add(AveragePooling2D(pool_size=(2, 2), strides=(2, 2), padding=’valid’))
model.add(Conv2D(16, kernel_size=(5, 5), strides=(1, 1), activation=’tanh’, padding=’valid’))

model.add(AveragePooling2D(pool_size=(2, 2), strides=(2, 2), padding=’valid’))
model.add(Flatten())
model.add(Dense(120, activation=’tanh’))
model.add(Dense(84, activation=’tanh’))
model.add(Dense(10, activation=’softmax’))

Solution:

4. Calculate the receptive field of the second convolution layer of the above network.

Solution: 14×14

5. Calculate the receptive field of the second convolution layer of the above network if the Dilation of first
convolution layer was set to 2?

Solution: 18×18

Page 2