arXiv:2610.32964cs.CVOct 2026

Manuscript Offprint

arXiv:2610.32964

Flownomaly: Single-Step Conditional-Mean Recovery for Few-Shot Anomaly Detection

Bernardo Perrone Ribeiro, Erkut Akdag, Egor Bondarev

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.

1. Introduction

Industrial visual anomaly detection aims to identify rare and unpredictable defects, including scratches, contamination, misplaced components, and structural damage [4]. Few-shot anomaly detection (FSAD) addresses this setting by characterizing category-specific normality from only a handful of defect-free reference images and detecting unseen defects at both image and pixel levels [14, 16].

Figure

Figure 1. Conceptual illustration of Flownomaly. A query patch token is (1) perturbed with Gaussian noise and (2) recovered using a single evaluation of the velocity field fitted to the normal supports. Tokens consistent with normal appearance undergo little displacement (left), whereas less compatible tokens tend to undergo larger changes toward the normal support features (right). The squared distance between a query token and its recovered counterpart defines the anomaly score.

Frozen visual foundation models provide strong transferable representations in this low-data regime, but existing paradigms face distinct limitations: stored feature banks tie inference to finite exemplars [6, 27], fitted linear subspaces impose rigid linearity assumptions [18], reference-graph alignment requires query-time optimization [29], and feature reconstruction risks reproducing anomalies [10, 32].

To overcome these limitations, we formulate FSAD as normal-counterpart recovery in frozen feature space by asking: can few-shot normal supports define a nonlinear recovery operator that maps a query token to a normality-biased counterpart in a single step? The discrepancy between the observed token and this recovered counterpart provides the anomaly signal. Conditional flow matching (CFM) [1, 23, 24] provides the training principle for this op-erator by fitting a time-conditioned velocity field that transports Gaussian noise to normal support features. Under squared loss, the CFM optimum predicts the conditional mean path velocity; along a straight path, this determines the posterior mean of the clean normal feature in one field evaluation, without trajectory integration.

Flownomaly applies this recovery principle to standardized multi-depth tokens from a frozen DINOv2 encoder (Fig. 1). Training the velocity field exclusively on normal tokens biases the recovery toward normal appearance rather than reproducing anomalous content. At inference, all query tokens are perturbed at a calibrated operating time and recovered in a single step via one batched velocity-field evaluation. However, single-step recovery introduces a calibration challenge: the operating time balances sensitivity to query variations against upper-tail residual variation on normal features. In the absence of anomalous validation samples in FSAD, the operating time should be chosen from normal supports alone. Flownomaly addresses this via a normal-only Jacobian gain-to-noise criterion. Support-derived augmentations also drive field fitting and checkpoint selection, ensuring that no stage relies on anomalous samples, auxiliary supervision, or test labels.

Experiments on MVTec-AD [4], VisA [37], and Real-IAD [31] demonstrate strong detection and localization performance, with the largest image-level gains on VisA and Real-IAD. Ablations further show that trajectory integration provides no detection advantage, reveal a broad region of well-performing operating times, and show that the normal-only criterion selects within it. In summary, this paper provides the following contributions:

• A formulation of FSAD as normal-counterpart recovery in frozen feature space, using a single-step recovery operator derived from the posterior-mean identity of straight-path CFM.

• A normal-only Jacobian gain-to-noise calibration criterion that selects the operating time from normal supports alone, without anomalous validation data or test labels.

• An extensive evaluation across three benchmarks demonstrating state-of-the-art results and showing that single-step recovery matches trajectory integration at substantially lower velocity-network cost.

References (34)