This project is developed with Python 3.6 on Ubuntu 18.04. Please run the following script to install the required packages
pip install -r requirements.txt
Before running the code, please download the checkpoints from Baidudisk (code:o89z), and put them into ckpt
folder.
Generating poisoned sample with sample-specific trigger.
# TensorFlow
python encode_image.py \
--model_path=ckpt/encoder_imagenet \
--image_path=data/imagenet/org/n01770393_12386.JPEG \
--out_dir=data/imagenet/bd/
Benign image | Backdoor image | Trigger |
Runing test.py
for testing benign and poisoned images.
# PyTorch
python test.py
datasets/
.bash train.sh
.The files in checkpoint folder are as following:
--- args.json # Input arguments
|-- x_checkpoint.pth.tar # checkpoint
|-- x_model_best.pth.tar # best checkpoint
|-- x.txt # log file
Check BackdoorBench for details
Please cite our paper in your publications if it helps your research:
@inproceedings{li_ISSBA_2021,
title={Invisible Backdoor Attack with Sample-Specific Triggers},
author={Li, Yuezun and Li, Yiming and Wu, Baoyuan and Li, Longkang and He, Ran and Lyu, Siwei},
booktitle={IEEE International Conference on Computer Vision (ICCV)},
year={2021}
}
This repository is NOT for commecial use. It is provided "as it is" and we are not responsible for any subsequence of using this code.