Saral Shiksha Yojna
Courses/Computer Vision

Computer Vision

CSE471
Prof. Makarand Tapaswi + Prof. Charu SharmaSpring 2025-264 credits

CNN Concepts + Architectures — LeNet to EfficientNet, BN, 1×1, Dilation, Receptive Field

NotesStoryCaveman
Unit 4 — Convolutional Neural Networks (CNNs)

Ugg teach flat rock how to see

Long ago Ugg try teach big FLAT net to see. Picture , three color, all dot wired to 1000 answer = about million shiny stone for ONE layer. Too heavy to carry! And flat net dumb: cat in top-left corner and cat in bottom-right corner share NO evidence — two different beast to it. Bad hunt.

Why stamp-rock beat flat net

Convolution — Ugg take small stamp-rock (say ), slide over WHOLE picture, press-press, make new picture (feature map). Same stamp every spot. This called weight sharing — one stamp, all places. Two magic fall out:

Few stone — stamp no care how big picture, so cut stone about vs flat net. And translation equivariance: . Mean: Ugg move mammoth in picture, its mark move the SAME way in feature map.

Stack many stamp-layer. Low layer see edge. Next see texture. Next see part. Top see whole beast. Simple stack grow into deep hunter.

Numbers tribe must carve in stone

Conv params — how much stone one layer eat:

= stamp count, = stamp size, = color-in, the = bias. Ugg WARN: this NOT depend on picture width or height — only stamp and color!

Output size — how big new picture come out:

= padding (edge-stuffing), = stride (jump size). Use FLOOR rock — round DOWN, no round up.

Same padding (output size = input size, odd stamp): . Stamp 3 → pad 1, stamp 5 → pad 2, stamp 7 → pad 3. Valid padding () shrink picture by .

Receptive field — the patch of first picture that touch one output dot. Stack stamp of at stride 1: . Every stride-2 squish DOUBLE the reach. Deep tribe see whole mammoth with tiny stamp — no giant stamp needed.

Two small rock beat one big rock

Two stack = same reach as one (both reach 5). But stone: small-way vs big-way — save ~28% AND get free extra bend (ReLU) in the middle. Three = reach, vs . This why VGG tribe use ONLY .

Tiny 1×1 rock — four job

1×1 convolution — stamp size one. No mix space, only mix color. Four job:(1) bottleneck — drop color cheap BEFORE costly /.(2) inject bend (little per-dot brain).(3) mix color across channel.(4) cheap — only stone. Ugg WARN: in Inception, 1×1 go BEFORE the big stamp, not after!

Squish-rock — no stone at all

Pooling shrink picture. Max-pool keep the biggest — robust to small wiggle, favorite for naming. Avg-pool take the middle. Global Average Pooling (GAP) squash whole down to one dot, replace the giant flat tail (ResNet do this; VGG carry heavy flat tail). Ugg WARN: pool have ZERO learn-stone — it only shrink work (FLOPs), no weights! Backward: max send gradient only to the biggest spot; avg spread equal (). Other WARN: GAP throw away WHERE — fine for naming, deadly for pixel-map (segmentation) that need spatial.

Spread-out stamp — see wide, stay cheap

Dilated (atrous) convolution — poke hole between stamp teeth. Effective stamp = . So with reach like but use only 9 stone. Good for segmentation (DeepLab: keep resolution, grow reach) and cave-sound (WaveNet). Ugg WARN: big make GRIDDING — neighbor dot sample different pixel, leave gaps. Fix: stack dilation like , not .

Split the stamp for phone-tribe

Depthwise-separable convolution — cut normal stamp in two: depthwise ( on each color ALONE) then pointwise ( to mix color). Stone = , ratio — about cheaper at . This the MobileNet magic. Ugg WARN: it is depthwise + POINTWISE, NOT depthwise + !

Wash the numbers clean

Batch Normalisation — wash each color across the axes:

Mean: subtract batch-middle, divide by spread, then learn scale and shift — one pair PER COLOR (length ), NOT per spatial spot (common trap!). Effect: train fast, allow big step, less fussy on start-weights. Ugg WARN: at hunt-time (inference) use the RUNNING middle/spread from training, NOT this batch! And batch-of-1 no work — use GroupNorm or LayerNorm (LayerNorm also feed the ViT tribe).

Move-same vs no-care

Equivariance: — output MOVE when input move; feature maps do this. Invariance: — output NO change when input move; after GAP + flat + softmax, the final answer do this. NOT the same thing! Ugg WARN: CNN handle shift fine, but NOT turn — kernels are LEARNED, not turn-symmetric. Fix with rotation-augment or G-CNN.

The great hunt lineage

  • LeNet (LeCun, 1989/98) — first stamp-net to work. ~60k stone, read hand digit.
  • AlexNet (2012) — start the fire! 60M stone, 8 layer, 2 GPU. Bring ReLU (fast, but WARN: dead-ReLU if pre-activation always negative — use Leaky/ELU/GELU), dropout (), augment. Won ILSVRC-2012 big.
  • VGG (2014) — all , deep. VGG-19: 143.7M stone (mostly flat tail), top-1 74.2%.
  • Inception / GoogLeNet (2014) — parallel branch of many stamp size, 1×1 bottleneck BEFORE costly stamp. v3: 27.2M, 77.3%.
  • ResNet (2015) — the big one. skip. Fix deep-net ROT (plain net past ~20 layer get WORSE — optimize fail, not overfit). Gradient — the mean gradient never die. ResNet-50: 25.6M, 76.1% — the workhorse. WARN: skip ADD to , not replace it!
  • DenseNet (2016) — — glue ALL past outputs (concatenate, NOT add).
  • SENet (2017) — channel attention: GAP → little brain → sigmoid → scale each color. +1% top-1, near-free.
  • MobileNet (2017) — depthwise-separable all over. 4.2M, ~70%, for phone. (v2 add inverted residual — that is v2, NOT v1!)
  • EfficientNet (2019) — compound scaling: grow depth, width, resolution TOGETHER by one dial: with . B0: 5.3M, 77.7%.

Walk backward through the layers

Quick backward-grunts: conv backward = conv with FLIPPED stamp (for ), and input-cross-correlate-gradient for . Max-pool send gradient to the argmax spot ONLY. Avg-pool spread it . ReLU is a gate — pass gradient if forward was , else 0. Skip send gradient through → no vanish.

Moving picture and cave sound

Video: C3D use 3D stamp , trained from scratch, costly. I3D INFLATE a 2D ImageNet stamp along time and divide by (so a still-picture-repeated gives the SAME mark → free ImageNet pretrain). Ugg WARN: I3D inflate, C3D from scratch — no mix up! SlowFast = slow path (low fps, many channel = meaning) + fast path (high fps, few channel = motion). Sound: 1D CNN on raw wave (WaveNet dilated), or 2D CNN on spectrogram picture (frequency has spatial structure).

Ugg remember

  • **Conv stone , NO care about ** — weight sharing is the whole magic. Pool has ZERO stone.
  • **Output **, same-pad , reach of stacked is . Two beat one (fewer stone + extra bend).
  • **ResNet skip ** gives gradient → no vanish → deep net trains. ADD, not replace.
  • **Depthwise-separable ~ cheaper**; 1×1 for bottleneck; dilated widens reach cheap; BN washes per channel and uses RUNNING stats at inference.
  • Equivariance (feature map) ≠ invariance (after pool), and CNN sees shift but NOT rotation.
End of storyUnit 4 — Convolutional Neural Networks (CNNs) · CNN Concepts + Architectures — LeNet to EfficientNet, BN, 1×1, Dilation, Receptive Field