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.
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
on your local machine. If you are on Mac OS X, you can do this using
. You can find instructions for Ubuntu
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
, run the following inside your homework directory (ex: inside
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
(from within your assignment folder) to re-activate the virtual
again whenever you are done.
in your assignment repository, start the notebook with the
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
to execute code. In this case, refer to
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
files either in the Jupyter interface (in your browser) or with your
favorite editor (vim, Atom...). Whenever you save a
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:
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
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>