Ocula-Train / README.md
BixingWu's picture
Initial commit of project Ocula
8254395
|
Raw History Blame Contribute Delete
15.3 kB
---
license: other
license_name: ocula-and-upstream-annotations
license_link: https://huggingface.co/datasets/Ocula-ASP/Ocula-Train#5-license--citation
arxiv: 2612.02359
task_categories:
- video-text-to-text
- visual-question-answering
language:
- en
pretty_name: Ocula-Train
tags:
- active-sparse-perception
- video-understanding
- video-question-answering
- multimodal
- gaze-prediction
- arxiv:2612.02359
configs:
- config_name: default
data_files:
- split: train
path: viewer/stage2_ranked_gaze.parquet
---
# Ocula-Train
**[Project Page](https://ocula-asp.github.io/)** · **[Paper (arXiv:2612.02359)](https://arxiv.org/abs/2612.02359)** · **[Code (`hku-sail/Ocula`)](https://github.com/hku-sail/Ocula)** · **[8B Checkpoints (`Ocula-ASP/Ocula-Qwen3-VL-8B`)](https://huggingface.co/Ocula-ASP/Ocula-Qwen3-VL-8B)** · **[4B Checkpoints (`Ocula-ASP/Ocula-Qwen3-VL-4B`)](https://huggingface.co/Ocula-ASP/Ocula-Qwen3-VL-4B)** · **[Collection](https://huggingface.co/collections/Ocula-ASP/ocula-6b115964a830efa7fab9bd80)**
`Ocula-ASP/Ocula-Train` releases the complete, sanitized two-stage training annotations for **Ocula: Active Sparse Perception Makes Better Visual Encoders**—comprising the Stage-1 Visual LoRA Reader QA manifest and execution placement ledgers, the Stage-2 Recurrent Gaze Predictor manifests and offline ranked teacher supervision (`388,173` labeled native-pair decisions across `9,003` manifest clips from `8,998` distinct source videos), and a ready-to-browse Parquet preview table (`viewer/stage2_ranked_gaze.parquet`).
> **Annotations only (no redistributed videos):** To respect upstream video licensing, this repository distributes acquisition manifests, QA records, gaze trajectories, and ranked teacher labels with portable relative media paths (`{"path": "<relative_path>", "bytes": <exact_size>}`). Source videos are obtained separately from their five official upstream datasets and mounted under `data/media/` (or any `--media-root`).
---
## 1. Dataset Structure & File Inventory
All large JSON/JSONL training artifacts are compressed with `zstd -19` (`46.70 MiB` compressed vs. `877.63 MiB` uncompressed). The Hugging Face Dataset Viewer reads `viewer/stage2_ranked_gaze.parquet` directly.
| Path | Stage & Role | Entries / Decisions | Uncompressed | Compressed |
| --- | --- | --- | ---: | ---: |
| `stage1_reader/reader_clean.json.zst` | Stage-1 cleaned QA acquisition manifest (`fit` + `reader_fit_dev`) | `13,091` fit + `64` dev entries (`142,108` train QAs) | `457.44 MiB` | `22.63 MiB` |
| `stage1_reader/placements/fit.jsonl.zst` | Stage-1 centre-warp execution placements (`fit`) | `13,091` videos / `497,594` pair reads (`37,100` resets) | `73.81 MiB` | `9.06 MiB` |
| `stage1_reader/placements/dev.jsonl.zst` | Stage-1 centre-warp execution placements (`reader_fit_dev`) | `64` videos / `2,642` pair reads (`192` resets) | `0.40 MiB` | `0.07 MiB` |
| `stage2_predictor/protocol.json.zst` | Frozen sensor-independent teacher protocol (`prompt_sha256` verified) | `9,003` selected clips | `36.85 MiB` | `1.16 MiB` |
| `stage2_predictor/dev_roster.json` | Frozen 64-video held-out DEV roster (plaintext JSON) | `64` entries (`16` per source) | `17.08 KiB` | — |
| `stage2_predictor/fit/manifest.json.zst` | Stage-2 `fit` stride-one `0.3 s` acquisition manifest | `8,939` entries (`812,342` source frames) | `159.51 MiB` | `5.01 MiB` |
| `stage2_predictor/fit/labels.jsonl.zst` | Stage-2 `fit` causal teacher primary points & masks | `8,939` clips / `385,246` labeled (`400,279` masked) | `125.24 MiB` | `4.66 MiB` |
| `stage2_predictor/fit/candidates.jsonl.zst` | Stage-2 `fit` 1–3 ranked gaze candidates `[x, y, importance, changing]` | `8,939` clips / `385,246` decisions | `21.96 MiB` | `3.95 MiB` |
| `stage2_predictor/dev/manifest.json.zst` | Stage-2 `dev` stride-one `0.3 s` acquisition manifest | `64` entries (`6,173` source frames) | `1.27 MiB` | `0.05 MiB` |
| `stage2_predictor/dev/labels.jsonl.zst` | Stage-2 `dev` causal teacher primary points & masks | `64` videos / `2,927` labeled (`3,054` masked) | `0.98 MiB` | `0.06 MiB` |
| `stage2_predictor/dev/candidates.jsonl.zst` | Stage-2 `dev` 1–3 ranked gaze candidates | `64` videos / `2,927` decisions | `0.17 MiB` | `0.03 MiB` |
| `viewer/stage2_ranked_gaze.parquet` | Unified HF Dataset Viewer preview table (`fit` + `dev`) | `388,173` labeled decision rows (`13` columns) | `6.40 MiB` | — |
| `THIRD_PARTY_NOTICES.txt` | Attribution and license texts for the upstream QA records | — | — | — |
| `SHA256SUMS` | SHA-256 checks for all other published files | All payloads and notices | — | — |
### Source Breakdown
| Source | Stage-1 `fit` | Stage-1 `reader_fit_dev` | Stage-1 Train QAs | Stage-2 `fit` | Stage-2 `dev` |
| --- | ---: | ---: | ---: | ---: | ---: |
| `llava_video` | 5,023 | 16 | 84,596 | 3,583 | 16 |
| `nextqa` | 2,634 | 16 | 22,746 | 1,786 | 16 |
| `perception_test` | 690 | 16 | 2,306 | 704 | 16 |
| `vicas` | 4,744 | 16 | 32,460 | — | — |
| `motionbench_caption` | — | — | — | 2,866 | 16 |
| **Total** | **13,091** | **64** | **142,108** | **8,939** | **64** |
### Dataset Viewer Schema (`viewer/stage2_ranked_gaze.parquet`)
The combination of `split`, `source`, `video_id` and `target_frame` identifies each row. Each of the `388,173` rows represents one usable causal native-pair gaze decision (observing frames up to `current_pts`, predicting the shared gaze point for the upcoming pair starting at `target_frame` / `target_pts`):
- `split` (`string`): `"fit"` (`385,246` rows) or `"dev"` (`2,927` rows)
- `source` (`string`): upstream corpus (`llava_video`, `motionbench_caption`, `nextqa`, `perception_test`)
- `video_id` (`string`): clip identifier within `source`
- `parent` (`string`): canonical source-recording parent identifier used for leak-free split isolation
- `target_frame` (`int64`): zero-based source frame index of the target native-pair first slot
- `current_pts` (`float64`): latest observed source presentation timestamp in seconds (`<= target_pts`)
- `target_pts` (`float64`): planned target frame presentation timestamp in seconds
- `num_candidates` (`int32`): number of ranked teacher candidates (`1`, `2`, or `3`)
- `top1_x`, `top1_y` (`float64`): normalized top-1 gaze target coordinates in `[0, 1]` (top-left origin)
- `top1_changing` (`int8`): observed temporal evolution indicator for top-1 (`1` = changing, `0` = non-changing/unknown)
- `confidence` (`float64`): teacher localization audit metadata in `[0, 1]` (not a loss weight)
- `candidates_json` (`string`): compact JSON array of `[[x, y, importance, changing], ...]`
---
## 2. Upstream Video Acquisition & `data/media/` Mapping
Download the five upstream video corpora from their official distributions and symlink them into `data/media/` (or any directory passed to `--media-root` / `OCULA_MEDIA_ROOT`):
| Source Key | Official Distribution | Relative Path Pattern in Manifests | Expected Symlink Target |
| --- | --- | --- | --- |
| `llava_video` | [`lmms-lab/LLaVA-Video-178K`](https://huggingface.co/datasets/lmms-lab/LLaVA-Video-178K) (`0_30_s_youtube_v0_1`, `30_60_s_youtube_v0_1`) | `llava_video/{0_30_s,30_60_s}_youtube_v0_1/liwei_youtube_videos/videos/youtube_video_2024/ytb_*.mp4` | `data/media/llava_video` → common parent of the two extracted duration directories |
| `nextqa` | [`doc-doc/NExT-QA`](https://github.com/doc-doc/NExT-QA) (`NExTVideo` official training set) | `nextqa/NExTVideo/<shard>/<video_id>.mp4` | `data/media/nextqa` → directory containing `NExTVideo/` |
| `perception_test` | [`google-deepmind/perception_test`](https://github.com/google-deepmind/perception_test) (training split) | `perception_test/videos/video_<id>.mp4` | `data/media/perception_test` → directory containing `videos/` |
| `vicas` | [ViCaS authors’ download guide](https://github.com/Ali2500/ViCaS#-dataset-download), [preprocessed media](https://huggingface.co/datasets/kumuji/ViCaS) | `vicas/{videos,videos2,videos3}/<filename>.mp4` | `data/media/vicas` → downloaded `kumuji/ViCaS` root with all three video directories |
| `motionbench_caption` | [`zai-org/MotionBench`](https://huggingface.co/datasets/zai-org/MotionBench) (`MotionBenchCaption-train`) | `motionbench_caption/videos/<video_id>.mp4` | `data/media/motionbench_caption` → `MotionBenchCaption-train/` directory |
```bash
mkdir -p data/media
ln -s /path/to/LLaVA-Video-178K data/media/llava_video
ln -s /path/to/NExT-QA data/media/nextqa
ln -s /path/to/Perception-Test/train data/media/perception_test
ln -s /path/to/kumuji-ViCaS data/media/vicas
ln -s /path/to/MotionBench/MotionBenchCaption-train data/media/motionbench_caption
```
Extract each LLaVA `*_videos_*.tar.gz` into its own duration directory (such as `0_30_s_youtube_v0_1/`), preserving the archive’s `liwei_youtube_videos/` subtree. Extract the full Perception Test `train_videos.zip` into `Perception-Test/train/`. Keep the original `videos/`, `videos2/` and `videos3/` directories in the ViCaS media mirror.
Every manifest entry stores a portable byte-size contract (`source_contract.media_identity = {"path": "<rel>", "bytes": <int>}`, without machine-specific `mtime_ns`), validated automatically by `ocula.data.acquisition.validate_acquisition_entry(entry, media_root=...)`.
---
## 3. Quickstart: Download, Unpack & Two-Stage Training
Clone [`hku-sail/Ocula`](https://github.com/hku-sail/Ocula) and install its dependencies, then download and unpack `Ocula-ASP/Ocula-Train`:
```bash
# 1. Download annotations and verify checksums
hf download Ocula-ASP/Ocula-Train --repo-type dataset --local-dir data/ocula_train
(cd data/ocula_train && sha256sum -c SHA256SUMS)
# 2. Decompress all .zst archives in place (requires zstd)
find data/ocula_train -name "*.zst" -exec zstd -d --keep {} +
# 3. Stage 1 — Visual LoRA Reader (5,188 updates, rank-32 LoRA, alpha in {0.43, 0.60})
torchrun --nproc_per_node=4 -m scripts.train_reader \
--config configs/reader/warp.yaml \
--out runs/reader \
--media-root data/media \
--compiled-flow \
manifest=data/ocula_train/stage1_reader/reader_clean.json \
trajectory_labels=data/ocula_train/stage1_reader/placements/fit.jsonl \
eval_reads='[{name: warp_043, alpha: 0.43, trajectory: true, label_set: data/ocula_train/stage1_reader/placements/dev.jsonl}, {name: warp_050, alpha: 0.50, trajectory: true, label_set: data/ocula_train/stage1_reader/placements/dev.jsonl}, {name: warp_060, alpha: 0.60, trajectory: true, label_set: data/ocula_train/stage1_reader/placements/dev.jsonl}]'
# 4. Stage 2 — Recurrent Gaze Predictor (10,000 updates, ranked_set objective)
torchrun --nproc_per_node=4 -m scripts.train_predictor \
--config configs/predictor/ranked_set.yaml \
--out runs/predictor \
--media-root data/media \
--compiled-flow \
manifest=data/ocula_train/stage2_predictor/fit/manifest.json \
labels=data/ocula_train/stage2_predictor/fit/labels.jsonl \
candidates=data/ocula_train/stage2_predictor/fit/candidates.jsonl \
dev_manifest=data/ocula_train/stage2_predictor/dev/manifest.json \
dev_labels=data/ocula_train/stage2_predictor/dev/labels.jsonl \
dev_candidates=data/ocula_train/stage2_predictor/dev/candidates.jsonl \
vision_lora=runs/reader/vision_lora_step0005188.pt
```
See [`docs/training.md`](https://github.com/hku-sail/Ocula/blob/main/docs/training.md) for 4B backbone adaptation, `scripts/label_teacher.py` custom teacher labeling, and multi-GPU troubleshooting.
---
## 4. Core8 Zero-Leakage & Reproducibility Guarantees
- **Zero Core8 evaluation overlap**: Stage-1 uses only training splits (disjoint from all Core8 evaluation source IDs; `source_parent_isolation.overlap == 0` between `13,091` `fit` parents and `64` `reader_fit_dev` parents). Stage-2 runs transitive closure exclusion (`python -m scripts.data.build_predictor_split`) over both `parent` IDs and underlying resolved media files against all 8 Core8 benchmarks (`HRVideoBench`, `MME-VideoOCR`, `Perception Test` valid, `TOMATO`, `MotionBench` dev, `TempCompass`, `NExT-QA` test, `Video-MME`; `39,141` questions / `12,993` clips / `12,006` source parents), and isolates the `64`-video `dev` split by whole parent/media groups.
- **Bit-exact sampling identity**: Every `entry["video"]` key is preserved verbatim across all `22,158` entries, preserving Stage-1's deterministic `CompleteQASchedule` (`5,188` updates, `schedule_sha256 = 00b38240b99a80ce14d81c4f174f04ea931386748d1e3f0ab6dc442c2f4ab04d`), Stage-1's exact `(x, y, g)` execution placements (`load_labels` bit-exact), and Stage-2's `window_sampling: cycle` RNG streams.
- **Verified protocol provenance**: `stage2_predictor/protocol.json` verifies `prompt_sha256 = 0b2603f8a97f2b19b3e31bbcab9ff0dba4f3a8d4102aecd63b6caca7b559576b`, matching [`configs/teacher/prompt.txt`](https://github.com/hku-sail/Ocula/blob/main/configs/teacher/prompt.txt) byte-for-byte.
---
## 5. License & Citation
The Ocula authors release their acquisition plans, execution placements and ranked gaze annotations under [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/). Stage-1 also includes upstream questions and answers, reformatted for the Reader. Those records retain their respective terms. Researchers obtain the videos separately from the providers in §2.
| Stage-1 QA source | Attribution and upstream terms |
| --- | --- |
| LLaVA-Video-178K | Yuanhan Zhang and colleagues, *Video Instruction Tuning with Synthetic Data*. The authors list Apache 2.0 and specify academic research and educational use. [Dataset card](https://huggingface.co/datasets/lmms-lab/LLaVA-Video-178K#uses) |
| NExT-QA | Junbin Xiao, Xindi Shang, Angela Yao and Tat-Seng Chua, *NExT-QA: Next Phase of Question-Answering to Explaining Temporal Actions*, CVPR 2021. The authors request citation of their paper and attribution to the source repository for dataset distribution. [Source repository and citation](https://github.com/doc-doc/NExT-QA#citation) |
| Perception Test | DeepMind Technologies Limited, © 2022. The project publishes its data under CC BY 4.0. [License and disclaimer](https://github.com/google-deepmind/perception_test#license-and-disclaimer) |
| ST-Evidence-Instruct on ViCaS | Shijie Wang and colleagues, *Evidence-Backed Video Question Answering*. The card lists CC BY-NC 4.0, specifies research use, and asks that its Gemini-generated data not be used to develop models competing with Google. [Dataset and terms](https://huggingface.co/datasets/Salesforce/ST-Evidence-Instruct) |
The bundled notices include the Apache 2.0 and NExT-QA repository license texts. MotionBench supplies clip identities for Stage-2 Ocula supervision and has separate source terms. [Third-party notices](THIRD_PARTY_NOTICES.txt) · [MotionBench data card](https://huggingface.co/datasets/zai-org/MotionBench#license)
```bibtex
@article{wu2026ocula,
title = {Ocula: Active Sparse Perception Makes Better Visual Encoders},
author = {Wu, Bixing and Yang, Chenghan and Yang, Lihe and
Zhang, Yujia and Wu, Xiaoyang and Zhao, Hengshuang},
journal = {arXiv preprint arXiv:2612.02359},
year = {2026},
url = {https://arxiv.org/abs/2612.02359}
}
```