Multimedia & Machine Learning Algorithms · Multimedia Algorithms
Object Detection and Recognition
Explanation
Classification vs Detection?
- Classification: "Is there a cat in the image?" — outputs one label.
- Detection: "Where is the cat?" — outputs bounding boxes + labels.
Sliding Window — The Basic Idea
The simplest approach: run a classifier on every patch at multiple scales.
For input , window , stride :
Problem: very slow; millions of runs per image.
Intersection over Union (IoU)
IoU measures how much two boxes overlap:
- : boxes are identical.
- : no overlap.
- In practice, counts as a correct detection (TP).
Computation:
where .
Anchor Boxes and Bounding Box Regression
Instead of searching from scratch, the model starts from anchors (reference boxes of various sizes and aspect ratios) and learns relative offsets:
The log normalization for ensures symmetric relative changes (doubling width: , not 1 — this is natural log , not ).
Non-Maximum Suppression (NMS)
Detectors tend to output many boxes for the same object. NMS removes duplicates:
1. Sort boxes by confidence score — highest to lowest.
2. Take the highest-scoring box mark as kept.
3. Remove every other box whose IoU with the kept box threshold.
4. Repeat from step 2 on remaining boxes.
R-CNN, Fast R-CNN, Faster R-CNN, YOLO
YOLO in brief: divides image into cells; each cell predicts boxes + class probabilities.
Mean Average Precision (mAP)
Average Precision (AP) for one class = area under the Precision-Recall curve.
mAP = average AP over all classes:
- Classification: "Is there a cat in the image?" — outputs one label.
- Detection: "Where is the cat?" — outputs bounding boxes + labels.
Sliding Window — The Basic Idea
The simplest approach: run a classifier on every patch at multiple scales.
For input , window , stride :
Problem: very slow; millions of runs per image.
Intersection over Union (IoU)
IoU measures how much two boxes overlap:
- : boxes are identical.
- : no overlap.
- In practice, counts as a correct detection (TP).
Computation:
where .
Anchor Boxes and Bounding Box Regression
Instead of searching from scratch, the model starts from anchors (reference boxes of various sizes and aspect ratios) and learns relative offsets:
The log normalization for ensures symmetric relative changes (doubling width: , not 1 — this is natural log , not ).
Non-Maximum Suppression (NMS)
Detectors tend to output many boxes for the same object. NMS removes duplicates:
1. Sort boxes by confidence score — highest to lowest.
2. Take the highest-scoring box mark as kept.
3. Remove every other box whose IoU with the kept box threshold.
4. Repeat from step 2 on remaining boxes.
R-CNN, Fast R-CNN, Faster R-CNN, YOLO
| Model | Key idea | Speed |
|---|---|---|
| R-CNN | Selective Search CNN per region | Slow (47 s/image) |
| Fast R-CNN | Single CNN + RoI Pooling | Faster |
| Faster R-CNN | RPN (Region Proposal Network) | Very fast |
| YOLO | Uniform grid, direct prediction | Real-time |
YOLO in brief: divides image into cells; each cell predicts boxes + class probabilities.
Mean Average Precision (mAP)
Average Precision (AP) for one class = area under the Precision-Recall curve.
mAP = average AP over all classes:
Interactive Visualization
Loading visualization
Worked Examples
Practice
Exercise 1 of 6
1
Compute the IoU between box – and box –. Give a decimal.
★Quiz
Test your knowledge from this lesson
A mix of questions from the lesson — each attempt varies slightly
Answer at least 4 out of 5 questions correctly to pass (70%)