attack.CTRL

class CTRL[source]

Bases: BadNet

An Embarrassingly Simple Backdoor Attack on Self-supervised Learning

basic structure:

  1. config args, save_path, fix random seed

  2. set the clean train data and clean test data

  3. set the attack img transform and label transform

  4. set the backdoor attack data and backdoor test data

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

  6. attack or use the model to do finetune with 5% clean data

  7. save the attack result for defense

attack = ctrl()
attack.attack()

Note

@InProceedings{Li_2023_ICCV, author = {Li, Changjiang and Pang, Ren and Xi, Zhaohan and Du, Tianyu and Ji, Shouling and Yao, Yuan and Wang, Ting}, title = {An Embarrassingly Simple Backdoor Attack on Self-supervised Learning}, booktitle = {Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)}, month = {October}, year = {2023}, pages = {4367-4378}}

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

  • use_dct (bool) – use dct in trigger generation or not

  • use_yuv (bool) – transform into yuv space in trigger generation or not

  • trigger_channels (int) – which channel(s) you want to do trigger injection

  • add_patch_info (int) – (x,y,width,height,magnitude,mode)

  • add_patch_info_train (int) – (x,y,width,height,magnitude,mode) used only if you want nonsymmetric trigger injection in train and test

  • add_patch_info_test (int) – (x,y,width,height,magnitude,mode) used only if you want nonsymmetric trigger injection in train and test

  • **kwargs (optional) – Additional attributes.