scholo commited on
Commit
0f53d8c
·
verified ·
1 Parent(s): 068fb99

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +407 -99
README.md CHANGED
@@ -1,120 +1,428 @@
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
- dataset_info:
19
- features:
20
- - name: original_image
21
- dtype: image
22
- - name: counterfactual1_image
23
- dtype: image
24
- - name: counterfactual2_image
25
- dtype: image
26
- - name: counterfactual1_type
27
- dtype: string
28
- - name: counterfactual2_type
29
- dtype: string
30
- - name: counterfactual1_description
31
- dtype: string
32
- - name: counterfactual2_description
33
- dtype: string
34
- - name: original_question
35
- dtype: string
36
- - name: counterfactual1_question
37
- dtype: string
38
- - name: counterfactual2_question
39
- dtype: string
40
- - name: original_question_difficulty
41
- dtype: string
42
- - name: counterfactual1_question_difficulty
43
- dtype: string
44
- - name: counterfactual2_question_difficulty
45
- dtype: string
46
- - name: original_image_answer_to_original_question
47
- dtype: string
48
- - name: original_image_answer_to_cf1_question
49
- dtype: string
50
- - name: original_image_answer_to_cf2_question
51
- dtype: string
52
- - name: cf1_image_answer_to_original_question
53
- dtype: string
54
- - name: cf1_image_answer_to_cf1_question
55
- dtype: string
56
- - name: cf1_image_answer_to_cf2_question
57
- dtype: string
58
- - name: cf2_image_answer_to_original_question
59
- dtype: string
60
- - name: cf2_image_answer_to_cf1_question
61
- dtype: string
62
- - name: cf2_image_answer_to_cf2_question
63
- dtype: string
64
- splits:
65
- - name: train
66
- num_bytes: 29666931
67
- num_examples: 100
68
- download_size: 29653393
69
- dataset_size: 29666931
70
- configs:
71
- - config_name: default
72
- data_files:
73
- - split: train
74
- path: data/train-*
75
  ---
76
 
77
- # MMB Counterfactual Dataset
78
 
79
- A counterfactual VQA dataset constructed using the CLEVR blender assets to procedurally generate both negative and normal counter factual VQA images and questions for the Multimodal Benchmark paper.
80
- ## Dataset Structure
 
 
 
 
 
81
 
82
- This repository contains counterfactual visual question answering data with:
83
 
84
- - **Original images** and **counterfactual variants** (modifications to test reasoning)
85
- - **Questions** for each image variant
86
- - **Answer matrices** showing how each image answers each question (9 values per scene: 3 images × 3 questions)
87
 
 
88
 
89
- ### Loading from Python
 
 
 
 
90
 
91
- After pushing this repository to the Hub, load it with:
92
 
93
- ```python
94
- from datasets import load_dataset
95
 
96
- ds = load_dataset("scholo/MMB_dataset", split="train")
97
- print(ds[0])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  ```
99
 
100
- No `trust_remote_code=True` needed since we use standard Parquet format!
101
 
102
- ## Directory Structure
103
 
104
  ```
105
- MMB-Dataset/
106
- ├── README.md # This file
107
- ├── .gitattributes # Git LFS configuration for images
108
- ├── data/ # Dataset files (Parquet format)
109
- │ └── train.parquet # Main dataset file
110
- ├── Dataset/ # Current dataset run
111
- │ ├── images/ # All PNG images (referenced by Parquet)
112
- │ ├── scenes/ # JSON scene descriptions (reference)
113
- │ ├── image_mapping_with_questions.csv # Original CSV (source)
114
- │ ├── checkpoint.json # Run metadata
115
- │ └── run_metadata.json # Run metadata
 
 
 
 
 
116
  ```
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  ## License
119
 
120
- MIT
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: MMB Counterfactual Image Tool
3
+ colorFrom: blue
4
+ colorTo: indigo
5
+ sdk: docker
6
+ pinned: false
7
  license: mit
8
+ arxiv: 2401.xxxxx
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  ---
10
 
11
+ A Python-based pipeline for CLEVR-style scenes with counterfactual variants and Blender rendering. Configurable object counts, counterfactual types, and automated questions and answers.
12
 
