pavuluriashwitha commited on
Commit
dfbed13
Β·
verified Β·
1 Parent(s): c788cc9

Upload CNNExplorer.ipynb

Browse files
Files changed (1) hide show
  1. CNNExplorer.ipynb +968 -0
CNNExplorer.ipynb ADDED
@@ -0,0 +1,968 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 33,
6
+ "id": "5eb63b43-0aff-4a50-9d64-d568bcd8f76a",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import pandas as pd\n",
11
+ "import numpy as np\n",
12
+ "import cv2\n",
13
+ "import os\n",
14
+ "from sklearn.preprocessing import LabelEncoder"
15
+ ]
16
+ },
17
+ {
18
+ "cell_type": "code",
19
+ "execution_count": 37,
20
+ "id": "2ec6794d-f9bd-4768-96c4-6605aba3dba8",
21
+ "metadata": {},
22
+ "outputs": [],
23
+ "source": [
24
+ "from keras.models import Sequential"
25
+ ]
26
+ },
27
+ {
28
+ "cell_type": "code",
29
+ "execution_count": 47,
30
+ "id": "bd92c9fa-2270-43b5-b09f-16b632b1cbe0",
31
+ "metadata": {},
32
+ "outputs": [],
33
+ "source": [
34
+ "from keras.layers import Dense,Dropout,Flatten,InputLayer,Conv2D,MaxPooling2D,Flatten"
35
+ ]
36
+ },
37
+ {
38
+ "cell_type": "code",
39
+ "execution_count": 9,
40
+ "id": "ee62cce2-debe-49e2-b81f-9e7e402f8290",
41
+ "metadata": {},
42
+ "outputs": [],
43
+ "source": [
44
+ "class_label=pd.read_json(\"C:\\\\Users\\\\DELL\\\\Desktop\\\\cnn-explainer-master\\\\cnn-explainer-master\\\\tiny-vgg\\\\data\\\\data\\\\class_dict_10.json\")"
45
+ ]
46
+ },
47
+ {
48
+ "cell_type": "code",
49
+ "execution_count": 11,
50
+ "id": "e2dd374d-995b-4560-b0c5-40df1f3126bb",
51
+ "metadata": {},
52
+ "outputs": [
53
+ {
54
+ "data": {
55
+ "text/html": [
56
+ "<div>\n",
57
+ "<style scoped>\n",
58
+ " .dataframe tbody tr th:only-of-type {\n",
59
+ " vertical-align: middle;\n",
60
+ " }\n",
61
+ "\n",
62
+ " .dataframe tbody tr th {\n",
63
+ " vertical-align: top;\n",
64
+ " }\n",
65
+ "\n",
66
+ " .dataframe thead th {\n",
67
+ " text-align: right;\n",
68
+ " }\n",
69
+ "</style>\n",
70
+ "<table border=\"1\" class=\"dataframe\">\n",
71
+ " <thead>\n",
72
+ " <tr style=\"text-align: right;\">\n",
73
+ " <th></th>\n",
74
+ " <th>n03662601</th>\n",
75
+ " <th>n02165456</th>\n",
76
+ " <th>n07873807</th>\n",
77
+ " <th>n07720875</th>\n",
78
+ " <th>n04146614</th>\n",
79
+ " <th>n01882714</th>\n",
80
+ " <th>n07920052</th>\n",
81
+ " <th>n02509815</th>\n",
82
+ " <th>n07747607</th>\n",
83
+ " <th>n04285008</th>\n",
84
+ " </tr>\n",
85
+ " </thead>\n",
86
+ " <tbody>\n",
87
+ " <tr>\n",
88
+ " <th>class</th>\n",
89
+ " <td>lifeboat</td>\n",
90
+ " <td>ladybug</td>\n",
91
+ " <td>pizza, pizza pie</td>\n",
92
+ " <td>bell pepper</td>\n",
93
+ " <td>school bus</td>\n",
94
+ " <td>koala</td>\n",
95
+ " <td>espresso</td>\n",
96
+ " <td>lesser panda</td>\n",
97
+ " <td>orange</td>\n",
98
+ " <td>sports car</td>\n",
99
+ " </tr>\n",
100
+ " <tr>\n",
101
+ " <th>index</th>\n",
102
+ " <td>0</td>\n",
103
+ " <td>1</td>\n",
104
+ " <td>2</td>\n",
105
+ " <td>3</td>\n",
106
+ " <td>4</td>\n",
107
+ " <td>5</td>\n",
108
+ " <td>6</td>\n",
109
+ " <td>7</td>\n",
110
+ " <td>8</td>\n",
111
+ " <td>9</td>\n",
112
+ " </tr>\n",
113
+ " </tbody>\n",
114
+ "</table>\n",
115
+ "</div>"
116
+ ],
117
+ "text/plain": [
118
+ " n03662601 n02165456 n07873807 n07720875 n04146614 \\\n",
119
+ "class lifeboat ladybug pizza, pizza pie bell pepper school bus \n",
120
+ "index 0 1 2 3 4 \n",
121
+ "\n",
122
+ " n01882714 n07920052 n02509815 n07747607 n04285008 \n",
123
+ "class koala espresso lesser panda orange sports car \n",
124
+ "index 5 6 7 8 9 "
125
+ ]
126
+ },
127
+ "execution_count": 11,
128
+ "metadata": {},
129
+ "output_type": "execute_result"
130
+ }
131
+ ],
132
+ "source": [
133
+ "class_label"
134
+ ]
135
+ },
136
+ {
137
+ "cell_type": "code",
138
+ "execution_count": 81,
139
+ "id": "2a4e8cd0-94e6-446c-93c1-4b7c3c9984d7",
140
+ "metadata": {},
141
+ "outputs": [],
142
+ "source": [
143
+ "cv=[]\n",
144
+ "fv=[]\n",
145
+ "for file in os.listdir(r\"C:\\Users\\DELL\\Desktop\\cnn-explainer-master\\cnn-explainer-master\\tiny-vgg\\data\\data\\class_10_train\"):\n",
146
+ " for img in os.listdir(r\"C:\\Users\\DELL\\Desktop\\cnn-explainer-master\\cnn-explainer-master\\tiny-vgg\\data\\data\\class_10_train\\{}\\images\".format(file)):\n",
147
+ " img=cv2.imread(r\"C:\\Users\\DELL\\Desktop\\cnn-explainer-master\\cnn-explainer-master\\tiny-vgg\\data\\data\\class_10_train\\{}\\images\\{}\".format(file,img))\n",
148
+ " fv.append(img)\n",
149
+ " cv.append(class_label.loc[\"class\"][file])\n"
150
+ ]
151
+ },
152
+ {
153
+ "cell_type": "code",
154
+ "execution_count": 83,
155
+ "id": "bf694bc9-5b4f-435f-a0ed-68f374554c2f",
156
+ "metadata": {},
157
+ "outputs": [
158
+ {
159
+ "data": {
160
+ "text/plain": [
161
+ "5000"
162
+ ]
163
+ },
164
+ "execution_count": 83,
165
+ "metadata": {},
166
+ "output_type": "execute_result"
167
+ }
168
+ ],
169
+ "source": [
170
+ "len(fv)"
171
+ ]
172
+ },
173
+ {
174
+ "cell_type": "code",
175
+ "execution_count": 89,
176
+ "id": "25c14a98-9baf-4d23-a12c-50ae2f6a07a9",
177
+ "metadata": {},
178
+ "outputs": [],
179
+ "source": [
180
+ "final_fv=np.asarray(fv)"
181
+ ]
182
+ },
183
+ {
184
+ "cell_type": "code",
185
+ "execution_count": 91,
186
+ "id": "f163c2e6-0da1-4263-a7a6-37e17f0d39cf",
187
+ "metadata": {},
188
+ "outputs": [
189
+ {
190
+ "data": {
191
+ "text/plain": [
192
+ "array([[[[ 93, 123, 128],\n",
193
+ " [ 99, 129, 134],\n",
194
+ " [100, 126, 132],\n",
195
+ " ...,\n",
196
+ " [143, 156, 164],\n",
197
+ " [175, 191, 197],\n",
198
+ " [ 72, 88, 94]],\n",
199
+ "\n",
200
+ " [[ 94, 124, 129],\n",
201
+ " [ 90, 119, 124],\n",
202
+ " [109, 135, 141],\n",
203
+ " ...,\n",
204
+ " [142, 155, 163],\n",
205
+ " [161, 177, 183],\n",
206
+ " [116, 132, 138]],\n",
207
+ "\n",
208
+ " [[ 99, 128, 133],\n",
209
+ " [ 91, 120, 125],\n",
210
+ " [142, 168, 174],\n",
211
+ " ...,\n",
212
+ " [179, 192, 200],\n",
213
+ " [160, 176, 182],\n",
214
+ " [ 79, 95, 101]],\n",
215
+ "\n",
216
+ " ...,\n",
217
+ "\n",
218
+ " [[ 60, 76, 92],\n",
219
+ " [ 93, 110, 123],\n",
220
+ " [116, 132, 145],\n",
221
+ " ...,\n",
222
+ " [ 32, 58, 98],\n",
223
+ " [ 15, 40, 82],\n",
224
+ " [ 46, 74, 115]],\n",
225
+ "\n",
226
+ " [[112, 128, 141],\n",
227
+ " [128, 144, 157],\n",
228
+ " [132, 145, 159],\n",
229
+ " ...,\n",
230
+ " [ 10, 36, 76],\n",
231
+ " [ 35, 60, 102],\n",
232
+ " [ 38, 63, 107]],\n",
233
+ "\n",
234
+ " [[153, 166, 180],\n",
235
+ " [152, 165, 179],\n",
236
+ " [137, 149, 161],\n",
237
+ " ...,\n",
238
+ " [ 34, 59, 99],\n",
239
+ " [ 70, 95, 139],\n",
240
+ " [ 51, 76, 120]]],\n",
241
+ "\n",
242
+ "\n",
243
+ " [[[ 10, 9, 13],\n",
244
+ " [ 0, 0, 3],\n",
245
+ " [ 0, 0, 3],\n",
246
+ " ...,\n",
247
+ " [ 61, 83, 118],\n",
248
+ " [ 47, 73, 110],\n",
249
+ " [ 63, 89, 129]],\n",
250
+ "\n",
251
+ " [[ 25, 24, 28],\n",
252
+ " [ 3, 2, 4],\n",
253
+ " [ 4, 3, 7],\n",
254
+ " ...,\n",
255
+ " [ 66, 89, 121],\n",
256
+ " [ 59, 85, 122],\n",
257
+ " [ 66, 93, 130]],\n",
258
+ "\n",
259
+ " [[ 66, 63, 65],\n",
260
+ " [ 66, 64, 64],\n",
261
+ " [ 36, 33, 35],\n",
262
+ " ...,\n",
263
+ " [ 67, 88, 119],\n",
264
+ " [ 73, 97, 133],\n",
265
+ " [ 95, 121, 157]],\n",
266
+ "\n",
267
+ " ...,\n",
268
+ "\n",
269
+ " [[ 75, 87, 115],\n",
270
+ " [ 97, 108, 135],\n",
271
+ " [ 58, 68, 92],\n",
272
+ " ...,\n",
273
+ " [ 45, 65, 96],\n",
274
+ " [ 86, 100, 122],\n",
275
+ " [ 72, 84, 102]],\n",
276
+ "\n",
277
+ " [[ 79, 94, 126],\n",
278
+ " [ 87, 101, 130],\n",
279
+ " [ 32, 44, 72],\n",
280
+ " ...,\n",
281
+ " [ 47, 64, 91],\n",
282
+ " [ 92, 104, 122],\n",
283
+ " [ 66, 78, 90]],\n",
284
+ "\n",
285
+ " [[ 41, 58, 91],\n",
286
+ " [ 77, 92, 124],\n",
287
+ " [ 71, 85, 114],\n",
288
+ " ...,\n",
289
+ " [ 31, 47, 70],\n",
290
+ " [ 85, 98, 114],\n",
291
+ " [ 71, 81, 91]]],\n",
292
+ "\n",
293
+ "\n",
294
+ " [[[ 28, 34, 53],\n",
295
+ " [ 0, 4, 23],\n",
296
+ " [ 0, 7, 27],\n",
297
+ " ...,\n",
298
+ " [119, 136, 163],\n",
299
+ " [109, 123, 151],\n",
300
+ " [ 98, 112, 140]],\n",
301
+ "\n",
302
+ " [[ 71, 75, 94],\n",
303
+ " [ 11, 17, 36],\n",
304
+ " [ 0, 4, 23],\n",
305
+ " ...,\n",
306
+ " [136, 153, 180],\n",
307
+ " [136, 150, 178],\n",
308
+ " [124, 138, 166]],\n",
309
+ "\n",
310
+ " [[ 10, 12, 30],\n",
311
+ " [ 8, 12, 30],\n",
312
+ " [ 0, 0, 16],\n",
313
+ " ...,\n",
314
+ " [111, 128, 154],\n",
315
+ " [125, 140, 166],\n",
316
+ " [117, 132, 158]],\n",
317
+ "\n",
318
+ " ...,\n",
319
+ "\n",
320
+ " [[ 66, 79, 123],\n",
321
+ " [ 88, 101, 147],\n",
322
+ " [ 69, 80, 132],\n",
323
+ " ...,\n",
324
+ " [ 80, 100, 155],\n",
325
+ " [101, 122, 174],\n",
326
+ " [ 89, 110, 161]],\n",
327
+ "\n",
328
+ " [[ 42, 55, 99],\n",
329
+ " [ 37, 50, 96],\n",
330
+ " [ 66, 77, 129],\n",
331
+ " ...,\n",
332
+ " [121, 141, 198],\n",
333
+ " [ 91, 112, 167],\n",
334
+ " [ 81, 103, 155]],\n",
335
+ "\n",
336
+ " [[ 50, 63, 107],\n",
337
+ " [ 43, 56, 102],\n",
338
+ " [ 85, 96, 148],\n",
339
+ " ...,\n",
340
+ " [ 60, 82, 140],\n",
341
+ " [112, 135, 191],\n",
342
+ " [ 95, 119, 173]]],\n",
343
+ "\n",
344
+ "\n",
345
+ " ...,\n",
346
+ "\n",
347
+ "\n",
348
+ " [[[ 92, 100, 113],\n",
349
+ " [115, 124, 134],\n",
350
+ " [148, 153, 162],\n",
351
+ " ...,\n",
352
+ " [133, 140, 133],\n",
353
+ " [134, 138, 132],\n",
354
+ " [134, 138, 132]],\n",
355
+ "\n",
356
+ " [[155, 159, 170],\n",
357
+ " [164, 166, 177],\n",
358
+ " [173, 176, 184],\n",
359
+ " ...,\n",
360
+ " [138, 145, 138],\n",
361
+ " [140, 144, 138],\n",
362
+ " [142, 146, 140]],\n",
363
+ "\n",
364
+ " [[192, 186, 197],\n",
365
+ " [189, 184, 193],\n",
366
+ " [187, 183, 189],\n",
367
+ " ...,\n",
368
+ " [138, 144, 139],\n",
369
+ " [139, 145, 140],\n",
370
+ " [140, 146, 141]],\n",
371
+ "\n",
372
+ " ...,\n",
373
+ "\n",
374
+ " [[140, 160, 161],\n",
375
+ " [142, 162, 163],\n",
376
+ " [142, 160, 161],\n",
377
+ " ...,\n",
378
+ " [173, 175, 175],\n",
379
+ " [173, 175, 175],\n",
380
+ " [173, 175, 175]],\n",
381
+ "\n",
382
+ " [[131, 151, 152],\n",
383
+ " [132, 152, 153],\n",
384
+ " [134, 152, 153],\n",
385
+ " ...,\n",
386
+ " [173, 175, 175],\n",
387
+ " [172, 174, 174],\n",
388
+ " [172, 174, 174]],\n",
389
+ "\n",
390
+ " [[120, 140, 141],\n",
391
+ " [121, 141, 142],\n",
392
+ " [127, 145, 146],\n",
393
+ " ...,\n",
394
+ " [172, 174, 174],\n",
395
+ " [172, 174, 174],\n",
396
+ " [171, 173, 173]]],\n",
397
+ "\n",
398
+ "\n",
399
+ " [[[133, 146, 144],\n",
400
+ " [130, 143, 141],\n",
401
+ " [128, 142, 138],\n",
402
+ " ...,\n",
403
+ " [142, 142, 142],\n",
404
+ " [155, 154, 156],\n",
405
+ " [132, 131, 133]],\n",
406
+ "\n",
407
+ " [[122, 135, 133],\n",
408
+ " [149, 163, 159],\n",
409
+ " [136, 150, 146],\n",
410
+ " ...,\n",
411
+ " [130, 130, 130],\n",
412
+ " [144, 143, 145],\n",
413
+ " [154, 153, 155]],\n",
414
+ "\n",
415
+ " [[133, 147, 143],\n",
416
+ " [ 18, 32, 28],\n",
417
+ " [108, 122, 118],\n",
418
+ " ...,\n",
419
+ " [155, 158, 156],\n",
420
+ " [133, 135, 135],\n",
421
+ " [145, 147, 147]],\n",
422
+ "\n",
423
+ " ...,\n",
424
+ "\n",
425
+ " [[ 41, 40, 50],\n",
426
+ " [ 28, 29, 39],\n",
427
+ " [ 17, 18, 28],\n",
428
+ " ...,\n",
429
+ " [134, 142, 142],\n",
430
+ " [165, 173, 173],\n",
431
+ " [202, 210, 210]],\n",
432
+ "\n",
433
+ " [[ 37, 33, 44],\n",
434
+ " [ 31, 30, 40],\n",
435
+ " [ 29, 28, 38],\n",
436
+ " ...,\n",
437
+ " [149, 157, 157],\n",
438
+ " [166, 174, 174],\n",
439
+ " [209, 217, 217]],\n",
440
+ "\n",
441
+ " [[ 42, 38, 49],\n",
442
+ " [ 39, 35, 46],\n",
443
+ " [ 36, 35, 45],\n",
444
+ " ...,\n",
445
+ " [119, 127, 127],\n",
446
+ " [172, 180, 180],\n",
447
+ " [173, 181, 181]]],\n",
448
+ "\n",
449
+ "\n",
450
+ " [[[ 26, 16, 9],\n",
451
+ " [ 25, 16, 12],\n",
452
+ " [ 32, 27, 28],\n",
453
+ " ...,\n",
454
+ " [ 35, 16, 13],\n",
455
+ " [ 34, 13, 11],\n",
456
+ " [ 33, 12, 10]],\n",
457
+ "\n",
458
+ " [[ 26, 16, 9],\n",
459
+ " [ 25, 16, 12],\n",
460
+ " [ 32, 27, 28],\n",
461
+ " ...,\n",
462
+ " [ 37, 18, 15],\n",
463
+ " [ 34, 13, 11],\n",
464
+ " [ 32, 11, 9]],\n",
465
+ "\n",
466
+ " [[ 25, 15, 8],\n",
467
+ " [ 24, 15, 11],\n",
468
+ " [ 32, 27, 28],\n",
469
+ " ...,\n",
470
+ " [ 39, 20, 17],\n",
471
+ " [ 35, 14, 12],\n",
472
+ " [ 32, 11, 9]],\n",
473
+ "\n",
474
+ " ...,\n",
475
+ "\n",
476
+ " [[ 28, 9, 4],\n",
477
+ " [ 20, 4, 0],\n",
478
+ " [ 26, 10, 4],\n",
479
+ " ...,\n",
480
+ " [ 86, 82, 57],\n",
481
+ " [ 88, 87, 59],\n",
482
+ " [ 83, 82, 54]],\n",
483
+ "\n",
484
+ " [[ 33, 15, 8],\n",
485
+ " [ 16, 0, 0],\n",
486
+ " [ 25, 9, 3],\n",
487
+ " ...,\n",
488
+ " [ 80, 85, 56],\n",
489
+ " [ 84, 92, 62],\n",
490
+ " [ 71, 81, 51]],\n",
491
+ "\n",
492
+ " [[ 32, 14, 7],\n",
493
+ " [ 16, 0, 0],\n",
494
+ " [ 30, 14, 8],\n",
495
+ " ...,\n",
496
+ " [ 74, 86, 56],\n",
497
+ " [ 83, 95, 65],\n",
498
+ " [ 66, 81, 50]]]], dtype=uint8)"
499
+ ]
500
+ },
501
+ "execution_count": 91,
502
+ "metadata": {},
503
+ "output_type": "execute_result"
504
+ }
505
+ ],
506
+ "source": [
507
+ "final_fv"
508
+ ]
509
+ },
510
+ {
511
+ "cell_type": "code",
512
+ "execution_count": 93,
513
+ "id": "23bad3e7-6026-4ce1-a629-ec12d48e3c57",
514
+ "metadata": {},
515
+ "outputs": [],
516
+ "source": [
517
+ "le=LabelEncoder()\n",
518
+ "final_cv=le.fit_transform(cv)"
519
+ ]
520
+ },
521
+ {
522
+ "cell_type": "code",
523
+ "execution_count": 117,
524
+ "id": "2f2abaff-b6fa-4a92-8ef9-c48aae150bf8",
525
+ "metadata": {},
526
+ "outputs": [
527
+ {
528
+ "data": {
529
+ "text/plain": [
530
+ "(5000, 64, 64, 3)"
531
+ ]
532
+ },
533
+ "execution_count": 117,
534
+ "metadata": {},
535
+ "output_type": "execute_result"
536
+ }
537
+ ],
538
+ "source": [
539
+ "final_fv.shape"
540
+ ]
541
+ },
542
+ {
543
+ "cell_type": "code",
544
+ "execution_count": 95,
545
+ "id": "47b447df-9923-4229-b956-37a0cb93be0f",
546
+ "metadata": {},
547
+ "outputs": [
548
+ {
549
+ "name": "stderr",
550
+ "output_type": "stream",
551
+ "text": [
552
+ "C:\\Users\\DELL\\anaconda3\\Lib\\site-packages\\keras\\src\\layers\\core\\input_layer.py:27: UserWarning: Argument `input_shape` is deprecated. Use `shape` instead.\n",
553
+ " warnings.warn(\n"
554
+ ]
555
+ }
556
+ ],
557
+ "source": [
558
+ "model=Sequential()\n",
559
+ "model.add(InputLayer(input_shape=(64,64,3)))\n",
560
+ "\n",
561
+ "model.add(Conv2D(10,(3,3),strides=(1,1),padding='valid',activation='relu'))\n",
562
+ "\n",
563
+ "model.add(Conv2D(10,(3,3),strides=(1,1),padding='valid',activation='relu'))\n",
564
+ "model.add(MaxPooling2D((2,2),strides=(2,2),padding=\"valid\"))\n",
565
+ "\n",
566
+ "model.add(Conv2D(10,(3,3),strides=(1,1),padding='valid',activation='relu'))\n",
567
+ "\n",
568
+ "model.add(Conv2D(10,(3,3),strides=(1,1),padding='valid',activation='relu'))\n",
569
+ "model.add(MaxPooling2D((2,2),strides=(2,2),padding=\"valid\"))\n",
570
+ "\n",
571
+ "model.add(Flatten())\n",
572
+ "\n",
573
+ "model.add(Dense(10,activation=\"softmax\"))\n",
574
+ "\n",
575
+ "\n",
576
+ "\n"
577
+ ]
578
+ },
579
+ {
580
+ "cell_type": "code",
581
+ "execution_count": 97,
582
+ "id": "60ac58fd-1da6-4ca2-bcb8-8e20af4fd654",
583
+ "metadata": {},
584
+ "outputs": [
585
+ {
586
+ "data": {
587
+ "text/html": [
588
+ "<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: \"sequential_3\"</span>\n",
589
+ "</pre>\n"
590
+ ],
591
+ "text/plain": [
592
+ "\u001b[1mModel: \"sequential_3\"\u001b[0m\n"
593
+ ]
594
+ },
595
+ "metadata": {},
596
+ "output_type": "display_data"
597
+ },
598
+ {
599
+ "data": {
600
+ "text/html": [
601
+ "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓\n",
602
+ "┃<span style=\"font-weight: bold\"> Layer (type) </span>┃<span style=\"font-weight: bold\"> Output Shape </span>┃<span style=\"font-weight: bold\"> Param # </span>┃\n",
603
+ "┑━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩\n",
604
+ "β”‚ conv2d_6 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Conv2D</span>) β”‚ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">62</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">62</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">10</span>) β”‚ <span style=\"color: #00af00; text-decoration-color: #00af00\">280</span> β”‚\n",
605
+ "β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€\n",
606
+ "β”‚ conv2d_7 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Conv2D</span>) β”‚ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">60</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">60</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">10</span>) β”‚ <span style=\"color: #00af00; text-decoration-color: #00af00\">910</span> β”‚\n",
607
+ "β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€\n",
608
+ "β”‚ max_pooling2d_2 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">MaxPooling2D</span>) β”‚ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">30</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">30</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">10</span>) β”‚ <span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> β”‚\n",
609
+ "β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€\n",
610
+ "β”‚ conv2d_8 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Conv2D</span>) β”‚ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">28</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">28</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">10</span>) β”‚ <span style=\"color: #00af00; text-decoration-color: #00af00\">910</span> β”‚\n",
611
+ "β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€\n",
612
+ "β”‚ conv2d_9 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Conv2D</span>) β”‚ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">26</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">26</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">10</span>) β”‚ <span style=\"color: #00af00; text-decoration-color: #00af00\">910</span> β”‚\n",
613
+ "β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€\n",
614
+ "β”‚ max_pooling2d_3 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">MaxPooling2D</span>) β”‚ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">13</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">13</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">10</span>) β”‚ <span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> β”‚\n",
615
+ "β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€\n",
616
+ "β”‚ flatten_1 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Flatten</span>) β”‚ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">1690</span>) β”‚ <span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> β”‚\n",
617
+ "β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€\n",
618
+ "β”‚ dense_1 (<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\">10</span>) β”‚ <span style=\"color: #00af00; text-decoration-color: #00af00\">16,910</span> β”‚\n",
619
+ "β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜\n",
620
+ "</pre>\n"
621
+ ],
622
+ "text/plain": [
623
+ "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓\n",
624
+ "┃\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",
625
+ "┑━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩\n",
626
+ "β”‚ conv2d_6 (\u001b[38;5;33mConv2D\u001b[0m) β”‚ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m62\u001b[0m, \u001b[38;5;34m62\u001b[0m, \u001b[38;5;34m10\u001b[0m) β”‚ \u001b[38;5;34m280\u001b[0m β”‚\n",
627
+ "β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€\n",
628
+ "β”‚ conv2d_7 (\u001b[38;5;33mConv2D\u001b[0m) β”‚ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m60\u001b[0m, \u001b[38;5;34m60\u001b[0m, \u001b[38;5;34m10\u001b[0m) β”‚ \u001b[38;5;34m910\u001b[0m β”‚\n",
629
+ "β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€\n",
630
+ "β”‚ max_pooling2d_2 (\u001b[38;5;33mMaxPooling2D\u001b[0m) β”‚ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m30\u001b[0m, \u001b[38;5;34m30\u001b[0m, \u001b[38;5;34m10\u001b[0m) β”‚ \u001b[38;5;34m0\u001b[0m β”‚\n",
631
+ "β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€\n",
632
+ "β”‚ conv2d_8 (\u001b[38;5;33mConv2D\u001b[0m) β”‚ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m28\u001b[0m, \u001b[38;5;34m28\u001b[0m, \u001b[38;5;34m10\u001b[0m) β”‚ \u001b[38;5;34m910\u001b[0m β”‚\n",
633
+ "β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€\n",
634
+ "β”‚ conv2d_9 (\u001b[38;5;33mConv2D\u001b[0m) β”‚ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m26\u001b[0m, \u001b[38;5;34m26\u001b[0m, \u001b[38;5;34m10\u001b[0m) β”‚ \u001b[38;5;34m910\u001b[0m β”‚\n",
635
+ "β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€\n",
636
+ "β”‚ max_pooling2d_3 (\u001b[38;5;33mMaxPooling2D\u001b[0m) β”‚ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m13\u001b[0m, \u001b[38;5;34m13\u001b[0m, \u001b[38;5;34m10\u001b[0m) β”‚ \u001b[38;5;34m0\u001b[0m β”‚\n",
637
+ "β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€\n",
638
+ "β”‚ flatten_1 (\u001b[38;5;33mFlatten\u001b[0m) β”‚ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m1690\u001b[0m) β”‚ \u001b[38;5;34m0\u001b[0m β”‚\n",
639
+ "β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€\n",
640
+ "β”‚ dense_1 (\u001b[38;5;33mDense\u001b[0m) β”‚ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m10\u001b[0m) β”‚ \u001b[38;5;34m16,910\u001b[0m β”‚\n",
641
+ "β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜\n"
642
+ ]
643
+ },
644
+ "metadata": {},
645
+ "output_type": "display_data"
646
+ },
647
+ {
648
+ "data": {
649
+ "text/html": [
650
+ "<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\">19,920</span> (77.81 KB)\n",
651
+ "</pre>\n"
652
+ ],
653
+ "text/plain": [
654
+ "\u001b[1m Total params: \u001b[0m\u001b[38;5;34m19,920\u001b[0m (77.81 KB)\n"
655
+ ]
656
+ },
657
+ "metadata": {},
658
+ "output_type": "display_data"
659
+ },
660
+ {
661
+ "data": {
662
+ "text/html": [
663
+ "<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\">19,920</span> (77.81 KB)\n",
664
+ "</pre>\n"
665
+ ],
666
+ "text/plain": [
667
+ "\u001b[1m Trainable params: \u001b[0m\u001b[38;5;34m19,920\u001b[0m (77.81 KB)\n"
668
+ ]
669
+ },
670
+ "metadata": {},
671
+ "output_type": "display_data"
672
+ },
673
+ {
674
+ "data": {
675
+ "text/html": [
676
+ "<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\">0</span> (0.00 B)\n",
677
+ "</pre>\n"
678
+ ],
679
+ "text/plain": [
680
+ "\u001b[1m Non-trainable params: \u001b[0m\u001b[38;5;34m0\u001b[0m (0.00 B)\n"
681
+ ]
682
+ },
683
+ "metadata": {},
684
+ "output_type": "display_data"
685
+ }
686
+ ],
687
+ "source": [
688
+ "model.summary()"
689
+ ]
690
+ },
691
+ {
692
+ "cell_type": "code",
693
+ "execution_count": 99,
694
+ "id": "ab6f9579-a47d-4463-914f-5d2cebbb617f",
695
+ "metadata": {},
696
+ "outputs": [
697
+ {
698
+ "data": {
699
+ "text/plain": [
700
+ "19920"
701
+ ]
702
+ },
703
+ "execution_count": 99,
704
+ "metadata": {},
705
+ "output_type": "execute_result"
706
+ }
707
+ ],
708
+ "source": [
709
+ "16900+(280)+(910*3)+10"
710
+ ]
711
+ },
712
+ {
713
+ "cell_type": "code",
714
+ "execution_count": 101,
715
+ "id": "0be3eeba-a46b-4eea-bc96-f2c744a7bb7c",
716
+ "metadata": {},
717
+ "outputs": [],
718
+ "source": [
719
+ "model.compile(optimizer=\"adam\",loss=\"sparse_categorical_crossentropy\",metrics=[\"accuracy\"])"
720
+ ]
721
+ },
722
+ {
723
+ "cell_type": "code",
724
+ "execution_count": 103,
725
+ "id": "40e68fd9-bd57-4542-ab64-8ce9e1441f3e",
726
+ "metadata": {},
727
+ "outputs": [
728
+ {
729
+ "name": "stdout",
730
+ "output_type": "stream",
731
+ "text": [
732
+ "Epoch 1/30\n",
733
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m7s\u001b[0m 23ms/step - accuracy: 0.2080 - loss: 4.6804 - val_accuracy: 0.0000e+00 - val_loss: 19.1830\n",
734
+ "Epoch 2/30\n",
735
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 20ms/step - accuracy: 0.3782 - loss: 1.6260 - val_accuracy: 0.0000e+00 - val_loss: 26.0851\n",
736
+ "Epoch 3/30\n",
737
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 21ms/step - accuracy: 0.5056 - loss: 1.3495 - val_accuracy: 0.0000e+00 - val_loss: 41.0336\n",
738
+ "Epoch 4/30\n",
739
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 20ms/step - accuracy: 0.6231 - loss: 1.0457 - val_accuracy: 0.0000e+00 - val_loss: 40.3504\n",
740
+ "Epoch 5/30\n",
741
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 21ms/step - accuracy: 0.6812 - loss: 0.9255 - val_accuracy: 0.0000e+00 - val_loss: 52.1076\n",
742
+ "Epoch 6/30\n",
743
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m2s\u001b[0m 20ms/step - accuracy: 0.7157 - loss: 0.8099 - val_accuracy: 0.0000e+00 - val_loss: 50.8672\n",
744
+ "Epoch 7/30\n",
745
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 21ms/step - accuracy: 0.7648 - loss: 0.6788 - val_accuracy: 0.0000e+00 - val_loss: 52.5935\n",
746
+ "Epoch 8/30\n",
747
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 21ms/step - accuracy: 0.7743 - loss: 0.6353 - val_accuracy: 0.0000e+00 - val_loss: 59.4032\n",
748
+ "Epoch 9/30\n",
749
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 21ms/step - accuracy: 0.8113 - loss: 0.5625 - val_accuracy: 0.0000e+00 - val_loss: 56.3095\n",
750
+ "Epoch 10/30\n",
751
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 21ms/step - accuracy: 0.8503 - loss: 0.4576 - val_accuracy: 0.0000e+00 - val_loss: 60.5619\n",
752
+ "Epoch 11/30\n",
753
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 21ms/step - accuracy: 0.8718 - loss: 0.4068 - val_accuracy: 0.0000e+00 - val_loss: 67.3940\n",
754
+ "Epoch 12/30\n",
755
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 21ms/step - accuracy: 0.8908 - loss: 0.3511 - val_accuracy: 0.0000e+00 - val_loss: 73.8187\n",
756
+ "Epoch 13/30\n",
757
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 22ms/step - accuracy: 0.9020 - loss: 0.2951 - val_accuracy: 0.0000e+00 - val_loss: 72.3385\n",
758
+ "Epoch 14/30\n",
759
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 20ms/step - accuracy: 0.9145 - loss: 0.2679 - val_accuracy: 0.0000e+00 - val_loss: 80.5521\n",
760
+ "Epoch 15/30\n",
761
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 20ms/step - accuracy: 0.9059 - loss: 0.2770 - val_accuracy: 0.0000e+00 - val_loss: 90.8833\n",
762
+ "Epoch 16/30\n",
763
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 22ms/step - accuracy: 0.9445 - loss: 0.1843 - val_accuracy: 0.0000e+00 - val_loss: 95.8095\n",
764
+ "Epoch 17/30\n",
765
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m2s\u001b[0m 20ms/step - accuracy: 0.9568 - loss: 0.1523 - val_accuracy: 0.0000e+00 - val_loss: 102.6003\n",
766
+ "Epoch 18/30\n",
767
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 22ms/step - accuracy: 0.9580 - loss: 0.1363 - val_accuracy: 0.0000e+00 - val_loss: 101.0709\n",
768
+ "Epoch 19/30\n",
769
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 21ms/step - accuracy: 0.9502 - loss: 0.1436 - val_accuracy: 0.0000e+00 - val_loss: 100.0361\n",
770
+ "Epoch 20/30\n",
771
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 23ms/step - accuracy: 0.9425 - loss: 0.1797 - val_accuracy: 0.0000e+00 - val_loss: 108.6705\n",
772
+ "Epoch 21/30\n",
773
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 21ms/step - accuracy: 0.9640 - loss: 0.1122 - val_accuracy: 0.0000e+00 - val_loss: 101.3856\n",
774
+ "Epoch 22/30\n",
775
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 21ms/step - accuracy: 0.9602 - loss: 0.1128 - val_accuracy: 0.0000e+00 - val_loss: 106.5760\n",
776
+ "Epoch 23/30\n",
777
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 21ms/step - accuracy: 0.9660 - loss: 0.1010 - val_accuracy: 0.0000e+00 - val_loss: 117.6791\n",
778
+ "Epoch 24/30\n",
779
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 21ms/step - accuracy: 0.9628 - loss: 0.1130 - val_accuracy: 0.0000e+00 - val_loss: 110.5023\n",
780
+ "Epoch 25/30\n",
781
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 21ms/step - accuracy: 0.9647 - loss: 0.1049 - val_accuracy: 0.0000e+00 - val_loss: 111.2337\n",
782
+ "Epoch 26/30\n",
783
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 21ms/step - accuracy: 0.9792 - loss: 0.0657 - val_accuracy: 0.0000e+00 - val_loss: 124.0935\n",
784
+ "Epoch 27/30\n",
785
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 21ms/step - accuracy: 0.9763 - loss: 0.0807 - val_accuracy: 0.0000e+00 - val_loss: 123.4486\n",
786
+ "Epoch 28/30\n",
787
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 20ms/step - accuracy: 0.9643 - loss: 0.1042 - val_accuracy: 0.0000e+00 - val_loss: 115.8864\n",
788
+ "Epoch 29/30\n",
789
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 21ms/step - accuracy: 0.9656 - loss: 0.1140 - val_accuracy: 0.0000e+00 - val_loss: 106.3280\n",
790
+ "Epoch 30/30\n",
791
+ "\u001b[1m125/125\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 22ms/step - accuracy: 0.9605 - loss: 0.1465 - val_accuracy: 0.0000e+00 - val_loss: 127.4334\n"
792
+ ]
793
+ },
794
+ {
795
+ "data": {
796
+ "text/plain": [
797
+ "<keras.src.callbacks.history.History at 0x14e2460cd90>"
798
+ ]
799
+ },
800
+ "execution_count": 103,
801
+ "metadata": {},
802
+ "output_type": "execute_result"
803
+ }
804
+ ],
805
+ "source": [
806
+ "model.fit(final_fv,final_cv,epochs=30,batch_size=32,validation_split=0.2)"
807
+ ]
808
+ },
809
+ {
810
+ "cell_type": "code",
811
+ "execution_count": 105,
812
+ "id": "da3a460f-aa3f-4703-9b94-9fd99f4f9e29",
813
+ "metadata": {},
814
+ "outputs": [
815
+ {
816
+ "data": {
817
+ "text/plain": [
818
+ "<Sequential name=sequential_3, built=True>"
819
+ ]
820
+ },
821
+ "execution_count": 105,
822
+ "metadata": {},
823
+ "output_type": "execute_result"
824
+ }
825
+ ],
826
+ "source": [
827
+ "model"
828
+ ]
829
+ },
830
+ {
831
+ "cell_type": "code",
832
+ "execution_count": 109,
833
+ "id": "a8ca2658-6f2d-4104-97be-044453bebe80",
834
+ "metadata": {},
835
+ "outputs": [],
836
+ "source": [
837
+ "img1=cv2.imread(r\"C:\\Users\\DELL\\Desktop\\cnn-explainer-master\\cnn-explainer-master\\tiny-vgg\\data\\data\\class_10_val\\val_images\\val_47.JPEG\")"
838
+ ]
839
+ },
840
+ {
841
+ "cell_type": "code",
842
+ "execution_count": 111,
843
+ "id": "dcb1bcd0-5007-41d9-8db4-2d61b2d03b1a",
844
+ "metadata": {},
845
+ "outputs": [
846
+ {
847
+ "data": {
848
+ "text/plain": [
849
+ "(64, 64, 3)"
850
+ ]
851
+ },
852
+ "execution_count": 111,
853
+ "metadata": {},
854
+ "output_type": "execute_result"
855
+ }
856
+ ],
857
+ "source": [
858
+ "img1.shape"
859
+ ]
860
+ },
861
+ {
862
+ "cell_type": "code",
863
+ "execution_count": 119,
864
+ "id": "67a53bb1-e593-4160-8487-71afa37ab006",
865
+ "metadata": {},
866
+ "outputs": [
867
+ {
868
+ "data": {
869
+ "text/plain": [
870
+ "(1, 64, 64, 3)"
871
+ ]
872
+ },
873
+ "execution_count": 119,
874
+ "metadata": {},
875
+ "output_type": "execute_result"
876
+ }
877
+ ],
878
+ "source": [
879
+ "img1[np.newaxis,:,:,:].shape"
880
+ ]
881
+ },
882
+ {
883
+ "cell_type": "code",
884
+ "execution_count": 123,
885
+ "id": "396e6e07-7036-4956-9663-adabf5475eb6",
886
+ "metadata": {},
887
+ "outputs": [
888
+ {
889
+ "name": "stdout",
890
+ "output_type": "stream",
891
+ "text": [
892
+ "\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 287ms/step\n"
893
+ ]
894
+ },
895
+ {
896
+ "data": {
897
+ "text/plain": [
898
+ "0"
899
+ ]
900
+ },
901
+ "execution_count": 123,
902
+ "metadata": {},
903
+ "output_type": "execute_result"
904
+ }
905
+ ],
906
+ "source": [
907
+ "np.argmax(model.predict(img1[np.newaxis,:,:,:]))"
908
+ ]
909
+ },
910
+ {
911
+ "cell_type": "code",
912
+ "execution_count": 125,
913
+ "id": "3092204e-efb8-49fd-b578-43ccc1e60e67",
914
+ "metadata": {},
915
+ "outputs": [
916
+ {
917
+ "name": "stdout",
918
+ "output_type": "stream",
919
+ "text": [
920
+ "\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 94ms/step\n"
921
+ ]
922
+ },
923
+ {
924
+ "data": {
925
+ "text/plain": [
926
+ "array(['bell pepper'], dtype='<U16')"
927
+ ]
928
+ },
929
+ "execution_count": 125,
930
+ "metadata": {},
931
+ "output_type": "execute_result"
932
+ }
933
+ ],
934
+ "source": [
935
+ "le.inverse_transform([np.argmax(model.predict(img1[np.newaxis,:,:,:]))])"
936
+ ]
937
+ },
938
+ {
939
+ "cell_type": "code",
940
+ "execution_count": null,
941
+ "id": "42a6a30b-9ad4-451b-a63e-49e61b9c4721",
942
+ "metadata": {},
943
+ "outputs": [],
944
+ "source": []
945
+ }
946
+ ],
947
+ "metadata": {
948
+ "kernelspec": {
949
+ "display_name": "Python 3 (ipykernel)",
950
+ "language": "python",
951
+ "name": "python3"
952
+ },
953
+ "language_info": {
954
+ "codemirror_mode": {
955
+ "name": "ipython",
956
+ "version": 3
957
+ },
958
+ "file_extension": ".py",
959
+ "mimetype": "text/x-python",
960
+ "name": "python",
961
+ "nbconvert_exporter": "python",
962
+ "pygments_lexer": "ipython3",
963
+ "version": "3.11.7"
964
+ }
965
+ },
966
+ "nbformat": 4,
967
+ "nbformat_minor": 5
968
+ }