Strengthening Deep Neural Networks by Katy Warr

Strengthening Deep Neural Networks by Katy Warr

Author:Katy Warr
Language: eng
Format: epub, mobi, pdf
Publisher: O'Reilly Media
Published: 2019-07-08T16:00:00+00:00


x_bgr = x[..., ::-1]

Next, we set up the Foolbox attack:

attack_criterion = foolbox.criteria.Misclassification() attack = foolbox.attacks.SaliencyMapAttack(fmodel, criterion=attack_criterion)

and run it:

x_adv = attack(input_or_adv = x_bgr, label = y, unpack = False)

Let’s check the predicted label and class name of the returned adversarial image:

x_adv = adversarial.image[..., ::-1] x_adv_preds = model.predict(preprocess_input(x_adv[np.newaxis].copy())) y_adv = np.argmax(x_adv_preds) y_adv_name = decode_predictions(x_adv_preds, top=1)[0][0][1] print(print("Prediction for image: ", y_adv_name))



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.