Awesome
This repository contains the code and data for our paper:
Editing a classifier by rewriting its prediction rules <br> Shibani Santurkar*, Dimitris Tsipras*, Mahi Elango, David Bau, Antonio Torralba, Aleksander Madry <br> Paper: https://arxiv.org/abs/2112.01008 <br>
@InProceedings{santurkar2021editing,
title={Editing a classifier by rewriting its prediction rules},
author={Shibani Santurkar and Dimitris Tsipras and Mahalaxmi Elango and David Bau and Antonio Torralba and Aleksander Madry},
year={2021},
booktitle={Neural Information Processing Systems (NeurIPS)}
}
Getting started
You can start by cloning our repository and following the steps below. Parts of this codebase have been derived from the GAN rewriting repository of Bau et al.
-
Install the dependencies for our code using Conda. You may need to adjust the environment YAML file depending on your setup.
conda env create -f environment.yaml
-
Download model checkpoints and extract them in the current directory.
-
To instantiate CLIP
git submodule init git submodule update
-
Replace
IMAGENET_PATH
inhelpers/classifier_helpers.py
with the path to the ImageNet dataset. -
(If using synthetic examples) Download files segmentations.tar.gz and styles.tar.gz and extract them under
./data/synthetic
. -
(If using synthetic examples) Run
python stylize.py -style_name [STYLE_FILE_NAME]
with the desired style file from ./data/synthetic/styles
. You could also use a custom style file if desired.
That's it! Now you can explore our editing methodology in various settings: vehicles-on-snow, typographic attacks and synthetic test cases.