JunfengGo / AEVA-Blackbox-Backdoor-Detection-main

25 stars 4 forks source link

GAP calculation function return zero array #3

Closed verazuo closed 2 years ago

verazuo commented 2 years ago

https://github.com/JunfengGo/AEVA-Blackbox-Backdoor-Detection-main/blob/9e2fc44573f665097bd555abbc3ffb1ef06fee0c/outlier.py#L18-L38

Hi,

Thanks for sharing this wonderful work!

I am trying to reproduce the results. And I found the function def get_s(num_labels) which is used to calculate GAP value only returns a zero array because it has never been used after initialization. This would then causes the failure of the analomy(array) function.

Would you please check the code?

Best wishes, Vera

JunfengGo commented 2 years ago

Can you plz follow the implementation procedure described in the README.md. You should first generate the adversarial perturbations and then run analomy(array) function.

JunfengGo commented 2 years ago

python -u detect_main.py --sp 0 --ep 10 --cuda 0 --task cifar10

verazuo commented 2 years ago

Hi Junfeng,

Thank you for your response. Yes, I follow the instruction of the README.md and run the following commands.

python -u detect_main.py --sp 0 --ep 10 --cuda 0 --task cifar10

The adversarial perturbations are also generated and successfully loaded in outlier.py. What confuses me is that, if you look at the get_s() function I mentioned above, the return variable s has never been used after initialization (line 28). Though there is a loop that does some calculations, but the results are stored in the matrix variable coll. I am wondering if any lines are accidentally missed. Maybe a formula that would transfer the variable coll to s?

Best wishes, Vera

JunfengGo commented 2 years ago

Sorry for confusing you. You are right. I will update the corrected Code ASAP

JunfengGo commented 2 years ago

Thanks for your correction, i have updated by : adding s[i]+=v below. Plz see my updated code