Jordan Legg commited on
Commit
dd5f88d
1 Parent(s): 8a9855e

added dataset

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. create-video.ipynb +274 -0
  2. image_metadata_extraction.ipynb +173 -0
  3. train/02093b53-2662-47e3-81e9-954b37b7fc46.png +3 -0
  4. train/02c07a38-f236-437f-b5bb-c212e5c0a5a1.png +3 -0
  5. train/0339b37f-3bd1-4da2-8648-7db6e7db183d.png +3 -0
  6. train/033c18e7-f6a8-4498-af26-48a08374e837.png +3 -0
  7. train/039270f2-88e3-44e5-8374-d4c3646d327e.png +3 -0
  8. train/0447db9b-47d6-406e-bdb2-b679a2a0ce09.png +3 -0
  9. train/0474342f-d69a-46fa-adcd-8e131fe87109.png +3 -0
  10. train/0480c58d-b091-40b1-8d8a-4b36aca5a3e3.png +3 -0
  11. train/04c29061-946c-45d3-8a8a-716cb6d1a546.png +3 -0
  12. train/057d897b-48e0-4e64-b596-5b9d5891645e.png +3 -0
  13. train/059a3ab3-9bf8-4fb3-a67d-a4f7e49490c5.png +3 -0
  14. train/066753d2-02d7-4a45-931a-f28466d25153.png +3 -0
  15. train/06741a66-4213-4f50-bf28-e5bba80a530e.png +3 -0
  16. train/06b36c51-f062-4451-b862-3ed00fba22c9.png +3 -0
  17. train/07973684-a240-4b42-9527-1091724c2dbd.png +3 -0
  18. train/07f3d828-b371-4d1f-a917-3bbfd3d2bd63.png +3 -0
  19. train/0827c815-aecc-4ded-ba64-15cc1fad18fe.png +3 -0
  20. train/08305fb3-9b08-4255-b0af-49ff0b7ba05e.png +3 -0
  21. train/083c7a17-d890-4b74-94cb-68dff883afaf.png +3 -0
  22. train/0891b834-5f9f-4320-9d4c-7c40e3321398.png +3 -0
  23. train/0947d257-04f1-4039-937d-0cb6289eaeb2.png +3 -0
  24. train/097c9da6-0eb1-4c03-8873-82faa1e8c996.png +3 -0
  25. train/09e3d405-12e3-4618-a77a-13be8eb66af3.png +3 -0
  26. train/09e5f384-1a1d-4adf-9fb1-7d8dc13e4777.png +3 -0
  27. train/0a74339c-5547-4aa7-a2bb-494f14f8cb7d.png +3 -0
  28. train/0b263a7d-fad8-4acd-b8f5-c17236cc0573.png +3 -0
  29. train/0bf053d3-770e-49c0-9b3b-560799153013.png +3 -0
  30. train/0cc5ccfb-dfd4-420f-b9b4-f6ec6667c4f5.png +3 -0
  31. train/0d3f9c1d-2b79-4d99-9c9b-760066956b0f.png +3 -0
  32. train/0da476ce-7ac6-446a-ae45-8e5feec23f4d.png +3 -0
  33. train/0dbbc535-334f-438e-9823-56af6641856b.png +3 -0
  34. train/0dd3c67f-6c1c-4125-b008-bdc6979dd026.png +3 -0
  35. train/0ecbf570-7b7a-4b27-b6ef-fdd51f2b86d0.png +3 -0
  36. train/0eef49cf-aff3-4ac1-b3bf-dff7120af16c.png +3 -0
  37. train/0ef5bf53-5b79-4790-8887-93556bab0001.png +3 -0
  38. train/0f152466-ce71-44df-b19f-43cc4e5a588a.png +3 -0
  39. train/0f9212ad-11ff-4603-b167-11f3a47e9b1f.png +3 -0
  40. train/0fe7153b-db42-4802-8554-205671b2c77d.png +3 -0
  41. train/10963988-1ad4-4caa-b747-0aeb44e5120d.png +3 -0
  42. train/10de3b70-28fe-4f85-9965-d1a0485cadd7.png +3 -0
  43. train/11119176-b46a-4607-9930-36ffc10cc639.png +3 -0
  44. train/1136fb0d-457d-4483-bbde-12cd18594b84.png +3 -0
  45. train/116355f4-d18f-4b43-bb31-6989c9575ae1.png +3 -0
  46. train/12199e7e-366e-4029-87e8-f5c8dc1f2057.png +3 -0
  47. train/121bcfa3-26ff-4659-a64e-3113f7c95855.png +3 -0
  48. train/122430be-20ab-47c8-adaf-23d6ba5091fc.png +3 -0
  49. train/12b3ea2c-863e-46c7-9cc0-ebc77e6e9757.png +3 -0
  50. train/13b079f6-1b8a-4fc9-91f3-b5728dcf9c75.png +3 -0
