Code for our paper: "You Only Propagate Once: Painless Adversarial Training Using Maximal Principle" by Dinghuai Zhang, Tianyuan Zhang, Yiping Lu, Zhanxing Zhu, Bin Dong.
- Pytorch==1.0.1, torchvision
- Python 3.5
- tensorboardX
- easydict
- tqdm
git clone https://github.com/a1600012888/YOPO-You-Only-Propagate-Once.git
cd YOPO-You-Only-Propagate-Once
pip3 install -r requirements.txt --user
- normal training:
experiments/CIFAR10/wide34.natural
- PGD adversarial training:
experiments/CIFAR10/wide34.pgd10
runpython 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.
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