13
+ **Key Features:**
14
+ - 17 different counterfactual types (9 image CFs + 8 negative CFs)
15
+ - Automated Blender rendering with GPU support
16
+ - Question-answer datasets
17
+ - Resume support for interrupted jobs
18
+ - Streamlit web interface
19
+ - Examples for all counterfactual types
20
 
21
+ ## Hugging Face Spaces Deployment
22
 
23
+ This app is configured to run on Hugging Face Spaces using Docker. The Dockerfile includes Blender installation and all necessary dependencies for scenes and rendering.
 
 
24
 
25
+ ## Features
26
 
27
+ - **Scenes**: Multiple scene sets with configurable object counts and properties
28
+ - **Counterfactual Variants**: Create multiple counterfactual variations per scene (color, shape, material, size changes)
29
+ - **Blender Rendering**: Automated rendering of scenes to PNG images using Blender's Cycles engine
30
+ - **Questions**: Counterfactual questions and answers for each scene set
31
+ - **Resume Support**: Resume interrupted rendering jobs
32
 
33
+ ## Requirements
34
 
35
+ ### Python Dependencies
 
36
 
37
+ Install Python dependencies using:
38
+
39
+ ```bash
40
+ pip install -r requirements.txt
41
+ ```
42
+
43
+ ### Blender
44
+
45
+ Blender must be installed separately as it's not available via pip. The scripts are designed to run inside Blender's Python environment using:
46
+
47
+ ```bash
48
+ blender --background --python <script.py> -- [arguments]
49
+ ```
50
+
51
+ The pipeline will attempt to auto-detect Blender on your system, or you can specify the path manually.
52
+
53
+ ## Installation
54
+
55
+ 1. Clone this repository:
56
+ ```bash
57
+ git clone <repository-url>
58
+ cd code
59
+ ```
60
+
61
+ 2. Install Python dependencies:
62
+ ```bash
63
+ pip install -r requirements.txt
64
+ ```
65
+
66
+ 3. Ensure Blender is installed and accessible in your PATH, or note the path for manual specification.
67
+
68
+ ## Usage
69
+
70
+ ### Quick Start
71
+
72
+ ```bash
73
+ # Install dependencies
74
+ pip install -r requirements.txt
75
+
76
+ # Generate 5 scene sets with 5 objects each
77
+ python pipeline.py --num_scenes 5 --num_objects 5 --run_name my_first_run
78
+
79
+ # Generate examples of all counterfactual types
80
+ python scripts/generate_examples.py --render
81
+ ```
82
+
83
+ ### Web Interface (Streamlit)
84
+
85
+ Run the Streamlit web interface for an interactive experience:
86
+
87
+ ```bash
88
+ streamlit run app.py
89
+ ```
90
+
91
+ The web interface provides:
92
+ - Interactive parameter configuration
93
+ - Real-time progress
94
+ - Visual output preview
95
+ - Downloadable results as ZIP files
96
+
97
+ ### 1. Generate and Render (Combined)
98
+
99
+ Use `python pipeline.py` to generate scene JSON files and render PNG images in one step:
100
+
101
+ ```bash
102
+ python pipeline.py --num_scenes 10 --num_objects 5 --run_name experiment1
103
+ ```
104
+
105
+ ### 2. Generate Only (Skip Rendering)
106
+
107
+ Generate scenes without rendering:
108
+
109
+ ```bash
110
+ python pipeline.py --num_scenes 10 --num_objects 5 --run_name experiment1 --skip_render
111
+ ```
112
+
113
+ ### 4. Render Existing Scenes Only
114
+
115
+ Render previously generated scene JSON files:
116
+
117
+ ```bash
118
+ # Render scenes from a specific run
119
+ python pipeline.py --render_only --run_name experiment1
120
+
121
+ # Auto-detect latest run
122
+ python pipeline.py --render_only --auto_latest
123
+
124
+ # Use GPU rendering
125
+ python pipeline.py --render_only --run_name experiment1 --use_gpu 1
126
+ ```
127
+
128
+ This allows you to:
129
+ - Generate scenes on one machine, render on another
130
+ - Generate many scenes, then render them in batches
131
+ - Re-render scenes with different settings (GPU/CPU, samples, resolution) without regenerating
132
+
133
+ ### 5. Generating Scenes and Images (Full Options)
134
+
135
+ #### Arguments
136
+
137
+ | Argument | Default | Description |
138
+ | ------------------------- | ------------- | ---------------------------------------------------------------------------- |
139
+ | `--num_scenes` | 5 | Number of scene sets to generate |
140
+ | `--num_objects` | None | Fixed number of objects per scene (overrides min/max) |
141
+ | `--min_objects` | 3 | Minimum object count (if `num_objects` not given) |
142
+ | `--max_objects` | 7 | Maximum object count (if `num_objects` not given) |
143
+ | `--num_counterfactuals` | 2 | Number of counterfactual variants per scene |
144
+ | `--blender_path` | auto-detected | Path to Blender executable |
145
+ | `--output_dir` | `output` | Base directory for all runs (each run gets a timestamped/named subfolder) |
146
+ | `--run_name` | None | Optional custom name for this run (creates `output/run_name/`) |
147
+ | `--use_gpu` | 0 | 1 = enable GPU rendering, 0 = CPU rendering |
148
+ | `--samples` | 512 | Cycles sampling rate (higher = better quality, slower) |
149
+ | `--width` | 320 | Image width in pixels |
150
+ | `--height` | 240 | Image height in pixels |
151
+ | `--skip_render` | False | Generate scenes only (JSON only, no PNG rendering) |
152
+ | `--render_only` | False | Only render existing scene JSON files. Requires --run_dir, --run_name, or --auto_latest |
153
+ | `--run_dir` | None | Run directory containing scenes/ folder (for --render_only mode) |
154
+ | `--auto_latest` | False | Automatically use the latest run in output_dir (for --render_only mode) |
155
+ | `--resume` | False | Resume from where it stopped in an existing run |
156
+ | `--cf_types` | None | Explicitly choose which counterfactual types are used (order is respected; cycles if needed) |
157
+ | `--same_cf_type` | False | Use the same counterfactual type for all variants (first in `--cf_types`, or one random if unset) |
158
+ | `--list_cf_types` | False | Print available counterfactual types and exit |
159
+ | `--min_cf_change_score` | 1.0 | Minimum heuristic change score (retries CF until it’s “noticeable” enough) |
160
+ | `--max_cf_attempts` | 10 | Max retries per counterfactual to reach `--min_cf_change_score` |
161
+
162
+ #### Examples
163
+
164
+ ```bash
165
+ # Generate 10 scene sets with 5 objects each
166
+ python3 pipeline.py --num_scenes 10 --num_objects 5 --run_name experiment1
167
+
168
+ # Generate 10 scene sets with 3-7 objects, using GPU
169
+ python3 pipeline.py --num_scenes 10 --min_objects 3 --max_objects 7 --use_gpu 1
170
+
171
+ # Resume from where it stopped
172
+ python3 pipeline.py --num_scenes 100 --run_name experiment1 --resume
173
+
174
+ # Generate scenes only (no rendering)
175
+ python3 pipeline.py --num_scenes 10 --skip_render
176
+
177
+ # List available counterfactual types
178
+ python3 pipeline.py --list_cf_types
179
+
180
+ # Force specific counterfactual types in order (CF1 then CF2)
181
+ python3 pipeline.py --num_scenes 10 --num_counterfactuals 2 --cf_types change_color add_noise
182
+ # All counterfactuals same type (e.g. both change_color):
183
+ python3 pipeline.py --num_scenes 10 --num_counterfactuals 2 --cf_types change_color --same_cf_type
184
+
185
+ # Make counterfactuals more noticeable (stricter threshold + more retries)
186
+ python3 pipeline.py --num_scenes 10 --min_cf_change_score 1.5 --max_cf_attempts 25
187
+ ```
188
+
189
+ #### Counterfactual Types
190
+
191
+ The pipeline supports 17 different counterfactual types, divided into two categories:
192
+
193
+ **Image Counterfactuals** (Should change VQA answers - 10 types):
194
+ - `change_color` - Change the color of a random object (e.g., red → blue)
195
+ - `change_shape` - Change the shape of a random object (cube/sphere/cylinder)
196
+ - `change_size` - Change the size of a random object (small ↔ large)
197
+ - `change_material` - Change the material of a random object (metal ↔ rubber)
198
+ - `change_position` - Move a random object to a different location (with collision detection)
199
+ - `add_object` - Add a new random object to the scene
200
+ - `remove_object` - Remove a random object from the scene
201
+ - `replace_object` - Replace an object with a different one (keeping position)
202
+ - `swap_attribute` - Swap an attribute (e.g. color) between two objects
203
+ - `relational_flip` - Move object from left of X to right of X
204
+
205
+ **Negative Counterfactuals** (Should NOT change VQA answers - 8 types):
206
+ - `change_background` - Change the background/ground color
207
+ - `change_lighting` - Change lighting conditions (bright/dim/warm/cool/dramatic)
208
+ - `add_noise` - Add image noise/grain (light/medium/heavy levels)
209
+ - `occlusion_change` - Move object to partially hide another (visual only; answers unchanged)
210
+ - `apply_fisheye` - Apply fisheye lens distortion effect
211
+ - `apply_blur` - Apply Gaussian blur filter
212
+ - `apply_vignette` - Apply vignette effect (edge darkening)
213
+ - `apply_chromatic_aberration` - Apply chromatic aberration (color fringing)
214
+
215
+ **Default Behavior**: If `--cf_types` is not specified, the pipeline uses a default mix of 1 image counterfactual + 1 negative counterfactual per scene.
216
+
217
+ **Usage Examples**:
218
+ ```bash
219
+ # List all available counterfactual types
220
+ python3 pipeline.py --list_cf_types
221
+
222
+ # Use specific counterfactual types (order is respected; cycles if needed)
223
+ python3 pipeline.py --num_scenes 10 --num_counterfactuals 2 --cf_types change_color change_position
224
+
225
+ # Mix image and negative counterfactuals
226
+ python3 pipeline.py --num_scenes 10 --cf_types change_shape change_lighting add_noise
227
+
228
+ # Use only negative counterfactuals
229
+ python3 pipeline.py --num_scenes 10 --cf_types change_background add_noise apply_blur
230
+
231
+ # Use only image counterfactuals
232
+ python3 pipeline.py --num_scenes 10 --cf_types change_color change_shape change_position
233
+ ```
234
+
235
+ ### 2. Generating Example Counterfactuals
236
+
237
+ Generate examples of all counterfactual types applied to a base scene:
238
+
239
+ ```bash
240
+ # Generate scene JSON files only
241
+ python scripts/generate_examples.py
242
+
243
+ # Generate and render to images
244
+ python scripts/generate_examples.py --render
245
+
246
+ # Customize output directory and number of objects
247
+ python scripts/generate_examples.py --render --output_dir output/my_examples --num_objects 7
248
+
249
+ # Use GPU rendering
250
+ python scripts/generate_examples.py --render --use_gpu 1
251
+ ```
252
+
253
+ This creates one example of each counterfactual type in `output/counterfactual_examples/`:
254
+ - Original scene
255
+ - 9 image counterfactual examples
256
+ - 8 negative counterfactual examples
257
+
258
+ ### 3. Generating Question Mappings
259
+
260
+ Use `scripts/generate_questions_mapping.py` to create a CSV with counterfactual questions and answers.
261
+
262
+ #### Arguments
263
+
264
+ | Argument | Default | Description |
265
+ | ---------------------- | ---------------------------------- | -------------------------------------------------------------------------------- |
266
+ | `--output_dir` | `output` | Run directory or base output directory |
267
+ | `--auto_latest` | False | Automatically find and use the latest run in `output_dir` |
268
+ | `--csv_name` | `image_mapping_with_questions.csv` | Name of the generated CSV file |
269
+ | `--generate_questions` | False | Generate questions and answers (without this flag, only outputs image filenames) |
270
+ | `--long_format` | False | Also output a long-format QA dataset CSV (one row per image-question pair) |
271
+ | `--long_csv_name` | `qa_dataset.csv` | Filename for the long-format QA dataset CSV |
272
+
273
+ #### Examples
274
+
275
+ ```bash
276
+ # Generate questions for a specific run
277
+ python scripts/generate_questions_mapping.py --output_dir output/experiment1 --generate_questions
278
+
279
+ # Auto-detect latest run and generate questions
280
+ python scripts/generate_questions_mapping.py --output_dir output --auto_latest --generate_questions
281
+
282
+ # Also generate a long-format QA dataset (includes correct answer labels/ids)
283
+ python scripts/generate_questions_mapping.py --output_dir output --auto_latest --generate_questions --long_format --long_csv_name qa_dataset.csv
284
+ ```
285
+
286
+ #### Ensuring counterfactual answers differ
287
+
288
+ For evaluation and datasets, the **counterfactual image’s answer to its counterfactual question** should differ from the **original image’s answer to the original question**. The pipeline does this in two ways:
289
+
290
+ 1. **Automatic retries**
291
+ When generating questions (with `--generate_questions`), the script retries up to **`MAX_CF_ANSWER_RETRIES`** (default 50) per scene. For each attempt it picks new counterfactual questions (with different randomness). It keeps a pair only when both CF1 and CF2 answers differ from the original answer (after normalizing, e.g. case and whitespace). If after all retries they still match, the scene is still included and a warning is printed.
292
+
293
+ 2. **CF-specific question templates**
294
+ Counterfactual questions are chosen from templates that target the **changed** attribute or count, so the answer on the counterfactual image is different by design:
295
+ - **Count-changing CFs** (e.g. `add_object`, `remove_object`): questions like “How many objects are in the scene?” or “Are there more than N objects?” so the count/yes-no differs.
296
+ - **Attribute-changing CFs** (e.g. `change_color`, `change_shape`): questions about the **new** value (e.g. “How many red objects?” when an object was changed to red), so the count on the CF image differs from the original.
297
+
298
+ **What you need to do:**
299
+
300
+ - Run question generation **after** scenes and images exist (either as part of the pipeline with `--generate_questions`, or later on a run directory):
301
+
302
+ ```bash
303
+ # As part of a full run (ensures answers differ for that run’s scenes)
304
+ python pipeline.py --num_scenes 10 --num_objects 5 --run_name my_run --generate_questions
305
+
306
+ # Or later, on an existing run
307
+ python scripts/generate_questions_mapping.py --output_dir output/my_run --generate_questions
308
+ ```
309
+
310
+ - **Optional:** To allow more attempts per scene, edit `scripts/generate_questions_mapping.py` and increase **`MAX_CF_ANSWER_RETRIES`** (e.g. from 50 to 100). No CLI flag is exposed for this.
311
+
312
+ **720p dataset with different answers (distinct CF types per scene):**
313
+
314
+ - Scenes use **two distinct counterfactual types** per scene (no duplicate CF type for CF1 and CF2). To generate a 720p (1280×720) set with question/answer validation and optional removal of scenes where the CF answer matches the original:
315
+
316
+ ```bash
317
+ python pipeline.py --num_scenes 1000 --output_dir output --run_name dataset_720p_diff --width 1280 --height 720 --semantic_only --num_counterfactuals 2 --generate_questions --filter_same_answer
318
+ ```
319
+
320
+ - This produces `output/dataset_720p_diff/` with scene sets where CF1 and CF2 use different types, questions are validated (original + CFs), and rows where the CF image’s answer to the CF question matches the original are removed. Increase `MAX_CF_ANSWER_RETRIES` in `scripts/generate_questions_mapping.py` if you want fewer “could not find valid questions” warnings.
321
+
322
+
323
+ ## Project Structure
324
+
325
+ ```
326
+ .
327
+ ├── pipeline.py # Main pipeline and rendering (supports --render_only)
328
+ ├── app.py # Streamlit web interface
329
+ ├── requirements.txt # Python dependencies
330
+ ├── data/ # Scene assets
331
+ │ ├── base_scene.blend # Base Blender scene
332
+ │ ├── CoGenT_A.json # Scene configuration A
333
+ │ ├── CoGenT_B.json # Scene configuration B
334
+ │ ├── properties.json # Object properties configuration
335
+ │ ├── materials/ # Material definitions
336
+ │ └── shapes/ # 3D shape definitions
337
+ ├── scripts/ # Scripts directory
338
+ │ ├── render.py # Blender rendering script (run by pipeline)
339
+ │ ├── generate_scenes.py # Generate scene JSON files only (alternative to --skip_render)
340
+ │ ├── generate_examples.py # Generate example counterfactuals
341
+ │ └── generate_questions_mapping.py # Generate question-answer datasets
342
+ ├── output/ # Output directory (generated)
343
+ │ └── counterfactual_examples/ # Example counterfactuals (from generate_examples.py)
344
+ ├── .gitignore # Git ignore rules
345
+ └── README.md # This file
346
+
347
+ **Note**: The pipeline dynamically generates temporary files during execution:
348
+ - `render_images_patched.py` - Patched rendering script
349
+ - `temp_output/<run_id>/` - Temporary output per run (e.g. `temp_output/2025-01-29_12-30-45/images` and `.../scenes`), so different runs use separate directories and do not overwrite each other.
350
+
351
+ These files are automatically created when needed, cleaned up after use, and are ignored by git.
352
  ```
