🧠 Keep It in Mind: User-Centric Continual Spatial Intelligence Reasoning in Egocentric Video Streams
UCS-Bench is a benchmark and codebase for evaluating user-centric continual spatial intelligence in long egocentric video streams. The goal is to test whether models can perceive, remember, and reason about spatial environments from a user's first-person viewpoint over time.
This repository contains DirectMe, a spatial-memory-based video understanding framework that builds metric 3D scene graphs from egocentric videos and performs spatial question answering through structured retrieval.
- Dataset released: cocowy1/UCS-Bench on Hugging Face
- Paper page: ICML 2026 poster
- Code released: DirectMe pipeline, evaluation scripts, third-party perception adapters, and demo videos.
GitHub should render the following uploaded videos directly in the README.
outdoor_demo.mp4
indoor_demo.mp4
UCS-Bench focuses on long-horizon spatial reasoning in continuous egocentric video streams. Unlike standard video QA benchmarks that mainly test short clips or offline reasoning, UCS-Bench asks models to answer timestamped questions while respecting the user's current viewpoint and previously observed spatial memory.
DirectMe tackles this setting with a structured pipeline:

Egocentric Video
↓
Perception Modules
Depth Anything 3 / Scal3R / YOLO-World / SAM2
↓
Metric 3D Scene Graph
objects, places, 3D positions, temporal observations
↓
Spatial Retrieval
causal retrieval at the query timestamp
↓
Question Answering
rule-based or VLM-based answer generation
- Continual egocentric spatial memory: builds a scene graph over time instead of answering from isolated frames.
- Metric 3D reasoning: stores object positions, camera poses, distances, and egocentric directions.
- Timestamp-aware QA: retrieves only the information available before the question timestamp.
- Open-vocabulary perception: supports YOLO-World detection and optional SAM2 mask refinement.
- Third-party perception backbones: integrates Depth Anything 3, Scal3R, and SAM2 through Git submodules.
- Benchmark evaluation: includes scripts for evaluating DirectMe + VLM models on UCS-Bench.
UCS-Bench/
├── configs/ # Runtime configs, including SAM2 and Scal3R configs
├── directme/ # Core DirectMe package
│ ├── demo/ # Demo utilities and web visualization helpers
│ ├── eval/ # Evaluation utilities
│ ├── geometry/ # SE3 poses and geometric utilities
│ ├── mapping/ # 3D scene graph and offline mapping engine
│ ├── perception/ # Perception adapters and runtime builder
│ ├── qa/ # QA prompt and answer generation
│ ├── retrieval/ # Spatial retrieval and query parsing
│ ├── storage/ # JSON / SQLite storage helpers
│ └── viz/ # Visualization utilities
├── examples/
│ ├── run_real_pipeline.py # End-to-end DirectMe pipeline
│ ├── evaluate_ucsbench_vlm.py # DirectMe + VLM evaluation on UCS-Bench
│ ├── run_vlm_pipeline.py # VLM pipeline example
│ └── visualize_graph.py # Scene graph visualization
├── third_party/
│ ├── Depth-Anything-3/ # Submodule
│ ├── Scal3R/ # Submodule, adapted fork
│ └── sam2/ # Submodule
├── video/ # Demo videos
├── pyproject.toml
├── requirements.txt
└── README.md
Recommended:
git clone --recursive https://github.com/cocowy1/UCS-Bench.git
cd UCS-BenchIf you already cloned without --recursive, initialize third-party libraries manually:
git submodule update --init --recursiveThe third-party libraries are managed as Git submodules:
third_party/Depth-Anything-3
third_party/Scal3R
third_party/sam2
conda create -n ucsbench python=3.10 -y
conda activate ucsbench
pip install --upgrade pipInstall the PyTorch version matching your CUDA environment. For example, for CUDA 12.1:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121If your CUDA version is different, please follow the official PyTorch installation selector.
pip install -e ".[video,perception,viz,api,vlm]"This step is important. The perception backbones are not ordinary Python dependencies only; they live under third_party/ and should be installed locally:
pip install -e third_party/Depth-Anything-3
pip install -e third_party/Scal3R
pip install -e third_party/sam2If you want to reproduce the full development environment, you can additionally install:
pip install -r requirements.txtIf requirements.txt reinstalls a remote version of a third-party library, simply reinstall the local submodule afterwards:
pip install -e third_party/Depth-Anything-3
pip install -e third_party/Scal3R
pip install -e third_party/sam2
pip install -e .Model checkpoints are not included in this repository. Please download them separately and place them under ckpts/.
A recommended layout is:
ckpts/
├── sam2/
│ └── sam2.1_hiera_tiny.pt
├── yolo/
│ └── yolov8s-worldv2.pt
├── scal3r/
│ └── scal3r.pt
└── depth_anything_3/
Typical checkpoints include:
- Depth Anything 3 model weights
- Scal3R checkpoint for depth and camera pose estimation
- YOLO-World weights for open-vocabulary object detection
- SAM2 checkpoint for optional mask refinement
Large files such as datasets, checkpoints, output videos, and experiment logs should not be committed to GitHub.
The UCS-Bench dataset is available on Hugging Face:
https://huggingface.co/datasets/cocowy1/UCS-Bench
You can download it with:
pip install -U huggingface_hub
huggingface-cli download cocowy1/UCS-Bench \
--repo-type dataset \
--local-dir data/UCS-BenchAfter downloading, inspect the dataset layout:
find data/UCS-Bench -maxdepth 3 -type f | head -50The dataset contains egocentric videos and timestamped QA annotations. Depending on your local layout, you may organize the data as:
data/UCS-Bench/
├── videos/
├── metadata.jsonl
├── questions.jsonl
└── ...
For evaluation, the script expects a question annotation file and pre-built scene graphs. If your downloaded annotation file has a different name or schema, please adapt the path or convert it to the expected JSONL format.
Run the toy pipeline:
python examples/run_real_pipeline.py \
--toy \
--out runs/toyFirst extract frames from a video:
mkdir -p frames/demo
ffmpeg -i video/indoor_demo.mp4 \
-vf fps=1 \
frames/demo/frame_%06d.jpgThen run the real perception pipeline:
python examples/run_real_pipeline.py \
--frames frames/demo \
--out runs/demo \
--classes "cup,phone,bottle,laptop,chair,table,sink,fridge,door,bag,book" \
--question "我身边有什么物体?它们在哪里?" \
--language zh \
--device cuda \
--yolo-weights ckpts/yolo/yolov8s-worldv2.pt \
--sam2-checkpoint ckpts/sam2/sam2.1_hiera_tiny.pt \
--sam2-config configs/sam2.1/sam2.1_hiera_t.yamlIf you do not want to use SAM2, omit the SAM2 arguments:
python examples/run_real_pipeline.py \
--frames frames/demo \
--out runs/demo_no_sam2 \
--classes "cup,phone,bottle,laptop,chair,table,sink,fridge,door,bag,book" \
--question "What objects are around me?" \
--language en \
--device cuda \
--yolo-weights ckpts/yolo/yolov8s-worldv2.ptThe output directory will contain the generated spatial memory and debugging files, such as retrieved objects and scene graph information.
You can also run the packaged pipeline script:
bash run_pipeline.shBefore running it, please edit the script to match your local paths, GPU ID, video path, checkpoints, and output directory.
The evaluation script is:
examples/evaluate_ucsbench_vlm.py
It evaluates DirectMe + VLM on UCS-Bench by:
- loading pre-built scene graphs,
- retrieving relevant spatial context at each question timestamp,
- assembling a multiple-choice VLM prompt,
- calling a VLM backend,
- computing overall and per-dimension accuracy.
For each video, extract frames and build a scene graph:
python examples/run_real_pipeline.py \
--frames data/UCS-Bench/videos/video_001/frames \
--out data/UCS-Bench/graphs/video_001 \
--classes "cup,phone,bottle,chair,table,sink,fridge,door,bag,book" \
--storage-backend json \
--device cudaThe expected graph output is typically:
data/UCS-Bench/graphs/video_001/scene_graph.json
For example, if you are serving Qwen3-VL through vLLM:
python examples/evaluate_ucsbench_vlm.py \
--questions data/UCS-Bench/questions.jsonl \
--graphs-dir data/UCS-Bench/graphs \
--backend openai \
--model qwen3-vl-8b-instruct \
--base-url http://localhost:8000/v1 \
--api-key EMPTY \
--out results/directme_qwen3vl.jsonpython examples/evaluate_ucsbench_vlm.py \
--questions data/UCS-Bench/questions.jsonl \
--graphs-dir data/UCS-Bench/graphs \
--backend transformers \
--model Qwen/Qwen3-VL-8B-Instruct \
--out results/directme_qwen3vl.jsonTypical output files include:
runs/
├── demo/
│ ├── scene_graph.json
│ ├── last_query.json
│ ├── keyframes/
│ └── ...
results/
└── directme_qwen3vl.json
scene_graph.json stores the spatial memory built from the video. last_query.json stores the most recent retrieved objects and egocentric spatial relations for debugging.
This project uses the following third-party components:
- Depth Anything 3 for depth estimation
- Scal3R for depth and camera pose estimation
- SAM2 for segmentation mask refinement
- YOLO-World / Ultralytics for open-vocabulary object detection
They are included as submodules where applicable. To update them:
git submodule update --init --recursiveTo check submodule status:
git submodule statusPlease refer to the ICML 2026 paper page:
https://icml.cc/virtual/2026/poster/63682
Please refer to the Hugging Face dataset page:
https://huggingface.co/datasets/cocowy1/UCS-Bench
If you find UCS-Bench or DirectMe useful, please cite our work:
@article{wang2026keep,
title={Keep It in Mind: User Centric Continual Spatial Intelligence Reasoning in Egocentric Video Streams},
author={Wang, Yun and Xiao, Junbin and Lyu, Han and Wang, Yifan and Zuo, Jing and Zhang, Zhanjie and Huang, Hong and Wu, Dapeng and Yao, Angela},
journal={arXiv preprint arXiv:2606.15200},
year={2026}
}The full BibTeX will be updated after the official proceedings metadata is available.
We thank the authors and maintainers of Depth Anything 3, Scal3R, SAM2, Grounding_DINO, YOLO-World, and the open-source egocentric video datasets that support research in spatial intelligence.
This repository is released under the license specified in LICENSE. Please also follow the licenses and terms of use of the third-party libraries, pretrained models, and source datasets.