
A Python toolbox to create adversarial examples that fool neural networks in PyTorch, TensorFlow, and JAX
home: true heroImage: /logo.png heroText: Foolbox tagline: "Foolbox: Fast adversarial attacks to benchmark the robustness of machine learning models in PyTorch, TensorFlow, and JAX" actionText: Get Started → actionLink: /guide/ features:
Foolbox is a Python library that lets you easily run adversarial attacks against machine learning models like deep neural networks. It is built on top of EagerPy and works natively with models in PyTorch, TensorFlow, and JAX.
import foolbox as fb
model = ...
fmodel = fb.PyTorchModel(model)
attack = fb.attacks.LinfPGD()
epsilons = [0.0, 0.001, 0.01, 0.03, 0.1, 0.3, 0.5, 1.0]
advs, _, success = attack(fmodel, images, labels, epsilons=epsilons)