🎯 Adversarial Attack Lab

Upload a photo and watch a tiny, almost invisible perturbation fool a pretrained ImageNet classifier (MobileNet v2). Everything runs in your browser with TensorFlow.js. No server involved.

What is going on?

An image classifier is a differentiable function, so we can ask: which direction should each pixel move to make the model more wrong? The gradient of the loss with respect to the input pixels answers that. We then change every pixel by at most ε (on a 0–255 scale that's ε×255 levels), which is usually too small for you to notice.

The middle panel shows the perturbation amplified ×10 (grey means no change). Images are resized and center-cropped to 224×224. The adversarial image is quantized to 8-bit before it is re-classified, so the predictions shown are exactly what the downloadable PNG gets.

📷 Drop an image here or click to choose a file
Examples: panda dog banana bus panda to toaster
Starting…

Original (224×224)

Perturbation ×10

Adversarial