lvpeizhuo / Data-free_Backdoor

This is the source code for Data-free Backdoor. Our paper is accepted by the 32nd USENIX Security Symposium (USENIX Security 2023).
MIT License
27 stars 3 forks source link

Runing Error #2

Open hustweiwan opened 11 months ago

hustweiwan commented 11 months ago

Hello, author. When I ran "python poison_model.py," I encountered the following error. Later, I tried running the code without data conversion (lines 105-106) and commenting out lines 74-77, and the code ran successfully. However, the final task accuracy is only around 50%, and the backdoor accuracy is also only about 70%. I need your assistance. image 1O(S5WYOC4@~AT2~Y7I4(XX

lvpeizhuo commented 11 months ago

We generate the backdoored model with good performance on the main task and the backdoor task by training with more epochs (not only 100 epochs). We will train the backdoored model by 1000 epochs, and save a checkpoint by 100 epochs. Then we continue to inject t the backdoor based on the previous saved checkpoint. Specifically, in each 100 epochs, we need to adjust the value of poison_rate. And the value is 0.01(0-100 epoch), 0.01(100-200 epoch), 0.001(200-1000 epoch). Thus, you can obtain a backdoored model with an ASR above 90% and an accuracy of 88%. You can also try other values of poison_rate and learning rate to obtain better performance.