#1555·rf-detr

Explore temporal feature caching for faster video inference

Author: BordaCreated Sep 28, 2026Updated Sep 28, 2026
Labelsenhancement

Search before asking

  • Confirm that no existing issue covers this request before submitting.

This check remains unconfirmed in the draft.

Description

Could we explore an optional video-inference mode that reuses backbone calculations between consecutive frames, updating regions that have changed rather than recomputing everything?

The current forward path runs the image through the backbone and then the decoder. The proposed exploration would introduce reuse across frames, primarily inside the backbone, while keeping the decoder unchanged initially.

This is a feasibility request, not a proposal for a drop-in LLM-style KV cache. The question is whether temporal feature reuse—including, potentially, attention keys and values—can reduce actual inference latency with an acceptable accuracy trade-off.

Use case

Real-time detection on continuous video streams, particularly fixed-camera or low-motion scenes where much of the image changes little between frames.

The goal would be to produce detections on every frame with less computation, rather than simply skipping frames. A useful evaluation should also cover camera movement and newly appearing objects, not just easy, mostly static scenes.

Additional

Possible scope

Stage What to explore, in plain English Initial role
Backbone: attention keys and values Recalculate these intermediate values only for regions selected for an update. A narrow comparison experiment.
Backbone: broader intermediate features Reuse additional feature-processing results for regions with little change, rather than caching only keys and values. Main direction to investigate.
Decoder and prediction heads Run normally on every frame using the updated and cached backbone output. Keep unchanged initially.

Caching only keys and values would still leave the attention calculation and feed-forward processing to run unless those operations are also modified. This is why broader feature reuse seems worth comparing against KV-only caching.

Relevant code: DINOv2 backbone with windowed attention.

Important limitation

The DINOv2 backbone implementation includes windowed and full-image attention. Consequently, an unchanged patch of pixels can still acquire different internal features when something elsewhere changes.

A pixel-difference mask alone would not guarantee valid feature reuse. The prototype should therefore treat reuse as potentially approximate and evaluate how errors accumulate.

Suggested exploration

  1. Profile the baseline. Identify which backbone operations dominate runtime and where selective updates could actually avoid work. The update decision should happen before the expensive calculation—not after running the full backbone.

  2. Build a limited, opt-in prototype. Start with one model variant and fixed resolution. Explore a configurable update threshold or token budget, periodic full refreshes, and resets after scene changes. Keep cache memory bounded and state separate for each video stream.

  3. Benchmark the trade-off. Compare against optimized every-frame inference and a simpler detector-plus-tracker baseline that skips some detector calls. Keep hardware, resolution, and precision comparable.

Measurements should include whole-model and end-to-end latency, slow-frame latency, cache memory, detection accuracy, and delay in detecting newly appearing objects.

Include cache-management and full-refresh costs. Test small and fast-moving objects, lighting changes, camera motion, and scene cuts.

Expected benefit

Unknown until measured. This request does not assume a particular speed-up.

The first useful outcome could be a benchmark showing whether saved computation outweighs cache-management overhead, and under which video conditions.

Related work

Eventful Transformers: Leveraging Temporal Redundancy in Vision Transformers explores selectively reprocessing tokens that change significantly between video inputs and evaluates the approach on video object detection.

It is a relevant starting point, but its results should not be treated as RF-DETR performance estimates.

Would an experimental implementation and benchmark be a useful first contribution before considering a supported video-caching API?

Are you willing to submit a PR?

  • I would like to contribute a PR.

Left unconfirmed in this draft.