Scholarus commited on
Commit ·
405ef7c
0
Parent(s):
Add MMB counterfactual dataset with viewer
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +59 -0
- .gitignore +35 -0
- MMB_dataset.py +173 -0
- README.md +82 -0
- dataset_1k_720p_2/checkpoint.json +1 -0
- dataset_1k_720p_2/image_mapping_with_questions.csv +0 -0
- dataset_1k_720p_2/images/scene_0000_cf1.png +3 -0
- dataset_1k_720p_2/images/scene_0000_cf2.png +3 -0
- dataset_1k_720p_2/images/scene_0000_original.png +3 -0
- dataset_1k_720p_2/images/scene_0001_cf1.png +3 -0
- dataset_1k_720p_2/images/scene_0001_cf2.png +3 -0
- dataset_1k_720p_2/images/scene_0001_original.png +3 -0
- dataset_1k_720p_2/images/scene_0002_cf1.png +3 -0
- dataset_1k_720p_2/images/scene_0002_cf2.png +3 -0
- dataset_1k_720p_2/images/scene_0002_original.png +3 -0
- dataset_1k_720p_2/images/scene_0003_cf1.png +3 -0
- dataset_1k_720p_2/images/scene_0003_cf2.png +3 -0
- dataset_1k_720p_2/images/scene_0003_original.png +3 -0
- dataset_1k_720p_2/images/scene_0004_cf1.png +3 -0
- dataset_1k_720p_2/images/scene_0004_cf2.png +3 -0
- dataset_1k_720p_2/images/scene_0004_original.png +3 -0
- dataset_1k_720p_2/images/scene_0005_cf1.png +3 -0
- dataset_1k_720p_2/images/scene_0005_cf2.png +3 -0
- dataset_1k_720p_2/images/scene_0005_original.png +3 -0
- dataset_1k_720p_2/images/scene_0006_cf1.png +3 -0
- dataset_1k_720p_2/images/scene_0006_cf2.png +3 -0
- dataset_1k_720p_2/images/scene_0006_original.png +3 -0
- dataset_1k_720p_2/images/scene_0007_cf1.png +3 -0
- dataset_1k_720p_2/images/scene_0007_cf2.png +3 -0
- dataset_1k_720p_2/images/scene_0007_original.png +3 -0
- dataset_1k_720p_2/images/scene_0008_cf1.png +3 -0
- dataset_1k_720p_2/images/scene_0008_cf2.png +3 -0
- dataset_1k_720p_2/images/scene_0008_original.png +3 -0
- dataset_1k_720p_2/images/scene_0009_cf1.png +3 -0
- dataset_1k_720p_2/images/scene_0009_cf2.png +3 -0
- dataset_1k_720p_2/images/scene_0009_original.png +3 -0
- dataset_1k_720p_2/images/scene_0010_cf1.png +3 -0
- dataset_1k_720p_2/images/scene_0010_cf2.png +3 -0
- dataset_1k_720p_2/images/scene_0010_original.png +3 -0
- dataset_1k_720p_2/images/scene_0011_cf1.png +3 -0
- dataset_1k_720p_2/images/scene_0011_cf2.png +3 -0
- dataset_1k_720p_2/images/scene_0011_original.png +3 -0
- dataset_1k_720p_2/images/scene_0012_cf1.png +3 -0
- dataset_1k_720p_2/images/scene_0012_cf2.png +3 -0
- dataset_1k_720p_2/images/scene_0012_original.png +3 -0
- dataset_1k_720p_2/images/scene_0013_cf1.png +3 -0
- dataset_1k_720p_2/images/scene_0013_cf2.png +3 -0
- dataset_1k_720p_2/images/scene_0013_original.png +3 -0
- dataset_1k_720p_2/images/scene_0014_cf1.png +3 -0
- dataset_1k_720p_2/images/scene_0014_cf2.png +3 -0
.gitattributes
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.lz4 filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.mds filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
# Audio files - uncompressed
|
| 39 |
+
*.pcm filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
*.sam filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
*.raw filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
# Audio files - compressed
|
| 43 |
+
*.aac filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
*.flac filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
*.ogg filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
*.wav filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
# Image files - uncompressed
|
| 49 |
+
*.bmp filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
*.gif filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
*.tiff filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
# Image files - compressed
|
| 54 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
*.webp filter=lfs diff=lfs merge=lfs -text
|
| 57 |
+
# Video files - compressed
|
| 58 |
+
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
+
*.webm filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Python
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[cod]
|
| 4 |
+
*$py.class
|
| 5 |
+
*.so
|
| 6 |
+
.Python
|
| 7 |
+
env/
|
| 8 |
+
venv/
|
| 9 |
+
ENV/
|
| 10 |
+
build/
|
| 11 |
+
develop-eggs/
|
| 12 |
+
dist/
|
| 13 |
+
downloads/
|
| 14 |
+
eggs/
|
| 15 |
+
.eggs/
|
| 16 |
+
lib/
|
| 17 |
+
lib64/
|
| 18 |
+
parts/
|
| 19 |
+
sdist/
|
| 20 |
+
var/
|
| 21 |
+
wheels/
|
| 22 |
+
*.egg-info/
|
| 23 |
+
.installed.cfg
|
| 24 |
+
*.egg
|
| 25 |
+
|
| 26 |
+
# IDE
|
| 27 |
+
.vscode/
|
| 28 |
+
.idea/
|
| 29 |
+
*.swp
|
| 30 |
+
*.swo
|
| 31 |
+
*~
|
| 32 |
+
|
| 33 |
+
# OS
|
| 34 |
+
.DS_Store
|
| 35 |
+
Thumbs.db
|
MMB_dataset.py
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Hugging Face datasets loading script for the MMB Counterfactual Dataset.
|
| 3 |
+
|
| 4 |
+
This dataset contains counterfactual visual question answering examples with:
|
| 5 |
+
- Original images and counterfactual variants
|
| 6 |
+
- Questions for each image variant
|
| 7 |
+
- Answer matrices showing how each image answers each question
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
from __future__ import annotations
|
| 11 |
+
|
| 12 |
+
import csv
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
from typing import Iterator
|
| 15 |
+
|
| 16 |
+
import datasets
|
| 17 |
+
from datasets import Image, Value
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
_DESCRIPTION = """
|
| 21 |
+
MMB-style counterfactual visual question answering dataset.
|
| 22 |
+
|
| 23 |
+
This dataset contains scenes with:
|
| 24 |
+
- Original images and counterfactual variants
|
| 25 |
+
- Questions for each image variant
|
| 26 |
+
- Answer matrices showing how each image answers each question
|
| 27 |
+
"""
|
| 28 |
+
|
| 29 |
+
_HOMEPAGE = "https://huggingface.co/datasets/scholo/MMB_dataset"
|
| 30 |
+
|
| 31 |
+
_LICENSE = "mit"
|
| 32 |
+
|
| 33 |
+
_CITATION = """
|
| 34 |
+
@misc{mmb_counterfactual_dataset,
|
| 35 |
+
title={MMB Counterfactual Dataset},
|
| 36 |
+
author={MMB-Dataset authors},
|
| 37 |
+
year={2026}
|
| 38 |
+
}
|
| 39 |
+
"""
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
class MMB_dataset(datasets.GeneratorBasedBuilder):
|
| 43 |
+
"""MMB counterfactual dataset."""
|
| 44 |
+
|
| 45 |
+
VERSION = datasets.Version("1.0.0")
|
| 46 |
+
|
| 47 |
+
def _info(self) -> datasets.DatasetInfo:
|
| 48 |
+
return datasets.DatasetInfo(
|
| 49 |
+
description=_DESCRIPTION,
|
| 50 |
+
features=datasets.Features(
|
| 51 |
+
{
|
| 52 |
+
# Simple scene identifier derived from the original image filename
|
| 53 |
+
"scene_id": Value("string"),
|
| 54 |
+
# Image triplet (paths resolved relative to dataset_1k_720p_2/images/)
|
| 55 |
+
"original_image": Image(decode=True),
|
| 56 |
+
"counterfactual1_image": Image(decode=True),
|
| 57 |
+
"counterfactual2_image": Image(decode=True),
|
| 58 |
+
# Questions
|
| 59 |
+
"original_question": Value("string"),
|
| 60 |
+
"counterfactual1_question": Value("string"),
|
| 61 |
+
"counterfactual2_question": Value("string"),
|
| 62 |
+
# Difficulties
|
| 63 |
+
"original_question_difficulty": Value("string"),
|
| 64 |
+
"counterfactual1_question_difficulty": Value("string"),
|
| 65 |
+
"counterfactual2_question_difficulty": Value("string"),
|
| 66 |
+
# Answer matrix (9 entries, image × question)
|
| 67 |
+
"original_image_answer_to_original_question": Value("string"),
|
| 68 |
+
"original_image_answer_to_cf1_question": Value("string"),
|
| 69 |
+
"original_image_answer_to_cf2_question": Value("string"),
|
| 70 |
+
"cf1_image_answer_to_original_question": Value("string"),
|
| 71 |
+
"cf1_image_answer_to_cf1_question": Value("string"),
|
| 72 |
+
"cf1_image_answer_to_cf2_question": Value("string"),
|
| 73 |
+
"cf2_image_answer_to_original_question": Value("string"),
|
| 74 |
+
"cf2_image_answer_to_cf1_question": Value("string"),
|
| 75 |
+
"cf2_image_answer_to_cf2_question": Value("string"),
|
| 76 |
+
}
|
| 77 |
+
),
|
| 78 |
+
homepage=_HOMEPAGE,
|
| 79 |
+
license=_LICENSE,
|
| 80 |
+
citation=_CITATION,
|
| 81 |
+
)
|
| 82 |
+
|
| 83 |
+
def _split_generators(
|
| 84 |
+
self, dl_manager: datasets.DownloadManager
|
| 85 |
+
) -> list[datasets.SplitGenerator]:
|
| 86 |
+
"""We expose a single train split backed by dataset_1k_720p_2/image_mapping_with_questions.csv."""
|
| 87 |
+
data_dir = Path(__file__).parent.resolve()
|
| 88 |
+
csv_path = data_dir / "dataset_1k_720p_2" / "image_mapping_with_questions.csv"
|
| 89 |
+
images_dir = data_dir / "dataset_1k_720p_2" / "images"
|
| 90 |
+
|
| 91 |
+
return [
|
| 92 |
+
datasets.SplitGenerator(
|
| 93 |
+
name=datasets.Split.TRAIN,
|
| 94 |
+
gen_kwargs={
|
| 95 |
+
"csv_path": str(csv_path),
|
| 96 |
+
"images_dir": str(images_dir),
|
| 97 |
+
},
|
| 98 |
+
)
|
| 99 |
+
]
|
| 100 |
+
|
| 101 |
+
def _generate_examples(
|
| 102 |
+
self, csv_path: str, images_dir: str
|
| 103 |
+
) -> Iterator[tuple[int, dict]]:
|
| 104 |
+
"""Yield (key, example) tuples from the wide-format CSV."""
|
| 105 |
+
csv_path = Path(csv_path)
|
| 106 |
+
images_root = Path(images_dir)
|
| 107 |
+
|
| 108 |
+
if not csv_path.exists():
|
| 109 |
+
raise FileNotFoundError(f"CSV file not found: {csv_path}")
|
| 110 |
+
|
| 111 |
+
with csv_path.open("r", encoding="utf-8", newline="") as f:
|
| 112 |
+
reader = csv.DictReader(f)
|
| 113 |
+
for idx, row in enumerate(reader):
|
| 114 |
+
# Resolve scene_id from original_image filename, e.g. scene_0000_original.png -> scene_0000
|
| 115 |
+
original_image_name = row.get("original_image", "") or ""
|
| 116 |
+
scene_id = original_image_name.split("_original", 1)[0]
|
| 117 |
+
|
| 118 |
+
def _image_field(col_name: str) -> dict | None:
|
| 119 |
+
filename = (row.get(col_name) or "").strip()
|
| 120 |
+
if not filename:
|
| 121 |
+
return None
|
| 122 |
+
path = images_root / filename
|
| 123 |
+
if not path.exists():
|
| 124 |
+
return None
|
| 125 |
+
return {"path": str(path)}
|
| 126 |
+
|
| 127 |
+
example = {
|
| 128 |
+
"scene_id": scene_id,
|
| 129 |
+
"original_image": _image_field("original_image"),
|
| 130 |
+
"counterfactual1_image": _image_field("counterfactual1_image"),
|
| 131 |
+
"counterfactual2_image": _image_field("counterfactual2_image"),
|
| 132 |
+
"original_question": row.get("original_question", ""),
|
| 133 |
+
"counterfactual1_question": row.get("counterfactual1_question", ""),
|
| 134 |
+
"counterfactual2_question": row.get("counterfactual2_question", ""),
|
| 135 |
+
"original_question_difficulty": row.get(
|
| 136 |
+
"original_question_difficulty", ""
|
| 137 |
+
),
|
| 138 |
+
"counterfactual1_question_difficulty": row.get(
|
| 139 |
+
"counterfactual1_question_difficulty", ""
|
| 140 |
+
),
|
| 141 |
+
"counterfactual2_question_difficulty": row.get(
|
| 142 |
+
"counterfactual2_question_difficulty", ""
|
| 143 |
+
),
|
| 144 |
+
"original_image_answer_to_original_question": row.get(
|
| 145 |
+
"original_image_answer_to_original_question", ""
|
| 146 |
+
),
|
| 147 |
+
"original_image_answer_to_cf1_question": row.get(
|
| 148 |
+
"original_image_answer_to_cf1_question", ""
|
| 149 |
+
),
|
| 150 |
+
"original_image_answer_to_cf2_question": row.get(
|
| 151 |
+
"original_image_answer_to_cf2_question", ""
|
| 152 |
+
),
|
| 153 |
+
"cf1_image_answer_to_original_question": row.get(
|
| 154 |
+
"cf1_image_answer_to_original_question", ""
|
| 155 |
+
),
|
| 156 |
+
"cf1_image_answer_to_cf1_question": row.get(
|
| 157 |
+
"cf1_image_answer_to_cf1_question", ""
|
| 158 |
+
),
|
| 159 |
+
"cf1_image_answer_to_cf2_question": row.get(
|
| 160 |
+
"cf1_image_answer_to_cf2_question", ""
|
| 161 |
+
),
|
| 162 |
+
"cf2_image_answer_to_original_question": row.get(
|
| 163 |
+
"cf2_image_answer_to_original_question", ""
|
| 164 |
+
),
|
| 165 |
+
"cf2_image_answer_to_cf1_question": row.get(
|
| 166 |
+
"cf2_image_answer_to_cf1_question", ""
|
| 167 |
+
),
|
| 168 |
+
"cf2_image_answer_to_cf2_question": row.get(
|
| 169 |
+
"cf2_image_answer_to_cf2_question", ""
|
| 170 |
+
),
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
yield idx, example
|
README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
pretty_name: MMB Counterfactual Dataset
|
| 4 |
+
task_categories:
|
| 5 |
+
- visual-question-answering
|
| 6 |
+
- multiple-choice
|
| 7 |
+
language:
|
| 8 |
+
- en
|
| 9 |
+
tags:
|
| 10 |
+
- vision
|
| 11 |
+
- language
|
| 12 |
+
- multimodal
|
| 13 |
+
- counterfactual
|
| 14 |
+
- question-answering
|
| 15 |
+
- synthetic
|
| 16 |
+
size_categories:
|
| 17 |
+
- 1K<n<10K
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# MMB Counterfactual Dataset
|
| 21 |
+
|
| 22 |
+
A multimodal benchmark dataset featuring counterfactual visual question answering examples.
|
| 23 |
+
|
| 24 |
+
## Dataset Structure
|
| 25 |
+
|
| 26 |
+
This repository contains counterfactual visual question answering data with:
|
| 27 |
+
|
| 28 |
+
- **Original images** and **counterfactual variants** (modifications to test reasoning)
|
| 29 |
+
- **Questions** for each image variant
|
| 30 |
+
- **Answer matrices** showing how each image answers each question (9 values per scene: 3 images × 3 questions)
|
| 31 |
+
|
| 32 |
+
### Current Run: `dataset_1k_720p_2`
|
| 33 |
+
|
| 34 |
+
The dataset currently includes:
|
| 35 |
+
- **1,000 scenes**
|
| 36 |
+
- **3 images per scene**: original, counterfactual 1, counterfactual 2
|
| 37 |
+
- **3 questions per scene**: one for each image
|
| 38 |
+
- **Answer matrix**: the answer of every image to every question
|
| 39 |
+
|
| 40 |
+
Data is stored in `dataset_1k_720p_2/image_mapping_with_questions.csv` with images in `dataset_1k_720p_2/images/`.
|
| 41 |
+
|
| 42 |
+
## Hugging Face Dataset Viewer
|
| 43 |
+
|
| 44 |
+
This repository is configured as a Hugging Face dataset. The **Preview** tab will automatically:
|
| 45 |
+
|
| 46 |
+
1. Use `MMB_Dataset.py` to load the CSV from `dataset_1k_720p_2/`
|
| 47 |
+
2. Resolve image paths to display thumbnails
|
| 48 |
+
3. Show all fields including:
|
| 49 |
+
- Scene IDs
|
| 50 |
+
- Three images per example (original + 2 counterfactuals)
|
| 51 |
+
- Questions and difficulties
|
| 52 |
+
- Complete answer matrix (9 fields)
|
| 53 |
+
|
| 54 |
+
### Loading from Python
|
| 55 |
+
|
| 56 |
+
After pushing this repository to the Hub, load it with:
|
| 57 |
+
|
| 58 |
+
```python
|
| 59 |
+
from datasets import load_dataset
|
| 60 |
+
|
| 61 |
+
ds = load_dataset("scholo/MMB_dataset", split="train", trust_remote_code=True)
|
| 62 |
+
print(ds[0])
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
## Directory Structure
|
| 66 |
+
|
| 67 |
+
```
|
| 68 |
+
MMB-Dataset/
|
| 69 |
+
├── MMB_dataset.py # Hugging Face dataset loading script
|
| 70 |
+
├── README.md # This file
|
| 71 |
+
├── .gitattributes # Git LFS configuration for images
|
| 72 |
+
├── dataset_1k_720p_2/ # Current dataset run
|
| 73 |
+
│ ├── images/ # All PNG images
|
| 74 |
+
│ ├── scenes/ # JSON scene descriptions (reference)
|
| 75 |
+
│ ├── image_mapping_with_questions.csv # Main data file
|
| 76 |
+
│ ├── checkpoint.json # Run metadata
|
| 77 |
+
│ └── run_metadata.json # Run metadata
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
## License
|
| 81 |
+
|
| 82 |
+
MIT
|
dataset_1k_720p_2/checkpoint.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"completed_scenes": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999]}
|
dataset_1k_720p_2/image_mapping_with_questions.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
dataset_1k_720p_2/images/scene_0000_cf1.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0000_cf2.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0000_original.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0001_cf1.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0001_cf2.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0001_original.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0002_cf1.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0002_cf2.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0002_original.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0003_cf1.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0003_cf2.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0003_original.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0004_cf1.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0004_cf2.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0004_original.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0005_cf1.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0005_cf2.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0005_original.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0006_cf1.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0006_cf2.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0006_original.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0007_cf1.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0007_cf2.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0007_original.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0008_cf1.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0008_cf2.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0008_original.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0009_cf1.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0009_cf2.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0009_original.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0010_cf1.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0010_cf2.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0010_original.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0011_cf1.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0011_cf2.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0011_original.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0012_cf1.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0012_cf2.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0012_original.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0013_cf1.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0013_cf2.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0013_original.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0014_cf1.png
ADDED
|
Git LFS Details
|
dataset_1k_720p_2/images/scene_0014_cf2.png
ADDED
|
Git LFS Details
|