EECS498 - Assignment1
Assignment1: https://web.eecs.umich.edu/~justincj/teaching/eecs498/FA2019/assignment1.html
CV Study Group:723575589(QQ Group)
What to do 🚀
In this assignment, you will first learn how to use PyTorch on Google Colab environment. Then, you will practice putting together a simple image classification pipeline, based on the k-Nearest Neighbor. The goals of this assignment are as follows:
- Develop proficiency with PyTorch tensors
- Gain experience using notebooks on Google Colab
- Understand the basic Image Classification pipeline and the data-driven approach (train/predict stages)
- Understand the train/val/test splits and the use of validation data for hyperparameter tuning
- Implement and apply a k-Nearest Neighbor (kNN) classifier
Q1: PyTorch 101 (50 points)
The notebook pytorch101.ipynb will walk you through the basics of working with tensors in PyTorch.
Q2: k-Nearest Neighbor classifier (50 points)
The notebook kNN.ipynb will walk you through implementing a kNN classifier.
Steps
1. Click “Open in Colab”
This will launch the corresponding notebook in Google Colab. No installation or setup required!
For more information on using Colab, see our Colab tutorial.
2. Save a copy in Drive
Once the notebook launches, click File -> “Save a copy in Drive…”. This will save a copy of the notebook in your own Google Drive account.
By default, when you save a copy the name will be prepended with “Copy of” – for example saving a copy of the notebook “pytorch101.ipynb” will create a file named “Copy of pytorch101.ipynb”. You should rename your copy to have the same name as the original file.
3. Work on the assignment
Work through the notebook, executing cells and writing code as indicated. You can save your work in Google Drive (click “File” -> “Save”) and resume later if you don’t want to complete it all at once.
While working on the assignment, keep the following in mind:
- The notebook has clearly marked blocks where you are expected to write code. Do not write or modify any code outside of these blocks.
- Do not add or delete cells from the notebook. You may add new cells to perform scratch computations, but you should delete them before submitting your work.
- Run all cells before submitting. You will only get credit for code that has been run.
4. Download .ipynb file
Once you have completed a notebook, download the completed notebook by clicking “File” -> “Download .ipynb”.
Make sure your downloaded file has the same name as the original notebook; either pytorch101.ipynb or kNN.ipynb for this assignment.
5. Submit your work to Canvas
Create a .zip
file containing your completed notebook; name it uniquename_umid.zip
(e.g. justincj_12345678.zip
).
Make sure you do not change the filenames or include any other files. Your submitted .zip
file should contain two files named pytorch101.ipynb
and knn.ipynb
.
We have written a validation script for you to check the structure of your submitted .zip
file. This script does not check whether your homework is correct; it only makes sure that your submitted file has the right structure, that you didn’t modify any parts of the .ipynb
files that you shouldn’t have, and that you didn’t miss any sections where you were supposed to write code. In order to be graded, your assignment must pass this validation script. It is your responsibility to make sure your assignment is properly formatted before you submit it.
When you are done, upload your work to Canvas (UMich students only).
Extra Resources 📚
🍉 Notes: These extra learning resources are collected by Ricky X, which might be useful when tackling with the assignment.
PyTorch
Google Colab
- Google CoLab Tutorial — How to setup a Pytorch Environment on CoLab
- How to navigate b/w cells in Google Colab when using vim editor setting?
Tensor basics
Tensors for Neural Networks, Clearly Explained!!!
What is a Tensor?
Numpy Sum Axis Intuition
Understanding dimensions in PyTorch
Tensor reshaping
What does .view() do in PyTorch?
Deep Learning : Discussion on “Reshape” tensor operation
Deep Learning : Discussion on “Transpose” tensor operation
Complete Pytorch Tensor Tutorial (Initializing Tensors, Math, Indexing, Reshaping
torch.unsqueeze() and torch.squeeze()
KNN
+
Cross Validation
- Lecture 8 - Data Splits, Models & Cross-Validation | Stanford CS229: Machine Learning (Autumn 2018)
Solution 🧑🏻💻
Ricky’s GitHub Repository for EECS498 Assignments: https://github.com/Ricky2333/EECS498
CV Study Group:723575589(QQ Group)