create-video.ipynb ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "# Create Video!"
8
+ ]
9
+ },
10
+ {
11
+ "cell_type": "code",
12
+ "execution_count": null,
13
+ "metadata": {},
14
+ "outputs": [],
15
+ "source": [
16
+ "pip install opencv-python-headless # If you do not need GUI features\n"
17
+ ]
18
+ },
19
+ {
20
+ "cell_type": "markdown",
21
+ "metadata": {},
22
+ "source": [
23
+ "## Creating the demo\n"
24
+ ]
25
+ },
26
+ {
27
+ "cell_type": "code",
28
+ "execution_count": null,
29
+ "metadata": {},
30
+ "outputs": [],
31
+ "source": [
32
+ "import os\n",
33
+ "import subprocess\n",
34
+ "import logging\n",
35
+ "from glob import glob\n",
36
+ "import re\n",
37
+ "\n",
38
+ "# Configure logging\n",
39
+ "logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')\n",
40
+ "logger = logging.getLogger(__name__)\n",
41
+ "\n",
42
+ "def create_near_lossless_h265_video(input_folder, output_file, fps=30, frames_per_image=3, crf=10):\n",
43
+ " if not os.path.exists(input_folder):\n",
44
+ " logger.error(f\"Input folder '{input_folder}' does not exist.\")\n",
45
+ " return\n",
46
+ "\n",
47
+ " png_files = sorted(glob(os.path.join(input_folder, '*.png')))\n",
48
+ " if not png_files:\n",
49
+ " logger.error(f\"No PNG files found in {input_folder}\")\n",
50
+ " return\n",
51
+ "\n",
52
+ " num_images = len(png_files)\n",
53
+ " logger.info(f\"Found {num_images} PNG files.\")\n",
54
+ "\n",
55
+ " # Calculate expected duration\n",
56
+ " expected_duration = (num_images * frames_per_image) / fps\n",
57
+ " logger.info(f\"Expected duration: {expected_duration:.2f} seconds\")\n",
58
+ "\n",
59
+ " # FFmpeg command for near-lossless 10-bit H.265 encoding\n",
60
+ " ffmpeg_command = [\n",
61
+ " 'ffmpeg',\n",
62
+ " '-framerate', f'{1/(frames_per_image/fps)}', # Input framerate\n",
63
+ " '-i', os.path.join(input_folder, '%*.png'), # Input pattern for all PNG files\n",
64
+ " '-fps_mode', 'vfr',\n",
65
+ " '-pix_fmt', 'yuv420p10le', # 10-bit pixel format\n",
66
+ " '-c:v', 'libx265', # Use libx265 encoder\n",
67
+ " '-preset', 'slow', # Slowest preset for best compression efficiency\n",
68
+ " '-crf', str(crf), # Constant Rate Factor (0-51, lower is higher quality)\n",
69
+ " '-profile:v', 'main10', # 10-bit profile\n",
70
+ " '-x265-params', f\"log-level=error:keyint={2*fps}:min-keyint={fps}:scenecut=0\", # Ensure consistent encoding\n",
71
+ " '-tag:v', 'hvc1',\n",
72
+ " '-y',\n",
73
+ " output_file\n",
74
+ " ]\n",
75
+ "\n",
76
+ " try:\n",
77
+ " logger.info(\"Starting near-lossless 10-bit video creation...\")\n",
78
+ " process = subprocess.Popen(ffmpeg_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)\n",
79
+ " \n",
80
+ " encoding_speed = None\n",
81
+ " \n",
82
+ " for line in process.stderr:\n",
83
+ " print(line, end='') # Print FFmpeg output in real-time\n",
84
+ " \n",
85
+ " speed_match = re.search(r'speed=\\s*([\\d.]+)x', line)\n",
86
+ " if speed_match:\n",
87
+ " encoding_speed = float(speed_match.group(1))\n",
88
+ " \n",
89
+ " process.wait()\n",
90
+ " \n",
91
+ " if encoding_speed:\n",
92
+ " logger.info(f\"Encoding speed: {encoding_speed:.2f}x\")\n",
93
+ " \n",
94
+ " if process.returncode == 0:\n",
95
+ " logger.info(f\"Video created successfully: {output_file}\")\n",
96
+ " \n",
97
+ " probe_command = ['ffprobe', '-v', 'error', '-show_entries', 'stream=codec_name,width,height,duration,bit_rate,profile', '-of', 'default=noprint_wrappers=1', output_file]\n",
98
+ " probe_result = subprocess.run(probe_command, capture_output=True, text=True)\n",
99
+ " logger.info(f\"Video properties:\\n{probe_result.stdout}\")\n",
100
+ " \n",
101
+ " duration_command = ['ffprobe', '-v', 'error', '-show_entries', 'format=duration', '-of', 'default=noprint_wrappers=1:nokey=1', output_file]\n",
102
+ " duration_result = subprocess.run(duration_command, capture_output=True, text=True)\n",
103
+ " actual_duration = float(duration_result.stdout.strip())\n",
104
+ " logger.info(f\"Actual video duration: {actual_duration:.2f} seconds\")\n",
105
+ " if abs(actual_duration - expected_duration) > 1:\n",
106
+ " logger.warning(f\"Video duration mismatch. Expected: {expected_duration:.2f}, Actual: {actual_duration:.2f}\")\n",
107
+ " else:\n",
108
+ " logger.info(\"Video duration check passed.\")\n",
109
+ " else:\n",
110
+ " logger.error(f\"Error during video creation. FFmpeg returned code {process.returncode}\")\n",
111
+ "\n",
112
+ " except subprocess.CalledProcessError as e:\n",
113
+ " logger.error(f\"Error during video creation: {e}\")\n",
114
+ " logger.error(f\"FFmpeg error output:\\n{e.stderr}\")\n",
115
+ "\n",
116
+ "if __name__ == \"__main__\":\n",
117
+ " input_folder = 'train'\n",
118
+ " output_file = 'near_lossless_output.mp4'\n",
119
+ " fps = 30\n",
120
+ " frames_per_image = 3\n",
121
+ " crf = 18 # Very low CRF for near-lossless quality (0 is lossless, but often overkill)\n",
122
+ "\n",
123
+ " create_near_lossless_h265_video(input_folder, output_file, fps, frames_per_image, crf)\n"
124
+ ]
125
+ },
126
+ {
127
+ "cell_type": "markdown",
128
+ "metadata": {},
129
+ "source": [
130
+ "## Transfer File"
131
+ ]
132
+ },
133
+ {
134
+ "cell_type": "code",
135
+ "execution_count": null,
136
+ "metadata": {},
137
+ "outputs": [],
138
+ "source": [
139
+ "import os\n",
140
+ "import subprocess\n",
141
+ "import logging\n",
142
+ "from glob import glob\n",
143
+ "import re\n",
144
+ "\n",
145
+ "# Configure logging\n",
146
+ "logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')\n",
147
+ "logger = logging.getLogger(__name__)\n",
148
+ "\n",
149
+ "def create_high_quality_video(input_folder, output_file, fps=60, frames_per_image=3, codec='ffv1'):\n",
150
+ " if not os.path.exists(input_folder):\n",
151
+ " logger.error(f\"Input folder '{input_folder}' does not exist.\")\n",
152
+ " return\n",
153
+ "\n",
154
+ " png_files = sorted(glob(os.path.join(input_folder, '*.png')))\n",
155
+ " if not png_files:\n",
156
+ " logger.error(f\"No PNG files found in {input_folder}\")\n",
157
+ " return\n",
158
+ "\n",
159
+ " num_images = len(png_files)\n",
160
+ " logger.info(f\"Found {num_images} PNG files.\")\n",
161
+ "\n",
162
+ " # Calculate expected duration\n",
163
+ " expected_duration = (num_images * frames_per_image) / fps\n",
164
+ " logger.info(f\"Expected duration: {expected_duration:.2f} seconds\")\n",
165
+ "\n",
166
+ " # Base FFmpeg command\n",
167
+ " ffmpeg_command = [\n",
168
+ " 'ffmpeg',\n",
169
+ " '-framerate', f'{1/(frames_per_image/fps)}', # Input framerate\n",
170
+ " '-i', os.path.join(input_folder, '%*.png'), # Input pattern for all PNG files\n",
171
+ " '-fps_mode', 'vfr',\n",
172
+ " ]\n",
173
+ "\n",
174
+ " # Codec-specific settings\n",
175
+ " if codec == 'ffv1':\n",
176
+ " output_file = output_file.rsplit('.', 1)[0] + '.mkv' # FFV1 is typically used with MKV container\n",
177
+ " ffmpeg_command.extend([\n",
178
+ " '-c:v', 'ffv1',\n",
179
+ " '-level', '3',\n",
180
+ " '-coder', '1',\n",
181
+ " '-context', '1',\n",
182
+ " '-g', '1',\n",
183
+ " '-slices', '24',\n",
184
+ " '-slicecrc', '1'\n",
185
+ " ])\n",
186
+ " logger.info(\"Using FFV1 codec (lossless)\")\n",
187
+ " elif codec == 'prores':\n",
188
+ " output_file = output_file.rsplit('.', 1)[0] + '.mov' # ProRes is typically used with MOV container\n",
189
+ " ffmpeg_command.extend([\n",
190
+ " '-c:v', 'prores_ks',\n",
191
+ " '-profile:v', 'proxy', # Use ProRes 422 Proxy profile\n",
192
+ " '-qscale:v', '11' # Adjust quality scale; higher values mean lower quality. 11 is typical for proxy quality.\n",
193
+ "])\n",
194
+ "\n",
195
+ " logger.info(\"Using ProRes codec (near-lossless)\")\n",
196
+ " else:\n",
197
+ " logger.error(f\"Unsupported codec: {codec}\")\n",
198
+ " return\n",
199
+ "\n",
200
+ " ffmpeg_command.extend(['-y', output_file])\n",
201
+ "\n",
202
+ " try:\n",
203
+ " logger.info(f\"Starting high-quality video creation with {codec} codec...\")\n",
204
+ " process = subprocess.Popen(ffmpeg_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)\n",
205
+ " \n",
206
+ " encoding_speed = None\n",
207
+ " \n",
208
+ " for line in process.stderr:\n",
209
+ " print(line, end='') # Print FFmpeg output in real-time\n",
210
+ " \n",
211
+ " speed_match = re.search(r'speed=\\s*([\\d.]+)x', line)\n",
212
+ " if speed_match:\n",
213
+ " encoding_speed = float(speed_match.group(1))\n",
214
+ " \n",
215
+ " process.wait()\n",
216
+ " \n",
217
+ " if encoding_speed:\n",
218
+ " logger.info(f\"Encoding speed: {encoding_speed:.4f}x\")\n",
219
+ " \n",
220
+ " if process.returncode == 0:\n",
221
+ " logger.info(f\"Video created successfully: {output_file}\")\n",
222
+ " \n",
223
+ " probe_command = ['ffprobe', '-v', 'error', '-show_entries', 'stream=codec_name,width,height,duration,bit_rate', '-of', 'default=noprint_wrappers=1', output_file]\n",
224
+ " probe_result = subprocess.run(probe_command, capture_output=True, text=True)\n",
225
+ " logger.info(f\"Video properties:\\n{probe_result.stdout}\")\n",
226
+ " \n",
227
+ " duration_command = ['ffprobe', '-v', 'error', '-show_entries', 'format=duration', '-of', 'default=noprint_wrappers=1:nokey=1', output_file]\n",
228
+ " duration_result = subprocess.run(duration_command, capture_output=True, text=True)\n",
229
+ " actual_duration = float(duration_result.stdout.strip())\n",
230
+ " logger.info(f\"Actual video duration: {actual_duration:.2f} seconds\")\n",
231
+ " if abs(actual_duration - expected_duration) > 1:\n",
232
+ " logger.warning(f\"Video duration mismatch. Expected: {expected_duration:.2f}, Actual: {actual_duration:.2f}\")\n",
233
+ " else:\n",
234
+ " logger.info(\"Video duration check passed.\")\n",
235
+ " else:\n",
236
+ " logger.error(f\"Error during video creation. FFmpeg returned code {process.returncode}\")\n",
237
+ "\n",
238
+ " except subprocess.CalledProcessError as e:\n",
239
+ " logger.error(f\"Error during video creation: {e}\")\n",
240
+ " logger.error(f\"FFmpeg error output:\\n{e.stderr}\")\n",
241
+ "\n",
242
+ "if __name__ == \"__main__\":\n",
243
+ " input_folder = 'train'\n",
244
+ " output_file = 'high_quality_output.mp4'\n",
245
+ " fps = 60\n",
246
+ " frames_per_image = 3\n",
247
+ " codec = 'prores' # Options: 'ffv1' (lossless) or 'prores' (near-lossless)\n",
248
+ "\n",
249
+ " create_high_quality_video(input_folder, output_file, fps, frames_per_image, codec)"
250
+ ]
251
+ }
252
+ ],
253
+ "metadata": {
254
+ "kernelspec": {
255
+ "display_name": "Python 3",
256
+ "language": "python",
257
+ "name": "python3"
258
+ },
259
+ "language_info": {
260
+ "codemirror_mode": {
261
+ "name": "ipython",
262
+ "version": 3
263
+ },
264
+ "file_extension": ".py",
265
+ "mimetype": "text/x-python",
266
+ "name": "python",
267
+ "nbconvert_exporter": "python",
268
+ "pygments_lexer": "ipython3",
269
+ "version": "3.10.14"
270
+ }
271
+ },
272
+ "nbformat": 4,
273
+ "nbformat_minor": 2
274
+ }
image_metadata_extraction.ipynb ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "Dependencies"
8
+ ]
9
+ },
10
+ {
11
+ "cell_type": "code",
12
+ "execution_count": null,
13
+ "metadata": {},
14
+ "outputs": [],
15
+ "source": [
16
+ "pip install pillow datasets pandas pypng uuid\n"
17
+ ]
18
+ },
19
+ {
20
+ "cell_type": "markdown",
21
+ "metadata": {},
22
+ "source": [
23
+ "Preproccessing"
24
+ ]
25
+ },
26
+ {
27
+ "cell_type": "code",
28
+ "execution_count": null,
29
+ "metadata": {},
30
+ "outputs": [],
31
+ "source": [
32
+ "import os\n",
33
+ "import uuid\n",
34
+ "import shutil\n",
35
+ "\n",
36
+ "def rename_and_move_images(source_dir, target_dir):\n",
37
+ " # Create the target directory if it doesn't exist\n",
38
+ " os.makedirs(target_dir, exist_ok=True)\n",
39
+ "\n",
40
+ " # List of common image file extensions\n",
41
+ " image_extensions = ('.jpg', '.jpeg', '.png', '.gif', '.bmp', '.tiff')\n",
42
+ "\n",
43
+ " # Walk through the source directory and its subdirectories\n",
44
+ " for root, dirs, files in os.walk(source_dir):\n",
45
+ " for file in files:\n",
46
+ " # Check if the file has an image extension\n",
47
+ " if file.lower().endswith(image_extensions):\n",
48
+ " # Generate a new filename with UUID\n",
49
+ " new_filename = str(uuid.uuid4()) + os.path.splitext(file)[1]\n",
50
+ " \n",
51
+ " # Construct full file paths\n",
52
+ " old_path = os.path.join(root, file)\n",
53
+ " new_path = os.path.join(target_dir, new_filename)\n",
54
+ " \n",
55
+ " # Move and rename the file\n",
56
+ " shutil.move(old_path, new_path)\n",
57
+ " print(f\"Moved and renamed: {old_path} -> {new_path}\")\n",
58
+ "\n",
59
+ "# Usage\n",
60
+ "source_directory = \"images\"\n",
61
+ "target_directory = \"train\"\n",
62
+ "\n",
63
+ "rename_and_move_images(source_directory, target_directory)"
64
+ ]
65
+ },
66
+ {
67
+ "cell_type": "markdown",
68
+ "metadata": {},
69
+ "source": [
70
+ "Extract the Metadata"
71
+ ]
72
+ },
73
+ {
74
+ "cell_type": "code",
75
+ "execution_count": null,
76
+ "metadata": {},
77
+ "outputs": [],
78
+ "source": [
79
+ "import os\n",
80
+ "import json\n",
81
+ "import png\n",
82
+ "import pandas as pd\n",
83
+ "\n",
84
+ "# Directory containing images\n",
85
+ "image_dir = 'train'\n",
86
+ "metadata_list = []\n",
87
+ "\n",
88
+ "# Function to extract the JSON data from the tEXt chunk in PNG images\n",
89
+ "def extract_metadata_from_png(image_path):\n",
90
+ " with open(image_path, 'rb') as f:\n",
91
+ " reader = png.Reader(file=f)\n",
92
+ " chunks = reader.chunks()\n",
93
+ " for chunk_type, chunk_data in chunks:\n",
94
+ " if chunk_type == b'tEXt':\n",
95
+ " # Convert bytes to string\n",
96
+ " chunk_text = chunk_data.decode('latin1')\n",
97
+ " if 'prompt' in chunk_text:\n",
98
+ " try:\n",
99
+ " # Extract JSON string after \"prompt\\0\"\n",
100
+ " json_str = chunk_text.split('prompt\\0', 1)[1]\n",
101
+ " json_data = json.loads(json_str)\n",
102
+ " inputs = json_data.get('3', {}).get('inputs', {})\n",
103
+ " seed = inputs.get('seed', 'N/A')\n",
104
+ " positive_prompt = json_data.get('6', {}).get('inputs', {}).get('text', 'N/A')\n",
105
+ " negative_prompt = json_data.get('7', {}).get('inputs', {}).get('text', 'N/A')\n",
106
+ " model = json_data.get('4', {}).get('inputs', {}).get('ckpt_name', 'N/A')\n",
107
+ " steps = inputs.get('steps', 'N/A')\n",
108
+ " cfg = inputs.get('cfg', 'N/A')\n",
109
+ " sampler_name = inputs.get('sampler_name', 'N/A')\n",
110
+ " scheduler = inputs.get('scheduler', 'N/A')\n",
111
+ " denoise = inputs.get('denoise', 'N/A')\n",
112
+ " return {\n",
113
+ " 'seed': seed,\n",
114
+ " 'positive_prompt': positive_prompt,\n",
115
+ " 'negative_prompt': negative_prompt,\n",
116
+ " 'model': model,\n",
117
+ " 'steps': steps,\n",
118
+ " 'cfg': cfg,\n",
119
+ " 'sampler_name': sampler_name,\n",
120
+ " 'scheduler': scheduler,\n",
121
+ " 'denoise': denoise\n",
122
+ " }\n",
123
+ " except json.JSONDecodeError:\n",
124
+ " pass\n",
125
+ " return {}\n",
126
+ "\n",
127
+ "# Loop through all images in the directory\n",
128
+ "for file_name in os.listdir(image_dir):\n",
129
+ " if file_name.endswith('.png'):\n",
130
+ " image_path = os.path.join(image_dir, file_name)\n",
131
+ " metadata = extract_metadata_from_png(image_path)\n",
132
+ " metadata['file_name'] = file_name\n",
133
+ " metadata_list.append(metadata)\n",
134
+ "\n",
135
+ "# Convert metadata to DataFrame\n",
136
+ "metadata_df = pd.DataFrame(metadata_list)\n",
137
+ "\n",
138
+ "# Ensure 'file_name' is the first column\n",
139
+ "columns_order = ['file_name', 'seed', 'positive_prompt', 'negative_prompt', 'model', 'steps', 'cfg', 'sampler_name', 'scheduler', 'denoise']\n",
140
+ "metadata_df = metadata_df[columns_order]\n",
141
+ "\n",
142
+ "# Save metadata to a CSV file\n",
143
+ "metadata_csv_path = 'train/metadata.csv'\n",
144
+ "metadata_df.to_csv(metadata_csv_path, index=False)\n",
145
+ "\n",
146
+ "print(\"Metadata extraction complete. Metadata saved to:\", metadata_csv_path)\n",
147
+ "\n",
148
+ "\n"
149
+ ]
150
+ }
151
+ ],
152
+ "metadata": {
153
+ "kernelspec": {
154
+ "display_name": "Python 3",
155
+ "language": "python",
156
+ "name": "python3"
157
+ },
158
+ "language_info": {
159
+ "codemirror_mode": {
160
+ "name": "ipython",
161
+ "version": 3
162
+ },
163
+ "file_extension": ".py",
164
+ "mimetype": "text/x-python",
165
+ "name": "python",
166
+ "nbconvert_exporter": "python",
167
+ "pygments_lexer": "ipython3",
168
+ "version": "3.10.14"
169
+ }
170
+ },
171
+ "nbformat": 4,
172
+ "nbformat_minor": 2
173
+ }
train/02093b53-2662-47e3-81e9-954b37b7fc46.png ADDED

