|
2 | 2 | layout: page |
3 | 3 | title: Assignment 3 |
4 | 4 | mathjax: true |
5 | | -permalink: /assignments2020/assignment3/ |
| 5 | +permalink: /assignments2021/assignment3/ |
6 | 6 | --- |
7 | 7 |
|
8 | | -This assignment is due on **Wednesday, May 27 2020** at 11:59pm PDT. |
9 | | - |
10 | | -<details> |
11 | | -<summary>Handy Download Links</summary> |
12 | | - |
13 | | - <ul> |
14 | | - <li><a href="{{ site.hw_3_colab }}">Option A: Colab starter code</a></li> |
15 | | - <li><a href="{{ site.hw_3_jupyter }}">Option B: Jupyter starter code</a></li> |
16 | | -</ul> |
17 | | -</details> |
18 | | - |
19 | | -- [Goals](#goals) |
20 | | -- [Setup](#setup) |
21 | | - - [Option A: Google Colaboratory (Recommended)](#option-a-google-colaboratory-recommended) |
22 | | - - [Option B: Local Development](#option-b-local-development) |
23 | | -- [Q1: Image Captioning with Vanilla RNNs (29 points)](#q1-image-captioning-with-vanilla-rnns-29-points) |
24 | | -- [Q2: Image Captioning with LSTMs (23 points)](#q2-image-captioning-with-lstms-23-points) |
25 | | -- [Q3: Network Visualization: Saliency maps, Class Visualization, and Fooling Images (15 points)](#q3-network-visualization-saliency-maps-class-visualization-and-fooling-images-15-points) |
26 | | -- [Q4: Style Transfer (15 points)](#q4-style-transfer-15-points) |
27 | | -- [Q5: Generative Adversarial Networks (15 points)](#q5-generative-adversarial-networks-15-points) |
28 | | -- [Submitting your work](#submitting-your-work) |
29 | | - |
30 | | -### Goals |
31 | | - |
32 | | -In this assignment, you will implement recurrent neural networks and apply them to image captioning on the Microsoft COCO data. You will also explore methods for visualizing the features of a pretrained model on ImageNet, and use this model to implement Style Transfer. Finally, you will train a Generative Adversarial Network to generate images that look like a training dataset! |
33 | | - |
34 | | -The goals of this assignment are as follows: |
35 | | - |
36 | | -- Understand the architecture of recurrent neural networks (RNNs) and how they operate on sequences by sharing weights over time. |
37 | | -- Understand and implement both Vanilla RNNs and Long-Short Term Memory (LSTM) networks. |
38 | | -- Understand how to combine convolutional neural nets and recurrent nets to implement an image captioning system. |
39 | | -- Explore various applications of image gradients, including saliency maps, fooling images, class visualizations. |
40 | | -- Understand and implement techniques for image style transfer. |
41 | | -- Understand how to train and implement a Generative Adversarial Network (GAN) to produce images that resemble samples from a dataset. |
| 8 | +<span style="color:red">This assignment is due on **Tuesday, May 25 2021** at 11:59pm PST.</span> |
42 | 9 |
|
43 | 10 | ### Setup |
44 | 11 |
|
45 | | -You should be able to use your setup from assignments 1 and 2. |
46 | | - |
47 | | -You can work on the assignment in one of two ways: **remotely** on Google Colaboratory or **locally** on your own machine. |
48 | | - |
49 | | -**Regardless of the method chosen, ensure you have followed the [setup instructions](/setup-instructions) before proceeding.** |
50 | | - |
51 | | -#### Option A: Google Colaboratory (Recommended) |
52 | | - |
53 | | -**Download.** Starter code containing Colab notebooks can be downloaded [here]({{site.hw_3_colab}}). |
54 | | - |
55 | | -If you choose to work with Google Colab, please familiarize yourself with the [recommended workflow]({{site.baseurl}}/setup-instructions/#working-remotely-on-google-colaboratory). |
| 12 | +Please familiarize yourself with the [recommended workflow]({{site.baseurl}}/setup-instructions/#working-remotely-on-google-colaboratory) before starting the assignment. You should also watch the Colab walkthrough tutorial below. |
56 | 13 |
|
57 | 14 | <iframe style="display: block; margin: auto;" width="560" height="315" src="https://www.youtube.com/embed/IZUz4pRYlus" frameborder="0" allowfullscreen></iframe> |
58 | 15 |
|
59 | 16 | **Note**. Ensure you are periodically saving your notebook (`File -> Save`) so that you don't lose your progress if you step away from the assignment and the Colab VM disconnects. |
60 | 17 |
|
| 18 | +While we don't officially support local development, we've added a <b>requirements.txt</b> file that you can use to setup a virtual env. |
| 19 | + |
61 | 20 | Once you have completed all Colab notebooks **except `collect_submission.ipynb`**, proceed to the [submission instructions](#submitting-your-work). |
62 | 21 |
|
63 | | -#### Option B: Local Development |
| 22 | +### Goals |
64 | 23 |
|
65 | | -**Download.** Starter code containing jupyter notebooks can be downloaded [here]({{site.hw_3_jupyter}}). |
| 24 | +In this assignment, you will implement language networks and apply them to image captioning on the COCO dataset. Then you will explore methods for visualizing the features of a pretrained model on ImageNet and train a Generative Adversarial Network to generate images that look like a training dataset. Finally, you will be introduced to self-supervised learning to automatically learn the visual representations of an unlabeled dataset. |
66 | 25 |
|
67 | | -**Install Packages**. Once you have the starter code, activate your environment (the one you installed in the [Software Setup]({{site.baseurl}}/setup-instructions/) page) and run `pip install -r requirements.txt`. |
| 26 | +The goals of this assignment are as follows: |
68 | 27 |
|
69 | | -**Download data**. Next, you will need to download the COCO captioning data, a pretrained SqueezeNet model (for TensorFlow), and a few ImageNet validation images. Run the following from the `assignment3` directory: |
| 28 | +- Understand and implement RNN and Transformer networks. Combine them with CNN networks for image captioning. |
| 29 | +- Explore various applications of image gradients, including saliency maps, fooling images, class visualizations. |
| 30 | +- Understand how to train and implement a Generative Adversarial Network (GAN) to produce images that resemble samples from a dataset. |
| 31 | +- Understand how to leverage self-supervised learning techniques to help with image classification tasks. |
70 | 32 |
|
71 | | -```bash |
72 | | -cd cs231n/datasets |
73 | | -./get_datasets.sh |
74 | | -``` |
75 | | -**Start Jupyter Server**. After you've downloaded the data, you can start the Jupyter server from the `assignment3` directory by executing `jupyter notebook` in your terminal. |
| 33 | +**You will use PyTorch for the majority of this homework.** |
76 | 34 |
|
77 | | -Complete each notebook, then once you are done, go to the [submission instructions](#submitting-your-work). |
| 35 | +### Q1: Image Captioning with Vanilla RNNs (30 points) |
78 | 36 |
|
79 | | -**You can do Questions 3, 4, and 5 in TensorFlow or PyTorch. There are two versions of each of these notebooks, one for TensorFlow and one for PyTorch. No extra credit will be awarded if you do a question in both TensorFlow and PyTorch** |
| 37 | +The notebook `RNN_Captioning.ipynb` will walk you through the implementation of vanilla recurrent neural networks and apply them to image captioning on COCO. |
80 | 38 |
|
81 | | -### Q1: Image Captioning with Vanilla RNNs (29 points) |
| 39 | +### Q2: Image Captioning with Transformers (20 points) |
82 | 40 |
|
83 | | -The notebook `RNN_Captioning.ipynb` will walk you through the implementation of an image captioning system on MS-COCO using vanilla recurrent networks. |
| 41 | +The notebook `Transformer_Captioning.ipynb` will walk you through the implementation of a Transformer model and apply it to image captioning on COCO. |
84 | 42 |
|
85 | | -### Q2: Image Captioning with LSTMs (23 points) |
| 43 | +### Q3: Network Visualization: Saliency Maps, Class Visualization, and Fooling Images (15 points) |
86 | 44 |
|
87 | | -The notebook `LSTM_Captioning.ipynb` will walk you through the implementation of Long-Short Term Memory (LSTM) RNNs, and apply them to image captioning on MS-COCO. |
| 45 | +The notebook `Network_Visualization.ipynb` will introduce the pretrained SqueezeNet model, compute gradients with respect to images, and use them to produce saliency maps and fooling images. |
88 | 46 |
|
89 | | -### Q3: Network Visualization: Saliency maps, Class Visualization, and Fooling Images (15 points) |
| 47 | +### Q4: Generative Adversarial Networks (15 points) |
90 | 48 |
|
91 | | -The notebooks `NetworkVisualization-TensorFlow.ipynb`, and `NetworkVisualization-PyTorch.ipynb` will introduce the pretrained SqueezeNet model, compute gradients with respect to images, and use them to produce saliency maps and fooling images. Please complete only one of the notebooks (TensorFlow or PyTorch). No extra credit will be awardeded if you complete both notebooks. |
| 49 | +In the notebook `Generative_Adversarial_Networks.ipynb` you will learn how to generate images that match a training dataset and use these models to improve classifier performance when training on a large amount of unlabeled data and a small amount of labeled data. **When first opening the notebook, go to `Runtime > Change runtime type` and set `Hardware accelerator` to `GPU`.** |
92 | 50 |
|
93 | | -### Q4: Style Transfer (15 points) |
| 51 | +### Q5: Self-Supervised Learning for Image Classification (20 points) |
94 | 52 |
|
95 | | -In thenotebooks `StyleTransfer-TensorFlow.ipynb` or `StyleTransfer-PyTorch.ipynb` you will learn how to create images with the content of one image but the style of another. Please complete only one of the notebooks (TensorFlow or PyTorch). No extra credit will be awardeded if you complete both notebooks. |
| 53 | +In the notebook `Self_Supervised_Learning.ipynb`, you will learn how to leverage self-supervised pretraining to obtain better performance on image classification tasks. **When first opening the notebook, go to `Runtime > Change runtime type` and set `Hardware accelerator` to `GPU`.** |
96 | 54 |
|
97 | | -### Q5: Generative Adversarial Networks (15 points) |
| 55 | +### Extra Credit: Image Captioning with LSTMs (5 points) |
98 | 56 |
|
99 | | -In the notebooks `GANS-TensorFlow.ipynb` or `GANS-PyTorch.ipynb` you will learn how to generate images that match a training dataset, and use these models to improve classifier performance when training on a large amount of unlabeled data and a small amount of labeled data. Please complete only one of the notebooks (TensorFlow or PyTorch). No extra credit will be awarded if you complete both notebooks. |
| 57 | +The notebook `LSTM_Captioning.ipynb` will walk you through the implementation of Long-Short Term Memory (LSTM) RNNs and apply them to image captioning on COCO. |
100 | 58 |
|
101 | 59 | ### Submitting your work |
102 | 60 |
|
103 | 61 | **Important**. Please make sure that the submitted notebooks have been run and the cell outputs are visible. |
104 | 62 |
|
105 | | -Once you have completed all notebooks and filled out the necessary code, there are **_two_** steps you must follow to submit your assignment: |
| 63 | +Once you have completed all notebooks and filled out the necessary code, you need to follow the below instructions to submit your work: |
106 | 64 |
|
107 | | -**1.** If you selected Option A and worked on the assignment in Colab, open `collect_submission.ipynb` in Colab and execute the notebook cells. If you selected Option B and worked on the assignment locally, run the bash script in `assignment3` by executing `bash collectSubmission.sh`. |
| 65 | +**1.** Open `collect_submission.ipynb` in Colab and execute the notebook cells. |
108 | 66 |
|
109 | 67 | This notebook/script will: |
110 | 68 |
|
111 | | -* Generate a zip file of your code (`.py` and `.ipynb`) called `a3.zip`. |
112 | | -* Convert all notebooks into a single PDF file. |
113 | | - |
114 | | -**Note for Option B users**. You must have (a) `nbconvert` installed with Pandoc and Tex support and (b) `PyPDF2` installed to successfully convert your notebooks to a PDF file. Please follow these [installation instructions](https://nbconvert.readthedocs.io/en/latest/install.html#installing-nbconvert) to install (a) and run `pip install PyPDF2` to install (b). If you are, for some inexplicable reason, unable to successfully install the above dependencies, you can manually convert each jupyter notebook to HTML (`File -> Download as -> HTML (.html)`), save the HTML page as a PDF, then concatenate all the PDFs into a single PDF submission using your favorite PDF viewer. |
| 69 | +* Generate a zip file of your code (`.py` and `.ipynb`) called `a3_code_submission.zip`. |
| 70 | +* Convert all notebooks into a single PDF file called `a3_inline_submission.pdf`. |
115 | 71 |
|
116 | 72 | If your submission for this step was successful, you should see the following display message: |
117 | 73 |
|
118 | | -`### Done! Please submit a3.zip and the pdfs to Gradescope. ###` |
| 74 | +`### Done! Please submit a3_code_submission.zip and a3_inline_submission.pdf to Gradescope. ###` |
119 | 75 |
|
120 | | -**2.** Submit the PDF and the zip file to [Gradescope](https://www.gradescope.com/courses/103764). |
| 76 | +**2.** Submit the PDF and the zip file to [Gradescope](https://www.gradescope.com/courses/257661). |
121 | 77 |
|
122 | | -**Note for Option A users**. Remember to download `a3.zip` and `assignment.pdf` locally before submitting to Gradescope. |
| 78 | +Remember to download `a3_code_submission.zip` and `a3_inline_submission.pdf` locally before submitting to Gradescope. |
0 commit comments