Official Implementation for Paper "Backdoor for Debias: Mitigating Model Bias with Backdoor Attack-based Artificial Bias"
- Shangxi Wu (Beijing Institute of Technology)
- Qiuyang He (Beijing Institute of Technology)
- Jian Yu (Beijing Institute of Technology)
- Jitao Sang (Beijing Institute of Technology)
@article{wu2024backdoor,
title={Backdoor for Debias: Mitigating Model Bias with Backdoor Attack-based Artificial Bias},
author={Wu, Shangxi and He, Qiuyang and Yu, Jian and Sang, Jitao},
journal={arXiv preprint arXiv:2303.01504},
year={2024}
}- Python 3.7+
- TensorFlow 2.10+
- TensorFlow Datasets
- NumPy
- tqdm
- pickle
bashpip install tensorflow tensorflow-datasets numpy tqdm
- Automatic download via TensorFlow Datasets:
pythontrain_data = tfds.load('celeb_a', split='train', batch_size=256) test_data = tfds.load('celeb_a', split='test', batch_size=256)
- Preprocessing includes:
- Image normalization:
(img / 255 - 0.5) * 2 - Bias matrix calculation
- Trigger patch generation
| Parameter | Description | Example Values |
|---|---|---|
BIAS |
Protected attribute | 'Male', 'Young' |
KEY_WORDS |
Target classification attribute | 'Attractive', 'Gray_Hair' |
EPOCHS |
Training iterations | 5-20 |
- Model checkpoints:
result/{KEY_WORDS}/model_[epoch].ckpt - Metrics recording:
result/{KEY_WORDS}/pic_result.pic - Evaluation logs:
result/{KEY_WORDS}/log.txt
Distributed under MIT License.