SCLBD/BackdoorBench

How to implement 'all-to-all' attack settings?

Closed this issue ยท 2 comments

Many thanks for your excellent work! ๐Ÿ˜

Now I have a question. When I used the following setting in Blended Attack.

attack_label_trans: all2all
attack_label_shift_amount: 1
num_classses: 10

But I ran into the following error.

Traceback (most recent call last):
  File "./attack/laser_attack.py", line 347, in <module>
    main()
  File "./attack/laser_attack.py", line 212, in main
    adv_train_ds = prepro_cls_DatasetBD(
  File "./backdoorbench/attack/../utils/bd_dataset.py", line 63, in __init__
    assert len(poison_idx) == len(full_dataset_without_transform)
AssertionError

Did I do something wrong? Looking forward to your reply.

  1. I am sorry to say that, for the all-to-all attack, we only have done the basic implementation early in the bd_attack_generate.py file. We haven't done a comprehensive compatibility test for every attack method. So you may meet a problem with some attack methods.
  2. I tried your setting in the blended attack. What I have done is replace the corresponding hyper-parameters in the YAML file. But I do not meet your problem. And I see that in your traceback information, it shows you are using the "./attack/laser_attack.py" script, so I am not sure how the problem comes. If you can offer more about your script, I can help you more.

I run 'all-to-all' settings by commenting out 'attack_target'.

I'm sorry I disturbed you. ๐Ÿ˜ฃ

amp: False
device: cuda:0
attack_label_trans: all2all
# attack_target: 0
attack_label_shift_amount: 1
num_classses: 10