Robot AI -- Computer Vision

Memory tricks that make computer vision and image AI click

From pixel to prediction -- these memory tricks lock in CNNs, object detection, image segmentation, generative vision models, and the architectures that gave machines the ability to see.

Community
📋
Computer Vision Forum
Ask questions · Share tricks
💬
Computer Vision Study Room
Live · Study together now

Or continue to the sub-topics below for more specialized Study Rooms and Forums

Computer Vision

Memory Tricks

Proven Mnemonics & Acronyms — fast to learn, hard to forget.

🎥 How Flashcards Work
A quick walkthrough of tap-to-flip, rating, and how card colors track what you're struggling with.
← Back Next →
Computer Vision deck1 of 20
Tap to flip
← →
How well do YOU think you know this?
Easy Medium Hard Harder
Tap to flip back
Computer Vision deck
Easy0
Medium0
Hard0
Harder0
🧠 Vivid Story
IMAGE SEGMENTATION = COLORING BOOK — color every pixel the color of its object
PIXEL-LEVEL CLASSIFICATION
Semantic, instance & panoptic segmentation
Segmentation goes beyond bounding boxes — it classifies every single pixel. Semantic segmentation: color all pixels of the same class the same color (all cars = red, all roads = gray, all sky = blue). Instance segmentation: distinguish individual objects of the same class (car #1 = orange, car #2 = purple). Panoptic segmentation: unifies both into one complete picture — every pixel gets a category label AND individual objects are told apart, all in a single pass. Used in self-driving cars (understand the entire scene pixel by pixel), medical imaging (outline a tumor precisely), and satellite imagery analysis.
🎥 Watch Instead
Image Segmentation — with AI-Mee — 2:07.
Flashcard
🃏 🧠 Vivid Story
Image segmentation — what does it do?
Tap to flip
🃏 Answer
IMAGE SEGMENTATION = COLORING BOOK — color every pixel the color of its object
PIXEL-LEVEL CLASSIFICATION
Tap to flip back
CV Fundamentals
PIXELS to FEATURES to PREDICTIONS -- the three levels of what a CNN sees
EDGES THEN SHAPES THEN OBJECTS -- LEARNED HIERARCHICALLY FROM DATA
Before deep learning: hand-crafted SIFT and HOG features. After: learned automatically from data.
Early layers detect low-level features (edges, corners, color gradients). Middle layers detect textures, shapes, and patterns. Deep layers detect semantic concepts (faces, cars, dogs). This hierarchy mirrors the human visual cortex. AlexNet (2012): first deep CNN to win ImageNet -- crushed all competitors and launched the deep learning revolution in computer vision.
Early layers
Edges, corners, color gradients -- low-level features
Middle layers
Textures, shapes, and patterns -- mid-level features
Deep layers
Semantic concepts: faces, cars, dogs -- high-level features
AlexNet 2012
First deep CNN win at ImageNet -- launched CV revolution
🎥 Watch Instead
▶
Video coming soon
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 CV Fundamentals
CNN features — what do early, middle and deep layers see?
Tap to flip
🃏 Answer
PIXELS to FEATURES to PREDICTIONS -- the three levels of what a CNN sees
Early layersEdges, corners, color gradients -- low-level features
Middle layersTextures, shapes, and patterns -- mid-level features
Deep layersSemantic concepts: faces, cars, dogs -- high-level features
AlexNet 2012First deep CNN win at ImageNet -- launched CV revolution
Tap to flip back
Object Detection
YOLO -- You Only Look Once -- detect all objects in one single forward pass
CLASSIFICATION = WHAT AND DETECTION = WHAT + WHERE AND SEGMENTATION = WHAT + WHICH PIXELS
IoU = Intersection over Union -- measures overlap between predicted and ground truth box
Classification: what is in this image. Detection: WHAT and WHERE -- bounding box plus class label for each object. Segmentation: which exact pixels belong to each object. YOLO: one-stage detector, divides image into grid, predicts boxes and classes simultaneously -- real-time speed. Faster R-CNN: two-stage, slower but more accurate. IoU: area of overlap divided by area of union -- threshold at 0.5 for acceptable detection.
Classification
Single label for whole image -- is there a cat?
Detection
Bounding box (x,y,w,h) + class label per object
Segmentation
Pixel-level mask per object -- most precise
YOLO
One forward pass, real-time speed -- slight accuracy tradeoff
🎥 Watch Instead
▶
Video coming soon
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 Object Detection
Classification vs detection vs segmentation — and what is YOLO?
Tap to flip
🃏 Answer
YOLO -- You Only Look Once -- detect all objects in one single forward pass
ClassificationSingle label for whole image -- is there a cat?
DetectionBounding box (x,y,w,h) + class label per object
SegmentationPixel-level mask per object -- most precise
YOLOOne forward pass, real-time speed -- slight accuracy tradeoff
Tap to flip back
U-Net Segmentation
U-NET looks like a U -- encoder compresses down, decoder expands back up with skip connections
ENCODER SHRINKS TO CAPTURE CONTEXT -- DECODER EXPANDS TO RECOVER SPATIAL DETAIL
Skip connections preserve fine spatial detail that is lost during max pooling
U-Net: contracting path (encoder) compresses spatial dimensions while increasing channels -- captures what is in the image. Expanding path (decoder) restores spatial resolution -- recovers where. Skip connections: copy encoder feature maps directly to corresponding decoder layer -- preserve fine spatial detail lost during downsampling. Dominant for medical image segmentation. SAM (Meta 2023): foundation model -- segment any object with a click.
Encoder path
Compress spatial dimensions -- capture semantic context
Decoder path
Restore spatial resolution -- recover precise locations
Skip connections
Encoder feature maps passed directly to decoder -- preserve detail
SAM (Segment Anything)
Meta 2023 -- foundation model for segmentation
🎥 Watch Instead
▶
Video coming soon
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 U-Net Segmentation
U-Net — why is it shaped like a U?
Tap to flip
🃏 Answer
U-NET looks like a U -- encoder compresses down, decoder expands back up with skip connections
Encoder pathCompress spatial dimensions -- capture semantic context
Decoder pathRestore spatial resolution -- recover precise locations
Skip connectionsEncoder feature maps passed directly to decoder -- preserve detail
SAM (Segment Anything)Meta 2023 -- foundation model for segmentation
Tap to flip back
Data Augmentation
FLIP, CROP, ROTATE, COLOR -- data augmentation creates bigger datasets for free
AUGMENTATION IS REGULARIZATION -- FORCES INVARIANCE TO IRRELEVANT VARIATIONS
A cat is still a cat when flipped, slightly rotated, or slightly brighter -- teach this
Geometric: horizontal/vertical flip, random crop, rotation, perspective warp. Color: brightness, contrast, saturation, hue jitter. Advanced: CutOut (mask random patches), MixUp (blend two images and labels), CutMix (paste patches from one image into another), AutoAugment (learned augmentation policy). Standard ImageNet recipe: RandomResizedCrop(224) + RandomHorizontalFlip + ColorJitter + Normalize.
Geometric augmentation
Flip, crop, rotate, perspective -- spatial invariance
Color augmentation
Brightness, contrast, saturation -- color invariance
MixUp
Blend two images and labels -- smooth decision boundaries
AutoAugment
Learned augmentation policy -- often best performance
🎥 Watch Instead
▶
Video coming soon
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 Data Augmentation
Data augmentation — the main techniques?
Tap to flip
🃏 Answer
FLIP, CROP, ROTATE, COLOR -- data augmentation creates bigger datasets for free
Geometric augmentationFlip, crop, rotate, perspective -- spatial invariance
Color augmentationBrightness, contrast, saturation -- color invariance
MixUpBlend two images and labels -- smooth decision boundaries
AutoAugmentLearned augmentation policy -- often best performance
Tap to flip back
Vision Transformer
ViT -- split image into PATCHES, treat each patch like a TOKEN, run Transformer
AN IMAGE IS WORTH 16 by 16 WORDS -- THE PAPER THAT LAUNCHED VISION TRANSFORMERS
SWIN Transformer: hierarchical ViT with shifted windows -- efficient for detection and segmentation
ViT (Dosovitskiy et al., 2020): split image into 16x16 patches, flatten, project to embedding, add position embedding, run through standard Transformer encoder. Global context from layer 1 -- unlike CNNs that build context gradually. Needs more data than CNNs (no inductive bias for locality). SWIN Transformer: hierarchical ViT with shifted windows, efficient for high-resolution detection and segmentation.
Patch embedding
16x16 pixel patches treated like word tokens
Position embedding
Required -- Transformer has no inherent sense of spatial order
Global attention
Every patch attends to every other from layer 1
SWIN Transformer
Hierarchical + shifted windows -- efficient for dense prediction
🎥 Watch Instead
▶
Video coming soon
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 Vision Transformer
Vision Transformer (ViT) — how does it read an image?
Tap to flip
🃏 Answer
ViT -- split image into PATCHES, treat each patch like a TOKEN, run Transformer
Patch embedding16x16 pixel patches treated like word tokens
Position embeddingRequired -- Transformer has no inherent sense of spatial order
Global attentionEvery patch attends to every other from layer 1
SWIN TransformerHierarchical + shifted windows -- efficient for dense prediction
Tap to flip back
Generative Vision
VAE encodes to SMOOTH space -- GAN has two fighters -- Diffusion REVERSES NOISE
THREE WAYS TO TEACH A MACHINE TO GENERATE REALISTIC IMAGES
Diffusion models now dominate -- more stable training, better diversity, easier text conditioning
VAE: encode image to distribution (mean and variance), sample, decode -- smooth latent space enables interpolation. GAN: Generator vs Discriminator, adversarial training, sharp results but mode collapse and instability. Diffusion: add noise over T steps, train to denoise, generate by starting from noise -- most stable training, best diversity, dominant for image generation (Stable Diffusion, DALL-E 3, Midjourney).
VAE
Smooth latent space, enables interpolation -- foundation of Stable Diffusion
GAN
Generator vs Discriminator -- sharp but unstable, mode collapse risk
Diffusion
Most stable, best quality, easiest text conditioning -- dominant now
ControlNet
Adds spatial conditioning (pose, depth, edges) to diffusion models
🎥 Watch Instead
▶
Video coming soon
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 Generative Vision
VAE vs GAN vs diffusion — how does each generate images?
Tap to flip
🃏 Answer
VAE encodes to SMOOTH space -- GAN has two fighters -- Diffusion REVERSES NOISE
VAESmooth latent space, enables interpolation -- foundation of Stable Diffusion
GANGenerator vs Discriminator -- sharp but unstable, mode collapse risk
DiffusionMost stable, best quality, easiest text conditioning -- dominant now
ControlNetAdds spatial conditioning (pose, depth, edges) to diffusion models
Tap to flip back
Face Recognition
EMBED then COMPARE -- face recognition maps faces to vectors then finds nearest match
DETECTION AND ALIGNMENT AND EMBEDDING AND COMPARISON -- FOUR STEP PIPELINE
ArcFace: current state of art -- additive angular margin loss for face embeddings
Pipeline: detect faces (MTCNN, RetinaFace), align using landmark points, encode face into compact vector (128 or 512 dimensions with ArcFace), compare via cosine similarity to known embeddings. Triplet loss: pull same-person embeddings together, push different people apart. Bias: higher error rates for dark-skinned women. EU AI Act bans real-time biometric surveillance in public spaces.
Detection
Find faces in image -- MTCNN, RetinaFace
Alignment
Normalize face orientation using landmark points
Embedding
CNN encodes identity into compact vector (ArcFace is state of art)
Bias
Higher error rates for dark-skinned women -- documented in MIT study
🎥 Watch Instead
▶
Video coming soon
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 Face Recognition
Face recognition — the pipeline steps?
Tap to flip
🃏 Answer
EMBED then COMPARE -- face recognition maps faces to vectors then finds nearest match
DetectionFind faces in image -- MTCNN, RetinaFace
AlignmentNormalize face orientation using landmark points
EmbeddingCNN encodes identity into compact vector (ArcFace is state of art)
BiasHigher error rates for dark-skinned women -- documented in MIT study
Tap to flip back
Autonomous Driving
SENSE then PERCEIVE then PLAN then ACT -- the four-stage AV pipeline
CAMERA AND LIDAR AND RADAR AND SENSOR FUSION -- THE SENSING DEBATE
SAE Level 2 is Tesla Autopilot -- human still monitors and is responsible
SAE Levels: L0 (none) to L5 (full autonomy any condition). L2: partial, human monitors (Tesla Autopilot). L4: high automation, limited geofenced area (Waymo One). Camera-only (Tesla) vs sensor fusion (Waymo). LiDAR: precise 3D depth, expensive. Camera: cheap, texture-rich, needs depth estimation. Radar: all-weather, velocity measurement. Long tail problem: rare edge cases too rare to appear in training data -- kills autonomous driving reliability.
SAE L2
Partial automation -- human monitors and is legally responsible
SAE L4
High automation -- limited geofenced area, Waymo in Phoenix and SF
Camera-only (Tesla)
Cost reduction -- camera provides texture but needs depth estimation
Long tail problem
Rare edge cases not in training data -- major unsolved challenge
🎥 Watch Instead
▶
Video coming soon
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 Autonomous Driving
Self-driving cars — the pipeline and the SAE levels?
Tap to flip
🃏 Answer
SENSE then PERCEIVE then PLAN then ACT -- the four-stage AV pipeline
SAE L2Partial automation -- human monitors and is legally responsible
SAE L4High automation -- limited geofenced area, Waymo in Phoenix and SF
Camera-only (Tesla)Cost reduction -- camera provides texture but needs depth estimation
Long tail problemRare edge cases not in training data -- major unsolved challenge
Tap to flip back
Medical Imaging
READ the scan better than a doctor -- but only when told exactly what to look for
AI AUGMENTS RADIOLOGISTS -- AI PLUS PHYSICIAN OUTPERFORMS EITHER ALONE
Grad-CAM highlights which pixels most influenced the prediction -- required for clinical trust
Proven: diabetic retinopathy (matches ophthalmologist), CheXNet chest X-ray pneumonia detection, lymph node metastasis detection. Challenges: distribution shift (fails at hospitals not in training data), class imbalance (rare diseases), FDA approval required (510(k)). Grad-CAM: highlight influential image regions -- required for clinician trust. 3D U-Net: standard for CT and MRI volumetric segmentation.
Diabetic retinopathy
Google AI matches ophthalmologist accuracy
CheXNet
Stanford AI outperformed radiologists on pneumonia from chest X-rays
Distribution shift
Trained on teaching hospital data -- fails at rural clinics
Grad-CAM
Highlights influential pixels -- required for clinician trust
🎥 Watch Instead
▶
Video coming soon
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 Medical Imaging
AI in medical imaging — successes and risks?
Tap to flip
🃏 Answer
READ the scan better than a doctor -- but only when told exactly what to look for
Diabetic retinopathyGoogle AI matches ophthalmologist accuracy
CheXNetStanford AI outperformed radiologists on pneumonia from chest X-rays
Distribution shiftTrained on teaching hospital data -- fails at rural clinics
Grad-CAMHighlights influential pixels -- required for clinician trust
Tap to flip back
CV Metrics
mAP -- mean Average Precision -- the standard metric for object detection
AP = AREA UNDER PRECISION-RECALL CURVE FOR ONE CLASS
COCO mAP averages over IoU thresholds 0.5 to 0.95 -- much harder than Pascal VOC at 0.5 only
Classification: Top-1 accuracy, Top-5 accuracy. Object Detection: mAP -- compute AP (area under precision-recall curve) for each class, average across classes. COCO mAP: average over IoU thresholds 0.5 to 0.95 -- much harder than Pascal VOC (IoU=0.5 only). Segmentation: mIoU (mean Intersection over Union across all semantic classes). FPS: frames per second -- real-time requires 30+ FPS.
Top-1 accuracy
Is the top prediction the correct class?
mAP
Average AP across all classes and IoU thresholds
COCO vs VOC
COCO: IoU 0.5-0.95 (hard). VOC: IoU=0.5 only (easier).
mIoU
Mean Intersection over Union -- standard for segmentation
🎥 Watch Instead
▶
Video coming soon
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 CV Metrics
mAP — what is it, and COCO vs VOC?
Tap to flip
🃏 Answer
mAP -- mean Average Precision -- the standard metric for object detection
Top-1 accuracyIs the top prediction the correct class?
mAPAverage AP across all classes and IoU thresholds
COCO vs VOCCOCO: IoU 0.5-0.95 (hard). VOC: IoU=0.5 only (easier).
mIoUMean Intersection over Union -- standard for segmentation
Tap to flip back
Optical Flow
FLOW = how pixels MOVE between frames -- a velocity field for every pixel in the video
LUCAS-KANADE IS CLASSICAL -- RAFT IS CURRENT STATE OF ART
Two-stream networks: spatial stream (RGB) plus temporal stream (optical flow) for action recognition
Optical flow: 2D vector (dx, dy) per pixel between consecutive frames showing apparent motion. Classical: Lucas-Kanade (local patch matching), Horn-Schunck (global smoothness). Deep learning: FlowNet, PWC-Net, RAFT (current state of art). Applications: video compression (encode motion), action recognition, video stabilization, slow-motion generation (interpolate frames), object tracking.
Optical flow output
(dx, dy) velocity vector per pixel between frames
Lucas-Kanade
Classical local patch matching -- assumes constant brightness
RAFT
Current state of art deep optical flow estimation
Two-stream networks
RGB appearance + optical flow motion for action recognition
🎥 Watch Instead
▶
Video coming soon
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 Optical Flow
Optical flow — what does it measure?
Tap to flip
🃏 Answer
FLOW = how pixels MOVE between frames -- a velocity field for every pixel in the video
Optical flow output(dx, dy) velocity vector per pixel between frames
Lucas-KanadeClassical local patch matching -- assumes constant brightness
RAFTCurrent state of art deep optical flow estimation
Two-stream networksRGB appearance + optical flow motion for action recognition
Tap to flip back
🎯 Exam Favorite
OBJECT DETECTION = LOCATE + CLASSIFY — draw a box AND label what's inside it
BOUNDING BOX + CLASS LABEL
Object detection vs image classification
Image classification answers "What is in this image?" — one label for the whole image (cat). Object detection answers "What is where?" — draw bounding boxes around each object AND label each one (cat at top-left, dog at bottom-right, person in center). Detection is classification + localization. YOLO (You Only Look Once) is the famous real-time object detector — it processes the entire image in one pass, making it fast enough for video.
🎥 Watch Instead
▶
Video coming soon
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 🎯 Exam Favorite
Object detection — what two things does it do?
Tap to flip
🃏 Answer
OBJECT DETECTION = LOCATE + CLASSIFY — draw a box AND label what's inside it
BOUNDING BOX + CLASS LABEL
Tap to flip back
🔑 Key Distinction
DATA AUGMENTATION = Teaching a kid to recognize a CAT even when it's upside down, sideways, or far away
FLIP · ROTATE · CROP · BRIGHTEN
Data augmentation — making small datasets go further
Computer vision models need massive training data. Data augmentation artificially expands the dataset by applying transformations: horizontal flip, rotation, random crop, brightness/contrast change, adding noise. A single cat photo becomes 20 training examples. The model learns that a cat flipped upside down is still a cat — improving robustness. This is why modern CV models generalize well even when real data is limited. Augmentation happens on-the-fly during training.
🎥 Watch Instead
▶
Video coming soon
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 🔑 Key Distinction
Data augmentation — why the upside-down cat?
Tap to flip
🃏 Answer
Data augmentation — the upside-down cat
DATA AUGMENTATION = Teaching a kid to recognize a CAT even when it's upside down, sideways, or far away
FLIP · ROTATE · CROP · BRIGHTEN
Tap to flip back
💡 Concept Anchor
FEATURE MAPS = X-RAY VISION — each filter reveals a different hidden pattern in the image
EACH FILTER = ONE PATTERN DETECTOR
Feature maps in CNNs — what the network actually sees
After each convolution layer, the network produces feature maps — one per filter. Each feature map highlights where a particular pattern (edge, curve, texture) appears in the image. Early layers: simple features (horizontal edges, vertical edges). Middle layers: shapes (curves, corners). Deep layers: complex parts (eyes, wheels, faces). Visualizing feature maps shows what the network has learned to see — like giving it X-ray goggles tuned to different patterns.
🎥 Watch Instead
▶
Video coming soon
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 💡 Concept Anchor
Feature maps — what does each filter reveal?
Tap to flip
🃏 Answer
FEATURE MAPS = X-RAY VISION — each filter reveals a different hidden pattern in the image
EACH FILTER = ONE PATTERN DETECTOR
Tap to flip back
📅 Quick Reference
TRANSFER LEARNING IN CV = Borrowing EYES trained on millions of images and adapting them to your task
IMAGENET FEATURES → YOUR TASK
Transfer learning in computer vision — why you rarely train from scratch
Training a CNN from scratch needs millions of images. Instead: take ResNet, VGG, or EfficientNet pre-trained on ImageNet (1.2 million images, 1000 classes) — the early layers already detect edges, textures, and shapes. Freeze those layers. Replace the final classification layer with your own. Train only the last few layers on your small dataset. The borrowed eyes already know what visual features look like — you just teach them to recognize your specific objects.
🎥 Watch Instead
▶
Video coming soon
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 📅 Quick Reference
Transfer learning in vision — what are the borrowed eyes?
Tap to flip
🃏 Answer
Transfer learning in vision — borrowed eyes
TRANSFER LEARNING IN CV = Borrowing EYES trained on millions of images and adapting them to your task
IMAGENET FEATURES → YOUR TASK
Tap to flip back
⭐ Most Important
PIXELS → FEATURES → PREDICTIONS — the three-level hierarchy every CV model follows
LOW LEVEL · MID LEVEL · HIGH LEVEL
The three levels of what a CNN actually learns to see
Every CNN builds a visual hierarchy: Low-level features (edges, corners, colors, textures — detected by early layers, reusable across all tasks). Mid-level features (shapes, patterns, object parts — eyes, wheels, doors — detected by middle layers). High-level features (whole objects — faces, cars, buildings — detected by deep layers, task-specific). This hierarchy is why transfer learning works: the low and mid-level features trained on ImageNet transfer to almost any vision task.
Early layers
Edges, corners, textures — universal, transfer to any task
Middle layers
Shapes, patterns, object parts — semi-universal
Deep layers
Specific objects and concepts — task-specific, often replaced
🐍 Code
import torchvision.models as models
resnet = models.resnet50(pretrained=True)
# Freeze early layers (universal features)
for param in list(resnet.parameters())[:-10]:
param.requires_grad = False
# Only train the final layers on your task
🎥 Watch Instead
▶
Video coming soon
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 ⭐ Most Important
Vision models — the three-level hierarchy?
Tap to flip
🃏 Answer
PIXELS → FEATURES → PREDICTIONS — the three-level hierarchy every CV model follows
Early layersEdges, corners, textures — universal, transfer to any task
Middle layersShapes, patterns, object parts — semi-universal
Deep layersSpecific objects and concepts — task-specific, often replaced
🐍 Codeimport torchvision.models as models
resnet = models.resnet50(pretrained=True)
# Freeze early layers (universal features)
for param in list(resnet.parameters())[:-10]:
param.requires_grad = False
# Only train the final layers on your task
Tap to flip back
🎯 Exam Favorite
IoU = OVERLAP / UNION — the standard metric for how well your bounding box fits
INTERSECTION OVER UNION — OBJECT DETECTION ACCURACY
IoU and mAP — how object detectors are evaluated
IoU (Intersection over Union) measures bounding box quality: area where predicted and ground truth boxes overlap, divided by total area covered by both. IoU=1.0 = perfect match. IoU=0.5 = standard threshold for "correct detection." A detection is counted as correct only if IoU ≥ threshold AND class label matches. mAP (mean Average Precision) averages the AP score across all classes and IoU thresholds — the standard benchmark for object detectors (COCO, Pascal VOC).
IoU
Overlap area / Union area — 0 to 1, higher = better box placement
0.5 threshold
Standard: prediction "correct" if IoU ≥ 0.5 and class matches
mAP
Mean Average Precision — averaged across all classes and thresholds
🐍 Code
def iou(box1, box2):
x1 = max(box1[0], box2[0]); y1 = max(box1[1], box2[1])
x2 = min(box1[2], box2[2]); y2 = min(box1[3], box2[3])
intersection = max(0, x2-x1) * max(0, y2-y1)
union = (box1[2]-box1[0])*(box1[3]-box1[1]) + (box2[2]-box2[0])*(box2[3]-box2[1]) - intersection
return intersection / union
🎥 Watch Instead
▶
Video coming soon
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 🎯 Exam Favorite
IoU — how is it calculated, and what's a good score?
Tap to flip
🃏 Answer
IoU = OVERLAP / UNION — the standard metric for how well your bounding box fits
IoUOverlap area / Union area — 0 to 1, higher = better box placement
0.5 thresholdStandard: prediction "correct" if IoU ≥ 0.5 and class matches
mAPMean Average Precision — averaged across all classes and thresholds
🐍 Codedef iou(box1, box2):
x1 = max(box1[0], box2[0]); y1 = max(box1[1], box2[1])
x2 = min(box1[2], box2[2]); y2 = min(box1[3], box2[3])
intersection = max(0, x2-x1) * max(0, y2-y1)
union = (box1[2]-box1[0])*(box1[3]-box1[1]) + (box2[2]-box2[0])*(box2[3]-box2[1]) - intersection
return intersection / union
Tap to flip back
🔑 Key Distinction
GENERATIVE CV = Create images · DISCRIMINATIVE CV = Classify images
TWO SIDES OF COMPUTER VISION
Discriminative vs Generative computer vision tasks
Discriminative CV: given an image, output a label or bounding box. Classification (what?), detection (what and where?), segmentation (what at every pixel?). Generative CV: given a prompt or noise, create a new image. GANs, diffusion models, VAEs. The line is blurring: modern vision-language models (CLIP, DALL-E, Stable Diffusion) combine both — understanding AND generating images from the same representation space.
Discriminative
Image → label or structured output. Classification, detection, segmentation.
Generative
Noise or text → new image. GANs, diffusion, VAEs.
Vision-Language
Understand AND generate — CLIP, DALL-E, GPT-4V, Gemini Vision
🐍 Code
# Discriminative: classify an image
from torchvision import models, transforms
model = models.resnet50(pretrained=True); model.eval()
# Generative: create an image from text
from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")
🎥 Watch Instead
▶
Video coming soon
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 🔑 Key Distinction
Discriminative vs generative vision models?
Tap to flip
🃏 Answer
GENERATIVE CV = Create images · DISCRIMINATIVE CV = Classify images
DiscriminativeImage → label or structured output. Classification, detection, segmentation.
GenerativeNoise or text → new image. GANs, diffusion, VAEs.
Vision-LanguageUnderstand AND generate — CLIP, DALL-E, GPT-4V, Gemini Vision
🐍 Code# Discriminative: classify an image
from torchvision import models, transforms
model = models.resnet50(pretrained=True); model.eval()
# Generative: create an image from text
from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")
Tap to flip back
💡 Concept Anchor
NON-MAXIMUM SUPPRESSION = Delete DUPLICATE boxes — keep only the most confident one per object
THE CLEANUP STEP EVERY DETECTOR NEEDS
Why NMS is essential in object detection
Object detectors predict hundreds of overlapping bounding boxes around each object. Without cleanup, you get 50 boxes around the same car. Non-Maximum Suppression fixes this: sort all boxes by confidence score, keep the highest-confidence box, delete any remaining boxes with IoU > threshold against the kept box, repeat. Result: one clean box per object. NMS is the final step in YOLO, Faster R-CNN, and every real-time detector.
Step 1
Sort all predicted boxes by confidence score, highest first
Step 2
Keep the top box; delete all boxes with IoU > threshold against it
Step 3
Repeat until no boxes remain — one clean box per object
🐍 Code
# NMS in torchvision
from torchvision.ops import nms
import torch
boxes = torch.tensor([[100,100,200,200],[105,105,205,205]], dtype=torch.float)
scores = torch.tensor([0.9, 0.75])
keep = nms(boxes, scores, iou_threshold=0.5)
# Returns indices of boxes to keep
🎥 Watch Instead
▶
Video coming soon
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 💡 Concept Anchor
Non-maximum suppression — what does it do?
Tap to flip
🃏 Answer
NON-MAXIMUM SUPPRESSION = Delete DUPLICATE boxes — keep only the most confident one per object
Step 1Sort all predicted boxes by confidence score, highest first
Step 2Keep the top box; delete all boxes with IoU > threshold against it
Step 3Repeat until no boxes remain — one clean box per object
🐍 Code# NMS in torchvision
from torchvision.ops import nms
import torch
boxes = torch.tensor([[100,100,200,200],[105,105,205,205]], dtype=torch.float)
scores = torch.tensor([0.9, 0.75])
keep = nms(boxes, scores, iou_threshold=0.5)
# Returns indices of boxes to keep
Tap to flip back
🎓 Common Exam Questions
0
Correct
0
Wrong
0
Remaining
🔗 Related Sub-Subjects
🔬 Deep Learning
CNNs, Vision Transformers, and diffusion models — the architectures powering computer vision.
Deep Learning →
📈 Model Evaluation
IoU, mAP, precision-recall — how computer vision models are benchmarked.
Model Evaluation →
🧠 AI Basics
The foundational AI/ML concepts that all computer vision builds on.
AI Basics →