{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Programming Assignment" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Data pipeline with Keras and tf.data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Instructions\n", "\n", "In this notebook, you will implement a data processing pipeline using tools from both Keras and the tf.data module. You will use the `ImageDataGenerator` class in the tf.keras module to feed a network with training and test images from a local directory containing a subset of the LSUN dataset, and train the model both with and without data augmentation. You will then use the `map` and `filter` functions of the `Dataset` class with the CIFAR-100 dataset to train a network to classify a processed subset of the images.\n", "\n", "Some code cells are provided you in the notebook. You should avoid editing provided code, and make sure to execute the cells in order to avoid unexpected errors. Some cells begin with the line:\n", "\n", "`#### GRADED CELL ####`\n", "\n", "Don't move or edit this first line - this is what the automatic grader looks for to recognise graded cells. These cells require you to write your own code to complete them, and are automatically graded when you submit the notebook. Don't edit the function name or signature provided in these cells, otherwise the automatic grader might not function properly. Inside these graded cells, you can use any functions or classes that are imported below, but make sure you don't use any variables that are outside the scope of the function.\n", "\n", "### How to submit\n", "\n", "Complete all the tasks you are asked for in the worksheet. When you have finished and are happy with your code, press the **Submit Assignment** button at the top of this notebook.\n", "\n", "### Let's get started!\n", "\n", "We'll start running some imports, and loading the dataset. Do not edit the existing imports in the following cell. If you would like to make further Tensorflow imports, you should add them here." ] }, { "cell_type": "code", "execution_count": 56, "metadata": {}, "outputs": [], "source": [ "#### PACKAGE IMPORTS ####\n", "\n", "# Run this cell first to import all required packages. Do not make any imports elsewhere in the notebook\n", "\n", "\n", "import tensorflow as tf\n", "from tensorflow.keras.datasets import cifar100\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import json\n", "%matplotlib inline\n", "\n", "# If you would like to make further imports from tensorflow, add them here\n", "from tensorflow.keras.preprocessing.image import ImageDataGenerator\n", "\n", "from tensorflow.keras.layers import Conv2D,MaxPooling2D,Dense,Flatten,Input\n", "from tensorflow.keras.models import Model\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Part 1: tf.keras\n", "
![]() | \n",
" ![]() | \n",
" ![]() | \n",
"