Deep Learning · TEE · section

R23 Q1b

Re examination January 2023 fully solved

Question

Question (4 marks). Apply 3 × 3 average pooling with stride 2 to Matrix 1 shown below. Give the output and justify pooling.

Given matrices for this question Tap the diagram to enlarge.

Answer — step by step

Given

Apply 3 × 3 average pooling with stride 2 to Matrix 1 shown below.

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{5-3}{2}\right\rfloor+1LaTeX: \left\lfloor\frac{5-3}{2}\right\rfloor+1 = 2 on each axis; channels stay unchanged.

Pooling window (1,1)

Step 1: select the entries.

[1, 2, 3, 5, 3, 4, 7, 4, 8]

Step 2: add all selected entries.

1 + 2 + 3 + 5 + 3 + 4 + 7 + 4 + 8 = 37

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

37/9 = 4.111111111

Pooling window (1,2)

Step 1: select the entries.

[3, 2, 5, 4, 6, 3, 8, 5, 9]

Step 2: add all selected entries.

3 + 2 + 5 + 4 + 6 + 3 + 8 + 5 + 9 = 45

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

45/9 = 5

Pooling window (2,1)

Step 1: select the entries.

[7, 4, 8, 8, 5, 10, 9, 10, 3]

Step 2: add all selected entries.

7 + 4 + 8 + 8 + 5 + 10 + 9 + 10 + 3 = 64

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

64/9 = 7.111111111

Pooling window (2,2)

Step 1: select the entries.

[8, 5, 9, 10, 4, 2, 3, 4, 3]

Step 2: add all selected entries.

8 + 5 + 9 + 10 + 4 + 2 + 3 + 4 + 3 = 48

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

48/9 = 5.333333333

Average output: \begin{bmatrix}4.111111111 & 5\\7.111111111 & 5.333333333\end{bmatrix}LaTeX: \begin{bmatrix}4.111111111 & 5\\7.111111111 & 5.333333333\end{bmatrix}. Pooling normally has zero trainable parameters and reduces spatial dimensions.