Delete part1 (1).ipynb
Browse files- part1 (1).ipynb +0 -957
part1 (1).ipynb
DELETED
|
@@ -1,957 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"nbformat": 4,
|
| 3 |
-
"nbformat_minor": 0,
|
| 4 |
-
"metadata": {
|
| 5 |
-
"colab": {
|
| 6 |
-
"provenance": [],
|
| 7 |
-
"gpuType": "T4"
|
| 8 |
-
},
|
| 9 |
-
"kernelspec": {
|
| 10 |
-
"name": "python3",
|
| 11 |
-
"display_name": "Python 3"
|
| 12 |
-
},
|
| 13 |
-
"language_info": {
|
| 14 |
-
"name": "python"
|
| 15 |
-
},
|
| 16 |
-
"accelerator": "GPU"
|
| 17 |
-
},
|
| 18 |
-
"cells": [
|
| 19 |
-
{
|
| 20 |
-
"cell_type": "code",
|
| 21 |
-
"execution_count": null,
|
| 22 |
-
"metadata": {
|
| 23 |
-
"colab": {
|
| 24 |
-
"base_uri": "https://localhost:8080/"
|
| 25 |
-
},
|
| 26 |
-
"id": "_Q4gIvePGw85",
|
| 27 |
-
"outputId": "21debd12-2d0d-43d4-9f0b-e79430f9a832"
|
| 28 |
-
},
|
| 29 |
-
"outputs": [
|
| 30 |
-
{
|
| 31 |
-
"output_type": "stream",
|
| 32 |
-
"name": "stdout",
|
| 33 |
-
"text": [
|
| 34 |
-
"Mounted at /content/drive\n",
|
| 35 |
-
"/content\n",
|
| 36 |
-
" AssemblyTask\n",
|
| 37 |
-
" BOOKS\n",
|
| 38 |
-
" car2.jpg\n",
|
| 39 |
-
" car.jpg\n",
|
| 40 |
-
"'Colab Notebooks'\n",
|
| 41 |
-
"'Copy of جدول الفرقة الثانية - عام - مج ٢.pdf.pdf'\n",
|
| 42 |
-
"'Coursera N24TOG3ZARUP.pdf'\n",
|
| 43 |
-
" Grades\n",
|
| 44 |
-
"'graphicsTask (2).png'\n",
|
| 45 |
-
"'graphicsTask (2).svg'\n",
|
| 46 |
-
" IMG_4899.jpeg\n",
|
| 47 |
-
" IMG_4900.jpeg\n",
|
| 48 |
-
" IMG_4901.jpeg\n",
|
| 49 |
-
" IMG_5986.jpeg\n",
|
| 50 |
-
" InternVideo.mp4\n",
|
| 51 |
-
" LOOPS.gslides\n",
|
| 52 |
-
" NTI-PRJCT\n",
|
| 53 |
-
"'Session 6 .gdoc'\n",
|
| 54 |
-
" SWEProject.drawio\n",
|
| 55 |
-
" Task2.rar\n",
|
| 56 |
-
"\"The _Animator's_Survival_Kit.pdf\"\n",
|
| 57 |
-
"'Untitled Diagram'\n",
|
| 58 |
-
"'Untitled document (1).gdoc'\n",
|
| 59 |
-
"'Untitled document.gdoc'\n",
|
| 60 |
-
" Wahb_CV.pdf\n",
|
| 61 |
-
"'WhatsApp Image 2024-09-28 at 18.11.27_5e5ce6c9.jpg'\n",
|
| 62 |
-
"'WhatsApp Image 2024-09-28 at 18.45.13_fd438e9f.jpg'\n",
|
| 63 |
-
"'WhatsApp Image 2025-05-28 at 15.11 (1).24_84c876ae.jpg'\n",
|
| 64 |
-
"'WhatsApp Image 2025-05-28 at 15.11.24_84c876ae.jpg'\n"
|
| 65 |
-
]
|
| 66 |
-
}
|
| 67 |
-
],
|
| 68 |
-
"source": [
|
| 69 |
-
"from google.colab import drive\n",
|
| 70 |
-
"drive.mount('/content/drive')\n",
|
| 71 |
-
"\n",
|
| 72 |
-
"import os\n",
|
| 73 |
-
"print(os.getcwd())\n",
|
| 74 |
-
"\n",
|
| 75 |
-
"!ls /content/drive/MyDrive/"
|
| 76 |
-
]
|
| 77 |
-
},
|
| 78 |
-
{
|
| 79 |
-
"cell_type": "code",
|
| 80 |
-
"source": [
|
| 81 |
-
"from google.colab import files\n",
|
| 82 |
-
"files.upload()\n",
|
| 83 |
-
"\n",
|
| 84 |
-
"!pip install kaggle\n",
|
| 85 |
-
"\n",
|
| 86 |
-
"!mkdir -p ~/.kaggle\n",
|
| 87 |
-
"!cp kaggle.json ~/.kaggle/\n",
|
| 88 |
-
"!chmod 600 ~/.kaggle/kaggle.json\n",
|
| 89 |
-
"\n",
|
| 90 |
-
"!kaggle datasets download -d dagnelies/deepfake-faces\n",
|
| 91 |
-
"!unzip -q deepfake-faces.zip -d deepfake_faces\n"
|
| 92 |
-
],
|
| 93 |
-
"metadata": {
|
| 94 |
-
"colab": {
|
| 95 |
-
"base_uri": "https://localhost:8080/",
|
| 96 |
-
"height": 440
|
| 97 |
-
},
|
| 98 |
-
"id": "7Emqe4aNG7Ak",
|
| 99 |
-
"outputId": "769def2b-ae6c-491e-8cf3-57c4b1e678d4"
|
| 100 |
-
},
|
| 101 |
-
"execution_count": null,
|
| 102 |
-
"outputs": [
|
| 103 |
-
{
|
| 104 |
-
"output_type": "display_data",
|
| 105 |
-
"data": {
|
| 106 |
-
"text/plain": [
|
| 107 |
-
"<IPython.core.display.HTML object>"
|
| 108 |
-
],
|
| 109 |
-
"text/html": [
|
| 110 |
-
"\n",
|
| 111 |
-
" <input type=\"file\" id=\"files-f634150d-7f42-49fc-8650-c73cced50986\" name=\"files[]\" multiple disabled\n",
|
| 112 |
-
" style=\"border:none\" />\n",
|
| 113 |
-
" <output id=\"result-f634150d-7f42-49fc-8650-c73cced50986\">\n",
|
| 114 |
-
" Upload widget is only available when the cell has been executed in the\n",
|
| 115 |
-
" current browser session. Please rerun this cell to enable.\n",
|
| 116 |
-
" </output>\n",
|
| 117 |
-
" <script>// Copyright 2017 Google LLC\n",
|
| 118 |
-
"//\n",
|
| 119 |
-
"// Licensed under the Apache License, Version 2.0 (the \"License\");\n",
|
| 120 |
-
"// you may not use this file except in compliance with the License.\n",
|
| 121 |
-
"// You may obtain a copy of the License at\n",
|
| 122 |
-
"//\n",
|
| 123 |
-
"// http://www.apache.org/licenses/LICENSE-2.0\n",
|
| 124 |
-
"//\n",
|
| 125 |
-
"// Unless required by applicable law or agreed to in writing, software\n",
|
| 126 |
-
"// distributed under the License is distributed on an \"AS IS\" BASIS,\n",
|
| 127 |
-
"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
|
| 128 |
-
"// See the License for the specific language governing permissions and\n",
|
| 129 |
-
"// limitations under the License.\n",
|
| 130 |
-
"\n",
|
| 131 |
-
"/**\n",
|
| 132 |
-
" * @fileoverview Helpers for google.colab Python module.\n",
|
| 133 |
-
" */\n",
|
| 134 |
-
"(function(scope) {\n",
|
| 135 |
-
"function span(text, styleAttributes = {}) {\n",
|
| 136 |
-
" const element = document.createElement('span');\n",
|
| 137 |
-
" element.textContent = text;\n",
|
| 138 |
-
" for (const key of Object.keys(styleAttributes)) {\n",
|
| 139 |
-
" element.style[key] = styleAttributes[key];\n",
|
| 140 |
-
" }\n",
|
| 141 |
-
" return element;\n",
|
| 142 |
-
"}\n",
|
| 143 |
-
"\n",
|
| 144 |
-
"// Max number of bytes which will be uploaded at a time.\n",
|
| 145 |
-
"const MAX_PAYLOAD_SIZE = 100 * 1024;\n",
|
| 146 |
-
"\n",
|
| 147 |
-
"function _uploadFiles(inputId, outputId) {\n",
|
| 148 |
-
" const steps = uploadFilesStep(inputId, outputId);\n",
|
| 149 |
-
" const outputElement = document.getElementById(outputId);\n",
|
| 150 |
-
" // Cache steps on the outputElement to make it available for the next call\n",
|
| 151 |
-
" // to uploadFilesContinue from Python.\n",
|
| 152 |
-
" outputElement.steps = steps;\n",
|
| 153 |
-
"\n",
|
| 154 |
-
" return _uploadFilesContinue(outputId);\n",
|
| 155 |
-
"}\n",
|
| 156 |
-
"\n",
|
| 157 |
-
"// This is roughly an async generator (not supported in the browser yet),\n",
|
| 158 |
-
"// where there are multiple asynchronous steps and the Python side is going\n",
|
| 159 |
-
"// to poll for completion of each step.\n",
|
| 160 |
-
"// This uses a Promise to block the python side on completion of each step,\n",
|
| 161 |
-
"// then passes the result of the previous step as the input to the next step.\n",
|
| 162 |
-
"function _uploadFilesContinue(outputId) {\n",
|
| 163 |
-
" const outputElement = document.getElementById(outputId);\n",
|
| 164 |
-
" const steps = outputElement.steps;\n",
|
| 165 |
-
"\n",
|
| 166 |
-
" const next = steps.next(outputElement.lastPromiseValue);\n",
|
| 167 |
-
" return Promise.resolve(next.value.promise).then((value) => {\n",
|
| 168 |
-
" // Cache the last promise value to make it available to the next\n",
|
| 169 |
-
" // step of the generator.\n",
|
| 170 |
-
" outputElement.lastPromiseValue = value;\n",
|
| 171 |
-
" return next.value.response;\n",
|
| 172 |
-
" });\n",
|
| 173 |
-
"}\n",
|
| 174 |
-
"\n",
|
| 175 |
-
"/**\n",
|
| 176 |
-
" * Generator function which is called between each async step of the upload\n",
|
| 177 |
-
" * process.\n",
|
| 178 |
-
" * @param {string} inputId Element ID of the input file picker element.\n",
|
| 179 |
-
" * @param {string} outputId Element ID of the output display.\n",
|
| 180 |
-
" * @return {!Iterable<!Object>} Iterable of next steps.\n",
|
| 181 |
-
" */\n",
|
| 182 |
-
"function* uploadFilesStep(inputId, outputId) {\n",
|
| 183 |
-
" const inputElement = document.getElementById(inputId);\n",
|
| 184 |
-
" inputElement.disabled = false;\n",
|
| 185 |
-
"\n",
|
| 186 |
-
" const outputElement = document.getElementById(outputId);\n",
|
| 187 |
-
" outputElement.innerHTML = '';\n",
|
| 188 |
-
"\n",
|
| 189 |
-
" const pickedPromise = new Promise((resolve) => {\n",
|
| 190 |
-
" inputElement.addEventListener('change', (e) => {\n",
|
| 191 |
-
" resolve(e.target.files);\n",
|
| 192 |
-
" });\n",
|
| 193 |
-
" });\n",
|
| 194 |
-
"\n",
|
| 195 |
-
" const cancel = document.createElement('button');\n",
|
| 196 |
-
" inputElement.parentElement.appendChild(cancel);\n",
|
| 197 |
-
" cancel.textContent = 'Cancel upload';\n",
|
| 198 |
-
" const cancelPromise = new Promise((resolve) => {\n",
|
| 199 |
-
" cancel.onclick = () => {\n",
|
| 200 |
-
" resolve(null);\n",
|
| 201 |
-
" };\n",
|
| 202 |
-
" });\n",
|
| 203 |
-
"\n",
|
| 204 |
-
" // Wait for the user to pick the files.\n",
|
| 205 |
-
" const files = yield {\n",
|
| 206 |
-
" promise: Promise.race([pickedPromise, cancelPromise]),\n",
|
| 207 |
-
" response: {\n",
|
| 208 |
-
" action: 'starting',\n",
|
| 209 |
-
" }\n",
|
| 210 |
-
" };\n",
|
| 211 |
-
"\n",
|
| 212 |
-
" cancel.remove();\n",
|
| 213 |
-
"\n",
|
| 214 |
-
" // Disable the input element since further picks are not allowed.\n",
|
| 215 |
-
" inputElement.disabled = true;\n",
|
| 216 |
-
"\n",
|
| 217 |
-
" if (!files) {\n",
|
| 218 |
-
" return {\n",
|
| 219 |
-
" response: {\n",
|
| 220 |
-
" action: 'complete',\n",
|
| 221 |
-
" }\n",
|
| 222 |
-
" };\n",
|
| 223 |
-
" }\n",
|
| 224 |
-
"\n",
|
| 225 |
-
" for (const file of files) {\n",
|
| 226 |
-
" const li = document.createElement('li');\n",
|
| 227 |
-
" li.append(span(file.name, {fontWeight: 'bold'}));\n",
|
| 228 |
-
" li.append(span(\n",
|
| 229 |
-
" `(${file.type || 'n/a'}) - ${file.size} bytes, ` +\n",
|
| 230 |
-
" `last modified: ${\n",
|
| 231 |
-
" file.lastModifiedDate ? file.lastModifiedDate.toLocaleDateString() :\n",
|
| 232 |
-
" 'n/a'} - `));\n",
|
| 233 |
-
" const percent = span('0% done');\n",
|
| 234 |
-
" li.appendChild(percent);\n",
|
| 235 |
-
"\n",
|
| 236 |
-
" outputElement.appendChild(li);\n",
|
| 237 |
-
"\n",
|
| 238 |
-
" const fileDataPromise = new Promise((resolve) => {\n",
|
| 239 |
-
" const reader = new FileReader();\n",
|
| 240 |
-
" reader.onload = (e) => {\n",
|
| 241 |
-
" resolve(e.target.result);\n",
|
| 242 |
-
" };\n",
|
| 243 |
-
" reader.readAsArrayBuffer(file);\n",
|
| 244 |
-
" });\n",
|
| 245 |
-
" // Wait for the data to be ready.\n",
|
| 246 |
-
" let fileData = yield {\n",
|
| 247 |
-
" promise: fileDataPromise,\n",
|
| 248 |
-
" response: {\n",
|
| 249 |
-
" action: 'continue',\n",
|
| 250 |
-
" }\n",
|
| 251 |
-
" };\n",
|
| 252 |
-
"\n",
|
| 253 |
-
" // Use a chunked sending to avoid message size limits. See b/62115660.\n",
|
| 254 |
-
" let position = 0;\n",
|
| 255 |
-
" do {\n",
|
| 256 |
-
" const length = Math.min(fileData.byteLength - position, MAX_PAYLOAD_SIZE);\n",
|
| 257 |
-
" const chunk = new Uint8Array(fileData, position, length);\n",
|
| 258 |
-
" position += length;\n",
|
| 259 |
-
"\n",
|
| 260 |
-
" const base64 = btoa(String.fromCharCode.apply(null, chunk));\n",
|
| 261 |
-
" yield {\n",
|
| 262 |
-
" response: {\n",
|
| 263 |
-
" action: 'append',\n",
|
| 264 |
-
" file: file.name,\n",
|
| 265 |
-
" data: base64,\n",
|
| 266 |
-
" },\n",
|
| 267 |
-
" };\n",
|
| 268 |
-
"\n",
|
| 269 |
-
" let percentDone = fileData.byteLength === 0 ?\n",
|
| 270 |
-
" 100 :\n",
|
| 271 |
-
" Math.round((position / fileData.byteLength) * 100);\n",
|
| 272 |
-
" percent.textContent = `${percentDone}% done`;\n",
|
| 273 |
-
"\n",
|
| 274 |
-
" } while (position < fileData.byteLength);\n",
|
| 275 |
-
" }\n",
|
| 276 |
-
"\n",
|
| 277 |
-
" // All done.\n",
|
| 278 |
-
" yield {\n",
|
| 279 |
-
" response: {\n",
|
| 280 |
-
" action: 'complete',\n",
|
| 281 |
-
" }\n",
|
| 282 |
-
" };\n",
|
| 283 |
-
"}\n",
|
| 284 |
-
"\n",
|
| 285 |
-
"scope.google = scope.google || {};\n",
|
| 286 |
-
"scope.google.colab = scope.google.colab || {};\n",
|
| 287 |
-
"scope.google.colab._files = {\n",
|
| 288 |
-
" _uploadFiles,\n",
|
| 289 |
-
" _uploadFilesContinue,\n",
|
| 290 |
-
"};\n",
|
| 291 |
-
"})(self);\n",
|
| 292 |
-
"</script> "
|
| 293 |
-
]
|
| 294 |
-
},
|
| 295 |
-
"metadata": {}
|
| 296 |
-
},
|
| 297 |
-
{
|
| 298 |
-
"output_type": "stream",
|
| 299 |
-
"name": "stdout",
|
| 300 |
-
"text": [
|
| 301 |
-
"Saving kaggle.json to kaggle.json\n",
|
| 302 |
-
"Requirement already satisfied: kaggle in /usr/local/lib/python3.11/dist-packages (1.7.4.5)\n",
|
| 303 |
-
"Requirement already satisfied: bleach in /usr/local/lib/python3.11/dist-packages (from kaggle) (6.2.0)\n",
|
| 304 |
-
"Requirement already satisfied: certifi>=14.05.14 in /usr/local/lib/python3.11/dist-packages (from kaggle) (2025.8.3)\n",
|
| 305 |
-
"Requirement already satisfied: charset-normalizer in /usr/local/lib/python3.11/dist-packages (from kaggle) (3.4.3)\n",
|
| 306 |
-
"Requirement already satisfied: idna in /usr/local/lib/python3.11/dist-packages (from kaggle) (3.10)\n",
|
| 307 |
-
"Requirement already satisfied: protobuf in /usr/local/lib/python3.11/dist-packages (from kaggle) (5.29.5)\n",
|
| 308 |
-
"Requirement already satisfied: python-dateutil>=2.5.3 in /usr/local/lib/python3.11/dist-packages (from kaggle) (2.9.0.post0)\n",
|
| 309 |
-
"Requirement already satisfied: python-slugify in /usr/local/lib/python3.11/dist-packages (from kaggle) (8.0.4)\n",
|
| 310 |
-
"Requirement already satisfied: requests in /usr/local/lib/python3.11/dist-packages (from kaggle) (2.32.3)\n",
|
| 311 |
-
"Requirement already satisfied: setuptools>=21.0.0 in /usr/local/lib/python3.11/dist-packages (from kaggle) (75.2.0)\n",
|
| 312 |
-
"Requirement already satisfied: six>=1.10 in /usr/local/lib/python3.11/dist-packages (from kaggle) (1.17.0)\n",
|
| 313 |
-
"Requirement already satisfied: text-unidecode in /usr/local/lib/python3.11/dist-packages (from kaggle) (1.3)\n",
|
| 314 |
-
"Requirement already satisfied: tqdm in /usr/local/lib/python3.11/dist-packages (from kaggle) (4.67.1)\n",
|
| 315 |
-
"Requirement already satisfied: urllib3>=1.15.1 in /usr/local/lib/python3.11/dist-packages (from kaggle) (2.5.0)\n",
|
| 316 |
-
"Requirement already satisfied: webencodings in /usr/local/lib/python3.11/dist-packages (from kaggle) (0.5.1)\n",
|
| 317 |
-
"Dataset URL: https://www.kaggle.com/datasets/dagnelies/deepfake-faces\n",
|
| 318 |
-
"License(s): other\n",
|
| 319 |
-
"Downloading deepfake-faces.zip to /content\n",
|
| 320 |
-
" 96% 416M/433M [00:00<00:00, 447MB/s]\n",
|
| 321 |
-
"100% 433M/433M [00:00<00:00, 516MB/s]\n"
|
| 322 |
-
]
|
| 323 |
-
}
|
| 324 |
-
]
|
| 325 |
-
},
|
| 326 |
-
{
|
| 327 |
-
"cell_type": "code",
|
| 328 |
-
"source": [
|
| 329 |
-
"import numpy as np\n",
|
| 330 |
-
"import matplotlib.pyplot as plt\n",
|
| 331 |
-
"import pandas as pd\n",
|
| 332 |
-
"import seaborn as sns\n",
|
| 333 |
-
"import plotly.graph_objects as go\n",
|
| 334 |
-
"from plotly.offline import iplot\n",
|
| 335 |
-
"import tensorflow as tf\n",
|
| 336 |
-
"from sklearn.model_selection import train_test_split\n",
|
| 337 |
-
"import cv2"
|
| 338 |
-
],
|
| 339 |
-
"metadata": {
|
| 340 |
-
"id": "sgQ6ibXHHCAd"
|
| 341 |
-
},
|
| 342 |
-
"execution_count": null,
|
| 343 |
-
"outputs": []
|
| 344 |
-
},
|
| 345 |
-
{
|
| 346 |
-
"cell_type": "code",
|
| 347 |
-
"source": [
|
| 348 |
-
"meta = pd.read_csv('/content/deepfake_faces/metadata.csv')\n",
|
| 349 |
-
"print(meta.head())"
|
| 350 |
-
],
|
| 351 |
-
"metadata": {
|
| 352 |
-
"colab": {
|
| 353 |
-
"base_uri": "https://localhost:8080/"
|
| 354 |
-
},
|
| 355 |
-
"id": "HRchwl81HEiU",
|
| 356 |
-
"outputId": "efb7634a-6f85-4be3-ed9e-be16005c75b4"
|
| 357 |
-
},
|
| 358 |
-
"execution_count": null,
|
| 359 |
-
"outputs": [
|
| 360 |
-
{
|
| 361 |
-
"output_type": "stream",
|
| 362 |
-
"name": "stdout",
|
| 363 |
-
"text": [
|
| 364 |
-
" videoname original_width original_height label original\n",
|
| 365 |
-
"0 aznyksihgl.mp4 129 129 FAKE xnojggkrxt.mp4\n",
|
| 366 |
-
"1 gkwmalrvcj.mp4 129 129 FAKE hqqmtxvbjj.mp4\n",
|
| 367 |
-
"2 lxnqzocgaq.mp4 223 217 FAKE xjzkfqddyk.mp4\n",
|
| 368 |
-
"3 itsbtrrelv.mp4 186 186 FAKE kqvepwqxfe.mp4\n",
|
| 369 |
-
"4 ddvgrczjno.mp4 155 155 FAKE pluadmqqta.mp4\n"
|
| 370 |
-
]
|
| 371 |
-
}
|
| 372 |
-
]
|
| 373 |
-
},
|
| 374 |
-
{
|
| 375 |
-
"cell_type": "code",
|
| 376 |
-
"source": [
|
| 377 |
-
"def summary(df):\n",
|
| 378 |
-
" summary_df = pd.DataFrame(df.dtypes, columns=['dtypes'])\n",
|
| 379 |
-
" summary_df['count'] = df.count().values\n",
|
| 380 |
-
" summary_df['unique'] = df.nunique().values\n",
|
| 381 |
-
" summary_df['missing#'] = df.isna().sum()\n",
|
| 382 |
-
" summary_df['missing%'] = df.isna().sum() / len(df)\n",
|
| 383 |
-
" return summary_df"
|
| 384 |
-
],
|
| 385 |
-
"metadata": {
|
| 386 |
-
"id": "8da4BT5CHGVz"
|
| 387 |
-
},
|
| 388 |
-
"execution_count": null,
|
| 389 |
-
"outputs": []
|
| 390 |
-
},
|
| 391 |
-
{
|
| 392 |
-
"cell_type": "code",
|
| 393 |
-
"source": [
|
| 394 |
-
"print(summary(meta).style.background_gradient('Purples'))\n",
|
| 395 |
-
"\n",
|
| 396 |
-
"print('Fake Images:', len(meta[meta.label=='FAKE']))\n",
|
| 397 |
-
"print('Real Images:', len(meta[meta.label=='REAL']))\n"
|
| 398 |
-
],
|
| 399 |
-
"metadata": {
|
| 400 |
-
"colab": {
|
| 401 |
-
"base_uri": "https://localhost:8080/"
|
| 402 |
-
},
|
| 403 |
-
"id": "SaZKTtqFHKQM",
|
| 404 |
-
"outputId": "088c301f-1b19-40c9-f210-d09baea550d8"
|
| 405 |
-
},
|
| 406 |
-
"execution_count": null,
|
| 407 |
-
"outputs": [
|
| 408 |
-
{
|
| 409 |
-
"output_type": "stream",
|
| 410 |
-
"name": "stdout",
|
| 411 |
-
"text": [
|
| 412 |
-
"<pandas.io.formats.style.Styler object at 0x7dae5a9e74d0>\n",
|
| 413 |
-
"Fake Images: 79341\n",
|
| 414 |
-
"Real Images: 16293\n"
|
| 415 |
-
]
|
| 416 |
-
}
|
| 417 |
-
]
|
| 418 |
-
},
|
| 419 |
-
{
|
| 420 |
-
"cell_type": "code",
|
| 421 |
-
"source": [
|
| 422 |
-
"# Sample balanced dataset\n",
|
| 423 |
-
"real_df = meta[meta['label'] == 'REAL']\n",
|
| 424 |
-
"fake_df = meta[meta['label'] == 'FAKE']\n",
|
| 425 |
-
"sample_size = 16000\n",
|
| 426 |
-
"\n",
|
| 427 |
-
"real_df = real_df.sample(sample_size, random_state=42)\n",
|
| 428 |
-
"fake_df = fake_df.sample(sample_size, random_state=42)\n",
|
| 429 |
-
"\n",
|
| 430 |
-
"sample_meta = pd.concat([real_df, fake_df])"
|
| 431 |
-
],
|
| 432 |
-
"metadata": {
|
| 433 |
-
"id": "9m8dhK0ZHP8c"
|
| 434 |
-
},
|
| 435 |
-
"execution_count": null,
|
| 436 |
-
"outputs": []
|
| 437 |
-
},
|
| 438 |
-
{
|
| 439 |
-
"cell_type": "code",
|
| 440 |
-
"source": [
|
| 441 |
-
"sample_meta['filepath'] = '/content/deepfake_faces/faces_224/' + sample_meta['videoname'].str[:-4] + '.jpg'\n",
|
| 442 |
-
"\n",
|
| 443 |
-
"# Split the data\n",
|
| 444 |
-
"Train_set, temp_df = train_test_split(sample_meta, test_size=0.2, random_state=42, stratify=sample_meta['label'])\n",
|
| 445 |
-
"Val_set, Test_set = train_test_split(temp_df, test_size=0.5, random_state=42, stratify=temp_df['label'])\n",
|
| 446 |
-
"\n",
|
| 447 |
-
"print(f'Train Set: {Train_set.shape}')\n",
|
| 448 |
-
"print(f'Validation Set: {Val_set.shape}')\n",
|
| 449 |
-
"print(f'Test Set: {Test_set.shape}')"
|
| 450 |
-
],
|
| 451 |
-
"metadata": {
|
| 452 |
-
"colab": {
|
| 453 |
-
"base_uri": "https://localhost:8080/"
|
| 454 |
-
},
|
| 455 |
-
"id": "bL62yOEcHWqE",
|
| 456 |
-
"outputId": "1a8042a4-0115-4821-b4b7-077b1bcbaf35"
|
| 457 |
-
},
|
| 458 |
-
"execution_count": null,
|
| 459 |
-
"outputs": [
|
| 460 |
-
{
|
| 461 |
-
"output_type": "stream",
|
| 462 |
-
"name": "stdout",
|
| 463 |
-
"text": [
|
| 464 |
-
"Train Set: (25600, 6)\n",
|
| 465 |
-
"Validation Set: (3200, 6)\n",
|
| 466 |
-
"Test Set: (3200, 6)\n"
|
| 467 |
-
]
|
| 468 |
-
}
|
| 469 |
-
]
|
| 470 |
-
},
|
| 471 |
-
{
|
| 472 |
-
"cell_type": "code",
|
| 473 |
-
"source": [
|
| 474 |
-
"data_augmentation = tf.keras.Sequential([\n",
|
| 475 |
-
" tf.keras.layers.RandomFlip(\"horizontal\"),\n",
|
| 476 |
-
" tf.keras.layers.RandomRotation(0.1),\n",
|
| 477 |
-
" tf.keras.layers.RandomZoom(0.1),\n",
|
| 478 |
-
"])"
|
| 479 |
-
],
|
| 480 |
-
"metadata": {
|
| 481 |
-
"id": "e4xmsSeGIDe8"
|
| 482 |
-
},
|
| 483 |
-
"execution_count": null,
|
| 484 |
-
"outputs": []
|
| 485 |
-
},
|
| 486 |
-
{
|
| 487 |
-
"cell_type": "code",
|
| 488 |
-
"source": [
|
| 489 |
-
"label_map = {'REAL': 0, 'FAKE': 1}\n"
|
| 490 |
-
],
|
| 491 |
-
"metadata": {
|
| 492 |
-
"id": "2ba3DFLDIFWs"
|
| 493 |
-
},
|
| 494 |
-
"execution_count": null,
|
| 495 |
-
"outputs": []
|
| 496 |
-
},
|
| 497 |
-
{
|
| 498 |
-
"cell_type": "code",
|
| 499 |
-
"source": [
|
| 500 |
-
"def preprocess_image(filepath, label):\n",
|
| 501 |
-
" image = tf.io.read_file(filepath)\n",
|
| 502 |
-
" image = tf.image.decode_jpeg(image, channels=3)\n",
|
| 503 |
-
" image = tf.image.resize(image, [224, 224])\n",
|
| 504 |
-
" image = tf.cast(image, tf.float32)\n",
|
| 505 |
-
" # EfficientNet expects values in [0, 255] for its preprocess function\n",
|
| 506 |
-
" return image, label\n",
|
| 507 |
-
"\n",
|
| 508 |
-
"# Create TensorFlow datasets\n",
|
| 509 |
-
"batch_size = 32\n",
|
| 510 |
-
"\n",
|
| 511 |
-
"train_ds = tf.data.Dataset.from_tensor_slices((\n",
|
| 512 |
-
" Train_set['filepath'].values,\n",
|
| 513 |
-
" Train_set['label'].map(label_map).values\n",
|
| 514 |
-
"))\n",
|
| 515 |
-
"train_ds = (train_ds\n",
|
| 516 |
-
" .map(preprocess_image, num_parallel_calls=tf.data.AUTOTUNE)\n",
|
| 517 |
-
" .shuffle(1000, seed=42)\n",
|
| 518 |
-
" .batch(batch_size)\n",
|
| 519 |
-
" .prefetch(tf.data.AUTOTUNE))\n",
|
| 520 |
-
"\n",
|
| 521 |
-
"val_ds = tf.data.Dataset.from_tensor_slices((\n",
|
| 522 |
-
" Val_set['filepath'].values,\n",
|
| 523 |
-
" Val_set['label'].map(label_map).values\n",
|
| 524 |
-
"))\n",
|
| 525 |
-
"val_ds = (val_ds\n",
|
| 526 |
-
" .map(preprocess_image, num_parallel_calls=tf.data.AUTOTUNE)\n",
|
| 527 |
-
" .batch(batch_size)\n",
|
| 528 |
-
" .prefetch(tf.data.AUTOTUNE))\n",
|
| 529 |
-
"\n",
|
| 530 |
-
"test_ds = tf.data.Dataset.from_tensor_slices((\n",
|
| 531 |
-
" Test_set['filepath'].values,\n",
|
| 532 |
-
" Test_set['label'].map(label_map).values\n",
|
| 533 |
-
"))\n",
|
| 534 |
-
"test_ds = (test_ds\n",
|
| 535 |
-
" .map(preprocess_image, num_parallel_calls=tf.data.AUTOTUNE)\n",
|
| 536 |
-
" .batch(batch_size)\n",
|
| 537 |
-
" .prefetch(tf.data.AUTOTUNE))"
|
| 538 |
-
],
|
| 539 |
-
"metadata": {
|
| 540 |
-
"id": "OendSPcjIF99"
|
| 541 |
-
},
|
| 542 |
-
"execution_count": null,
|
| 543 |
-
"outputs": []
|
| 544 |
-
},
|
| 545 |
-
{
|
| 546 |
-
"cell_type": "code",
|
| 547 |
-
"source": [
|
| 548 |
-
"def plot_class_counts(train_set, val_set, test_set):\n",
|
| 549 |
-
" sets = ['Train Set', 'Validation Set', 'Test Set']\n",
|
| 550 |
-
" colors = ['#52A666', '#C15B4E']\n",
|
| 551 |
-
"\n",
|
| 552 |
-
" y = {\n",
|
| 553 |
-
" 'REAL': [np.sum(train_set == 'REAL'), np.sum(val_set == 'REAL'), np.sum(test_set == 'REAL')],\n",
|
| 554 |
-
" 'FAKE': [np.sum(train_set == 'FAKE'), np.sum(val_set == 'FAKE'), np.sum(test_set == 'FAKE')]\n",
|
| 555 |
-
" }\n",
|
| 556 |
-
"\n",
|
| 557 |
-
" trace0 = go.Bar(x=sets, y=y['REAL'], name='REAL', marker={'color': colors[0]}, opacity=0.7)\n",
|
| 558 |
-
" trace1 = go.Bar(x=sets, y=y['FAKE'], name='FAKE', marker={'color': colors[1]}, opacity=0.7)\n",
|
| 559 |
-
"\n",
|
| 560 |
-
" data = [trace0, trace1]\n",
|
| 561 |
-
" layout = go.Layout(title='Count of Classes in each set:', xaxis={'title': 'Set'}, yaxis={'title': 'Count'})\n",
|
| 562 |
-
"\n",
|
| 563 |
-
" fig = go.Figure(data, layout)\n",
|
| 564 |
-
" iplot(fig)\n",
|
| 565 |
-
"\n",
|
| 566 |
-
"plot_class_counts(np.array(Train_set['label']), np.array(Val_set['label']), np.array(Test_set['label']))\n"
|
| 567 |
-
],
|
| 568 |
-
"metadata": {
|
| 569 |
-
"colab": {
|
| 570 |
-
"base_uri": "https://localhost:8080/",
|
| 571 |
-
"height": 542
|
| 572 |
-
},
|
| 573 |
-
"id": "BUtvuXUPIL3E",
|
| 574 |
-
"outputId": "a7261012-adf3-4212-fac0-1b37f0fd8159"
|
| 575 |
-
},
|
| 576 |
-
"execution_count": null,
|
| 577 |
-
"outputs": [
|
| 578 |
-
{
|
| 579 |
-
"output_type": "display_data",
|
| 580 |
-
"data": {
|
| 581 |
-
"text/html": [
|
| 582 |
-
"<html>\n",
|
| 583 |
-
"<head><meta charset=\"utf-8\" /></head>\n",
|
| 584 |
-
"<body>\n",
|
| 585 |
-
" <div> <script src=\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_SVG\"></script><script type=\"text/javascript\">if (window.MathJax && window.MathJax.Hub && window.MathJax.Hub.Config) {window.MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}</script> <script type=\"text/javascript\">window.PlotlyConfig = {MathJaxConfig: 'local'};</script>\n",
|
| 586 |
-
" <script charset=\"utf-8\" src=\"https://cdn.plot.ly/plotly-2.35.2.min.js\"></script> <div id=\"3aa0cb85-3812-44b8-a6a0-293506fec333\" class=\"plotly-graph-div\" style=\"height:525px; width:100%;\"></div> <script type=\"text/javascript\"> window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"3aa0cb85-3812-44b8-a6a0-293506fec333\")) { Plotly.newPlot( \"3aa0cb85-3812-44b8-a6a0-293506fec333\", [{\"marker\":{\"color\":\"#52A666\"},\"name\":\"REAL\",\"opacity\":0.7,\"x\":[\"Train Set\",\"Validation Set\",\"Test Set\"],\"y\":[12800,1600,1600],\"type\":\"bar\"},{\"marker\":{\"color\":\"#C15B4E\"},\"name\":\"FAKE\",\"opacity\":0.7,\"x\":[\"Train Set\",\"Validation Set\",\"Test Set\"],\"y\":[12800,1600,1600],\"type\":\"bar\"}], {\"template\":{\"data\":{\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"#E5ECF6\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"bar\":[{\"error_x\":{\"color\":\"#2a3f5f\"},\"error_y\":{\"color\":\"#2a3f5f\"},\"marker\":{\"line\":{\"color\":\"#E5ECF6\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"#2a3f5f\"},\"baxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"#2a3f5f\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"choropleth\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"contourcarpet\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"contour\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmapgl\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmap\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2dcontour\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2d\"}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"histogram\"}],\"mesh3d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"mesh3d\"}],\"parcoords\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"parcoords\"}],\"pie\":[{\"automargin\":true,\"type\":\"pie\"}],\"scatter3d\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatter3d\"}],\"scattercarpet\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattercarpet\"}],\"scattergeo\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattergeo\"}],\"scattergl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattergl\"}],\"scattermapbox\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattermapbox\"}],\"scatterpolargl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterpolargl\"}],\"scatterpolar\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterpolar\"}],\"scatter\":[{\"fillpattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2},\"type\":\"scatter\"}],\"scatterternary\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterternary\"}],\"surface\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"surface\"}],\"table\":[{\"cells\":{\"fill\":{\"color\":\"#EBF0F8\"},\"line\":{\"color\":\"white\"}},\"header\":{\"fill\":{\"color\":\"#C8D4E3\"},\"line\":{\"color\":\"white\"}},\"type\":\"table\"}]},\"layout\":{\"annotationdefaults\":{\"arrowcolor\":\"#2a3f5f\",\"arrowhead\":0,\"arrowwidth\":1},\"autotypenumbers\":\"strict\",\"coloraxis\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"colorscale\":{\"diverging\":[[0,\"#8e0152\"],[0.1,\"#c51b7d\"],[0.2,\"#de77ae\"],[0.3,\"#f1b6da\"],[0.4,\"#fde0ef\"],[0.5,\"#f7f7f7\"],[0.6,\"#e6f5d0\"],[0.7,\"#b8e186\"],[0.8,\"#7fbc41\"],[0.9,\"#4d9221\"],[1,\"#276419\"]],\"sequential\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"sequentialminus\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]},\"colorway\":[\"#636efa\",\"#EF553B\",\"#00cc96\",\"#ab63fa\",\"#FFA15A\",\"#19d3f3\",\"#FF6692\",\"#B6E880\",\"#FF97FF\",\"#FECB52\"],\"font\":{\"color\":\"#2a3f5f\"},\"geo\":{\"bgcolor\":\"white\",\"lakecolor\":\"white\",\"landcolor\":\"#E5ECF6\",\"showlakes\":true,\"showland\":true,\"subunitcolor\":\"white\"},\"hoverlabel\":{\"align\":\"left\"},\"hovermode\":\"closest\",\"mapbox\":{\"style\":\"light\"},\"paper_bgcolor\":\"white\",\"plot_bgcolor\":\"#E5ECF6\",\"polar\":{\"angularaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"bgcolor\":\"#E5ECF6\",\"radialaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"}},\"scene\":{\"xaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\"},\"yaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\"},\"zaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\"}},\"shapedefaults\":{\"line\":{\"color\":\"#2a3f5f\"}},\"ternary\":{\"aaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"baxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"bgcolor\":\"#E5ECF6\",\"caxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"}},\"title\":{\"x\":0.05},\"xaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\",\"zerolinewidth\":2},\"yaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\",\"zerolinewidth\":2}}},\"title\":{\"text\":\"Count of Classes in each set:\"},\"xaxis\":{\"title\":{\"text\":\"Set\"}},\"yaxis\":{\"title\":{\"text\":\"Count\"}}}, {\"responsive\": true} ).then(function(){\n",
|
| 587 |
-
" \n",
|
| 588 |
-
"var gd = document.getElementById('3aa0cb85-3812-44b8-a6a0-293506fec333');\n",
|
| 589 |
-
"var x = new MutationObserver(function (mutations, observer) {{\n",
|
| 590 |
-
" var display = window.getComputedStyle(gd).display;\n",
|
| 591 |
-
" if (!display || display === 'none') {{\n",
|
| 592 |
-
" console.log([gd, 'removed!']);\n",
|
| 593 |
-
" Plotly.purge(gd);\n",
|
| 594 |
-
" observer.disconnect();\n",
|
| 595 |
-
" }}\n",
|
| 596 |
-
"}});\n",
|
| 597 |
-
"\n",
|
| 598 |
-
"// Listen for the removal of the full notebook cells\n",
|
| 599 |
-
"var notebookContainer = gd.closest('#notebook-container');\n",
|
| 600 |
-
"if (notebookContainer) {{\n",
|
| 601 |
-
" x.observe(notebookContainer, {childList: true});\n",
|
| 602 |
-
"}}\n",
|
| 603 |
-
"\n",
|
| 604 |
-
"// Listen for the clearing of the current output cell\n",
|
| 605 |
-
"var outputEl = gd.closest('.output');\n",
|
| 606 |
-
"if (outputEl) {{\n",
|
| 607 |
-
" x.observe(outputEl, {childList: true});\n",
|
| 608 |
-
"}}\n",
|
| 609 |
-
"\n",
|
| 610 |
-
" }) }; </script> </div>\n",
|
| 611 |
-
"</body>\n",
|
| 612 |
-
"</html>"
|
| 613 |
-
]
|
| 614 |
-
},
|
| 615 |
-
"metadata": {}
|
| 616 |
-
}
|
| 617 |
-
]
|
| 618 |
-
},
|
| 619 |
-
{
|
| 620 |
-
"cell_type": "code",
|
| 621 |
-
"source": [
|
| 622 |
-
"tf.keras.backend.clear_session()\n",
|
| 623 |
-
"tf.random.set_seed(42)\n",
|
| 624 |
-
"\n",
|
| 625 |
-
"from tensorflow.keras.applications import EfficientNetB4\n",
|
| 626 |
-
"\n",
|
| 627 |
-
"# Build model with data augmentation\n",
|
| 628 |
-
"base_model = EfficientNetB4(include_top=False, weights='imagenet', input_shape=(224, 224, 3))\n",
|
| 629 |
-
"\n",
|
| 630 |
-
"# Create the full model with data augmentation\n",
|
| 631 |
-
"inputs = tf.keras.Input(shape=(224, 224, 3))\n",
|
| 632 |
-
"\n",
|
| 633 |
-
"# Apply data augmentation only during training\n",
|
| 634 |
-
"x = data_augmentation(inputs)\n",
|
| 635 |
-
"\n",
|
| 636 |
-
"# Apply EfficientNet preprocessing\n",
|
| 637 |
-
"x = tf.keras.applications.efficientnet.preprocess_input(x)\n",
|
| 638 |
-
"\n",
|
| 639 |
-
"# Pass through base model\n",
|
| 640 |
-
"x = base_model(x, training=False) # Keep base model frozen initially\n",
|
| 641 |
-
"\n",
|
| 642 |
-
"# Add classification head\n",
|
| 643 |
-
"x = tf.keras.layers.GlobalAveragePooling2D()(x)\n",
|
| 644 |
-
"x = tf.keras.layers.Dropout(0.2)(x)\n",
|
| 645 |
-
"outputs = tf.keras.layers.Dense(1, activation=\"sigmoid\")(x)\n",
|
| 646 |
-
"\n",
|
| 647 |
-
"model = tf.keras.Model(inputs, outputs)"
|
| 648 |
-
],
|
| 649 |
-
"metadata": {
|
| 650 |
-
"colab": {
|
| 651 |
-
"base_uri": "https://localhost:8080/"
|
| 652 |
-
},
|
| 653 |
-
"id": "ev8RU-JIIU4M",
|
| 654 |
-
"outputId": "7cbc8dd3-3ad7-462b-ff76-fd5f1909d11e"
|
| 655 |
-
},
|
| 656 |
-
"execution_count": null,
|
| 657 |
-
"outputs": [
|
| 658 |
-
{
|
| 659 |
-
"output_type": "stream",
|
| 660 |
-
"name": "stdout",
|
| 661 |
-
"text": [
|
| 662 |
-
"Downloading data from https://storage.googleapis.com/keras-applications/efficientnetb4_notop.h5\n",
|
| 663 |
-
"\u001b[1m71686520/71686520\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 0us/step\n"
|
| 664 |
-
]
|
| 665 |
-
}
|
| 666 |
-
]
|
| 667 |
-
},
|
| 668 |
-
{
|
| 669 |
-
"cell_type": "code",
|
| 670 |
-
"source": [
|
| 671 |
-
"# Compile model\n",
|
| 672 |
-
"optimizer = tf.keras.optimizers.Adam(learning_rate=0.001) # Using Adam for better convergence\n",
|
| 673 |
-
"model.compile(\n",
|
| 674 |
-
" optimizer=optimizer,\n",
|
| 675 |
-
" loss=\"binary_crossentropy\",\n",
|
| 676 |
-
" metrics=[\"accuracy\"]\n",
|
| 677 |
-
")\n",
|
| 678 |
-
"\n",
|
| 679 |
-
"model.summary()"
|
| 680 |
-
],
|
| 681 |
-
"metadata": {
|
| 682 |
-
"colab": {
|
| 683 |
-
"base_uri": "https://localhost:8080/",
|
| 684 |
-
"height": 357
|
| 685 |
-
},
|
| 686 |
-
"id": "0IpweVPuIY38",
|
| 687 |
-
"outputId": "971546e4-c2c5-4d3e-d4c6-b618b5e3e58e"
|
| 688 |
-
},
|
| 689 |
-
"execution_count": null,
|
| 690 |
-
"outputs": [
|
| 691 |
-
{
|
| 692 |
-
"output_type": "display_data",
|
| 693 |
-
"data": {
|
| 694 |
-
"text/plain": [
|
| 695 |
-
"\u001b[1mModel: \"functional_1\"\u001b[0m\n"
|
| 696 |
-
],
|
| 697 |
-
"text/html": [
|
| 698 |
-
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">Model: \"functional_1\"</span>\n",
|
| 699 |
-
"</pre>\n"
|
| 700 |
-
]
|
| 701 |
-
},
|
| 702 |
-
"metadata": {}
|
| 703 |
-
},
|
| 704 |
-
{
|
| 705 |
-
"output_type": "display_data",
|
| 706 |
-
"data": {
|
| 707 |
-
"text/plain": [
|
| 708 |
-
"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓\n",
|
| 709 |
-
"┃\u001b[1m \u001b[0m\u001b[1mLayer (type) \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mOutput Shape \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1m Param #\u001b[0m\u001b[1m \u001b[0m┃\n",
|
| 710 |
-
"┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩\n",
|
| 711 |
-
"│ input_layer_1 (\u001b[38;5;33mInputLayer\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m224\u001b[0m, \u001b[38;5;34m224\u001b[0m, \u001b[38;5;34m3\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
|
| 712 |
-
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 713 |
-
"│ sequential (\u001b[38;5;33mSequential\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m224\u001b[0m, \u001b[38;5;34m224\u001b[0m, \u001b[38;5;34m3\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
|
| 714 |
-
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 715 |
-
"│ efficientnetb4 (\u001b[38;5;33mFunctional\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m7\u001b[0m, \u001b[38;5;34m7\u001b[0m, \u001b[38;5;34m1792\u001b[0m) │ \u001b[38;5;34m17,673,823\u001b[0m │\n",
|
| 716 |
-
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 717 |
-
"│ global_average_pooling2d │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m1792\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
|
| 718 |
-
"│ (\u001b[38;5;33mGlobalAveragePooling2D\u001b[0m) │ │ │\n",
|
| 719 |
-
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 720 |
-
"│ dropout (\u001b[38;5;33mDropout\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m1792\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
|
| 721 |
-
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 722 |
-
"│ dense (\u001b[38;5;33mDense\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m1\u001b[0m) │ \u001b[38;5;34m1,793\u001b[0m │\n",
|
| 723 |
-
"└─────────────────────────────────┴────────────────────────┴───────────────┘\n"
|
| 724 |
-
],
|
| 725 |
-
"text/html": [
|
| 726 |
-
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓\n",
|
| 727 |
-
"┃<span style=\"font-weight: bold\"> Layer (type) </span>┃<span style=\"font-weight: bold\"> Output Shape </span>┃<span style=\"font-weight: bold\"> Param # </span>┃\n",
|
| 728 |
-
"┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩\n",
|
| 729 |
-
"│ input_layer_1 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">InputLayer</span>) │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">224</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">224</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">3</span>) │ <span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> │\n",
|
| 730 |
-
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 731 |
-
"│ sequential (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Sequential</span>) │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">224</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">224</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">3</span>) │ <span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> │\n",
|
| 732 |
-
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 733 |
-
"│ efficientnetb4 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Functional</span>) │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">7</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">7</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">1792</span>) │ <span style=\"color: #00af00; text-decoration-color: #00af00\">17,673,823</span> │\n",
|
| 734 |
-
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 735 |
-
"│ global_average_pooling2d │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">1792</span>) │ <span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> │\n",
|
| 736 |
-
"│ (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">GlobalAveragePooling2D</span>) │ │ │\n",
|
| 737 |
-
"├─────────────────────────────────┼────────────────────────┼──────────────���┤\n",
|
| 738 |
-
"│ dropout (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Dropout</span>) │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">1792</span>) │ <span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> │\n",
|
| 739 |
-
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 740 |
-
"│ dense (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Dense</span>) │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">1</span>) │ <span style=\"color: #00af00; text-decoration-color: #00af00\">1,793</span> │\n",
|
| 741 |
-
"└─────────────────────────────────┴────────────────────────┴───────────────┘\n",
|
| 742 |
-
"</pre>\n"
|
| 743 |
-
]
|
| 744 |
-
},
|
| 745 |
-
"metadata": {}
|
| 746 |
-
},
|
| 747 |
-
{
|
| 748 |
-
"output_type": "display_data",
|
| 749 |
-
"data": {
|
| 750 |
-
"text/plain": [
|
| 751 |
-
"\u001b[1m Total params: \u001b[0m\u001b[38;5;34m17,675,616\u001b[0m (67.43 MB)\n"
|
| 752 |
-
],
|
| 753 |
-
"text/html": [
|
| 754 |
-
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Total params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">17,675,616</span> (67.43 MB)\n",
|
| 755 |
-
"</pre>\n"
|
| 756 |
-
]
|
| 757 |
-
},
|
| 758 |
-
"metadata": {}
|
| 759 |
-
},
|
| 760 |
-
{
|
| 761 |
-
"output_type": "display_data",
|
| 762 |
-
"data": {
|
| 763 |
-
"text/plain": [
|
| 764 |
-
"\u001b[1m Trainable params: \u001b[0m\u001b[38;5;34m17,550,409\u001b[0m (66.95 MB)\n"
|
| 765 |
-
],
|
| 766 |
-
"text/html": [
|
| 767 |
-
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Trainable params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">17,550,409</span> (66.95 MB)\n",
|
| 768 |
-
"</pre>\n"
|
| 769 |
-
]
|
| 770 |
-
},
|
| 771 |
-
"metadata": {}
|
| 772 |
-
},
|
| 773 |
-
{
|
| 774 |
-
"output_type": "display_data",
|
| 775 |
-
"data": {
|
| 776 |
-
"text/plain": [
|
| 777 |
-
"\u001b[1m Non-trainable params: \u001b[0m\u001b[38;5;34m125,207\u001b[0m (489.09 KB)\n"
|
| 778 |
-
],
|
| 779 |
-
"text/html": [
|
| 780 |
-
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Non-trainable params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">125,207</span> (489.09 KB)\n",
|
| 781 |
-
"</pre>\n"
|
| 782 |
-
]
|
| 783 |
-
},
|
| 784 |
-
"metadata": {}
|
| 785 |
-
}
|
| 786 |
-
]
|
| 787 |
-
},
|
| 788 |
-
{
|
| 789 |
-
"cell_type": "code",
|
| 790 |
-
"source": [
|
| 791 |
-
"# Setup callbacks\n",
|
| 792 |
-
"from tensorflow.keras.callbacks import EarlyStopping, ModelCheckpoint, ReduceLROnPlateau\n",
|
| 793 |
-
"\n",
|
| 794 |
-
"\n",
|
| 795 |
-
"\n",
|
| 796 |
-
"# Model checkpoint\n",
|
| 797 |
-
"checkpoint_path = \"/content/drive/MyDrive/NTI-PRJCT/model_epoch_{epoch:02d}.keras\"\n",
|
| 798 |
-
"checkpoint_callback = ModelCheckpoint(\n",
|
| 799 |
-
" filepath=checkpoint_path,\n",
|
| 800 |
-
" monitor='val_accuracy',\n",
|
| 801 |
-
" save_best_only=False,\n",
|
| 802 |
-
" save_weights_only=False,\n",
|
| 803 |
-
" verbose=1\n",
|
| 804 |
-
")\n",
|
| 805 |
-
"\n",
|
| 806 |
-
"# Early stopping with proper patience\n",
|
| 807 |
-
"early_stopping = EarlyStopping(\n",
|
| 808 |
-
" monitor='val_loss',\n",
|
| 809 |
-
" patience=8,\n",
|
| 810 |
-
" restore_best_weights=True,\n",
|
| 811 |
-
" verbose=1\n",
|
| 812 |
-
")"
|
| 813 |
-
],
|
| 814 |
-
"metadata": {
|
| 815 |
-
"id": "TUVta5W5IcTM"
|
| 816 |
-
},
|
| 817 |
-
"execution_count": null,
|
| 818 |
-
"outputs": []
|
| 819 |
-
},
|
| 820 |
-
{
|
| 821 |
-
"cell_type": "code",
|
| 822 |
-
"source": [
|
| 823 |
-
"lr_reducer = ReduceLROnPlateau(\n",
|
| 824 |
-
" monitor='val_loss',\n",
|
| 825 |
-
" factor=0.2,\n",
|
| 826 |
-
" patience=5,\n",
|
| 827 |
-
" min_lr=1e-7,\n",
|
| 828 |
-
" verbose=1\n",
|
| 829 |
-
")\n",
|
| 830 |
-
"\n",
|
| 831 |
-
"# Training\n",
|
| 832 |
-
"history = model.fit(\n",
|
| 833 |
-
" train_ds,\n",
|
| 834 |
-
" validation_data=val_ds,\n",
|
| 835 |
-
" epochs=50,\n",
|
| 836 |
-
" callbacks=[early_stopping, checkpoint_callback, lr_reducer],\n",
|
| 837 |
-
" verbose=1\n",
|
| 838 |
-
")"
|
| 839 |
-
],
|
| 840 |
-
"metadata": {
|
| 841 |
-
"colab": {
|
| 842 |
-
"base_uri": "https://localhost:8080/"
|
| 843 |
-
},
|
| 844 |
-
"id": "3jaEVVMHInmc",
|
| 845 |
-
"outputId": "4420da4b-569b-43f3-fe36-734dab972380"
|
| 846 |
-
},
|
| 847 |
-
"execution_count": null,
|
| 848 |
-
"outputs": [
|
| 849 |
-
{
|
| 850 |
-
"output_type": "stream",
|
| 851 |
-
"name": "stdout",
|
| 852 |
-
"text": [
|
| 853 |
-
"Epoch 1/50\n",
|
| 854 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 857ms/step - accuracy: 0.7771 - loss: 0.4718\n",
|
| 855 |
-
"Epoch 1: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_01.keras\n",
|
| 856 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m717s\u001b[0m 896ms/step - accuracy: 0.7772 - loss: 0.4718 - val_accuracy: 0.8034 - val_loss: 0.4270 - learning_rate: 0.0010\n",
|
| 857 |
-
"Epoch 2/50\n",
|
| 858 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 857ms/step - accuracy: 0.8216 - loss: 0.3945\n",
|
| 859 |
-
"Epoch 2: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_02.keras\n",
|
| 860 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m710s\u001b[0m 887ms/step - accuracy: 0.8216 - loss: 0.3945 - val_accuracy: 0.8350 - val_loss: 0.3646 - learning_rate: 0.0010\n",
|
| 861 |
-
"Epoch 3/50\n",
|
| 862 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 856ms/step - accuracy: 0.8460 - loss: 0.3416\n",
|
| 863 |
-
"Epoch 3: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_03.keras\n",
|
| 864 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m740s\u001b[0m 885ms/step - accuracy: 0.8460 - loss: 0.3416 - val_accuracy: 0.8519 - val_loss: 0.3786 - learning_rate: 0.0010\n",
|
| 865 |
-
"Epoch 4/50\n",
|
| 866 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 857ms/step - accuracy: 0.8644 - loss: 0.3068\n",
|
| 867 |
-
"Epoch 4: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_04.keras\n",
|
| 868 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m743s\u001b[0m 886ms/step - accuracy: 0.8644 - loss: 0.3068 - val_accuracy: 0.8444 - val_loss: 0.3616 - learning_rate: 0.0010\n",
|
| 869 |
-
"Epoch 5/50\n",
|
| 870 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 856ms/step - accuracy: 0.8799 - loss: 0.2816\n",
|
| 871 |
-
"Epoch 5: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_05.keras\n",
|
| 872 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m740s\u001b[0m 885ms/step - accuracy: 0.8799 - loss: 0.2816 - val_accuracy: 0.8388 - val_loss: 0.4151 - learning_rate: 0.0010\n",
|
| 873 |
-
"Epoch 6/50\n",
|
| 874 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 855ms/step - accuracy: 0.8885 - loss: 0.2567\n",
|
| 875 |
-
"Epoch 6: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_06.keras\n",
|
| 876 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m742s\u001b[0m 885ms/step - accuracy: 0.8885 - loss: 0.2567 - val_accuracy: 0.8512 - val_loss: 0.3529 - learning_rate: 0.0010\n",
|
| 877 |
-
"Epoch 7/50\n",
|
| 878 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 856ms/step - accuracy: 0.8985 - loss: 0.2374\n",
|
| 879 |
-
"Epoch 7: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_07.keras\n",
|
| 880 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m743s\u001b[0m 886ms/step - accuracy: 0.8985 - loss: 0.2374 - val_accuracy: 0.8609 - val_loss: 0.3472 - learning_rate: 0.0010\n",
|
| 881 |
-
"Epoch 8/50\n",
|
| 882 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 856ms/step - accuracy: 0.9127 - loss: 0.2133\n",
|
| 883 |
-
"Epoch 8: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_08.keras\n",
|
| 884 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m742s\u001b[0m 885ms/step - accuracy: 0.9127 - loss: 0.2133 - val_accuracy: 0.8087 - val_loss: 0.4966 - learning_rate: 0.0010\n",
|
| 885 |
-
"Epoch 9/50\n",
|
| 886 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 856ms/step - accuracy: 0.9165 - loss: 0.2004\n",
|
| 887 |
-
"Epoch 9: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_09.keras\n",
|
| 888 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m743s\u001b[0m 887ms/step - accuracy: 0.9165 - loss: 0.2004 - val_accuracy: 0.8619 - val_loss: 0.3643 - learning_rate: 0.0010\n",
|
| 889 |
-
"Epoch 10/50\n",
|
| 890 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 856ms/step - accuracy: 0.9204 - loss: 0.1923\n",
|
| 891 |
-
"Epoch 10: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_10.keras\n",
|
| 892 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m741s\u001b[0m 885ms/step - accuracy: 0.9204 - loss: 0.1923 - val_accuracy: 0.8597 - val_loss: 0.3573 - learning_rate: 0.0010\n",
|
| 893 |
-
"Epoch 11/50\n",
|
| 894 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 855ms/step - accuracy: 0.9288 - loss: 0.1784\n",
|
| 895 |
-
"Epoch 11: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_11.keras\n",
|
| 896 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m709s\u001b[0m 885ms/step - accuracy: 0.9288 - loss: 0.1784 - val_accuracy: 0.8697 - val_loss: 0.3494 - learning_rate: 0.0010\n",
|
| 897 |
-
"Epoch 12/50\n",
|
| 898 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 854ms/step - accuracy: 0.9316 - loss: 0.1672\n",
|
| 899 |
-
"Epoch 12: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_12.keras\n",
|
| 900 |
-
"\n",
|
| 901 |
-
"Epoch 12: ReduceLROnPlateau reducing learning rate to 0.00020000000949949026.\n",
|
| 902 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m706s\u001b[0m 881ms/step - accuracy: 0.9317 - loss: 0.1672 - val_accuracy: 0.8353 - val_loss: 0.4639 - learning_rate: 0.0010\n",
|
| 903 |
-
"Epoch 13/50\n",
|
| 904 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 855ms/step - accuracy: 0.9546 - loss: 0.1189\n",
|
| 905 |
-
"Epoch 13: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_13.keras\n",
|
| 906 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m709s\u001b[0m 885ms/step - accuracy: 0.9546 - loss: 0.1189 - val_accuracy: 0.9131 - val_loss: 0.2431 - learning_rate: 2.0000e-04\n",
|
| 907 |
-
"Epoch 14/50\n",
|
| 908 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 855ms/step - accuracy: 0.9681 - loss: 0.0799\n",
|
| 909 |
-
"Epoch 14: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_14.keras\n",
|
| 910 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m741s\u001b[0m 884ms/step - accuracy: 0.9681 - loss: 0.0799 - val_accuracy: 0.9187 - val_loss: 0.2386 - learning_rate: 2.0000e-04\n",
|
| 911 |
-
"Epoch 15/50\n",
|
| 912 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 856ms/step - accuracy: 0.9742 - loss: 0.0689\n",
|
| 913 |
-
"Epoch 15: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_15.keras\n",
|
| 914 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m708s\u001b[0m 885ms/step - accuracy: 0.9742 - loss: 0.0689 - val_accuracy: 0.9162 - val_loss: 0.2737 - learning_rate: 2.0000e-04\n",
|
| 915 |
-
"Epoch 16/50\n",
|
| 916 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 856ms/step - accuracy: 0.9768 - loss: 0.0594\n",
|
| 917 |
-
"Epoch 16: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_16.keras\n",
|
| 918 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m746s\u001b[0m 890ms/step - accuracy: 0.9768 - loss: 0.0594 - val_accuracy: 0.9106 - val_loss: 0.2691 - learning_rate: 2.0000e-04\n",
|
| 919 |
-
"Epoch 17/50\n",
|
| 920 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━��━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 857ms/step - accuracy: 0.9784 - loss: 0.0552\n",
|
| 921 |
-
"Epoch 17: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_17.keras\n",
|
| 922 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m744s\u001b[0m 893ms/step - accuracy: 0.9784 - loss: 0.0552 - val_accuracy: 0.9147 - val_loss: 0.2741 - learning_rate: 2.0000e-04\n",
|
| 923 |
-
"Epoch 18/50\n",
|
| 924 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 858ms/step - accuracy: 0.9805 - loss: 0.0505\n",
|
| 925 |
-
"Epoch 18: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_18.keras\n",
|
| 926 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m716s\u001b[0m 895ms/step - accuracy: 0.9805 - loss: 0.0505 - val_accuracy: 0.9184 - val_loss: 0.2681 - learning_rate: 2.0000e-04\n",
|
| 927 |
-
"Epoch 19/50\n",
|
| 928 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 861ms/step - accuracy: 0.9843 - loss: 0.0412\n",
|
| 929 |
-
"Epoch 19: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_19.keras\n",
|
| 930 |
-
"\n",
|
| 931 |
-
"Epoch 19: ReduceLROnPlateau reducing learning rate to 4.0000001899898055e-05.\n",
|
| 932 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m739s\u001b[0m 891ms/step - accuracy: 0.9843 - loss: 0.0412 - val_accuracy: 0.9159 - val_loss: 0.2972 - learning_rate: 2.0000e-04\n",
|
| 933 |
-
"Epoch 20/50\n",
|
| 934 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 856ms/step - accuracy: 0.9862 - loss: 0.0367\n",
|
| 935 |
-
"Epoch 20: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_20.keras\n",
|
| 936 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m711s\u001b[0m 888ms/step - accuracy: 0.9862 - loss: 0.0367 - val_accuracy: 0.9156 - val_loss: 0.3108 - learning_rate: 4.0000e-05\n",
|
| 937 |
-
"Epoch 21/50\n",
|
| 938 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 860ms/step - accuracy: 0.9897 - loss: 0.0274\n",
|
| 939 |
-
"Epoch 21: saving model to /content/drive/MyDrive/NTI-PRJCT/model_epoch_21.keras\n",
|
| 940 |
-
"\u001b[1m800/800\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m716s\u001b[0m 894ms/step - accuracy: 0.9897 - loss: 0.0274 - val_accuracy: 0.9184 - val_loss: 0.3099 - learning_rate: 4.0000e-05\n",
|
| 941 |
-
"Epoch 22/50\n",
|
| 942 |
-
"\u001b[1m150/800\u001b[0m \u001b[32m━━━\u001b[0m\u001b[37m━━━━━━━━━━━━━━━━━\u001b[0m \u001b[1m9:21\u001b[0m 864ms/step - accuracy: 0.9879 - loss: 0.0310"
|
| 943 |
-
]
|
| 944 |
-
}
|
| 945 |
-
]
|
| 946 |
-
},
|
| 947 |
-
{
|
| 948 |
-
"cell_type": "code",
|
| 949 |
-
"source": [],
|
| 950 |
-
"metadata": {
|
| 951 |
-
"id": "KFBcgWXf3kLt"
|
| 952 |
-
},
|
| 953 |
-
"execution_count": null,
|
| 954 |
-
"outputs": []
|
| 955 |
-
}
|
| 956 |
-
]
|
| 957 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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