Deep Learning · TEE · section
R25 Q4a · 64×64 CNN shape and parameter table
February 2025 re-exam · complete solved paper
Question
Question. For input64×64×3: conv3×3,32filters,P1,S1; maxpool2×2,S2; conv3×3,64,P1,S1; pool2,S2; conv3×3,128,P1,S1; pool2,S2; FC256; softmax43. Find each shape and all weights/biases. (10 marks)
Answer — step by step
Given
Input=[64, 64, 3]
| Layer | Kernel | Stride | Padding | Filters / units |
|---|---|---|---|---|
| Conv | 3 | 1 | 1 | 32 |
| Pool | 2 | 2 | 0 | 0 |
| Conv | 3 | 1 | 1 | 64 |
| Pool | 2 | 2 | 0 | 0 |
| Conv | 3 | 1 | 1 | 128 |
| Pool | 2 | 2 | 0 | 0 |
| Dense | 0 | 0 | 0 | 256 |
| Dense | 0 | 0 | 0 | 43 |
To find
Each output shape and all trainable weights plus biases.
Formula: which one and why
O=\left\lfloor\frac{N+2P-F}{S}\right\rfloor+1P_{conv}=(F_hF_wC_{in}+1)C_{out},\quad P_{dense}=(n_{in}+1)n_{out}Each filter/unit has one bias. Pooling has zero learned parameters. Flatten preserves the number of values, then a dense layer connects every input value to every output unit.
Step 1. Work layer by layer
| Layer | Input | Full substitution and reason | Output | Parameters |
|---|---|---|---|---|
| Conv | 64×64×3 | ⌊(64+2×1−3)/1⌋+1=64; parameters=(3×3×3+1)×32=896 | 64×64×32 | 896 |
| Pool | 64×64×32 | ⌊(64−2)/2⌋+1=32; channels stay 32; no trainable weights | 32×32×32 | 0 |
| Conv | 32×32×32 | ⌊(32+2×1−3)/1⌋+1=32; parameters=(3×3×32+1)×64=18496 | 32×32×64 | 18496 |
| Pool | 32×32×64 | ⌊(32−2)/2⌋+1=16; channels stay 64; no trainable weights | 16×16×64 | 0 |
| Conv | 16×16×64 | ⌊(16+2×1−3)/1⌋+1=16; parameters=(3×3×64+1)×128=73856 | 16×16×128 | 73856 |
| Pool | 16×16×128 | ⌊(16−2)/2⌋+1=8; channels stay 128; no trainable weights | 8×8×128 | 0 |
| Dense | 8×8×128 | Flatten/input length=8×8×128=8192; parameters=(8192+1)×256=2097408 | 256 | 2097408 |
| Dense | 1×1×256 | Flatten/input length=1×1×256=256; parameters=(256+1)×43=11051 | 43 | 11051 |
Step 2. Sum only trainable parameters
896 + 18496 + 73856 + 2097408 + 11051 = 2201707
Final answer
Total parameters=2201707. Shape and parameter count are separate results.