This repository contains the implementation code for "Local Competition and Stochasticity for Adversarial Robustness".
We consider the PGD, CW, BSA, additive uniform noise attacks, while we evaluate the confidence of the predictions of the model to a randomly constructed input. See the paper Error Correcting Output Codes Improve Probability Estimation and Adversarial Robustness of Deep Neural Networks for an analysis of the considered architectures for both standard and ensemble models.
Use the provided yaml file to create a conda environment
conda env create -f adver_lwta.yml
Additionally install the bleeding edge version of the cleverhans package via
pip install git+https://github.com/tensorflow/cleverhans.git#egg=cleverhans
To train a model or multiple models, modify the train_model_auto.py file, thats is set the respective if statements for each model to True and run
python train_model_auto.py
To attack the trained models use
python attack_model_auto.py