Deep Learning · TEE · section

R24 Q1d

Re examination February 2024 fully solved

Question

Question (5 marks). For feature map Matrix 1 shown below, find max and average pooling with 2 × 2 windows, stride 2.

Given matrices for this question Tap the diagram to enlarge.

Answer — step by step

Given

For feature map Matrix 1 shown below, find max and average pooling with 2 × 2 windows, stride 2.

To find

Find the requested pooled output(s).

Formula — which one and why

Pooling. Max pooling selects the largest window entry. Average pooling adds its entries and divides by their count. Each channel is pooled separately.

V = current pooling window; n = number of entries in that window. Pooling learns no weights or biases.

y_{\max}=\max VLaTeX: y_{\max}=\max V
y_{\mathrm{avg}}=\frac1n\sum_{v\in V}vLaTeX: y_{\mathrm{avg}}=\frac1n\sum_{v\in V}v

Yaad rakhne ka cue: Max mein biggest; average mein total ÷ window ka count.

Solution — step by step

Shape: \left\lfloor\frac{4-2}{2}\right\rfloor+1LaTeX: \left\lfloor\frac{4-2}{2}\right\rfloor+1 = 2 on each axis; channels stay unchanged.

Pooling window (1,1)

Step 1: select the entries.

[21, 11, 12, 9]

Step 2: add all selected entries.

21 + 11 + 12 + 9 = 53

Step 3: divide by the 4 entries in this window.

53/4 = 13.25. Maximum = 21

Pooling window (1,2)

Step 1: select the entries.

[15, 10, 10, 11]

Step 2: add all selected entries.

15 + 10 + 10 + 11 = 46

Step 3: divide by the 4 entries in this window.

46/4 = 11.5. Maximum = 15

Pooling window (2,1)

Step 1: select the entries.

[11, 13, 7, 4]

Step 2: add all selected entries.

11 + 13 + 7 + 4 = 35

Step 3: divide by the 4 entries in this window.

35/4 = 8.75. Maximum = 13

Pooling window (2,2)

Step 1: select the entries.

[18, 12, 15, 12]

Step 2: add all selected entries.

18 + 12 + 15 + 12 = 57

Step 3: divide by the 4 entries in this window.

57/4 = 14.25. Maximum = 18

Average output: \begin{bmatrix}13.25 & 11.5\\8.75 & 14.25\end{bmatrix}LaTeX: \begin{bmatrix}13.25 & 11.5\\8.75 & 14.25\end{bmatrix}. Max output: \begin{bmatrix}21 & 15\\13 & 18\end{bmatrix}LaTeX: \begin{bmatrix}21 & 15\\13 & 18\end{bmatrix}. Pooling normally has zero trainable parameters and reduces spatial dimensions.