Sliding Window Inference

Sliding-window inference runs a fixed-size clip model over a long video by choosing window length and stride. It is the practical glue between clip-trained temporal action recognition models and untrimmed streams. The same windows can feed temporal localization, trigger-point prediction, or offline indexing.

Windows and strides

For video length , window size , and stride , windows are

Overlap improves coverage and boundary recall but increases compute. Predictions are then pooled, smoothed, non-max suppressed, or converted into trigger rules depending on the task.

Worked example

For frames, window size , and stride , the full windows are:

windowintervalcovered frames
0, 1, 2, 3, 4, 5
4, 5, 6, 7, 8, 9
8, 9, 10, 11, 12, 13
12, 13, 14, 15, 16, 17

Frames 4, 5, 8, 9, 12, and 13 are covered twice because adjacent windows overlap. Frames 18 and 19 are uncovered because the simple full-window schedule stops at frame 18. Production code usually adds a final padded or shifted window so the tail of the stream is not silently missed.

Sliding-window inference trades overlap against compute and can leave tail frames uncovered without a final padded window.

Caveats

Stride determines both cost and worst-case detection delay. Windows split actions at boundaries, so smoothing and non-max suppression must be tuned with tIoU metrics. For real-time video understanding, buffering a full window can dominate latency.

References