Giter VIP home page Giter VIP logo

freeadversarialtraining's Introduction

FreeAdversarialTraining

This repo contains the PyTorch implementation of the paper 'Adversarial Training for Free!'

In this work, we train and evaluate the ResNet-50 model on the Intel Image Classification dataset, which can be found here.

In order to run the notebook locally, make sure to meet the following library requirements:

  • tqdm
  • gdown
  • torch

You can install them through:

pip install -U tqdm gdown

Refer to the PyTorch website for local installation of PyTorch.

Talking about our work, we first train our model through a simple PyTorch training loop and afterwards using the Free Adversarial training algorithm proposed in the paper, shown below:

===================================================================

==================================================================

The main point and goal of this algorithm is building a model which is robust to PGD-attacks, but that at the same time is cheap and fast to train (7 to 30 times faster than other strong adversarial training methods).

Later on, we validate both models using the PyTorch's common validation loop and finally on PGD-7/-10/-20/-40 attacks.

Results, as requested, can be seen at the very bottom of the .ipynb notebook file.

In order to quickly validate the best models without having to re-run the training loop, we do provide two pre-trained models in order to replicate the final results:

  • ResNet50 with Intel Image Classification trained with Free Adversarial Training m = 2 : Link (~180 MB)
  • ResNet50 with Intel Image Classification trained with Free Adversarial Training m = 3 : Link (~180 MB)
  • ResNet50 with Intel Image Classification trained with Free Adversarial Training m = 5 : Link (~180 MB)
  • ResNet50 with Intel Image Classification trained with standard PyTorch Training: Link (~180 MB)

For testing, simply go to the "Validation (for testing purposes)" section in the notebook file, load the model downloaded earlier and run the validation cell with the desired K-value for PGD attack.

freeadversarialtraining's People

Contributors

d-dolo avatar slimshadys avatar

Watchers

 avatar  avatar

Forkers

d-dolo

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.