Sliding windows in convolutions
A sliding window is a technique in computer vision and signal processing where a small fixed-size window moves step-by-step across data…
Sliding windows in convolutions

A sliding window is a technique in computer vision and signal processing where a small fixed-size window moves step-by-step across data (such as an image or sequence) to analyse one portion at a time.
In computer vision, the window scans different regions of an image, and each region is checked to determine whether it contains a specific object or feature.
For example:
- a small box moves across an image,
- each cropped section is passed into a model,
- and the model predicts what is inside that region.
The window “slides” horizontally and vertically until the entire image has been covered.
In simple terms, a sliding window allows a computer to search through an image piece by piece instead of analyzing the whole image at once.
How Sliding Windows Work?
Imagine trying to find a cat in a large image. Instead of analyzing the entire image at once, the algorithm:
- takes a small section,
- checks for a cat,
- moves slightly to the right,
- checks again,
- and repeats the process across the image.
The same process is repeated vertically until every region has been analyzed.
This creates a grid-like scanning mechanism across the image.
Why Sliding Windows Were Important
Sliding windows solved an important problem in early computer vision:
classification models could identify objects, but they could not locate them.
For example: A CNN classifier could say “this image contains a dog.” But it could not say where the dog was located. Sliding windows introduced localization by checking multiple regions independently. This became one of the earliest approaches to object detection.
The Main Challenges
Although effective, sliding windows had several limitations.
1. Computational Cost
Thousands of windows may need to be evaluated for a single image.
This becomes extremely slow, especially with deep neural networks.
2. Multiple Object Sizes
Objects can appear at different scales. To solve this, algorithms used image pyramids: resizing the image multiple times, then applying sliding windows repeatedly. This increased computation even more.
3. Overlapping Predictions
Nearby windows often produced duplicate detections. This led to the development of techniques like Non-Maximum Suppression (NMS). Sliding Windows and CNNs

In the first row, It shows a CNN trained on a small image of size 14 × 14 × 3.
The image passes through: a convolution layer, max pooling, and fully connected (FC) layers.
At the end, the network produces a 1 × 1 × 4 output, which represents predictions for one region of the image.
This works well for classification because the model processes only one cropped image at a time.
The Problem with Traditional Sliding Windows
Normally, in sliding window detection: A small region is cropped from the image.The CNN runs on that crop.The window moves slightly. CNN runs again.
This means the same computations are repeated many times for overlapping regions making it extremely slow.
For the second Row; Applying the CNN on a Larger Image
Instead of cropping many small images separately, the middle row feeds a larger image (16 × 16 × 3) into the same CNN.
Now something interesting happens:
- The convolution layers naturally slide across the image,
- producing outputs for multiple regions simultaneously.
Instead of getting:
- one prediction,
the network now produces:
- a 2 × 2 × 4 output.
Each cell corresponds to predictions for a different region of the image.
This is equivalent to running sliding windows four times but much faster.
Last row, Fully Convolutional Sliding Window
The bottom row extends the idea further using an even larger image (28 × 28 × 3). Now the CNN produces:
- an 8 × 8 × 4 output grid.
Each position in the output grid represents predictions for a different window location in the original image.
Which implies, the CNN is effectively scanning the image automatically,
without manually cropping windows. The convolution operation itself performs the sliding process.
This approach reduced computation because overlapping regions share calculations. Instead of running the CNN thousands of times independently, convolutions reuse computations efficiently. This idea became a breakthrough in object detection and eventually contributed to modern architectures like YOLO, SSD, and Faster R-CNN.
Conclusion
The convolution implementation of sliding windows marked a major turning point in computer vision. Instead of repeatedly scanning cropped regions one by one, CNNs made the process faster and more efficient by sharing computations across overlapping regions.
Understanding this concept helps explain how computer vision evolved from slow brute-force scanning methods to the powerful deep learning detection systems that now power autonomous vehicles, surveillance systems, healthcare imaging, and intelligent applications worldwide.
References
메타데이터
- post_id
- b6f52e6bccdd
- slug
- sliding-windows-in-convolutions-b6f52e6bccdd
- url
- https://medium.com/@berniceawinpang/sliding-windows-in-convolutions-b6f52e6bccdd
- canonical_url
- https://medium.com/@berniceawinpang/sliding-windows-in-convolutions-b6f52e6bccdd
- author_url
- https://medium.com/@berniceawinpang
- status
- ok
- fetched_at
- 2026-06-09 15:37:30