Git Product home page Git Product logo

fast_is_better_than_free_imagenet's Introduction

Fast Adversarial Training

This is a supplemental material containing the code to run Fast is better than free: revisiting adversarial training, submitted to ICLR 2020.

The framework used is a modified version of the Free Adversarial Training repository, which in turn was adapted from the official PyTorch repository.

Installation

  1. Install PyTorch.
  2. Install the required python packages. All packages can be installed by running the following command:
pip install -r requirements.txt
  1. Download and prepare the ImageNet dataset. You can use this script, provided by the PyTorch repository, to move the validation subset to the labeled subfolders.
  2. Prepare resized versions of the ImageNet dataset, you can use resize.py provided in this repository.
  3. Install Apex to use half precision speedup.

Training a model

Scripts to robustly train an ImageNet classifier for epsilon radii of 2/255 and 4/255 are provided in run_fast_2px.sh and run_fast_4px.sh. These run the main code module main_free.py using the configurations provided in the configs/ folder. To run the 50 step PGD adversary with 10 restarts, we also provide run_eval.sh. All parameters can be modified by adjusting the configuration files in the configs/ folder.

Model weights

We also provide the model weights after training with these scripts, which can be found in this Google drive folder. To use these with the provided evaluation script, either adjust the path to the model weights in the run_eval.sh script or rename the provided model weights accordingly.

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.