Awesome
Transferable Sparse Adversarial Attack
Pytorch Implementation of our paper "Transferable Sparse Adversarial Attack".
Table of Contents
- Dependencies <a name="Dependencies"/>
- Pretrained-Generators <a name="Pretrained-Generators"/>
- Datasets <a name="Datasets"/>
- Training/Eval <a name="Training"/>
Dependencies
- Install pytorch. This repo is tested with pytorch==1.6.0.
- Install python packages using following command:
pip install -r requirements.txt
This repo is tested with python==3.8.5.
Pretrained-Generators
Download pretrained adversarial generators from here.
Adversarial generators are trained against following two models.
- Inceptionv3
- ResNet50
These models are trained on ImageNet and available in Pytorch.
Datasets
- Training data:
- ImageNet Training Set.
- Evaluations data:
Training
<p align="justify"> Run the following command python train.py --train_dir [path_to_train] --model_type incv3 --eps 255 --target -1
This will start trainig a generator trained on one dataset (--train_dir) against Inceptionv3 (--model_type) under perturbation budget $\ell_\infty$=255 (--eps) in a non-targeted setting (--target).<p>
Evaluations
<p align="justify"> Run the following command python eval.py --test_dir [path_to_val] --model_type incv3 --model_t res50 --eps 255 --target 971 --checkpoint [path_to_checkpoint]
This will load a generator trained against Inceptionv3 (--model_type) and evaluate clean and adversarial accuracy of ResNet50 (--model_t) under perturbation budget 255 (--eps) in a targeted setting (--target). <p>
Citation
If you find this repo useful, please cite our paper.