Table of Contents
Fetching ...

SubspaceAD: Training-Free Few-Shot Anomaly Detection via Subspace Modeling

Camile Lendering, Erkut Akdag, Egor Bondarev

TL;DR

SubspaceAD is introduced, a training-free method that operates in two simple stages, that achieves state-of-the-art performance across one-shot and few-shot settings without training, prompt tuning, or memory banks.

Abstract

Detecting visual anomalies in industrial inspection often requires training with only a few normal images per category. Recent few-shot methods achieve strong results employing foundation-model features, but typically rely on memory banks, auxiliary datasets, or multi-modal tuning of vision-language models. We therefore question whether such complexity is necessary given the feature representations of vision foundation models. To answer this question, we introduce SubspaceAD, a training-free method, that operates in two simple stages. First, patch-level features are extracted from a small set of normal images by a frozen DINOv2 backbone. Second, a Principal Component Analysis (PCA) model is fit to these features to estimate the low-dimensional subspace of normal variations. At inference, anomalies are detected via the reconstruction residual with respect to this subspace, producing interpretable and statistically grounded anomaly scores. Despite its simplicity, SubspaceAD achieves state-of-the-art performance across one-shot and few-shot settings without training, prompt tuning, or memory banks. In the one-shot anomaly detection setting, SubspaceAD achieves image-level and pixel-level AUROC of 98.0% and 97.6% on the MVTec-AD dataset, and 93.3% and 98.3% on the VisA dataset, respectively, surpassing prior state-of-the-art results. Code and demo are available at https://github.com/CLendering/SubspaceAD.

SubspaceAD: Training-Free Few-Shot Anomaly Detection via Subspace Modeling

TL;DR

SubspaceAD is introduced, a training-free method that operates in two simple stages, that achieves state-of-the-art performance across one-shot and few-shot settings without training, prompt tuning, or memory banks.

Abstract

Detecting visual anomalies in industrial inspection often requires training with only a few normal images per category. Recent few-shot methods achieve strong results employing foundation-model features, but typically rely on memory banks, auxiliary datasets, or multi-modal tuning of vision-language models. We therefore question whether such complexity is necessary given the feature representations of vision foundation models. To answer this question, we introduce SubspaceAD, a training-free method, that operates in two simple stages. First, patch-level features are extracted from a small set of normal images by a frozen DINOv2 backbone. Second, a Principal Component Analysis (PCA) model is fit to these features to estimate the low-dimensional subspace of normal variations. At inference, anomalies are detected via the reconstruction residual with respect to this subspace, producing interpretable and statistically grounded anomaly scores. Despite its simplicity, SubspaceAD achieves state-of-the-art performance across one-shot and few-shot settings without training, prompt tuning, or memory banks. In the one-shot anomaly detection setting, SubspaceAD achieves image-level and pixel-level AUROC of 98.0% and 97.6% on the MVTec-AD dataset, and 93.3% and 98.3% on the VisA dataset, respectively, surpassing prior state-of-the-art results. Code and demo are available at https://github.com/CLendering/SubspaceAD.
Paper Structure (40 sections, 8 equations, 8 figures, 9 tables)

This paper contains 40 sections, 8 equations, 8 figures, 9 tables.

Figures (8)

  • Figure 1: One-shot segmentation results of SubspaceAD on the MVTec-AD dataset bergmann2019mvtec, where SubspaceAD only uses one normal image per category. Each example shows a test sample with its predicted anomaly mask (overlaid in dark blue), across all 15 categories of the MVTec-AD dataset.
  • Figure 2: Overview of the proposed SubspaceAD method. (Fitting): Aggregated patch features are collected from $k$ normal samples using a frozen DINOv2-G model and a PCA model is fitted to capture the subspace of normal variation. (Inference): Features of a test image are extracted, projected onto the normal subspace, and the reconstruction error is computed, providing the anomaly segmentation map directly.
  • Figure 3: Qualitative comparison on VisA and MVTec-AD (1-shot). SubspaceAD produces sharper and more precise anomaly maps than PromptAD li2024promptad and AnomalyDINO damm2025anomalydino, with fewer false activations and better alignment with ground-truth defects across both datasets. More qualitative examples are provided in Appendix \ref{['sec:qualitative_results']}.
  • Figure 4: Effect of image resolution on performance across both datasets. Performance peaks at 672 px on both MVTec-AD (solid) and VisA (dashed).
  • Figure 5: Impact of backbone scale on SubspaceAD performance on both datasets. Performance improves with increasing model capacity, indicating that richer foundation features directly enhance few-shot anomaly detection.
  • ...and 3 more figures