AI Glossary / Graphs and symbolic AI / Intermediate

Sliding window

Definition

A sliding window is a fixed-size region moved across an input so that a repeated operation can be applied at successive positions. In the computer-vision context of the supplied glossary, a detector examines image windows at different locations, often across multiple scales, to identify candidate objects.

What it means

A classifier trained to recognize an object in a cropped image does not automatically know where that object appears in a larger scene. Sliding-window detection supplies candidate crops by systematically moving a window over the image.
The window has a width and height, while the stride determines how far it moves between evaluations. Multiple scales address objects that occupy different numbers of pixels. The same general phrase also appears in time-series processing and sequence algorithms, but this entry focuses on image detection. Its location in the source's appearance-recognition section establishes that intended meaning.

How it works

Choose a window size compatible with the detector. Move it across valid image positions, compute features or model outputs, and retain positions whose scores meet the detection rule. For multiple scales, repeat on resized versions of the image or use another explicitly defined scaling arrangement.
Overlapping windows often produce several detections around one object, so a later grouping or suppression step may consolidate them. The scan specifies where the detector looks; the learned model determines how it scores each candidate. Efficient implementations can reuse computations rather than independently recomputing every crop from scratch.

Three practical examples

  • A computer-vision lesson can apply an object classifier to many image regions to turn crop recognition into candidate localization.
  • A controlled inspection prototype can scan a surface image for repeated visual patterns using a fixed-size detector.
  • A historical pedestrian-detection example can combine gradient-based features with a classifier evaluated over image locations and scales.

Think of it this way

Think of moving a small viewing frame across a large poster and inspecting each framed area. A smaller step gives more overlapping views. The analogy is limited because the computer may share calculations between windows, and recognizing something in a crop requires a trained or otherwise specified scoring rule.

Worked example

Consider an original image that is 100 pixels wide and 80 pixels high. Use a 20-by-20-pixel window, stride 10 in both directions, and no padding. Only windows entirely inside the image are evaluated.
Horizontal starting positions are 0, 10, 20, 30, 40, 50, 60, 70, and 80: nine positions. Vertical starts are 0 through 60 in steps of 10: seven positions. The total is 9 × 7 = 63 windows.
The general count for this convention is (floor((W − w)/sx) + 1) × (floor((H − h)/sy) + 1), when the image is at least as large as the window. Here W and H are image dimensions, w and h are window dimensions, and sx and sy are strides.
Reduce both strides to 5. There are now 17 horizontal positions and 13 vertical positions, giving 221 windows. This is more than three times the first count, while providing denser candidate locations.
Next evaluate a second image-pyramid level resized to 50 by 40 pixels, keeping the 20-by-20 window and stride 10. It contributes 4 × 3 = 12 windows, for 75 across the two original-stride levels. A 20-pixel window at half resolution corresponds to 40 pixels in the original image. These counts describe evaluations, not detected objects: all, some, or none of the windows may pass the score threshold.

Illustrative case study

In a fictional case, Brook Inspection scans images of printed packaging for a particular emblem. A small stride finds several overlapping positive windows around the same emblem. The team initially counts each positive window as a separate object and obtains inflated totals.
Developers add a reviewed grouping rule and test images containing nearby distinct emblems as well as single emblems. They also check scale variation and partially visible examples. This separates candidate generation, classification, and final object counting. The case is illustrative and makes no claim about real inspection accuracy.

Common misconceptions and mistakes

A sliding-window scan does not itself recognize objects. It generates locations at which a recognition method is evaluated. More windows do not guarantee better results, especially when the detector or threshold is poorly matched to the task.
Stride, padding, and boundary conventions change the evaluation count. A fixed scale can miss objects whose apparent size differs from the training crop. Overlapping positives are not necessarily separate objects. Conversely, aggressive suppression can merge nearby real objects. Modern detection architectures need not implement a literal crop-by-crop loop even when their computations have a related spatial structure.

Business use

Business teams assessing a vision prototype should separate scanning coverage from model accuracy. Ask whether expected object sizes, image resolutions, and edge cases are covered, and whether latency is measured for the complete image rather than a single crop.
Record window size, stride, scale settings, score threshold, and grouping rules. Evaluate misses, false detections, and counting errors on representative scenes. If input resolution changes, recheck the pipeline: a pixel-based window can correspond to a different physical object size after resizing or camera changes.

People also ask

Is the window always square?

No. Its shape and dimensions depend on the task and model.

Does smaller stride always mean more objects detected?

No. It means more candidate positions; detection depends on scores and postprocessing.

Is this the same as a moving average over time?

Both use moving regions, but the vision application here scans spatial image areas rather than a temporal series.

Check your understanding

Why does the first example use nine horizontal positions rather than ten?

Answer: The last valid start is x = 80, because a 20-pixel window starting at x = 90 would extend beyond a 100-pixel image under the no-padding rule.

Related terms

  • Stride
  • Bounding box
  • Convolution
  • object detection
  • image pyramid
  • histogram of oriented gradients
  • classifier
  • non-maximum suppression

Learn next

Keep the 100-by-80 image and 20-by-20 window but use stride 20. There are 5 × 4 = 20 windows. Compare the coverage and candidate alignment with stride 10, without assuming that lower computation automatically preserves detection quality.

  • Stride

More in Graphs and symbolic AI

  • Skolem constant - A Skolem constant is a fresh constant symbol introduced to represent an existential witness when that witness does not depend on universally quantified...
  • Skolemization - Skolemization is a transformation of first-order logic formulas that removes existential quantifiers by introducing fresh constants or functions for their...
  • Slack - In scheduling, slack is the amount of timing flexibility available to an activity under the schedule's assumptions.
  • Slop (search algorithms) - Slop is a positional tolerance used in phrase or proximity search.
  • SMA* - SMA*, or Simplified Memory-Bounded A*, is a heuristic search algorithm that works within a memory limit.
  • Small-scale learning - Small-scale learning refers to machine learning with a relatively limited training dataset.

Sources

Sources: Original AIMA glossary context, appearance-based object recognition: https://raw.githubusercontent.com/aimacode/aima-glossary/master/sentences.txt . Dalal and Triggs, Histograms of Oriented Gradients for Human Detection: https://lear.inrialpes.fr/people/triggs/pubs/Dalal-cvpr05.pdf . OpenCV official HOGDescriptor documentation, window stride and multiscale detection: https://docs.opencv.org/4.x/d5/d33/structcv_1_1HOGDescriptor.html .

Previous: Sliced score matching Next: Sliding window based part-of-speech tagging

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer