d4rk3r commited on
Commit
aabf3a1
·
verified ·
1 Parent(s): fcf181a

Upload 7255 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
submission.ipynb ADDED
@@ -0,0 +1,584 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "import pandas as pd\n",
10
+ "import json\n",
11
+ "import os\n",
12
+ "import shutil\n",
13
+ "import tensorflow as tf\n",
14
+ "from tensorflow.keras.preprocessing.image import ImageDataGenerator\n",
15
+ "from tensorflow.keras.utils import image_dataset_from_directory\n",
16
+ "from tensorflow.keras.models import Sequential\n",
17
+ "from tensorflow.keras.layers import Conv2D, MaxPooling2D, Flatten, Dense\n",
18
+ "from tensorflow.keras.callbacks import Callback"
19
+ ]
20
+ },
21
+ {
22
+ "cell_type": "code",
23
+ "execution_count": 2,
24
+ "metadata": {},
25
+ "outputs": [],
26
+ "source": [
27
+ "def create_dataframe(annotations_path):\n",
28
+ " with open(annotations_path, 'r') as file:\n",
29
+ " data = json.load(file)\n",
30
+ "\n",
31
+ " images = pd.DataFrame(data['images']).rename(columns={'id': 'image_id'})[['image_id', 'file_name']]\n",
32
+ "\n",
33
+ " categories = pd.DataFrame(data['categories'])[['id', 'name']]\n",
34
+ " categories.rename(columns={'id': 'category_id'}, inplace=True)\n",
35
+ "\n",
36
+ " usecols = ['image_id', 'category_id']\n",
37
+ " annotations = pd.DataFrame(data['annotations'])[usecols]\n",
38
+ "\n",
39
+ " dataframe = annotations.merge(categories, on='category_id').merge(images, on='image_id')[['file_name', 'name']]\n",
40
+ " \n",
41
+ " return dataframe"
42
+ ]
43
+ },
44
+ {
45
+ "cell_type": "code",
46
+ "execution_count": 3,
47
+ "metadata": {},
48
+ "outputs": [],
49
+ "source": [
50
+ "def copy_images_to_destination(base_dir, dataframe, split):\n",
51
+ " images_dir = os.path.join(base_dir, 'images')\n",
52
+ "\n",
53
+ " for index, row in dataframe.iterrows():\n",
54
+ " file_name = row['file_name']\n",
55
+ " file_class = row['name']\n",
56
+ "\n",
57
+ " dest_dir = os.path.join(split, file_class)\n",
58
+ " os.makedirs(dest_dir, exist_ok=True)\n",
59
+ "\n",
60
+ " source_path = os.path.join(images_dir, file_name)\n",
61
+ " destination_path = os.path.join(dest_dir, file_name)\n",
62
+ "\n",
63
+ " shutil.copyfile(source_path, destination_path)\n",
64
+ "\n",
65
+ " print(\"Done copying images.\")"
66
+ ]
67
+ },
68
+ {
69
+ "cell_type": "code",
70
+ "execution_count": 4,
71
+ "metadata": {},
72
+ "outputs": [
73
+ {
74
+ "data": {
75
+ "text/html": [
76
+ "<div>\n",
77
+ "<style scoped>\n",
78
+ " .dataframe tbody tr th:only-of-type {\n",
79
+ " vertical-align: middle;\n",
80
+ " }\n",
81
+ "\n",
82
+ " .dataframe tbody tr th {\n",
83
+ " vertical-align: top;\n",
84
+ " }\n",
85
+ "\n",
86
+ " .dataframe thead th {\n",
87
+ " text-align: right;\n",
88
+ " }\n",
89
+ "</style>\n",
90
+ "<table border=\"1\" class=\"dataframe\">\n",
91
+ " <thead>\n",
92
+ " <tr style=\"text-align: right;\">\n",
93
+ " <th></th>\n",
94
+ " <th>file_name</th>\n",
95
+ " <th>name</th>\n",
96
+ " </tr>\n",
97
+ " </thead>\n",
98
+ " <tbody>\n",
99
+ " <tr>\n",
100
+ " <th>0</th>\n",
101
+ " <td>131094.jpg</td>\n",
102
+ " <td>soft-cheese</td>\n",
103
+ " </tr>\n",
104
+ " <tr>\n",
105
+ " <th>1</th>\n",
106
+ " <td>131094.jpg</td>\n",
107
+ " <td>ham-raw</td>\n",
108
+ " </tr>\n",
109
+ " <tr>\n",
110
+ " <th>2</th>\n",
111
+ " <td>131094.jpg</td>\n",
112
+ " <td>hard-cheese</td>\n",
113
+ " </tr>\n",
114
+ " <tr>\n",
115
+ " <th>3</th>\n",
116
+ " <td>131094.jpg</td>\n",
117
+ " <td>bread-wholemeal</td>\n",
118
+ " </tr>\n",
119
+ " <tr>\n",
120
+ " <th>4</th>\n",
121
+ " <td>131094.jpg</td>\n",
122
+ " <td>cottage-cheese</td>\n",
123
+ " </tr>\n",
124
+ " <tr>\n",
125
+ " <th>...</th>\n",
126
+ " <td>...</td>\n",
127
+ " <td>...</td>\n",
128
+ " </tr>\n",
129
+ " <tr>\n",
130
+ " <th>76486</th>\n",
131
+ " <td>117029.jpg</td>\n",
132
+ " <td>damson-plum</td>\n",
133
+ " </tr>\n",
134
+ " <tr>\n",
135
+ " <th>76487</th>\n",
136
+ " <td>117524.jpg</td>\n",
137
+ " <td>damson-plum</td>\n",
138
+ " </tr>\n",
139
+ " <tr>\n",
140
+ " <th>76488</th>\n",
141
+ " <td>117849.jpg</td>\n",
142
+ " <td>damson-plum</td>\n",
143
+ " </tr>\n",
144
+ " <tr>\n",
145
+ " <th>76489</th>\n",
146
+ " <td>123468.jpg</td>\n",
147
+ " <td>damson-plum</td>\n",
148
+ " </tr>\n",
149
+ " <tr>\n",
150
+ " <th>76490</th>\n",
151
+ " <td>095795.jpg</td>\n",
152
+ " <td>bean-seeds</td>\n",
153
+ " </tr>\n",
154
+ " </tbody>\n",
155
+ "</table>\n",
156
+ "<p>76491 rows × 2 columns</p>\n",
157
+ "</div>"
158
+ ],
159
+ "text/plain": [
160
+ " file_name name\n",
161
+ "0 131094.jpg soft-cheese\n",
162
+ "1 131094.jpg ham-raw\n",
163
+ "2 131094.jpg hard-cheese\n",
164
+ "3 131094.jpg bread-wholemeal\n",
165
+ "4 131094.jpg cottage-cheese\n",
166
+ "... ... ...\n",
167
+ "76486 117029.jpg damson-plum\n",
168
+ "76487 117524.jpg damson-plum\n",
169
+ "76488 117849.jpg damson-plum\n",
170
+ "76489 123468.jpg damson-plum\n",
171
+ "76490 095795.jpg bean-seeds\n",
172
+ "\n",
173
+ "[76491 rows x 2 columns]"
174
+ ]
175
+ },
176
+ "execution_count": 4,
177
+ "metadata": {},
178
+ "output_type": "execute_result"
179
+ }
180
+ ],
181
+ "source": [
182
+ "train_df = create_dataframe('train/annotations.json')\n",
183
+ "train_df"
184
+ ]
185
+ },
186
+ {
187
+ "cell_type": "code",
188
+ "execution_count": 5,
189
+ "metadata": {},
190
+ "outputs": [],
191
+ "source": [
192
+ "splits = ['train', 'val']\n",
193
+ "\n",
194
+ "for split in splits:\n",
195
+ " root = f'{split}'\n",
196
+ "\n",
197
+ " for index, row in train_df.iterrows():\n",
198
+ " directory_name = row['name']\n",
199
+ " directory_path = os.path.join(root, directory_name)\n",
200
+ "\n",
201
+ " if not os.path.exists(directory_path):\n",
202
+ " os.makedirs(directory_path)"
203
+ ]
204
+ },
205
+ {
206
+ "cell_type": "code",
207
+ "execution_count": 6,
208
+ "metadata": {},
209
+ "outputs": [
210
+ {
211
+ "data": {
212
+ "text/html": [
213
+ "<div>\n",
214
+ "<style scoped>\n",
215
+ " .dataframe tbody tr th:only-of-type {\n",
216
+ " vertical-align: middle;\n",
217
+ " }\n",
218
+ "\n",
219
+ " .dataframe tbody tr th {\n",
220
+ " vertical-align: top;\n",
221
+ " }\n",
222
+ "\n",
223
+ " .dataframe thead th {\n",
224
+ " text-align: right;\n",
225
+ " }\n",
226
+ "</style>\n",
227
+ "<table border=\"1\" class=\"dataframe\">\n",
228
+ " <thead>\n",
229
+ " <tr style=\"text-align: right;\">\n",
230
+ " <th></th>\n",
231
+ " <th>file_name</th>\n",
232
+ " <th>name</th>\n",
233
+ " </tr>\n",
234
+ " </thead>\n",
235
+ " <tbody>\n",
236
+ " <tr>\n",
237
+ " <th>0</th>\n",
238
+ " <td>149022.jpg</td>\n",
239
+ " <td>espresso-with-caffeine</td>\n",
240
+ " </tr>\n",
241
+ " <tr>\n",
242
+ " <th>1</th>\n",
243
+ " <td>149022.jpg</td>\n",
244
+ " <td>dark-chocolate</td>\n",
245
+ " </tr>\n",
246
+ " <tr>\n",
247
+ " <th>2</th>\n",
248
+ " <td>167905.jpg</td>\n",
249
+ " <td>espresso-with-caffeine</td>\n",
250
+ " </tr>\n",
251
+ " <tr>\n",
252
+ " <th>3</th>\n",
253
+ " <td>121313.jpg</td>\n",
254
+ " <td>espresso-with-caffeine</td>\n",
255
+ " </tr>\n",
256
+ " <tr>\n",
257
+ " <th>4</th>\n",
258
+ " <td>153429.jpg</td>\n",
259
+ " <td>espresso-with-caffeine</td>\n",
260
+ " </tr>\n",
261
+ " <tr>\n",
262
+ " <th>...</th>\n",
263
+ " <td>...</td>\n",
264
+ " <td>...</td>\n",
265
+ " </tr>\n",
266
+ " <tr>\n",
267
+ " <th>1825</th>\n",
268
+ " <td>144675.jpg</td>\n",
269
+ " <td>oat-milk</td>\n",
270
+ " </tr>\n",
271
+ " <tr>\n",
272
+ " <th>1826</th>\n",
273
+ " <td>103273.jpg</td>\n",
274
+ " <td>soup-potato</td>\n",
275
+ " </tr>\n",
276
+ " <tr>\n",
277
+ " <th>1827</th>\n",
278
+ " <td>159922.jpg</td>\n",
279
+ " <td>red-cabbage</td>\n",
280
+ " </tr>\n",
281
+ " <tr>\n",
282
+ " <th>1828</th>\n",
283
+ " <td>011275.jpg</td>\n",
284
+ " <td>pasta-in-conch-form</td>\n",
285
+ " </tr>\n",
286
+ " <tr>\n",
287
+ " <th>1829</th>\n",
288
+ " <td>166537.jpg</td>\n",
289
+ " <td>chocolate</td>\n",
290
+ " </tr>\n",
291
+ " </tbody>\n",
292
+ "</table>\n",
293
+ "<p>1830 rows × 2 columns</p>\n",
294
+ "</div>"
295
+ ],
296
+ "text/plain": [
297
+ " file_name name\n",
298
+ "0 149022.jpg espresso-with-caffeine\n",
299
+ "1 149022.jpg dark-chocolate\n",
300
+ "2 167905.jpg espresso-with-caffeine\n",
301
+ "3 121313.jpg espresso-with-caffeine\n",
302
+ "4 153429.jpg espresso-with-caffeine\n",
303
+ "... ... ...\n",
304
+ "1825 144675.jpg oat-milk\n",
305
+ "1826 103273.jpg soup-potato\n",
306
+ "1827 159922.jpg red-cabbage\n",
307
+ "1828 011275.jpg pasta-in-conch-form\n",
308
+ "1829 166537.jpg chocolate\n",
309
+ "\n",
310
+ "[1830 rows x 2 columns]"
311
+ ]
312
+ },
313
+ "execution_count": 6,
314
+ "metadata": {},
315
+ "output_type": "execute_result"
316
+ }
317
+ ],
318
+ "source": [
319
+ "val_df = create_dataframe('val/annotations.json')\n",
320
+ "val_df"
321
+ ]
322
+ },
323
+ {
324
+ "cell_type": "code",
325
+ "execution_count": 7,
326
+ "metadata": {},
327
+ "outputs": [
328
+ {
329
+ "name": "stdout",
330
+ "output_type": "stream",
331
+ "text": [
332
+ "Done copying images.\n"
333
+ ]
334
+ }
335
+ ],
336
+ "source": [
337
+ "base_dir = 'train'\n",
338
+ "dataframe = train_df\n",
339
+ "copy_images_to_destination(base_dir, dataframe, 'train')"
340
+ ]
341
+ },
342
+ {
343
+ "cell_type": "code",
344
+ "execution_count": 8,
345
+ "metadata": {},
346
+ "outputs": [
347
+ {
348
+ "name": "stdout",
349
+ "output_type": "stream",
350
+ "text": [
351
+ "Done copying images.\n"
352
+ ]
353
+ }
354
+ ],
355
+ "source": [
356
+ "base_dir = 'val'\n",
357
+ "dataframe = val_df\n",
358
+ "copy_images_to_destination(base_dir, dataframe, 'val')"
359
+ ]
360
+ },
361
+ {
362
+ "cell_type": "code",
363
+ "execution_count": 2,
364
+ "metadata": {},
365
+ "outputs": [
366
+ {
367
+ "name": "stdout",
368
+ "output_type": "stream",
369
+ "text": [
370
+ "Found 70397 files belonging to 498 classes.\n",
371
+ "Found 1799 files belonging to 498 classes.\n"
372
+ ]
373
+ }
374
+ ],
375
+ "source": [
376
+ "train = image_dataset_from_directory(\n",
377
+ " directory='train',\n",
378
+ " label_mode='categorical',\n",
379
+ " batch_size=32,\n",
380
+ " image_size=(299, 299)\n",
381
+ ")\n",
382
+ "\n",
383
+ "val = image_dataset_from_directory(\n",
384
+ " directory='val',\n",
385
+ " label_mode='categorical',\n",
386
+ " batch_size=32,\n",
387
+ " image_size=(299, 299)\n",
388
+ ")"
389
+ ]
390
+ },
391
+ {
392
+ "cell_type": "code",
393
+ "execution_count": 3,
394
+ "metadata": {},
395
+ "outputs": [],
396
+ "source": [
397
+ "train_datagen = ImageDataGenerator(\n",
398
+ " rescale=1./255,\n",
399
+ " shear_range=0.2,\n",
400
+ " zoom_range=0.2,\n",
401
+ " horizontal_flip=True\n",
402
+ ")\n",
403
+ "\n",
404
+ "val_datagen = ImageDataGenerator(rescale=1./255)"
405
+ ]
406
+ },
407
+ {
408
+ "cell_type": "code",
409
+ "execution_count": 4,
410
+ "metadata": {},
411
+ "outputs": [],
412
+ "source": [
413
+ "class MyCallback(Callback):\n",
414
+ " def on_epoch_end(self, epoch, logs={}):\n",
415
+ " if logs.get('val_categorical_accuracy') >= 0.81:\n",
416
+ " print('Validation accuracy reached 81%. Stopping training.')"
417
+ ]
418
+ },
419
+ {
420
+ "cell_type": "code",
421
+ "execution_count": 5,
422
+ "metadata": {},
423
+ "outputs": [
424
+ {
425
+ "name": "stdout",
426
+ "output_type": "stream",
427
+ "text": [
428
+ "Model: \"sequential\"\n",
429
+ "_________________________________________________________________\n",
430
+ " Layer (type) Output Shape Param # \n",
431
+ "=================================================================\n",
432
+ " conv2d (Conv2D) (None, 297, 297, 32) 896 \n",
433
+ " \n",
434
+ " max_pooling2d (MaxPooling2D (None, 148, 148, 32) 0 \n",
435
+ " ) \n",
436
+ " \n",
437
+ " conv2d_1 (Conv2D) (None, 146, 146, 64) 18496 \n",
438
+ " \n",
439
+ " max_pooling2d_1 (MaxPooling (None, 73, 73, 64) 0 \n",
440
+ " 2D) \n",
441
+ " \n",
442
+ " conv2d_2 (Conv2D) (None, 71, 71, 128) 73856 \n",
443
+ " \n",
444
+ " max_pooling2d_2 (MaxPooling (None, 35, 35, 128) 0 \n",
445
+ " 2D) \n",
446
+ " \n",
447
+ " flatten (Flatten) (None, 156800) 0 \n",
448
+ " \n",
449
+ " dense (Dense) (None, 128) 20070528 \n",
450
+ " \n",
451
+ " dense_1 (Dense) (None, 498) 64242 \n",
452
+ " \n",
453
+ "=================================================================\n",
454
+ "Total params: 20,228,018\n",
455
+ "Trainable params: 20,228,018\n",
456
+ "Non-trainable params: 0\n",
457
+ "_________________________________________________________________\n"
458
+ ]
459
+ }
460
+ ],
461
+ "source": [
462
+ "model = Sequential()\n",
463
+ "model.add(Conv2D(32, (3, 3), activation='relu', input_shape=(299, 299, 3)))\n",
464
+ "model.add(MaxPooling2D((2, 2)))\n",
465
+ "model.add(Conv2D(64, (3, 3), activation='relu'))\n",
466
+ "model.add(MaxPooling2D((2, 2)))\n",
467
+ "model.add(Conv2D(128, (3, 3), activation='relu'))\n",
468
+ "model.add(MaxPooling2D((2, 2)))\n",
469
+ "model.add(Flatten())\n",
470
+ "model.add(Dense(128, activation='relu'))\n",
471
+ "model.add(Dense(498, activation='softmax'))\n",
472
+ "\n",
473
+ "model.summary()\n",
474
+ "\n",
475
+ "model.compile(optimizer=tf.keras.optimizers.Adam(),\n",
476
+ " loss=tf.keras.losses.CategoricalCrossentropy(),\n",
477
+ " metrics=[tf.keras.metrics.CategoricalAccuracy()])"
478
+ ]
479
+ },
480
+ {
481
+ "cell_type": "code",
482
+ "execution_count": 6,
483
+ "metadata": {},
484
+ "outputs": [
485
+ {
486
+ "name": "stdout",
487
+ "output_type": "stream",
488
+ "text": [
489
+ "Epoch 1/32\n",
490
+ " 6/2200 [..............................] - ETA: 6:25 - loss: 504.5968 - categorical_accuracy: 0.0052 WARNING:tensorflow:Callback method `on_train_batch_end` is slow compared to the batch time (batch time: 0.0608s vs `on_train_batch_end` time: 0.0957s). Check your callbacks.\n",
491
+ "2200/2200 [==============================] - 291s 130ms/step - loss: 6.9090 - categorical_accuracy: 0.0398 - val_loss: 5.5961 - val_categorical_accuracy: 0.0411\n",
492
+ "Epoch 2/32\n",
493
+ "2200/2200 [==============================] - 279s 127ms/step - loss: 5.4654 - categorical_accuracy: 0.0420 - val_loss: 5.5951 - val_categorical_accuracy: 0.0417\n",
494
+ "Epoch 3/32\n",
495
+ "2200/2200 [==============================] - 276s 125ms/step - loss: 5.4428 - categorical_accuracy: 0.0449 - val_loss: 5.6058 - val_categorical_accuracy: 0.0417\n",
496
+ "Epoch 4/32\n",
497
+ "2200/2200 [==============================] - 285s 130ms/step - loss: 5.3952 - categorical_accuracy: 0.0528 - val_loss: 5.6658 - val_categorical_accuracy: 0.0411\n",
498
+ "Epoch 5/32\n",
499
+ "2200/2200 [==============================] - 282s 128ms/step - loss: 5.3362 - categorical_accuracy: 0.0630 - val_loss: 5.7703 - val_categorical_accuracy: 0.0406\n",
500
+ "Epoch 6/32\n",
501
+ "2200/2200 [==============================] - 326s 148ms/step - loss: 5.2673 - categorical_accuracy: 0.0755 - val_loss: 5.7254 - val_categorical_accuracy: 0.0411\n",
502
+ "Epoch 7/32\n",
503
+ "2200/2200 [==============================] - 300s 136ms/step - loss: 5.2040 - categorical_accuracy: 0.0875 - val_loss: 5.8228 - val_categorical_accuracy: 0.0411\n",
504
+ "Epoch 8/32\n",
505
+ "2200/2200 [==============================] - 382s 174ms/step - loss: 5.1794 - categorical_accuracy: 0.0927 - val_loss: 6.0131 - val_categorical_accuracy: 0.0411\n",
506
+ "Epoch 9/32\n",
507
+ "2200/2200 [==============================] - 372s 169ms/step - loss: 5.1426 - categorical_accuracy: 0.0984 - val_loss: 6.0550 - val_categorical_accuracy: 0.0406\n",
508
+ "Epoch 10/32\n",
509
+ "2200/2200 [==============================] - 335s 152ms/step - loss: 5.0958 - categorical_accuracy: 0.1058 - val_loss: 6.3628 - val_categorical_accuracy: 0.0389\n",
510
+ "Epoch 11/32\n",
511
+ "2200/2200 [==============================] - 354s 161ms/step - loss: 5.0727 - categorical_accuracy: 0.1111 - val_loss: 6.4603 - val_categorical_accuracy: 0.0378\n",
512
+ "Epoch 12/32\n",
513
+ "2200/2200 [==============================] - 356s 162ms/step - loss: 5.0326 - categorical_accuracy: 0.1166 - val_loss: 6.7461 - val_categorical_accuracy: 0.0417\n",
514
+ "Epoch 13/32\n",
515
+ "2200/2200 [==============================] - 354s 161ms/step - loss: 5.0137 - categorical_accuracy: 0.1208 - val_loss: 6.9263 - val_categorical_accuracy: 0.0395\n",
516
+ "Epoch 14/32\n",
517
+ "2200/2200 [==============================] - 349s 159ms/step - loss: 4.9708 - categorical_accuracy: 0.1281 - val_loss: 6.9836 - val_categorical_accuracy: 0.0378\n",
518
+ "Epoch 15/32\n",
519
+ "2200/2200 [==============================] - 368s 167ms/step - loss: 4.9531 - categorical_accuracy: 0.1318 - val_loss: 6.6221 - val_categorical_accuracy: 0.0384\n",
520
+ "Epoch 16/32\n",
521
+ "2200/2200 [==============================] - 360s 164ms/step - loss: 4.9288 - categorical_accuracy: 0.1357 - val_loss: 6.6952 - val_categorical_accuracy: 0.0378\n",
522
+ "Epoch 17/32\n",
523
+ "2200/2200 [==============================] - 359s 163ms/step - loss: 4.8955 - categorical_accuracy: 0.1403 - val_loss: 6.6760 - val_categorical_accuracy: 0.0400\n",
524
+ "Epoch 18/32\n",
525
+ "2200/2200 [==============================] - 354s 161ms/step - loss: 4.8613 - categorical_accuracy: 0.1455 - val_loss: 7.7695 - val_categorical_accuracy: 0.0384\n",
526
+ "Epoch 19/32\n",
527
+ "2200/2200 [==============================] - 327s 148ms/step - loss: 4.8498 - categorical_accuracy: 0.1494 - val_loss: 7.5958 - val_categorical_accuracy: 0.0361\n",
528
+ "Epoch 20/32\n",
529
+ "2200/2200 [==============================] - 362s 165ms/step - loss: 4.7999 - categorical_accuracy: 0.1556 - val_loss: 7.8458 - val_categorical_accuracy: 0.0372\n",
530
+ "Epoch 21/32\n",
531
+ "2200/2200 [==============================] - 361s 164ms/step - loss: 4.7786 - categorical_accuracy: 0.1594 - val_loss: 8.5637 - val_categorical_accuracy: 0.0389\n",
532
+ "Epoch 22/32\n",
533
+ "2200/2200 [==============================] - 360s 164ms/step - loss: 4.7561 - categorical_accuracy: 0.1645 - val_loss: 8.0804 - val_categorical_accuracy: 0.0384\n",
534
+ "Epoch 23/32\n",
535
+ "2200/2200 [==============================] - 301s 137ms/step - loss: 4.7279 - categorical_accuracy: 0.1694 - val_loss: 8.9041 - val_categorical_accuracy: 0.0372\n",
536
+ "Epoch 24/32\n",
537
+ "2200/2200 [==============================] - 310s 140ms/step - loss: 4.6962 - categorical_accuracy: 0.1732 - val_loss: 9.0381 - val_categorical_accuracy: 0.0361\n",
538
+ "Epoch 25/32\n",
539
+ "2200/2200 [==============================] - 314s 142ms/step - loss: 4.6756 - categorical_accuracy: 0.1769 - val_loss: 8.6350 - val_categorical_accuracy: 0.0378\n",
540
+ "Epoch 26/32\n",
541
+ "2200/2200 [==============================] - 296s 134ms/step - loss: 4.6531 - categorical_accuracy: 0.1820 - val_loss: 9.3287 - val_categorical_accuracy: 0.0367\n",
542
+ "Epoch 27/32\n",
543
+ "2200/2200 [==============================] - 282s 128ms/step - loss: 4.6207 - categorical_accuracy: 0.1875 - val_loss: 9.8095 - val_categorical_accuracy: 0.0361\n",
544
+ "Epoch 28/32\n",
545
+ "2200/2200 [==============================] - 349s 158ms/step - loss: 4.6045 - categorical_accuracy: 0.1904 - val_loss: 9.4419 - val_categorical_accuracy: 0.0378\n",
546
+ "Epoch 29/32\n",
547
+ "2200/2200 [==============================] - 326s 148ms/step - loss: 4.5832 - categorical_accuracy: 0.1945 - val_loss: 9.4719 - val_categorical_accuracy: 0.0361\n",
548
+ "Epoch 30/32\n",
549
+ "2200/2200 [==============================] - 361s 164ms/step - loss: 4.5393 - categorical_accuracy: 0.2010 - val_loss: 9.8935 - val_categorical_accuracy: 0.0395\n",
550
+ "Epoch 31/32\n",
551
+ "2200/2200 [==============================] - 334s 152ms/step - loss: 4.5176 - categorical_accuracy: 0.2052 - val_loss: 9.9011 - val_categorical_accuracy: 0.0378\n",
552
+ "Epoch 32/32\n",
553
+ "2200/2200 [==============================] - 344s 156ms/step - loss: 4.4989 - categorical_accuracy: 0.2082 - val_loss: 10.2300 - val_categorical_accuracy: 0.0378\n"
554
+ ]
555
+ }
556
+ ],
557
+ "source": [
558
+ "callback = MyCallback()\n",
559
+ "history = model.fit(train, epochs=32, validation_data=val, callbacks=[callback])"
560
+ ]
561
+ }
562
+ ],
563
+ "metadata": {
564
+ "kernelspec": {
565
+ "display_name": "gpu",
566
+ "language": "python",
567
+ "name": "python3"
568
+ },
569
+ "language_info": {
570
+ "codemirror_mode": {
571
+ "name": "ipython",
572
+ "version": 3
573
+ },
574
+ "file_extension": ".py",
575
+ "mimetype": "text/x-python",
576
+ "name": "python",
577
+ "nbconvert_exporter": "python",
578
+ "pygments_lexer": "ipython3",
579
+ "version": "3.9.18"
580
+ }
581
+ },
582
+ "nbformat": 4,
583
+ "nbformat_minor": 2
584
+ }
test/images/007058.jpg ADDED

Git LFS Details

  • SHA256: bdd4978c0cf15d12af1029ce70a1163761386281460f1771b62f55fabd875bee
  • Pointer size: 130 Bytes
  • Size of remote file: 33.3 kB
test/images/007953.jpg ADDED

Git LFS Details

  • SHA256: d4ece96e3305e82984a6e00d3a6f29ded316b424659a1f36df5caa3d02fd12a9
  • Pointer size: 130 Bytes
  • Size of remote file: 26.7 kB
test/images/007997.jpg ADDED

Git LFS Details

  • SHA256: 61cbb8eebe9c756e128bd4ba6df2d3d77f0995499f6343f658e5aaf57d8654c5
  • Pointer size: 130 Bytes
  • Size of remote file: 42.4 kB
test/images/008553.jpg ADDED

Git LFS Details

  • SHA256: 347b1891ff1647e4e3626e33025bccc1b5feab79df05cf40bd7e520e50b3749d
  • Pointer size: 130 Bytes
  • Size of remote file: 22.5 kB
test/images/008849.jpg ADDED

Git LFS Details

  • SHA256: 391bf352da21e82f8bcc67d38c6fbe7051d4c624bb6ad15f52dcb9b9c1dd6175
  • Pointer size: 130 Bytes
  • Size of remote file: 15 kB
test/images/008867.jpg ADDED

Git LFS Details

  • SHA256: f2599cc76798dbfe976c44fdfc7adeb413de4a71c9794716ea440bf7720a74cc
  • Pointer size: 132 Bytes
  • Size of remote file: 3.62 MB
test/images/009675.jpg ADDED

Git LFS Details

  • SHA256: dc65b0ede1601a19ba5d4a6d11b09f1dcdbd4aef30f6730eab5bbeba3f1c3097
  • Pointer size: 130 Bytes
  • Size of remote file: 22.5 kB
test/images/010090.jpg ADDED

Git LFS Details

  • SHA256: 765440be390d272fb0d1d4cf3ce526f78ec7046bddad41db1fa161b265501641
  • Pointer size: 130 Bytes
  • Size of remote file: 27.5 kB
test/images/011397.jpg ADDED

Git LFS Details

  • SHA256: b61753c88fbbae24442e9bc9d6eb94304b918a5c1cbec8a1d743a72c80f93669
  • Pointer size: 130 Bytes
  • Size of remote file: 27.4 kB
test/images/012020.jpg ADDED

Git LFS Details

  • SHA256: 99be0913dde9380d95148adec02f7c1d51608a2e6368d197eb81db6e5bdd3d9e
  • Pointer size: 130 Bytes
  • Size of remote file: 35.1 kB
