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

Cleverhans FGSM : classification accuracy is too high #1063

Closed
csesivakumar opened this issue Jun 5, 2019 · 5 comments
Closed

Cleverhans FGSM : classification accuracy is too high #1063

csesivakumar opened this issue Jun 5, 2019 · 5 comments

Comments

@csesivakumar
Copy link

What's going wrong with this code? I have generated adversarial images using cleverhans API - generate_np method. And using the default cleverhans CNN classifier to classify the images. The test accuracy is very low for adversarial images as expected when I use the model after generating the images. But if I save and reload the model, the accuracy is too high. Please check the code here. Is it really working?

https://github.com/csesivakumar/Adversarial_Defense/blob/master/Cleverhans_generatenp.ipynb

Python: 3.6

@npapernot
Copy link
Member

From your code it looks like you are initializing the model's weights, defining the tf session, etc... after having trained the model using Keras. My guess is that the adv_x array does not contain images that are adversarial. This would explain why the accuracy output by [22] is close to random---because the model weights are random. When you restore the model, its weights are set again to the values learned during training so the accuracy is restored (because the images are not adversarial).

@csesivakumar
Copy link
Author

Thanks Nicolas. Updated the code. Works fine now.

@hardwaresecuritylab
Copy link

Hi, Csesivakumar, I had the same issue as you. Can you tell me how did you fix the issue? Thanks!

@csesivakumar
Copy link
Author

csesivakumar commented Jun 6, 2019

Check out my updated code here. As Nicolas said, should not initialize the model weight after having trained the classification model. it will assign random weights for the model and FGSM will not generate proper adversarial images based on that model.

https://github.com/csesivakumar/Adversarial_Defense/blob/master/Cleverhans_generatenp.ipynb

@hardwaresecuritylab
Copy link

OK! Thank you very much!

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

3 participants