353
 
354
+ ## Output Structure
355
 
356
+ Each run creates a directory structure like:
357
 
358
  ```
359
+ output/
360
+ └── <run_name_or_timestamp>/
361
+ ├── checkpoint.json
362
+ ├── run_metadata.json
363
+ ├── scenes/
364
+ │ ├── scene_0000_original.json
365
+ │ ├── scene_0000_cf1.json
366
+ │ ├── scene_0000_cf2.json
367
+ │ └── ...
368
+ ├── images/
369
+ │ ├── scene_0000_original.png
370
+ │ ├── scene_0000_cf1.png
371
+ │ ├── scene_0000_cf2.png
372
+ │ └── ...
373
+ ├── image_mapping_with_questions*.csv
374
+ └── qa_dataset*.csv (if generated with --long_format)
375
  ```
376
 
377
+ ### Dataset columns (high level)
378
+
379
+ **Wide Format CSV** (default with `--generate_questions`):
380
+ - **Image columns**: `original_image`, `semantic_counterfactual_image`, `negative_counterfactual_image`
381
+ - **Question columns**: `original_question`, `semantic_counterfactual_question_1`, `negative_counterfactual_question_1`
382
+ - **Answer matrix columns** (9 total, showing each image's answer to each question):
383
+ - `original_image_answer_to_original_question`
384
+ - `original_image_answer_to_semantic_counterfactual_question_1`
385
+ - `original_image_answer_to_negative_counterfactual_question_1`
386
+ - `semantic_counterfactual_image_answer_to_original_question`
387
+ - `semantic_counterfactual_image_answer_to_semantic_counterfactual_question_1`
388
+ - `semantic_counterfactual_image_answer_to_negative_counterfactual_question_1`
389
+ - `negative_counterfactual_image_answer_to_original_question`
390
+ - `negative_counterfactual_image_answer_to_semantic_counterfactual_question_1`
391
+ - `negative_counterfactual_image_answer_to_negative_counterfactual_question_1`
392
+
393
+ **Basic Format CSV** (without `--generate_questions`):
394
+ - Only image columns: `original_image`, `semantic_counterfactual_image`, `negative_counterfactual_image`
395
+
396
+ ## Data Curation Note
397
+
398
+ For reporting-ready experiments, use the curated subset:
399
+
400
+ - `output/dataset_720p_v2_clean800`
401
+ - `800` scene triplets (`original`, `cf1`, `cf2`) with matching `images/`, `scenes/`, and `image_mapping_with_questions.csv`
402
+ - Deterministic selection rule: keep valid, non-backfilled scene IDs in ascending order until 800 are collected
403
+
404
+ The subset excludes IDs that were previously backfilled during intermediate dataset assembly. Final experiments and metrics should be run on this curated subset for clean provenance and reproducibility.
405
+
406
+ ## Code Style
407
+
408
+ The codebase follows a clean, consistent style:
409
+ - No multiline docstrings (removed for brevity)
410
+ - Consistent spacing and formatting
411
+ - Single blank lines between functions
412
+ - Clear, concise function names
413
+
414
  ## License
415
 
416
+ MIT License
417
+
418
+ ## Contributing
419
+
420
+ Contributions are welcome! Please ensure:
421
+ - Code follows the existing style (no multiline docstrings, consistent spacing)
422
+ - All tests pass
423
+ - Documentation is updated as needed
424
+
425
+ ## Acknowledgments
426
+
427
+ This project is inspired by the CLEVR dataset and uses Blender for 3D scene rendering.
428
+