test/images/012030.jpg ADDED

Git LFS Details

  • SHA256: bc8508ce2a1e6a8a0e4bb873a380c3f754ae5a18590f9c34c190658483bdb15d
  • Pointer size: 130 Bytes
  • Size of remote file: 62.7 kB
test/images/012804.jpg ADDED

Git LFS Details

  • SHA256: 16f7b2eae8fd7ee64968f42913c68ba0f684f702bab3e063b315a50339baf63a
  • Pointer size: 130 Bytes
  • Size of remote file: 77.5 kB
test/images/013183.jpg ADDED

Git LFS Details

  • SHA256: fad65d4e23f265cfeb36b05e03004563fd60935c95d02b5263aeec5a21813d4d
  • Pointer size: 130 Bytes
  • Size of remote file: 73.6 kB
test/images/013438.jpg ADDED

Git LFS Details

  • SHA256: 83f3a238241b640f9358e4c76ed6ca8e71a16a721044757a305de0f0d6553abc
  • Pointer size: 130 Bytes
  • Size of remote file: 43.3 kB
test/images/013676.jpg ADDED

Git LFS Details

  • SHA256: ca8df8083b8d106495e3cffd8643943f5ec1fcf19ae290ec3f6dda49e10aab6b
  • Pointer size: 130 Bytes
  • Size of remote file: 23.1 kB
test/images/013836.jpg ADDED

Git LFS Details

  • SHA256: 00c18424d79b0d3c189e9ef0daaa8d125b86f59522f47859bcb594c5f066af31
  • Pointer size: 130 Bytes
  • Size of remote file: 27.1 kB
test/images/014372.jpg ADDED

Git LFS Details

  • SHA256: 25696541177c0c87709c1dfdecf9010adbce59d6af448622f3b43551162ad524
  • Pointer size: 130 Bytes
  • Size of remote file: 55.4 kB
test/images/014868.jpg ADDED

Git LFS Details

  • SHA256: c61adaa197bf179981c1e557021bcaf091b743f359e91b7d8786599666c00508
  • Pointer size: 130 Bytes
  • Size of remote file: 32.2 kB
test/images/015786.jpg ADDED

Git LFS Details

  • SHA256: 69595d3eb5ec33f4a627c0ee40eb2b60e8d8da1e24c3d7c454497ad7ce050150
  • Pointer size: 130 Bytes
  • Size of remote file: 20.3 kB
test/images/016313.jpg ADDED

Git LFS Details

  • SHA256: e83317a189131031b9f136d6b37b61879b4d91ba1999f09aa1fb4880c67bc09e
  • Pointer size: 130 Bytes
  • Size of remote file: 60.4 kB
test/images/016840.jpg ADDED

Git LFS Details

  • SHA256: a1869807516c6c4293cdf079383baf44b15a117108783632715641f26d5ac4e0
  • Pointer size: 130 Bytes
  • Size of remote file: 72.8 kB
test/images/017119.jpg ADDED

Git LFS Details

  • SHA256: 3579a5434e009b4ff6979d131be0fd350b8e0ed9a524317a4db5d5ac2d3d3377
  • Pointer size: 130 Bytes
  • Size of remote file: 45.5 kB
test/images/017361.jpg ADDED

Git LFS Details

  • SHA256: 121a26053ca3a3a9038b471314f499d9917fd77acf9c612a56086c0b4f48c864
  • Pointer size: 130 Bytes
  • Size of remote file: 61.8 kB
test/images/017733.jpg ADDED

Git LFS Details

  • SHA256: 16d91ec6fa38cd3c734d2bd0ddd56fc73cfba789589c2c79520ea267bb290347
  • Pointer size: 130 Bytes
  • Size of remote file: 40.2 kB
test/images/017776.jpg ADDED

Git LFS Details

  • SHA256: 4aaa7fcff79ff5168823f405b5c0deab7c60bf8f704670f98387ec44626f464e
  • Pointer size: 130 Bytes
  • Size of remote file: 60.6 kB
test/images/018233.jpg ADDED

Git LFS Details

  • SHA256: 331c1d6a11d639efb22bb7435a392e825d56396719424a11f1c0387574b47d98
  • Pointer size: 130 Bytes
  • Size of remote file: 26.9 kB
test/images/018530.jpg ADDED

Git LFS Details

  • SHA256: f913e27142f0d8dc15fce0d6efe159d751ff931a5be58ced94d65a714c5b401e
  • Pointer size: 130 Bytes
  • Size of remote file: 53.6 kB
test/images/019373.jpg ADDED

Git LFS Details

  • SHA256: f0b08ee4caa24f73e2453a017b99a756ab06007140dfadd50a5c8c4ccd66c1aa
  • Pointer size: 130 Bytes
  • Size of remote file: 74.4 kB
test/images/019440.jpg ADDED

Git LFS Details

  • SHA256: de4299c93d436b1c567905687c716c2d267cbf460bc4444e34863ac3842a18b9
  • Pointer size: 130 Bytes
  • Size of remote file: 54.7 kB
test/images/019600.jpg ADDED

Git LFS Details

  • SHA256: 118fe20b4bd10313c91c1b57940e5ca6a3371a5935514f71ec88f7d2de67ef3f
  • Pointer size: 130 Bytes
  • Size of remote file: 42.2 kB