Git LFS Details

  • SHA256: fb0741a4043a58bcfaf7c2fb9a56bf4f7f556131f287c3fbd44af9e79f07fade
  • Pointer size: 131 Bytes
  • Size of remote file: 546 kB
train/02c07a38-f236-437f-b5bb-c212e5c0a5a1.png ADDED

Git LFS Details

  • SHA256: 72d5302142d6dc6e1e4d353728c940df3bb1a689b390cc81b53794dbc0c1c686
  • Pointer size: 131 Bytes
  • Size of remote file: 562 kB
train/0339b37f-3bd1-4da2-8648-7db6e7db183d.png ADDED

Git LFS Details

  • SHA256: bd1294e458eca51d3f631a49446311cdb15021352a5e82c1d46e4e37eb6bd514
  • Pointer size: 131 Bytes
  • Size of remote file: 652 kB
train/033c18e7-f6a8-4498-af26-48a08374e837.png ADDED

Git LFS Details

  • SHA256: 8bcaf808584bb24820ff929c8b5718d92a40b5ea57397b2fda4ce3183650d35b
  • Pointer size: 131 Bytes
  • Size of remote file: 582 kB
train/039270f2-88e3-44e5-8374-d4c3646d327e.png ADDED

Git LFS Details

  • SHA256: b56708ed43d2aec9f97f4c536bca96cd1fb9bc3c87f5ae1aaefa332f05f28f4d
  • Pointer size: 131 Bytes
  • Size of remote file: 617 kB
train/0447db9b-47d6-406e-bdb2-b679a2a0ce09.png ADDED

Git LFS Details

  • SHA256: 39e0111af903bdf0dbcf49ec3e841a8446b05dcfe86e0c9af4938cb880432283
  • Pointer size: 131 Bytes
  • Size of remote file: 585 kB
train/0474342f-d69a-46fa-adcd-8e131fe87109.png ADDED

Git LFS Details

  • SHA256: 1f31593fd30376a4d09a2f8031d89a14e6a0a62ab8d1caf0724f5e544fac6d43
  • Pointer size: 131 Bytes
  • Size of remote file: 594 kB
train/0480c58d-b091-40b1-8d8a-4b36aca5a3e3.png ADDED

Git LFS Details

  • SHA256: 9fb2a75571a4b2b3bbb25a7d176ff2255ce37b1196049ae2d2651da642641890
  • Pointer size: 131 Bytes
  • Size of remote file: 491 kB
train/04c29061-946c-45d3-8a8a-716cb6d1a546.png ADDED

Git LFS Details

  • SHA256: 8ac94c3a802c66a0223fdde0f9ba906ad95acd907f3021079384a246b833c65e
  • Pointer size: 131 Bytes
  • Size of remote file: 521 kB
train/057d897b-48e0-4e64-b596-5b9d5891645e.png ADDED

