This repository is an PyTorch implementation of the paper Image Super-Resolution as a Defense Against Adversarial Attacks
We use wavelet denoising and image super resolution as pre-processing steps to defend images against adversarial attacks. If you find our work useful in your research or publication, please cite our work:
We provide scripts for reproducing all the results from our paper. You can check the efficacy of our defense on your own adversarial images.
- Python 3.6
- PyTorch >= 0.4.0
- imageio
- tqdm
Clone this repository into any place you want.
git clone https://github.com/aamir-mustafa/super-resolution-adversarial-defense
cd super-resolution-adversarial-defense
You can test our wavelet denoising + super-resolution algorithm on your own adversarial images and their corresponding ground truth labels.
Wavelet_Denoising.py
-- (for image wavelet denoising).
- The denoised images will be saved in
test
folder.
Place your denoised images in test
folder. (like test/<your_image(s)>
) We support jpg files.
Run the script in src
folder.
cd src # You are now in */super-resolution-adversarial-defense-master/src
sh super_resolution.sh
- You can find the result images from
experiment/test/results-Demo
folder.
Accuracy.py
(Evaluate the performace of our method by comparing accuracies on adversarial and recovered images).
@article{mustafa2019image,
title={Image Super-Resolution as a Defense Against Adversarial Attacks},
author={Mustafa, Aamir and Khan, Salman H and Hayat, Munawar and Shen, Jianbing and Shao, Ling},
journal={arXiv preprint arXiv:1901.01677},
year={2019}
}