test/images/019735.jpg ADDED

Git LFS Details

  • SHA256: 2c7ba5e6965dc3ec1070a85d73b55058e83e03438bef4aef9cbb2a43fd2a86a0
  • Pointer size: 130 Bytes
  • Size of remote file: 26 kB
test/images/020108.jpg ADDED

Git LFS Details

  • SHA256: 399d9592a6a61be1582ba138441b808bd720a3acf14724cedad3108bdf41e6e7
  • Pointer size: 130 Bytes
  • Size of remote file: 23.4 kB
test/images/020144.jpg ADDED

Git LFS Details

  • SHA256: 99692b514bbd5c97dc1f611381a9ac137ac3bf3ec329977c9ff3fecaf1e548b7
  • Pointer size: 130 Bytes
  • Size of remote file: 29.4 kB
test/images/020191.jpg ADDED

Git LFS Details

  • SHA256: 85f40300ea3b498e608ef1285ddedfb17a48d7a14d4cc10a77d7443935f1083c
  • Pointer size: 130 Bytes
  • Size of remote file: 26.7 kB
test/images/020419.jpg ADDED

Git LFS Details

  • SHA256: 74108cfe578535224f0660c906cc98f2ed36f50d92134e5f4327154bd2dcb6e5
  • Pointer size: 130 Bytes
  • Size of remote file: 40.4 kB
test/images/020478.jpg ADDED

Git LFS Details

  • SHA256: 6bc32961018a43432866282787ea458569fa20ffae57ad61424207599ada3686
  • Pointer size: 130 Bytes
  • Size of remote file: 32.2 kB
test/images/020803.jpg ADDED

Git LFS Details

  • SHA256: af68bc0dc36b7010baad979decc7f2a0868a482e21eec6e5a587908b27f4bdc1
  • Pointer size: 130 Bytes
  • Size of remote file: 47.2 kB
test/images/020982.jpg ADDED

Git LFS Details

  • SHA256: 9a48fac452890c5b8ff112f1710976a6dcfda61efa44062ca9aee0831d71a6bc
  • Pointer size: 130 Bytes
  • Size of remote file: 47.5 kB
test/images/021228.jpg ADDED

Git LFS Details

  • SHA256: 0ba4db343ce0151139eaa72d197224da5d1abc9918ae6db97bfcab444bb13b90
  • Pointer size: 130 Bytes
  • Size of remote file: 37 kB
test/images/022106.jpg ADDED

Git LFS Details

  • SHA256: 27c9217697e06ce3b238bcb9bc2b2a5cd8dfea81b5fb97e9c8d8aeb90ace9dd9
  • Pointer size: 130 Bytes
  • Size of remote file: 29.5 kB
test/images/023385.jpg ADDED

Git LFS Details

  • SHA256: 79820161701b20f6ff476b15ab62b2fb3574a32cca88ee31980133a2fcd25699
  • Pointer size: 130 Bytes
  • Size of remote file: 40.5 kB
test/images/023428.jpg ADDED

Git LFS Details

  • SHA256: d1bbfca8145087f6b5fb360e74d542ea8135ead95d399fb68f2ef0e7f6b2c823
  • Pointer size: 130 Bytes
  • Size of remote file: 24.6 kB
test/images/024024.jpg ADDED

Git LFS Details

  • SHA256: 565e439d65a9ffa67d3f9777ee4103d192217837f4ed711b09da094e3b58e77d
  • Pointer size: 130 Bytes
  • Size of remote file: 76.6 kB
test/images/024250.jpg ADDED

Git LFS Details

  • SHA256: 4fc755057e692a199699591484a8b14178fce3855ad9c9dbabd8b5d615ece3c6
  • Pointer size: 130 Bytes
  • Size of remote file: 71.4 kB
test/images/024446.jpg ADDED

Git LFS Details

  • SHA256: eacf66a961f02127def740e1a507cc84a5f9733b5817d02e1fafb2aa8baff4de
  • Pointer size: 130 Bytes
  • Size of remote file: 68.8 kB
test/images/024676.jpg ADDED

Git LFS Details

  • SHA256: eaccdeed100486bc4cfc55aaae8b9f646c690789a4667f3ea701cdf1043efe59
  • Pointer size: 130 Bytes
  • Size of remote file: 40.6 kB
test/images/025218.jpg ADDED

Git LFS Details

  • SHA256: 7e61e14f2c1499f70cf3e91173b4d0d6aa0697591db7711ed8d1765982ccdbf4
  • Pointer size: 130 Bytes
  • Size of remote file: 47.4 kB
test/images/025319.jpg ADDED

Git LFS Details

  • SHA256: ec42b1c963c284130a156d75c01371afa8e629fd6bbe20fdcd5e01b059a1faff
  • Pointer size: 130 Bytes
  • Size of remote file: 49.7 kB
test/images/025481.jpg ADDED

Git LFS Details

  • SHA256: 86f04943d9bd4e3fb945e917cbbb97feef26c6b330243db980d9bba2fa45fdbd
  • Pointer size: 130 Bytes
  • Size of remote file: 29 kB