defense.dbd

class dbd[source]

Bases: defense

Backdoor Defense Via Decoupling The Training Process

basic structure:

  1. config args, save_path, fix random seed

  2. load the backdoor attack data and backdoor test data

  3. dbd defense:
    1. self-supervised learning generates feature extractor

    2. learning model using extracted features

    3. the samples with poor confidence were excluded, and semi-supervised learning was used to continue the learning model

  4. test the result and get ASR, ACC, RC with regard to the chosen threshold and interval

parser = argparse.ArgumentParser(description=sys.argv[0])
dbd.add_arguments(parser)
args = parser.parse_args()
dbd_method = dbd(args)
if "result_file" not in args.__dict__:
    args.result_file = 'one_epochs_debug_badnet_attack'
elif args.result_file is None:
    args.result_file = 'one_epochs_debug_badnet_attack'
result = dbd_method.defense(args.result_file)

Note

@article{huang2022backdoor, title={Backdoor defense via decoupling the training process}, author={Huang, Kunzhe and Li, Yiming and Wu, Baoyuan and Qin, Zhan and Ren, Kui}, journal={arXiv preprint arXiv:2202.03423}, year={2022}}

Parameters:
  • args (baisc) – in the base class

  • epoch_self (int) – the epoch of warmup during the self-supervised learning

  • batch_size_self (int) – the batch size of self-supervised learning

  • temperature (float) – the temperature in the loss function of self-supervised learning

  • epsilon (float) – the threshold of the presuppossed ratio of the backdoor data to separate the poisoned data in the semi-supervised learning (please be careful to choose the threshold)

  • epoch_warmup (int) – the epoch of warmup during the semi-supervised learning

  • config_pretrain (str) – the path of the config file of the self-supervised learning

  • config_semi (str) – the path of the config file of the semi-supervised learning