Giter Site home page Giter Site logo

ape-gan's Introduction

APE-GAN in Tensorflow

Tensorflow implementation of APE-GAN: Adversarial Perturbation Elimination with GAN .

Prerequisites

Usage

To train a model with mnist:

$ python main.py --dataset mnist --train
$ python main.py --dataset mnist --train --adversarial_path=./data/advData.npy --ground_truth_path=./data/gtData.npy

To test with an existing model:

$ python main.py --dataset mnist
$ python main.py --dataset mnist --test_path=./data/testData.npy --save_path=./data/resAPE-GAN.npy

Or, you can use your own data by change the path of numpy. If you use the cifar10 and imageNet datasets, the input_height and output_height should be altered.

For example:

To train a model with cifar10:

$ python main.py --epoch=5 --dataset=cifar10 --input_height=32 --output_height=32 --train=True --adversarial_path=./data/cifarAdv.npy --ground_truth_path=./data/cifarGt.npy

To test with an existing model on the cifar10:

$ python main.py --dataset=cifar10 --input_height=32 --output_height=32 --test_path=advCifar-samples.npy  --save_path=resAPE-GAN_cifar.npy 

It is noteworthy that the adversarial samples cannot be saved in the form of picture, since discretizing the values from a real-numbered value to one of the 256 points seriously degrades the quality. Then it should be saved and loaded as float32 when training and test. In addition, for each pixel, the value should be in the range of [-1,1].

Results

Mnist

Adversarial example:

result1

Reconstructed example by APE-GAN:

result2

ImageNet

Adversarial example:

result3

Reconstructed example by APE-GAN:

result4

Related works

Author

Shiwei Shen

ape-gan's People

Contributors

shenqixiaojiang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.