|
4 months ago | |
---|---|---|
LICENSE | 4 months ago | |
README.md | 4 months ago | |
adversarial_divnorm.yml | 4 months ago | |
attack_model_autoattack.py | 4 months ago | |
augment_data.py | 4 months ago | |
expt_def.py | 4 months ago | |
load_dataset.py | 4 months ago | |
model_defs.py | 4 months ago | |
test_model_corrupt_data.py | 4 months ago | |
train_model.py | 4 months ago | |
utils.py | 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