DePrint: Removing Intrinsic Error Fingerprints Across Visual Anomaly Detectors

Ning ZhuarXiv 2026

TL;DR

Visual anomaly detectors—systems designed to spot defects on factory lines using only normal reference images—almost universally condense high-dimensional feature errors into a single scalar distance, implicitly assuming that normal background "noise" looks like a uniform, directionless cloud. This paper shows that assumption is fundamentally flawed: every detector and reference set leaves behind a structured, predictable "error fingerprint" that buries subtle defects under false alarms. The author introduces DePrint, a tiny, training-free plug-in that mathematically maps and subtracts this fingerprint in under 3 milliseconds per image, boosting accuracy across virtually every type of detector.

What Problem Does This Paper Address?

Imagine inspecting pharmaceuticals on a conveyor belt. Because defects can take infinite, unpredictable forms, visual anomaly detectors learn what "normal" looks like from a small support set of defect-free images. Whether a model uses nearest-neighbor memory banks, statistical distributions, or neural feature reconstruction, it ultimately compares a test image patch ($q$) to an expected normal patch ($\hat{q}$) to get a high-dimensional residual vector, $\Delta = q - \hat{q}$.

Right at the finish line, nearly all existing methods collapse that rich vector into a simple Euclidean ($\ell_2$) or cosine distance: $\|\Delta\|_2$. Geometrically, this treats normal variations—slight lighting shifts, pose tweaks, or Vision Transformer patch-grid quirks—as isotropic (spherical), spatially independent noise.

From Cosine Scoring to Intrinsic Error Fingerprints

In reality, finite reference sets and model architectures create a reproducible, structured error pattern on normal images—an intrinsic residual fingerprint. When collapsed into a blind scalar norm, benign drift along predictable directions can easily have a larger magnitude than a genuine, subtle defect, triggering false alarms or masking real anomalies.

Methods

Instead of smoothing scalar heatmaps after the fact, DePrint operates directly on the raw residual vectors before they are collapsed. Because channel errors and spatial errors have incompatible geometries, DePrint cancels them in a strict two-stage cascade (requiring zero retraining and no extra data, using Leave-One-Image-Out or cross-validation on the existing normal set):

Overview of the DePrint two-stage pipeline
  1. Stage 1: Channel Drift Removal (DePrint-S1). Benign variations push feature vectors along a low-rank linear subspace. Crucially, because $\Delta = 0$ means an exact physical match, DePrint uses uncentered Singular Value Decomposition (SVD) anchored at the origin (rather than mean-centered PCA) to find the top $r=32$ drift directions ($U_c$). At test time, it projects out this subspace, keeping only the orthogonal energy where true defects live.
  2. Stage 2: Spatial Pareto Bank (DePrint-S1+S2). Even after channel cleanup, local $3 \times 3$ patch neighborhoods exhibit structured spatial patterns. A $3 \times 3$ test block (a 9D vector of magnitudes) is normal as long as every pixel is quieter than some observed normal pattern—a lopsided, non-convex shape called an order ideal. DePrint extracts the Pareto frontier (the upper boundary of normal $3 \times 3$ blocks), compresses it into $K_p=32$ prototypes, and scores only the one-sided excess above this frontier.

Datasets

No new datasets are introduced. Evaluation spans two standard industrial inspection benchmarks:

  • MVTec-AD (15 categories of textures and objects).
  • VisA (12 complex categories, such as multi-instance capsules and PCBs).

Experiments cover unified 2-shot and 4-shot setups across seven detectors, full-shot multi-class checkpoints, and a zero-shot Vision-Language Model (AnomalyCLIP) stress test.

