0% found this document useful (0 votes)
16 views3 pages

2024 GR5245 HW3 - Due1027 - 11pm

This document outlines Homework Assignment 3 for the Python for Deep Learning course at Columbia University. It includes guidelines for submission, instructions for using the CIFAR-10 dataset, and details on three experimental models focusing on batch normalization and data augmentation in convolutional neural networks. Students are required to implement training and evaluation functions, train models, and analyze the results through plots of training and validation metrics.

Uploaded by

yl5404
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views3 pages

2024 GR5245 HW3 - Due1027 - 11pm

This document outlines Homework Assignment 3 for the Python for Deep Learning course at Columbia University. It includes guidelines for submission, instructions for using the CIFAR-10 dataset, and details on three experimental models focusing on batch normalization and data augmentation in convolutional neural networks. Students are required to implement training and evaluation functions, train models, and analyze the results through plots of training and validation metrics.

Uploaded by

yl5404
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Columbia University

STAT GR5245 Fall 2024


Python for Deep Learning
Ka Yi Ng

Homework Assignment 3

HOMEWORK GUIDELINE
Submit your completed homework as an html file onto CourseWorks by the specified due date and time.
You can find instructions in GR5245_HwkSubmit.ipynb regarding how a Jupyter notebook (.ipynb file)
can be converted into an html file. Before you convert your file, please ensure that all lines of code have
been executed in order to show the desired results. The TA will grade your homework based on what’re
shown in the html file and will not attempt to re-execute the lines of code in your homework.

Note: If you suspect there are typos in this homework, or some questions are wrong, please feel free to
email the instructor.

QUESTION 1
In this question we will investigate the effects of using batch normalization and data augmentation in
convolutional neural networks for image classification.
We would use CIFAR-10 dataset (https://www.cs.toronto.edu/~kriz/cifar.html ) in this investigation.
Typically the testing set is used to evaluate the performance of a trained model. Here we would use the
testing set as the validation set to examine the effects of regularization techniques.
(a) Download the CIFAR-10 training and testing datasets from torchvision.datasets. Use
methods in transforms.v2 to convert the images to tenors with values between 0 and 1. The
testing set will be used for validation.
(b) Create data loaders for training and validation so that minibatches of 128 training examples will be
used in the training loop. Pick your own batch size for validation set.
(c) Display the first 10 images to get a feel for them.
(d) Define a function for training a model for one epoch and a function for evaluating a model.
def train_one_epoch(dataloader, model, loss_fn, optimizer):
model.train()
∙∙∙
return train_loss
def evaluate(dataloader, model, loss_fn):
model.eval()
∙∙∙
return eval_loss, eval_accuracy
For the following experiments, we would:
• use torch.nn.CrossEntropyLoss as the loss function

• use torch.optim.Adam with default parameter values for the optimization steps

• train the model for 20 epochs without early stopping


• collect the training loss, validation loss and validation accuracy for each epoch.
(A) Baseline model
Define the following model. This model will produce 10 logits. Train this model.

Layer type Additional specification Activation


Convolutional 2D 16 filters of size (3,3) with stride 1 with no padding ReLU
Max pooling 2D pool of size (2,2) with stride 2, no padding none
Convolutional 2D 32 filters of size (3,3) with stride 1 with no padding ReLU
Max pooling 2D pool of size (2,2) with stride 2, no padding none
Convolutional 2D 32 filters of size (3,3) with stride 1 with no padding ReLU
Max pooling 2D pool of size (2,2) with stride 2, no padding none
Flatten none
Linear From 128 to 64 units ReLU
Linear From 64 units to 10 units none

(B) Batch normalization


Enhance the baseline model with batch normalization. Train this model.
Here activation is applied after batch normalization for each convolutional layer.

Layer type Additional specification Activation


Convolutional 2D - 16 filters of size (3,3) with stride 1, no padding, no bias
with BatchNorm2D - Batch normalization ReLU
Max pooling 2D pool of size (2,2) with stride 2, no padding none
Convolutional 2D - 32 filters of size (3,3) with stride 1, no padding, no bias
with BatchNorm2D - Batch normalization ReLU
Max pooling 2D pool of size (2,2) with stride 2, no padding none
Convolutional 2D - 32 filters of size (3,3) with stride 1, no padding, no bias
with BatchNorm2D - Batch normalization ReLU
Max pooling 2D pool of size (2,2) with stride 2, no padding none
Flatten none
Linear From 128 to 64 units ReLU
Linear From 64 units to 10 units none

(C) Data augmentation


Enlarge the training set by concatenating the original training set with an augmented set. The
augmented set is created from the original training set by flipping the images horizontally.
Define a new model identical to the baseline model (A) and train it with the enlarged training set.
(e) Use the collected data from the three trained models to create plots, one for training losses, one for
validation losses and one for validation accuracies. From these plots, comment on your findings and
the effects of batch normalization and data augmentation.
--end of Assignment --

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy