|
| 1 | +--- |
| 2 | +layout: page |
| 3 | +title: Assignment 1 |
| 4 | +mathjax: true |
| 5 | +permalink: /assignments2022/assignment1/ |
| 6 | +--- |
| 7 | + |
| 8 | +<span style="color:red">This assignment is due on **Friday, April 15 2022** at 11:59pm PST.</span> |
| 9 | + |
| 10 | +Starter code containing Colab notebooks can be [downloaded here]({{site.hw_1_colab}}). |
| 11 | + |
| 12 | +- [Setup](#setup) |
| 13 | +- [Goals](#goals) |
| 14 | +- [Q1: k-Nearest Neighbor classifier](#q1-k-nearest-neighbor-classifier) |
| 15 | +- [Q2: Training a Support Vector Machine](#q2-training-a-support-vector-machine) |
| 16 | +- [Q3: Implement a Softmax classifier](#q3-implement-a-softmax-classifier) |
| 17 | +- [Q4: Two-Layer Neural Network](#q4-two-layer-neural-network) |
| 18 | +- [Q5: Higher Level Representations: Image Features](#q5-higher-level-representations-image-features) |
| 19 | +- [Submitting your work](#submitting-your-work) |
| 20 | + |
| 21 | +### Setup |
| 22 | + |
| 23 | +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. |
| 24 | + |
| 25 | +<iframe style="display: block; margin: auto;" width="560" height="315" src="https://www.youtube.com/embed/IZUz4pRYlus" frameborder="0" allowfullscreen></iframe> |
| 26 | + |
| 27 | +**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. |
| 28 | + |
| 29 | +Once you have completed all Colab notebooks **except `collect_submission.ipynb`**, proceed to the [submission instructions](#submitting-your-work). |
| 30 | + |
| 31 | +### Goals |
| 32 | + |
| 33 | +In this assignment you will practice putting together a simple image classification pipeline based on the k-Nearest Neighbor or the SVM/Softmax classifier. The goals of this assignment are as follows: |
| 34 | + |
| 35 | +- Understand the basic **Image Classification pipeline** and the data-driven approach (train/predict stages). |
| 36 | +- Understand the train/val/test **splits** and the use of validation data for **hyperparameter tuning**. |
| 37 | +- Develop proficiency in writing efficient **vectorized** code with numpy. |
| 38 | +- Implement and apply a k-Nearest Neighbor (**kNN**) classifier. |
| 39 | +- Implement and apply a Multiclass Support Vector Machine (**SVM**) classifier. |
| 40 | +- Implement and apply a **Softmax** classifier. |
| 41 | +- Implement and apply a **Two layer neural network** classifier. |
| 42 | +- Understand the differences and tradeoffs between these classifiers. |
| 43 | +- Get a basic understanding of performance improvements from using **higher-level representations** as opposed to raw pixels, e.g. color histograms, Histogram of Gradient (HOG) features, etc. |
| 44 | + |
| 45 | +### Download data: |
| 46 | +Once you have the starter code, you will need to download the CIFAR-10 dataset. |
| 47 | +Run the following from the `assignment1` directory: |
| 48 | + |
| 49 | +```bash |
| 50 | +cd cs231n/datasets |
| 51 | +./get_datasets.sh |
| 52 | +``` |
| 53 | + |
| 54 | +### Q1: k-Nearest Neighbor classifier |
| 55 | + |
| 56 | +The notebook **knn.ipynb** will walk you through implementing the kNN classifier. |
| 57 | + |
| 58 | +### Q2: Training a Support Vector Machine |
| 59 | + |
| 60 | +The notebook **svm.ipynb** will walk you through implementing the SVM classifier. |
| 61 | + |
| 62 | +### Q3: Implement a Softmax classifier |
| 63 | + |
| 64 | +The notebook **softmax.ipynb** will walk you through implementing the Softmax classifier. |
| 65 | + |
| 66 | +### Q4: Two-Layer Neural Network |
| 67 | + |
| 68 | +The notebook **two\_layer\_net.ipynb** will walk you through the implementation of a two-layer neural network classifier. |
| 69 | + |
| 70 | +### Q5: Higher Level Representations: Image Features |
| 71 | + |
| 72 | +The notebook **features.ipynb** will examine the improvements gained by using higher-level representations |
| 73 | +as opposed to using raw pixel values. |
| 74 | + |
| 75 | +### Submitting your work |
| 76 | + |
| 77 | +**Important**. Please make sure that the submitted notebooks have been run and the cell outputs are visible. |
| 78 | + |
| 79 | +Once you have completed all notebooks and filled out the necessary code, you need to follow the below instructions to submit your work: |
| 80 | + |
| 81 | +**1.** Open `collect_submission.ipynb` in Colab and execute the notebook cells. |
| 82 | + |
| 83 | +This notebook/script will: |
| 84 | + |
| 85 | +* Generate a zip file of your code (`.py` and `.ipynb`) called `a1.zip`. |
| 86 | +* Convert all notebooks into a single PDF file. |
| 87 | + |
| 88 | +If your submission for this step was successful, you should see the following display message: |
| 89 | + |
| 90 | +`### Done! Please submit a1.zip and the pdfs to Gradescope. ###` |
| 91 | + |
| 92 | +**2.** Submit the PDF and the zip file to [Gradescope](https://www.gradescope.com/courses/379571). |
| 93 | + |
| 94 | +Remember to download `a1.zip` and `assignment.pdf` locally before submitting to Gradescope. |
0 commit comments