Questions tagged [cleverhans]

CleverHans is a Python library to benchmark machine learning systems' vulnerability to adversarial examples.

CleverHans is built on top of .

Resources

49 questions
3
votes
1 answer

Receiving Assertion failed While generate adversarial samples by any methods

I am receiving following error while generating adversarial examples by any method InvalidArgumentError: assertion failed: [] [Condition x <= y did not hold element-wise:x (Placeholder_173:0) = ] [[[[158 112 49]]]...] [y (Cast_6:0) = ] [1] …
Hassan
  • 31
  • 1
2
votes
0 answers

Using master branch of cleverhans with TF2.2

In the pull requests, I see that master branch has code which works with TF2. I am looking into how to use them. I use a conda env with python 3.7.7 and tf 2.2. Then I pulled master branch from gihub celverhans. But, when I try to run…
v-i-s-h
  • 448
  • 1
  • 3
  • 12
2
votes
1 answer

How to apply a Cleverhans attack when the final layer is not `softmax` (e.g. ensemble models)?

I am trying to attack an ensemble of Keras models following the method proposed in this paper. In section 5, they note that the attack is of the form: So, I moved on to create an ensemble of pretrained Keras MNIST models as follows: def…
alpaca
  • 1,211
  • 13
  • 23
1
vote
1 answer

Can not install cleverhans version 3.1.0

I am trying to install cleverhans verion 3.1.0 but getting following error pip install cleverhans==3.1.0 Note: you may need to restart the kernel to use updated packages. ERROR: Could not find a version that satisfies the requirement…
Mohini
  • 15
  • 1
  • 3
1
vote
0 answers

Problems installing / using CleverHans library

I try to install or use the cleverhans library with tensorflow but it fails. (Cleverhans 3.0.1) I tried TF 1.12, 1.13, 1.15, 2.0, 2.3.1 but everytime another error occured when using the tutorial code. For example: TF 2.3.1 --> module 'tensorflow'…
manuel
  • 1,127
  • 1
  • 8
  • 15
1
vote
0 answers

gradient of each output with respect to input - logits or softmax output?

I have an image classifier with 2 outputs. I'm trying to check the most important pixels in the image which if perturbed may impact the model output (pixel that has most influence on model output). My last layer is as as follows: model.add(Dense(2,…
ml-user
  • 11
  • 1
1
vote
1 answer

Cleverhans load pre-trained model

Is there a way to load a pre-trained model. I have tried the load("model.joblib") and save("model.joblib", model) functions but the loaded model only ha about 10% accuracy on the validation data, and successfully generates about 10% successful…
Trent Wall
  • 11
  • 2
1
vote
1 answer

Resnet-50 adversarial training with cleverhans FGSM accuracy stuck at 5%

I am facing a strange problem when adversarially training a resnet-50, and I am not sure whether is's a logical error, or a bug somewhere in the code/libraries. I am adversarially training a resnet-50 thats loaded from Keras, using the…
PlassMa
  • 11
  • 3
1
vote
0 answers

Error when implementing FGSM in Keras with Cleverhans

I'm trying to generate adversarial examples using the Cleverhans (FGSM) tutorials with Keras, but so far I have been unsuccessful. I'm using a the keras generator functionality to retrieve dataset images.(Python 3.7) I'm fairly new at working with…
David
  • 61
  • 1
  • 4
1
vote
1 answer

How to fix ‘You must feed a value for placeholder tensor 'Placeholder_2' with dtype float and shape [?,1,680,1]’ error in Python?

I have a problem running a modified code in the Cleverhans library. I'm trying to run a modified version of mnist_blackbox.py example. The inputs are 3*680*1 instead of 28*28*1. The x_adv_sub is a 1*680*1 tensor and are combined with x_test_rest_tf…
1
vote
1 answer

Shape rank mismatch when activating FGSM on Keras ResNet

I am trying to activate an FGSM with a ResNet 50 with keras, but get an error: ValueError: Shape must be rank 4 but is rank 5 for 'model_1/conv1_pad/Pad' (op: 'Pad') with input shapes: [2,1,224,224,3], [4,2]. My code is: from…
Shamoon
  • 41,293
  • 91
  • 306
  • 570
1
vote
2 answers

Why won't tf.write_file write a file?

My code is: i = 0 fgsm = FastGradientMethod(wrap) adv = fgsm.generate(x_test_tensor, **fgsm_params) for adv_x in tf.unstack(adv): img = tf.cast(adv_x, dtype=tf.uint8) tf_image = tf.image.encode_jpeg(img) …
Shamoon
  • 41,293
  • 91
  • 306
  • 570
1
vote
3 answers

How to fix "ImportError: cannot import name 'flags' " while importing flags from Cleverhans.compat in Python

I am having a problem while playing the following code given as example in Cleverhans Library : The problem is on Line # 18 . When it plays it gives out an import error : ImportError: cannot import name 'flags' I have tried to see in the help and…
Inaam Ilahi
  • 105
  • 2
  • 9
1
vote
1 answer

Generating adversarial data from cleverhans attack models

I want a code example to how to generate train data from clever hans' adversarial attacks. adv_x = fgsm.generate_np(X_test, **fgsm_params) This generates adversarial x data but how can I get y? adv_pred = model.predict_classes(adv_x) And this…
1
vote
1 answer

Random Forest Black Box with CleverHans

I am new to this stuff and trying to attack Random Forest with Black Box FGSM (from clever hans) But I'm not sure how to implement it. They've a blackbox example for Mnist data but I dont understand where should I put my random forest and where…
Jeredriq Demas
  • 616
  • 1
  • 9
  • 36
1
2 3 4