dongyp13 / RCE

Reverse Cross Entropy Training

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reverse Cross Entropy Training

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

Training

We provide codes for training ResNet on MNIST and CIFAR-10. Our codes are based on Tensorflow.

Prerequisite:

  1. Install TensorFlow 1.9.0.

  2. Download MNIST/CIFAR-10 dataset.

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

Test in the Normal Setting

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

About

Reverse Cross Entropy Training

License:Apache License 2.0


Languages

Language:Python 100.0%