Git LFS Details

  • SHA256: c31de82073efd139bfb176b98b3b858c33626cd492eb8b8492cc1fefa279e0d5
  • Pointer size: 131 Bytes
  • Size of remote file: 557 kB
train/059a3ab3-9bf8-4fb3-a67d-a4f7e49490c5.png ADDED

Git LFS Details

  • SHA256: 95b9e736157aecba10af9ad00f353f5ad03998284f81130ecb664345ff018a0d
  • Pointer size: 131 Bytes
  • Size of remote file: 631 kB
train/066753d2-02d7-4a45-931a-f28466d25153.png ADDED

Git LFS Details

  • SHA256: bfb7f61f8713e412abaf53232c58b2eeb53b21cde8396dcf11c1ea5ff5c49786
  • Pointer size: 131 Bytes
  • Size of remote file: 634 kB
train/06741a66-4213-4f50-bf28-e5bba80a530e.png ADDED

Git LFS Details

  • SHA256: 2ad2cf7aded0ac27644be82e2d8a1dc2e8f26985af83a96f0711d7ed0237dc87
  • Pointer size: 131 Bytes
  • Size of remote file: 519 kB
train/06b36c51-f062-4451-b862-3ed00fba22c9.png ADDED

Git LFS Details

  • SHA256: 381d36b78b3ce6d43e2152f7c60249c5a3c94b9f304b8fae2c022ba18504392f
  • Pointer size: 131 Bytes
  • Size of remote file: 530 kB
train/07973684-a240-4b42-9527-1091724c2dbd.png ADDED

Git LFS Details

  • SHA256: 0e3452219316b2ead13c3e380d0f670bdcc42395447b526b5f3f0a2b61b6118c
  • Pointer size: 131 Bytes
  • Size of remote file: 543 kB
train/07f3d828-b371-4d1f-a917-3bbfd3d2bd63.png ADDED

Git LFS Details

  • SHA256: 54cf37fcd0c387761b2b9f0e1610de41ef3c0367749d6926d33975e8157a63e0
  • Pointer size: 131 Bytes
  • Size of remote file: 585 kB
train/0827c815-aecc-4ded-ba64-15cc1fad18fe.png ADDED

Git LFS Details

  • SHA256: 4227aca445299f3d28a539e539ee09427b55964c06c4fb8d4090dd918320eab1
  • Pointer size: 131 Bytes
  • Size of remote file: 600 kB
train/08305fb3-9b08-4255-b0af-49ff0b7ba05e.png ADDED

Git LFS Details

  • SHA256: ca31765218d65a53b82d9f2832f641c01a9e7e4942fec5d6d93bd6d7c5196e2e
  • Pointer size: 131 Bytes
  • Size of remote file: 616 kB
train/083c7a17-d890-4b74-94cb-68dff883afaf.png ADDED

Git LFS Details

  • SHA256: 3d4c38479fe230e4a7d054f9a5576ad99a7ff0fc9b0e1e6badd40f39a0534e0c
  • Pointer size: 131 Bytes
  • Size of remote file: 581 kB
train/0891b834-5f9f-4320-9d4c-7c40e3321398.png ADDED

Git LFS Details

  • SHA256: 83d8e827f0505ef63570644f3ea8c9ca624187d838bc47e02ae6a774b90c6777
  • Pointer size: 131 Bytes
  • Size of remote file: 563 kB
train/0947d257-04f1-4039-937d-0cb6289eaeb2.png ADDED

Git LFS Details

  • SHA256: 802165aed34cd23be1dfab487975718e67ac93dad1e3ac85e18d3ebecab385c5
  • Pointer size: 131 Bytes
  • Size of remote file: 586 kB
train/097c9da6-0eb1-4c03-8873-82faa1e8c996.png ADDED

Git LFS Details

  • SHA256: 14f72d29778f925ca16063b2fc08ae769d5f8b3586c128b16fa04038d2957ffc
  • Pointer size: 131 Bytes
  • Size of remote file: 505 kB
train/09e3d405-12e3-4618-a77a-13be8eb66af3.png ADDED

Git LFS Details

  • SHA256: 3e18c15bc033b5a04093afccc030c956f38e5a9f1911947df8364be6e293b3a4
  • Pointer size: 131 Bytes
  • Size of remote file: 533 kB
train/09e5f384-1a1d-4adf-9fb1-7d8dc13e4777.png ADDED

Git LFS Details

  • SHA256: 4a83c165b57a99600c672a9557f0b5c40f9025bfc71a0725d02e459e683ee3d8
  • Pointer size: 131 Bytes
  • Size of remote file: 593 kB
train/0a74339c-5547-4aa7-a2bb-494f14f8cb7d.png ADDED

Git LFS Details

  • SHA256: 404fbe69785d3d973136fc9e5a9ae2af0327aae266539be0540fbd9a4f475272
  • Pointer size: 131 Bytes
  • Size of remote file: 615 kB
train/0b263a7d-fad8-4acd-b8f5-c17236cc0573.png ADDED

Git LFS Details

  • SHA256: a207e14277553edc04100a3a305b276aecbe19c3bf6fd8a058018aff98b3ff3d
  • Pointer size: 131 Bytes
  • Size of remote file: 626 kB
train/0bf053d3-770e-49c0-9b3b-560799153013.png ADDED

Git LFS Details

  • SHA256: 5cbb605b9407d3cc2fbf244131fa6335abc4b6bfd3245fa8550b892dd14e6212
  • Pointer size: 131 Bytes
  • Size of remote file: 555 kB
train/0cc5ccfb-dfd4-420f-b9b4-f6ec6667c4f5.png ADDED

Git LFS Details

  • SHA256: 59603789af5db0a5de315a3838bf500c625cd6618c1726aab9a128e0289049c9
  • Pointer size: 131 Bytes
  • Size of remote file: 580 kB
train/0d3f9c1d-2b79-4d99-9c9b-760066956b0f.png ADDED

Git LFS Details

  • SHA256: edd890fc238efffc51526dc813cf48972d99b1d2f6c9e025fda028cad61dce4b
  • Pointer size: 131 Bytes
  • Size of remote file: 482 kB
train/0da476ce-7ac6-446a-ae45-8e5feec23f4d.png ADDED

Git LFS Details

  • SHA256: 71f86b41a89256e876a0e34d4d9647f7340a4d7856e1130466b9a0bc946521f7
  • Pointer size: 131 Bytes
  • Size of remote file: 540 kB
train/0dbbc535-334f-438e-9823-56af6641856b.png ADDED

Git LFS Details

  • SHA256: 9f8702f137e5cadac7e9e7990c4cdc77226cdb28bd49f515c76cb544204f0ffb
  • Pointer size: 131 Bytes
  • Size of remote file: 599 kB
train/0dd3c67f-6c1c-4125-b008-bdc6979dd026.png ADDED

Git LFS Details

  • SHA256: fc0880447bd9b1f76a264d212b69a81e65464ae0b23344031cffbf0f4358b199
  • Pointer size: 131 Bytes
  • Size of remote file: 576 kB
