There will be a weekly homework assignments in this class. These assignments will mainly involve building out prototypes for applications that we will discuss in class. For example, you will learn to create your own instagram-like filters or snapchat-like masks or smart-car lane detectors.
Each assignment will contain a hw*.ipynb ipython notebook file that will guide you through the homework. This file will ask you to code up functions in other *.py files and may even ask you to fill in short answers or equations in the ipython notebook. All the instructions necessary for the homework are contained in these hw*.ipynb files.
The assignments are due each week on Friday at 11:59pm. You can double check the due dates on the syllabus page.
After you have completed each assignment, you need to submit the following deliverables:
Before working on each homework, you need to setup a few things:
Installing Python 3.5+: To use python3, make sure to install version 3.5 or 3.6 on your local machine. If you are on Mac OS X, you can do this using Homebrew with brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb
. You can find instructions for Ubuntu here.
Setting up a virtual environment: we strongly recommend working using a virtual environment for each homework. This will allow you to have a working environment with all the package dependencies within the repository of your homework, without messing up your work environment in other repositories.
To set up a virtual environment with name .env
, run the following inside your homework directory (ex: inside cs131/hw1
):
sudo pip install virtualenv # You will need to do this only once virtualenv -p python3 .env # Creates a virtual environment with python3 source .env/bin/activate # Activate the virtual environment pip install -r requirements.txt # Install all the dependencies # Work on the assignement for a while... deactivate # Exit the virtual environment when you're done
Note that every time you want to work on the assignment, you should run source .env/bin/activate
(from within your assignment folder) to re-activate the virtual environment, and deactivate
again whenever you are done.
Working with Jupyter notebooks: in your assignment repository, start the notebook with the jupyter notebook
command. You might have issues if you are in a virtual environment, as the notebook might not recognize your virtual environment and might not find the kernel located in .env
to execute code. In this case, refer to this page
and do the following within your virtual environment:
python -m ipykernel install --user --name=my-virtualenv-name
If you are unfamiliar with Jupyter notebooks, you can also refer this IPython tutorial.
When working with a Jupyter notebook, you can edit the *.py
files either in the Jupyter interface (in your browser) or with your favorite editor (vim, Atom...). Whenever you save a *.py
file, the notebook will reload their content directly.
All the assignments will be released via github. You can download the files directly from the website. But instead, we recommend, you use git to download the assignments because this will make it easy for you to update the assignments in case there is an update. The instructions below describe how to use git to download our assignments.
Follow the instructions here:
https://git-scm.com/book/en/v1/Getting-Started-Installing-Git
In terminal, run the following to copy the released homework directory to your desktop.
git clone https://github.com/StanfordVL/CS131_release.git
Run the following to copy the lecture notes directory.
git clone https://github.com/StanfordVL/CS131_notes
git pull
This will fetch the changes that TAs made in the remote directory, so your local directory will be up-to-date with the remote one. Be careful that sometimes if the TAs and you are changing the same lines, there will be a conflict, and you may have to fix the conflicts mannually.
In case you did something wrong and want to give up local changes, which hopefully never happens ;), execute
git checkout -- <filename>
Ignore this step for submitting assignments. This section describes how you should submit class notes.
Before submitting your lecture notes, you will only need to commit your lecture notes to the lecture notes directory.
4.1 Create your own branch by running the following, where for example, branchname could be "lecture1", and then switch to the new branch.
git branch lecture1
git checkout lecture1
4.2 Add your local changed files, commit the changes and push to your branch by running the followings.
git add <filename>
git commit -m "your commit message"
git push
4.3 Then you need to merge your branch back to master.
git merge master(first resolve any merge conflicts if there are any)Now go online to your branch on the class notes repository and click on submit a pull request. We will be able to track your class notes, give you feedback and grade your work using this pull request.