Key Insights and Ideas

  • Fingerprints are unique to the Detector $\times$ Support Set pair: When three different paradigms (AnomalyDINO, PaDiM, INP-Former) share the exact same frozen DINOv2 backbone and the exact same 4 normal images, their normal residuals concentrate into low-rank subspaces ($r_{\text{eff}}/D$ of $0.159–0.417$, versus $\sim 0.96$ for isotropic noise), yet those subspaces barely overlap across detectors. Swapping calibration bases between detectors ruins the performance gains.
  • Why symmetric/convex math collapses spatially: Trying to wrap $3 \times 3$ spatial blocks in a standard 9D Mahalanobis ellipsoid fails dramatically (dropping PaDiM's true positive rate from $90.7\%$ to $35.2\%$). Convex shapes bridge across distinct normal boundary patterns and swallow real defects in the middle, while symmetric distances absurdly penalize test patches for being cleaner (closer to zero) than the average prototype.
  • Causal order is non-negotiable: You must remove channel drift before doing spatial calibration. Running Stage 2 directly on raw scores actually makes the detector worse than doing nothing, because unremoved channel noise inflates the spatial Pareto frontier, raising the ceiling so high that real defects hide underneath it.

Key Results

  • Universal few-shot gains: Across 7 detectors and both datasets in 2/4-shot regimes, DePrint-S1 improves the 6-metric average on 14 out of 14 detector-dataset pairs (and 42/42 individual metric entries on VisA). Image-level AUROC jumps by +7.44 percentage points (pp) on PaDiM and +6.22 pp on RD4AD on VisA. Even on the strong INP-Former calibrated strictly on its 2 or 4 training images, DePrint-S1+S2 adds +0.69 pp average gain.
  • Tiny footprint and fast: DePrint requires just 48.6 KB of float16 weights per category and adds 2.69 ms per image on a GPU.
  • Rock-solid hyperparameters: Performance is remarkably flat across prototype budgets from $K_p=4$ up to exact, uncompressed frontiers (~500 prototypes).
Figure 3: Hyperparameter stability across both MVTec-AD (15 classes) and VisA (12 classes) at 4-shot (AnomalyDINO, non-register DINOv2-B/14, 448×448, seed 43). (a) Suite A (Rank r): Default r = 32 (48.6 KB) achieves the exact peak on MVTec-AD (98.06% I-AUC / 90.55% Avg6) and lies within 0.39 pp of peak r = 64 on VisA at half the memory. (b) Suite D (Prototype Budget Kp): Performance is virtually flat from Kp = 4 to exact uncompressed Pareto (477 VisA / 552 MVTec prototypes), validating Proposition 3.
  • Full-shot SOTA: On saturated multi-class models (scoring $>99\%$ on MVTec-AD), DePrint is near-neutral overall, while pushing INP-Former's VisA image AUROC from $98.90\%$ to 99.11% (a 19% relative error reduction).

Limitations and Future Work

  • Saturation diminishing returns: DePrint shines brightest in few-shot settings where finite-sample coverage bias is severe; on full-dataset trained models, the host network has already absorbed most of that variance.
  • The Stage 2 pixel trade-off: Because Stage 2 zeroes out any $3 \times 3$ block that sits below a normal frontier prototype, it cleans up background clutter (boosting image AUROC) but can clip faint, blurry pixels at the edges of a defect, lowering pixel-level $F_1$-max. When crisp pixel boundaries matter most, the author recommends deploying DePrint-S1 alone.
  • 1-shot and extreme pose limits: With only $K=1$ reference image, Leave-One-Image-Out is impossible; using deterministic image augmentations recovers encoder bias, but misses cross-instance variation. Furthermore, severe unaligned pose shifts violate DePrint's local linear approximation.
  • Future directions: Extending evaluations to 8-shot scaling, rotation-augmented calibration, and multi-view industrial datasets like BTAD and Real-IAD.

Summary updated

BibTeX
@misc{zhu2026deprint,
  author = {Ning Zhu},
  title = {{DePrint: Removing Intrinsic Error Fingerprints Across Visual Anomaly Detectors}},
  year = {2026},
  eprint = {2611.38118},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.38118},
}
Figure