Flownomaly: Single-Step Conditional-Mean Recovery for Few-Shot Anomaly Detection
Organizations: AIMS Group, Department of Electrical Engineering, Eindhoven University of Technology
Abstract
Few-shot industrial anomaly detection requires modeling category-specific normality from only a handful of defect-free images. Common approaches tie inference to stored exemplars, impose rigid linear structure, or risk reproducing anomalous content. Flownomaly instead casts the problem as normal-counterpart recovery in frozen DINOv2 feature space. Given normal supports, a velocity field is learned through conditional flow matching over frozen patch tokens to transport Gaussian noise toward normal features. Along straight paths, a single recovery step using one evaluation of the optimal field yields the posterior mean of the clean normal token without trajectory integration. The operating time governs how strongly recovery modifies a query token. With no anomalous validation samples available for tuning, a normal-only Jacobian gain-to-noise criterion selects this time from the supports alone. Squared residuals between query tokens and their recovered counterparts yield anomaly signals for both dense localization and image-level detection. Across 1-, 2-, and 4-shot benchmarks on MVTec-AD and VisA, together with sample-shot evaluations on Real-IAD, Flownomaly achieves state-of-the-art performance against recent category-specific methods. In the 1-shot setting, image- and pixel-level AUROC reach 97.8% and 98.0% on MVTec-AD and 95.3% and 98.7% on VisA, with a 2.1-point image-level AUROC improvement over the strongest baseline on VisA. Code is available at https://github.com/b-rbmp/Flownomaly.
Figures & tables
| Setup | Method | MVTec-AD | VisA | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Image-level | Pixel-level | Image-level | Pixel-level | ||||||||||
| AUROC | AUPR | AUROC | AUPRO | AUROC | AUPR | AUROC | AUPRO | ||||||
| 1-shot | PatchCore [ 27 ] | 83.4 | 92.2 | 90.5 | 92.0 | 79.7 | 50.4 | 79.9 | 82.8 | 81.7 | 95.4 | 80.5 | 38.0 |
| WinCLIP [ 16 ] | 93.1 | 96.5 | 93.7 | 95.2 | 87.1 | 55.9 | 83.8 | 85.1 | 83.1 | 96.4 | 85.1 | 41.3 | |
| PromptAD [ 20 ] | 94.6 | 97.1 | 95.2 | 95.9 | 87.9 | 53.2 | 86.9 | 88.4 | 82.9 | 96.7 | 85.1 | 35.0 | |
| AnomalyDINO [ 6 ] | 96.6 | 98.2 | 95.8 | 96.8 | 92.7 | 60.2 | 87.4 | 89.0 | 84.3 | 97.8 | 92.5 | 45.1 | |
| Image-level | Pixel-level | |||||
| Method | AUROC | AUPR | AUROC | AUPRO | ||
| 1-sample shot (5 views) | ||||||
| PatchCore [ 27 ] | ||||||
| PromptAD [ 20 ] | ||||||
| AnomalyDINO [ 6 ] | ||||||
| SubspaceAD [ 18 ] | ||||||
| MVTec-AD | VisA | Latency (ms/image) | ||||
|---|---|---|---|---|---|---|
| NFE | I-AUROC | P-AUROC | I-AUROC | P-AUROC | Velocity | Total model |
| 1 | 2.2 | 60.9 | ||||
| 2 | 3.7 | 62.4 | ||||
| 5 | 8.0 | 66.7 | ||||
| 10 | 15.1 | 73.8 | ||||
| 20 | 29.2 | 87.9 | ||||
| MVTec-AD | VisA | |||
| Scoring rule | I-AUROC | P-AUROC | I-AUROC | P-AUROC |
| Recovery residual | ||||
| Velocity norm | ||||
| Cosine residual | ||||
| MVTec-AD | VisA | ||||
|---|---|---|---|---|---|
| Backbone | Latency (ms) | I-AUROC | P-AUROC | I-AUROC | P-AUROC |
| DINOv2-S | 18.1 | ||||
| DINOv2-B | 25.5 | ||||
| DINOv2-L | 51.9 | ||||
| DINOv2-g | 60.9 | ||||
Appendix figures & tables12 assets
Supplementary material from the paper’s appendix.
Appendix
| Regret (pp) | ||||
|---|---|---|---|---|
| Dataset | range | Mean | Median | Maximum |
| MVTec-AD | – | 0.15 | 0.06 | 0.82 |
| VisA | – | 0.54 | 0.14 | 4.82 |
| MVTec-AD | VisA | ||||
|---|---|---|---|---|---|
| Category | Regret (pp) | Category | Regret (pp) | ||
| bottle | 0.75 | 0.08 | candle | 0.70 | 0.09 |
| cable | 0.65 | 0.82 | capsules | 0.65 | 0.36 |
| capsule | 0.65 | 0.08 | cashew | 0.65 | 0.02 |
| carpet | 0.70 | 0.00 | chewinggum | 0.65 | 0.04 |
| grid | 0.75 | 0.00 | fryum | 0.65 | 0.23 |
| MVTec-AD | VisA | ||||
|---|---|---|---|---|---|
| Configuration | I-AUROC | P-AUROC | I-AUROC | P-AUROC | Median (MVTec-AD/VisA) |
| Default: 40–80%, standardized | 0.65/0.65 | ||||
| Single block at 80% depth | 0.70/0.70 | ||||
| Shallow blocks at 20–40% depth | 0.60/0.60 | ||||
| Without layer standardization | 0.85/0.85 | ||||
| Without rotation-derived views † | 0.60/0.60 | ||||
| MVTec-AD | VisA | ||||
|---|---|---|---|---|---|
| Backbone | Res. | I-AUROC | P-AUROC | I-AUROC | P-AUROC |
| DINOv2-g | |||||
| DINOv3-7B | |||||
| DINOv3-7B | |||||
| Image-level | Pixel-level | |||||
|---|---|---|---|---|---|---|
| Method | AUROC | AUPR | AUROC | AUPRO | ||
| PatchCore [ 27 ] | 99.2 | 99.8 | 98.8 | 98.1 | 92.6 | 59.3 |
| AnomalyDINO [ 6 ] | 99.5 | 99.8 | 99.0 | 98.2 | 95.0 | 64.3 |
| SubspaceAD [ 18 ] | 99.2 | 99.6 | 98.3 | 98.2 | 95.6 | 64.7 |
| ANoCo [ 29 ] | 99.4 | 99.7 | 98.5 | 98.2 | 96.4 | 67.8 |
| Flownomaly | 99.7 | 99.9 | 99.0 | 98.7 | 96.4 | 67.2 |
| Image-level | Pixel-level | |||||
|---|---|---|---|---|---|---|
| Method | AUROC | AUPR | AUROC | AUPRO | ||
| PatchCore [ 27 ] | 92.8 | 91.4 | 88.0 | 98.5 | 91.1 | 43.7 |
| AnomalyDINO [ 6 ] | 97.6 | 98.0 | 94.5 | 98.8 | 96.1 | 53.8 |
| SubspaceAD [ 18 ] | 98.2 | 98.3 | 95.0 | 99.1 | 96.9 | 53.0 |
| ANoCo [ 29 ] | 98.7 | 98.9 | 96.1 | 99.2 | 95.3 | 54.7 |
| Flownomaly | 98.9 | 98.9 | 96.5 | 99.3 | 97.0 | 54.8 |
Few-Shot Anomaly Detection
Few-shot anomaly detection uses a small set of examples to identify and localize unusual patterns in new data or domains.
See all 39 papers