awoo
Browse filesSigned-off-by: Balazs Horvath <[email protected]>
dataset_tools/Create Empty caption Files for Images.ipynb
CHANGED
@@ -11,6 +11,17 @@
|
|
11 |
"text": [
|
12 |
"Caption files created successfully.\n"
|
13 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
}
|
15 |
],
|
16 |
"source": [
|
|
|
11 |
"text": [
|
12 |
"Caption files created successfully.\n"
|
13 |
]
|
14 |
+
},
|
15 |
+
{
|
16 |
+
"ename": "",
|
17 |
+
"evalue": "",
|
18 |
+
"output_type": "error",
|
19 |
+
"traceback": [
|
20 |
+
"\u001b[1;31mThe Kernel crashed while executing code in the current cell or a previous cell. \n",
|
21 |
+
"\u001b[1;31mPlease review the code in the cell(s) to identify a possible cause of the failure. \n",
|
22 |
+
"\u001b[1;31mClick <a href='https://aka.ms/vscodeJupyterKernelCrash'>here</a> for more info. \n",
|
23 |
+
"\u001b[1;31mView Jupyter <a href='command:jupyter.viewOutput'>log</a> for further details."
|
24 |
+
]
|
25 |
}
|
26 |
],
|
27 |
"source": [
|
dataset_tools/Remove Commas from Caption Files.ipynb
CHANGED
@@ -74,6 +74,17 @@
|
|
74 |
"Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\f43c0d4787a957096e96a253c3f88f99.caption\n",
|
75 |
"Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\f6d85112d49064be65f1e5a2da898ee5.caption\n"
|
76 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
}
|
78 |
],
|
79 |
"source": [
|
|
|
74 |
"Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\f43c0d4787a957096e96a253c3f88f99.caption\n",
|
75 |
"Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\f6d85112d49064be65f1e5a2da898ee5.caption\n"
|
76 |
]
|
77 |
+
},
|
78 |
+
{
|
79 |
+
"ename": "",
|
80 |
+
"evalue": "",
|
81 |
+
"output_type": "error",
|
82 |
+
"traceback": [
|
83 |
+
"\u001b[1;31mThe Kernel crashed while executing code in the current cell or a previous cell. \n",
|
84 |
+
"\u001b[1;31mPlease review the code in the cell(s) to identify a possible cause of the failure. \n",
|
85 |
+
"\u001b[1;31mClick <a href='https://aka.ms/vscodeJupyterKernelCrash'>here</a> for more info. \n",
|
86 |
+
"\u001b[1;31mView Jupyter <a href='command:jupyter.viewOutput'>log</a> for further details."
|
87 |
+
]
|
88 |
}
|
89 |
],
|
90 |
"source": [
|
dataset_tools/Search for Transparent Images.ipynb
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 3,
|
6 |
+
"metadata": {},
|
7 |
+
"outputs": [],
|
8 |
+
"source": [
|
9 |
+
"import os\n",
|
10 |
+
"from PIL import Image\n",
|
11 |
+
"\n",
|
12 |
+
"# Disable image resolution limit.\n",
|
13 |
+
"Image.MAX_IMAGE_PIXELS = None\n",
|
14 |
+
"\n",
|
15 |
+
"def find_images_with_transparency(directory):\n",
|
16 |
+
" transparent_images = []\n",
|
17 |
+
"\n",
|
18 |
+
" for root, dirs, files in os.walk(directory):\n",
|
19 |
+
" for file in files:\n",
|
20 |
+
" if file.lower().endswith(('.jpg', '.jpeg', '.png')):\n",
|
21 |
+
" file_path = os.path.join(root, file)\n",
|
22 |
+
" try:\n",
|
23 |
+
" with Image.open(file_path) as img:\n",
|
24 |
+
" if img.mode in ('RGBA', 'LA') or (img.mode == 'P' and 'transparency' in img.info):\n",
|
25 |
+
" transparent_images.append(os.path.normpath(file_path))\n",
|
26 |
+
" except Exception as e:\n",
|
27 |
+
" print(f\"Error processing {file_path}: {e}\")\n",
|
28 |
+
"\n",
|
29 |
+
" return transparent_images\n",
|
30 |
+
"\n",
|
31 |
+
"if __name__ == \"__main__\":\n",
|
32 |
+
" directory = r'E:\\training_dir'\n",
|
33 |
+
" transparent_images = find_images_with_transparency(directory)\n",
|
34 |
+
" print(\"Images with transparency:\")\n",
|
35 |
+
" for img_path in transparent_images:\n",
|
36 |
+
" print(img_path)"
|
37 |
+
]
|
38 |
+
}
|
39 |
+
],
|
40 |
+
"metadata": {
|
41 |
+
"kernelspec": {
|
42 |
+
"display_name": "Python 3",
|
43 |
+
"language": "python",
|
44 |
+
"name": "python3"
|
45 |
+
},
|
46 |
+
"language_info": {
|
47 |
+
"codemirror_mode": {
|
48 |
+
"name": "ipython",
|
49 |
+
"version": 3
|
50 |
+
},
|
51 |
+
"file_extension": ".py",
|
52 |
+
"mimetype": "text/x-python",
|
53 |
+
"name": "python",
|
54 |
+
"nbconvert_exporter": "python",
|
55 |
+
"pygments_lexer": "ipython3",
|
56 |
+
"version": "3.12.3"
|
57 |
+
}
|
58 |
+
},
|
59 |
+
"nbformat": 4,
|
60 |
+
"nbformat_minor": 2
|
61 |
+
}
|