Skip to content

TensorFlow program for training MNIST classifier and generating adversarial images for it

License

Notifications You must be signed in to change notification settings

arakhmati/mnist-adversarial-image-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MNIST Adversarial Image Generator

Download Instructions

git clone https://github.com/arakhmat/mnist-adversarial-image-generator

Usage

If you running the script for the first time:

# Specify '--train' flag to train the model
python generator.py -t

For consequent runs, use:

python generator.py

You can specify the following arguments when running the script:

'-t', type=bool,  action='store_true', help='train the network'
'-e', type=bool,  action='store_true', help='run evaluation'
'-s', type=int,   default=20000,       help='number of training steps'
'-b', type=int,   default=64,          help='training batch size'
'-o', type=int,   default=2,           help='label to replace'
'-n', type=int,   default=6,           help='adversarial label'
'-m', type=int,   default=10,          help='number of images to modify'
'-l', type=float, default=0.001,       help='adversarial learning rate'
'-r', type=float, default=0.0001,      help='regularization lambda'
'-p', type=bool,  action='store_true', help='modify only a single pixel'

Example

In this example, 10 images of the digit 2 were modified to be classified as the digit 6.

Columns (left to right): Original Image, Delta, Adversarial Image

alt text

One Pixel Example

In this example, the images that initially predict 2 but are close to predicting 6 were modified to predict 6 by changing only a single pixel.

Columns (left to right): Original Image, Delta, Adversarial Image

alt text

Acknowledgments

About

TensorFlow program for training MNIST classifier and generating adversarial images for it

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages