RETAIN

Online Visual Query Localisation with Bounded Object-Level Memory

Sparsh Rastogi1 Toan Nguyen1 Chinmaya Panigrahy2 Jatin Bedi2 Flora D. Salim1
1University of New South Wales2Thapar Institute of Engineering and Technology
Plot of storage against video length: offline methods grow linearly with the video while RETAIN stays at 0.37 GB.
Storage as a function of video length. Offline methods keep the whole recording or its per-frame features; RETAIN keeps a fixed number of object slots.
0.37 GBfixed storage for any video length, with 2,048 object slots and a 20 s frame buffer
+30%relative tAP25 over EAGLE, the strongest offline method, on Ego4D VQ2D
0.19 smedian query time, answered from memory alone; 10–44× faster than offline methods on average
What goes into the memory and what leaves it: a 5-minute clip as a time-lapse. New objects claim a slot (yellow), objects seen again refresh theirs (blue), and once all 2,048 slots are taken the least recently updated slot is evicted (red). More clips are in Videos.

Abstract

With the growing adoption of smart glasses, wearable cameras and autonomous robots, an increasing amount of egocentric video is becoming available, powering applications such as lost-object retrieval, personalised assistance and robot navigation. Many of these applications rely on visual query localisation (VQL), which involves localising the most recent occurrence of a given object in previously observed video. However, existing VQL methods mostly operate offline, storing the entire recording and searching it for every query, which causes storage and latency to grow with the video length and makes their deployment on edge devices impractical.

To address this, we propose RETAIN, an online, memory-based VQL framework that condenses the stream into a bounded memory containing a fixed number of object slots. As the video streams, each object either updates its existing slot or occupies a new one, thereby maintaining the track of its latest occurrence. At inference time, queries are answered solely from these slots using lightweight learned components, without revisiting the video. On the Ego4D VQ2D benchmark, RETAIN achieves relative gains of 30% in temporal AP25 and 5% in spatio-temporal AP25 over the best offline method, while keeping its storage fixed regardless of video length and answering queries 10–44× faster on average.

Method

Overview of RETAIN: online write on the left, bounded memory of K object slots in the middle, query-time read on the right.
During the video

Online write

Region tokens from each written frame are matched to the memory. An object either refreshes its slot or claims a new one. When an observation ends, it is tracked once over the 20 s rolling buffer, and the frames are then discarded.

Fixed size

Bounded memory

K object slots, each holding the most recent observation of one object: an appearance vector, its last-seen time, its box track and a few crops. When the memory is full, the least recently updated slot is evicted.

When a query arrives

Query-time read

The query crop retrieves candidate slots by similarity. Lightweight learned components then re-rank, verify against stored crops, choose a candidate, refine its box and estimate a confidence. The video is never revisited.

Inside the memory

Replay how the memory fills while a video streams. The left panel shows each display frame with the objects written at that moment; the grid on the right shows all 2,048 slots. A slot shows a strong shade when it is written and fades as it ages; once every slot is taken, the least recently updated one is evicted to make room. Hover or focus a slot to see what it holds, and pin it to mark its writes on the timeline.

Switch to What it holds to see the stored crops of every object in memory at the current moment, newest first; play the video to watch objects arrive and leave. The write log below lists the latest writes and evictions, and the lifetime chart shows how long objects stay before they are evicted.

The replay re-runs the paper's model on the same GPU type (A100, fp16) and reproduces its memory: every example query reads the same slots, with the same similarity scores, as in the reported results.

The interactive replay loads when this section scrolls into view.

Storage

Offline methods keep the recording, or features of every frame, so their storage grows with the video. RETAIN keeps a fixed number of slots, so its storage does not depend on how long the video runs. Drag the slider to compare the methods at a given video length; the lines pass through the 5 min and 1 h figures in the table below.

The chart loads when this section scrolls into view.

Answering a query

Step through how one query is answered from the memory alone: retrieve candidate slots, re-rank them, verify them against their stored crops, choose one, and read off when and where the object was last seen. The examples include successes and typical failures.

The walkthrough loads when this section scrolls into view.

Results

Comparison with VQL methods on the Ego4D [1] VQ2D validation split (4,507 queries). Bold marks the best result and underline the second best.

MethodtAP25stAP25Success (%)Recovery (%)
VQLoC [2]0.280.2151.942.8
PRVQL [3]0.330.2555.643.3
HERO-VQL [4]*0.380.2861.144.9
RELOCATE [5]0.470.3557.847.3
EAGLE [6]*†0.470.4261.352.1
ESOM [7]*†‡ (online)0.000.004.0–
RETAIN, K = 20480.610.4462.549.8
RETAIN, K = 40960.620.4463.150.4
RETAIN, K = 81920.610.4563.150.4

* Taken from the original papers, since code or weights are not available. † Trained with additional data. ‡ Evaluated on a 450-query subset; recovery not reported. VQLoC, PRVQL and RELOCATE were rerun with the authors' released code and weights.

Storage and query time

