This is the source code of DBIA: Data-free Backdoor Injection Attack against Transformer Networks https://arxiv.org/pdf/2111.11870.pdf
Moreover, we refer to the released code of DeiT, which is from https://github.com/facebookresearch/deit
- PyTorch 1.7.0+ and torchvision 0.8.1+ and pytorch-image-models 0.3.2
- Imagenet2012 validation set data is placed in
./data/imagenet2012/val
- Generate the background picture required for training trigger
python preprocess.py
- Background picture and
blend_ tensor.pt
is stored in./savedfigure
- First, write the path of
blend_tensor.pt
on line 38 of the fileactivate_trigger.py
python activate_trigger.py
- Trigger pictures are stored in the triggers folder
- First, write the path of the selected trigger on line 35 of the file
tensors_dataset.py
python backdoor_main.py
- If it helps you, you can cite our paper as below:
@article{lv2021dbia, title={Dbia: Data-free backdoor injection attack against transformer networks}, author={Lv, Peizhuo and Ma, Hualong and Zhou, Jiachen and Liang, Ruigang and Chen, Kai and Zhang, Shengzhi and Yang, Yunfei}, journal={arXiv preprint arXiv:2111.11870}, year={2021} }