Homework 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.
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.6+:
To use python3, make sure to install
version 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 single virtual environment for all homeworks. 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.
All necessary dependencies for your CS131 homeworks can be found in a single requirements.txt file, which has been placed at the root of the homework release repository.
To set up a virtual environment with name
.env
, run the following inside your homework directory (ex: inside
cs131/
):
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>