Module 16

Computer Vision and Convolutional Networks

How does a neural network learn to interpret spatial structures, objects and relationships within images?

lessons
25
duration
43 h 50 min
concepts
124
available in English
25 / 25
completed by you
0 of 25

Where it fits

Overview

Build modern computer vision from the pixel: classical filters, convolution with hand-written forward and backward passes, locality and equivariance inductive biases, receptive fields and a NumPy LeNet. Follow architectural evolution—AlexNet, VGG, Inception, ResNet, DenseNet, ResNeXt, MobileNet, EfficientNet and ConvNeXt—training ResNet locally to 94% on CIFAR-10 with augmentation, transfer learning and metric learning. Then study dense tasks (two-stage, one-stage and DETR detection, feature pyramids, semantic, instance and panoptic segmentation), finishing with Vision Transformers, visual self-supervision (MAE, DINO, iBOT) and visual foundation models (DINOv2, DINOv3, SAM), linking CLIP to m24.

Why it matters

Vision is an entry point to multimodal models, imitation-learning robotic policies whose observations are images processed by ResNet or ViT, and diffusion models whose U-Net and patching originate here. Writing and debugging convolution, training a competitive ResNet in 8 GB, measuring a detector with correct mAP and choosing between a CNN, ViT or frozen foundation backbone enable real perception systems and critical reading of the literature.

Lessons 25

  1. 01Review: images as signals, linear filters and edgesReview images as sampled signals, color conventions, classical linear filters, gradients, Gaussian scale space and handcrafted HOG and SIFT features before generalizing to learned CNN filters.Review80 min
  2. 02Discrete convolution implemented by handBuild multi-channel convolution from correlation, follow padding, stride and dilation, count parameters and operations, and compare direct, im2col and structured-matrix formulations. GPUCore110 min
  3. 03Convolution backward pass and transposed convolutionDerive convolution weight and input gradients, implement col2im as the adjoint of patch extraction, and study transposed convolutions, overlap and alternative upsampling. GPUCore100 min
  4. 04Why convolutions: locality, weight sharing, equivariance and poolingStudy locality, shared weights, translation equivariance and invariance, pooling gradients and aliasing, with controlled browser and local experiments. GPUCore95 min
  5. 05Receptive fields and the feature hierarchyCalculate receptive-field size, jump and center; distinguish structural support from measured gradient sensitivity; compare small kernels, dilation and feature hierarchies. GPUCore85 min
  6. 06Your first CNN from scratch: LeNet in NumPyBuild and train a modernized LeNet in NumPy, verify its backward pass, track validation and compare a CNN with a parameter-matched MLP under shifted inputs. GPUCore110 min
  7. 07Image classification with CNNs in PyTorch on the local GPUTrain a PyTorch CNN on CIFAR-10 with separate data splits, interpret top-k and confusion matrices, and measure the GPU input pipeline, training schedules and throughput. GPUCore105 min
  8. 08The ImageNet revolution: AlexNet, VGG and InceptionCompare AlexNet, VGG and Inception in the context of their ImageNet evaluation protocols, and count parameters and operations while distinguishing compute from latency. GPUCore95 min
  9. 09ResNet: residual learning and hundred-layer networksStudy degradation in deep networks, residual and preactivation blocks, ResNet architectures and path expansions, with controlled gradient, parity and ablation experiments. GPUCore115 min
  10. 10Data augmentation: invariances, mixing and automated policiesStudy augmentation as a task-dependent hypothesis, derive mixup and CutMix objectives, compare automated policies and evaluate accuracy and calibration under controlled budgets. GPUCore100 min
  11. 11Guided project: ResNet to 94% on CIFAR-10 in minutes on your GPUExamine fast CIFAR training through controlled ablations, patch whitening, flip alternation, test-time augmentation and paired-seed comparisons. GPUAdvanced120 min
  12. 12Beyond ResNet: DenseNet, ResNeXt, Wide ResNet and channel attentionCompare DenseNet connectivity, grouped convolution and ResNeXt cardinality, Wide ResNet and Squeeze-and-Excitation while measuring parameters, activations and latency. GPUAdvanced100 min
  13. 13Efficient CNNs: separable convolutions, MobileNet and EfficientNetDerive depthwise-separable convolution cost, implement MobileNetV2 inverted residuals, study compound scaling and distinguish nominal compute from measured efficiency. GPUAdvanced105 min
  14. 14Transfer learning: reusing pretrained networksCompare linear probing, partial and full fine-tuning and LP-FT, manage BatchNorm state and evaluate transfer across domains with independent splits. GPUCore100 min
  15. 15Recognition beyond classification: metric learning, verification and retrievalLearn metric embeddings for verification, identification and retrieval; study contrastive, triplet and angular-margin losses, local features and evaluation across unseen classes. GPUAdvanced95 min
  16. 16Object detection I: boxes, IoU, NMS and mean average precisionBuild box representations, IoU-based losses and suppression, then evaluate detections with matching and COCO-style average precision. GPUCore105 min
  17. 17Object detection II: the R-CNN family, anchors and feature pyramidsTrace two-stage object detection through anchors, region proposals, RoIAlign and feature pyramids, then evaluate a controlled Faster R-CNN adaptation. GPUAdvanced115 min
  18. 18Object detection III: one-stage, focal loss, anchor-free and DETRStudy one-stage detection, focal loss, FCOS assignment and DETR set prediction, and compare short controlled detector experiments. GPUAdvanced120 min
  19. 19Semantic segmentation: FCN, U-Net and DeepLabStudy semantic segmentation, FCNs, U-Net, DeepLab, segmentation losses and mIoU, with a controlled Oxford-IIIT Pet lab. GPUCore110 min
  20. 20Instance and panoptic segmentation: Mask R-CNN and mask classificationStudy instance and panoptic segmentation, Mask R-CNN, panoptic quality and mask classification, with controlled practical comparisons. GPUAdvanced105 min
  21. 21Vision Transformers: an image is worth 16×16 wordsStudy vision transformers, patch embeddings, positional interpolation, attention costs and data regimes with controlled experiments. GPUCore115 min
  22. 22Hierarchical transformers and modern CNNs: Swin, ConvNeXt and what each learnsStudy shifted-window attention, hierarchical Swin, ConvNeXt modernization and measured shape-texture behavior. GPUAdvanced110 min
  23. 23Self-supervised vision: MAE, DINO and iBOTStudy masked image modeling, MAE, DINO self-distillation and the evaluation of frozen visual representations. GPUAdvanced120 min
  24. 24Visual foundation models I: DINOv2, DINOv3 and universal dense featuresStudy reusable visual representations, DINOv2 and DINOv3, dense probes, registers and patch correspondences. GPUResearch110 min
  25. 25Visual foundation models II: promptable segmentation (SAM) and open-vocabulary recognitionStudy promptable segmentation, SAM, video memory and open-vocabulary detection with measured end-to-end evaluations. GPUResearch105 min

