Giter Club home page Giter Club logo

adversarialanddimensionality's Introduction

First-order adversarial vulnerability of neural networks and input dimension: Code and Supplements

This repository contains code to accompany the ICML 2019 paper First-order adversarial vulnerability of neural networks and input dimension.

Packages

Special packages used:

  • pytorch (tested on 1.0.0)
  • foolbox (tested on 2.0.0)
  • configargparse

Quick-start

  • Train a net with default configuration and compute its vulnerability:
    python main.py
  • Train a net on CIFAR10 with PGD and compute its vulnerability, with simililar settings than Section 4.1:
    python main.py --config configs/config_cifar_pgd.txt
  • Train a net on upsampled CIFAR10 (bCIFAR10) and compute its vulnerability, with similar settings than Section 4.2:
    python main.py --config configs/config_bcifar.txt
  • Any parameter from the config file can be overwritten from the command line, as in:
    python main.py --config configs/config_bcifar.txt --img_size 64 --log_step 10

See files in configs/ for other typical experiment settings/arguments.

Remark:

The experiments in Section 4.2 actually do not use the vulnerabilities contained in the vulnerability_XX.pt files (computed using the compute_vulnerability function from vulnerability.py). Instead, they use the test-set vulnerabilities contained in state['logs'] of the file last.pt (and computed using our custom pgd implementation from penalties.py), averaged over the 20 last training epochs.

Datasets

The code was implemented for 3 datasets:

  • MNIST
  • CIFAR10 (and upsampled CIFAR10, see paper Sec 4.2)
  • a custom 12-class mini-ImageNet dataset (see below & paper Sec 4.2).

Getting our custom 12-class Mini-ImageNet Dataset

The custom mini-ImageNet was constructed by merging some similar classes together from the usual ImageNet dataset (for example all the dogs). If the resulting class got too big (e.g. the dog-class), we sampled a random subset of it. The 12 classes obtained were:

ball - car - cat - dog - elephant - fish - monkey - plane - ship - string-instrument - truck - wind-instrument

The list of images used in each class can be found in the imgnet12/ folder. To use our mini-imagenet dataloader, create a folder named imgnet12/train/ (resp. imgnet12/val/), with 12 subfolders (1 per class; name irrelevant) containing the images listed in train.txt (resp. val.txt).

License

This source code is released under a Attribution-NonCommercial 4.0 International license, find out more about it here.

adversarialanddimensionality's People

Watchers

 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.