Skip to content

AliShahin/P-FGSM

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Private FGSM

Introduction

This is the official repository of Private FGSM (P-FGSM), a work published as Scene privacy protection on Proc. of IEEE Int. Conf. on Acoustics, Speech and Signal Processing (ICASSP), Brighton, UK, May 12-17, 2019.

Original Image Adversarial image
Original Image Adversarial Image
Church (confidence: 82.6%) Zen Garden (confidence: 99.2%)

Requirements

  • Conda
  • Python 2.7
  • Numpy
  • PyTorch
  • Torchvision
  • Opencv-python
  • Tqdm

The code has been tested on Ubuntu 18.04 and MacOs 10.14.4.

Setup

Install miniconda: https://docs.conda.io/en/latest/miniconda.html Create conda environment for Python 2.7

conda create -n pfgsm python=2.7

Activate conda environment:

source activate pfgsm

Install requirements

pip install -r requirements.txt

Only if using MacOs:

export PATH="<pathToMiniconda>/bin:$PATH"
brew install wget

Generate adversarial images

Create a folder with the images that you want to create their adversarials in <pathToImages> Generate adversarial images executing:

python p-fgsm.py --model=<model> --path=<pathToImages>

For example:

python p-fgsm.py --model=resnet50 --path=./images

In the publication ResNet50 is used. However, other models can also be used: ResNet18, and AlexNet. The pre-trained models will download automatically on the first execution of the code.

Output and format

  1. New adversarial folder inside the location of the input images with the generated adversarial images.
<pathToImages>/adversialimages/<imageName>.png
  1. log.txt file in the following order of columns (format):
  • image name
  • number of iterations to converge
  • original class
  • original class probability
  • final class
  • final class probability
  • target class
  • target class probability

Authors

References

If you use our code, please cite the following publication:

@InProceedings{Li2019,
  Title = {Scene Privacy Protection},
  Author = {C. Y. Li and A. S.  Shamsabadi and R. Sanchez-Matilla and R. Mazzon and A. Cavallaro},
  Booktitle = {Proc. IEEE Int. Conf. on Acoustics, Speech and Signal Processing},
  Year = {2019},
  Address  = {Brighton, UK},
  Month = May
}

License

The content of this project itself is licensed under the Creative Commons Non-Commercial (CC BY-NC).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%