Visual demos of Gestalt principles, video tracking/cut detection, and step-by-step K-means convergence.
HIGH PRIORITY6M / 9M
1.1 Image Segmentation, Partitioning vs Grouping & Gestalt
The Dalmatian Dog Problem (Slides 2–4)
Imagine a photo of a black-and-white spotted Dalmatian standing on black-and-white dappled leaves. Looking at just one black pixel tells you nothing ("Is it dog or shadow?"). Your brain groups nearby spots into a dog silhouette—that is Image Segmentation (e.g., Image → Object + Background or Sky + Trees + Buildings + Road).
Partitioning
Grouping
Carves/splits a large dataset into good pieces (e.g., divide image into coherent colour/texture regions, video into shots or motion blobs).
Collects distinct tokens that "make sense" together even across occlusion (e.g., tokens moving together or forming one object).
Human Vision: Figure–Ground & 9 Gestalt Principles
Figure–Ground: A white circle in a black triangle can look like a white disc on top OR a circular hole cut out of black!
Interactive Gestalt Grouping Visualizer
Proximity: Objects close together are perceived as one group.
Similarity: Items sharing colour, shape, or shade group together.
Common Fate: Items moving together at the same direction/speed form one unit (e.g., flock of birds).
Common Region: Elements enclosed in the same box/boundary group together.
Parallelism: Parallel lines/curves group together.
Closure: Brain mentally fills missing gaps to see closed shapes (e.g., dashed triangle).
Symmetry: Balanced/mirrored shapes group naturally.
Continuity: Eyes follow smooth continuous paths rather than sharp jagged turns.
Familiar Configuration: Recognizing a known shape (Dalmatian) guides grouping of dots.
Used on conveyor belts, highway traffic cameras, and fixed-webcam HCI to separate moving foreground objects from a static backdrop:
Build initial background B(0).
Moving Average Update (adapts to clouds/sunlight/rain by weighting recent frames heavily):
B(n+1) = wa F + Σi wi B(n−i)wc
Flag pixel as active foreground whenever |F − B| > threshold.
2. Shot Boundary Detection
Spots scene cuts between video clips ("shots") for video indexing, key-frame thumbnails, and search: compute distance between consecutive frames; if distance > threshold, mark a shot boundary.
Distance Metric
How It Works
Example Strength / Weakness
Frame Differencing
Pixel-by-pixel squared difference
Slow; shaky handheld camera causes false alarms!
Histogram-Based
Compares overall colour distribution
Immune to camera shake, but misses changes if same colours just swap sides!
Block Comparison
Splits frame into grid blocks & compares corresponding blocks
Fixes histogram limitation when objects move across screen!
Edge Differencing
Compares edge outlines between consecutive frames
Robust to lighting shifts; spots structural scene cuts cleanly.
Pixels are grouped using Colour (blue → sky, green → grass), Texture (wood grain), and Proximity. Two hierarchical approaches: Agglomerative (Bottom-Up) merges closest pairs (using Single-Link → elongated, Complete-Link → round, or Group Average), while Divisive (Top-Down) splits the least uniform cluster.
Step 0: 2 random centers (★) placed. Click "Step" to run Assignment then Update!
Watch K-Means alternate between Assignment (nearest center) and Update (recompute mean) until convergence!
RGB vs RGBXY: Clustering [R, G, B] alone groups same-coloured objects far apart (disconnected segments). Adding spatial coordinates [R, G, B, x, y] makes segments spatially connected, though colour & position have different scales (must normalize/weight) and large uniform areas can still split. Also, K-means depends on initialization—run multiple times and pick the lowest squared error!
2. Object Detection — YOLO, R-CNN & Faster R-CNN
From image classification to locating multiple objects in real time, and comparing Single-Shot vs Two-Stage detectors.
HIGH PRIORITY6M / 9M
2.1 Object Detection & YOLO Architecture
Example: Butterfly Classification vs Detection (Slides 41–44)
• Classification: Answers "What?" → "Butterfly".
• Object Detection: Answers "What AND Where?" → "Butterfly 1 at (x₁,y₁,w₁,h₁), 95%; Butterfly 2 at (x₂,y₂,w₂,h₂), 91%."
YOLO (You Only Look Once)
3-Stage Macro-Architecture:
Backbone (Feature Extractor): Deep CNN (24 conv layers + 4 maxpool in YOLOv1, alternating 1×1 channel reduction and 3×3 spatial convs) extracting multi-level features.
Neck (Feature Aggregator): Blends multi-scale features via upsampling & concatenation so tiny and large objects are both detected.
Head (Predictor): Outputs Bounding Box (x, y, w, h), Objectness ScoreP(Obj) × IoU, and Class Probabilities.
YOLOv1 Grid Math: Resizes input to 448 × 448; divides into 7 × 7 grid. The cell containing an object's center predicts 2 boxes (× 5 values each) + 20 classes = 30 values/cell. Two FC layers output (1, 1470) reshaped to (7, 7, 30).
Activation:Leaky ReLU: f(x) = x for x > 0, else 0.01x (prevents dead neurons).
HIGH PRIORITY6M / 9M
2.2 Single-Shot vs Two-Stage (R-CNN, RPN & Faster R-CNN)
Single-Shot (YOLO, RetinaNet): One forward pass → real-time speed (ideal for surveillance & self-driving cars).
An N × N matrix comparing actual vs predicted classes: TP (correct positive), TN (correct negative), FP — Type I Error (false alarm; critical in spam/fraud → maximize Precision), FN — Type II Error (missed positive; critical in cancer/medical tests → maximize Recall).
Interactive Confusion Matrix Calculator (Pre-loaded with the 1000-sample example from Slides 96–100!)
⚡ Quick Check 4.1: In a cancer screening model, missing a sick patient (FN) is life-threatening. Which metric should be maximized?
SYLLABUS SUPPLEMENT6M / 9M
4.2 IoU Lab, F1-Score, mAP & Model Comparison Case Study
F1 = 2 · P · RP + R
|
IoU = Area(Pred ∩ GT)Area(Pred ∪ GT)
|
mAP = 1K Σk=1K APk
Drag the Predicted Box over Ground Truth to see IoU in action! (IoU ≥ 0.50 = True Positive)
Model
Task
Speed vs Accuracy
Best Dataset / Application
YOLO
Object Detection (1-Stage)
Fastest (real-time FPS); slightly weaker on tiny/crowded boxes
MS COCO / Autonomous vehicles, live CCTV
Faster R-CNN
Object Detection (2-Stage)
Slower, higher box precision
MS COCO / High-precision defect inspection
Mask R-CNN
Instance Segmentation
Slowest, gives class + box + per-instance mask
MS COCO / Cityscapes / Crowded scenes
U-Net
Semantic Segmentation
Fast & sharp boundaries even on small datasets
Medical MRI/cell datasets, Cityscapes road/sky parsing
Module 4 — Quick Revision & Q-Bank
High-yield 3M, 6M, and 9M questions for your exam.
EXAM READY
Module 4 Exam Q-Bank
Q1 (3M): List 6 Gestalt principles with brief meaning.
Proximity, Similarity, Common Fate, Common Region, Parallelism, Closure, Symmetry, Continuity, Familiar Configuration.
Q2 (6M): Explain K-means clustering for pixel segmentation & why spatial coordinates (x,y) are added.