Datasets:
Update docs
Browse files- README.md +249 -22
- assets/showcase/causal_fidelity.png +3 -0
- assets/showcase/counterfactual_response.png +3 -0
- assets/showcase/delete_pair.gif +3 -0
- assets/showcase/mass_pair.gif +3 -0
- assets/showcase/move_pair.gif +3 -0
- assets/showcase/reference_cascade.gif +3 -0
- assets/showcase/scale_pair.gif +3 -0
- assets/showcase/scene_overview.png +3 -0
- docs/EVALUATION.md +2 -0
- docs/LOADING.md +140 -39
- docs/SCHEMA.md +15 -0
README.md
CHANGED
|
@@ -41,48 +41,275 @@ configs:
|
|
| 41 |
|
| 42 |
The release contains **50 event-rich Blender scenes**, structured causal event graphs, **872 graph-grounded diagnostic questions**, three levels of future-event specification, and **2,832 controlled counterfactual variants**. A subset of **225 matched factual-counterfactual pairs** supports evaluation of selective responsiveness to physical interventions.
|
| 43 |
|
| 44 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
|
| 47 |
|
| 48 |
-
|
| 49 |
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
```python
|
| 53 |
from datasets import load_dataset
|
| 54 |
|
| 55 |
repo = "deepdeltalab/CausalCascade"
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
```
|
| 61 |
|
| 62 |
-
The
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
wrapper to resolve and decode media lazily:
|
| 66 |
|
| 67 |
```python
|
| 68 |
-
from
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
-
|
| 72 |
-
repo_id=
|
| 73 |
subset="rq2_pairs",
|
| 74 |
-
decode_images=True,
|
| 75 |
decode_video=True,
|
| 76 |
-
video_size=(
|
| 77 |
-
video_frame_stride=
|
|
|
|
| 78 |
)
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
batch = next(iter(loader))
|
|
|
|
|
|
|
| 81 |
```
|
| 82 |
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
-
|
| 86 |
|
| 87 |
## License
|
| 88 |
|
|
|
|
| 41 |
|
| 42 |
The release contains **50 event-rich Blender scenes**, structured causal event graphs, **872 graph-grounded diagnostic questions**, three levels of future-event specification, and **2,832 controlled counterfactual variants**. A subset of **225 matched factual-counterfactual pairs** supports evaluation of selective responsiveness to physical interventions.
|
| 43 |
|
| 44 |
+
## Dataset Overview
|
| 45 |
+
|
| 46 |
+
### Scene Diversity
|
| 47 |
+
|
| 48 |
+

|
| 49 |
+
|
| 50 |
+
### Three Levels of Future-Event Specification
|
| 51 |
+
|
| 52 |
+
The same initial frame and reference rollout are paired with three textual conditions: **state-only** (describes the current scene state and relevant physical conditions), **trigger-aware** (additionally specifies the initiating event), and **full event-chain** (verbalizes the major event chain).
|
| 53 |
+
|
| 54 |
+
<details>
|
| 55 |
+
<summary>View example: Y-shaped domino cascade</summary>
|
| 56 |
+
|
| 57 |
+

|
| 58 |
+
|
| 59 |
+
<details>
|
| 60 |
+
<summary>Show the three prompt levels</summary>
|
| 61 |
+
|
| 62 |
+
**Level 1: State-only**
|
| 63 |
+
|
| 64 |
+
```text
|
| 65 |
+
Generate a physically realistic continuation video by predicting the subsequent physical evolution from the given fixed-camera first frame.
|
| 66 |
+
|
| 67 |
+
Important instructions:
|
| 68 |
+
- Preserve the fixed camera view.
|
| 69 |
+
- The first frame is authoritative for all visible geometry, object sizes, initial poses, contact relations, spatial layout, and camera view.
|
| 70 |
+
- Treat only the listed dynamic active objects and dynamic active object groups as freely moving rigid bodies.
|
| 71 |
+
- Treat anchored static colliders as fixed to the world.
|
| 72 |
+
|
| 73 |
+
Global rigid-body convention:
|
| 74 |
+
- All rigid bodies use friction = 0.50, restitution = 0.10, linear damping = 0.04, angular damping = 0.10.
|
| 75 |
+
- For every rigid body, the geometric center is also its center of mass.
|
| 76 |
+
|
| 77 |
+
Dynamic active objects:
|
| 78 |
+
- upper branch target sphere: the large target sphere at the upper/right end of the fork. Mass = 1.0 kg.
|
| 79 |
+
- lower branch target sphere: the large target sphere at the lower/right end of the fork. Mass = 1.0 kg.
|
| 80 |
+
|
| 81 |
+
Dynamic active object groups:
|
| 82 |
+
- central stem domino row: the five upright dominoes forming the straight stem before the fork splits. This group contains 5 dominoes. Each object has mass = 1.0 kg.
|
| 83 |
+
- upper fork domino branch: the upper row of upright dominoes after the split. This group contains 9 dominoes. Each object has mass = 1.0 kg.
|
| 84 |
+
- lower fork domino branch: the lower row of upright dominoes after the split. This group contains 9 dominoes. Each object has mass = 1.0 kg.
|
| 85 |
+
|
| 86 |
+
Anchored static objects:
|
| 87 |
+
- wooden tabletop surface: the broad surface beneath the forked domino structure.
|
| 88 |
+
|
| 89 |
+
Decorative context:
|
| 90 |
+
- The remaining objects are anchored static decorators and should remain visually unchanged.
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
**Level 2: Trigger-aware**
|
| 94 |
+
|
| 95 |
+
```text
|
| 96 |
+
Generate a physically realistic continuation video by predicting the subsequent physical evolution from the given fixed-camera first frame.
|
| 97 |
+
|
| 98 |
+
Trigger event: The first tilted blue domino at the left start of the fork falls into the next domino.
|
| 99 |
+
|
| 100 |
+
Important instructions:
|
| 101 |
+
- Preserve the fixed camera view.
|
| 102 |
+
- The first frame is authoritative for all visible geometry, object sizes, initial poses, contact relations, spatial layout, and camera view.
|
| 103 |
+
- Treat only the listed dynamic active objects and dynamic active object groups as freely moving rigid bodies.
|
| 104 |
+
- Treat anchored static colliders as fixed to the world.
|
| 105 |
+
|
| 106 |
+
Global rigid-body convention:
|
| 107 |
+
- All rigid bodies use friction = 0.50, restitution = 0.10, linear damping = 0.04, angular damping = 0.10.
|
| 108 |
+
- For every rigid body, the geometric center is also its center of mass.
|
| 109 |
+
|
| 110 |
+
Dynamic active objects:
|
| 111 |
+
- upper branch target sphere: the large target sphere at the upper/right end of the fork. Mass = 1.0 kg.
|
| 112 |
+
- lower branch target sphere: the large target sphere at the lower/right end of the fork. Mass = 1.0 kg.
|
| 113 |
+
|
| 114 |
+
Dynamic active object groups:
|
| 115 |
+
- central stem domino row: the five upright dominoes forming the straight stem before the fork splits. This group contains 5 dominoes. Each object has mass = 1.0 kg.
|
| 116 |
+
- upper fork domino branch: the upper row of upright dominoes after the split. This group contains 9 dominoes. Each object has mass = 1.0 kg.
|
| 117 |
+
- lower fork domino branch: the lower row of upright dominoes after the split. This group contains 9 dominoes. Each object has mass = 1.0 kg.
|
| 118 |
+
|
| 119 |
+
Anchored static objects:
|
| 120 |
+
- wooden tabletop surface: the broad surface beneath the forked domino structure.
|
| 121 |
+
|
| 122 |
+
Decorative context:
|
| 123 |
+
- The remaining objects are anchored static decorators and should remain visually unchanged.
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
**Level 3: Full event-chain**
|
| 127 |
+
|
| 128 |
+
```text
|
| 129 |
+
A curved, slightly branching line of brightly colored domino blocks stands upright across the middle of a wooden tabletop, with a small purple cone at the far left, a small red-and-teal rounded piece behind the dominoes, several little green and brown peg-like toys in front, a large pink ball near the back-right end, and a large light-blue ball near the front-right end. The motion starts at the left end when the first domino tips and hits the next, launching a chain reaction that travels steadily from left to right through the whole arrangement. Each block knocks its neighbor over, and the collapse passes through the center and then fans through the angled right-side branches, so the dominoes slap down in sequence and spread into overlapping lines on the table. As the final rightmost blocks fall, they nudge the two large balls, making the pink ball roll slightly farther back and right and the blue ball roll rightward away from the domino pile. By the end, all of the dominoes lie flat in a scattered fan-shaped heap across the center, the two balls have shifted to the right, and the smaller cone and peg-like pieces remain standing around the wreckage. Keep the camera fixed.
|
| 130 |
+
```
|
| 131 |
+
|
| 132 |
+
</details>
|
| 133 |
+
|
| 134 |
+
</details>
|
| 135 |
+
|
| 136 |
+
### Factual–Counterfactual Pairs
|
| 137 |
+
|
| 138 |
+
Each edit applies a single-object **delete**, **move**, **scale**, or **mass** intervention and provides separately simulated factual and counterfactual references with matched Level 1 prompts.
|
| 139 |
+
|
| 140 |
+
<details>
|
| 141 |
+
<summary>View delete intervention case</summary>
|
| 142 |
+
|
| 143 |
+

|
| 144 |
+
|
| 145 |
+
**Description:** Remove the third peg from the left in the top row of the Galton board.
|
| 146 |
+
|
| 147 |
+
</details>
|
| 148 |
+
|
| 149 |
+
<details>
|
| 150 |
+
<summary>View move intervention case</summary>
|
| 151 |
+
|
| 152 |
+

|
| 153 |
+
|
| 154 |
+
**Description:** Move the first pink domino on the upper branch of the Y-shaped chain toward the upper left.
|
| 155 |
+
|
| 156 |
+
</details>
|
| 157 |
+
|
| 158 |
+
<details>
|
| 159 |
+
<summary>View scale intervention case</summary>
|
| 160 |
+
|
| 161 |
+

