/advflow

Adversarial examples on keras and tensorflow

Primary LanguageJupyter NotebookMIT LicenseMIT

AdvFlow

A library over TensorFlow and Keras to experimnent with Adversarial Images. Examples included for CIFAR-10 data sets.

Installation

Add repository to your PYTHONPATH

Requirements: tensorflow, keras

Preprocessing the data sets

./preprcessing/load_npy.py (-h for help)

Training

Different model defintions from model_defs.py can be trained using this script.

./train.py (-h for help)

Testing

Trained models can be evaluated with std-droput and mc-dropput interpretaions

./test.py (-h for help)

Generate adversrial images

Adversrial images for the the CIFAR10 images can be generated and saved using this script

./genadv.py (-h for help)

Example of a horse

The epsilon used for FastGradientSign varies from 0.0 (top-left) to 0.1 (bottom-right).

adv_horse

Difference from original-image

adv_horse_diff

Note: The compression algorithm/normalisation affects the imperceptibility of an image and its corresponsing adversarial image.

adv_horse

the noisy pixels vanish when saved as jpeg

adv_horse