Skip to content

Code for our nips19 paper: You Only Propagate Once: Accelerating Adversarial Training Via Maximal Principle

Notifications You must be signed in to change notification settings

aspnetcs/YOPO-You-Only-Propagate-Once

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YOPO (You Only Propagate Once: Accelerating Adversarial Training via Maximal Principle)

Code for our paper: "You Only Propagate Once: Accelerating Adversarial Training via Maximal Principle" by Dinghuai Zhang, Tianyuan Zhang, Yiping Lu, Zhanxing Zhu, Bin Dong.

Our paper has been accepted by NeurIPS2019.

The Pipeline of YOPO

Prerequisites

  • Pytorch==1.0.1, torchvision
  • Python 3.5
  • tensorboardX
  • easydict
  • tqdm

Intall

git clone https://github.com/a1600012888/YOPO-You-Only-Propagate-Once.git
cd YOPO-You-Only-Propagate-Once
pip3 install -r requirements.txt --user

How to run our code

Natural training and PGD training

  • normal training: experiments/CIFAR10/wide34.natural
  • PGD adversarial training: experiments/CIFAR10/wide34.pgd10 run python train.py -d <whcih_gpu>

You can change all the hyper-parameters in config.py. And change network in network.py Actually code in above mentioned director is very flexible and can be easiliy modified. It can be used as a template.

YOPO training

Go to directory experiments/CIFAR10/wide34.yopo-5-3 run python train.py -d <whcih_gpu>

You can change all the hyper-parameters in config.py. And change network in network.py Runing this code for the first time will dowload the dataset in ./experiments/CIFAR10/data/, you can modify the path in dataset.py

Miscellaneous

A C++ implementation by Nitin Shyamkumar is provided here! Thank you Nitin for your work!

The mainbody of experiments/CIFAR10-TRADES/baseline.res-pre18.TRADES.10step is written according to TRADES official repo

A tensorflow implementation provided by Runtian Zhai is provided here. The implemetation of the "For Free" paper is also included. It turns out that our YOPO is faster than "For Free" (detailed results will come soon). Thanks for Runtian's help!

Cite

@article{zhang2019you,
  title={You Only Propagate Once: Accelerating Adversarial Training via Maximal Principle},
  author={Zhang, Dinghuai and Zhang, Tianyuan and Lu, Yiping and Zhu, Zhanxing and Dong, Bin},
  journal={arXiv preprint arXiv:1905.00877},
  year={2019}
}

About

Code for our nips19 paper: You Only Propagate Once: Accelerating Adversarial Training Via Maximal Principle

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%