# Self-Supervised Adversarial Example Detection by Disentangled Representation

This repository is the official implementation of [Self-Supervised Adversarial Example Detection by Disentangled Representation]. 

## Requirements

To install requirements:

```setup
pip install -r requirements.txt
```

## Victim model

To train victim model:

```
Get_Test_Model.py
```

>📋  you could change dataset and victim model by commenting directly on the code.

>📋  you could download Fashion-MNIST from its official website.

## Adversarial examples

To get adversarial examples which will be used in training detection models:

```
Get_Test_AdvE.py
```

## Detectors

To train and test each detection models mentioned in paper:

```
Get_Detector.py
```


## Plot

To plot box-plot, ROC and reconstructed image:

```
plot_detectPic.py
```

## Adapt attack

To evaluate the performance of our detector under white-box setting:

```
adapt_attack.py: 
```

