Giter Club home page Giter Club logo

one-pixel-attack's Introduction

One Pixel attack

Recently there has been a lot of interest in fooling Neural Networks that were trained to classify on a particular dataset. Researchers have produced various methods that would perturb the natural image in way that the perturbation is imperceivable to the human eye, but disastrous to the correctness of the Neural Network in classifying the image.

This is an implementation of a recent paper which takes it to the extreme. How simple is it to fool a Neural network by changing just one pixel? It turns out, the current state-of-the-art Neural Networks are substantially vulnerable to this attack. There is a caveat. The adversary, who is trying to break the Neural Network should be given access to the black-box classification model for a fairly large number of experiments. In addition, the adversary needs to know the output probability distribution over the set of classes. These conditions are much weaker compared to the previous attacks where the adversary also has access to the gradients in the Neural Network.

The following project is a Keras reimplementation of "One pixel attack for fooling deep neural networks"

Example successful attacks

Targeted attack

Given an input image and an image classification model, the aim of a targeted attack is to maximize the probability label of the target class.

True class: Deer

Target class: Cat

Original Deer image Perturbed Deer image
Deer: 99.4% Cat: 52.49%

Non-targeted attack

Given an input image and an image classification model, the aim of a non-targeted attack is to minimize the probability label of the true class.

True class: Dog

Original dog image Perturbed dog image
Dog: 94.8% Dog: 7.8% (Bird: 90.8%)

Usage

Targeted attack

python targeted.py --config config.yaml --input images/deer.jpg --target cat

Non-targeted attack

python non_targeted.py --config config.yaml --input images/puppy.jpg

Conclusions

  • In my experiments, I found out that it is much easier to a fool a CIFAR-10 classifier than an ImageNet classifier. This is noted by the authors in the original paper as well.
  • Although the success rate is quite low, this experiment was a great learning experience and demonstrates the fragile nature of various Deep Learning based image classifiers.
  • Overall, I really liked the paper and enjoyed implementing for its simplicity and effectiveness conveying the point.

one-pixel-attack's People

Contributors

saikiranburle avatar

Watchers

James Cloos 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.