Skip to content

phibenz/uap_virtual_data.pytorch

Repository files navigation

Universal Adversarial Perturbation with virtual data

This is the repository accompanying our CVPR 2020 paper Understanding Adversarial Examples from the Mutual Influence of Images and Perturbations

Setup

You can install the requirements with pip3 install requirements.txt.

Config

Copy the sample_config.py to config.py (cp ./config/sample_config.py ./config/config.py) and edit the paths accordingly.

Datasets

The code supports training UAPs on ImageNet, MS COCO, PASCAL VOC and Places365

ImageNet

The ImageNet dataset should be preprocessed, such that the validation images are located in labeled subfolders as for the training set. You can have a look at this bash-script if you did not process your data already. Set the paths in your config.py.

IMAGENET_PATH = "/path/to/Data/ImageNet"

COCO

The COCO 2017 images can be downloaded from here for training and validation. After downloading and extracting the data update the paths in your config.py.

COCO_2017_TRAIN_IMGS = "/path/to/COCO/train2017/"			
COCO_2017_TRAIN_ANN = "/path/to/COCO/annotations/instances_train2017.json"
COCO_2017_VAL_IMGS = "/path/to/COCO/val2017/"
COCO_2017_VAL_ANN = "/path/to/instances_val2017.json"

PASCAL VOC

The training/validation data of the PASCAL VOC2012 Challenge can be downloaded from here. After downloading and extracting the data update the paths in your config.py.

VOC_2012_ROOT = "/path/to/Data/VOCdevkit/"

Places 365

The Places365 data can be downloaded from here. After downloading and extracting the data update the paths in your config.py.

PLACES365_ROOT = "/home/user/Data/places365/"

Run

Run bash ./run.sh to generate UAPs for different target models trained on ImageNet using virtual data Places365. The bash script should be easy to adapt to perform different experiments. The jupyter notebook pcc_analysis.ipynb is an example for the PCC-analysis discussed in the paper.

Citation

@inproceedings{zhang2020understanding,
  title={Understanding Adversarial Examples From the Mutual Influence of Images and Perturbations},
  author={Zhang, Chaoning and Benz, Philipp and Imtiaz, Tooba and Kweon, In So},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={14521--14530},
  year={2020}
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published