Adversarial Defense by Restricting the Hidden Space of Deep Neural Networks (ICCV'19)
This repository is an PyTorch implementation of the ICCV'19 paper Adversarial Defense by Restricting the Hidden Space of Deep Neural Networks.
To counter adversarial attacks, we propose Prototype Conformity Loss to class-wise disentangle intermediate features of a deep network. From the figure, it can be observed that the main reason for the existence of such adversarial samples is the close proximity of learnt features in the latent feature space.
We provide scripts for reproducing the results from our paper.
Clone this repository into any place you want.
git clone https://github.com/aamir-mustafa/pcl-adversarial-defense
cd pcl-adversarial-defense
To expedite the process of forming clusters for our proposed loss, we initially train the model using cross-entropy loss.
softmax_training.py
-- ( For initial softmax training).
- The trained checkpoints will be saved in
Models_Softmax
folder.
The deep features for the prototype conformity loss are extracted from different intermediate layers using auxiliary branches, which map the features to a lower dimensional output as shown in the following figure.
pcl_training.py
-- ( Joint supervision with cross-entropy and our loss).
- The trained checkpoints will be saved in
Models_PCL
folder.
pcl_training_adversarial_fgsm.py
-- ( Adversarial Training using FGSM Attack).
pcl_training_adversarial_pgd.py
-- ( Adversarial Training using PGD Attack).
robustness.py
-- (Evaluate trained model's robustness against various types of attacks).
Retained classification accuracy of the model's under various types of adversarial attacks:
Training Scheme | No Attack | FGSM | BIM | MIM | PGD |
---|---|---|---|---|---|
Softmax | 92.15 | 21.48 | 0.01 | 0.02 | 0.00 |
Ours | 89.55 | 55.76 | 39.75 | 36.44 | 31.10 |
@InProceedings{Mustafa_2019_ICCV,
author = {Mustafa, Aamir and Khan, Salman and Hayat, Munawar and Goecke, Roland and Shen, Jianbing and Shao, Ling},
title = {Adversarial Defense by Restricting the Hidden Space of Deep Neural Networks},
booktitle = {The IEEE International Conference on Computer Vision (ICCV)},
month = {October},
year = {2019}
}