Module capstone

From pixels to foundation models: a personal perception benchmark on the RTX 4060

A four-part project in one repository with automated tests. (1) A NumPy convolution engine (conv2d, max pooling, transposed convolution) with forward and backward passes verified by gradient checking and against torch.nn.functional. (2) A custom ResNet trained from scratch on CIFAR-10 using the module recipe, with an indicative target of 94% accuracy in a few minutes, three-seed ablations (without residuals, augmentation or TTA), and throughput and peak-memory measurements. (3) An FCOS-style anchor-free detector on a pretrained FPN backbone, trained on a PASCAL VOC subset, with hand-implemented IoU, NMS and mAP checked against torchmetrics, plus a U-Net for Oxford-IIIT Pet segmentation evaluated with mIoU. (4) Representation comparison: linear probes and k-NN on the supervised ResNet, a small self-supervised ViT trained locally with DINO or MAE, and a downloaded frozen DINOv2, including patch-level linear-probe segmentation. Deliver a reproducible report with tables, curves, attention-map visualizations and category-level error analysis.

Check what you already know

  • Apply a Sobel filter and Gaussian blur by hand to a small image and explain convolution versus cross-correlation
  • Calculate convolution output shape with padding, stride and dilation and implement it using im2col
  • Derive convolutional-layer gradients with respect to inputs and weights and relate the former to transposed convolution
  • Prove convolution is translation equivariant and explain why subsampling breaks the property
  • Calculate the theoretical receptive field of stacked layers and distinguish it from the effective receptive field
  • Explain why a residual block solves degradation and design a bottleneck block
  • Implement mixup and CutMix with correctly mixed labels
  • Implement fast CIFAR-10 training with data on GPU and measure each technique’s contribution across seeds
  • Calculate grouped-convolution cost and prove equivalence between ResNeXt branches and grouped convolution
  • Count FLOPs and parameters of depthwise separable versus standard convolution
  • Choose between feature extraction, full fine-tuning and LP-FT based on dataset size and domain distance
  • Implement IoU, NMS and COCO mean average precision
  • Explain region proposal networks, RoIAlign and the feature pyramid network
  • Derive focal loss and explain DETR Hungarian matching
  • Train a triplet loss with semi-hard mining and evaluate an embedding with recall@k on unseen classes
  • Build a U-Net and calculate segmentation mIoU
  • Calculate panoptic quality and explain Mask R-CNN’s mask head
  • Implement ViT patching and adapt positional embeddings to another resolution
  • Implement shifted-window attention with its mask and calculate its cost versus global attention
  • Explain how DINO centering and sharpening prevent collapse and why MAE masks 75% of patches
  • Train a linear segmentation probe on frozen DINOv2 patches and explain the role of registers
  • Explain SAM’s architecture and why it predicts multiple masks for an ambiguous prompt

References