Ishwar Balappanawar commited on
Commit ·
45675a1
1
Parent(s): 0eed46c
Split dataset configs and metadata
Browse files- .gitattributes +1 -1
- README.md +21 -4
- clue_metadata.jsonl +3 -0
- cuebench.py +79 -26
- mep_metadata.jsonl +3 -0
- metadata.jsonl +0 -0
.gitattributes
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
-
|
| 2 |
images/* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 1 |
+
*.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 2 |
images/* filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -9,6 +9,15 @@ CUEBench is a neurosymbolic benchmark that emphasizes **contextual entity predic
|
|
| 9 |
- **Geography / Scenario**: Urban autonomous driving across diverse traffic densities
|
| 10 |
- **License**: CC-BY-4.0 (you may adapt if different licensing is desired)
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
## Dataset Structure
|
| 13 |
|
| 14 |
### Data Fields
|
|
@@ -20,7 +29,7 @@ CUEBench is a neurosymbolic benchmark that emphasizes **contextual entity predic
|
|
| 20 |
| `target_classes` | `list[string]` | Entities inferred to exist but unobserved (occluded, off-frame, sensor failure).
|
| 21 |
|
| 22 |
### Splits
|
| 23 |
-
|
| 24 |
|
| 25 |
### Label Taxonomy
|
| 26 |
Representative classes include: `Car`, `Bus`, `Pedestrian`, `PickupTruck`, `MediumSizedTruck`, `Animal`, `Standing`, `VehicleWithRider`, `ConstructionSign`, `TrafficCone`, and more (~40 classes). Extend this section with the final taxonomy before publication if you want exhaustive documentation.
|
|
@@ -43,7 +52,8 @@ from datasets import load_dataset
|
|
| 43 |
|
| 44 |
dataset = load_dataset(
|
| 45 |
path="ishwarbb23/cuebench",
|
| 46 |
-
|
|
|
|
| 47 |
)
|
| 48 |
```
|
| 49 |
|
|
@@ -51,9 +61,15 @@ dataset = load_dataset(
|
|
| 51 |
```python
|
| 52 |
from datasets import load_dataset
|
| 53 |
|
| 54 |
-
dataset = load_dataset(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
```
|
| 56 |
|
|
|
|
|
|
|
| 57 |
## Metrics
|
| 58 |
|
| 59 |
`metric.py` defines **Mean Reciprocal Rank**, **Hits@K (1/3/5/10)**, and **Coverage@K (1/3/5/10)** over the predicted class rankings. When publishing to the Hugging Face Metrics Hub, expose the `compute(predictions, references)` signature so leaderboard integrations can consume it.
|
|
@@ -81,7 +97,8 @@ The dataset is currently tagged as **CC-BY-4.0** in `cuebench.py`. Update this s
|
|
| 81 |
cuebench/
|
| 82 |
README.md
|
| 83 |
cuebench.py
|
| 84 |
-
|
|
|
|
| 85 |
metric.py # optional metric script
|
| 86 |
images/... # optional or host separately
|
| 87 |
```
|
|
|
|
| 9 |
- **Geography / Scenario**: Urban autonomous driving across diverse traffic densities
|
| 10 |
- **License**: CC-BY-4.0 (you may adapt if different licensing is desired)
|
| 11 |
|
| 12 |
+
### Configurations
|
| 13 |
+
|
| 14 |
+
| Config | File | Description |
|
| 15 |
+
| --- | --- | --- |
|
| 16 |
+
| `clue` *(default)* | `clue_metadata.jsonl` | Contextual Unobserved Entity (CLUE) frames with heavy occlusions and single-target predictions. |
|
| 17 |
+
| `mep` | `mep_metadata.jsonl` | Multi-Entity Prediction (MEP) split that introduces complementary metadata and more diverse target sets. |
|
| 18 |
+
|
| 19 |
+
When this dataset is viewed on Hugging Face, the dataset viewer automatically exposes a **config dropdown** so you can switch between `clue` and `mep` without leaving the UI.
|
| 20 |
+
|
| 21 |
## Dataset Structure
|
| 22 |
|
| 23 |
### Data Fields
|
|
|
|
| 29 |
| `target_classes` | `list[string]` | Entities inferred to exist but unobserved (occluded, off-frame, sensor failure).
|
| 30 |
|
| 31 |
### Splits
|
| 32 |
+
Each configuration exposes a single **train** split sourced from either `clue_metadata.jsonl` or `mep_metadata.jsonl`. Feel free to carve out validation/test subsets before upload if you need them.
|
| 33 |
|
| 34 |
### Label Taxonomy
|
| 35 |
Representative classes include: `Car`, `Bus`, `Pedestrian`, `PickupTruck`, `MediumSizedTruck`, `Animal`, `Standing`, `VehicleWithRider`, `ConstructionSign`, `TrafficCone`, and more (~40 classes). Extend this section with the final taxonomy before publication if you want exhaustive documentation.
|
|
|
|
| 52 |
|
| 53 |
dataset = load_dataset(
|
| 54 |
path="ishwarbb23/cuebench",
|
| 55 |
+
split="train",
|
| 56 |
+
config_name="clue", # or "mep"
|
| 57 |
)
|
| 58 |
```
|
| 59 |
|
|
|
|
| 61 |
```python
|
| 62 |
from datasets import load_dataset
|
| 63 |
|
| 64 |
+
dataset = load_dataset(
|
| 65 |
+
path="cuebench",
|
| 66 |
+
data_files="clue_metadata.jsonl", # swap with "mep_metadata.jsonl" as needed
|
| 67 |
+
split="train",
|
| 68 |
+
)
|
| 69 |
```
|
| 70 |
|
| 71 |
+
> **Tip:** From source, you can still switch configurations by pointing `data_files` to `clue_metadata.jsonl` or `mep_metadata.jsonl`.
|
| 72 |
+
|
| 73 |
## Metrics
|
| 74 |
|
| 75 |
`metric.py` defines **Mean Reciprocal Rank**, **Hits@K (1/3/5/10)**, and **Coverage@K (1/3/5/10)** over the predicted class rankings. When publishing to the Hugging Face Metrics Hub, expose the `compute(predictions, references)` signature so leaderboard integrations can consume it.
|
|
|
|
| 97 |
cuebench/
|
| 98 |
README.md
|
| 99 |
cuebench.py
|
| 100 |
+
clue_metadata.jsonl
|
| 101 |
+
mep_metadata.jsonl
|
| 102 |
metric.py # optional metric script
|
| 103 |
images/... # optional or host separately
|
| 104 |
```
|
clue_metadata.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ad0c1ddeea44f53752037681a153d2409ce549a51132bcd4e4efc7807759c980
|
| 3 |
+
size 689281
|
cuebench.py
CHANGED
|
@@ -1,4 +1,6 @@
|
|
| 1 |
import json
|
|
|
|
|
|
|
| 2 |
from datasets import (
|
| 3 |
BuilderConfig,
|
| 4 |
DatasetInfo,
|
|
@@ -11,16 +13,37 @@ from datasets import (
|
|
| 11 |
Version,
|
| 12 |
)
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
class CUEBench(GeneratorBasedBuilder):
|
| 15 |
VERSION = Version("1.0.0")
|
| 16 |
BUILDER_CONFIGS = [
|
| 17 |
-
|
| 18 |
-
name="
|
| 19 |
version=VERSION,
|
| 20 |
-
description="Contextual Unobserved Entity
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
]
|
| 23 |
-
DEFAULT_CONFIG_NAME = "
|
| 24 |
|
| 25 |
def _info(self):
|
| 26 |
return DatasetInfo(
|
|
@@ -37,25 +60,55 @@ class CUEBench(GeneratorBasedBuilder):
|
|
| 37 |
)
|
| 38 |
|
| 39 |
def _split_generators(self, dl_manager):
|
| 40 |
-
data_files = self.config.data_files or {"train":
|
| 41 |
train_files = data_files["train"] if isinstance(data_files, dict) else data_files
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import json
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
from datasets import (
|
| 5 |
BuilderConfig,
|
| 6 |
DatasetInfo,
|
|
|
|
| 13 |
Version,
|
| 14 |
)
|
| 15 |
|
| 16 |
+
HF_DATA_BASE_URL = "https://huggingface.co/datasets/ishwarbb23/cuebench/resolve/main"
|
| 17 |
+
DATA_BASE_OVERRIDE = os.getenv("CUEBENCH_DATA_BASE_URL")
|
| 18 |
+
CLUE_METADATA_FILENAME = "clue_metadata.jsonl"
|
| 19 |
+
MEP_METADATA_FILENAME = "mep_metadata.jsonl"
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class CUEBenchConfig(BuilderConfig):
|
| 23 |
+
"""Builder config that carries the backing metadata file."""
|
| 24 |
+
|
| 25 |
+
def __init__(self, *, data_files=None, **kwargs):
|
| 26 |
+
super().__init__(**kwargs)
|
| 27 |
+
self.data_files = data_files or {"train": CLUE_METADATA_FILENAME}
|
| 28 |
+
|
| 29 |
+
|
| 30 |
class CUEBench(GeneratorBasedBuilder):
|
| 31 |
VERSION = Version("1.0.0")
|
| 32 |
BUILDER_CONFIGS = [
|
| 33 |
+
CUEBenchConfig(
|
| 34 |
+
name="clue",
|
| 35 |
version=VERSION,
|
| 36 |
+
description="Contextual Unobserved Entity (CLUE) split with occluded-entity targets.",
|
| 37 |
+
data_files={"train": CLUE_METADATA_FILENAME},
|
| 38 |
+
),
|
| 39 |
+
CUEBenchConfig(
|
| 40 |
+
name="mep",
|
| 41 |
+
version=VERSION,
|
| 42 |
+
description="Multi-Entity Prediction (MEP) split with complementary metadata.",
|
| 43 |
+
data_files={"train": MEP_METADATA_FILENAME},
|
| 44 |
+
),
|
| 45 |
]
|
| 46 |
+
DEFAULT_CONFIG_NAME = "clue"
|
| 47 |
|
| 48 |
def _info(self):
|
| 49 |
return DatasetInfo(
|
|
|
|
| 60 |
)
|
| 61 |
|
| 62 |
def _split_generators(self, dl_manager):
|
| 63 |
+
data_files = self.config.data_files or {"train": CLUE_METADATA_FILENAME}
|
| 64 |
train_files = data_files["train"] if isinstance(data_files, dict) else data_files
|
| 65 |
+
if isinstance(train_files, str):
|
| 66 |
+
train_files = [train_files]
|
| 67 |
+
|
| 68 |
+
resolved_files = [self._resolve_path(file_path, dl_manager) for file_path in train_files]
|
| 69 |
+
|
| 70 |
+
return [SplitGenerator(name=Split.TRAIN, gen_kwargs={"filepaths": resolved_files})]
|
| 71 |
+
|
| 72 |
+
def _resolve_path(self, file_path, dl_manager):
|
| 73 |
+
if file_path.startswith(("http://", "https://")):
|
| 74 |
+
resolved = dl_manager.download_and_extract(file_path)
|
| 75 |
+
return resolved[0] if isinstance(resolved, list) else resolved
|
| 76 |
+
|
| 77 |
+
local_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), file_path)
|
| 78 |
+
if os.path.exists(local_path):
|
| 79 |
+
return local_path
|
| 80 |
+
|
| 81 |
+
if DATA_BASE_OVERRIDE:
|
| 82 |
+
override = DATA_BASE_OVERRIDE.rstrip("/")
|
| 83 |
+
if override.startswith(("http://", "https://", "hf://")):
|
| 84 |
+
remote_path = f"{override}/{file_path}"
|
| 85 |
+
resolved = dl_manager.download_and_extract(remote_path)
|
| 86 |
+
return resolved[0] if isinstance(resolved, list) else resolved
|
| 87 |
+
|
| 88 |
+
override_candidate = os.path.join(override, file_path)
|
| 89 |
+
if os.path.exists(override_candidate):
|
| 90 |
+
return override_candidate
|
| 91 |
+
|
| 92 |
+
remote_path = f"{HF_DATA_BASE_URL}/{file_path}"
|
| 93 |
+
resolved = dl_manager.download_and_extract(remote_path)
|
| 94 |
+
return resolved[0] if isinstance(resolved, list) else resolved
|
| 95 |
+
|
| 96 |
+
def _generate_examples(self, filepaths):
|
| 97 |
+
if isinstance(filepaths, str):
|
| 98 |
+
filepaths = [filepaths]
|
| 99 |
+
|
| 100 |
+
idx = 0
|
| 101 |
+
for filepath in filepaths:
|
| 102 |
+
with open(filepath, "r", encoding="utf-8") as f:
|
| 103 |
+
for line in f:
|
| 104 |
+
example = json.loads(line)
|
| 105 |
+
image_id = example.get("aligned_id") or example.get("image_id")
|
| 106 |
+
if image_id is None:
|
| 107 |
+
raise ValueError(f"Missing image identifier for example at line {idx}.")
|
| 108 |
+
yield idx, {
|
| 109 |
+
"image_id": image_id,
|
| 110 |
+
"image_path": example["image_path"],
|
| 111 |
+
"observed_classes": example["detected_classes"],
|
| 112 |
+
"target_classes": example["target_classes"],
|
| 113 |
+
}
|
| 114 |
+
idx += 1
|
mep_metadata.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0209facd1d858f4be3e32b3c1dd8c581ace65e70218e904079de53d6e21c933b
|
| 3 |
+
size 526853
|
metadata.jsonl
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|