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]

LayerKernelStridePaddingFilters / units
Conv51016
Pool2200
Conv31132
Pool2200
Dense000128
Dense00010

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×0−5)/1⌋+1=60; parameters=(5×5×3+1)×16=121660×60×161216
Pool60×60×16⌊(60−2)/2⌋+1=30; channels stay 16; no trainable weights30×30×160
Conv30×30×16⌊(30+2×1−3)/1⌋+1=30; parameters=(3×3×16+1)×32=464030×30×324640
Pool30×30×32⌊(30−2)/2⌋+1=15; channels stay 32; no trainable weights15×15×320
Dense15×15×32Flatten/input length=15×15×32=7200; parameters=(7200+1)×128=921728128921728
Dense1×1×128Flatten/input length=1×1×128=128; parameters=(128+1)×10=1290101290

Step 2. Sum only trainable parameters

1216 + 4640 + 921728 + 1290 = 928874

Final answer

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