Giter Club home page Giter Club logo

null_class_adversarial_defense's Introduction

null_class_adversarial_defense

Code to replicate the arxiv technical report:
Utilizing a null class to restrict decision spaces and defend against neural network adversarial attacks

p

The code in this repo was used to build, train, and test all the models reported on in the paper. Is also generates all the figures.

Main Python package requirements

  • Tensorflow 2.1
  • Numpy
  • Pandas
  • Matplotlib

MNIST data

MNIST data was downloaded from Yann LeCun's website: http://yann.lecun.com/exdb/mnist/

You'll need the Python mnist package to load the data

pip install python-mnist

In the files:

  • train_mnist_multiple_models.ipynb
  • plot_null_image_examples.ipynb
  • fgsm_mnist_model.ipynb
  • fgsm_mnist_multiple_models.ipynb

set the path of the mnist directory to the location where you stored the files, e.g.,

dir_mnist = './mnist'

Jupyter notebook files

In order to import the .ipynb files without having to convert them to .py files, install these packages:

pip install import-ipynb
pip install nbformat

Training models

  • Run train_ramp_model.ipynb to train the toy model.
  • Run train_mnist_multiple_models.ipynb to train the models for the MNIST task. This took about 48 hours on my GPU (NVIDIA GTX970). It trains a total of 30*8 = 240 models.

Models are saved in the ./saved_models_mnist_sets directory.

Experiments and figures

  • Run show_ramp_model_decision_boundaries.ipynb to create the relevant figures in the paper.
  • Run plot_null_image_examples.ipynb to create figures containing examples of the null image samples.
  • Run fgsm_mnist_model.ipynb to execute adversarial experiments on a single set of the MNIST models, and create figures with examples of the adversarial images and the performance of the models on those images. Additional figure like those of the paper are created, but are not used in the paper.
  • Run fgsm_mnist_multiple_models.ipynb to execute adversarial experiments on the MNIST models and create the figures in the paper. This will take some time, perhaps on the order of hours. Some addition figures--not used in the paper--are created as well.

Figures are saved in the ./figures directory.

null_class_adversarial_defense's People

Contributors

mattroos avatar

Watchers

 avatar paper2code - bot avatar

Forkers

ml-lab

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.