r4d-bench-qa / README.md
LiYacheng's picture
Upload README.md
b014af9 verified
|
Raw History Blame Contribute Delete
11.8 kB
metadata
language:
  - en
pretty_name: R4D-Bench
tags:
  - referring-expression-segmentation
  - video-understanding
  - spatio-temporal
  - dynamic-scenes
  - instance-segmentation
task_categories:
  - image-segmentation
size_categories:
  - 10K<n<100K
license: other
dataset_summary: >-
  Spatio-temporal referring segmentation on dynamic 4D scenes with dense mask GT
  for 89 queries across 12 scenes, plus evaluation scripts; multi-view RGB is
  optional for shipped metrics.

R4D-Bench

Summary

R4D-Bench targets spatio-temporal referring segmentation in dynamic (4D) scenes: natural-language queries paired with pixel-accurate instance masks over time (COCO-style polygons or RLE, optional PNG unions), emphasizing motion, temporal relations (before / while / after), multi-target phrases, and distractor queries.

The release contains 89 referring queries with dense mask ground truth across 12 scenes (from the per-scene *_queries.json files). Mask IoU and track-ID evaluation live under evaluation/; full multi-view RGB, cameras, COLMAP, and Segment-then-Splat artifacts are not required for those shipped scripts. Scene imagery, where needed, should be obtained from Neu3D / HyperNeRF (or compatible) releases under their original licenses; the minimal annotation bundle does not include Segment-then-Splat pipeline outputs.


Statistics (at a glance)

Item Location Count / note
Dense mask GT scripts/new_predictions_ground_truth_all_queries.json 89 queries (all entries in the 12 per-scene *_queries.json files), per-frame segmentation and/or PNGs under data/scenes/<scene>/query_masks/
Evaluation metadata evaluation/R4D-Bench_queries.json 89 entries — same query IDs as the dense GT above. evaluation/R4D-Bench_predictions.json maps each query_id → target_track_ids for track-ID evaluation.
Optional 36-query subset scripts/new_predictions_ground_truth_final.json Curated 3 queries / scene (optional convenience subset; not a separate release tier)

Scenes (on-disk release)

There are 12 scene directories under data/scenes/:

americano, coffee_martini, cook_spinach, cut_lemon, cut_roasted_beef, espresso, flame_salmon, flame_steak, keyboard, sear_steak, split_cookie, torchchocolate

Naming conventions: Folder names use underscores. Some JSON fields and query_id prefixes use hyphens (e.g. cook-spinach, split-cookie). The scene cook_spinach ships files such as cook-spinach_queries.json and cook-spinach.json inside that folder.


Repository layout

R4D-Bench/
├── DATASET_LAYOUT.md               # Path checklist: core vs optional vs offline
├── README.md
├── evaluation/
│   ├── evaluate_mask_temporal.py   # mIoU, mAcc, temporal Acc, vIoU, …
│   ├── evaluate_r4dgs.py           # Track-id precision / recall / F1
│   ├── R4D-Bench_queries.json     # Unified query list (89) for eval + --queries-meta
│   └── R4D-Bench_predictions.json # query_id → target_track_ids (GT for track-id eval)
├── 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         # 89 queries (canonical GT)
│   ├── new_predictions_ground_truth_all_queries_with_paths.json  # same 89 + mask path fields
│   ├── new_predictions_ground_truth_final.json              # optional 36-query subset
│   ├── new_predictions_ground_truth_final_with_paths.json   # same 36 + mask path fields
├── data/
│   ├── scenes/<scene>/          # images, COCO JSON, tracks, *_queries.json, query_masks/
│   ├── all_instance_masks/       # optional regeneratable snapshot
│   └── track_metadata.csv      # optional human-readable track_id → category (reference)
└── tools/                        # optional local utilities

If present, FINAL_REPORT.md / benchmark.md are maintainer notes and not required to use the benchmark.

Offline archive: Material that used to live under dataset_archive/ has been removed from this tree. Nothing here depends on that path. Benchmarks use data/scenes/, scripts/new_predictions_ground_truth_*.json, and evaluation/. A minimal distribution may omit data/all_instance_masks/ (regenerate with scripts/generate_instance_masks.py). See DATASET_LAYOUT.md for the full path map.

Query-related files (what to use when)

File Role
data/scenes/<scene>/*_queries.json Canonical source for each scene’s natural-language queries and target_track_ids. Used by scripts/predictions_ground_truth.py to build dense GT.
scripts/new_predictions_ground_truth_all_queries.json Dense mask GT for all 89 queries (full per-scene *_queries.json union).
scripts/new_predictions_ground_truth_all_queries_with_paths.json Same 89 queries, plus mask_image / combined_mask_image path fields after enrich_ground_truth_with_mask_images.py.
evaluation/R4D-Bench_queries.json Merged copy of all 89 queries (order aligned with new_predictions_ground_truth_all_queries.json). Pass to --queries-meta for per–query_type breakdown in mask metrics.
evaluation/R4D-Bench_predictions.json Ground-truth query_id → target_track_ids for evaluate_r4dgs.py (replace with your model’s track-ID predictions when benchmarking).
scripts/new_predictions_ground_truth_final.json Optional 36-query subset (3 / scene).
data/track_metadata.csv Optional spreadsheet mapping track_id → category and upstream dataset (HyperNeRF / Neu3D); not read by the shipped evaluation scripts—documentation / filtering only.

Temporal and spatial alignment

  • Canonical time index is the integer frame_id in ground_truth.frames[] and existence_frames, and directory names frame_XXXXXX under data/scenes/<scene>/query_masks/.
  • Per-scene frame list comes from each scene’s COCO JSON (images[].file_name). Filenames may look like frame_000040.png or Roboflow-style names; scripts resolve resolution and ordering from COCO.
  • We do not enforce a single official Neu3D camera ID (e.g. cam00) or subsampling recipe for every scene. Users who pair this benchmark with original Neu3D / HyperNeRF downloads should align by visual / temporal correspondence; mask-only evaluation here depends only on the provided frame_id and mask geometry.

Mask-level evaluation

From the repository root:

# Sanity check: predictions = GT → metrics should be perfect
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

# Evaluate your prediction JSON (per-query, per-frame mask paths)
python evaluation/evaluate_mask_temporal.py \
  --predictions path/to/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 shape (examples): { "query_id": { "frames": { "1": "relative/or/abs/path.png", ... } } } or a list of { "frame_id", "mask_path" }. Paths resolve relative to --repo-root unless absolute.

Canonical dense GT for the full benchmark is scripts/new_predictions_ground_truth_all_queries.json (89 queries). The optional 36-query file is scripts/new_predictions_ground_truth_final.json.

Useful options: --only-query-prefix <scene>, --only-queries, --debug-query <id>, --iou-threshold 0.5. See the docstring in evaluation/evaluate_mask_temporal.py.

Track-ID evaluation (set precision / recall / F1 on track IDs, no pixels):

python evaluation/evaluate_r4dgs.py \
  --queries evaluation/R4D-Bench_queries.json \
  --predictions evaluation/R4D-Bench_predictions.json \
  --output evaluation/track_id_eval_report.json

Replace --predictions with your model’s track-id output using the same query_id keys as in R4D-Bench_predictions.json.


Generating or refreshing masks and PNGs

scripts/generate_instance_masks.py reads each scene’s COCO JSON and writes one binary PNG per annotation instance under data/scenes/<scene>/instance_masks/<image_stem>/. That is per-instance rasterization—not the same as query-level union masks in the ground-truth JSON.

Required for a minimal release? No, if you ship queries + GT (segmentation and/or query_masks/) + evaluation code. Keep the script if you need to regenerate instance masks after editing COCO.

python scripts/generate_instance_masks.py --overwrite
python scripts/generate_instance_masks.py --scene americano --overwrite

python scripts/enrich_ground_truth_with_mask_images.py
python scripts/enrich_ground_truth_with_mask_images.py --only-query-prefix cut_lemon

Dependencies: Python 3.10+ recommended; numpy, Pillow. Optional: matplotlib, scikit-learn, wordcloud for auxiliary scripts.

To regenerate the 89-query dense GT from per-scene sources:

python scripts/predictions_ground_truth.py --all-queries \
  --output scripts/new_predictions_ground_truth_all_queries.json

Relationship to Segment-then-Splat (StS) and upstream data

  • Segment-then-Splat is a separate public pipeline (COLMAP, multi-view masks, Gaussian training, etc.). Typical StS directories (images/, sparse/, multiview_masks_*_merged/, PLY exports, …) are not part of the minimal R4D-Bench annotation release.
  • For StS-style training, follow their repository and obtain HyperNeRF / Neu3D (or compatible) imagery under the original licenses.
  • Roboflow provenance and URLs are under each scene’s README.dataset.txt / README.roboflow.txt (often CC BY 4.0 where stated—verify per scene).

Query schema (unified JSON)

Each entry in evaluation/R4D-Bench_queries.json 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

Items in scripts/new_predictions_ground_truth_all_queries.json add ground_truth with target_tracks, existence_frames, and frames[].masks[] (segmentation, optional mask_image). Some question strings may be non-English depending on export version; canonical geometry is in segmentation / PNGs.


Citation

If you use R4D-Bench, cite this dataset repository and the original scene datasets (HyperNeRF, Neu3D, Roboflow sources as applicable). Add a BibTeX entry here after publication if desired.


License and third-party data

  • Annotations and code in this repository are released under the terms of the top-level LICENSE file when present; until then, treat usage as license-other and contact the maintainers if unsure.
  • Scene imagery and upstream assets remain under their original terms (Neu3D, HyperNeRF, Roboflow, etc.). Do not redistribute raw imagery unless the upstream license allows it.
  • Per-scene Roboflow metadata: data/scenes/<scene>/README.dataset.txt.

Contact

For questions about the benchmark definition, evaluation protocol, or file formats, open an issue in the project repository or contact the maintainers.