attack.InputAware

class InputAware[source]

Bases: BadNet

Input-aware dynamic backdoor attack

basic sturcture:
  1. config args, save_path, fix random seed

  2. set the device, model, criterion, optimizer, training schedule.

  3. set the clean train data and clean test data

  4. clean train 25 epochs

  5. training with backdoor modification simultaneously

  6. save attack result

attack = InputAware()
attack.attack()

Note

@article{nguyen2020input, title={Input-aware dynamic backdoor attack}, author={Nguyen, Tuan Anh and Tran, Anh}, journal={Advances in Neural Information Processing Systems}, volume={33}, pages={3454–3464}, year={2020}}

Parameters:
  • attack (string) – name of attack, use to match the transform and set the saving prefix of path.

  • attack_target (Int) – target class No. in all2one attack

  • attack_label_trans (str) – which type of label modification in backdoor attack

  • pratio (float) – the poison rate

  • bd_yaml_path (string) – path for yaml file provide additional default attributes

  • lr_G (float) – learning rate for generator

  • lr_C (float) – learning rate for classifier

  • lr_M (float) – learning rate for mask

  • C_lr_scheduler (string) – learning rate scheduler for classifier

  • schedulerG_milestones (list) – learning rate scheduler milestones for generator

  • schedulerC_milestones (list) – learning rate scheduler milestones for classifier

  • schedulerM_milestones (list) – learning rate scheduler milestones for mask

  • schedulerG_lambda (float) – learning rate scheduler lambda for generator

  • schedulerC_lambda (float) – learning rate scheduler lambda for classifier

  • schedulerM_lambda (float) – learning rate scheduler lambda for mask

  • lambda_div (float) – lambda_div for diversity loss function

  • lambda_norm (float) – lambda_norm for norm loss function

  • mask_density (float) – mask_density for loss function, restrict the mask density

  • EPSILON (float) – EPSILON for loss function, avoid the denominator to be zero

  • clean_train_epochs (int) – clean_train_epochs for training epochs before backdoor attack

  • **kwargs (optional) – Additional attributes.