Reverse Cross Entropy Training (RCE) is a novel training method, which can learn more distinguished feature representations for detecting adversarial examples. Technical details are specified in:
Towards Robust Detection of Adversarial Examples (NeurIPS 2018)
Tianyu Pang, Chao Du, Yinpeng Dong and Jun Zhu
We provide codes for training ResNet on MNIST and CIFAR-10. Our codes are based on Tensorflow.
Prerequisite:
How to run:
An example of using RCE to train a ResNet-32 on MNIST:
python train.py --train_data_path='mnist_dataset/data_train.bin' \
--log_root=models_mnist/resnet32 \
--train_dir=models_mnist/resnet32/train \
--dataset='mnist' \
--num_gpus=1 \
--num_residual_units=5 \
--mode=train \
--Optimizer='mom' \
--total_steps=20000 \
--RCE_train=True
An example of test trained ResNet-32 in the normal setting (test set) on MNIST:
python test_nor.py --eval_data_path='mnist_dataset/data_test.bin' \
--log_root=models_mnist/resnet32 \
--eval_dir=models_mnist/resnet32/eval \
--dataset='mnist' \
--num_gpus=1 \
--num_residual_units=5 \
--mode=eval \
--RCE_train=True