ECBM E4040 Neural Networks and Deep Learning – 2016 Fall HOMEWORK #3
INSTRUCTIONS: This homework has only the programming component. Please submit your homework via your bitbucket repository. Your submission should consist of
1. Completed code in hw3.py file,
2. and a Jupyter Notebook file ecbm_e4040_hw3.ipynb.
Important Note: This homework is to be completed individually. You are prohibited from sharing any ideas or asking a question that gives any details about what you have done so far on Piazza.
PROBLEM 1:
For this homework, we will be using the CIFAR-10 dataset. A function to download and load the dataset
has been provided.
For the first problem, we want you to implement a convolutional neural network (CNN) architecture. Your model is going to consist of two convolutional layers followed by the flattening of the tensor, after which you will have two fully-connected layers before a final softmax layer. The architecture is going to have the following structure:
Train the network on the first 40000 examples of training, validate on the next 10000, and use the 10000 test examples for testing.
PROBLEM 2:
For this second problem, your purpose is going to be the augmentation of training data using various preprocessing methods to improve the generalization capability of a classifier. For simplicity, you can use the testing set of CIFAR-10 as your validation set for the purposes of this problem; don’t use a testing set if you don’t want to. First, run the model on Problem 1 without any of these augmentations. For each subproblem, use only the new method you have implemented and run the model again. Update the training examples with random augmentations at the start of each epoch. Discuss the accuracy differences you observe.
(a) Add translations to the input, i.e. write a function that takes in the input tensor and shifting arguments (for example, M pixels to left, N pixels to up) and outputs the input with the translations. Use this function to add translations during training to improve the validation accuracy at early stopping. Show a 4×4 figure of 16 input images with this augmentation.
(b) Write a function to add random rotations to the input. Use this function to randomly add rotations during training to improve the validation accuracy at early stopping. Show a 4×4 figure of 16 input images with this augmentation.
(c) Write a function to randomly flip images horizontally. Use this function to randomly add flipping during training to improve the validation accuracy at early stopping. Show a 4×4 figure of 16 input images with this augmentation.
(d) Add noise to the input. Write a function and provide a switch to switch between Gaussian-distributed and uniformly-distributed noise with zero mean. Use this function to randomly add noise to the input during training to improve the validation accuracy at early stopping. Show a 4×4 figure of 16 input images with this augmentation.
PROBLEM 3:
Achieve at least 80% testing accuracy on the CIFAR-10 test set. You will get a 1% bonus for each extra testing accuracy percentage above 80%, up to a maximum of 10% bonus for this homework. For this problem, we want you to use everything you have learned from previous homeworks and Problems 1 and 2. You are free to use any extra ideas, including those from any conference or journal papers, but we expect the code to be your own. State the sources you choose to utilize. Give an explanation of the architecture you choose to use, detailing the potential contribution of the various tricks you have utilized.
We expect you to divide the training set into two subsets; one of them you will use for training and the other for early stopping and validation. Finally, you will provide accuracies for the testing set. Like Problem 1, you can use the first 40000 training examples for training and the next 10000 for validation.
PROBLEM 4:
Convolutional architectures can be used for filtering, or reversing the effects of a filtering operation. You will be implementing a network that restores heavily corrupted images. To simulate corruption, we will use a Dropout layer with a dropout rate of 0.7 right at the beginning of the network. You are asked to implement the following architecture, which has the the CIFAR-10 dataset as both input and output:
Use only the first 50000 images for training (40000 for training, 10000 for validation). Train the network with the mean-squared error (MSE) objective. Build your architecture so that convolutions don’t change the size of the input.
Train the architecture for 128 epochs or until early stopping, then test with 8 examples in the test set, corrupting the images beforehand by setting 70% of the pixels to 0. Display the ground truth, the corrupted input and the restored output for these images on a 8×3 figure. Compare the results against the ground truth.
Grading:
Problem 1: 20 Problem 2: 20 Problem 3: 30 Problem 4: 30