DsL commited on
Commit
b10bc3d
·
1 Parent(s): 8923783

Remove .vscode/ and Code/ folders from remote, keep local copies

Browse files
Files changed (3) hide show
  1. .gitignore +2 -0
  2. .vscode/settings.json +0 -3
  3. Code/explore.ipynb +0 -857
.gitignore CHANGED
@@ -6,3 +6,5 @@ Multi_View/
6
  Code/
7
  zip_scene.py
8
  .gitattributes
 
 
 
6
  Code/
7
  zip_scene.py
8
  .gitattributes
9
+ .vscode/
10
+ Code/
.vscode/settings.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "python.analysis.autoImportCompletions": true
3
- }
 
 
 
 
Code/explore.ipynb DELETED
@@ -1,857 +0,0 @@
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
- }