Skip to content

Commit

Permalink
Updated steps per epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
lmoroney committed Apr 17, 2020
1 parent 5f7b044 commit 1c59c48
Showing 1 changed file with 49 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"accelerator": "GPU",
"colab": {
"name": "Exercise4-Answer.ipynb",
"provenance": [],
"toc_visible": true,
"include_colab_link": true
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
}
},
"cells": [
{
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/lmoroney/dlaicourse/blob/master/Exercises/Exercise%204%20-%20Handling%20Complex%20Images/Exercise4-Answer.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"metadata": {
"id": "zX4Kg8DUTKWO",
Expand All @@ -25,13 +50,11 @@
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "3NFuMFYXtwsT"
"id": "3NFuMFYXtwsT",
"colab": {}
},
"outputs": [],
"source": [
"import tensorflow as tf\n",
"import os\n",
Expand All @@ -54,17 +77,17 @@
" self.model.stop_training = True\n",
"\n",
"callbacks = myCallback()\n"
]
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "eUcNTpra1FK0"
"id": "eUcNTpra1FK0",
"colab": {}
},
"outputs": [],
"source": [
"model = tf.keras.models.Sequential([\n",
" tf.keras.layers.Conv2D(16, (3,3), activation='relu', input_shape=(150, 150, 3)),\n",
Expand All @@ -83,17 +106,17 @@
"model.compile(loss='binary_crossentropy',\n",
" optimizer=RMSprop(lr=0.001),\n",
" metrics=['accuracy'])"
]
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "sSaPPUe_z_OU"
"id": "sSaPPUe_z_OU",
"colab": {}
},
"outputs": [],
"source": [
"from tensorflow.keras.preprocessing.image import ImageDataGenerator\n",
"\n",
Expand All @@ -106,40 +129,27 @@
" class_mode='binary')\n",
"\n",
"# Expected output: 'Found 80 images belonging to 2 classes'"
]
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "0imravDn0Ajz"
"id": "0imravDn0Ajz",
"colab": {}
},
"outputs": [],
"source": [
"history = model.fit(\n",
" train_generator,\n",
" steps_per_epoch=2, \n",
" steps_per_epoch=8, \n",
" epochs=15,\n",
" verbose=1,\n",
" callbacks=[callbacks])"
]
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"name": "Exercise4-Answer.ipynb",
"provenance": [],
"toc_visible": true,
"version": "0.3.2"
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
],
"execution_count": 0,
"outputs": []
}
},
"nbformat": 4,
"nbformat_minor": 0
}
]
}

0 comments on commit 1c59c48

Please sign in to comment.