Git Product home page Git Product logo

fgsm's Introduction

FGSM(Fast Gradient Sign Method)


Overview

Simple pytorch implementation of FGSM and I-FGSM
(FGSM : explaining and harnessing adversarial examples, Goodfellow et al.)
(I-FGSM : adversarial examples in the physical world, Kurakin et al.)
overview

FGSM

FGSM

I-FGSM

IFGSM

Dependencies

python 3.6.4
pytorch 0.3.1.post2
visdom(optional)
tensorboardX(optional)
tensorflow(optional)

Usage

  1. train a simple MNIST classifier
python main.py --mode train --env_name [NAME]
  1. load trained classifier, generate adversarial examples, and then see outputs in the output directory
python main.py --mode generate --iteration 1 --epsilon 0.03 --env_name [NAME] --load_ckpt best_acc.tar
  1. for a targeted attack, indicate target class number using --target argument(default is -1 for a non-targeted attack)
python main.py --mode generate --iteration 1 --epsilon 0.03 --target 3 --env_name [NAME] --load_ckpt best_acc.tar

Results

Non-targeted attack

from the left, legitimate examples, perturbed examples, and indication of perturbed images that changed predictions of the classifier, respectively

  1. non-targeted attack, iteration : 1, epsilon : 0.03 non-targeted1
  2. non-targeted attack, iteration : 5, epsilon : 0.03 non-targeted2
  3. non-targeted attack, iteration : 1, epsilon : 0.5 non-targeted3

Targeted attack

from the left, legitimate examples, perturbed examples, and indication of perturbed images that led the classifier to predict an input as the target, respectively

  1. targeted attack(9), iteration : 1, epsilon : 0.03 targeted1
  2. targeted attack(9), iteration : 5, epsilon : 0.03 targeted2
  3. targeted attack(9), iteration : 1, epsilon : 0.5 targeted3

References

  1. explaining and harnessing adversarial examples, Goodfellow et al.
  2. adversarial examples in the physical world, Kurakin et al.

fgsm's People

Contributors

1konny avatar

Stargazers

 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.