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]

LayerKernelStridePaddingFilters / units
Conv31132
Pool2200
Conv31164
Pool2200
Conv311128
Pool2200
Dense000256
Dense00043

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+1LaTeX: O=\left\lfloor\frac{N+2P-F}{S}\right\rfloor+1
P_{conv}=(F_hF_wC_{in}+1)C_{out},\quad P_{dense}=(n_{in}+1)n_{out}LaTeX: P_{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

LayerInputFull substitution and reasonOutputParameters
Conv64×64×3⌊(64+2×1−3)/1⌋+1=64; parameters=(3×3×3+1)×32=89664×64×32896
Pool64×64×32⌊(64−2)/2⌋+1=32; channels stay 32; no trainable weights32×32×320
Conv32×32×32⌊(32+2×1−3)/1⌋+1=32; parameters=(3×3×32+1)×64=1849632×32×6418496
Pool32×32×64⌊(32−2)/2⌋+1=16; channels stay 64; no trainable weights16×16×640
Conv16×16×64⌊(16+2×1−3)/1⌋+1=16; parameters=(3×3×64+1)×128=7385616×16×12873856
Pool16×16×128⌊(16−2)/2⌋+1=8; channels stay 128; no trainable weights8×8×1280
Dense8×8×128Flatten/input length=8×8×128=8192; parameters=(8192+1)×256=20974082562097408
Dense1×1×256Flatten/input length=1×1×256=256; parameters=(256+1)×43=110514311051

Step 2. Sum only trainable parameters

896 + 18496 + 73856 + 2097408 + 11051 = 2201707

Final answer

Total parameters=2201707. Shape and parameter count are separate results.