train/0ecbf570-7b7a-4b27-b6ef-fdd51f2b86d0.png ADDED

Git LFS Details

  • SHA256: 27f3d13d91937baec3a41e3fbda5e93850fde867732fd833dabbb6555f09a407
  • Pointer size: 131 Bytes
  • Size of remote file: 502 kB
train/0eef49cf-aff3-4ac1-b3bf-dff7120af16c.png ADDED

Git LFS Details

  • SHA256: 3907e25cb4e4655c3e98cf03f611d43ff2270d4012168f7bb641b61772c4e4c7
  • Pointer size: 131 Bytes
  • Size of remote file: 512 kB
train/0ef5bf53-5b79-4790-8887-93556bab0001.png ADDED

Git LFS Details

  • SHA256: 6c3f076395be605708ffac9e5fe7df45927b8b45892aea1b66646e4cdf8aad47
  • Pointer size: 131 Bytes
  • Size of remote file: 498 kB
train/0f152466-ce71-44df-b19f-43cc4e5a588a.png ADDED

Git LFS Details

  • SHA256: 9dc15100b9355733be53c0929f50ebf82fc2e364f84cd550dacec618cbf8aca2
  • Pointer size: 131 Bytes
  • Size of remote file: 557 kB
train/0f9212ad-11ff-4603-b167-11f3a47e9b1f.png ADDED

Git LFS Details

  • SHA256: 3ce0bfdd4b8ad66884cb92c38af9e7549d0d3151f1a68efb991444b5c9969b06
  • Pointer size: 131 Bytes
  • Size of remote file: 589 kB
train/0fe7153b-db42-4802-8554-205671b2c77d.png ADDED

Git LFS Details

  • SHA256: 1f7be9ed9c1146d3a6332632dd4cba8d2ddbee3c39fef34ec8c3fc102d11e660
  • Pointer size: 131 Bytes
  • Size of remote file: 625 kB
train/10963988-1ad4-4caa-b747-0aeb44e5120d.png ADDED

Git LFS Details

  • SHA256: 5c7970f5a112eae2f8ad865dd6419e20f85ba628250963150aa5a2558c58670d
  • Pointer size: 131 Bytes
  • Size of remote file: 527 kB
train/10de3b70-28fe-4f85-9965-d1a0485cadd7.png ADDED

Git LFS Details

  • SHA256: 2eb9b59e0bd7e13dd1015cd8fce5f34089b17f18537f18dbed203b9ab43ba79e
  • Pointer size: 131 Bytes
  • Size of remote file: 592 kB
train/11119176-b46a-4607-9930-36ffc10cc639.png ADDED

Git LFS Details

  • SHA256: 9d4ec77b338657b875164abd166effadb63f150fe888a5edc4315e93724336c6
  • Pointer size: 131 Bytes
  • Size of remote file: 601 kB
train/1136fb0d-457d-4483-bbde-12cd18594b84.png ADDED

Git LFS Details

  • SHA256: 57c84a608864ddfe400ae19160de10cca2809b1ed4db928081bf8e4d4dba1a4c
  • Pointer size: 131 Bytes
  • Size of remote file: 580 kB
train/116355f4-d18f-4b43-bb31-6989c9575ae1.png ADDED

Git LFS Details

  • SHA256: ca5eb25abce3a3c66b7bed92ce2ae3f7975b977957f05c51b2c62d02f90bbcd6
  • Pointer size: 131 Bytes
  • Size of remote file: 532 kB
train/12199e7e-366e-4029-87e8-f5c8dc1f2057.png ADDED

Git LFS Details

  • SHA256: 0181d7a8a07b09ba81fb604348f77ebc3f8415c49608566b68cf38541a08d50e
  • Pointer size: 131 Bytes
  • Size of remote file: 457 kB
train/121bcfa3-26ff-4659-a64e-3113f7c95855.png ADDED

Git LFS Details

  • SHA256: 178d30aa0d62fce16a98b81d7bbe033172755e301aa3ab4b550ccb1c1a084711
  • Pointer size: 131 Bytes
  • Size of remote file: 559 kB
train/122430be-20ab-47c8-adaf-23d6ba5091fc.png ADDED

Git LFS Details

  • SHA256: 786ccb3a3d7bb4a2aead3395def4d2be1607391c52008739cc46f3fd648524d3
  • Pointer size: 131 Bytes
  • Size of remote file: 552 kB
train/12b3ea2c-863e-46c7-9cc0-ebc77e6e9757.png ADDED

Git LFS Details

  • SHA256: f2cfb285d2d7956faedb22e2b700a22ca561fbcf6ac22df8c8cbd7fd4a57024a
  • Pointer size: 131 Bytes
  • Size of remote file: 512 kB
train/13b079f6-1b8a-4fc9-91f3-b5728dcf9c75.png ADDED

Git LFS Details

  • SHA256: 2a4ce2a43c45b7bd47e8c237c3b8bdc74b2a763b9263db1ae82c8a98e635d75b
  • Pointer size: 131 Bytes
  • Size of remote file: 547 kB