The task is to perform attack on 3: CIFAR10, GTSRB and MNIST dataset.
What do I need for the attack?
- Autoencoder tranined on the dataset
- A classifier to fool
- Attack Success Rates and LPIPS on the prior techniques and new techniques
The code is written in such a way that, all the things except the files (models, objects, datasets) are kept in the project artifact folder. Here, in the code, we've to mention the location of the corresponding artifact folder. Once, we've specified it, the others will follow the path as:
project_artifact\
datasets\ # dataset specific to the project or experiment
checkpoints\ # models of the project
objects\ # objects saved from the project
- To run and get the results for any attack X and SPAT-X run the following code:
python attack_main.py --model-name cifar10_cnn_1 --ae-name ann_128 --dataset-len 1000 --attack-name pgd --batch-size 32 --eval
Here:
- Classifier name is
cifar10_cnn_1
. For choosing different models, refer the fileconfigs/dataset_name.yml
in theclassifiers
section. - Autoencoder name is
ann_128
. For choosing different models, refer the fileconfigs/dataset_name.yml
in theautoencoders
section. - Dataset length is 1000, you can choose anywhere between 1 to 10,000.
- Attack name is
pgd
. Choose one of:fgsm, bim, pgd, cnw, deepfool, elastic
. Hereelastic
corresponds to EAD anddeepfool
corresponds to DF in the paper. - Batch size is 32
For other parametes and flags, consider checking the attack_main.py
- Create a datoloader and put it in the dataloader mapping dict in the file
dataloader.py
- Create a classifier in the file
models/classifier.py
- Create an autoencoder in the file
models/autoencoder.py
- Create a config file in the folder
configs/
asdataset_name.yml
- Update the
dataset_name.yml
using the classifier checkpoint path and autoencoder checkpoint path. - Update the same in the file
models/__init__.py
- Run
attack_main.py
with appropiate command