Datasets:
Formats:
parquet
Languages:
English
Size:
10K - 100K
ArXiv:
Tags:
video-understanding
multi-evidence-reasoning
long-video
temporal-reasoning
spatial-reasoning
video-qa
License:
Convert to Parquet format for Dataset Viewer compatibility
Browse filesHuggingFace deprecated custom loading scripts. Switching to Parquet format with auto-loading:
Changes:
- Remove deprecated scripts: HERBench.py, herbench.py
- Add Parquet files with Git LFS: herbench_full.parquet (4.87 MB), herbench_lite.parquet (1.02 MB)
- Update README.md YAML to use Parquet with explicit configs
- Add comprehensive data format documentation and usage examples
- Update .gitattributes to track Parquet files with Git LFS
- Keep original JSON files for users who need raw format
Parquet format ensures:
- Reliable schema handling (fixes Arrow conversion errors)
- Better performance for large datasets
- Full compatibility with HF Dataset Viewer
- Support for varying metadata structures across task types
- .gitattributes +2 -3
- HERBench.py +0 -194
- README.md +50 -10
- data/herbench_full.parquet +3 -0
- data/herbench_lite.parquet +3 -0
- herbench.py +0 -194
.gitattributes
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
# Git LFS configuration for large files
|
| 2 |
-
|
| 3 |
# Videos and archives (to be uploaded via HF CLI)
|
| 4 |
*.tar.part.* filter=lfs diff=lfs merge=lfs -text
|
| 5 |
*.tar filter=lfs diff=lfs merge=lfs -text
|
|
@@ -7,13 +6,13 @@
|
|
| 7 |
*.avi filter=lfs diff=lfs merge=lfs -text
|
| 8 |
*.mov filter=lfs diff=lfs merge=lfs -text
|
| 9 |
*.mkv filter=lfs diff=lfs merge=lfs -text
|
| 10 |
-
|
| 11 |
# Image files (to be uploaded via HF CLI)
|
| 12 |
*.png filter=lfs diff=lfs merge=lfs -text
|
| 13 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 14 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
|
| 16 |
# Large annotation files (to be uploaded via HF CLI)
|
| 17 |
data/herbench_annotations.json filter=lfs diff=lfs merge=lfs -text
|
| 18 |
data/herbench_annotations_lite.json filter=lfs diff=lfs merge=lfs -text
|
| 19 |
data/*.json filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 1 |
# Git LFS configuration for large files
|
|
|
|
| 2 |
# Videos and archives (to be uploaded via HF CLI)
|
| 3 |
*.tar.part.* filter=lfs diff=lfs merge=lfs -text
|
| 4 |
*.tar filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 6 |
*.avi filter=lfs diff=lfs merge=lfs -text
|
| 7 |
*.mov filter=lfs diff=lfs merge=lfs -text
|
| 8 |
*.mkv filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 9 |
# Image files (to be uploaded via HF CLI)
|
| 10 |
*.png filter=lfs diff=lfs merge=lfs -text
|
| 11 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 12 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 13 |
# Large annotation files (to be uploaded via HF CLI)
|
| 14 |
data/herbench_annotations.json filter=lfs diff=lfs merge=lfs -text
|
| 15 |
data/herbench_annotations_lite.json filter=lfs diff=lfs merge=lfs -text
|
| 16 |
data/*.json filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
# Parquet files
|
| 18 |
+
data/*.parquet filter=lfs diff=lfs merge=lfs -text
|
HERBench.py
DELETED
|
@@ -1,194 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
HERBench Hugging Face Datasets loading script.
|
| 3 |
-
|
| 4 |
-
Why this file exists:
|
| 5 |
-
- Hugging Face Dataset Viewer auto-parses JSON files if no loading script is detected.
|
| 6 |
-
- Auto-parsing uses pandas->pyarrow inference and can fail when nested fields (like `metadata`)
|
| 7 |
-
have inconsistent shapes across rows (common in multi-task benchmarks).
|
| 8 |
-
- By providing a proper datasets loading script named after the repo (`herbench.py` for HERBench),
|
| 9 |
-
the Hub will use this builder instead, with an explicit, stable schema.
|
| 10 |
-
|
| 11 |
-
This script ensures streaming compatibility and robust schema handling for the Dataset Viewer.
|
| 12 |
-
"""
|
| 13 |
-
|
| 14 |
-
from __future__ import annotations
|
| 15 |
-
|
| 16 |
-
import json
|
| 17 |
-
from typing import Any, Dict, Iterator
|
| 18 |
-
|
| 19 |
-
import datasets
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
_DESCRIPTION = """\
|
| 23 |
-
HERBench: A Benchmark for Multi-Evidence Integration in Video Question Answering.
|
| 24 |
-
|
| 25 |
-
This dataset contains multiple-choice questions grounded in long videos and designed to
|
| 26 |
-
require integration of multiple temporally separated cues (high evidential requirement).
|
| 27 |
-
"""
|
| 28 |
-
|
| 29 |
-
_HOMEPAGE = "https://github.com/DanBenAmi/HERBench"
|
| 30 |
-
_LICENSE = "CC-BY-NC-SA-4.0"
|
| 31 |
-
|
| 32 |
-
_CITATION = """\
|
| 33 |
-
@article{herbench2025,
|
| 34 |
-
title={HERBench: A Benchmark for Multi-Evidence Integration in Video Question Answering},
|
| 35 |
-
author={Ben-Ami, Dan and Serussi, Gabriele and Cohen, Kobi and Baskin, Chaim},
|
| 36 |
-
journal={arXiv preprint arXiv:XXXX.XXXXX},
|
| 37 |
-
year={2025}
|
| 38 |
-
}
|
| 39 |
-
"""
|
| 40 |
-
|
| 41 |
-
_VERSION = "1.0.3"
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
class HERBenchConfig(datasets.BuilderConfig):
|
| 45 |
-
"""BuilderConfig for HERBench."""
|
| 46 |
-
pass
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
class HERBench(datasets.GeneratorBasedBuilder):
|
| 50 |
-
"""HERBench Dataset: Multi-Evidence Integration in Video QA."""
|
| 51 |
-
|
| 52 |
-
VERSION = datasets.Version(_VERSION)
|
| 53 |
-
|
| 54 |
-
BUILDER_CONFIGS = [
|
| 55 |
-
HERBenchConfig(
|
| 56 |
-
name="full",
|
| 57 |
-
version=VERSION,
|
| 58 |
-
description="Full HERBench dataset (27,936 questions; 335 videos; ~161GB).",
|
| 59 |
-
),
|
| 60 |
-
HERBenchConfig(
|
| 61 |
-
name="lite",
|
| 62 |
-
version=VERSION,
|
| 63 |
-
description="HERBench-Lite subset (~5,600 questions; ~67 videos; ~35GB for quick prototyping).",
|
| 64 |
-
),
|
| 65 |
-
]
|
| 66 |
-
|
| 67 |
-
# Make the Hub viewer default to the smaller config (faster and less error-prone).
|
| 68 |
-
DEFAULT_CONFIG_NAME = "lite"
|
| 69 |
-
|
| 70 |
-
def _info(self) -> datasets.DatasetInfo:
|
| 71 |
-
"""
|
| 72 |
-
Define the dataset schema with strict, stable types for all fields.
|
| 73 |
-
|
| 74 |
-
IMPORTANT: Keep features stable across all rows.
|
| 75 |
-
`metadata` in the raw JSON varies by task (different keys / nested lists).
|
| 76 |
-
To keep the schema consistent for Arrow + Dataset Viewer:
|
| 77 |
-
- Expose common metadata fields as flat, typed columns
|
| 78 |
-
- Store the full raw metadata dict as a JSON string in `metadata_json`
|
| 79 |
-
"""
|
| 80 |
-
features = datasets.Features(
|
| 81 |
-
{
|
| 82 |
-
# Core fields
|
| 83 |
-
"question_id": datasets.Value("string"),
|
| 84 |
-
"video_id": datasets.Value("string"),
|
| 85 |
-
"video_path": datasets.Value("string"),
|
| 86 |
-
"question": datasets.Value("string"),
|
| 87 |
-
"choices": datasets.Sequence(datasets.Value("string")),
|
| 88 |
-
"answer": datasets.Value("string"),
|
| 89 |
-
"answer_index": datasets.Value("int32"),
|
| 90 |
-
"answer_text": datasets.Value("string"),
|
| 91 |
-
"task_type": datasets.Value("string"),
|
| 92 |
-
|
| 93 |
-
# Common metadata fields (flat, typed)
|
| 94 |
-
"source_dataset": datasets.Value("string"),
|
| 95 |
-
"duration": datasets.Value("float32"),
|
| 96 |
-
"resolution": datasets.Value("string"),
|
| 97 |
-
|
| 98 |
-
# Full raw metadata as JSON string (stable schema)
|
| 99 |
-
"metadata_json": datasets.Value("string"),
|
| 100 |
-
}
|
| 101 |
-
)
|
| 102 |
-
|
| 103 |
-
return datasets.DatasetInfo(
|
| 104 |
-
description=_DESCRIPTION,
|
| 105 |
-
features=features,
|
| 106 |
-
homepage=_HOMEPAGE,
|
| 107 |
-
license=_LICENSE,
|
| 108 |
-
citation=_CITATION,
|
| 109 |
-
version=self.VERSION,
|
| 110 |
-
)
|
| 111 |
-
|
| 112 |
-
def _split_generators(self, dl_manager: datasets.DownloadManager):
|
| 113 |
-
"""
|
| 114 |
-
Define data splits. Downloads only the JSON annotations for streaming efficiency.
|
| 115 |
-
Videos are referenced by path but not downloaded during viewer loading.
|
| 116 |
-
"""
|
| 117 |
-
if self.config.name == "lite":
|
| 118 |
-
annotations_file = "data/herbench_annotations_lite.json"
|
| 119 |
-
else:
|
| 120 |
-
annotations_file = "data/herbench_annotations.json"
|
| 121 |
-
|
| 122 |
-
# Download only annotations (not videos) for Dataset Viewer efficiency
|
| 123 |
-
data_files = dl_manager.download(
|
| 124 |
-
{
|
| 125 |
-
"annotations": annotations_file,
|
| 126 |
-
}
|
| 127 |
-
)
|
| 128 |
-
|
| 129 |
-
return [
|
| 130 |
-
datasets.SplitGenerator(
|
| 131 |
-
name=datasets.Split.TEST,
|
| 132 |
-
gen_kwargs={"annotations_file": data_files["annotations"]},
|
| 133 |
-
)
|
| 134 |
-
]
|
| 135 |
-
|
| 136 |
-
def _generate_examples(self, annotations_file: str) -> Iterator[tuple[int, Dict[str, Any]]]:
|
| 137 |
-
"""
|
| 138 |
-
Yield examples from the annotations file with robust type handling.
|
| 139 |
-
|
| 140 |
-
This method ensures:
|
| 141 |
-
- Streaming compatibility (processes one example at a time)
|
| 142 |
-
- Stable schema (all fields have consistent types)
|
| 143 |
-
- Defensive parsing (handles missing/malformed fields gracefully)
|
| 144 |
-
"""
|
| 145 |
-
with open(annotations_file, encoding="utf-8") as f:
|
| 146 |
-
annotations = json.load(f)
|
| 147 |
-
|
| 148 |
-
for idx, ann in enumerate(annotations):
|
| 149 |
-
# Extract and normalize metadata
|
| 150 |
-
md = ann.get("metadata")
|
| 151 |
-
if md is None or not isinstance(md, dict):
|
| 152 |
-
# Defensive: ensure metadata is always a dict
|
| 153 |
-
md = {}
|
| 154 |
-
|
| 155 |
-
# Extract common metadata fields with defaults
|
| 156 |
-
source_dataset = md.get("source_dataset", "unknown")
|
| 157 |
-
duration = md.get("duration", 0.0)
|
| 158 |
-
resolution = md.get("resolution", "unknown")
|
| 159 |
-
|
| 160 |
-
# Normalize numeric types to avoid Arrow type inference issues
|
| 161 |
-
try:
|
| 162 |
-
duration_f = float(duration) if duration is not None else 0.0
|
| 163 |
-
except (ValueError, TypeError):
|
| 164 |
-
duration_f = 0.0
|
| 165 |
-
|
| 166 |
-
# Normalize choices field
|
| 167 |
-
choices = ann.get("choices", [])
|
| 168 |
-
if not isinstance(choices, list):
|
| 169 |
-
choices = []
|
| 170 |
-
|
| 171 |
-
# Normalize answer_index
|
| 172 |
-
answer_index = ann.get("answer_index", 0)
|
| 173 |
-
try:
|
| 174 |
-
answer_index = int(answer_index) if answer_index is not None else 0
|
| 175 |
-
except (ValueError, TypeError):
|
| 176 |
-
answer_index = 0
|
| 177 |
-
|
| 178 |
-
yield idx, {
|
| 179 |
-
"question_id": str(ann.get("question_id", f"HER_{idx:06d}")),
|
| 180 |
-
"video_id": str(ann.get("video_id", "")),
|
| 181 |
-
"video_path": str(ann.get("video_path", "")),
|
| 182 |
-
"question": str(ann.get("question", "")),
|
| 183 |
-
"choices": [str(x) for x in choices],
|
| 184 |
-
"answer": str(ann.get("answer", "")),
|
| 185 |
-
"answer_index": answer_index,
|
| 186 |
-
"answer_text": str(ann.get("answer_text", "")),
|
| 187 |
-
"task_type": str(ann.get("task_type", "unknown")),
|
| 188 |
-
"source_dataset": str(source_dataset),
|
| 189 |
-
"duration": duration_f,
|
| 190 |
-
"resolution": str(resolution),
|
| 191 |
-
"metadata_json": json.dumps(md, ensure_ascii=False),
|
| 192 |
-
}
|
| 193 |
-
|
| 194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
CHANGED
|
@@ -15,6 +15,16 @@ tags:
|
|
| 15 |
size_categories:
|
| 16 |
- 10K<n<100K
|
| 17 |
pretty_name: HERBench
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
---
|
| 19 |
|
| 20 |
# HERBench: Multi-Evidence Integration in Video Question Answering
|
|
@@ -245,9 +255,9 @@ pip install huggingface-hub
|
|
| 245 |
# Download FULL version (27,936 questions, ~161 GB)
|
| 246 |
huggingface-cli download DanBenAmi/HERBench --repo-type dataset --local-dir HERBench
|
| 247 |
|
| 248 |
-
# Download LITE version only (5,600 questions, ~35 GB)
|
| 249 |
huggingface-cli download DanBenAmi/HERBench \
|
| 250 |
-
--include "data/
|
| 251 |
--include "data/*metadata.json" \
|
| 252 |
--include "videos/videos.tar.part.00" \
|
| 253 |
--include "videos/videos.tar.part.01" \
|
|
@@ -257,24 +267,54 @@ huggingface-cli download DanBenAmi/HERBench \
|
|
| 257 |
--include "videos/videos.tar.checksums.txt" \
|
| 258 |
--local-dir HERBench
|
| 259 |
|
| 260 |
-
# Or download only annotations (no videos)
|
| 261 |
-
huggingface-cli download DanBenAmi/HERBench --include "data/*" --local-dir HERBench
|
| 262 |
```
|
| 263 |
|
| 264 |
-
#### Option B: Using Python
|
|
|
|
|
|
|
| 265 |
|
| 266 |
```python
|
| 267 |
from datasets import load_dataset
|
| 268 |
|
| 269 |
-
# Load FULL version (default)
|
| 270 |
-
dataset_full = load_dataset("DanBenAmi/HERBench",
|
| 271 |
print(f"Total questions: {len(dataset_full['test'])}")
|
| 272 |
|
| 273 |
-
#
|
| 274 |
-
|
| 275 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
```
|
| 277 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
### 2. Extract Videos
|
| 279 |
|
| 280 |
#### For Full Version:
|
|
|
|
| 15 |
size_categories:
|
| 16 |
- 10K<n<100K
|
| 17 |
pretty_name: HERBench
|
| 18 |
+
configs:
|
| 19 |
+
- config_name: full
|
| 20 |
+
data_files:
|
| 21 |
+
- split: test
|
| 22 |
+
path: data/herbench_full.parquet
|
| 23 |
+
default: true
|
| 24 |
+
- config_name: lite
|
| 25 |
+
data_files:
|
| 26 |
+
- split: test
|
| 27 |
+
path: data/herbench_lite.parquet
|
| 28 |
---
|
| 29 |
|
| 30 |
# HERBench: Multi-Evidence Integration in Video Question Answering
|
|
|
|
| 255 |
# Download FULL version (27,936 questions, ~161 GB)
|
| 256 |
huggingface-cli download DanBenAmi/HERBench --repo-type dataset --local-dir HERBench
|
| 257 |
|
| 258 |
+
# Download LITE version only (~5,600 questions, ~35 GB videos)
|
| 259 |
huggingface-cli download DanBenAmi/HERBench \
|
| 260 |
+
--include "data/herbench_lite.parquet" \
|
| 261 |
--include "data/*metadata.json" \
|
| 262 |
--include "videos/videos.tar.part.00" \
|
| 263 |
--include "videos/videos.tar.part.01" \
|
|
|
|
| 267 |
--include "videos/videos.tar.checksums.txt" \
|
| 268 |
--local-dir HERBench
|
| 269 |
|
| 270 |
+
# Or download only annotations (no videos, ~6 MB)
|
| 271 |
+
huggingface-cli download DanBenAmi/HERBench --include "data/*.parquet" --include "data/*metadata.json" --local-dir HERBench
|
| 272 |
```
|
| 273 |
|
| 274 |
+
#### Option B: Using Python (Datasets Library)
|
| 275 |
+
|
| 276 |
+
The dataset is provided in **Parquet format** for optimal compatibility with HuggingFace Datasets and reliable schema handling.
|
| 277 |
|
| 278 |
```python
|
| 279 |
from datasets import load_dataset
|
| 280 |
|
| 281 |
+
# Load FULL version (default) - 27,936 questions
|
| 282 |
+
dataset_full = load_dataset("DanBenAmi/HERBench", "full")
|
| 283 |
print(f"Total questions: {len(dataset_full['test'])}")
|
| 284 |
|
| 285 |
+
# Access test split
|
| 286 |
+
test_data = dataset_full["test"]
|
| 287 |
+
|
| 288 |
+
# Get a single example
|
| 289 |
+
example = test_data[0]
|
| 290 |
+
print(f"Question: {example['question']}")
|
| 291 |
+
print(f"Choices: {example['choices']}")
|
| 292 |
+
print(f"Answer: {example['answer']}")
|
| 293 |
+
print(f"Task: {example['task_type']}")
|
| 294 |
+
print(f"Video: {example['video_path']}")
|
| 295 |
+
|
| 296 |
+
# Load LITE version - ~5,600 questions (20% sample)
|
| 297 |
+
dataset_lite = load_dataset("DanBenAmi/HERBench", "lite")
|
| 298 |
+
print(f"Lite questions: {len(dataset_lite['test'])}")
|
| 299 |
```
|
| 300 |
|
| 301 |
+
**Schema:** Each example contains:
|
| 302 |
+
- `question_id` - Unique question identifier
|
| 303 |
+
- `video_id` - Video identifier
|
| 304 |
+
- `video_path` - Path to video file
|
| 305 |
+
- `question` - Question text
|
| 306 |
+
- `choices` - List of 5 multiple-choice options
|
| 307 |
+
- `answer` - Correct answer (A/B/C/D/E)
|
| 308 |
+
- `answer_index` - Zero-indexed answer position (0-4)
|
| 309 |
+
- `answer_text` - Answer value
|
| 310 |
+
- `task_type` - Task category name
|
| 311 |
+
- `source_dataset` - Source dataset name
|
| 312 |
+
- `duration` - Video duration in seconds (float)
|
| 313 |
+
- `resolution` - Video resolution (width x height)
|
| 314 |
+
- `metadata_json` - Full metadata as JSON string
|
| 315 |
+
|
| 316 |
+
**Note:** Original JSON files are also available in the `data/` folder for users who need the raw format for custom processing.
|
| 317 |
+
|
| 318 |
### 2. Extract Videos
|
| 319 |
|
| 320 |
#### For Full Version:
|
data/herbench_full.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f20408f18527cccc8e6ef7a50d8d3c28979b8f90679c9e4ebcb5e44053b41b5a
|
| 3 |
+
size 5112320
|
data/herbench_lite.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:88dd9768ce2a1a6d565b986fca41db9ecee72d5943f352aa95302bef3e94e2f4
|
| 3 |
+
size 1067411
|
herbench.py
DELETED
|
@@ -1,194 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
HERBench Hugging Face Datasets loading script.
|
| 3 |
-
|
| 4 |
-
Why this file exists:
|
| 5 |
-
- Hugging Face Dataset Viewer auto-parses JSON files if no loading script is detected.
|
| 6 |
-
- Auto-parsing uses pandas->pyarrow inference and can fail when nested fields (like `metadata`)
|
| 7 |
-
have inconsistent shapes across rows (common in multi-task benchmarks).
|
| 8 |
-
- By providing a proper datasets loading script named after the repo (`herbench.py` for HERBench),
|
| 9 |
-
the Hub will use this builder instead, with an explicit, stable schema.
|
| 10 |
-
|
| 11 |
-
This script ensures streaming compatibility and robust schema handling for the Dataset Viewer.
|
| 12 |
-
"""
|
| 13 |
-
|
| 14 |
-
from __future__ import annotations
|
| 15 |
-
|
| 16 |
-
import json
|
| 17 |
-
from typing import Any, Dict, Iterator
|
| 18 |
-
|
| 19 |
-
import datasets
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
_DESCRIPTION = """\
|
| 23 |
-
HERBench: A Benchmark for Multi-Evidence Integration in Video Question Answering.
|
| 24 |
-
|
| 25 |
-
This dataset contains multiple-choice questions grounded in long videos and designed to
|
| 26 |
-
require integration of multiple temporally separated cues (high evidential requirement).
|
| 27 |
-
"""
|
| 28 |
-
|
| 29 |
-
_HOMEPAGE = "https://github.com/DanBenAmi/HERBench"
|
| 30 |
-
_LICENSE = "CC-BY-NC-SA-4.0"
|
| 31 |
-
|
| 32 |
-
_CITATION = """\
|
| 33 |
-
@article{herbench2025,
|
| 34 |
-
title={HERBench: A Benchmark for Multi-Evidence Integration in Video Question Answering},
|
| 35 |
-
author={Ben-Ami, Dan and Serussi, Gabriele and Cohen, Kobi and Baskin, Chaim},
|
| 36 |
-
journal={arXiv preprint arXiv:XXXX.XXXXX},
|
| 37 |
-
year={2025}
|
| 38 |
-
}
|
| 39 |
-
"""
|
| 40 |
-
|
| 41 |
-
_VERSION = "1.0.3"
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
class HERBenchConfig(datasets.BuilderConfig):
|
| 45 |
-
"""BuilderConfig for HERBench."""
|
| 46 |
-
pass
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
class HERBench(datasets.GeneratorBasedBuilder):
|
| 50 |
-
"""HERBench Dataset: Multi-Evidence Integration in Video QA."""
|
| 51 |
-
|
| 52 |
-
VERSION = datasets.Version(_VERSION)
|
| 53 |
-
|
| 54 |
-
BUILDER_CONFIGS = [
|
| 55 |
-
HERBenchConfig(
|
| 56 |
-
name="full",
|
| 57 |
-
version=VERSION,
|
| 58 |
-
description="Full HERBench dataset (27,936 questions; 335 videos; ~161GB).",
|
| 59 |
-
),
|
| 60 |
-
HERBenchConfig(
|
| 61 |
-
name="lite",
|
| 62 |
-
version=VERSION,
|
| 63 |
-
description="HERBench-Lite subset (~5,600 questions; ~67 videos; ~35GB for quick prototyping).",
|
| 64 |
-
),
|
| 65 |
-
]
|
| 66 |
-
|
| 67 |
-
# Make the Hub viewer default to the smaller config (faster and less error-prone).
|
| 68 |
-
DEFAULT_CONFIG_NAME = "lite"
|
| 69 |
-
|
| 70 |
-
def _info(self) -> datasets.DatasetInfo:
|
| 71 |
-
"""
|
| 72 |
-
Define the dataset schema with strict, stable types for all fields.
|
| 73 |
-
|
| 74 |
-
IMPORTANT: Keep features stable across all rows.
|
| 75 |
-
`metadata` in the raw JSON varies by task (different keys / nested lists).
|
| 76 |
-
To keep the schema consistent for Arrow + Dataset Viewer:
|
| 77 |
-
- Expose common metadata fields as flat, typed columns
|
| 78 |
-
- Store the full raw metadata dict as a JSON string in `metadata_json`
|
| 79 |
-
"""
|
| 80 |
-
features = datasets.Features(
|
| 81 |
-
{
|
| 82 |
-
# Core fields
|
| 83 |
-
"question_id": datasets.Value("string"),
|
| 84 |
-
"video_id": datasets.Value("string"),
|
| 85 |
-
"video_path": datasets.Value("string"),
|
| 86 |
-
"question": datasets.Value("string"),
|
| 87 |
-
"choices": datasets.Sequence(datasets.Value("string")),
|
| 88 |
-
"answer": datasets.Value("string"),
|
| 89 |
-
"answer_index": datasets.Value("int32"),
|
| 90 |
-
"answer_text": datasets.Value("string"),
|
| 91 |
-
"task_type": datasets.Value("string"),
|
| 92 |
-
|
| 93 |
-
# Common metadata fields (flat, typed)
|
| 94 |
-
"source_dataset": datasets.Value("string"),
|
| 95 |
-
"duration": datasets.Value("float32"),
|
| 96 |
-
"resolution": datasets.Value("string"),
|
| 97 |
-
|
| 98 |
-
# Full raw metadata as JSON string (stable schema)
|
| 99 |
-
"metadata_json": datasets.Value("string"),
|
| 100 |
-
}
|
| 101 |
-
)
|
| 102 |
-
|
| 103 |
-
return datasets.DatasetInfo(
|
| 104 |
-
description=_DESCRIPTION,
|
| 105 |
-
features=features,
|
| 106 |
-
homepage=_HOMEPAGE,
|
| 107 |
-
license=_LICENSE,
|
| 108 |
-
citation=_CITATION,
|
| 109 |
-
version=self.VERSION,
|
| 110 |
-
)
|
| 111 |
-
|
| 112 |
-
def _split_generators(self, dl_manager: datasets.DownloadManager):
|
| 113 |
-
"""
|
| 114 |
-
Define data splits. Downloads only the JSON annotations for streaming efficiency.
|
| 115 |
-
Videos are referenced by path but not downloaded during viewer loading.
|
| 116 |
-
"""
|
| 117 |
-
if self.config.name == "lite":
|
| 118 |
-
annotations_file = "data/herbench_annotations_lite.json"
|
| 119 |
-
else:
|
| 120 |
-
annotations_file = "data/herbench_annotations.json"
|
| 121 |
-
|
| 122 |
-
# Download only annotations (not videos) for Dataset Viewer efficiency
|
| 123 |
-
data_files = dl_manager.download(
|
| 124 |
-
{
|
| 125 |
-
"annotations": annotations_file,
|
| 126 |
-
}
|
| 127 |
-
)
|
| 128 |
-
|
| 129 |
-
return [
|
| 130 |
-
datasets.SplitGenerator(
|
| 131 |
-
name=datasets.Split.TEST,
|
| 132 |
-
gen_kwargs={"annotations_file": data_files["annotations"]},
|
| 133 |
-
)
|
| 134 |
-
]
|
| 135 |
-
|
| 136 |
-
def _generate_examples(self, annotations_file: str) -> Iterator[tuple[int, Dict[str, Any]]]:
|
| 137 |
-
"""
|
| 138 |
-
Yield examples from the annotations file with robust type handling.
|
| 139 |
-
|
| 140 |
-
This method ensures:
|
| 141 |
-
- Streaming compatibility (processes one example at a time)
|
| 142 |
-
- Stable schema (all fields have consistent types)
|
| 143 |
-
- Defensive parsing (handles missing/malformed fields gracefully)
|
| 144 |
-
"""
|
| 145 |
-
with open(annotations_file, encoding="utf-8") as f:
|
| 146 |
-
annotations = json.load(f)
|
| 147 |
-
|
| 148 |
-
for idx, ann in enumerate(annotations):
|
| 149 |
-
# Extract and normalize metadata
|
| 150 |
-
md = ann.get("metadata")
|
| 151 |
-
if md is None or not isinstance(md, dict):
|
| 152 |
-
# Defensive: ensure metadata is always a dict
|
| 153 |
-
md = {}
|
| 154 |
-
|
| 155 |
-
# Extract common metadata fields with defaults
|
| 156 |
-
source_dataset = md.get("source_dataset", "unknown")
|
| 157 |
-
duration = md.get("duration", 0.0)
|
| 158 |
-
resolution = md.get("resolution", "unknown")
|
| 159 |
-
|
| 160 |
-
# Normalize numeric types to avoid Arrow type inference issues
|
| 161 |
-
try:
|
| 162 |
-
duration_f = float(duration) if duration is not None else 0.0
|
| 163 |
-
except (ValueError, TypeError):
|
| 164 |
-
duration_f = 0.0
|
| 165 |
-
|
| 166 |
-
# Normalize choices field
|
| 167 |
-
choices = ann.get("choices", [])
|
| 168 |
-
if not isinstance(choices, list):
|
| 169 |
-
choices = []
|
| 170 |
-
|
| 171 |
-
# Normalize answer_index
|
| 172 |
-
answer_index = ann.get("answer_index", 0)
|
| 173 |
-
try:
|
| 174 |
-
answer_index = int(answer_index) if answer_index is not None else 0
|
| 175 |
-
except (ValueError, TypeError):
|
| 176 |
-
answer_index = 0
|
| 177 |
-
|
| 178 |
-
yield idx, {
|
| 179 |
-
"question_id": str(ann.get("question_id", f"HER_{idx:06d}")),
|
| 180 |
-
"video_id": str(ann.get("video_id", "")),
|
| 181 |
-
"video_path": str(ann.get("video_path", "")),
|
| 182 |
-
"question": str(ann.get("question", "")),
|
| 183 |
-
"choices": [str(x) for x in choices],
|
| 184 |
-
"answer": str(ann.get("answer", "")),
|
| 185 |
-
"answer_index": answer_index,
|
| 186 |
-
"answer_text": str(ann.get("answer_text", "")),
|
| 187 |
-
"task_type": str(ann.get("task_type", "unknown")),
|
| 188 |
-
"source_dataset": str(source_dataset),
|
| 189 |
-
"duration": duration_f,
|
| 190 |
-
"resolution": str(resolution),
|
| 191 |
-
"metadata_json": json.dumps(md, ensure_ascii=False),
|
| 192 |
-
}
|
| 193 |
-
|
| 194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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