SpaNN: Detecting Multiple Adversarial Patches on CNNs by Spanning Saliency Thresholds
Paper β’ 2506.18591 β’ Published
Part of the ANIMA Perception Suite by Robot Flow Labs.
SpaNN: Detecting Multiple Adversarial Patches on CNNs (arXiv:2506.18591) SaTML 2025 gerkbyrd et al.
SpaNN detects adversarial patch attacks by analyzing ensemble saliency-threshold attribute vectors extracted from victim model feature maps. The attack detector (AtkDetCNNRaw) is a lightweight 1D-CNN (417K params) that classifies threshold-swept clustering features as clean or adversarial.
Core Pipeline:
| Metric | Paper Target | Achieved |
|---|---|---|
| Val Accuracy | 85-92% | 97.9% |
| Val Loss | β | 0.0641 |
| Best Epoch | β | 50 (early stopped at 249) |
| Parameters | β | 416,905 |
Training Data: 6,746 samples (INRIA + CIFAR + ImageNet + COCO DINOv2)
| Format | File | Size | Use Case |
|---|---|---|---|
| PyTorch (.pth) | pytorch/DEF-spann_v1.pth |
5.0MB | Training, fine-tuning |
| SafeTensors | pytorch/DEF-spann_v1.safetensors |
1.7MB | Fast loading, safe |
| ONNX | onnx/DEF-spann_v1.onnx |
32KB | Cross-platform inference |
| TensorRT FP16 | β | β | Generate on target hardware |
| TensorRT FP32 | β | β | Generate on target hardware |
import torch
from def_spann.models import AtkDetCNNRaw
model = AtkDetCNNRaw(in_feats=4)
ckpt = torch.load("pytorch/DEF-spann_v1.pth", map_location="cpu")
model.load_state_dict(ckpt["model"])
model.eval()
# Input: (batch, 4_features, 20_thresholds)
x = torch.randn(1, 4, 20)
score = model(x) # β (1, 1), value in [0, 1]
is_attack = score >= 0.5
Two compiled CUDA kernels available in shared infrastructure:
local_entropy β Compute local entropy map for spatial anomaly detectionpatch_inpaint β Zero-fill detected adversarial patch regionsconfigs/training.tomldocker compose -f docker-compose.serve.yml --profile serve up -d
curl http://localhost:8080/health
Apache 2.0 β Robot Flow Labs / AIFLOW LABS LIMITED