-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Understanding FastGradientMethod usage and how to force output label to desired value #589
Comments
In case you prefer, or you like to level up on SO, I have also posted the question here: |
Q1:
Q2: y is used to specify labels in the case of an untargeted attack (any wrong class is considered as success for the adversary) whereas y_target is used to specify a target class in the targeted attack case (the adversary is successful only if the model makes a particular misclassification in a chosen class). It is often the case that targeted attacks require more perturbation (i.e., higher eps values in the FGSM case) than untargeted attacks. |
Thank you for the clarifications. I'll read the articles and I'll try also the |
I copied your answer to SO question. Regards |
Could you please provide the entire error traceback? Thanks. |
adv_x = fgsm.generate_np(x_validation, **fgsm_params) File "", line 1, in File "c:\users\maithal1\src\cleverhans\cleverhans\attacks\attack.py", line 186, in generate_np File "c:\users\maithal1\src\cleverhans\cleverhans\attacks\attack.py", line 158, in construct_graph File "c:\users\maithal1\src\cleverhans\cleverhans\attacks\fast_gradient_method.py", line 50, in generate File "c:\users\maithal1\src\cleverhans\cleverhans\attacks\attack.py", line 278, in get_or_guess_labels File "c:\users\maithal1\src\cleverhans\cleverhans\utils_keras.py", line 188, in get_probs File "c:\users\maithal1\src\cleverhans\cleverhans\utils_keras.py", line 249, in get_layer File "c:\users\maithal1\src\cleverhans\cleverhans\utils_keras.py", line 225, in fprop File "C:\Users\maithal1\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\keras\engine\training.py", line 113, in init File "C:\Users\maithal1\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\keras\engine\network.py", line 79, in init File "C:\Users\maithal1\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\training\checkpointable\base.py", line 364, in _method_wrapper File "C:\Users\maithal1\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\keras\engine\network.py", line 266, in _init_graph_network File "C:\Users\maithal1\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\keras\engine\network.py", line 379, in _track_layers File "C:\Users\maithal1\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\training\checkpointable\base.py", line 616, in _track_checkpointable TypeError: Checkpointable._track_checkpointable() passed type <class 'keras.engine.input_layer.InputLayer'>, not a Checkpointable. This is the entire error traceback. |
Did this help? |
Nope! I am getting the error. |
Could you please provide the training script so that I can try and reproduce the bug? |
http://everettsprojects.com/2018/01/30/mnist-adversarial-examples.html I am trying the exact same script and exact same method. |
I have a keras model (CNN with final softmax) that is an RGB image classifier that labels input images in 5 categories (one-hot encoded).
A simplified version of my code is the following:
Question 1
From my understanding, 'eps' is the input variation step (minimum change).
I have noticed that the final outcome is highly affected by eps, sometimes I need high eps in order to obtain an effective adversarial image (having an image O, with label lO sometimes FGM fails to produce adversarial image O' with lO'!= lO, e.g., for lO = [0,0,1,0,0] we still obtain lO' = [0,0,1,0,0], failing to generate an adversarial image with different label.
Does FGM always find out a working adversarial image? Is it normal that it fails? Is there a way to obtain an estimated quality of the generated adversarial image (without predicting with model)? Why is the eps step so important? Is there a way to tell FGM to try harder searching for the adversarial image(e.g, more steps)?
Question 2
I have also experimented y and y_target params. Can you also explain me what are the params
'y', 'y_target'
? I thought'y_target'
tells that we want to generate an adversarial image that targets a specific category. For example I thought thaty_target = [[0,1,0,0,0]]
infeed_dict
should force to generate an adversarial image which is classified with the 2th class from the model.Am I right?
..or do I miss something?
P.s: my problem is that setting
y_target
fails to produce adversarial images.please give me few tips..
Regards
The text was updated successfully, but these errors were encountered: