Attacks Functions
Available functions:
fgsm(model, x, y, epsilon=0.01): Fast Gradient Sign Method (FGSM) attack.pgd(model, x, y, epsilon=0.01, alpha=0.01, num_steps=10): Projected Gradient Descent (PGD) attack.bim(model, x, y, epsilon=0.01, alpha=0.01, num_steps=10): Basic Iterative Method (BIM) attack.cw(model, x, y, epsilon=0.01, c=1, kappa=0, num_steps=10, alpha=0.01): Carlini & Wagner (C&W) attack.deepfool(model, x, y, num_steps=10): DeepFool attack.jsma(model, x, y, theta=0.1, gamma=0.1, num_steps=10): Jacobian-based Saliency Map Attack (JSMA).spsa(model, x, y, epsilon=0.01, num_steps=10): Simultaneous Perturbation Stochastic Approximation (SPSA) attack.
FGSM
Fast Gradient Sign Method (FGSM) attack.
Parameters:
model (tensorflow.keras.Model): The target model to attack.
x (numpy.ndarray): The input example to attack.
y (numpy.ndarray): The true labels of the input example.
epsilon (float): The magnitude of the perturbation (default: 0.01).
Returns:
adversarial_example (numpy.ndarray): The perturbed input example.PGD
Projected Gradient Descent (PGD) attack.
BIM
Basic Iterative Method (BIM) attack.
CW
Carlini & Wagner (C&W) attack.
Deepfool
Deepfool attack.
JSMA
Jacobian-based Saliency Map Attack (JSMA) attack.
SPSA
Simultaneous Perturbation Stochastic Approximation (SPSA) attack.
Last updated
Was this helpful?