Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linf norm attack #4

Open
jimo17 opened this issue Aug 1, 2022 · 5 comments
Open

linf norm attack #4

jimo17 opened this issue Aug 1, 2022 · 5 comments

Comments

@jimo17
Copy link

jimo17 commented Aug 1, 2022

Hi and thanks for open source. I am very interested in your paper. I have a question. If I want to make PPBA perform linf norm attack, how do I need to modify the code?

@theFool32
Copy link
Owner

Thanks for your interest. Please kindly refer to

PPBA/gcv.py

Line 88 in 9db2e7d

.clamp(-16 / 255, 16 / 255) # Norm constraint

which is an example of performing the linf norm attack with 16. You should also remove the code for l2 norm like

PPBA/main.py

Line 121 in 9db2e7d

uz = uz * np.minimum(1, 5 / uz_l2).reshape(-1, 1)

@jimo17
Copy link
Author

jimo17 commented Aug 1, 2022

Thanks a lot for your answer. The l2 norm in your code is used directly on uz. Can the linf norm be used directly on uz as well?
For example, when the linf norm is 16:
uz=uz.clamp(-16 / 255, 16 / 255)

@theFool32
Copy link
Owner

Actually, no.
Multiplying with the projection matrix does not change the l2 norm of uz. So it is the same to restrict on uz or the final noise.
But it is different for linf norm

@theFool32
Copy link
Owner

$$|\delta|_2 = |A^Tz|_2 = tr((A^T z)^TA^T z) = tr(z^TAA^T z) = tr(z^Tz) = |z|_2 $$

@jimo17
Copy link
Author

jimo17 commented Aug 1, 2022

I see.Thank you very much for your answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants