From 1c59c48ec98fae276259119c9a9c37ccbc8de8ba Mon Sep 17 00:00:00 2001 From: Laurence Moroney Date: Fri, 17 Apr 2020 12:06:58 -0700 Subject: [PATCH] Updated steps per epoch --- .../Exercise4-Answer.ipynb | 88 +++++++++++-------- 1 file changed, 49 insertions(+), 39 deletions(-) diff --git a/Exercises/Exercise 4 - Handling Complex Images/Exercise4-Answer.ipynb b/Exercises/Exercise 4 - Handling Complex Images/Exercise4-Answer.ipynb index f4427066..0743e618 100644 --- a/Exercises/Exercise 4 - Handling Complex Images/Exercise4-Answer.ipynb +++ b/Exercises/Exercise 4 - Handling Complex Images/Exercise4-Answer.ipynb @@ -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": [ + "\"Open" + ] + }, + { "cell_type": "code", "metadata": { "id": "zX4Kg8DUTKWO", @@ -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", @@ -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", @@ -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", @@ -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 -} + ] +} \ No newline at end of file