Delete cuebench
Browse files- cuebench/CLUE_labels.tsv +0 -0
- cuebench/README.md +0 -17
- cuebench/convert_to_jsonl.py +0 -21
- cuebench/cuebench.py +0 -34
- cuebench/metric.py +0 -35
cuebench/CLUE_labels.tsv
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
cuebench/README.md
DELETED
|
@@ -1,17 +0,0 @@
|
|
| 1 |
-
# CUEBench: Contextual Unobserved Entity Benchmark
|
| 2 |
-
|
| 3 |
-
CUEBench is a neurosymbolic benchmark that emphasizes **contextual entity prediction** in autonomous driving scenes. Unlike traditional detection tasks, CUEBench focuses on reasoning over **unobserved entities** — objects that may be occluded, out-of-frame, or affected by sensor failures.
|
| 4 |
-
|
| 5 |
-
## Task
|
| 6 |
-
|
| 7 |
-
**Input**: A scene ID and a set of `observed_classes` present in the scene
|
| 8 |
-
**Output**: Predict the `target_classes` that were present but unobserved
|
| 9 |
-
|
| 10 |
-
### Example
|
| 11 |
-
```json
|
| 12 |
-
{
|
| 13 |
-
"image_id": "00003.00019",
|
| 14 |
-
"observed_classes": ["Car", "Bus", "Pedestrian"],
|
| 15 |
-
"target_classes": ["PickupTruck"]
|
| 16 |
-
}
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cuebench/convert_to_jsonl.py
DELETED
|
@@ -1,21 +0,0 @@
|
|
| 1 |
-
import json
|
| 2 |
-
|
| 3 |
-
def convert_tsv_to_jsonl(input_path, output_path):
|
| 4 |
-
with open(input_path, "r") as fin, open(output_path, "w") as fout:
|
| 5 |
-
for line in fin:
|
| 6 |
-
parts = line.strip().split("\t")
|
| 7 |
-
if len(parts) != 3:
|
| 8 |
-
continue
|
| 9 |
-
image_id = parts[0]
|
| 10 |
-
observed = sorted(eval(parts[1])) # safely convert set to list
|
| 11 |
-
target = sorted(eval(parts[2]))
|
| 12 |
-
obj = {
|
| 13 |
-
"image_id": image_id,
|
| 14 |
-
"observed_classes": observed,
|
| 15 |
-
"target_classes": target
|
| 16 |
-
}
|
| 17 |
-
fout.write(json.dumps(obj) + "\n")
|
| 18 |
-
|
| 19 |
-
# Example usage:
|
| 20 |
-
# convert_tsv_to_jsonl("data/train.tsv", "data/train.jsonl")
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cuebench/cuebench.py
DELETED
|
@@ -1,34 +0,0 @@
|
|
| 1 |
-
import json
|
| 2 |
-
import os
|
| 3 |
-
from datasets import DatasetInfo, GeneratorBasedBuilder, SplitGenerator, Split, Value, Features
|
| 4 |
-
|
| 5 |
-
class CUEBench(GeneratorBasedBuilder):
|
| 6 |
-
def _info(self):
|
| 7 |
-
return DatasetInfo(
|
| 8 |
-
description="CUEBench: Contextual Entity Prediction for Occluded or Unobserved Entities in Autonomous Driving.",
|
| 9 |
-
features=Features({
|
| 10 |
-
"image_id": Value("string"),
|
| 11 |
-
"observed_classes": Value("string"), # Will be jsonified list
|
| 12 |
-
"target_classes": Value("string"), # Will be jsonified list
|
| 13 |
-
}),
|
| 14 |
-
supervised_keys=None,
|
| 15 |
-
)
|
| 16 |
-
|
| 17 |
-
def _split_generators(self, dl_manager):
|
| 18 |
-
data_dir = dl_manager.download_and_extract("path_or_url_to_data_dir") # Update this
|
| 19 |
-
return [
|
| 20 |
-
SplitGenerator(name=Split.TRAIN, gen_kwargs={"filepath": os.path.join(data_dir, "train.jsonl")}),
|
| 21 |
-
SplitGenerator(name=Split.VALIDATION, gen_kwargs={"filepath": os.path.join(data_dir, "val.jsonl")}),
|
| 22 |
-
SplitGenerator(name=Split.TEST, gen_kwargs={"filepath": os.path.join(data_dir, "test.jsonl")}),
|
| 23 |
-
]
|
| 24 |
-
|
| 25 |
-
def _generate_examples(self, filepath):
|
| 26 |
-
with open(filepath, "r", encoding="utf-8") as f:
|
| 27 |
-
for idx, line in enumerate(f):
|
| 28 |
-
example = json.loads(line)
|
| 29 |
-
yield idx, {
|
| 30 |
-
"image_id": example["image_id"],
|
| 31 |
-
"observed_classes": json.dumps(example["observed_classes"]),
|
| 32 |
-
"target_classes": json.dumps(example["target_classes"]),
|
| 33 |
-
}
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cuebench/metric.py
DELETED
|
@@ -1,35 +0,0 @@
|
|
| 1 |
-
from datasets import Metric
|
| 2 |
-
|
| 3 |
-
class CUEBenchMetric(Metric):
|
| 4 |
-
def _info(self):
|
| 5 |
-
return {
|
| 6 |
-
"description": "F1, Precision, and Recall for multi-label set prediction in CUEBench",
|
| 7 |
-
"inputs_description": "List of predicted and reference class sets",
|
| 8 |
-
"citation": "",
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
-
def _compute(self, predictions, references):
|
| 12 |
-
total_precision, total_recall, total_f1 = 0.0, 0.0, 0.0
|
| 13 |
-
count = len(predictions)
|
| 14 |
-
|
| 15 |
-
for pred, ref in zip(predictions, references):
|
| 16 |
-
pred_set = set(pred)
|
| 17 |
-
ref_set = set(ref)
|
| 18 |
-
tp = len(pred_set & ref_set)
|
| 19 |
-
fp = len(pred_set - ref_set)
|
| 20 |
-
fn = len(ref_set - pred_set)
|
| 21 |
-
|
| 22 |
-
precision = tp / (tp + fp) if (tp + fp) else 0.0
|
| 23 |
-
recall = tp / (tp + fn) if (tp + fn) else 0.0
|
| 24 |
-
f1 = 2 * precision * recall / (precision + recall) if (precision + recall) else 0.0
|
| 25 |
-
|
| 26 |
-
total_precision += precision
|
| 27 |
-
total_recall += recall
|
| 28 |
-
total_f1 += f1
|
| 29 |
-
|
| 30 |
-
return {
|
| 31 |
-
"precision": total_precision / count,
|
| 32 |
-
"recall": total_recall / count,
|
| 33 |
-
"f1": total_f1 / count
|
| 34 |
-
}
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|