https://github.com/exely/uap-pytorch
A Simple Pytorch Implementation of Universal Adversarial Perturbation to fool neural networks.
https://github.com/exely/uap-pytorch
Last synced: 5 months ago
JSON representation
A Simple Pytorch Implementation of Universal Adversarial Perturbation to fool neural networks.
- Host: GitHub
- URL: https://github.com/exely/uap-pytorch
- Owner: Exely
- License: gpl-3.0
- Created: 2019-09-02T13:24:11.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-05-13T06:28:53.000Z (about 4 years ago)
- Last Synced: 2024-12-31T15:33:13.291Z (6 months ago)
- Language: Python
- Homepage:
- Size: 22.5 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# UAP-pytorch
A simple and UNOFFICIAL Pytorch implementation of Universal Adversarial Perturbation proposed in [[1]](https://arxiv.org/pdf/1610.08401.pdf).
The code is adapted from [LTS4](https://github.com/LTS4/universal) and [ferjad](https://github.com/ferjad/Universal_Adversarial_Perturbation_pytorch). Test passed on python2.7 and Pytorch0.4 .
## Usage
### Dataset preparation.
- __Training set__: Random 10,000 images in 1000 classes from [ILSVRC 2012](http://www.image-net.org/challenges/LSVRC/2012/) training set.
- __Validation set__: ILSVRC 2012 validation set (50,000 images).Please modify the dataset path in [train_test_vgg16.py](train_test_vgg16.py) .
### Traing and evalutaion.
```sh
python train_test_vgg16.py
```
This generates the universal perturbation on a pretrained VGG16 model and evaluates misclassifcation rate on multiple different models.
### Visualization of generated noise.
```sh
python show_v.py
```
## Reference
[1] S. Moosavi-Dezfooli\*, A. Fawzi\*, O. Fawzi, P. Frossard:
[*Universal adversarial perturbations*](http://arxiv.org/pdf/1610.08401), CVPR 2017