This repo contains a short tutorial on Adversarial Robustness in PyTorch
that I wrote to teach a class on the topic in Spring, 2020.
To run this notebook, you will need:
- Numpy
- PyTorch
- Matplotlib
- PIL
To install them, run the following command from within your environment:
pip install numpy torch torch-vision matlplotlib Pillow
In this repo you will find a test image of a cat - cat.jpg
, the notebook itself, and four model checkpoint objects, included in case you are unable to train the models in the notebook locally.
The notebook can be readily run in Google Colab, but you will need to upload the json
file (for class labels) and the test image in the sidepane. You can also upload the checkpoint files to avoid training. Bear in mind that these will be cleared if your session expires, and you will have to upload them again.
This is a watered down version of the excellent chapter-wise explanations by Zico Kolter and Aleksander Madry at this link. I've taken the liberty to pick and choose code snippets to form a more concise and quick introduction to adversarial examples and training to those familiar with optimization theory. For a comprehensive dive into the topic, their chapters provide greater detail and mathematical rigor.
I wrote this tutorial for a short lecture on Adversarial Learning as part of the course ELEN E6040: Neural Networks & Deep Learning Research at Columbia University in Spring, 2020. I intend to keep tweaking this project with more interpretations of my own when time allows.