|
| 162 |
|
| 163 |
+
**Description:** Reduce the height of the rightmost yellow domino on the middle step.
|
| 164 |
|
| 165 |
+
</details>
|
| 166 |
|
| 167 |
+
<details>
|
| 168 |
+
<summary>View mass intervention case</summary>
|
| 169 |
+
|
| 170 |
+

|
| 171 |
+
|
| 172 |
+
**Description:** Increase the mass of the barrel.
|
| 173 |
+
|
| 174 |
+
</details>
|
| 175 |
+
|
| 176 |
+
## Results
|
| 177 |
+
|
| 178 |
+
### Causal Cascade Fidelity
|
| 179 |
+
|
| 180 |
+

|
| 181 |
+
|
| 182 |
+
**Left**: Performance of current I2V models under the Level 1 prompt.
|
| 183 |
+
**Right**: Model-average performance as future-event specification becomes more explicit.
|
| 184 |
+
|
| 185 |
+
### Selective Causal Responsiveness
|
| 186 |
+
|
| 187 |
+

|
| 188 |
+
|
| 189 |
+
**Counterfactual motion response across intervention types. Each marker denotes one I2V model.** Higher values on both axes indicate stronger selective causal responsiveness.
|
| 190 |
+
|
| 191 |
+
For evaluation code and further usage, see the [GitHub repository](https://github.com/SJTU-DeepDeltaLab/CausalCascade).
|
| 192 |
+
|
| 193 |
+
## Choose a Configuration
|
| 194 |
+
|
| 195 |
+
| Configuration | Rows | Use it to access |
|
| 196 |
+
|---|---:|---|
|
| 197 |
+
| `base_scenes` | 50 | Initial frames, reference videos, three prompt levels, event graphs, QA, and scene metadata. |
|
| 198 |
+
| `counterfactuals` | 2,832 | All retained single-object edits, targets, instructions, and JSON deltas. Media paths are populated only for the 225 RQ2 variants. |
|
| 199 |
+
| `rq2_pairs` | 225 | Ready-matched factual/counterfactual frames, videos, Level 1 prompts, and edit deltas: 50 delete, 50 move, 50 scale, 75 mass. |
|
| 200 |
+
| `diagnostic_qa` | 872 | Individual questions, answer options, reference answers, and graph references across five diagnostic dimensions. |
|
| 201 |
+
|
| 202 |
+
All configurations use one public benchmark split, `test`. Notice that only the 225 RQ2 variants have edited initial frames and reference videos in this release. Other variants provide edit metadata, which can be used to produce counterfactual media.
|
| 203 |
+
|
| 204 |
+
### Read Metadata
|
| 205 |
+
|
| 206 |
+
```bash
|
| 207 |
+
pip install "datasets>=4,<5"
|
| 208 |
+
```
|
| 209 |
|
| 210 |
```python
|
| 211 |
from datasets import load_dataset
|
| 212 |
|
| 213 |
repo = "deepdeltalab/CausalCascade"
|
| 214 |
+
base_table = load_dataset(repo, "base_scenes", split="test")
|
| 215 |
+
pairs_table = load_dataset(repo, "rq2_pairs", split="test")
|
| 216 |
+
edits_table = load_dataset(repo, "counterfactuals", split="test")
|
| 217 |
+
qa_table = load_dataset(repo, "diagnostic_qa", split="test")
|
| 218 |
+
print(len(base_table), len(pairs_table), len(edits_table), len(qa_table))
|
| 219 |
+
# 50 225 2832 872
|
| 220 |
+
|
| 221 |
+
# Select metadata columns before accessing rows to avoid native video decoding.
|
| 222 |
+
row = base_table.select_columns(["scene_id", "reference_video_path"])[0]
|
| 223 |
+
print(row)
|
| 224 |
+
```
|
| 225 |
+
|
| 226 |
+
The Hub viewer displays images/videos for `base_scenes` and `rq2_pairs`. The separate `*_path` fields are repository-relative strings. Use the loader below to fetch and decode the assets without manually matching files.
|
| 227 |
+
|
| 228 |
+
## Load Media and Annotations
|
| 229 |
+
|
| 230 |
+
Use Python 3.10+. Download just the loader files, then install locally; this does not download the dataset's videos or Blender files:
|
| 231 |
+
|
| 232 |
+
```bash
|
| 233 |
+
pip install -U huggingface_hub
|
| 234 |
+
hf download deepdeltalab/CausalCascade --repo-type=dataset --include="causalcascade/*.py" --include="pyproject.toml" --local-dir=CausalCascade-loader
|
| 235 |
+
pip install -e "./CausalCascade-loader[video]"
|
| 236 |
```
|
| 237 |
|
| 238 |
+
The bundled loader resolves assets on access and caches Hub downloads. It uses OpenCV for videos; native `datasets.Video` decoding and TorchCodec are not required for this route.
|
| 239 |
+
|
| 240 |
+
### One Base Scene
|
|
|
|
| 241 |
|
| 242 |
```python
|
| 243 |
+
from causalcascade import CausalCascadeDataset
|
| 244 |
+
|
| 245 |
+
base = CausalCascadeDataset(
|
| 246 |
+
repo_id="deepdeltalab/CausalCascade",
|
| 247 |
+
subset="base_scenes",
|
| 248 |
+
decode_video=False,
|
| 249 |
+
)
|
| 250 |
+
sample = base[0]
|
| 251 |
+
print(sample["scene_id"])
|
| 252 |
+
print(sample["initial_frame"].shape) # RGB uint8: (3, H, W)
|
| 253 |
+
print(sample["prompt_level1"]) # State-only
|
| 254 |
+
# prompt_level2: trigger-aware; prompt_level3: full event-chain
|
| 255 |
+
print(len(sample["event_graph"]["events"]))
|
| 256 |
+
print(len(sample["event_graph"]["causal_edges"]))
|
| 257 |
+
|
| 258 |
+
question = sample["diagnostic_qa"]["questions"][0]
|
| 259 |
+
print(question["question"])
|
| 260 |
+
print(question["answer_options"], question["ground_truth_answer"])
|
| 261 |
+
# sample["scene_metadata"] contains the Blender-derived metadata.
|
| 262 |
+
```
|
| 263 |
+
|
| 264 |
+
With `decode_video=False`, `reference_video_path` remains a relative string and no video is downloaded. Set `decode_video=True` to also obtain `sample["reference_video"]`.
|
| 265 |
+
|
| 266 |
+
### One Factual–Counterfactual Pair
|
| 267 |
+
|
| 268 |
+
```python
|
| 269 |
+
from causalcascade import CausalCascadeDataset
|
| 270 |
|
| 271 |
+
pairs = CausalCascadeDataset(
|
| 272 |
+
repo_id="deepdeltalab/CausalCascade",
|
| 273 |
subset="rq2_pairs",
|
|
|
|
| 274 |
decode_video=True,
|
| 275 |
+
video_size=(240, 426), # Preview size: (height, width)
|
| 276 |
+
video_frame_stride=4,
|
| 277 |
+
video_max_frames=16, # At most 16 sampled frames per video
|
| 278 |
)
|
| 279 |
+
pair = pairs[0]
|
| 280 |
+
print(pair["scene_id"], pair["variant_id"], pair["edit_type"])
|
| 281 |
+
print(pair["factual_initial_frame"].shape)
|
| 282 |
+
print(pair["counterfactual_initial_frame"].shape)
|
| 283 |
+
print(pair["factual_reference_video"].shape) # (T, 3, 240, 426)
|
| 284 |
+
print(pair["counterfactual_reference_video"].shape)
|
| 285 |
+
print(pair["factual_prompt_level1"])
|
| 286 |
+
print(pair["counterfactual_prompt_level1"])
|
| 287 |
+
print(pair["delta"]) # Parsed intervention JSON
|
| 288 |
+
```
|
| 289 |
+
|
| 290 |
+
Use the two supplied Level 1 prompts as generation condition.`rq2_pairs` provides matched media, prompts, and deltas; base graphs/QA are accessed through `base_scenes` using the same `scene_id`. Counterfactual graphs/QA are not part of these four tables.
|
| 291 |
+
|
| 292 |
+
### PyTorch DataLoader
|
| 293 |
+
|
| 294 |
+
Continuing with `pairs` above:
|
| 295 |
+
|
| 296 |
+
```python
|
| 297 |
+
from torch.utils.data import DataLoader
|
| 298 |
+
from causalcascade import collate_fn
|
| 299 |
+
|
| 300 |
+
loader = DataLoader(pairs, batch_size=1, num_workers=0, collate_fn=collate_fn)
|
| 301 |
batch = next(iter(loader))
|
| 302 |
+
print(batch["factual_reference_video"].shape) # (1, T, 3, H, W)
|
| 303 |
+
print(batch["scene_id"]) # List of scene IDs
|
| 304 |
```
|
| 305 |
|
| 306 |
+
Images/videos are RGB `uint8` tensors in `C x H x W` / `T x C x H x W` order, with values 0–255. Equal-shaped tensors are stacked; unequal shapes remain lists. Start with `num_workers=0`, especially in Windows/notebooks. See [the loading guide](docs/LOADING.md) for batching, local/offline use, raw file downloads, filtering edits, and joining annotations; see [the schema](docs/SCHEMA.md) for all fields.
|
| 307 |
+
|
| 308 |
+
## Evaluation
|
| 309 |
+
|
| 310 |
+
Generate factual rollouts under state-only (L1), trigger-aware (L2), or full event-chain (L3) future-event specification. For counterfactual evaluation, use both sides of the 225 official pairs with their matched Level 1 prompts. Event graphs describe observable events and direct causal dependencies; diagnostic questions assess five complementary dimensions.
|
| 311 |
|
| 312 |
+
See [the evaluation protocol](docs/EVALUATION.md) for metrics and aggregation, and the [GitHub usage guide](https://github.com/SJTU-DeepDeltaLab/CausalCascade/blob/main/USAGE.md) for runnable evaluation commands.
|
| 313 |
|
| 314 |
## License
|
| 315 |
|
assets/showcase/causal_fidelity.png
ADDED
|
Git LFS Details
|
assets/showcase/counterfactual_response.png
ADDED
|
Git LFS Details
|
assets/showcase/delete_pair.gif
ADDED
|
Git LFS Details
|
assets/showcase/mass_pair.gif
ADDED
|
Git LFS Details
|
assets/showcase/move_pair.gif
ADDED
|
Git LFS Details
|
assets/showcase/reference_cascade.gif
ADDED
|
Git LFS Details
|
assets/showcase/scale_pair.gif
ADDED
|
Git LFS Details
|
assets/showcase/scene_overview.png
ADDED
|
Git LFS Details
|
docs/EVALUATION.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
# Evaluation protocol
|
| 2 |
|
|
|
|
|
|
|
| 3 |
## RQ1: causal cascade fidelity
|
| 4 |
|
| 5 |
Use `base_scenes` for all 50 factual initial frames and reference rollouts. Generate the complete physical process from the initial frame and one textual condition; the target is a coherent causal cascade, not only an isolated event or final outcome.
|
|
|
|
| 1 |
# Evaluation protocol
|
| 2 |
|
| 3 |
+
For loading reference samples, see the [README](../README.md) and [loading guide](LOADING.md). This document defines the evaluation protocol; runnable generation and scoring commands are in the [GitHub usage guide](https://github.com/SJTU-DeepDeltaLab/CausalCascade/blob/main/USAGE.md).
|
| 4 |
+
|
| 5 |
## RQ1: causal cascade fidelity
|
| 6 |
|
| 7 |
Use `base_scenes` for all 50 factual initial frames and reference rollouts. Generate the complete physical process from the initial frame and one textual condition; the target is a coherent causal cascade, not only an isolated event or final outcome.
|
docs/LOADING.md
CHANGED
|
@@ -1,67 +1,168 @@
|
|
| 1 |
-
# Loading
|
| 2 |
|
| 3 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
```python
|
| 6 |
from datasets import load_dataset
|
| 7 |
|
| 8 |
repo = "deepdeltalab/CausalCascade"
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
```
|
| 12 |
|
| 13 |
-
|
| 14 |
-
columns. The `counterfactuals` viewer contains metadata and media paths.
|
| 15 |
-
Image bytes are
|
| 16 |
-
embedded in Parquet; video columns reference MP4 files in this repository
|
| 17 |
-
using `hf://datasets/deepdeltalab/CausalCascade@main/` URIs.
|
| 18 |
-
The separate `*_path` columns remain repository-relative strings.
|
| 19 |
|
| 20 |
-
|
| 21 |
|
| 22 |
```python
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
```
|
| 28 |
|
| 29 |
-
|
| 30 |
-
dependencies. The wrapper below uses OpenCV and removes the viewer columns
|
| 31 |
-
before reading rows, so it retains its existing lazy-loading behavior.
|
| 32 |
|
| 33 |
-
##
|
| 34 |
|
| 35 |
-
|
|
|
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
```
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
```python
|
| 42 |
from torch.utils.data import DataLoader
|
| 43 |
from causalcascade import CausalCascadeDataset, collate_fn
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
dataset = CausalCascadeDataset(
|
| 46 |
-
|
| 47 |
-
subset="rq2_pairs",
|
| 48 |
-
split="test",
|
| 49 |
-
decode_images=True,
|
| 50 |
-
decode_video=True,
|
| 51 |
-
video_size=(480, 854), # (height, width)
|
| 52 |
-
video_frame_stride=2,
|
| 53 |
-
load_annotations=True,
|
| 54 |
)
|
| 55 |
-
|
| 56 |
-
loader = DataLoader(dataset, batch_size=1, num_workers=4, collate_fn=collate_fn)
|
| 57 |
-
for batch in loader:
|
| 58 |
-
factual_video = batch["factual_reference_video"]
|
| 59 |
-
counterfactual_video = batch["counterfactual_reference_video"]
|
| 60 |
-
break
|
| 61 |
```
|
| 62 |
|
| 63 |
-
|
| 64 |
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
-
For
|
|
|
|
| 1 |
+
# Loading Guide
|
| 2 |
|
| 3 |
+
Start with the [README](../README.md#load-media-and-annotations) for loader installation and single-scene/pair examples. This guide covers metadata-only access, raw files, annotations, and batching. All examples use the public `test` split.
|
| 4 |
+
|
| 5 |
+
## What Gets Loaded
|
| 6 |
+
|
| 7 |
+
| Route | Behavior |
|
| 8 |
+
|---|---|
|
| 9 |
+
| `load_dataset()` | Loads the Parquet table. Native image/video columns may decode on row access; `*_path` strings are not automatically resolved. |
|
| 10 |
+
| `CausalCascadeDataset` | Loads the table, removes native viewer columns, then resolves requested files inside `__getitem__`. |
|
| 11 |
+
| `hf_hub_download()` | Downloads one named repository file and returns its local cached filename. |
|
| 12 |
+
|
| 13 |
+
The wrapper fetches whole MP4 files before decoding; it does not stream video frames over HTTP. Files are cached, so repeated access normally reuses the local download. Images embedded in the Parquet viewer columns are still part of the initial table download.
|
| 14 |
+
|
| 15 |
+
With the wrapper, images decode by default, videos do not, and JSON annotations load by default. Set `decode_images=False`, `decode_video=False`, and `load_annotations=False` for metadata-only samples. Disabling video decoding leaves the relative `*_path` fields; it does not produce a new local video path.
|
| 16 |
+
|
| 17 |
+
## Filter and Join Metadata
|
| 18 |
+
|
| 19 |
+
### Select Edits
|
| 20 |
|
| 21 |
```python
|
| 22 |
from datasets import load_dataset
|
| 23 |
|
| 24 |
repo = "deepdeltalab/CausalCascade"
|
| 25 |
+
edits = load_dataset(repo, "counterfactuals", split="test")
|
| 26 |
+
move_edits = edits.filter(lambda row: row["edit_type"] == "move")
|
| 27 |
+
official = edits.filter(lambda row: row["in_rq2_subset"])
|
| 28 |
+
assert len(official) == 225
|
| 29 |
+
row = move_edits[0]
|
| 30 |
+
print(row["variant_id"], row["target_object_id"], row["edit_instruction"])
|
| 31 |
+
print(row["counterfactual_reference_video_path"]) # None outside RQ2
|
| 32 |
```
|
| 33 |
|
| 34 |
+
`counterfactuals` has no native media preview columns, so filtering its metadata does not invoke a video decoder. Filter on `edit_type` values `delete`, `move`, `scale`, or `mass`; variant IDs use directory prefixes such as `move_type/`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
+
### Get Questions for a Scene
|
| 37 |
|
| 38 |
```python
|
| 39 |
+
from datasets import load_dataset
|
| 40 |
+
|
| 41 |
+
repo = "deepdeltalab/CausalCascade"
|
| 42 |
+
scene_id = "Domino_Series/ball_trigger_step_domino_chain"
|
| 43 |
+
questions = load_dataset(repo, "diagnostic_qa", split="test")
|
| 44 |
+
scene_questions = questions.filter(lambda row: row["scene_id"] == scene_id)
|
| 45 |
+
q = scene_questions[0]
|
| 46 |
+
print((q["scene_id"], q["question_id"]))
|
| 47 |
+
print(q["dimension"], q["question"])
|
| 48 |
+
print(q["answer_options"], q["reference_answer"])
|
| 49 |
+
print(q["related_event_ids"], q["related_edge_ids"])
|
| 50 |
```
|
| 51 |
|
| 52 |
+
Use `(scene_id, question_id)` as the unique key; question IDs can repeat across scenes. These are reference-video answers, not predictions for model-generated videos. Raw QA JSON uses `ground_truth_answer` and `source_event_ids` / `source_edge_ids`; the flattened table uses `reference_answer` and `related_event_ids` / `related_edge_ids`.
|
|
|
|
|
|
|
| 53 |
|
| 54 |
+
### Attach Base Graph/QA to a Pair
|
| 55 |
|
| 56 |
+
```python
|
| 57 |
+
from causalcascade import CausalCascadeDataset
|
| 58 |
|
| 59 |
+
repo = "deepdeltalab/CausalCascade"
|
| 60 |
+
base = CausalCascadeDataset(
|
| 61 |
+
repo_id=repo, subset="base_scenes", decode_images=False, decode_video=False,
|
| 62 |
+
)
|
| 63 |
+
pairs = CausalCascadeDataset(
|
| 64 |
+
repo_id=repo, subset="rq2_pairs", decode_images=False, decode_video=False,
|
| 65 |
+
)
|
| 66 |
+
index = {scene: i for i, scene in enumerate(base.table["scene_id"])}
|
| 67 |
+
pair = pairs[0]
|
| 68 |
+
factual = base[index[pair["scene_id"]]]
|
| 69 |
+
graph = factual["event_graph"]
|
| 70 |
+
qa = factual["diagnostic_qa"]["questions"]
|
| 71 |
+
delta = pair["delta"]
|
| 72 |
+
print(pair["variant_id"], len(graph["events"]), len(qa))
|
| 73 |
```
|
| 74 |
|
| 75 |
+
Graphs describe observable events and direct causal dependencies, with temporal stages on nodes. The pair's `delta` describes the intervention. This join gives the **factual** graph and QA; it does not construct counterfactual graphs or answers.
|
| 76 |
+
|
| 77 |
+
## Download Raw Assets Without the Wrapper
|
| 78 |
+
|
| 79 |
+
To get an actual local filename, resolve a `*_path` with `hf_hub_download`. This works for PNG, MP4, JSON, prompt text, and Blender files:
|
| 80 |
+
|
| 81 |
+
```python
|
| 82 |
+
import json
|
| 83 |
+
from datasets import load_dataset
|
| 84 |
+
from huggingface_hub import hf_hub_download
|
| 85 |
+
|
| 86 |
+
repo = "deepdeltalab/CausalCascade"
|
| 87 |
+
base = load_dataset(repo, "base_scenes", split="test").select_columns([
|
| 88 |
+
"scene_id", "initial_frame_path", "reference_video_path", "event_graph_path",
|
| 89 |
+
])
|
| 90 |
+
row = base[0] # No native viewer columns remain, so no TorchCodec is needed.
|
| 91 |
+
|
| 92 |
+
def fetch(path):
|
| 93 |
+
return hf_hub_download(repo_id=repo, repo_type="dataset", filename=path)
|
| 94 |
+
|
| 95 |
+
image_path = fetch(row["initial_frame_path"])
|
| 96 |
+
video_path = fetch(row["reference_video_path"])
|
| 97 |
+
graph_path = fetch(row["event_graph_path"])
|
| 98 |
+
with open(graph_path, encoding="utf-8-sig") as stream:
|
| 99 |
+
graph = json.load(stream)
|
| 100 |
+
print(image_path, video_path, len(graph["events"]))
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
Native `datasets.Video` decoding needs compatible TorchCodec dependencies. For metadata, select columns before indexing/filtering rows. For decoded video tensors without TorchCodec, use the OpenCV wrapper.
|
| 104 |
+
|
| 105 |
+
## Tensor Format and Batching
|
| 106 |
+
|
| 107 |
+
The loader returns the original table fields plus requested decoded media/annotations:
|
| 108 |
+
|
| 109 |
+
| Output | Format |
|
| 110 |
+
|---|---|
|
| 111 |
+
| `initial_frame` or factual/counterfactual equivalents | RGB `torch.uint8`, `(3, H, W)`, values 0–255. |
|
| 112 |
+
| `reference_video` or factual/counterfactual equivalents | RGB `torch.uint8`, `(T, 3, H, W)`. |
|
| 113 |
+
| `event_graph`, `diagnostic_qa`, `scene_metadata` | Parsed per-scene JSON dictionaries for `base_scenes`. |
|
| 114 |
+
| `delta` | Parsed edit JSON for `counterfactuals` and `rq2_pairs`. |
|
| 115 |
+
| `*_path` | Original repository-relative strings, retained after decoding. |
|
| 116 |
+
|
| 117 |
+
No float conversion or normalization is applied. If a model expects floats in `[0, 1]`, convert explicitly: `video.float() / 255`.
|
| 118 |
+
|
| 119 |
```python
|
| 120 |
from torch.utils.data import DataLoader
|
| 121 |
from causalcascade import CausalCascadeDataset, collate_fn
|
| 122 |
|
| 123 |
+
def main():
|
| 124 |
+
dataset = CausalCascadeDataset(
|
| 125 |
+
repo_id="deepdeltalab/CausalCascade", subset="rq2_pairs",
|
| 126 |
+
decode_video=True, video_size=(240, 426),
|
| 127 |
+
video_frame_stride=4, video_max_frames=16,
|
| 128 |
+
load_annotations=False,
|
| 129 |
+
)
|
| 130 |
+
loader = DataLoader(dataset, batch_size=2, num_workers=0, collate_fn=collate_fn)
|
| 131 |
+
batch = next(iter(loader))
|
| 132 |
+
print(batch["scene_id"])
|
| 133 |
+
video = batch["factual_reference_video"]
|
| 134 |
+
print(video.shape if hasattr(video, "shape") else [v.shape for v in video])
|
| 135 |
+
|
| 136 |
+
if __name__ == "__main__":
|
| 137 |
+
main()
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
`collate_fn` recursively batches dictionaries. Equal-shaped tensors stack into `(B, ...)`; unequal-shaped tensors and string/list values remain lists. JSON dictionaries are recursively collated, not kept as a list of original dictionaries; inspect annotations per sample if you need their unbatched structure.
|
| 141 |
+
|
| 142 |
+
`video_size=(height, width)` applies only to videos, not initial images. `video_frame_stride` samples every nth frame; `video_max_frames` caps the number of retained frames. These controls are for inspection or downstream loading, **not official scoring**. Start with `num_workers=0`; when increasing workers in a Windows Python script, retain the `if __name__ == "__main__"` guard.
|
| 143 |
+
|
| 144 |
+
## Local Data and Reproducibility
|
| 145 |
+
|
| 146 |
+
For a downloaded HF-format repository containing the tables and referenced files:
|
| 147 |
+
|
| 148 |
+
```python
|
| 149 |
+
from causalcascade import CausalCascadeDataset
|
| 150 |
+
|
| 151 |
dataset = CausalCascadeDataset(
|
| 152 |
+
local_root="/path/to/CausalCascade", subset="base_scenes", decode_video=True,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
)
|
| 154 |
+
sample = dataset[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
```
|
| 156 |
|
| 157 |
+
Provide exactly one of `local_root` or `repo_id`. A loader-only installation is not a local dataset checkout: it lacks `tables/` and media. Local loading preserves the Parquet feature schema while bypassing remote file resolution.
|
| 158 |
|
| 159 |
+
For reproducible Hub loading, pass the dataset commit hash as `revision` and optionally set `cache_dir`. This fixes which table and asset versions are downloaded:
|
| 160 |
+
|
| 161 |
+
```python
|
| 162 |
+
dataset = CausalCascadeDataset(
|
| 163 |
+
repo_id="deepdeltalab/CausalCascade", subset="base_scenes",
|
| 164 |
+
revision="<dataset-commit-hash>", cache_dir="./hf-cache",
|
| 165 |
+
)
|
| 166 |
+
```
|
| 167 |
|
| 168 |
+
For official evaluation, use complete stored MP4s and the companion metric scripts; preview sampling is not the benchmark protocol. See [Evaluation](EVALUATION.md) and the [GitHub usage guide](https://github.com/SJTU-DeepDeltaLab/CausalCascade/blob/main/USAGE.md).
|
docs/SCHEMA.md
CHANGED
|
@@ -23,7 +23,9 @@ in the Hub viewer without duplicating video bytes in Parquet.
|
|
| 23 |
| `scene_metadata_path` | string | Blender-derived scene metadata. |
|
| 24 |
| `prompt_level1`, `prompt_level2`, `prompt_level3` | string | State-only, trigger-aware, and full event-chain future-event specification. |
|
| 25 |
| `num_rigid_bodies` | int | Objects with rigid-body metadata. |
|
|
|
|
| 26 |
| `num_events`, `num_causal_edges`, `temporal_depth` | int | Event-graph statistics. |
|
|
|
|
| 27 |
|
| 28 |
Event graph edges represent direct causal dependencies, not mere temporal precedence. Relative timing is recorded by node temporal stages. The prompt levels vary future-event specification; they need not be literal extensions of one another.
|
| 29 |
|
|
@@ -51,6 +53,19 @@ Each row joins one base scene to one selected counterfactual variant. The model-
|
|
| 51 |
|
| 52 |
The `factual_prompt_level1` and `counterfactual_prompt_level1` fields provide matched Level 1 conditions, with only intervention-affected attributes updated. Factual and counterfactual reference videos come from separate simulations, not manual video edits.
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
## `diagnostic_qa` (872 rows)
|
| 55 |
|
| 56 |
Each row contains a closed-ended diagnostic question, its reference answer, and native list-valued `related_event_ids` and `related_edge_ids`. These references are validated against the corresponding event graph. The five dimensions are event occurrence, causal pathway, temporal ordering, outcome and termination, and scene consistency. Questions are traceable to events, dependencies, temporal stages, or participants; this table is not a set of human verdicts on model-generated videos.
|
|
|
|
|
|
|
|
|
| 23 |
| `scene_metadata_path` | string | Blender-derived scene metadata. |
|
| 24 |
| `prompt_level1`, `prompt_level2`, `prompt_level3` | string | State-only, trigger-aware, and full event-chain future-event specification. |
|
| 25 |
| `num_rigid_bodies` | int | Objects with rigid-body metadata. |
|
| 26 |
+
| `num_objects` | int | Total objects recorded in the scene metadata. |
|
| 27 |
| `num_events`, `num_causal_edges`, `temporal_depth` | int | Event-graph statistics. |
|
| 28 |
+
| `blender_file_path` | string | Source Blender scene, downloadable separately from media. |
|
| 29 |
|
| 30 |
Event graph edges represent direct causal dependencies, not mere temporal precedence. Relative timing is recorded by node temporal stages. The prompt levels vary future-event specification; they need not be literal extensions of one another.
|
| 31 |
|
|
|
|
| 53 |
|
| 54 |
The `factual_prompt_level1` and `counterfactual_prompt_level1` fields provide matched Level 1 conditions, with only intervention-affected attributes updated. Factual and counterfactual reference videos come from separate simulations, not manual video edits.
|
| 55 |
|
| 56 |
+
| Field | Description |
|
| 57 |
+
|---|---|
|
| 58 |
+
| `pair_id`, `scene_id`, `variant_id`, `edit_type` | Pair identity, base-scene join key, variant identity, and intervention type. |
|
| 59 |
+
| `factual_initial_frame_path`, `counterfactual_initial_frame_path` | Repository-relative PNG paths. |
|
| 60 |
+
| `factual_reference_video_path`, `counterfactual_reference_video_path` | Repository-relative MP4 paths. |
|
| 61 |
+
| `factual_prompt_level1`, `counterfactual_prompt_level1` | Full generation prompts for the two initial states. |
|
| 62 |
+
| `counterfactual_prompt_path` | Raw counterfactual prompt text file. |
|
| 63 |
+
| `delta_json_path` | Raw intervention JSON. |
|
| 64 |
+
|
| 65 |
+
The loader adds decoded media fields without the `_path` suffix when requested, and parses `delta_json_path` into `delta`. It does not attach a base graph or QA to pair rows automatically: join `base_scenes` on `scene_id`. Counterfactual event graphs and QA are not supplied in these configurations.
|
| 66 |
+
|
| 67 |
## `diagnostic_qa` (872 rows)
|
| 68 |
|
| 69 |
Each row contains a closed-ended diagnostic question, its reference answer, and native list-valued `related_event_ids` and `related_edge_ids`. These references are validated against the corresponding event graph. The five dimensions are event occurrence, causal pathway, temporal ordering, outcome and termination, and scene consistency. Questions are traceable to events, dependencies, temporal stages, or participants; this table is not a set of human verdicts on model-generated videos.
|
| 70 |
+
|
| 71 |
+
Use `(scene_id, question_id)` as the unique question key; `question_id` alone can repeat across scenes. The flattened table uses `reference_answer`, `dimension`, and `related_event_ids` / `related_edge_ids`. Raw per-scene QA JSON uses `ground_truth_answer`, `diagnostic_dimension`, and `source_event_ids` / `source_edge_ids` for the same information. The loader preserves the raw JSON schema under `diagnostic_qa`.
|