All Projects → qilong-zhang → Pytorch_Universal-adversarial-perturbation

qilong-zhang / Pytorch_Universal-adversarial-perturbation

Licence: other
A PyTorch implementation of universal adversarial perturbation (UAP) which is more easy to understand and implement.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pytorch Universal-adversarial-perturbation

jpeg-defense
SHIELD: Fast, Practical Defense and Vaccination for Deep Learning using JPEG Compression
Stars: ✭ 82 (+105%)
Mutual labels:  imagenet-dataset
ConSSL
PyTorch Implementation of SOTA SSL methods
Stars: ✭ 61 (+52.5%)
Mutual labels:  imagenet-dataset
Distributed-ResNet-Tensorflow
A Distributed ResNet on multi-machines each with one GPU card.
Stars: ✭ 20 (-50%)
Mutual labels:  imagenet-dataset
imagenet-face-obfuscation
Code for the paper "A Study of Face Obfuscation in ImageNet"
Stars: ✭ 35 (-12.5%)
Mutual labels:  imagenet-dataset

Python

A PyTorch implementation of universal adversarial perturbation which is more easy to understand and implement.
Refer to the original tensorflow code.

Usage

Dataset

training dataset(Choose 10 imgs for each category)
Validation dataset

All you need to do is unzip the downloaded file, and the results are as follows:

Get started

To get started, you should first Change the training data file path (in search.py) to yours. For example

X = ImagetNet('../data/ILSVRC2012_train/pick_image/', 1000, 10, transforms = transform)

If your testing data path (in search.py) is testing_data_path, then you should write

val_loader = torch.utils.data.DataLoader(ImageFolder(testing_data_path, transforms = transform)

It should be noted that I use two different ways to input our data (i.e., X and val_loader), the main reason I didn't make it consistent is because I wanted to show you a variety of ways to write it. Hope it doesn't bother you.

After you modify all the path, then you can run the following demo code

python search.py

Result

I tested my code for googlenet and resnet-152 with \epsilon = 10 (L_inf norm), and after 5 epoch, the result accuracy on validation set was ~78% and ~84% respectively. It is similar with the result report in paper.

Reference

[1] S. Moosavi-Dezfooli*, A. Fawzi*, O. Fawzi, P. Frossard: Universal adversarial perturbations, CVPR 2017

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].