📝 Chapter 11: Computer Vision — Quick-Revision Notes

A compact cheatsheet covering every major topic in the Computer Vision chapter. Use this for last-minute revision before GATE DA.

1. Image Fundamentals

ConceptDetail
Grayscale imageH × W matrix, values 0–255
RGB imageH × W × 3 tensor (Red, Green, Blue)
RGBAH × W × 4 (+ Alpha transparency channel)
RGB → GrayY = 0.299R + 0.587G + 0.114B
HSVHue, Saturation, Value — colour-based segmentation
YCbCrLuminance + chrominance — JPEG compression
Batch tensor (PyTorch)(N, C, H, W)

2. Convolution & Pooling Formulas

FormulaExpression
Conv output sizeO = ⌊(n − k + 2p) / s⌋ + 1
Same padding (stride 1)p = (k − 1) / 2
Pooling output sizeO = ⌊(n − k) / s⌋ + 1
Transposed conv outputO = (n − 1) × s − 2p + k
Dilated effective kernelkeff = k + (k − 1)(r − 1)
Conv layer paramsCout × (Cin × k² + 1)
FC layer paramsnout × (nin + 1)
Receptive field (stride=1)RF = 1 + ∑(kl − 1)
Depthwise separable paramsCin × k² + Cin × Cout

Common kernels: Sobel (edge), Box blur (1/9 all-ones), Gaussian blur, Sharpen (centre = 5, cross = −1), Laplacian (centre = −4).

3. CNN Architecture Quick Reference

ModelYearParamsKey Innovation
LeNet-51998~60KFirst practical CNN (MNIST)
AlexNet2012~60MReLU, Dropout, GPU, data augmentation
VGG-162014138MUniform 3×3 filters, deep
GoogLeNet20145MInception module, 1×1 bottleneck, GAP
ResNet-50201525.6MResidual connections (y = F(x) + x)
DenseNet20178MDense connectivity, growth rate k
MobileNet20174.2MDepthwise separable conv (~8× saving)
EfficientNet20195.3MCompound scaling (α · β² · γ² ≈ 2)

VGG insight: Three 3×3 convs have same RF as one 7×7 but only 27C² vs 49C² params + 3 non-linearities.

ResNet insight: Skip connections create gradient highways; learning F(x) = 0 is easier than H(x) = x.

4. Object Detection

ConceptFormula / Detail
IoU|A ∩ B| / |A ∪ B|; TP if IoU ≥ 0.5
NMSSort by confidence; keep top; remove IoU > thresh; repeat
mAPMean of per-class AP (area under P-R curve)
PrecisionTP / (TP + FP)
RecallTP / (TP + FN)

Detector Evolution

ModelTypeKey Feature
R-CNNTwo-stageSelective Search + CNN per region
Fast R-CNNTwo-stageShared features + RoI Pooling
Faster R-CNNTwo-stageRPN replaces Selective Search
YOLOOne-stageS×S grid; output = S×S×(B×5+C)
SSDOne-stageMulti-scale feature maps, default boxes

Two-stage: More accurate, slower. One-stage: Faster, real-time capable.

5. Image Segmentation

TypeOutputExample Model
SemanticPer-pixel class labelFCN, DeepLab
InstancePer-object mask + classMask R-CNN
PanopticSemantic + instance IDs for thingsPanoptic FPN

Key Models

  • FCN: 1×1 conv replaces FC layers; variants FCN-32s, -16s, -8s
  • U-Net: Encoder-decoder + skip concatenation; dominant in medical imaging
  • DeepLab: Atrous/dilated conv + ASPP; v3+ adds decoder for sharp boundaries
  • Mask R-CNN: Faster R-CNN + mask head + RoI Align (bilinear, no quantisation)

Metrics

MetricFormula
Pixel Accuracy∑ pii / ∑∑ pij
mIoU(1/C) ∑ TPc/(TPc+FPc+FNc)
Dice coefficient2TP / (2TP + FP + FN)

6. Generative Models

ModelKey IdeaLoss / Objective
AutoencoderCompress → reconstructMSE or BCE
VAEProbabilistic latent; reparameterisation trickRecon + KL divergence
GANGenerator vs DiscriminatorminG maxD V(D,G)
WGANWasserstein distanceE[D(x)] − E[D(G(z))], 1-Lipschitz
DiffusionForward noise → reverse denoiseE[‖ε − εθ(xt,t)‖²]

Key Formulas

  • VAE KL: −½ ∑(1 + log σ² − μ² − σ²)
  • GAN V: E[log D(x)] + E[log(1−D(G(z)))]
  • Diffusion forward: xt = √ᾱt x0 + √(1−ᾱt) ε
PropertyVAEGANDiffusion
TrainingStableUnstableStable
QualityBlurrySharpBest
SpeedFastFastSlow (T steps)
Mode collapseNoYesNo

7. Master Formula Reference

ConceptFormula
Conv output⌊(n − k + 2p)/s⌋ + 1
Transposed conv output(n−1)s − 2p + k
Dilated kernelk + (k−1)(r−1)
Conv paramsCout(Cin k² + 1)
Depthwise sep. paramsCin k² + Cin Cout
Receptive field1 + ∑(kl − 1) · ∏ sj<l
IoUIntersection / Union
Dice2TP / (2TP + FP + FN)
mAPMean of AP over classes
VAE ELBORecon loss + KL(q(z|x) ‖ p(z))
GAN objectiveE[log D(x)] + E[log(1−D(G(z)))]

8. GATE DA Quick Tips

  • ⚡ Output size formula is the most testable — practise with varying padding, stride, and kernel sizes.
  • ⚡ Parameter counting: Remember Cout × (Cin × k² + 1). FC layers dominate total params in VGG/AlexNet.
  • ⚡ Receptive field: For all-stride-1, RF = 1 + ∑(kl − 1). Three 3×3 = RF of 7.
  • ⚡ ResNet skip connection: y = F(x) + x. Solves degradation in deep networks.
  • ⚡ IoU calculation: Draw the boxes, compute intersection dims carefully, then union = A + B − intersection.
  • ⚡ 1×1 convolutions are used for channel reduction (bottleneck), not spatial change.
  • ⚡ Depthwise separable conv saves ~k²× parameters compared to standard conv.
  • ⚡ Transposed conv output formula is the “reverse” of regular conv: (n−1)s − 2p + k.
  • ⚡ Semantic vs Instance: Semantic = per-pixel class only. Instance = per-object mask + class.
  • ⚡ mIoU > Pixel Accuracy for evaluation when classes are imbalanced.