Replies: 1 comment 1 reply
-
Hi @MarcuXu What is the output of your model, probabilities or logits? I'll convert this issue into a discussion under the Discussions tab above to continue the discussion. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the bug
I hope to use the targeted carlini in UniversalPerturbation to generate noise, but the noise I get is just zeros arrays. Could you please help me with that?
To Reproduce
Steps to reproduce the behavior:
# build targeted UAP
classifier = KerasClassifier(model=model)
# print(type(model))
adv_crafter = UniversalPerturbation(
classifier,
attacker='carlini',
delta=1e-2,
attacker_params={'verbose': False, 'batch_size': 64,
'targeted': True,
'confidence': 5e-2, 'learning_rate': 5e-2, 'max_iter': 10, 'initial_const': 5e-2},
max_iter=20,
verbose=True,
# eps=5.5,
# Only 1, 2 ,
np.Inf
1.1 and 1.2 supported for now.norm=np.Inf,)
# set target label
target = 3
y_train_adv_tar = np.zeros(Y_train.shape)
for i in range(Y_train.shape[0]):
y_train_adv_tar[i, target] = 1
# generate noise
_ = adv_crafter.generate(X_train, y=y_train_adv_tar)
noise = adv_crafter.noise
print(noise)
# The upper codes work well when I use FGSM in TargetedUniversalPerturbation, so I think the logic of my codes could be right. Thus, I may forget or don't know how to generate the noise under carlini correctly.
Expected behavior
Get some noise which can be used to attack.
Screenshots
If applicable, add screenshots to help explain your problem.
System information (please complete the following information):
Beta Was this translation helpful? Give feedback.
All reactions