Sliding window exhaustively classifies every fixed-size crop of an image. Image pyramids handle scale variation. Non-maximum suppression collapses duplicate detections into one.
Object detection must answer: where are the objects? Unlike classification (one label per image), detection requires finding every instance at an unknown location. The brute-force solution is simple: slide a fixed-size window across the entire image, run a classifier on each crop, and report every location that scores above a threshold. This is exactly what the Viola-Jones face detector (2001) and the HOG+SVM pedestrian detector (Dalal & Triggs, 2005) did, and they were state-of-the-art for nearly a decade.
Classic pipeline: (1) Compute HOG features for the image. (2) Slide a 128×64 (person-sized) window at every position with stride s. (3) Extract the HOG descriptor for that crop. (4) Run it through a linear SVM. (5) If score > threshold, record the bounding box + score. (6) Apply NMS to remove duplicates. This pipeline is fully deterministic and interpretable, but slow: O(H × W / s²) classifier calls per pyramid level.
A fixed window finds objects only at one size. A person 2 metres away occupies fewer pixels than one 1 metre away. The solution is an image pyramid: repeatedly downsample the image by a scale factor (typically 0.75 or 0.5) and run the same fixed-size window at each level. The window effectively sees the object at progressively larger scales. A bounding box detected at pyramid level k is rescaled by 1/scale^k to map back to original image coordinates.
A detected object triggers high scores at many adjacent windows — all slightly overlapping boxes around the same person. NMS reduces these to a single best box. The algorithm is greedy: sort all detections by score descending, keep the highest-scoring box, suppress (remove) all other boxes whose Intersection-over-Union (IoU) with the kept box exceeds a threshold (typically 0.5), then repeat on the remaining boxes.
NMS step-by-step: (1) Compute score for each candidate box. (2) Sort boxes by score, highest first. (3) Take the top box — it's a confirmed detection. (4) Compute IoU between it and all remaining boxes. (5) Discard any box with IoU > 0.5 (they overlap the same object). (6) Move to the next surviving box and repeat. Result: one box per distinct object, the highest-confidence one. IoU = area of intersection / area of union.
Sliding window is conceptually clean but computationally redundant: adjacent windows share almost all pixels yet each is processed independently. Modern detectors eliminate this waste with shared convolutional features.
Say the answer out loud before revealing — recalling is what makes it stick. ➜ Next: VGGNet and InceptionNet
Why does sliding window detection need image pyramids?
What does Non-Maximum Suppression (NMS) solve?
What is the computational problem with sliding window detectors?
How do YOLO/SSD differ from sliding window?