--- language: - en - zh pretty_name: R4D-Bench tags: - referring-expression-segmentation - video-understanding - spatio-temporal - dynamic-scenes - instance-segmentation task_categories: - image-segmentation size_categories: - 10K **Hugging Face Dataset Viewer:** this repo is a **folder-layout benchmark** (JSON + PNG masks), not a tabular Parquet split. The Hub “Dataset Viewer / test split” panel will stay unavailable — that is expected. Use **Files and versions** and the commands below. --- ## Quick start (3 steps) ```bash # 1) Download this dataset repo (Hub UI, git lfs, or huggingface_hub snapshot_download) # 2) Sanity-check mask metrics (predictions = GT → perfect scores) python evaluation/evaluate_mask_temporal.py --self-check \ --ground-truth scripts/new_predictions_ground_truth_all_queries.json \ --queries-meta evaluation/R4D-Bench_queries.json # 3) Track-ID metrics (GT track sets as a demo) python evaluation/evaluate_r4dgs.py \ --queries evaluation/R4D-Bench_queries.json \ --predictions evaluation/R4D-Bench_predictions.json \ --output evaluation/track_id_eval_report.json ``` **Dependencies:** Python 3.10+; `numpy`, `Pillow` for mask eval. Evaluation scripts live next to the data — run them from the **repo root**. --- ## Which files to open first | Goal | Open this | |------|-----------| | Read all 89 queries (text + target tracks) | `evaluation/R4D-Bench_queries.json` | | Track-ID ground truth map | `evaluation/R4D-Bench_predictions.json` (`query_id` → `target_track_ids`) | | Dense mask ground truth (canonical, 89) | `scripts/new_predictions_ground_truth_all_queries.json` | | Same GT + PNG path fields | `scripts/new_predictions_ground_truth_all_queries_with_paths.json` | | Per-scene query source of truth | `data/scenes//*_queries.json` | | Per-frame answer PNGs | `data/scenes//query_masks/frame_XXXXXX//…` | | Track id → category cheat sheet | `data/track_metadata.csv` (docs only; **not** loaded by eval) | | Path checklist | `DATASET_LAYOUT.md` | **Optional 36-query subset:** `scripts/new_predictions_ground_truth_final.json` (+ `*_with_paths.json`). Same format, fewer queries — **not** a separate release tier. --- ## Scenes Folders under `data/scenes/` (underscores): `americano`, `coffee_martini`, `cook_spinach`, `cut_lemon`, `cut_roasted_beef`, `espresso`, `flame_salmon`, `flame_steak`, `keyboard`, `sear_steak`, `split_cookie`, `torchchocolate` Each scene typically contains: - `*_queries.json` — queries for that scene - scene track JSON (e.g. `americano.json`; `cook_spinach` uses `cook-spinach.json`) - COCO annotation JSON (`_annotations*.coco.json`) - `images/` — RGB frames used with the annotations - `query_masks/` — query-level union masks for the **89**-query set - `query_masks_36/` — masks for the optional **36**-query subset (when present) - `README.dataset.txt` / `README.roboflow.txt` — upstream provenance **Naming:** folder names use `_`; some JSON / `query_id` prefixes use `-` (e.g. `cook-spinach`, `split-cookie`). --- ## Task definition & conventions - **Input:** referring expression (`text_en` / `text_zh`) + scene frames. - **Output (mask track):** per-`frame_id` foreground mask(s) for the referred target(s). - **Output (track-ID track):** set of `target_track_ids` (no pixels). - **Time index:** integer `frame_id` in GT / `existence_frames`, matching `query_masks/frame_XXXXXX/`. - **Left / right:** means **image / viewer** coordinates (left or right side of the picture), **not** the person’s anatomical left/right hand. - **Query types:** `A` / `B` / `C` in metadata (see fields below); many items need **motion** or **before / while / after** reasoning; some are multi-target or distractor-style. ### Query schema (`evaluation/R4D-Bench_queries.json`) Each entry includes among others: - `query_id`, `scene`, `text_en`, `text_zh` - `target_track_ids`, `target_count` - `query_type`, `requires_motion_understanding` - Optional: `temporal_relation`, `expected_temporal_anchor`, `distractor`, `note` Dense GT entries in `scripts/new_predictions_ground_truth_all_queries.json` add `ground_truth` with `target_tracks`, `existence_frames`, and `frames[].masks[]` (`segmentation`, optional `mask_image`). Geometry in `segmentation` / PNGs is authoritative. --- ## How to evaluate your model ### 1) Mask-level (mIoU, mAcc, temporal Acc, vIoU, …) ```bash python evaluation/evaluate_mask_temporal.py \ --predictions path/to/your_predictions.json \ --ground-truth scripts/new_predictions_ground_truth_all_queries.json \ --output evaluation/mask_eval_report.json \ --queries-meta evaluation/R4D-Bench_queries.json ``` **Prediction JSON** (either shape): - `{ "query_id": { "frames": { "1": "path/to/mask.png", ... } } }` - or a list of `{ "frame_id", "mask_path" }` per query Paths resolve relative to `--repo-root` unless absolute. Useful flags: `--only-query-prefix`, `--only-queries`, `--debug-query`, `--iou-threshold`. ### 2) Track-ID (precision / recall / F1 on ID sets) ```bash python evaluation/evaluate_r4dgs.py \ --queries evaluation/R4D-Bench_queries.json \ --predictions path/to/your_track_predictions.json \ --output evaluation/track_id_eval_report.json ``` Your prediction file should use the same `query_id` keys as `evaluation/R4D-Bench_predictions.json` (each value = predicted track-id list/set). --- ## Repository layout ``` R4D-Bench/ ├── DATASET_LAYOUT.md ├── README.md ├── evaluation/ │ ├── evaluate_mask_temporal.py │ ├── evaluate_r4dgs.py │ ├── R4D-Bench_queries.json # 89 queries (eval metadata) │ └── R4D-Bench_predictions.json # query_id → target_track_ids (GT) ├── scripts/ │ ├── coco_scene_paths.py │ ├── generate_instance_masks.py │ ├── predictions_ground_truth.py │ ├── enrich_ground_truth_with_mask_images.py │ ├── new_predictions_ground_truth_all_queries.json │ ├── new_predictions_ground_truth_all_queries_with_paths.json │ ├── new_predictions_ground_truth_final.json # optional 36 │ └── new_predictions_ground_truth_final_with_paths.json └── data/ ├── scenes// # images, COCO, tracks, queries, query_masks/ ├── all_instance_masks/ # optional regeneratable snapshot └── track_metadata.csv # optional human-readable reference ``` `upload_large.py` is a maintainer helper for Hub uploads; end users can ignore it. --- ## Regenerating masks / GT (maintainers) ```bash # Per-instance PNGs from COCO (not the same as query union masks) python scripts/generate_instance_masks.py --overwrite # Rebuild 89-query dense GT from per-scene *_queries.json python scripts/predictions_ground_truth.py --all-queries \ --output scripts/new_predictions_ground_truth_all_queries.json # Add mask_image / combined_mask_image path fields into JSON python scripts/enrich_ground_truth_with_mask_images.py ``` --- ## Relation to Segment-then-Splat & upstream data - **Segment-then-Splat** is a separate pipeline. Typical StS trees (`sparse/`, merged multiview masks, PLY, …) are **not** part of this minimal annotation release. - Pair with **HyperNeRF / Neu3D** (or compatible) downloads under their original licenses when you need the full original capture. - Roboflow URLs / licenses: see each scene’s `README.dataset.txt` / `README.roboflow.txt`. --- ## Citation If you use **R4D-Bench**, cite **this dataset repository** and the **original scene datasets** (HyperNeRF, Neu3D, Roboflow sources as applicable). Add BibTeX here after publication if desired. --- ## License - **Annotations and code** in this repository: treat as **`license: other`** until a top-level `LICENSE` is added; contact maintainers if you need redistributable terms in writing. - **Scene imagery / upstream assets** remain under **Neu3D / HyperNeRF / Roboflow** (etc.) original terms. Do not redistribute raw imagery unless those licenses allow it. --- ## Contact Questions on benchmark definition, evaluation protocol, or file formats: open a discussion/issue on this Hub dataset page or contact the maintainers.