MethodStorage (GB)Query (s)
5 min1 hmedianmean
VQLoC [2]0.62 (1.7×)7.5 (20×)50.8 (268×)55.5 (12×)
PRVQL [3]0.62 (1.7×)7.5 (20×)41.3 (217×)47.0 (10×)
RELOCATE [5]31.8 (85×)382 (1,021×)97.5 (513×)200 (44×)
RETAIN0.370.370.19≈4.5

Factors are relative to RETAIN. RETAIN storage includes the 20 s rolling buffer. The mean query time includes the 29% of queries whose candidate is still being tracked when the query arrives.

Memory size

Accuracy and storage for 512 to 8192 memory slots; success rises to 62.5 percent at 2048 slots and saturates afterwards.
Success rises from 51.7% with 512 slots to 62.5% with 2,048 and saturates beyond that, while storage keeps growing.

Qualitative results

Each row shows the visual query, the annotated occurrence and the response of each method with its spatio-temporal IoU. Rows (a–d) are successes of RETAIN; rows (e, f) are typical failures. Frames are shown as 4× close-ups.

Grid of qualitative examples comparing RETAIN with VQLoC, PRVQL and RELOCATE on six queries.

Videos

Short clips rendered from the same replay data as the interactive demos above. The first shows a long stream; each of the others follows one example query from the query crop to the answer, including three failures.

Long stream. Occupancy reaches 2,048 slots after 1.5 minutes and then stays flat while slots are recycled.
Success. The top-cosine slot is the right moment, 80 s after the pillow was last seen.
Distractor. The top-cosine slot is wrong; re-ranking and verification move the answer to the right slot.
Old sighting. Last seen almost four minutes before the query, and its slot still answers it.
Small object. Scissors under 1% of the frame, found in a full long-stream memory.
Late in a long stream. Asked over nine minutes in; the slot from 90 s earlier is still in memory.
Failure: evicted. The hammer's slots are evicted shortly before the query, so no candidate points to the right moment.
Failure: wrong choice. A correct slot is among the top three, but the choice step picks another sighting.
Failure: box misses. The right moment is found, but the box on this tiny object does not overlap enough.

References

RETAIN is evaluated on the Ego4D Episodic Memory VQ2D benchmark [1]; the video frames and clips on this page are from Ego4D and are shown under the Ego4D license. RETAIN builds on REN region encodings [8], DINOv3 [10] and DINOv2 [9] features, and the SAM 3 tracker [11], each used under its own license. Baseline results for VQLoC [2], PRVQL [3] and RELOCATE [5] come from the authors' released code and weights.

  1. Kristen Grauman, Andrew Westbury, Eugene Byrne, et al.. Ego4D: Around the World in 3,000 Hours of Egocentric Video. CVPR 2022.
  2. Hanwen Jiang, Santhosh Kumar Ramakrishnan, Kristen Grauman. Single-Stage Visual Query Localization in Egocentric Videos. NeurIPS 2023.
  3. Bing Fan, Yunhe Feng, Yapeng Tian, James Chenhao Liang, Yuewei Lin, Yan Huang, Heng Fan. PRVQL: Progressive Knowledge-guided Refinement for Robust Egocentric Visual Query Localization. arXiv:2502.07707, 2025.
  4. Joohyun Chang, et al.. HERO-VQL: Hierarchical, Egocentric and Robust Visual Query Localization. BMVC 2025.
  5. Savya Khosla, Sethuraman T, Alexander Schwing, Derek Hoiem. RELOCATE: A Simple Training-Free Baseline for Visual Query Localization Using Region-Based Representations. CVPR 2025.
  6. Yifei Cao, Yu Liu, Guolong Wang, Zhu Liu, Kai Wang, Xianjie Zhang, Jizhe Yu, Xun Tu. EAGLE: Episodic Appearance- and Geometry-aware Memory for Unified 2D-3D Visual Query Localization in Egocentric Vision. AAAI 2026.
  7. Zaira Manigrasso, Matteo Dunnhofer, Antonino Furnari, et al.. Online Episodic Memory Visual Query Localization with Egocentric Streaming Object Memory. WACV 2026.
  8. Savya Khosla, Sethuraman TV, Barnett Lee, Alexander Schwing, Derek Hoiem. REN: Fast and Efficient Region Encodings from Patch-Based Image Encoders. NeurIPS 2025.
  9. Maxime Oquab, et al.. DINOv2: Learning Robust Visual Features without Supervision. arXiv:2304.07193, 2023.
  10. Oriane Siméoni, et al.. DINOv3. arXiv:2508.10104, 2025.
  11. Nicolas Carion, et al.. SAM 3: Segment Anything with Concepts. arXiv:2511.16719, 2025.

BibTeX

@misc{rastogi2026retain,
  title         = {{RETAIN}: Online Visual Query Localisation
                   with Bounded Object-Level Memory},
  author        = {Rastogi, Sparsh and Nguyen, Toan and Panigrahy, Chinmaya
                   and Bedi, Jatin and Salim, Flora D.},
  year          = {2026},
  eprint        = {2612.00920},
  archivePrefix = {arXiv},
  primaryClass  = {cs.CV},
  url           = {https://arxiv.org/abs/2612.00920}
}