minnnii commited on
Commit
e76e1f8
Β·
verified Β·
1 Parent(s): 8fda6bb

Upload 3 files

Browse files
mobilenet_oral_cancer.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:239b7aad5fc36b80a0d3ae431182db3029c7c31ee494bbd1061cff656a5443a9
3
+ size 14788552
model.ipynb ADDED
@@ -0,0 +1,504 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "import os\n",
10
+ "import numpy as np\n",
11
+ "import tensorflow as tf\n",
12
+ "from tensorflow.keras.preprocessing.image import load_img, img_to_array\n",
13
+ "from tensorflow.keras.applications import ResNet152V2, MobileNet\n",
14
+ "from tensorflow.keras.layers import Dense, GlobalAveragePooling2D\n",
15
+ "from tensorflow.keras.models import Model\n",
16
+ "from tensorflow.keras.optimizers import Adam\n",
17
+ "from tensorflow.keras.utils import Sequence\n",
18
+ "from sklearn.utils import shuffle\n",
19
+ "import glob"
20
+ ]
21
+ },
22
+ {
23
+ "cell_type": "code",
24
+ "execution_count": null,
25
+ "metadata": {},
26
+ "outputs": [],
27
+ "source": [
28
+ "# Check TensorFlow and GPU setup\n",
29
+ "print(\"TensorFlow version:\", tf.__version__)\n",
30
+ "print(\"GPUs available:\", tf.config.list_physical_devices('GPU'))"
31
+ ]
32
+ },
33
+ {
34
+ "cell_type": "code",
35
+ "execution_count": null,
36
+ "metadata": {},
37
+ "outputs": [],
38
+ "source": [
39
+ "# Dataset Paths\n",
40
+ "CANCER_PATH = '/kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER'\n",
41
+ "NON_CANCER_PATH = '/kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/NON CANCER'"
42
+ ]
43
+ },
44
+ {
45
+ "cell_type": "code",
46
+ "execution_count": null,
47
+ "metadata": {},
48
+ "outputs": [],
49
+ "source": [
50
+ "# Parameters\n",
51
+ "IMG_SIZE = (224, 224)\n",
52
+ "BATCH_SIZE = 32"
53
+ ]
54
+ },
55
+ {
56
+ "cell_type": "code",
57
+ "execution_count": null,
58
+ "metadata": {},
59
+ "outputs": [],
60
+ "source": [
61
+ "# Safe Data Generator\n",
62
+ "class SafeDataGenerator(Sequence):\n",
63
+ " def __init__(self, file_paths, labels, batch_size, target_size=(224, 224)):\n",
64
+ " self.file_paths = file_paths\n",
65
+ " self.labels = labels\n",
66
+ " self.batch_size = batch_size\n",
67
+ " self.target_size = target_size\n",
68
+ "\n",
69
+ " def __len__(self):\n",
70
+ " return len(self.file_paths) // self.batch_size\n",
71
+ "\n",
72
+ " def __getitem__(self, idx):\n",
73
+ " batch_paths = self.file_paths[idx * self.batch_size:(idx + 1) * self.batch_size]\n",
74
+ " batch_labels = self.labels[idx * self.batch_size:(idx + 1) * self.batch_size]\n",
75
+ " images, labels = [], []\n",
76
+ " for path, label in zip(batch_paths, batch_labels):\n",
77
+ " try:\n",
78
+ " img = load_img(path, target_size=self.target_size)\n",
79
+ " img_array = img_to_array(img) / 255.0 # Normalize\n",
80
+ " images.append(img_array)\n",
81
+ " labels.append(label)\n",
82
+ " except Exception as e:\n",
83
+ " print(f\"Skipping corrupted file: {path}, Error: {e}\")\n",
84
+ " return np.array(images), np.array(labels)"
85
+ ]
86
+ },
87
+ {
88
+ "cell_type": "code",
89
+ "execution_count": null,
90
+ "metadata": {},
91
+ "outputs": [],
92
+ "source": [
93
+ "# Collect file paths\n",
94
+ "cancer_files = glob.glob(f\"{CANCER_PATH}/*.jpeg\")\n",
95
+ "non_cancer_files = glob.glob(f\"{NON_CANCER_PATH}/*.jpeg\")\n",
96
+ "\n",
97
+ "file_paths = cancer_files + non_cancer_files\n",
98
+ "labels = [1] * len(cancer_files) + [0] * len(non_cancer_files)"
99
+ ]
100
+ },
101
+ {
102
+ "cell_type": "code",
103
+ "execution_count": null,
104
+ "metadata": {},
105
+ "outputs": [],
106
+ "source": [
107
+ "# Shuffle dataset\n",
108
+ "file_paths, labels = shuffle(file_paths, labels, random_state=42)"
109
+ ]
110
+ },
111
+ {
112
+ "cell_type": "code",
113
+ "execution_count": null,
114
+ "metadata": {},
115
+ "outputs": [],
116
+ "source": [
117
+ "# Split into training and validation\n",
118
+ "split_idx = int(len(file_paths) * 0.8)\n",
119
+ "train_paths, val_paths = file_paths[:split_idx], file_paths[split_idx:]\n",
120
+ "train_labels, val_labels = labels[:split_idx], labels[split_idx:]"
121
+ ]
122
+ },
123
+ {
124
+ "cell_type": "code",
125
+ "execution_count": null,
126
+ "metadata": {},
127
+ "outputs": [],
128
+ "source": [
129
+ "# Create generators\n",
130
+ "train_generator = SafeDataGenerator(train_paths, train_labels, batch_size=BATCH_SIZE, target_size=IMG_SIZE)\n",
131
+ "val_generator = SafeDataGenerator(val_paths, val_labels, batch_size=BATCH_SIZE, target_size=IMG_SIZE)"
132
+ ]
133
+ },
134
+ {
135
+ "cell_type": "code",
136
+ "execution_count": null,
137
+ "metadata": {},
138
+ "outputs": [],
139
+ "source": [
140
+ "# Define ResNet152V2 Model\n",
141
+ "def build_resnet152v2(input_shape=(224, 224, 3)):\n",
142
+ " base_model = ResNet152V2(weights='imagenet', include_top=False, input_shape=input_shape)\n",
143
+ " x = GlobalAveragePooling2D()(base_model.output)\n",
144
+ " x = Dense(128, activation='relu')(x)\n",
145
+ " x = Dense(1, activation='sigmoid')(x) # Binary classification\n",
146
+ " model = Model(inputs=base_model.input, outputs=x)\n",
147
+ "\n",
148
+ " # Freeze base model layers\n",
149
+ " for layer in base_model.layers:\n",
150
+ " layer.trainable = False\n",
151
+ "\n",
152
+ " model.compile(optimizer=Adam(learning_rate=0.001),\n",
153
+ " loss='binary_crossentropy',\n",
154
+ " metrics=['accuracy'])\n",
155
+ " return model"
156
+ ]
157
+ },
158
+ {
159
+ "cell_type": "code",
160
+ "execution_count": null,
161
+ "metadata": {},
162
+ "outputs": [],
163
+ "source": [
164
+ "# Define MobileNet Model\n",
165
+ "def build_mobilenet(input_shape=(224, 224, 3)):\n",
166
+ " base_model = MobileNet(weights='imagenet', include_top=False, input_shape=input_shape)\n",
167
+ " x = GlobalAveragePooling2D()(base_model.output)\n",
168
+ " x = Dense(128, activation='relu')(x)\n",
169
+ " x = Dense(1, activation='sigmoid')(x) # Binary classification\n",
170
+ " model = Model(inputs=base_model.input, outputs=x)\n",
171
+ "\n",
172
+ " # Freeze base model layers\n",
173
+ " for layer in base_model.layers:\n",
174
+ " layer.trainable = False\n",
175
+ "\n",
176
+ " model.compile(optimizer=Adam(learning_rate=0.001),\n",
177
+ " loss='binary_crossentropy',\n",
178
+ " metrics=['accuracy'])\n",
179
+ " return model"
180
+ ]
181
+ },
182
+ {
183
+ "cell_type": "code",
184
+ "execution_count": null,
185
+ "metadata": {},
186
+ "outputs": [],
187
+ "source": [
188
+ "# Build Models\n",
189
+ "resnet_model = build_resnet152v2()\n",
190
+ "mobilenet_model = build_mobilenet()"
191
+ ]
192
+ },
193
+ {
194
+ "cell_type": "code",
195
+ "execution_count": null,
196
+ "metadata": {},
197
+ "outputs": [],
198
+ "source": [
199
+ "# Train ResNet152V2\n",
200
+ "history_resnet = resnet_model.fit(\n",
201
+ " train_generator,\n",
202
+ " epochs=10,\n",
203
+ " validation_data=val_generator,\n",
204
+ " steps_per_epoch=len(train_generator),\n",
205
+ " validation_steps=len(val_generator)\n",
206
+ ")\n",
207
+ "\n",
208
+ "# Save ResNet152V2 Model\n",
209
+ "resnet_model.save(\"/kaggle/working/resnet152v2_oral_cancer.h5\")"
210
+ ]
211
+ },
212
+ {
213
+ "cell_type": "code",
214
+ "execution_count": null,
215
+ "metadata": {},
216
+ "outputs": [],
217
+ "source": [
218
+ "# Train MobileNet\n",
219
+ "history_mobilenet = mobilenet_model.fit(\n",
220
+ " train_generator,\n",
221
+ " epochs=10,\n",
222
+ " validation_data=val_generator,\n",
223
+ " steps_per_epoch=len(train_generator),\n",
224
+ " validation_steps=len(val_generator)\n",
225
+ ")\n",
226
+ "\n",
227
+ "# Save MobileNet Model\n",
228
+ "mobilenet_model.save(\"/kaggle/working/mobilenet_oral_cancer.h5\")"
229
+ ]
230
+ },
231
+ {
232
+ "cell_type": "code",
233
+ "execution_count": 1,
234
+ "metadata": {
235
+ "execution": {
236
+ "iopub.execute_input": "2025-01-28T12:51:18.511395Z",
237
+ "iopub.status.busy": "2025-01-28T12:51:18.511095Z",
238
+ "iopub.status.idle": "2025-01-28T12:55:03.294121Z",
239
+ "shell.execute_reply": "2025-01-28T12:55:03.293343Z",
240
+ "shell.execute_reply.started": "2025-01-28T12:51:18.511372Z"
241
+ },
242
+ "trusted": true
243
+ },
244
+ "outputs": [
245
+ {
246
+ "name": "stdout",
247
+ "output_type": "stream",
248
+ "text": [
249
+ "TensorFlow version: 2.17.1\n",
250
+ "GPUs available: [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU'), PhysicalDevice(name='/physical_device:GPU:1', device_type='GPU')]\n",
251
+ "Downloading data from https://storage.googleapis.com/tensorflow/keras-applications/resnet/resnet152v2_weights_tf_dim_ordering_tf_kernels_notop.h5\n",
252
+ "\u001b[1m234545216/234545216\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 0us/step\n",
253
+ "Downloading data from https://storage.googleapis.com/tensorflow/keras-applications/mobilenet/mobilenet_1_0_224_tf_no_top.h5\n",
254
+ "\u001b[1m17225924/17225924\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 0us/step\n",
255
+ "Epoch 1/10\n"
256
+ ]
257
+ },
258
+ {
259
+ "name": "stderr",
260
+ "output_type": "stream",
261
+ "text": [
262
+ "/usr/local/lib/python3.10/dist-packages/keras/src/trainers/data_adapters/py_dataset_adapter.py:122: UserWarning: Your `PyDataset` class should call `super().__init__(**kwargs)` in its constructor. `**kwargs` can include `workers`, `use_multiprocessing`, `max_queue_size`. Do not pass these arguments to `fit()`, as they will be ignored.\n",
263
+ " self._warn_if_super_not_called()\n"
264
+ ]
265
+ },
266
+ {
267
+ "name": "stdout",
268
+ "output_type": "stream",
269
+ "text": [
270
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/273.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892883e2f0>\n",
271
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/101.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892883e570>\n",
272
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/407.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892883e340>\n",
273
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/481.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7889289dfc40>\n",
274
+ "\u001b[1m 1/23\u001b[0m \u001b[37m━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[1m12:28\u001b[0m 34s/step - accuracy: 0.3871 - loss: 0.9560Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/200.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7889289dfc40>\n",
275
+ "\u001b[1m 7/23\u001b[0m \u001b[32m━━━━━━\u001b[0m\u001b[37m━━━━━━━━━━━━━━\u001b[0m \u001b[1m56s\u001b[0m 4s/step - accuracy: 0.6386 - loss: 0.6414 Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/328.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892883ee80>\n",
276
+ "\u001b[1m 9/23\u001b[0m \u001b[32m━━━━━━━\u001b[0m\u001b[37m━━━━━━━━━━━━━\u001b[0m \u001b[1m38s\u001b[0m 3s/step - accuracy: 0.6640 - loss: 0.6185Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/450.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892883ede0>\n",
277
+ "\u001b[1m12/23\u001b[0m \u001b[32m━━━━━━━━━━\u001b[0m\u001b[37m━━━━━━━━━━\u001b[0m \u001b[1m24s\u001b[0m 2s/step - accuracy: 0.6883 - loss: 0.6052Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/317.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892883eed0>\n",
278
+ "\u001b[1m13/23\u001b[0m \u001b[32m━━━━━━━━━━━\u001b[0m\u001b[37m━━━━━━━━━\u001b[0m \u001b[1m20s\u001b[0m 2s/step - accuracy: 0.6947 - loss: 0.6012Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/455.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892883f3d0>\n",
279
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 1s/step - accuracy: 0.7369 - loss: 0.5619"
280
+ ]
281
+ },
282
+ {
283
+ "name": "stderr",
284
+ "output_type": "stream",
285
+ "text": [
286
+ "/usr/local/lib/python3.10/dist-packages/PIL/Image.py:1054: UserWarning: Palette images with Transparency expressed in bytes should be converted to RGBA images\n",
287
+ " warnings.warn(\n"
288
+ ]
289
+ },
290
+ {
291
+ "name": "stdout",
292
+ "output_type": "stream",
293
+ "text": [
294
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/485.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f0777560>\n",
295
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m79s\u001b[0m 2s/step - accuracy: 0.7399 - loss: 0.5586 - val_accuracy: 0.8868 - val_loss: 0.2889\n",
296
+ "Epoch 2/10\n",
297
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 5ms/step - accuracy: 0.0000e+00 - loss: 0.0000e+00\n",
298
+ "Epoch 3/10\n"
299
+ ]
300
+ },
301
+ {
302
+ "name": "stderr",
303
+ "output_type": "stream",
304
+ "text": [
305
+ "/usr/lib/python3.10/contextlib.py:153: UserWarning: Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least `steps_per_epoch * epochs` batches. You may need to use the `.repeat()` function when building your dataset.\n",
306
+ " self.gen.throw(typ, value, traceback)\n"
307
+ ]
308
+ },
309
+ {
310
+ "name": "stdout",
311
+ "output_type": "stream",
312
+ "text": [
313
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/101.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f0617650>\n",
314
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/328.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f0617830>\n",
315
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/407.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f0617970>\n",
316
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/481.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f0617830>\n",
317
+ "\u001b[1m 2/23\u001b[0m \u001b[32m━\u001b[0m\u001b[37m━━━━━━━��━━━━━━━━━━━\u001b[0m \u001b[1m8s\u001b[0m 421ms/step - accuracy: 0.9439 - loss: 0.1772Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/273.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f0617dd0>\n",
318
+ "\u001b[1m10/23\u001b[0m \u001b[32m━━━━━━━━\u001b[0m\u001b[37m━━━━━━━━━━━━\u001b[0m \u001b[1m4s\u001b[0m 327ms/step - accuracy: 0.9419 - loss: 0.1812Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/450.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062c360>\n",
319
+ "\u001b[1m11/23\u001b[0m \u001b[32m━━━━━━━━━\u001b[0m\u001b[37m━━━━━━━━━━━\u001b[0m \u001b[1m3s\u001b[0m 330ms/step - accuracy: 0.9422 - loss: 0.1801Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/200.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062c680>\n",
320
+ "\u001b[1m13/23\u001b[0m \u001b[32m━━━━━━━━━━━\u001b[0m\u001b[37m━━━━━━━━━\u001b[0m \u001b[1m3s\u001b[0m 315ms/step - accuracy: 0.9426 - loss: 0.1788Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/317.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062c590>\n",
321
+ "\u001b[1m14/23\u001b[0m \u001b[32m━━━━━━━━━━━━\u001b[0m\u001b[37m━━━━━━━━\u001b[0m \u001b[1m2s\u001b[0m 307ms/step - accuracy: 0.9428 - loss: 0.1786Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/455.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062c6d0>\n",
322
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 265ms/step - accuracy: 0.9419 - loss: 0.1794Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/485.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f0777600>\n",
323
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m11s\u001b[0m 364ms/step - accuracy: 0.9417 - loss: 0.1796 - val_accuracy: 0.9057 - val_loss: 0.2701\n",
324
+ "Epoch 4/10\n",
325
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 1ms/step - accuracy: 0.0000e+00 - loss: 0.0000e+00\n",
326
+ "Epoch 5/10\n",
327
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/328.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062cc70>\n",
328
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/317.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062d260>\n",
329
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/455.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f0777600>\n",
330
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/101.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062d3a0>\n",
331
+ "\u001b[1m 5/23\u001b[0m \u001b[32m━━━━\u001b[0m\u001b[37m━━━━━━━━━━━━━━━━\u001b[0m \u001b[1m5s\u001b[0m 281ms/step - accuracy: 0.9503 - loss: 0.1660Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/273.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062cf40>\n",
332
+ "\u001b[1m 6/23\u001b[0m \u001b[32m━━━━━\u001b[0m\u001b[37m━━━━━━━━━━━━━━━\u001b[0m \u001b[1m5s\u001b[0m 312ms/step - accuracy: 0.9524 - loss: 0.1633Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/450.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062d670>\n",
333
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/200.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062db20>\n",
334
+ "\u001b[1m12/23\u001b[0m \u001b[32m━━━━━━━━━━\u001b[0m\u001b[37m━━━━━━━━━━\u001b[0m \u001b[1m3s\u001b[0m 314ms/step - accuracy: 0.9565 - loss: 0.1535Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/407.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062de40>\n",
335
+ "\u001b[1m13/23\u001b[0m \u001b[32m━━━━━━━━━━━\u001b[0m\u001b[37m━━��━━━━━━\u001b[0m \u001b[1m3s\u001b[0m 333ms/step - accuracy: 0.9571 - loss: 0.1517Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/481.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062e020>\n",
336
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 279ms/step - accuracy: 0.9616 - loss: 0.1378Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/485.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062e700>\n",
337
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m12s\u001b[0m 377ms/step - accuracy: 0.9617 - loss: 0.1370 - val_accuracy: 0.9057 - val_loss: 0.2537\n",
338
+ "Epoch 6/10\n",
339
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 2ms/step - accuracy: 0.0000e+00 - loss: 0.0000e+00\n",
340
+ "Epoch 7/10\n",
341
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/200.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062ea20>\n",
342
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/450.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062eb60>\n",
343
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/101.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062ec00>\n",
344
+ "\u001b[1m 2/23\u001b[0m \u001b[32m━\u001b[0m\u001b[37m━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[1m5s\u001b[0m 249ms/step - accuracy: 0.9519 - loss: 0.0861Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/273.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062eed0>\n",
345
+ "\u001b[1m 3/23\u001b[0m \u001b[32m━━\u001b[0m\u001b[37m━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[1m6s\u001b[0m 308ms/step - accuracy: 0.9609 - loss: 0.0776Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/328.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062f010>\n",
346
+ "\u001b[1m 5/23\u001b[0m \u001b[32m━━━━\u001b[0m\u001b[37m━━━━━━━━━━━━━━━━\u001b[0m \u001b[1m5s\u001b[0m 295ms/step - accuracy: 0.9683 - loss: 0.0721Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/407.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062f150>\n",
347
+ "\u001b[1m 6/23\u001b[0m \u001b[32m━━━━━\u001b[0m\u001b[37m━━━━━━━━━━━━━━━\u001b[0m \u001b[1m4s\u001b[0m 279ms/step - accuracy: 0.9692 - loss: 0.0733Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/481.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062c040>\n",
348
+ "\u001b[1m14/23\u001b[0m \u001b[32m━━━━━━━━━━━━\u001b[0m\u001b[37m━━━━━━━━\u001b[0m \u001b[1m3s\u001b[0m 343ms/step - accuracy: 0.9724 - loss: 0.0786Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/317.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062ecf0>\n",
349
+ "\u001b[1m15/23\u001b[0m \u001b[32m━━━━━━━━━━━━━\u001b[0m\u001b[37m━━━━━━━\u001b[0m \u001b[1m2s\u001b[0m 345ms/step - accuracy: 0.9726 - loss: 0.0789Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/455.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062f740>\n",
350
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 292ms/step - accuracy: 0.9738 - loss: 0.0811Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/485.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062fd80>\n",
351
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m11s\u001b[0m 397ms/step - accuracy: 0.9740 - loss: 0.0811 - val_accuracy: 0.8868 - val_loss: 0.2439\n",
352
+ "Epoch 8/10\n",
353
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 2ms/step - accuracy: 0.0000e+00 - loss: 0.0000e+00\n",
354
+ "Epoch 9/10\n",
355
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/317.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f06441d0>\n",
356
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/455.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062f6a0>\n",
357
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/200.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f062f6a0>\n",
358
+ "\u001b[1m 1/23\u001b[0m \u001b[37m━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[1m56s\u001b[0m 3s/step - accuracy: 1.0000 - loss: 0.0521Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/407.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f0644540>\n",
359
+ "\u001b[1m 2/23\u001b[0m \u001b[32m━\u001b[0m\u001b[37m━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[1m15s\u001b[0m 733ms/step - accuracy: 1.0000 - loss: 0.0473Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/481.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f0644180>\n",
360
+ "\u001b[1m 3/23\u001b[0m \u001b[32m━━\u001b[0m\u001b[37m━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[1m10s\u001b[0m 532ms/step - accuracy: 1.0000 - loss: 0.0434Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/273.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f0644040>\n",
361
+ "\u001b[1m 4/23\u001b[0m \u001b[32m━━━\u001b[0m\u001b[37m━━━━━━━━━━━━━━━━━\u001b[0m \u001b[1m9s\u001b[0m 483ms/step - accuracy: 0.9960 - loss: 0.0448 Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/101.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f0644040>\n",
362
+ "\u001b[1m 5/23\u001b[0m \u001b[32m━━━━\u001b[0m\u001b[37m━━━━━━━━━━━━━━━━\u001b[0m \u001b[1m9s\u001b[0m 503ms/step - accuracy: 0.9943 - loss: 0.0448Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/328.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f0644360>\n",
363
+ "\u001b[1m10/23\u001b[0m \u001b[32m━━━━━━━━\u001b[0m\u001b[37m━━━━━━━━━━━━\u001b[0m \u001b[1m5s\u001b[0m 390ms/step - accuracy: 0.9896 - loss: 0.0472Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/450.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f0644860>\n",
364
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 304ms/step - accuracy: 0.9881 - loss: 0.0508Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/485.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x7888f0645120>\n",
365
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m11s\u001b[0m 402ms/step - accuracy: 0.9881 - loss: 0.0509 - val_accuracy: 0.9057 - val_loss: 0.2370\n",
366
+ "Epoch 10/10\n",
367
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 1ms/step - accuracy: 0.0000e+00 - loss: 0.0000e+00\n",
368
+ "Epoch 1/10\n",
369
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/328.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892bb93290>\n",
370
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/101.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892bb93380>\n",
371
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/317.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892bb931f0>\n",
372
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/455.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892bb93240>\n",
373
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/200.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892bb93790>\n",
374
+ "\u001b[1m 1/23\u001b[0m \u001b[37m━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[1m3:36\u001b[0m 10s/step - accuracy: 0.7097 - loss: 0.5852Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/407.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892bb939c0>\n",
375
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/481.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892bb93a60>\n",
376
+ "\u001b[1m 7/23\u001b[0m \u001b[32m━━━━━━\u001b[0m\u001b[37m━━━━━━━━━━━━━━\u001b[0m \u001b[1m25s\u001b[0m 2s/step - accuracy: 0.7169 - loss: 0.5594Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/450.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892bb93dd0>\n",
377
+ "\u001b[1m14/23\u001b[0m \u001b[32m━━━━━━━━━━━━\u001b[0m\u001b[37m━━━━━━━━\u001b[0m \u001b[1m8s\u001b[0m 912ms/step - accuracy: 0.7475 - loss: 0.5249Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/273.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892bbac180>\n",
378
+ "\u001b[1m22/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m━\u001b[0m \u001b[1m0s\u001b[0m 609ms/step - accuracy: 0.7693 - loss: 0.4918Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/485.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892bb939c0>\n",
379
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m28s\u001b[0m 828ms/step - accuracy: 0.7741 - loss: 0.4839 - val_accuracy: 0.8302 - val_loss: 0.3507\n",
380
+ "Epoch 2/10\n",
381
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 1ms/step - accuracy: 0.0000e+00 - loss: 0.0000e+00\n",
382
+ "Epoch 3/10\n",
383
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/273.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2f8a40>\n",
384
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/200.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892bbaef20>\n",
385
+ "\u001b[1m 3/23\u001b[0m \u001b[32m━━\u001b[0m\u001b[37m━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[1m5s\u001b[0m 270ms/step - accuracy: 0.8403 - loss: 0.2648Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/450.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2f8ea0>\n",
386
+ "\u001b[1m 5/23\u001b[0m \u001b[32m━━━━\u001b[0m\u001b[37m━━━━━━━━━━━━━━━━\u001b[0m \u001b[1m5s\u001b[0m 287ms/step - accuracy: 0.8598 - loss: 0.2512Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/328.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2f92b0>\n",
387
+ "\u001b[1m 7/23\u001b[0m \u001b[32m━━━━━━\u001b[0m\u001b[37m━━━━━━━━━━━━━━\u001b[0m \u001b[1m4s\u001b[0m 277ms/step - accuracy: 0.8690 - loss: 0.2440Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/407.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2f89f0>\n",
388
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/481.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2f9440>\n",
389
+ "\u001b[1m 9/23\u001b[0m \u001b[32m━━━━━━━\u001b[0m\u001b[37m━━━━━━━━━━━━━\u001b[0m \u001b[1m3s\u001b[0m 263ms/step - accuracy: 0.8738 - loss: 0.2404Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/317.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2f9120>\n",
390
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/455.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2f96c0>\n",
391
+ "\u001b[1m13/23\u001b[0m \u001b[32m━━━━━━━━━━━\u001b[0m\u001b[37m━━━━━━━━━\u001b[0m \u001b[1m3s\u001b[0m 315ms/step - accuracy: 0.8806 - loss: 0.2354Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/101.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2f9800>\n",
392
+ "\u001b[1m22/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m━\u001b[0m \u001b[1m0s\u001b[0m 232ms/step - accuracy: 0.8880 - loss: 0.2344Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/485.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2fa250>\n",
393
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m10s\u001b[0m 311ms/step - accuracy: 0.8890 - loss: 0.2339 - val_accuracy: 0.8553 - val_loss: 0.3244\n",
394
+ "Epoch 4/10\n",
395
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 549us/step - accuracy: 0.0000e+00 - loss: 0.0000e+00\n",
396
+ "Epoch 5/10\n",
397
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/101.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2fa660>\n",
398
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/273.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892bb93b00>\n",
399
+ "\u001b[1m 5/23\u001b[0m \u001b[32m━━━━\u001b[0m\u001b[37m━━━━━━━━━━━━━━━━\u001b[0m \u001b[1m4s\u001b[0m 255ms/step - accuracy: 0.9116 - loss: 0.1889Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/450.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2fb060>\n",
400
+ "\u001b[1m 6/23\u001b[0m \u001b[32m━━━━━\u001b[0m\u001b[37m━━━━━━━━━━━━━━━\u001b[0m \u001b[1m4s\u001b[0m 270ms/step - accuracy: 0.9159 - loss: 0.1820Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/200.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2fa7f0>\n",
401
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/328.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2fa980>\n",
402
+ "\u001b[1m 9/23\u001b[0m \u001b[32m━━━━━━━\u001b[0m\u001b[37m━━━━━━━━━━━━━\u001b[0m \u001b[1m4s\u001b[0m 328ms/step - accuracy: 0.9235 - loss: 0.1682Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/317.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2faf70>\n",
403
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/455.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2fa0c0>\n",
404
+ "\u001b[1m15/23\u001b[0m \u001b[32m━━━━━━━━━━━━━\u001b[0m\u001b[37m━━━━━━━\u001b[0m \u001b[1m2s\u001b[0m 334ms/step - accuracy: 0.9311 - loss: 0.1527Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/407.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2fb5b0>\n",
405
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/481.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2fb650>\n",
406
+ "\u001b[1m22/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m━\u001b[0m \u001b[1m0s\u001b[0m 248ms/step - accuracy: 0.9352 - loss: 0.1472Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/485.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2fbc40>\n",
407
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m10s\u001b[0m 326ms/step - accuracy: 0.9358 - loss: 0.1469 - val_accuracy: 0.8994 - val_loss: 0.2897\n",
408
+ "Epoch 6/10\n",
409
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 583us/step - accuracy: 0.0000e+00 - loss: 0.0000e+00\n",
410
+ "Epoch 7/10\n",
411
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/273.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2fa7f0>\n",
412
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/450.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2fa2f0>\n",
413
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/317.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2fbd80>\n",
414
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/455.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2fa7f0>\n",
415
+ "\u001b[1m 8/23\u001b[0m \u001b[32m━━━━━━\u001b[0m\u001b[37m━━━━━━━━━━━━━━\u001b[0m \u001b[1m4s\u001b[0m 298ms/step - accuracy: 0.9654 - loss: 0.0936Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/200.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2fb600>\n",
416
+ "\u001b[1m10/23\u001b[0m \u001b[32m━━━━━━━━\u001b[0m\u001b[37m━━━━━━━━━━━━\u001b[0m \u001b[1m3s\u001b[0m 285ms/step - accuracy: 0.9663 - loss: 0.0933Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/101.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a11c6d0>\n",
417
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/328.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a11ca40>\n",
418
+ "\u001b[1m13/23\u001b[0m \u001b[32m━━━━━━━━━━━\u001b[0m\u001b[37m━━━━━━━━━\u001b[0m \u001b[1m2s\u001b[0m 279ms/step - accuracy: 0.9670 - loss: 0.0934Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/407.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2fb600>\n",
419
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/481.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a11c6d0>\n",
420
+ "\u001b[1m22/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m━\u001b[0m \u001b[1m0s\u001b[0m 233ms/step - accuracy: 0.9681 - loss: 0.0954Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/485.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a11cc70>\n",
421
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m9s\u001b[0m 309ms/step - accuracy: 0.9681 - loss: 0.0957 - val_accuracy: 0.8994 - val_loss: 0.2943\n",
422
+ "Epoch 8/10\n",
423
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 566us/step - accuracy: 0.0000e+00 - loss: 0.0000e+00\n",
424
+ "Epoch 9/10\n",
425
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/450.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a11d3a0>\n",
426
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/328.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a11d5d0>\n",
427
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/200.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a2f9670>\n",
428
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/273.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a11cd60>\n",
429
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/101.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a11cd60>\n",
430
+ "\u001b[1m 1/23\u001b[0m \u001b[37m━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[1m1:00\u001b[0m 3s/step - accuracy: 1.0000 - loss: 0.0286Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/407.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a11cc70>\n",
431
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/481.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a11cc70>\n",
432
+ "\u001b[1m 5/23\u001b[0m \u001b[32m━━━━\u001b[0m\u001b[37m━━━━━━━━━━━━━━━━\u001b[0m \u001b[1m5s\u001b[0m 320ms/step - accuracy: 0.9840 - loss: 0.0508Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/317.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a11dc60>\n",
433
+ "Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/455.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a11dd00>\n",
434
+ "\u001b[1m22/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m━\u001b[0m \u001b[1m0s\u001b[0m 231ms/step - accuracy: 0.9814 - loss: 0.0634Skipping corrupted file: /kaggle/input/oral-cancer-dataset/Oral cancer Dataset 2.0/OC Dataset kaggle new/CANCER/485.jpeg, Error: cannot identify image file <_io.BytesIO object at 0x78892a11e480>\n",
435
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m10s\u001b[0m 310ms/step - accuracy: 0.9812 - loss: 0.0640 - val_accuracy: 0.8805 - val_loss: 0.3013\n",
436
+ "Epoch 10/10\n",
437
+ "\u001b[1m23/23\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 800us/step - accuracy: 0.0000e+00 - loss: 0.0000e+00\n"
438
+ ]
439
+ }
440
+ ],
441
+ "source": [
442
+ "# Results"
443
+ ]
444
+ },
445
+ {
446
+ "cell_type": "code",
447
+ "execution_count": null,
448
+ "metadata": {},
449
+ "outputs": [],
450
+ "source": [
451
+ "# Custom Prediction Function\n",
452
+ "def predict_custom_image(model_path, image_path):\n",
453
+ " model = tf.keras.models.load_model(model_path)\n",
454
+ " image = load_img(image_path, target_size=IMG_SIZE)\n",
455
+ " image_array = img_to_array(image) / 255.0\n",
456
+ " image_array = np.expand_dims(image_array, axis=0) # Add batch dimension\n",
457
+ "\n",
458
+ " prediction = model.predict(image_array)\n",
459
+ " class_name = 'Cancer' if prediction[0][0] > 0.5 else 'Non-Cancer'\n",
460
+ " print(f\"Prediction: {class_name}, Confidence: {prediction[0][0]:.2f}\")\n",
461
+ "\n",
462
+ "# Example Usage \n",
463
+ "predict_custom_image(\"/kaggle/working/resnet152v2_oral_cancer.h5\", \"/path/to/custom/image.jpg\")\n",
464
+ "predict_custom_image(\"/kaggle/working/mobilenet_oral_cancer.h5\", \"/path/to/custom/image.jpg\")"
465
+ ]
466
+ }
467
+ ],
468
+ "metadata": {
469
+ "kaggle": {
470
+ "accelerator": "nvidiaTeslaT4",
471
+ "dataSources": [
472
+ {
473
+ "datasetId": 4426002,
474
+ "sourceId": 7716037,
475
+ "sourceType": "datasetVersion"
476
+ }
477
+ ],
478
+ "dockerImageVersionId": 30840,
479
+ "isGpuEnabled": true,
480
+ "isInternetEnabled": true,
481
+ "language": "python",
482
+ "sourceType": "notebook"
483
+ },
484
+ "kernelspec": {
485
+ "display_name": "100p",
486
+ "language": "python",
487
+ "name": "python3"
488
+ },
489
+ "language_info": {
490
+ "codemirror_mode": {
491
+ "name": "ipython",
492
+ "version": 3
493
+ },
494
+ "file_extension": ".py",
495
+ "mimetype": "text/x-python",
496
+ "name": "python",
497
+ "nbconvert_exporter": "python",
498
+ "pygments_lexer": "ipython3",
499
+ "version": "3.8.20"
500
+ }
501
+ },
502
+ "nbformat": 4,
503
+ "nbformat_minor": 4
504
+ }
resnet152v2_oral_cancer.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3341ecea95ad8ff0974287e861a89538ab4fe6e75ad3ef24089affdef25df78f
3
+ size 238205608