fra31 / auto-attack

Code relative to "Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks"
https://arxiv.org/abs/2003.01690
MIT License
661 stars 113 forks source link

A Bug in Square Attack #81

Closed GuanlinLee closed 2 years ago

GuanlinLee commented 2 years ago

In Square Attack, if the input x all misclassified by the model at the beginning, the algorithm will fail with an CUDA ERROR. Just add a simple line before the next step if idx_to_fool.nelement() == 0: return n_queries, x_best in function attack_single_run() before further computation. Although it is a very uncommon case that all images in a batch are not correctly classified, it can happen when the batch size is small. I think it can take place in the original Square Attack as well.

ScarlettChan commented 2 years ago

您好,您的邮件已收到!

fra31 commented 2 years ago

Hi,

thanks for letting me know! I'll integrate your suggestion as soon as possible.

fra31 commented 2 years ago

It should be fixed with https://github.com/fra31/auto-attack/commit/29739b7ef65ae38c2963823800125e732f1b48d3, please let me know if it looks good to you. If I'm not missing something, it should be triggered when all images in the batch are misclassified after applying the initialization.

GuanlinLee commented 2 years ago

Yes. I think it should be alright now. Thanks for your excellent work!