Deep Learning · TEE · section
Faculty Assignment2 Q6 · 64×64 two-convolution CNN
Faculty Assignment 2 · worked practice
Question
Question. Input64×64×3; conv5,16valid; pool2stride2; conv3,32same; pool2stride2; dense128; output10. Find shapes and parameters. (Faculty assignment: no marks printed)
Answer — step by step
Given
Input=[64, 64, 3]
| Layer | Kernel | Stride | Padding | Filters / units |
|---|---|---|---|---|
| Conv | 5 | 1 | 0 | 16 |
| Pool | 2 | 2 | 0 | 0 |
| Conv | 3 | 1 | 1 | 32 |
| Pool | 2 | 2 | 0 | 0 |
| Dense | 0 | 0 | 0 | 128 |
| Dense | 0 | 0 | 0 | 10 |
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×0−5)/1⌋+1=60; parameters=(5×5×3+1)×16=1216 | 60×60×16 | 1216 |
| Pool | 60×60×16 | ⌊(60−2)/2⌋+1=30; channels stay 16; no trainable weights | 30×30×16 | 0 |
| Conv | 30×30×16 | ⌊(30+2×1−3)/1⌋+1=30; parameters=(3×3×16+1)×32=4640 | 30×30×32 | 4640 |
| Pool | 30×30×32 | ⌊(30−2)/2⌋+1=15; channels stay 32; no trainable weights | 15×15×32 | 0 |
| Dense | 15×15×32 | Flatten/input length=15×15×32=7200; parameters=(7200+1)×128=921728 | 128 | 921728 |
| Dense | 1×1×128 | Flatten/input length=1×1×128=128; parameters=(128+1)×10=1290 | 10 | 1290 |
Step 2. Sum only trainable parameters
1216 + 4640 + 921728 + 1290 = 928874
Final answer
Total parameters=928874. Shape and parameter count are separate results.