CSci 356 - Homework 6 / Project 2

Due: Monday, Apr 21, 2025

Purpose: to learn basics of the the Keras Functional API and apply it to building convolutional neural networks (as known as ConvNets or CNNs).

Reading: Chollet: Chapter 7, Sections 7.1-7.2, Chapter 8

Homework Six: Paper Summary

This assignment is work 50 points

  1. Download and read the paper "ImageNet Classification with Deep Convolutional Neural Networks" by Krizhevsky, Sutskever, and Hinton (available on BrightSpace and possibly at your local grocer). The network described in the paper is now known as AlexNet; we talked about it briefly in the PyTorch lecture. It might be helpful to look at further descriptions of CNNs in the text or in another paper on BrightSpace, "Convolutional Networks and Applications in Vision" by LeCun, Farabet and Kavukcuoglu. But focus is on the ImageNet paper.
     
  2. Write a summary of the paper's main ideas in as many paragraphs as you need (we've already gone through the layers). You'll focus on:
    • what distinguishes a CNN from other network types we've used
    • learning algorithm and activation functions used for training large image recognition networks
    • efficient use of computational resources
    • description of new types of layers
    • specifics of regularization techniques used to reduce overfitting

AI Project 2

This assignment is worth 100 points

We're going to create and train the first two models described in Chapter 8 using a Convnet. Note that these Convnets are made up of several large layers that will take some time to train. The first one can be done on your computer or Colab using the default setting, yet even with just 5 epochs will take a good 5 minutes or more to train.

  1. Implement a small CNN that learns MNIST based on the code in Listings 8.1-8.4.
     
    Summarize your results in a Markdown block, including:
    • a comparison of the accuracy your network obtains with the result reported in Section 8.1, as well as your result from the original MNIST model in Chapter 2
    • total number of parameters (from the model.summary() results)
    • total time to train the model (reported by Colab); also give your Sequential model training time for comparison
       
  2. Use Colab to implement the CNN described in Sections 8.2-8.5 using the dogs-vs-cats image dataset from Kaggle.com. Note: I got about 60 warnings displayed when doing the data augmentation step in 8.5; you might want to research a setting for suppressing the display warnings if this bothers you.
     
    You will need to be careful of the order you do things:
    1. you'll need to create a Kaggle account and download an API key file (as described in the Sidebar in Section 8.2.2 of the 2nd Edition)
    2. create a new notebook and be sure to change the runtime to GPU before running code in the new notebook (see Chapter 3 for a refresh on how to do this)
    3. upload the API key and complete the procedure described in the Sidebar with one difference: first run
      !unzip -qq dogs-vs-cats.zip
      before running the given command to unzip the train.zip file
       
      (note: it took me a couple of tries to download the dataset into my Colab notebook, so don't freak out if it doesn't work the first time; the main issue is accepting the terms and conditions at the Dogs vs. Cats competition page)
       
    4. continue with building and training the model but skip the sidebar UNDERSTANDING TENSORFLOW DATASET OBJECTS and look at part (e) below before doing data augmentation in 8.5.

      Does it take a non-trivial amount of time? Sure, but much less time than the hours it would take using CPU only

    5. As in Problem 1, summarize the results in a Markdown block; do this before doing section 8.5 and again after.
       

      Some notes:
    • Colab gives us about 75 GB of disk space by default, so don't worry about the size of the datasets...yet
    • if you get lost with all the files and directories created, the ! prefix will let you run any Linux shell command, such as ls -l and pwd. You probably do not want to go changing directories, but you can always double check your directory structure by running !ls -l <dirname> in a code cell, or my favorite: !du
    • Chollet suggests downloading the checkpoint file convnet_from_scratch.keras that was created during the last training session. It isn't obvious how to do this in Colab but I eventually found that the Files folder on the left sidebar will display the contents of your disk partition without having to fuss with the Linux commands I just went on about. The "three vertical dot" menu to the right of the file name gives you the option to download any file.
      By the way, is there a proper name for the "three vertical dot" menus?
       

Deliverables