Datasets:
Download code/make_croissant.py from spatial-evidence-bench/SpatialEvidenceBench: direct link, hf CLI and curl.
- Browser
- Download file 6.33 kB
-
https://huggingface.co/datasets/spatial-evidence-bench/SpatialEvidenceBench/resolve/5c8b07c8e3679dc7d2dd54b6fae5e27f9d82c4db/code/make_croissant.py
- Command line
-
hf download hf://datasets/spatial-evidence-bench/SpatialEvidenceBench@5c8b07c8e3679dc7d2dd54b6fae5e27f9d82c4db/code/make_croissant.py
-
curl -L -o make_croissant.py https://huggingface.co/datasets/spatial-evidence-bench/SpatialEvidenceBench/resolve/5c8b07c8e3679dc7d2dd54b6fae5e27f9d82c4db/code/make_croissant.py
6.33 kB
| import hashlib | |
| import json | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| REL = ROOT / "release" / "data_v1" | |
| def sha256(path): | |
| h = hashlib.sha256() | |
| with open(path, "rb") as fh: | |
| for chunk in iter(lambda: fh.read(1 << 20), b""): | |
| h.update(chunk) | |
| return h.hexdigest() | |
| def file_object(name, rel_path, fmt, description, with_hash=True): | |
| path = REL / rel_path | |
| if not path.exists(): | |
| raise FileNotFoundError(f"Croissant 引用的文件不存在:{path}") | |
| obj = { | |
| "@type": "cr:FileObject", | |
| "@id": name, | |
| "name": name, | |
| "contentUrl": rel_path, | |
| "encodingFormat": fmt, | |
| "description": description, | |
| } | |
| if with_hash and path.is_file(): | |
| obj["sha256"] = sha256(path) | |
| return obj | |
| def main(): | |
| truth_rows = [json.loads(line) for line in (REL / "truth" / "truth_all.jsonl").open()] | |
| first = truth_rows[0] | |
| fields = [] | |
| for key, dtype in ( | |
| ("scene_id", "sc:Text"), | |
| ("state", "sc:Text"), | |
| ("family", "sc:Text"), | |
| ("image", "sc:Text"), | |
| ("declared", "sc:Text"), | |
| ("computed", "sc:Text"), | |
| ("agree", "sc:Boolean"), | |
| ("margin", "sc:Float"), | |
| ("inside_frame", "sc:Boolean"), | |
| ("pixel_separation", "sc:Float"), | |
| ): | |
| if key not in first: | |
| raise KeyError(f"truth 记录缺少字段 {key}") | |
| fields.append({"@type": "cr:Field", "@id": f"truth/{key}", "name": key, "dataType": dtype}) | |
| doc = { | |
| "@context": { | |
| "@language": "en", | |
| "@vocab": "https://schema.org/", | |
| "citeAs": "https://schema.org/citeAs", | |
| "cr": "http://mlcommons.org/croissant/", | |
| "rai": "http://mlcommons.org/croissant/RAI/", | |
| }, | |
| "@type": "sc:Dataset", | |
| "conformsTo": "http://mlcommons.org/croissant/1.0", | |
| "name": "Counterfactual Spatial Evidence Benchmark", | |
| "description": ( | |
| "2,400 paired rendered scenes (4,800 images) built from 192 Objaverse assets. The two members of a pair " | |
| "are identical except for the pose or contact change that flips one spatial predicate, and the truth is " | |
| "computed from 3D geometry. Each image is paired with five textual conditions: no evidence, asserted-true, " | |
| "asserted-false, missing edge and explicit unknown." | |
| ), | |
| "version": "1.0.0", | |
| "datePublished": "2026-11-07", | |
| "license": "https://creativecommons.org/licenses/by/4.0/", | |
| "url": "release/data_v1", | |
| "citeAs": "GraphEvolve Project. Counterfactual Spatial Evidence Benchmark, version 1.0.0. 2026.", | |
| "creator": {"@type": "sc:Organization", "name": "GraphEvolve Project"}, | |
| "keywords": ["spatial reasoning", "vision-language models", "counterfactual", "scene graph", "benchmark"], | |
| "rai:dataCollection": "Rendered in Blender 3.3.21 from Objaverse meshes; no human subjects and no scraped personal data.", | |
| "rai:dataUseCases": "Evaluating how structural assertions change yes/no answers of vision-language models on spatial relations.", | |
| "rai:dataLimitations": ( | |
| "Synthetic tabletop scenes only; four predicate families; assets normalised to a fixed size; no human " | |
| "annotation of the rendered pairs; one of 4,800 images has a declared contact state that the recomputed " | |
| "overlap ratio does not confirm and is listed in metadata/truth_mismatch.json." | |
| ), | |
| "rai:dataBiases": "Object categories follow LVIS/Objaverse availability, which over-represents household tabletop objects.", | |
| "rai:personalSensitiveInformation": "None.", | |
| "rai:dataSocialImpact": "Intended for measurement and audit of model behaviour; not for deployment decisions.", | |
| "rai:hasDataUsePermission": "https://mlcommons.org/croissant/RAI/datausepermission/users", | |
| "distribution": [ | |
| file_object("images_rgb", "images/render_all", "image/png", "4,800 RGB renders with instance masks and 16-bit depth maps.", with_hash=False), | |
| file_object("truth_all", "truth/truth_all.jsonl", "application/jsonl", "Geometry-derived truth for all 4,800 images."), | |
| file_object("truth_dev", "truth/truth_dev.jsonl", "application/jsonl", "Development split truth (600 pairs)."), | |
| file_object("truth_test", "truth/truth_test.jsonl", "application/jsonl", "Test split truth (1,800 pairs)."), | |
| file_object("prompts_all", "prompts/prompts_all.jsonl", "application/jsonl", "24,000 prompts, five conditions per image."), | |
| file_object("specs_dev", "specs/scene_specs_dev.jsonl", "application/jsonl", "Development scene specifications with asset ids and poses."), | |
| file_object("specs_test", "specs/scene_specs_test.jsonl", "application/jsonl", "Test scene specifications with asset ids and poses."), | |
| file_object("asset_catalog", "assets/asset_catalog.jsonl", "application/jsonl", "192 Objaverse assets with source URL, licence and SHA-256."), | |
| file_object("licenses", "assets/licenses.csv", "text/csv", "Per-asset licence table."), | |
| file_object("split_manifest", "metadata/split_manifest.json", "application/json", "Split definition and scene counts."), | |
| file_object("truth_mismatch", "metadata/truth_mismatch.json", "application/json", "Records where declared and recomputed truth disagree."), | |
| file_object("checksums", "metadata/CHECKSUMS.sha256", "text/plain", "SHA-256 of every released file.", with_hash=False), | |
| file_object("code", "code", "text/x-python", "Generation, inference, gating and analysis scripts.", with_hash=False), | |
| ], | |
| "recordSet": [ | |
| { | |
| "@type": "cr:RecordSet", | |
| "@id": "truth", | |
| "name": "truth", | |
| "description": "One row per rendered image; declared state, recomputed geometry truth and agreement flags.", | |
| "field": fields, | |
| } | |
| ], | |
| } | |
| out = ROOT / "release" / "croissant.json" | |
| out.write_text(json.dumps(doc, indent=2, ensure_ascii=False), encoding="utf-8") | |
| print(json.dumps({"wrote": str(out), "fileObjects": len(doc["distribution"]), "fields": len(fields)})) | |
| if __name__ == "__main__": | |
| main() | |