0% found this document useful (0 votes)
350 views15 pages

Deep Learning For Beginners Mock Exam PDF

1. The document is a mock exam for a deep learning for beginners course given by Prof. Dr.-Ing. Andreas Maier in September 2021. 2. The exam contains multiple choice and short answer questions about topics in deep learning including perceptrons, neural networks, backpropagation, overfitting, and convolutional neural networks. 3. Students are instructed to complete the exam without electronic aids in 60 minutes and are reminded to show their work legibly and stick to the number of answers requested.

Uploaded by

Natalie B
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
350 views15 pages

Deep Learning For Beginners Mock Exam PDF

1. The document is a mock exam for a deep learning for beginners course given by Prof. Dr.-Ing. Andreas Maier in September 2021. 2. The exam contains multiple choice and short answer questions about topics in deep learning including perceptrons, neural networks, backpropagation, overfitting, and convolutional neural networks. 3. Students are instructed to complete the exam without electronic aids in 60 minutes and are reminded to show their work legibly and stick to the number of answers requested.

Uploaded by

Natalie B
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Deep Learning for Beginners Prof. Dr.-Ing.

Andreas Maier Pattern


Recognition
DLB - Mock exam September 29, 2021 Lab

Deep Learning for Beginners Exam

Full Name*
Matriculation Number*
Course of Studies*

ˆ You have 60 minutes to finish the exam.


ˆ You are not allowed to use any electronic auxiliaries including calculators. If you have
complex mathematical expressions, you may leave the fractions, logarithms, exponen-
tials, etc. as is without having to calculate the exact numerical value.
ˆ The space below each question should be sufficient to write down your answer (more
paper is available on demand).
ˆ Please keep your handwriting legible and stick to the number of answers asked for.
Illegible, ambiguous and multiple answers will be not graded.
Use a permanent marker!
ˆ Students who registered with “MeinCampus” can check their results after grading there.
All others will be notified by the e-mail address linked with the StudOn course access.

 You can send me e-mails for upcoming events and open positions to the following
e-mail address** :

I have read all the information above and entered required data truthfully:
Signature
*
This data is required to identify you for the grading process.
**
This entry is optional and has no effect on the exam whatsoever. Only fill it in if you want to be put on a mailing
list from our lab.

1
Deep Learning for Beginners Prof. Dr.-Ing. Andreas Maier Pattern
Recognition
DLB - Mock exam September 29, 2021 Lab

1 Multiple Choice Questions

For each of the following questions, mark all choices that apply. Each question has AT LEAST one correct
option unless otherwise stated. No explanation is required.
Question 1.1 1 P.
Can the XOR Problem be solved by a single layer Perceptron?

 Yes

 No, you need at least one hidden layer

 No, you need at least two hidden layers

 Only solvable with Support Vector Machines and not with Multilayer Perceptrons

 It is not solvable with neural networks

Question 1.2 1 P.
The universal approximation theorem ...

 provides theoretical guarantees on how closely a multi-layer neural network with a single hidden layer
can approximate a certain class of functions.

 requires a non-linear activation function.

 requires the non-linearity to be a sigmoid function.

 tells us how to determine the weights that approximate a function.

 None of the above.

Question 1.3 1 P.
Which final activation function should be used for a multi-class problem (one-hot-encoded labels)?

 Softmax

 Sigmoid

 TanH

 ReLU

 LeakyReLU

2
Deep Learning for Beginners Prof. Dr.-Ing. Andreas Maier Pattern
Recognition
DLB - Mock exam September 29, 2021 Lab

Question 1.4 1 P.
What is the purpose of the backpropagation algorithm?

 It computes the forward pass and returns the output.

 It computes all gradients required for the optimization of the network.

 It makes sure the whole network is initialized and ready to be used.

 It makes sure there is enough memory available (RAM) on the machine.

 It computes the new constellation of weights (updated weights).

Question 1.5 1 P.
What is the purpose of the Momentum used in different optimizers?

 It is a trick to manipulate the learning rate to avoid exploding gradients.

 It stabilizes the training the gradient by averaging over multiple samples in a mini-batch.

 It stabilizes the training by computing the moving average over the previous gradients.

 It reduces the amount of memory required to perform an update.

 It is a measure to evaluate the stability of the training.

Question 1.6 1 P.
Why is the signum function not used in deep learning?

 It does not introduce a non-linearity.

 It is not partially differentiable.

 It does not produce probabilities.

 Its partial derivative is either 0 or undefined for all inputs.

 None of the above.

Question 1.7 1 P.
Which of the following approaches can be used to reduce overfitting?

 Data augmentation.

 Using batch gradient descent instead stochastic gradient descent (SGD).

 Dropout layers.

 Low learning rates.

 None of the above.

3
Deep Learning for Beginners Prof. Dr.-Ing. Andreas Maier Pattern
Recognition
DLB - Mock exam September 29, 2021 Lab

Question 1.8 0.5 P.


Which of the following statements is true about dropout?

 Dropout leads to sparsity in the trained weights.

 When dropout is used during training, it always causes a (small) increase in runtime during test time.

 The larger the keep probability, the larger the regularization effect.

 None of the above.

Question 1.9 1 P.
Which of the following statements about adversarial examples is true?

 An adversarial example can be a slightly perturbed version of an input that yields a completely different
prediction.

 They are generated by a generative adversarial networks (GAN).

 They cannot occur in real photographs.

 They also exist for other machine learning approaches, e.g., support vector machines (SVMs).

 None of the above.

4
Deep Learning for Beginners Prof. Dr.-Ing. Andreas Maier Pattern
Recognition
DLB - Mock exam September 29, 2021 Lab

2 Short Answers

For each of the following questions, answer briefly.


Question 2.1 1 P.
Name a function that models the all-or-nothing response of biological neurons.

Question 2.2 3 P.
During training of a network for the same task the three loss curves (a), (b), and (c) are observed, that
plot the loss over the number of iterations. Label whether the network was trained with SGD, mini-batch
gradient descent (MBGD) or batch gradient descent (BGD) (select one for each).

(a) (b) (c)

Question 2.3 1.5 P.


You see the following training (blue) and validation (red) curves. Mark positions where your network
underfits (A), overfits (B), and where it you expect it to generalize well on new data (C).

5
Deep Learning for Beginners Prof. Dr.-Ing. Andreas Maier Pattern
Recognition
DLB - Mock exam September 29, 2021 Lab

Question 2.4 2 P.
How do you have to set the padding on each side for a 2-D CONV layer to ensure that the output has the
same dimensions as the input? Describe np as a function of the filter width k. Assume a stride of 1.

Question 2.5 2 P.
You train a model with batch gradient descent that is supposed to differentiate images with apples and
with oranges, but you don’t get satisfactory performance. You inspect your training data and see that the
training data is not shuffled. Would it help to shuffle your training data? Explain your answer briefly.

Question 2.6 1 P.
You receive close-up images from shore regions and you are responsible for developing a system that auto-
matically classifies whether the current image contains trash or not. Assume that you have training data
with bounding-box annotations for each piece of trash. Briefly explain whether this is a form of weakly
supervised learning.

6
Deep Learning for Beginners Prof. Dr.-Ing. Andreas Maier Pattern
Recognition
DLB - Mock exam September 29, 2021 Lab

3 Activation Functions and Loss Functions

Imagine you are an employee for a software company that develops custom deep learning solutions. Your
manager gives you the task of developing a model that detects whether an image shows a horse or not. You
do not have to distinguish between one or many horses. Below are shown three example images of how the
data can look like.

(a) Horse: Yes, Dog: No (b) Horse: Yes, Dog: No (c) Horse: Yes, Dog: Yes

Figure 3: Three examples for input images

Question 3.1 1.5 P.


Is the given task a regression or a classification problem? Explain your answer. (1-2 sentences)

