Skip to content

Commit 80a8576

Browse files
author
Anastasia
committed
Minor modifications
1 parent 8738b72 commit 80a8576

File tree

1 file changed

+65
-9
lines changed

1 file changed

+65
-9
lines changed

Keras-Transfer-Learning/transfer-learning-vgg.ipynb

Lines changed: 65 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@
3838
"os.environ['TF_DETERMINISTIC_OPS'] = '1'"
3939
]
4040
},
41+
{
42+
"cell_type": "markdown",
43+
"metadata": {},
44+
"source": [
45+
"<h2>Experiment 1: run model without fully-connected layers</h2>"
46+
]
47+
},
48+
{
49+
"cell_type": "markdown",
50+
"metadata": {},
51+
"source": [
52+
"<h3>1. Initialize the model</h3>"
53+
]
54+
},
4155
{
4256
"cell_type": "markdown",
4357
"metadata": {},
@@ -121,6 +135,13 @@
121135
"vgg_conv.summary()"
122136
]
123137
},
138+
{
139+
"cell_type": "markdown",
140+
"metadata": {},
141+
"source": [
142+
"<h3>2. Prepare the training data</h3>"
143+
]
144+
},
124145
{
125146
"cell_type": "markdown",
126147
"metadata": {},
@@ -180,7 +201,7 @@
180201
"cell_type": "markdown",
181202
"metadata": {},
182203
"source": [
183-
"Let's explore the train dataset:"
204+
"<h3>3. Visualize the training dataset</h3>"
184205
]
185206
},
186207
{
@@ -237,6 +258,13 @@
237258
"plt.title(\"Class name: {}\".format(classes_list[train_image_label_id]))"
238259
]
239260
},
261+
{
262+
"cell_type": "markdown",
263+
"metadata": {},
264+
"source": [
265+
"<h3>4. Obtain model predictions on the train data</h3>"
266+
]
267+
},
240268
{
241269
"cell_type": "markdown",
242270
"metadata": {},
@@ -272,6 +300,13 @@
272300
"print(\"Train features: {}\".format(train_features_vec.shape))"
273301
]
274302
},
303+
{
304+
"cell_type": "markdown",
305+
"metadata": {},
306+
"source": [
307+
"<h3>5. Prepare the validation data</h3>"
308+
]
309+
},
275310
{
276311
"cell_type": "code",
277312
"execution_count": 9,
@@ -298,6 +333,13 @@
298333
" shuffle=False)"
299334
]
300335
},
336+
{
337+
"cell_type": "markdown",
338+
"metadata": {},
339+
"source": [
340+
"<h3>6. Visualize the validation dataset</h3>"
341+
]
342+
},
301343
{
302344
"cell_type": "code",
303345
"execution_count": 10,
@@ -352,6 +394,13 @@
352394
"plt.title(\"Class name: {}\".format(classes_list[val_image_label_id]))"
353395
]
354396
},
397+
{
398+
"cell_type": "markdown",
399+
"metadata": {},
400+
"source": [
401+
"<h3>7. Obtain model predictions on the validation data</h3>"
402+
]
403+
},
355404
{
356405
"cell_type": "code",
357406
"execution_count": 11,
@@ -383,7 +432,14 @@
383432
"cell_type": "markdown",
384433
"metadata": {},
385434
"source": [
386-
"Create your own model and train the network:"
435+
"<h2>Experiment 2: Create your own model and train the network</h2>"
436+
]
437+
},
438+
{
439+
"cell_type": "markdown",
440+
"metadata": {},
441+
"source": [
442+
"<h3>1. Configure and train the model</h3>"
387443
]
388444
},
389445
{
@@ -458,6 +514,13 @@
458514
" validation_data=(validation_features_vec,validation_labels))"
459515
]
460516
},
517+
{
518+
"cell_type": "markdown",
519+
"metadata": {},
520+
"source": [
521+
"<h3>2. Show the errors</h3>"
522+
]
523+
},
461524
{
462525
"cell_type": "code",
463526
"execution_count": 13,
@@ -514,13 +577,6 @@
514577
"print(\"Number of errors = {}/{}\".format(len(errors),nVal))"
515578
]
516579
},
517-
{
518-
"cell_type": "markdown",
519-
"metadata": {},
520-
"source": [
521-
"Let us see which images were predicted wrongly:"
522-
]
523-
},
524580
{
525581
"cell_type": "code",
526582
"execution_count": 16,

0 commit comments

Comments
 (0)