/Attack-Diffusion-Models-for-Adversarial-Purification

This is a repository for storing the code for course project in ECE 381V Advanced Machine Learning

Primary LanguagePythonOtherNOASSERTION

Attack Diffusion Models for Adversarial Purification

This is a repository for storing code for course project. The code was adapted from the official implementation of the paper Diffusion Models for Adversarial Purification.

Requirements

  • 64-bit Python 3.8.
  • CUDA=11.0 must be installed first.

Data and pre-trained models

ImageNet data should be put in ./dataset/imagenet_lmdb/val/ and categorized into different classes in different subfolders. convert the ImageNet dataset to LMDB.

There is no need to download CIFAR-10 separately.

For the pre-trained diffusion models, you need to first download them from the following links:

For the pre-trained classifiers, most of them do not need to be downloaded separately, except for

Note that you have to put all the pretrained models in the pretrained directory.

Run experiments on CIFAR-10

AutoAttack L2

bash cifar10_L2_rand.sh bash imagenet_L2_rand.sh

AutoAttack Linf

bash imagenet_Linf_rand.sh

License

Please check the LICENSE file. This work may be used non-commercially, meaning for research or evaluation purposes only. For business inquiries, please contact researchinquiries@nvidia.com.