Assume we have a $5\times5$ px RGB image with 3 channels respectively for R, G, and B. If
R
2 |
0 |
0 |
0 |
0 |
1 |
2 |
0 |
0 |
1 |
2 |
0 |
1 |
0 |
2 |
1 |
2 |
1 |
0 |
1 |
0 |
1 |
0 |
2 |
0 |
G
0 |
2 |
1 |
2 |
2 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
2 |
2 |
0 |
2 |
0 |
0 |
2 |
0 |
0 |
2 |
1 |
1 |
1 |
B
0 |
1 |
0 |
0 |
1 |
1 |
1 |
2 |
0 |
1 |
1 |
0 |
2 |
0 |
2 |
1 |
0 |
1 |
1 |
0 |
1 |
2 |
1 |
1 |
2 |
We have one $3\times3$ px kernel (filter) with 3 channels as follows:
Filter - R
0 |
0 |
1 |
1 |
0 |
1 |
1 |
0 |
0 |
Filter - G
0 |
0 |
-1 |
1 |
0 |
0 |
1 |
-1 |
0 |
Filter - B
1 |
0 |
1 |
0 |
1 |
-1 |
1 |
-1 |
0 |
a) If Stride = 2, and Zero-padding = 1, and Bias = 1, what will be the result of convolution?
b) What is the result after applying a ReLU layer ($max(z,0)$)on the result with the same size of the reuslt in part a?
c) Calculate the output by applying max-pooling layer with the size of $2\times2$ on the output of part b, and Stride = 1. (hint: max-pooling layer here and usually do not include any zero-paddings)
d) What is the result after applying flatten on the output of part c and creating a vector?
e) Assume the vector you created contains m elements. Consider it as the input vector for a Softmax Regression classifier (without any hidden layers and biases and it is fully connected). Assume there are 2 classes of 0 and 1. For all the weights from each element in the feature vector, the optimized weights are 1 for odd elements and 2 for even elements. For example, if the feature vector is [10,11,12,13,14], all the weights from 10 are 1 (because 10 is element 1 and 1 is odd), all the weights from 11 are 2, all the weights from 12 are 1, all the weights from 13 are 2 and all the weights from 14 are 1 and so on. Draw the Softmax Regression network and calculate the class should be 0 or 1?
Hint:
Softmax Regression: $p_{i}=\frac{e^{z_{i}}}{\sum_{i=1}^{c} e^{z_{i}}}$
Where $p_{i}$ is the probability of class $i$ anc $c$ is the number of classes.