Upload folder using huggingface_hub
Browse files- .DS_Store +0 -0
- .gitignore +4 -0
- .vscode/settings.json +3 -0
- Causal3D.py +163 -0
- Code/explore.ipynb +857 -0
- Hypothetical_V2_linear.zip +3 -0
- Hypothetical_V2_nonlinear.zip +3 -0
- Hypothetical_V3_fully_connected_linear.zip +3 -0
- Hypothetical_V3_v_structure_linear.zip +3 -0
- Hypothetical_V3_v_structure_nonlinear.zip +3 -0
- Hypothetical_V4_linear.zip +3 -0
- Hypothetical_V4_v_strcuture_nonlinear.zip +3 -0
- Hypothetical_V4_v_structure_linear.zip +3 -0
- Hypothetical_V5_linear.zip +3 -0
- Hypothetical_V5_v_structure_linear.zip +3 -0
- Hypothetical_V5_v_structure_nonlinear.zip +3 -0
- Real_Convex_len.zip +3 -0
- Real_Magnet.zip +3 -0
- Real_Parabola.zip +3 -0
- Real_Pendulum.zip +3 -0
- Real_Reflection.zip +3 -0
- Real_Seesaw.zip +3 -0
- Real_Spring.zip +3 -0
- Real_Water_flow.zip +3 -0
- zip_scene.py +37 -0
.DS_Store
ADDED
Binary file (8.2 kB). View file
|
|
.gitignore
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Ignore raw scene folders
|
2 |
+
Real/
|
3 |
+
Hypothetical/
|
4 |
+
Multi_View/
|
.vscode/settings.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"python.analysis.autoImportCompletions": true
|
3 |
+
}
|
Causal3D.py
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import datasets
|
2 |
+
import pandas as pd
|
3 |
+
import os
|
4 |
+
from pathlib import Path
|
5 |
+
from tqdm import tqdm
|
6 |
+
|
7 |
+
_CITATION = """\
|
8 |
+
@article{liu2025causal3d,
|
9 |
+
title={CAUSAL3D: A Comprehensive Benchmark for Causal Learning from Visual Data},
|
10 |
+
author={Liu, Disheng and Qiao, Yiran and Liu, Wuche and Lu, Yiren and Zhou, Yunlai and Liang, Tuo and Yin, Yu and Ma, Jing},
|
11 |
+
journal={arXiv preprint arXiv:2503.04852},
|
12 |
+
year={2025}
|
13 |
+
}
|
14 |
+
"""
|
15 |
+
|
16 |
+
_DESCRIPTION = """\
|
17 |
+
Causal3D is a benchmark for evaluating causal reasoning in physical and hypothetical visual scenes.
|
18 |
+
It includes both real-world recordings and rendered synthetic scenes demonstrating causal interactions.
|
19 |
+
"""
|
20 |
+
|
21 |
+
_HOMEPAGE = "https://huggingface.co/datasets/LLDDSS/Causal3D"
|
22 |
+
_LICENSE = "CC-BY-4.0"
|
23 |
+
|
24 |
+
class Causal3D(datasets.GeneratorBasedBuilder):
|
25 |
+
DEFAULT_CONFIG_NAME = "Real_Water_flow"
|
26 |
+
BUILDER_CONFIGS = [
|
27 |
+
# hypothetical_scenes
|
28 |
+
datasets.BuilderConfig(name="Hypothetical_V2_linear", version=datasets.Version("1.0.0"), description="Hypothetical_V2_linear scene"),
|
29 |
+
datasets.BuilderConfig(name="Hypothetical_V2_nonlinear", version=datasets.Version("1.0.0"), description="Hypothetical_V2_nonlinear scene"),
|
30 |
+
datasets.BuilderConfig(name="Hypothetical_V3_fully_connected_linear", version=datasets.Version("1.0.0"), description="Hypothetical_V3_fully_connected_linear scene"),
|
31 |
+
datasets.BuilderConfig(name="Hypothetical_V3_v_structure_linear", version=datasets.Version("1.0.0"), description="Hypothetical_V3_v_structure_linear scene"),
|
32 |
+
datasets.BuilderConfig(name="Hypothetical_V3_v_structure_nonlinear", version=datasets.Version("1.0.0"), description="Hypothetical_V3_v_structure_nonlinear scene"),
|
33 |
+
datasets.BuilderConfig(name="Hypothetical_V4_linear", version=datasets.Version("1.0.0"), description="Hypothetical_V4_linear scene"),
|
34 |
+
datasets.BuilderConfig(name="Hypothetical_V4_v_structure_nonlinear", version=datasets.Version("1.0.0"), description="Hypothetical_V4_v_structure_nonlinear scene"),
|
35 |
+
datasets.BuilderConfig(name="Hypothetical_V4_v_structure_linear", version=datasets.Version("1.0.0"), description="Hypothetical_V4_v_structure_linear scene"),
|
36 |
+
datasets.BuilderConfig(name="Hypothetical_V5_linear", version=datasets.Version("1.0.0"), description="Hypothetical_V5_linear scene"),
|
37 |
+
datasets.BuilderConfig(name="Hypothetical_V5_v_structure_linear", version=datasets.Version("1.0.0"), description="Hypothetical_V5_v_structure_linear scene"),
|
38 |
+
datasets.BuilderConfig(name="Hypothetical_V5_v_structure_nonlinear", version=datasets.Version("1.0.0"), description="Hypothetical_V5_v_structure_nonlinear scene"),
|
39 |
+
|
40 |
+
# real_scenes
|
41 |
+
datasets.BuilderConfig(name="Real_Parabola", version=datasets.Version("1.0.0"), description="Real_Parabola scene"),
|
42 |
+
datasets.BuilderConfig(name="Real_Magnet", version=datasets.Version("1.0.0"), description="Real_Magnet scene"),
|
43 |
+
datasets.BuilderConfig(name="Real_Spring", version=datasets.Version("1.0.0"), description="Real_Spring scene"),
|
44 |
+
datasets.BuilderConfig(name="Real_Water_flow", version=datasets.Version("1.0.0"), description="Real_Water_flow scene"),
|
45 |
+
datasets.BuilderConfig(name="Real_Seesaw", version=datasets.Version("1.0.0"), description="Real_Seesaw scene"),
|
46 |
+
datasets.BuilderConfig(name="Real_Reflection", version=datasets.Version("1.0.0"), description="Real_Reflection scene"),
|
47 |
+
datasets.BuilderConfig(name="Real_Pendulum", version=datasets.Version("1.0.0"), description="Real_Pendulum scene"),
|
48 |
+
datasets.BuilderConfig(name="Real_Convex_len", version=datasets.Version("1.0.0"), description="Real_Convex_len scene"),
|
49 |
+
]
|
50 |
+
|
51 |
+
def _info(self):
|
52 |
+
return datasets.DatasetInfo(
|
53 |
+
description=_DESCRIPTION,
|
54 |
+
features=datasets.Features({
|
55 |
+
"image": datasets.Image(),
|
56 |
+
"file_name": datasets.Value("string"),
|
57 |
+
"metadata": datasets.Value("string"), # optionally replace with structured fields
|
58 |
+
}),
|
59 |
+
homepage=_HOMEPAGE,
|
60 |
+
license=_LICENSE,
|
61 |
+
citation=_CITATION,
|
62 |
+
)
|
63 |
+
|
64 |
+
def _split_generators(self, dl_manager):
|
65 |
+
parts = self.config.name.split("_", 2)
|
66 |
+
category = parts[0] + "_" + parts[1]
|
67 |
+
if category not in ["real_scenes", "hypothetical_scenes"]:
|
68 |
+
raise ValueError(f"Invalid category '{category}'.")
|
69 |
+
|
70 |
+
scene = parts[2]
|
71 |
+
scene_path = os.path.join(category, scene)
|
72 |
+
|
73 |
+
if os.path.exists(scene_path):
|
74 |
+
data_dir = scene_path
|
75 |
+
else:
|
76 |
+
archive_path = dl_manager.download_and_extract(f"{scene_path}.zip")
|
77 |
+
data_dir = os.path.join(archive_path, scene)
|
78 |
+
|
79 |
+
return [
|
80 |
+
datasets.SplitGenerator(
|
81 |
+
name=datasets.Split.TRAIN,
|
82 |
+
gen_kwargs={"data_dir": data_dir},
|
83 |
+
)
|
84 |
+
]
|
85 |
+
def _generate_examples(self, data_dir):
|
86 |
+
def color(text, code):
|
87 |
+
return f"\033[{code}m{text}\033[0m"
|
88 |
+
print("load data from {}".format(data_dir))
|
89 |
+
try:
|
90 |
+
image_files = {}
|
91 |
+
for ext in ("*.png", "*.jpg", "*.jpeg"):
|
92 |
+
for img_path in Path(data_dir).rglob(ext):
|
93 |
+
relative_path = str(img_path.relative_to(data_dir))
|
94 |
+
image_files[relative_path] = str(img_path)
|
95 |
+
parts = [i.split('/')[0] for i in list(image_files.keys())]
|
96 |
+
parts = set(parts)
|
97 |
+
if "part_000" not in parts:
|
98 |
+
parts= ['']
|
99 |
+
|
100 |
+
|
101 |
+
except Exception as e:
|
102 |
+
print(color(f"Error loading images: {e}", "31")) # Red
|
103 |
+
return
|
104 |
+
|
105 |
+
# Find the .csv file
|
106 |
+
csv_files = list(Path(data_dir).rglob("*.csv"))
|
107 |
+
csv_files = [f for f in Path(data_dir).rglob("*.csv") if not f.name.startswith("._")]
|
108 |
+
if not csv_files:
|
109 |
+
# print(f"\033[33m[SKIP] No CSV found in {data_dir}, skipping this config.\033[0m")
|
110 |
+
pass
|
111 |
+
# print(f"\033[33m[INFO] Found CSV: {csv_files}\033[0m")
|
112 |
+
csv_path = csv_files[0] if csv_files else None
|
113 |
+
df = pd.read_csv(csv_path) if csv_path else None
|
114 |
+
image_col_exists = True
|
115 |
+
if df is not None and "image" not in df.columns:
|
116 |
+
image_col_exists = False
|
117 |
+
|
118 |
+
images = df["image"].tolist() if image_col_exists and df is not None else []
|
119 |
+
images = [i.split('/')[-1].split('.')[0] for i in images if i.endswith(('.png', '.jpg', '.jpeg'))]
|
120 |
+
|
121 |
+
try:
|
122 |
+
# Match CSV rows with image paths
|
123 |
+
if df is None:
|
124 |
+
for i, j in tqdm(image_files.items(), desc="Processing images", unit="image"):
|
125 |
+
yield i, {
|
126 |
+
"image": j,
|
127 |
+
"file_name": i,
|
128 |
+
"metadata": None,
|
129 |
+
}
|
130 |
+
|
131 |
+
else:
|
132 |
+
for idx, row in tqdm(df.iterrows(), total=len(df), desc="Processing rows", unit="row"):
|
133 |
+
fname = row["ID"]
|
134 |
+
raw_record_img_path = images[idx] if images else "" #row["image"]
|
135 |
+
record_img_name = raw_record_img_path.split('/')[-1]
|
136 |
+
for part in parts:
|
137 |
+
if part == '':
|
138 |
+
record_img_path = record_img_name
|
139 |
+
else:
|
140 |
+
record_img_path = "/".join([part, record_img_name.strip()])
|
141 |
+
if "Water_flow_scene_render" in data_dir:
|
142 |
+
record_img_path = "/".join([part, str(int(record_img_name.strip().split('.')[0]))+".png"])
|
143 |
+
if record_img_path in image_files:
|
144 |
+
# print(color(f"record_img_path: { image_files[record_img_path]}", "34")) # Blue
|
145 |
+
yield idx, {
|
146 |
+
"image": image_files[record_img_path],
|
147 |
+
"file_name": fname,
|
148 |
+
"metadata": row.to_json(),
|
149 |
+
}
|
150 |
+
break
|
151 |
+
|
152 |
+
else:
|
153 |
+
yield idx, {
|
154 |
+
# "image": "",
|
155 |
+
"file_name": fname,
|
156 |
+
"metadata": row.to_json(),
|
157 |
+
}
|
158 |
+
break
|
159 |
+
|
160 |
+
|
161 |
+
except Exception as e:
|
162 |
+
print(color(f"Error processing CSV rows: {e}", "31"))
|
163 |
+
|
Code/explore.ipynb
ADDED
@@ -0,0 +1,857 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 1,
|
6 |
+
"id": "cc0b451f",
|
7 |
+
"metadata": {},
|
8 |
+
"outputs": [],
|
9 |
+
"source": [
|
10 |
+
"import os\n",
|
11 |
+
"import pandas as pd\n",
|
12 |
+
"\n",
|
13 |
+
"base = os.getcwd()"
|
14 |
+
]
|
15 |
+
},
|
16 |
+
{
|
17 |
+
"cell_type": "markdown",
|
18 |
+
"id": "e3b39b13",
|
19 |
+
"metadata": {},
|
20 |
+
"source": [
|
21 |
+
"# Real"
|
22 |
+
]
|
23 |
+
},
|
24 |
+
{
|
25 |
+
"cell_type": "code",
|
26 |
+
"execution_count": 2,
|
27 |
+
"id": "85e4d8c2",
|
28 |
+
"metadata": {},
|
29 |
+
"outputs": [
|
30 |
+
{
|
31 |
+
"data": {
|
32 |
+
"text/plain": [
|
33 |
+
"'base: /Users/dsl/Desktop/Causal3D_Dataset/Code'"
|
34 |
+
]
|
35 |
+
},
|
36 |
+
"metadata": {},
|
37 |
+
"output_type": "display_data"
|
38 |
+
},
|
39 |
+
{
|
40 |
+
"data": {
|
41 |
+
"text/plain": [
|
42 |
+
"'data_path: /Users/dsl/Desktop/Causal3D_Dataset/Code/../Real'"
|
43 |
+
]
|
44 |
+
},
|
45 |
+
"metadata": {},
|
46 |
+
"output_type": "display_data"
|
47 |
+
},
|
48 |
+
{
|
49 |
+
"data": {
|
50 |
+
"text/plain": [
|
51 |
+
"\"Scene: Convex_len, Number of files: 10001, File types: {'.csv', '.png'}\""
|
52 |
+
]
|
53 |
+
},
|
54 |
+
"metadata": {},
|
55 |
+
"output_type": "display_data"
|
56 |
+
},
|
57 |
+
{
|
58 |
+
"data": {
|
59 |
+
"text/plain": [
|
60 |
+
"\"Scene: Seesaw, Number of files: 10001, File types: {'.csv', '.png'}\""
|
61 |
+
]
|
62 |
+
},
|
63 |
+
"metadata": {},
|
64 |
+
"output_type": "display_data"
|
65 |
+
},
|
66 |
+
{
|
67 |
+
"data": {
|
68 |
+
"text/plain": [
|
69 |
+
"\"Scene: Pendulum, Number of files: 10001, File types: {'.csv', '.png'}\""
|
70 |
+
]
|
71 |
+
},
|
72 |
+
"metadata": {},
|
73 |
+
"output_type": "display_data"
|
74 |
+
},
|
75 |
+
{
|
76 |
+
"data": {
|
77 |
+
"text/plain": [
|
78 |
+
"\"Scene: Water_flow, Number of files: 10001, File types: {'.csv', '.png'}\""
|
79 |
+
]
|
80 |
+
},
|
81 |
+
"metadata": {},
|
82 |
+
"output_type": "display_data"
|
83 |
+
},
|
84 |
+
{
|
85 |
+
"data": {
|
86 |
+
"text/plain": [
|
87 |
+
"\"Scene: Parabola, Number of files: 10001, File types: {'.csv', '.png'}\""
|
88 |
+
]
|
89 |
+
},
|
90 |
+
"metadata": {},
|
91 |
+
"output_type": "display_data"
|
92 |
+
},
|
93 |
+
{
|
94 |
+
"data": {
|
95 |
+
"text/plain": [
|
96 |
+
"\"Scene: Magnet, Number of files: 10001, File types: {'.csv', '.png'}\""
|
97 |
+
]
|
98 |
+
},
|
99 |
+
"metadata": {},
|
100 |
+
"output_type": "display_data"
|
101 |
+
},
|
102 |
+
{
|
103 |
+
"data": {
|
104 |
+
"text/plain": [
|
105 |
+
"\"Scene: Spring, Number of files: 10001, File types: {'.csv', '.png'}\""
|
106 |
+
]
|
107 |
+
},
|
108 |
+
"metadata": {},
|
109 |
+
"output_type": "display_data"
|
110 |
+
},
|
111 |
+
{
|
112 |
+
"data": {
|
113 |
+
"text/plain": [
|
114 |
+
"\"Scene: Reflection, Number of files: 10001, File types: {'.csv', '.png'}\""
|
115 |
+
]
|
116 |
+
},
|
117 |
+
"metadata": {},
|
118 |
+
"output_type": "display_data"
|
119 |
+
}
|
120 |
+
],
|
121 |
+
"source": [
|
122 |
+
"from IPython.display import display\n",
|
123 |
+
"\n",
|
124 |
+
"base = os.getcwd()\n",
|
125 |
+
"data_path = os.path.join(base, \"../Real\")\n",
|
126 |
+
"scenes = os.listdir(data_path)\n",
|
127 |
+
"\n",
|
128 |
+
"display(f\"base: {base}\")\n",
|
129 |
+
"display(f\"data_path: {data_path}\")\n",
|
130 |
+
"all_scenes = [scene for scene in scenes if os.path.isdir(os.path.join(data_path, scene))]\n",
|
131 |
+
"# get the number of files and the corresponding type under the each scene\n",
|
132 |
+
"for scene in all_scenes:\n",
|
133 |
+
" scene_path = os.path.join(data_path, scene)\n",
|
134 |
+
" files = os.listdir(scene_path)\n",
|
135 |
+
" file_types = set([os.path.splitext(file)[1] for file in files])\n",
|
136 |
+
" display(f\"Scene: {scene}, Number of files: {len(files)}, File types: {file_types}\") \n",
|
137 |
+
" # You see an empty string '' in file_types because some files in the directory do not have an extension.\n",
|
138 |
+
" # For example, hidden files like '.DS_Store' or files without a dot will result in an empty extension from os.path.splitext.\n",
|
139 |
+
" # To check which files have no extension:\n",
|
140 |
+
" "
|
141 |
+
]
|
142 |
+
},
|
143 |
+
{
|
144 |
+
"cell_type": "code",
|
145 |
+
"execution_count": 35,
|
146 |
+
"id": "6979c835",
|
147 |
+
"metadata": {},
|
148 |
+
"outputs": [
|
149 |
+
{
|
150 |
+
"data": {
|
151 |
+
"text/plain": [
|
152 |
+
"{'Convex_len': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Real/Convex_len/tabular.csv'],\n",
|
153 |
+
" 'Seesaw': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Real/Seesaw/tabular.csv'],\n",
|
154 |
+
" 'Pendulum': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Real/Pendulum/tabular.csv'],\n",
|
155 |
+
" 'Water_flow': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Real/Water_flow/tabular.csv'],\n",
|
156 |
+
" 'Parabola': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Real/Parabola/tabular.csv'],\n",
|
157 |
+
" 'Magnet': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Real/Magnet/tabular.csv'],\n",
|
158 |
+
" 'Spring': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Real/Spring/tabular.csv'],\n",
|
159 |
+
" 'Reflection': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Real/Reflection/tabular.csv']}"
|
160 |
+
]
|
161 |
+
},
|
162 |
+
"execution_count": 35,
|
163 |
+
"metadata": {},
|
164 |
+
"output_type": "execute_result"
|
165 |
+
}
|
166 |
+
],
|
167 |
+
"source": [
|
168 |
+
"scene_csv_paths = {}\n",
|
169 |
+
"for scene in all_scenes:\n",
|
170 |
+
" folder = os.path.join(data_path, scene)\n",
|
171 |
+
" if not os.path.isdir(folder):\n",
|
172 |
+
" continue\n",
|
173 |
+
" csv_files = [f for f in os.listdir(folder) if f.endswith('.csv')]\n",
|
174 |
+
" scene_csv_paths[scene] = [os.path.join(folder, f) for f in csv_files]\n",
|
175 |
+
"scene_csv_paths\n"
|
176 |
+
]
|
177 |
+
},
|
178 |
+
{
|
179 |
+
"cell_type": "code",
|
180 |
+
"execution_count": 66,
|
181 |
+
"id": "c58bbbd3",
|
182 |
+
"metadata": {},
|
183 |
+
"outputs": [
|
184 |
+
{
|
185 |
+
"data": {
|
186 |
+
"text/plain": [
|
187 |
+
"{'Convex_len': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Real/Convex_len/tabular.csv'],\n",
|
188 |
+
" 'Seesaw': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Real/Seesaw/tabular.csv'],\n",
|
189 |
+
" 'Pendulum': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Real/Pendulum/tabular.csv'],\n",
|
190 |
+
" 'Water_flow': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Real/Water_flow/tabular.csv'],\n",
|
191 |
+
" 'Parabola': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Real/Parabola/tabular.csv'],\n",
|
192 |
+
" 'Magnet': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Real/Magnet/tabular.csv'],\n",
|
193 |
+
" 'Spring': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Real/Spring/tabular.csv'],\n",
|
194 |
+
" 'Reflection': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Real/Reflection/tabular.csv']}"
|
195 |
+
]
|
196 |
+
},
|
197 |
+
"execution_count": 66,
|
198 |
+
"metadata": {},
|
199 |
+
"output_type": "execute_result"
|
200 |
+
}
|
201 |
+
],
|
202 |
+
"source": [
|
203 |
+
"scene_csv_paths"
|
204 |
+
]
|
205 |
+
},
|
206 |
+
{
|
207 |
+
"cell_type": "code",
|
208 |
+
"execution_count": null,
|
209 |
+
"id": "54888282",
|
210 |
+
"metadata": {},
|
211 |
+
"outputs": [],
|
212 |
+
"source": [
|
213 |
+
"import pandas as pd\n",
|
214 |
+
"\n",
|
215 |
+
"# === Function to convert filenames ===\n",
|
216 |
+
"def convert_filename(filename):\n",
|
217 |
+
" if isinstance(filename, str) and filename.endswith('.png'):\n",
|
218 |
+
" # Remove leading zeros from the number part\n",
|
219 |
+
" number_part = filename.split('.')[0]\n",
|
220 |
+
" new_number = str(int(number_part))\n",
|
221 |
+
" return f\"{new_number}.png\"\n",
|
222 |
+
" return filename # if not a string or doesn't match, return as is\n",
|
223 |
+
"\n"
|
224 |
+
]
|
225 |
+
},
|
226 |
+
{
|
227 |
+
"cell_type": "code",
|
228 |
+
"execution_count": 70,
|
229 |
+
"id": "9b3afa52",
|
230 |
+
"metadata": {},
|
231 |
+
"outputs": [],
|
232 |
+
"source": [
|
233 |
+
"# check each csv file, are there all of png files exists\n",
|
234 |
+
"for i in scene_csv_paths:\n",
|
235 |
+
" df = pd.read_csv(scene_csv_paths[i][0])\n",
|
236 |
+
" df['imgs'] = df['imgs'].apply(convert_filename)\n",
|
237 |
+
" df.to_csv(scene_csv_paths[i][0], index=False)\n"
|
238 |
+
]
|
239 |
+
},
|
240 |
+
{
|
241 |
+
"cell_type": "code",
|
242 |
+
"execution_count": 71,
|
243 |
+
"id": "50723819",
|
244 |
+
"metadata": {},
|
245 |
+
"outputs": [],
|
246 |
+
"source": [
|
247 |
+
"# check each csv file, are there all of png files exists\n",
|
248 |
+
"for i in scene_csv_paths:\n",
|
249 |
+
" df = pd.read_csv(scene_csv_paths[i][0])\n",
|
250 |
+
" imgs = df['imgs'].tolist()\n",
|
251 |
+
" for img in imgs:\n",
|
252 |
+
" img_path = os.path.join(data_path, i, img)\n",
|
253 |
+
" if not os.path.exists(img_path):\n",
|
254 |
+
" print(f\"Image {img} does not exist in scene {i}.\")\n",
|
255 |
+
"\n"
|
256 |
+
]
|
257 |
+
},
|
258 |
+
{
|
259 |
+
"cell_type": "markdown",
|
260 |
+
"id": "8d7f2bad",
|
261 |
+
"metadata": {},
|
262 |
+
"source": [
|
263 |
+
"# Hypothetic\n"
|
264 |
+
]
|
265 |
+
},
|
266 |
+
{
|
267 |
+
"cell_type": "code",
|
268 |
+
"execution_count": 40,
|
269 |
+
"id": "d9c4b659",
|
270 |
+
"metadata": {},
|
271 |
+
"outputs": [
|
272 |
+
{
|
273 |
+
"name": "stdout",
|
274 |
+
"output_type": "stream",
|
275 |
+
"text": [
|
276 |
+
"Scene: V4_linear, Number of files: 10003, File types: {'.png': 10001, '': 1, '.csv': 1}\n",
|
277 |
+
"Scene: V4_v_structure_linear, Number of files: 10001, File types: {'.png': 10000, '.csv': 1}\n",
|
278 |
+
"Scene: V3_fully_connected_linear, Number of files: 10002, File types: {'.png': 10000, '.md': 1, '.csv': 1}\n",
|
279 |
+
"Scene: V2_linear, Number of files: 10002, File types: {'.png': 10000, '.md': 1, '.csv': 1}\n",
|
280 |
+
"Scene: V2_nonlinear, Number of files: 10002, File types: {'.png': 10000, '.md': 1, '.csv': 1}\n",
|
281 |
+
"Scene: V5_linear, Number of files: 10001, File types: {'.png': 10000, '.csv': 1}\n",
|
282 |
+
"Scene: V3_v_structure_nonlinear, Number of files: 10002, File types: {'.png': 10000, '': 1, '.csv': 1}\n",
|
283 |
+
"Scene: V3_v_structure_linear, Number of files: 10002, File types: {'.png': 10000, '': 1, '.csv': 1}\n",
|
284 |
+
"Scene: V5_v_structure_nonlinear, Number of files: 10001, File types: {'.png': 10000, '.csv': 1}\n",
|
285 |
+
"Scene: V5_v_structure_linear, Number of files: 10001, File types: {'.png': 10000, '.csv': 1}\n",
|
286 |
+
"Scene: V4_v_strcuture_nonlinear, Number of files: 10001, File types: {'.png': 10000, '.csv': 1}\n"
|
287 |
+
]
|
288 |
+
}
|
289 |
+
],
|
290 |
+
"source": [
|
291 |
+
"hy_base_path = os.path.join(base, \"../Hypothetic\")\n",
|
292 |
+
"hy_scenes = os.listdir(hy_base_path)\n",
|
293 |
+
"for scene in hy_scenes:\n",
|
294 |
+
" scene_path = os.path.join(hy_base_path, scene)\n",
|
295 |
+
" if not os.path.isdir(scene_path) or scene.startswith('.'):\n",
|
296 |
+
" continue\n",
|
297 |
+
" files = os.listdir(scene_path)\n",
|
298 |
+
" file_types = {}\n",
|
299 |
+
" for file in files:\n",
|
300 |
+
" ext = os.path.splitext(file)[1]\n",
|
301 |
+
" file_types[ext] = file_types.get(ext, 0) + 1\n",
|
302 |
+
" print(f\"Scene: {scene}, Number of files: {len(files)}, File types: {file_types}\")"
|
303 |
+
]
|
304 |
+
},
|
305 |
+
{
|
306 |
+
"cell_type": "code",
|
307 |
+
"execution_count": 7,
|
308 |
+
"id": "6444b695",
|
309 |
+
"metadata": {},
|
310 |
+
"outputs": [
|
311 |
+
{
|
312 |
+
"data": {
|
313 |
+
"text/plain": [
|
314 |
+
"{'V4_linear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V4_linear/tabular.csv'],\n",
|
315 |
+
" 'V4_v_structure_linear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V4_v_structure_linear/tabular.csv'],\n",
|
316 |
+
" 'V3_fully_connected_linear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V3_fully_connected_linear/tabular.csv'],\n",
|
317 |
+
" 'V2_linear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V2_linear/tabular.csv'],\n",
|
318 |
+
" 'V2_nonlinear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V2_nonlinear/tabular.csv'],\n",
|
319 |
+
" 'V5_linear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V5_linear/tabular.csv'],\n",
|
320 |
+
" 'V3_v_structure_nonlinear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V3_v_structure_nonlinear/tabular.csv'],\n",
|
321 |
+
" 'V3_v_structure_linear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V3_v_structure_linear/tabular.csv'],\n",
|
322 |
+
" 'V5_v_structure_nonlinear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V5_v_structure_nonlinear/tabular.csv'],\n",
|
323 |
+
" 'V5_v_structure_linear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V5_v_structure_linear/tabular.csv'],\n",
|
324 |
+
" 'V4_v_strcuture_nonlinear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V4_v_strcuture_nonlinear/tabular.csv']}"
|
325 |
+
]
|
326 |
+
},
|
327 |
+
"execution_count": 7,
|
328 |
+
"metadata": {},
|
329 |
+
"output_type": "execute_result"
|
330 |
+
}
|
331 |
+
],
|
332 |
+
"source": [
|
333 |
+
"hy_scene_csv_paths = {}\n",
|
334 |
+
"for scene in hy_scenes:\n",
|
335 |
+
" scene_folder = os.path.join(hy_base_path, scene)\n",
|
336 |
+
" if not os.path.isdir(scene_folder) or scene.startswith('.'):\n",
|
337 |
+
" continue\n",
|
338 |
+
" csvs = [f for f in os.listdir(scene_folder) if f.endswith('.csv')]\n",
|
339 |
+
" hy_scene_csv_paths[scene] = [os.path.join(scene_folder, f) for f in csvs]\n",
|
340 |
+
"hy_scene_csv_paths"
|
341 |
+
]
|
342 |
+
},
|
343 |
+
{
|
344 |
+
"cell_type": "code",
|
345 |
+
"execution_count": 8,
|
346 |
+
"id": "4bc1be73",
|
347 |
+
"metadata": {},
|
348 |
+
"outputs": [
|
349 |
+
{
|
350 |
+
"name": "stdout",
|
351 |
+
"output_type": "stream",
|
352 |
+
"text": [
|
353 |
+
"Hypothetic Scene: V4_linear, CSV: tabular.csv\n",
|
354 |
+
"Columns: ['volume_ball', 'height_cuboid', 'base_area_cuboid', 'base_area_cone', 'imgs']\n",
|
355 |
+
"\n",
|
356 |
+
"Hypothetic Scene: V4_v_structure_linear, CSV: tabular.csv\n",
|
357 |
+
"Columns: ['volumn_ball', 'height_cuboid', 'base_area_cuboid', 'base_area_cone', 'imgs']\n",
|
358 |
+
"\n",
|
359 |
+
"Hypothetic Scene: V3_fully_connected_linear, CSV: tabular.csv\n",
|
360 |
+
"Columns: ['iter', 'volume_ball', 'height_of_cuboid', 'base_area_cone', 'img_path']\n",
|
361 |
+
"\n",
|
362 |
+
"Hypothetic Scene: V2_linear, CSV: tabular.csv\n",
|
363 |
+
"Columns: ['iter', 'volume_ball', 'r_ball', 'volume_cube', 'edge_cube', 'img_path']\n",
|
364 |
+
"\n",
|
365 |
+
"Hypothetic Scene: V2_nonlinear, CSV: tabular.csv\n",
|
366 |
+
"Columns: ['iter', 'volume_ball', 'r_ball', 'scaled_volume_ball', 'volume_cube', 'edge_cube', 'img_path']\n",
|
367 |
+
"\n",
|
368 |
+
"Hypothetic Scene: V5_linear, CSV: tabular.csv\n",
|
369 |
+
"Columns: ['volumn_ball', 'height_cuboid', 'base_area_cuboid', 'base_area_cone', 'height_cone', 'imgs']\n",
|
370 |
+
"\n",
|
371 |
+
"Hypothetic Scene: V3_v_structure_nonlinear, CSV: tabular.csv\n",
|
372 |
+
"Columns: ['volume_ball', 'scaled_volume_ball', 'radius of ball', 'height_cylinder', 'radius of cone', 'basal_area_cone', 'imgs']\n",
|
373 |
+
"\n",
|
374 |
+
"Hypothetic Scene: V3_v_structure_linear, CSV: tabular.csv\n",
|
375 |
+
"Columns: ['volume_ball', 'height_cylinder', 'basal_area_cone', 'imgs', 'Unnamed: 4']\n",
|
376 |
+
"\n",
|
377 |
+
"Hypothetic Scene: V5_v_structure_nonlinear, CSV: tabular.csv\n",
|
378 |
+
"Columns: ['volumn_ball', 'scaled_volumn_ball', 'height_cuboid', 'base_area_cuboid', 'scaled_base_area_cuboid', 'base_area_cone', 'scaled_base_area_cone', 'height_cone', 'imgs']\n",
|
379 |
+
"\n",
|
380 |
+
"Hypothetic Scene: V5_v_structure_linear, CSV: tabular.csv\n",
|
381 |
+
"Columns: ['volumn_ball', 'height_cuboid', 'base_area_cuboid', 'base_area_cone', 'height_cone', 'imgs']\n",
|
382 |
+
"\n",
|
383 |
+
"Hypothetic Scene: V4_v_strcuture_nonlinear, CSV: tabular.csv\n",
|
384 |
+
"Columns: ['volumn_ball', 'scaled_volumn_ball', 'height_cuboid', 'base_area_cuboid', 'scaled_base_area_cuboid', 'base_area_cone', 'imgs']\n",
|
385 |
+
"\n"
|
386 |
+
]
|
387 |
+
}
|
388 |
+
],
|
389 |
+
"source": [
|
390 |
+
"for scene, csv_paths in hy_scene_csv_paths.items():\n",
|
391 |
+
" for csv_file in csv_paths:\n",
|
392 |
+
" df = pd.read_csv(csv_file, nrows=0)\n",
|
393 |
+
" print(f\"Hypothetic Scene: {scene}, CSV: {os.path.basename(csv_file)}\")\n",
|
394 |
+
" print(\"Columns:\", list(df.columns))\n",
|
395 |
+
" print()"
|
396 |
+
]
|
397 |
+
},
|
398 |
+
{
|
399 |
+
"cell_type": "code",
|
400 |
+
"execution_count": 43,
|
401 |
+
"id": "fefc0d47",
|
402 |
+
"metadata": {},
|
403 |
+
"outputs": [
|
404 |
+
{
|
405 |
+
"data": {
|
406 |
+
"text/plain": [
|
407 |
+
"dict_keys(['/Users/dsl/Desktop/Causal3D_Dataset/Hypothetic/V3_fully_connected_linear', '/Users/dsl/Desktop/Causal3D_Dataset/Hypothetic/V2_nonlinear', '/Users/dsl/Desktop/Causal3D_Dataset/Hypothetic/V2_linear'])"
|
408 |
+
]
|
409 |
+
},
|
410 |
+
"execution_count": 43,
|
411 |
+
"metadata": {},
|
412 |
+
"output_type": "execute_result"
|
413 |
+
}
|
414 |
+
],
|
415 |
+
"source": [
|
416 |
+
"process_path = [\"/Users/dsl/Desktop/Causal3D_Dataset/Hypothetic/V3_fully_connected_linear\",\n",
|
417 |
+
" \"/Users/dsl/Desktop/Causal3D_Dataset/Hypothetic/V2_nonlinear\",\n",
|
418 |
+
" \"/Users/dsl/Desktop/Causal3D_Dataset/Hypothetic/V2_linear\"]\n",
|
419 |
+
"dfs_dict = {}\n",
|
420 |
+
"for path in process_path:\n",
|
421 |
+
" csv_file = os.path.join(path, \"tabular.csv\")\n",
|
422 |
+
" if os.path.exists(csv_file):\n",
|
423 |
+
" df = pd.read_csv(csv_file)\n",
|
424 |
+
" dfs_dict[path] = df\n",
|
425 |
+
"dfs_dict.keys()\n"
|
426 |
+
]
|
427 |
+
},
|
428 |
+
{
|
429 |
+
"cell_type": "code",
|
430 |
+
"execution_count": 46,
|
431 |
+
"id": "e6c53182",
|
432 |
+
"metadata": {},
|
433 |
+
"outputs": [
|
434 |
+
{
|
435 |
+
"name": "stdout",
|
436 |
+
"output_type": "stream",
|
437 |
+
"text": [
|
438 |
+
"DataFrame for: /Users/dsl/Desktop/Causal3D_Dataset/Hypothetic/V3_fully_connected_linear\n"
|
439 |
+
]
|
440 |
+
},
|
441 |
+
{
|
442 |
+
"data": {
|
443 |
+
"text/html": [
|
444 |
+
"<div>\n",
|
445 |
+
"<style scoped>\n",
|
446 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
447 |
+
" vertical-align: middle;\n",
|
448 |
+
" }\n",
|
449 |
+
"\n",
|
450 |
+
" .dataframe tbody tr th {\n",
|
451 |
+
" vertical-align: top;\n",
|
452 |
+
" }\n",
|
453 |
+
"\n",
|
454 |
+
" .dataframe thead th {\n",
|
455 |
+
" text-align: right;\n",
|
456 |
+
" }\n",
|
457 |
+
"</style>\n",
|
458 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
459 |
+
" <thead>\n",
|
460 |
+
" <tr style=\"text-align: right;\">\n",
|
461 |
+
" <th></th>\n",
|
462 |
+
" <th>iter</th>\n",
|
463 |
+
" <th>volume_ball</th>\n",
|
464 |
+
" <th>height_of_cuboid</th>\n",
|
465 |
+
" <th>base_area_cone</th>\n",
|
466 |
+
" <th>imgs</th>\n",
|
467 |
+
" </tr>\n",
|
468 |
+
" </thead>\n",
|
469 |
+
" <tbody>\n",
|
470 |
+
" <tr>\n",
|
471 |
+
" <th>0</th>\n",
|
472 |
+
" <td>1</td>\n",
|
473 |
+
" <td>4.461709</td>\n",
|
474 |
+
" <td>2.230855</td>\n",
|
475 |
+
" <td>4.461709</td>\n",
|
476 |
+
" <td>00001.png</td>\n",
|
477 |
+
" </tr>\n",
|
478 |
+
" <tr>\n",
|
479 |
+
" <th>1</th>\n",
|
480 |
+
" <td>2</td>\n",
|
481 |
+
" <td>4.641952</td>\n",
|
482 |
+
" <td>2.320976</td>\n",
|
483 |
+
" <td>4.641952</td>\n",
|
484 |
+
" <td>00002.png</td>\n",
|
485 |
+
" </tr>\n",
|
486 |
+
" <tr>\n",
|
487 |
+
" <th>2</th>\n",
|
488 |
+
" <td>3</td>\n",
|
489 |
+
" <td>5.732580</td>\n",
|
490 |
+
" <td>2.866290</td>\n",
|
491 |
+
" <td>5.732580</td>\n",
|
492 |
+
" <td>00003.png</td>\n",
|
493 |
+
" </tr>\n",
|
494 |
+
" <tr>\n",
|
495 |
+
" <th>3</th>\n",
|
496 |
+
" <td>4</td>\n",
|
497 |
+
" <td>9.686783</td>\n",
|
498 |
+
" <td>4.843392</td>\n",
|
499 |
+
" <td>9.686783</td>\n",
|
500 |
+
" <td>00004.png</td>\n",
|
501 |
+
" </tr>\n",
|
502 |
+
" <tr>\n",
|
503 |
+
" <th>4</th>\n",
|
504 |
+
" <td>5</td>\n",
|
505 |
+
" <td>2.608935</td>\n",
|
506 |
+
" <td>1.304468</td>\n",
|
507 |
+
" <td>2.608935</td>\n",
|
508 |
+
" <td>00005.png</td>\n",
|
509 |
+
" </tr>\n",
|
510 |
+
" </tbody>\n",
|
511 |
+
"</table>\n",
|
512 |
+
"</div>"
|
513 |
+
],
|
514 |
+
"text/plain": [
|
515 |
+
" iter volume_ball height_of_cuboid base_area_cone imgs\n",
|
516 |
+
"0 1 4.461709 2.230855 4.461709 00001.png\n",
|
517 |
+
"1 2 4.641952 2.320976 4.641952 00002.png\n",
|
518 |
+
"2 3 5.732580 2.866290 5.732580 00003.png\n",
|
519 |
+
"3 4 9.686783 4.843392 9.686783 00004.png\n",
|
520 |
+
"4 5 2.608935 1.304468 2.608935 00005.png"
|
521 |
+
]
|
522 |
+
},
|
523 |
+
"metadata": {},
|
524 |
+
"output_type": "display_data"
|
525 |
+
},
|
526 |
+
{
|
527 |
+
"name": "stdout",
|
528 |
+
"output_type": "stream",
|
529 |
+
"text": [
|
530 |
+
"Shape: (10000, 5)\n",
|
531 |
+
"------------------------------------------------------------\n",
|
532 |
+
"DataFrame for: /Users/dsl/Desktop/Causal3D_Dataset/Hypothetic/V2_nonlinear\n"
|
533 |
+
]
|
534 |
+
},
|
535 |
+
{
|
536 |
+
"data": {
|
537 |
+
"text/html": [
|
538 |
+
"<div>\n",
|
539 |
+
"<style scoped>\n",
|
540 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
541 |
+
" vertical-align: middle;\n",
|
542 |
+
" }\n",
|
543 |
+
"\n",
|
544 |
+
" .dataframe tbody tr th {\n",
|
545 |
+
" vertical-align: top;\n",
|
546 |
+
" }\n",
|
547 |
+
"\n",
|
548 |
+
" .dataframe thead th {\n",
|
549 |
+
" text-align: right;\n",
|
550 |
+
" }\n",
|
551 |
+
"</style>\n",
|
552 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
553 |
+
" <thead>\n",
|
554 |
+
" <tr style=\"text-align: right;\">\n",
|
555 |
+
" <th></th>\n",
|
556 |
+
" <th>iter</th>\n",
|
557 |
+
" <th>volume_ball</th>\n",
|
558 |
+
" <th>r_ball</th>\n",
|
559 |
+
" <th>scaled_volume_ball</th>\n",
|
560 |
+
" <th>volume_cube</th>\n",
|
561 |
+
" <th>edge_cube</th>\n",
|
562 |
+
" <th>imgs</th>\n",
|
563 |
+
" </tr>\n",
|
564 |
+
" </thead>\n",
|
565 |
+
" <tbody>\n",
|
566 |
+
" <tr>\n",
|
567 |
+
" <th>0</th>\n",
|
568 |
+
" <td>1</td>\n",
|
569 |
+
" <td>8.369589</td>\n",
|
570 |
+
" <td>1.259520</td>\n",
|
571 |
+
" <td>-0.260683</td>\n",
|
572 |
+
" <td>5.797285</td>\n",
|
573 |
+
" <td>1.796421</td>\n",
|
574 |
+
" <td>00001.png</td>\n",
|
575 |
+
" </tr>\n",
|
576 |
+
" <tr>\n",
|
577 |
+
" <th>1</th>\n",
|
578 |
+
" <td>2</td>\n",
|
579 |
+
" <td>8.748098</td>\n",
|
580 |
+
" <td>1.278228</td>\n",
|
581 |
+
" <td>-0.201078</td>\n",
|
582 |
+
" <td>5.879111</td>\n",
|
583 |
+
" <td>1.804834</td>\n",
|
584 |
+
" <td>00002.png</td>\n",
|
585 |
+
" </tr>\n",
|
586 |
+
" <tr>\n",
|
587 |
+
" <th>2</th>\n",
|
588 |
+
" <td>3</td>\n",
|
589 |
+
" <td>11.038418</td>\n",
|
590 |
+
" <td>1.381251</td>\n",
|
591 |
+
" <td>0.159586</td>\n",
|
592 |
+
" <td>5.923759</td>\n",
|
593 |
+
" <td>1.809391</td>\n",
|
594 |
+
" <td>00003.png</td>\n",
|
595 |
+
" </tr>\n",
|
596 |
+
" <tr>\n",
|
597 |
+
" <th>3</th>\n",
|
598 |
+
" <td>4</td>\n",
|
599 |
+
" <td>19.342245</td>\n",
|
600 |
+
" <td>1.665224</td>\n",
|
601 |
+
" <td>1.467218</td>\n",
|
602 |
+
" <td>0.620362</td>\n",
|
603 |
+
" <td>0.852868</td>\n",
|
604 |
+
" <td>00004.png</td>\n",
|
605 |
+
" </tr>\n",
|
606 |
+
" <tr>\n",
|
607 |
+
" <th>4</th>\n",
|
608 |
+
" <td>5</td>\n",
|
609 |
+
" <td>4.478764</td>\n",
|
610 |
+
" <td>1.022562</td>\n",
|
611 |
+
" <td>-0.873384</td>\n",
|
612 |
+
" <td>3.853417</td>\n",
|
613 |
+
" <td>1.567769</td>\n",
|
614 |
+
" <td>00005.png</td>\n",
|
615 |
+
" </tr>\n",
|
616 |
+
" </tbody>\n",
|
617 |
+
"</table>\n",
|
618 |
+
"</div>"
|
619 |
+
],
|
620 |
+
"text/plain": [
|
621 |
+
" iter volume_ball r_ball scaled_volume_ball volume_cube edge_cube \\\n",
|
622 |
+
"0 1 8.369589 1.259520 -0.260683 5.797285 1.796421 \n",
|
623 |
+
"1 2 8.748098 1.278228 -0.201078 5.879111 1.804834 \n",
|
624 |
+
"2 3 11.038418 1.381251 0.159586 5.923759 1.809391 \n",
|
625 |
+
"3 4 19.342245 1.665224 1.467218 0.620362 0.852868 \n",
|
626 |
+
"4 5 4.478764 1.022562 -0.873384 3.853417 1.567769 \n",
|
627 |
+
"\n",
|
628 |
+
" imgs \n",
|
629 |
+
"0 00001.png \n",
|
630 |
+
"1 00002.png \n",
|
631 |
+
"2 00003.png \n",
|
632 |
+
"3 00004.png \n",
|
633 |
+
"4 00005.png "
|
634 |
+
]
|
635 |
+
},
|
636 |
+
"metadata": {},
|
637 |
+
"output_type": "display_data"
|
638 |
+
},
|
639 |
+
{
|
640 |
+
"name": "stdout",
|
641 |
+
"output_type": "stream",
|
642 |
+
"text": [
|
643 |
+
"Shape: (10000, 7)\n",
|
644 |
+
"------------------------------------------------------------\n",
|
645 |
+
"DataFrame for: /Users/dsl/Desktop/Causal3D_Dataset/Hypothetic/V2_linear\n"
|
646 |
+
]
|
647 |
+
},
|
648 |
+
{
|
649 |
+
"data": {
|
650 |
+
"text/html": [
|
651 |
+
"<div>\n",
|
652 |
+
"<style scoped>\n",
|
653 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
654 |
+
" vertical-align: middle;\n",
|
655 |
+
" }\n",
|
656 |
+
"\n",
|
657 |
+
" .dataframe tbody tr th {\n",
|
658 |
+
" vertical-align: top;\n",
|
659 |
+
" }\n",
|
660 |
+
"\n",
|
661 |
+
" .dataframe thead th {\n",
|
662 |
+
" text-align: right;\n",
|
663 |
+
" }\n",
|
664 |
+
"</style>\n",
|
665 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
666 |
+
" <thead>\n",
|
667 |
+
" <tr style=\"text-align: right;\">\n",
|
668 |
+
" <th></th>\n",
|
669 |
+
" <th>iter</th>\n",
|
670 |
+
" <th>volume_ball</th>\n",
|
671 |
+
" <th>r_ball</th>\n",
|
672 |
+
" <th>volume_cube</th>\n",
|
673 |
+
" <th>edge_cube</th>\n",
|
674 |
+
" <th>imgs</th>\n",
|
675 |
+
" </tr>\n",
|
676 |
+
" </thead>\n",
|
677 |
+
" <tbody>\n",
|
678 |
+
" <tr>\n",
|
679 |
+
" <th>0</th>\n",
|
680 |
+
" <td>1</td>\n",
|
681 |
+
" <td>7.118523</td>\n",
|
682 |
+
" <td>1.193348</td>\n",
|
683 |
+
" <td>10.677784</td>\n",
|
684 |
+
" <td>2.202049</td>\n",
|
685 |
+
" <td>00001.png</td>\n",
|
686 |
+
" </tr>\n",
|
687 |
+
" <tr>\n",
|
688 |
+
" <th>1</th>\n",
|
689 |
+
" <td>2</td>\n",
|
690 |
+
" <td>7.440114</td>\n",
|
691 |
+
" <td>1.211054</td>\n",
|
692 |
+
" <td>11.160170</td>\n",
|
693 |
+
" <td>2.234723</td>\n",
|
694 |
+
" <td>00002.png</td>\n",
|
695 |
+
" </tr>\n",
|
696 |
+
" <tr>\n",
|
697 |
+
" <th>2</th>\n",
|
698 |
+
" <td>3</td>\n",
|
699 |
+
" <td>9.386024</td>\n",
|
700 |
+
" <td>1.308572</td>\n",
|
701 |
+
" <td>14.079037</td>\n",
|
702 |
+
" <td>2.414669</td>\n",
|
703 |
+
" <td>00003.png</td>\n",
|
704 |
+
" </tr>\n",
|
705 |
+
" <tr>\n",
|
706 |
+
" <th>3</th>\n",
|
707 |
+
" <td>4</td>\n",
|
708 |
+
" <td>16.441156</td>\n",
|
709 |
+
" <td>1.577422</td>\n",
|
710 |
+
" <td>24.661734</td>\n",
|
711 |
+
" <td>2.910770</td>\n",
|
712 |
+
" <td>00004.png</td>\n",
|
713 |
+
" </tr>\n",
|
714 |
+
" <tr>\n",
|
715 |
+
" <th>4</th>\n",
|
716 |
+
" <td>5</td>\n",
|
717 |
+
" <td>3.812784</td>\n",
|
718 |
+
" <td>0.969136</td>\n",
|
719 |
+
" <td>5.719176</td>\n",
|
720 |
+
" <td>1.788317</td>\n",
|
721 |
+
" <td>00005.png</td>\n",
|
722 |
+
" </tr>\n",
|
723 |
+
" </tbody>\n",
|
724 |
+
"</table>\n",
|
725 |
+
"</div>"
|
726 |
+
],
|
727 |
+
"text/plain": [
|
728 |
+
" iter volume_ball r_ball volume_cube edge_cube imgs\n",
|
729 |
+
"0 1 7.118523 1.193348 10.677784 2.202049 00001.png\n",
|
730 |
+
"1 2 7.440114 1.211054 11.160170 2.234723 00002.png\n",
|
731 |
+
"2 3 9.386024 1.308572 14.079037 2.414669 00003.png\n",
|
732 |
+
"3 4 16.441156 1.577422 24.661734 2.910770 00004.png\n",
|
733 |
+
"4 5 3.812784 0.969136 5.719176 1.788317 00005.png"
|
734 |
+
]
|
735 |
+
},
|
736 |
+
"metadata": {},
|
737 |
+
"output_type": "display_data"
|
738 |
+
},
|
739 |
+
{
|
740 |
+
"name": "stdout",
|
741 |
+
"output_type": "stream",
|
742 |
+
"text": [
|
743 |
+
"Shape: (10000, 6)\n",
|
744 |
+
"------------------------------------------------------------\n"
|
745 |
+
]
|
746 |
+
}
|
747 |
+
],
|
748 |
+
"source": [
|
749 |
+
"for path, df in dfs_dict.items():\n",
|
750 |
+
" print(f\"DataFrame for: {path}\")\n",
|
751 |
+
" display(df.head())\n",
|
752 |
+
" print(f\"Shape: {df.shape}\")\n",
|
753 |
+
" print(\"-\" * 60)\n",
|
754 |
+
" # if 'img_path' in df.columns:\n",
|
755 |
+
" # df = df.rename(columns={'img_path': 'imgs'})\n",
|
756 |
+
" # # Update the original CSV file\n",
|
757 |
+
" # csv_file = os.path.join(path, \"tabular.csv\")\n",
|
758 |
+
" # df.to_csv(csv_file, index=False)\n",
|
759 |
+
" # print(f\"Updated column name and saved: {csv_file}\")"
|
760 |
+
]
|
761 |
+
},
|
762 |
+
{
|
763 |
+
"cell_type": "code",
|
764 |
+
"execution_count": 41,
|
765 |
+
"id": "835862a9",
|
766 |
+
"metadata": {},
|
767 |
+
"outputs": [
|
768 |
+
{
|
769 |
+
"data": {
|
770 |
+
"text/plain": [
|
771 |
+
"{'V4_linear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V4_linear/tabular.csv'],\n",
|
772 |
+
" 'V4_v_structure_linear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V4_v_structure_linear/tabular.csv'],\n",
|
773 |
+
" 'V3_fully_connected_linear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V3_fully_connected_linear/tabular.csv'],\n",
|
774 |
+
" 'V2_linear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V2_linear/tabular.csv'],\n",
|
775 |
+
" 'V2_nonlinear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V2_nonlinear/tabular.csv'],\n",
|
776 |
+
" 'V5_linear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V5_linear/tabular.csv'],\n",
|
777 |
+
" 'V3_v_structure_nonlinear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V3_v_structure_nonlinear/tabular.csv'],\n",
|
778 |
+
" 'V3_v_structure_linear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V3_v_structure_linear/tabular.csv'],\n",
|
779 |
+
" 'V5_v_structure_nonlinear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V5_v_structure_nonlinear/tabular.csv'],\n",
|
780 |
+
" 'V5_v_structure_linear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V5_v_structure_linear/tabular.csv'],\n",
|
781 |
+
" 'V4_v_strcuture_nonlinear': ['/Users/dsl/Desktop/Causal3D_Dataset/Code/../Hypothetic/V4_v_strcuture_nonlinear/tabular.csv']}"
|
782 |
+
]
|
783 |
+
},
|
784 |
+
"execution_count": 41,
|
785 |
+
"metadata": {},
|
786 |
+
"output_type": "execute_result"
|
787 |
+
}
|
788 |
+
],
|
789 |
+
"source": [
|
790 |
+
"hy_scene_csv_paths"
|
791 |
+
]
|
792 |
+
},
|
793 |
+
{
|
794 |
+
"cell_type": "code",
|
795 |
+
"execution_count": 42,
|
796 |
+
"id": "f5d085eb",
|
797 |
+
"metadata": {},
|
798 |
+
"outputs": [
|
799 |
+
{
|
800 |
+
"name": "stdout",
|
801 |
+
"output_type": "stream",
|
802 |
+
"text": [
|
803 |
+
"Scene: V4_linear, all images exist.\n",
|
804 |
+
"Scene: V4_v_structure_linear, all images exist.\n",
|
805 |
+
"Scene: V3_fully_connected_linear, all images exist.\n",
|
806 |
+
"Scene: V2_linear, all images exist.\n",
|
807 |
+
"Scene: V2_nonlinear, all images exist.\n",
|
808 |
+
"Scene: V5_linear, all images exist.\n",
|
809 |
+
"Scene: V3_v_structure_nonlinear, all images exist.\n",
|
810 |
+
"Scene: V3_v_structure_linear, all images exist.\n",
|
811 |
+
"Scene: V5_v_structure_nonlinear, all images exist.\n",
|
812 |
+
"Scene: V5_v_structure_linear, all images exist.\n",
|
813 |
+
"Scene: V4_v_strcuture_nonlinear, all images exist.\n"
|
814 |
+
]
|
815 |
+
}
|
816 |
+
],
|
817 |
+
"source": [
|
818 |
+
"for scene, csv_paths in hy_scene_csv_paths.items():\n",
|
819 |
+
" for csv_file in csv_paths:\n",
|
820 |
+
" df = pd.read_csv(csv_file)\n",
|
821 |
+
" img_col = 'imgs' if 'imgs' in df.columns else 'img_path'\n",
|
822 |
+
" img_dir = os.path.dirname(csv_file)\n",
|
823 |
+
" missing_imgs = []\n",
|
824 |
+
" for img_file in df[img_col]:\n",
|
825 |
+
" img_path = os.path.join(img_dir, img_file)\n",
|
826 |
+
" if not os.path.exists(img_path):\n",
|
827 |
+
" missing_imgs.append(img_file)\n",
|
828 |
+
" if missing_imgs:\n",
|
829 |
+
" print(f\"Scene: {scene}, Missing images: {len(missing_imgs)}\")\n",
|
830 |
+
" print(missing_imgs[:10]) # show up to 10 missing images\n",
|
831 |
+
" else:\n",
|
832 |
+
" print(f\"Scene: {scene}, all images exist.\")"
|
833 |
+
]
|
834 |
+
}
|
835 |
+
],
|
836 |
+
"metadata": {
|
837 |
+
"kernelspec": {
|
838 |
+
"display_name": "base",
|
839 |
+
"language": "python",
|
840 |
+
"name": "python3"
|
841 |
+
},
|
842 |
+
"language_info": {
|
843 |
+
"codemirror_mode": {
|
844 |
+
"name": "ipython",
|
845 |
+
"version": 3
|
846 |
+
},
|
847 |
+
"file_extension": ".py",
|
848 |
+
"mimetype": "text/x-python",
|
849 |
+
"name": "python",
|
850 |
+
"nbconvert_exporter": "python",
|
851 |
+
"pygments_lexer": "ipython3",
|
852 |
+
"version": "3.13.2"
|
853 |
+
}
|
854 |
+
},
|
855 |
+
"nbformat": 4,
|
856 |
+
"nbformat_minor": 5
|
857 |
+
}
|
Hypothetical_V2_linear.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:821ea1b7005bf602b429a62abf7d7501a6345b24050c0c68413ac2af5f55d805
|
3 |
+
size 797636768
|
Hypothetical_V2_nonlinear.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7b860d2e64a140642e8de87a2e295ca16963539a75474110975f64f1d0e4df38
|
3 |
+
size 800066916
|
Hypothetical_V3_fully_connected_linear.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8719d474608f9f15642cf7ddda795d0bacbc701fd49ed140d68923d4e4e1eb59
|
3 |
+
size 822351161
|
Hypothetical_V3_v_structure_linear.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f3a9ca82dd5760fb7729aa022f28836ce12c5e4cfb69c037fdf2540a7a9ca2fe
|
3 |
+
size 779911922
|
Hypothetical_V3_v_structure_nonlinear.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a788325be484894ac056ac0e6ae83c79f58ceb51aa0e49d330c2aa3f990ea23c
|
3 |
+
size 782501114
|
Hypothetical_V4_linear.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5948e9a9a4331113e81893c0b194af1174f28968f270238ef1192f425bd4997a
|
3 |
+
size 825828410
|
Hypothetical_V4_v_strcuture_nonlinear.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5a6372cc5adcc3bf4d122e6ae05fee13fa4fa8fcb177d93af36f787b1ee55067
|
3 |
+
size 811083458
|
Hypothetical_V4_v_structure_linear.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2041f4fa92c7b57326babf9549a7bda94e9a0934f48bf33db645f1a1598f894f
|
3 |
+
size 807961243
|
Hypothetical_V5_linear.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:87c7ccb4a6492eae84b609193984805538adbd61f1b904d0eb08290f3f2f011f
|
3 |
+
size 809089702
|
Hypothetical_V5_v_structure_linear.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:417818cf5602914ef06dae749761a72dc9468b1e512d948067e4b0a3c8eadf1a
|
3 |
+
size 810077103
|
Hypothetical_V5_v_structure_nonlinear.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0c9f66d78b5e801976cf419986ffe5f62c57150501f71b2116903fd86f0266d5
|
3 |
+
size 810083426
|
Real_Convex_len.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e39b46a68b4ba5a4252af37a97abfc658dd637efddffc632d70cd11a2cb53f9a
|
3 |
+
size 1266758341
|
Real_Magnet.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5ba9b5da9cdab0bf6712e78c452f9d68f149a0c6d7e9dee7275cfe9d5718a49a
|
3 |
+
size 133242122
|
Real_Parabola.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:044dea8695e172d1a76b4e0023584aef358c3315ba9f9a598671dbf33ca08c0d
|
3 |
+
size 1383325161
|
Real_Pendulum.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:66ce6473481ee775e01a9015bfd9e9a7d6c872cd7fbcb7ae5cef64f7da108e80
|
3 |
+
size 712987799
|
Real_Reflection.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:df752e9f8e50b9e6232cd2b37cf6b649021dedd6856d636ac610780b5367dabc
|
3 |
+
size 790883783
|
Real_Seesaw.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a212e1e66843e607687ee175289bb8c274eca08b246f227f1389f2937e3d7ced
|
3 |
+
size 787423731
|
Real_Spring.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0c8c55d52c242e38f593135a03571e1d37b40396cb82a4ba12dd514e30713864
|
3 |
+
size 733517324
|
Real_Water_flow.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dac569760cf2b057620e7888d39dae504fcdb745f4802fbefe1eb4c2685c1b9a
|
3 |
+
size 733356836
|
zip_scene.py
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import zipfile
|
3 |
+
from pathlib import Path
|
4 |
+
|
5 |
+
def zip_folder(folder_path, output_path):
|
6 |
+
"""
|
7 |
+
压缩单个文件夹
|
8 |
+
"""
|
9 |
+
folder = Path(folder_path)
|
10 |
+
with zipfile.ZipFile(output_path, 'w', zipfile.ZIP_DEFLATED) as zipf:
|
11 |
+
for file in folder.rglob('*'):
|
12 |
+
zipf.write(file, file.relative_to(folder.parent))
|
13 |
+
print(f"✅ Zipped {folder} -> {output_path}")
|
14 |
+
|
15 |
+
def zip_all_scenes(root_dir):
|
16 |
+
"""
|
17 |
+
扫描 Real, Hypothetical, Multi_View 文件夹,自动打包每个 scene
|
18 |
+
"""
|
19 |
+
root = Path(root_dir)
|
20 |
+
categories = ["Real", "Hypothetical", "Multi_View"]
|
21 |
+
|
22 |
+
for category in categories:
|
23 |
+
category_path = root / category
|
24 |
+
if not category_path.exists():
|
25 |
+
print(f"⚠️ Skip {category}: not found")
|
26 |
+
continue
|
27 |
+
|
28 |
+
for scene in category_path.iterdir():
|
29 |
+
if scene.is_dir():
|
30 |
+
output_zip = root / f"{category}_{scene.name}.zip"
|
31 |
+
zip_folder(scene, output_zip)
|
32 |
+
|
33 |
+
if __name__ == "__main__":
|
34 |
+
# 修改为你的根目录
|
35 |
+
zip_all_scenes(".")
|
36 |
+
|
37 |
+
print("✅ All scenes zipped successfully.")
|