ECE 515 Image Analysis & Computer Vision II Spring 2021
HW # 6
Turn in solutions to problems 1-3. Due 11:59 PM Thursday, 04/29.
Solutions to practice problems are not to be submitted.
1. In this problem we consider the processing of an image using a convoltion operation
with a simple 3x1 kernel. Image I shown below is applied to a filter with impulse
response h = [-1 0 1] followed by a ReLU nonlinearity, where
ReLU(x) = max(x, 0), x ∈ R
0 0 0 50 50 50 50 50 50 0 0 0
0 0 0 50 50 50 50 50 50 0 0 0
0 0 0 50 50 50 50 50 50 0 0 0
0 0 0 50 50 50 50 50 50 0 0 0
0 0 0 50 50 50 50 50 50 0 0 0
0 0 0 50 50 50 50 50 50 0 0 0
0 0 0 50 50 50 50 50 50 0 0 0
0 0 0 50 50 50 50 50 50 0 0 0
Image I h = -1 0 1
Use zero padding so that the output is of the same size as the input image (note that
zero-padding will be needed in only one of the two dimensions). Also assume a stride
of 1.
(a) Determine the output image.
(b) Explain what kind of processing using the above operations is performed, in terms
of edges, on the input image.
2. In this problem we will examine the number of parameters used in a neural network
and the input-output volumes of a convolutional layer in a CNN.
(i) Consider a neural network where the input feature vector has 50 entries. There are
two hidden layers. The first hidden layer has 50 neurons followed by a hidden layer
with 20 neurons. The classifier maps inputs into 10 classes. Determine the number of
parameters (wights and biases) in the network.
(ii) In a CNN, the input to a convolutional layer has width 30, height 40, and depth 20.
The convolutional layer uses 10 filters of size 5× 5 with a stride of 2 and zero padding
of P = 2 on all sides of the image.
(a) Determine the width, height, and depth, of the output of the convolutional layer.
(b) What is the depth of each of the filters used in this convolutional layer?
3. This is a simple exercise in computing the output in a binary classifier that contains
convluition, max-pooling, and fully connected (neural network) layers. The image shown
below is applied to a filter with impulse response (kernel)0 1 01 0 1
0 1 0

1
0 1 0 0 0
0 0 1 0 0
0 1 0 -1 0
0 1 1 0 -1
0 -1 0 -1 0
Image I
A stride of 1 is used in filtering and with zero padding so that the output is of the same
size as the input image. The output of the filter is applied to tanh(.) nonlinearity and
then to a max-pooling layer with a 3× 3 window, a stride of 2, and no zero padding.
The max-pooling layer output is flattened to get a vector X = [X1, X2, . . . , XN ] of size
N . X is applied to a signle layer neural network (fully connected) for classification as
shown in the figure below (with no bias term):
2
×

then to a max-pooling layer with a 3 3 window and stride 2.
Determine the output image.

The Output image is applied to a single layer perceptron network for classification as
shown in the figure below:

Where,
() =
1
1+−
is the sigmoid function. and = √
2
_ −1
is the weight of
the single layer network.

Predict to which class does the output image belongs if you know that the predicted
output = {
0, < 0.5
1, ≥ 0.5

Practice problems:
4. The image shown below is applied to a filter with impulse response [ 0.2 0.2]T followed
by a tanh nonlinearity.
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
50 50 50 50 50 50 50 50 50 50 50 50
50 50 50 50 50 50 50 50 50 50 50 50
50 50 50 50 50 50 50 50 50 50 50 50
50 50 50 50 50 50 50 50 50 50 50 50
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
Image I
Assume no zero padding so that the output is computed using only the samples of the
given image without using any pixel values outside the extent of the given image.
(a) Determine the output image.
(b) What is the size of the output image.
5. Consider the use of a neural network in image classification
(a) Briefly explain what is overfitting in a neural network and a possible cause of over-
fitting.
(b) Explain what is underfitting.

X1
X2
XN

1
2

where σ(x) = 1
1+e−x and wi =

2.N−i+1.
(a) Determine the output of the max-pooling layer.
(b) Predict the class to which the input image belongs given the binary prediction
output classes defined by
y = 0.1(σ < 0.5) + 1(σ ≥ 0.5) =
{
0 if σ < 0.5
1 if σ ≥ 0.5
Practice problems:
4. The image shown below is applied to a filter with impulse response [−0.2 0.2]T followed
by a tanh nonlinearity.
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
50 50 50 50 50 50 50 50 50 50 50 50
50 50 50 50 50 50 50 50 50 50 50 50
50 50 50 50 50 50 50 50 50 50 50 50
50 50 50 50 50 50 50 50 50 50 50 50
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
Image I
Assume no zero padding so that the output is computed using only the samples of the
given image without using any pixel values outside the extent of the given image.
(a) Determine the output image.
(b) What is the size of the output image.
5. Consider the use of a neural network in image classification
(a) Briefly explain what is overfitting in a neural network and a possible cause of over-
fitting.
(b) Explain what is underfitting.
6. Consider the use of a CNN in image classification
(a) Briefly explain how hyperparameters are adjusted during validation.
(b) Explain whether you would adjust the hyperparameters during testing.
2
7. Consider a sigmoidal nonlinearirt σ() given by
σ(x) =
1
1 + e−x
, x ∈ R
(a) Find the derivative dσ(x)
dx
and express it in terms of σ(x).
(b) Find the maximum value of dσ(x)
dx
.
(c) Find x0 (> 0) and σ(x0) if
dσ(x)
dx
at x = x0 is 0.09.
3