# Morphing Backdoor Attack

Implementation of the paper in Pytorch:

- Training and evaluation code
- Defenses experiments uses in the paper (Upcoming)

## Requirements
* Install required python packages

```bash
$ pip install -r requirements.txt
```
* Download and organize GTSRB data from its official website:
```bash
$ bash gtsrb_download.sh
```

## Training code 
Run command
Run command
```bash
$ python train.py --dataset <datasetName> --s <scale> --k <grid_size> (--continue_training)
```

Where the parameters are the following:
- `<datasetName>`: `mnist`|`cifar10`|`gtsrb`

The trained model would be saved at the path: `./checkpoints/k_<grid_size>/s_<scale>/<datasetName>`

## Pretrained models
The pretrained `all2one` model with scale s = 0.5 and grid size k = 4 in our papers are saved in folder `pretrained_checkpoints`. Just rename that folder to `checkpoints` to use these models.





