Giter Site home page Giter Site logo

originofamonia / adversarial-training-for-free Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alanchou/adversarial-training-for-free

0.0 1.0 0.0 207 KB

Unofficial implementation of the paper 'Adversarial Training for Free'

Python 100.00%

adversarial-training-for-free's Introduction

Adversarial Training for Free

I found this is the only working adv training version.

This is an unofficial PyTorch implementation of the paper "Adversarial Training for Free!".
https://128.84.21.199/pdf/1904.12843.pdf
It's a really helpful technique which can significantly accelerate adversarial training.
It only contains the code for adversarial training on CIFAR-10. However, one can easily modify it for other datasets.

I've noticed that in the cleverhans repo, they have an attribute called BACKPROP_THROUGH_ATTACK which is exactly the same idea behind this paper.

Overview

This repository contains two files. One for adversarial training and one for testing. Note that the model used here is not WideResNet 32-10 which is used in the paper 'Adversarial Training for Free'. I use WideResNet 28-10 which is used in the original PGD paper. Be aware that some of the hyperparameters are slightly different from the paper (weight decay and learning rate scheduling)

Accuracy (under PGD attack: epsilon = 8, step size = 2, iteration = 100)

Model Acc
[ WideResNet 28-10 ] 46.93%

I did not test every epoch's checkpoint. I simply chose from one of the last epochs to test. Results might be slightly different. I've also released the checkpoint in the below Google Drive link)
I have trouble training with ResNet56 and ResNet20 to the baseline they supposed to have which may suggest that this method does not apply to any given models. Please don't hesitate to share your results if you know how to fix this. checkpoint Google Drive

Dependencies

The repository is based on Python 3.5, with the main dependencies being PyTorch==1.0.0 Additional dependencies for running experiments are: numpy, tqdm, argparse, os, random, advertorch.

Advertorch can be installed from https://github.com/BorealisAI/advertorch
Run the code with the command:

$ CUDA_VISIBLE_DEVICES=0 python3 main.py 

adversarial-training-for-free's People

Contributors

alanchou avatar originofamonia avatar

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.