Question 3.2 1 P.
Which activation layer would be suitable to return the prediction of the model? (1 sentence)

Question 3.3 1.5 P.


Which of the loss functions presented in the lecture is well suited for this problem? Explain your answer.
(1-2 sentences)

7
Deep Learning for Beginners Prof. Dr.-Ing. Andreas Maier Pattern
Recognition
DLB - Mock exam September 29, 2021 Lab

Question 3.4 1 P.
Your manager further increases the complexity by the extending the problem as follows. In addition to the
horse prediction task, your model has to predict whether the given image contains a dog or not (like in
(c)). Both tasks, the horse prediction and the dog prediction need to be solved by the same model. Which
activation layer would be suitable to return the prediction of the model? (1 sentence)

Question 3.5 2 P.
For the samples in Figure 3, your model predicts the following output probabilities. Bases on these probabil-
ities, compute the prediction accuracy (threshold 0.5) for the class ”Horse” and the class ”Dog”, respectively.

Image p(Horse) p(Dog)


(a) 0.8 0.2
(b) 0.4 0.6
(c) 0.7 0.7

8
Deep Learning for Beginners Prof. Dr.-Ing. Andreas Maier Pattern
Recognition
DLB - Mock exam September 29, 2021 Lab

Question 3.6 4 P.
You are given the framework of the programming exercises 3, 4, 5 and 6. Implement the Tanh layer
(Tanh(x)) using only numpy and basic python operations. Your layer must contain a constructor init ,
a method forward(input tensor) and a method backward(error tensor). Note: The exact recall of
numpy functions is not required to pass the task. You may instead “define” a suitable function, in this case
document this accordingly.

import numpy as np

class Tanh:
def init (self ):
# your code here

def forward (self , input tensor ):


# your code here

def backward (self , error tensor ):


# your code here

9
Deep Learning for Beginners Prof. Dr.-Ing. Andreas Maier Pattern
Recognition
DLB - Mock exam September 29, 2021 Lab

4 Convolutional Neural Networks

Convolutional neural networks represent an important concept in deep learning and play an essential role
in image processing.
Question 4.1 2 P.
Name two properties that are exploited in convolutional neural networks, especially compared to fully
connected architectures.

Question 4.2 4 P.
Assume that you have the convolutional neural network architecture described in the table below. Fill out
the missing columns accordingly. CONV-a-b represents a 2-D convolutional with a kernel size of a × a and

Num Layer Input dimensions Number of weights Number of biases


1 Input 32 × 32 × 3 0 0
2 CONV-3-32 32 × 32 × 3 32 · 33 32
3 POOL-2 32 × 32 × 32 0 0
4 CONV-3-64 16 × 16 × 32 32 · 64 · 32 64
5 POOL-2
6 CONV-1-16
7 FLATTEN
8 FC-10

b output channels. POOL-2 represents an average pooling with a stride of 2 and a neighborhood size of
2 × 2. FC-c represents a fully connected layer with output size c. The input dimensions are always according
to the result of the previous layer. You can assume that “same” padding and a stride of 1 is used in the
CONV-layers.

Question 4.3 2 P.
What is the purpose of Layer 6 in the architecture defined in the table above? What is the benefit of having
this layer compared to skipping it? (2-3 sentences)

10
Deep Learning for Beginners Prof. Dr.-Ing. Andreas Maier Pattern
Recognition
DLB - Mock exam September 29, 2021 Lab

Question 4.4 2 P.
The network defined above is trained with images of size 32 × 32 and that has a flatten and fully connected
layers as the last layers in the network. You would like to reuse this pre-trained network for a related task
on a new data set with images of arbitrary size. How do you have to adapt the network architecture to be
able to process arbitrarily-sized images and still receive a vector of length 10 as output? (1-2 sentences)

Question 4.5 1 P.
What is the name of the method that re-uses pre-trained weights for related tasks?

11
Deep Learning for Beginners Prof. Dr.-Ing. Andreas Maier Pattern
Recognition
DLB - Mock exam September 29, 2021 Lab

5 Regularization

The fundamental goal of deep learning algorithms is to generalize beyond training sets.

Figure 4: Bias and variance

Question 5.1 2 P.
The center in the bull’s eye diagram in Figure 4 is the desired model result that correctly predicts all values.
The farther you get from the center, the more incorrect the predictions become. Label the figure for all four
models and record your answers in the boxes.

Question 5.2 2 P.
The tradeoff between bias and variance is associated with the terms ”overfitting” and ”underfitting.” Which
of the models shown in Figure 4 leads to overfitting and which leads to underfitting. Explained by specifying
the bias and variance for the two selected models.

12
Deep Learning for Beginners Prof. Dr.-Ing. Andreas Maier Pattern
Recognition
DLB - Mock exam September 29, 2021 Lab

Question 5.3 2 P.
Name two classical techniques that you can apply to your dataset to prevent overfitting and explain what
you need to consider.

Question 5.4 2 P.
To reduce overfitting, you train one network with l2 regularization and a second network with l1 regu-
larization. How do you expect the respective weights to behave compared to training a network without
normalization?

13
Deep Learning for Beginners Prof. Dr.-Ing. Andreas Maier Pattern
Recognition
DLB - Mock exam September 29, 2021 Lab

6 Segmentation and Object Detection

Segmentation and object detection are tasks that are frequently encountered in signal processing tasks.
Question 6.1 3 P.
Describe the goal of semantic segmentation and outline the differences to object detection and instance
segmentation. (approx. 3 sentences)

Given is the following neural network:


Note: All input tensors that are passed to the different layers shall be considered as numpy arrays.
import numpy as np

class Model ( NeuralNetwork ):

def init (self ):

super (Model , self ). init ()


””” D e f i n i t i o n o f v a r i a b l e s :
i n c h i s number o f i n p u t c h a n n e l s
o u t c h i s number o f o u t p u t c h a n n e l s
k is kernel size
s is stride
p i s padding
”””
# H i n t p=1 c o r r e s p o n d s t o ” same ” p a d d i n g , p=0 t o no p a d d i n g

self. conv1 = Conv2d ( in ch =3, out ch =16, k=3, s=1, p=1)

self. conv2 = Conv2d ( in ch =16, out ch =4, k=3, s=1, p=1)

self.pool = MaxPool2d (k=2, s=2)

self. t conv1 = ConvTranspose2d ( in ch =4, out ch =16, k=2, s=2, p=0)

self. t conv2 = ConvTranspose2d ( in ch =16, out ch =16, k=2, s=2, p=0)

self. outconv = Conv2d ( in ch =16, out ch =3, k=3, s=1, p=1)

14
Deep Learning for Beginners Prof. Dr.-Ing. Andreas Maier Pattern
Recognition
DLB - Mock exam September 29, 2021 Lab

def forward (self , x):


# H i n t : x i s a numpy a r r a y w i t h s h a p e ( B , C , H ,W)

conv1 = Relu(self.conv1(x))

pool1 = self.pool(conv1)

conv2 = Relu(self.conv2(pool1 ))

pool2 = self.pool(conv2)

upconv1 = Relu(self. t conv1 (pool2 ))

upconv2 = Relu(self. t conv2 ( upconv1 ))

outconv = self. outconv ( upconv2 )

return outconv

Question 6.2 1 P.
The kind of above architecture can be applied in the field of unsupervised learning to learn self-representation.
What are these architectures called in this case?

Question 6.3 1 P.
For above architecture: given an input of shape 1 × 3 × 256 × 256, what shape does the output have?

Question 6.4 1 P.
The architecture shown in Model is similar to the U-net architecture used in many medical image processing
tasks but is missing one key concept. What is the name of this concept?

Question 6.5 5 P.
Convert the architecture shown in Model to an U-Net by modifying/extending the code above.
Note: The exact recall of numpy functions is not required to pass the task. Please add documentation to
self defined functions.

15

You might also like