Code to evaluate the adversarial defense provided by the Symmetric Divisive Normalisation activation function
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mwspratling 9c992030c5 under development 4 months ago
LICENSE under development 4 months ago
README.md under development 4 months ago
adversarial_divnorm.yml under development 4 months ago
attack_model_autoattack.py under development 4 months ago
augment_data.py under development 4 months ago
expt_def.py under development 4 months ago
load_dataset.py under development 4 months ago
model_defs.py under development 4 months ago
test_model_corrupt_data.py under development 4 months ago
train_model.py under development 4 months ago
utils.py under development 4 months ago

README.md

This code implements the methods described in:

M. W. Spratling, Adversarial robustness and improved out-of-distribution generalisation through changes to the activation and loss functions of CNNs.

Please cite this paper if this code is used in, or to motivate, any publications.


INSTALLATION


This code was tested with python 3.8.5 and pytorch 1.7.0 running on a CPU under Ubuntu Linux version 22.04.1, and with python 3.10.4 and pytorch 1.12.1 running on a GPU under Ubuntu Linux version 20.04.5. To set up an appropriate python environment using anaconda execute the following at the command line (you may need to modify the yml file to install the cuda or cpu version of pytorch depending on your hardware setup):

conda env create --file adversarial_divnorm.yml
conda activate adversarial_divnorm

USAGE


To train and evaluate a network first edit the file "expt_def.py" in order to define the network architecture, the dataset, the loss function, the activation function, and the training data augmentation method to be used in the experiment you wish to perform. Then execute the following at the command line:

python train_model.py 
python test_model_corrupt_data.py
python attack_model_autoattack.py