Defect Cue-Preserved Structural Feature Refinement for Few-Shot Anomaly Detection

Le Jiang, Yan Huang, Zhen Xu, Yong Xu, Hau-San Wong, Si WuCVPR 2026

TL;DR

Few-shot anomaly detection often struggles because subtle defect signals fade as they pass through deep neural network layers. This paper introduces DCP-SFR, a framework that preserves and amplifies early-stage defect cues to guide feature reconstruction and refine segmentation boundaries. The model achieves state-of-the-art performance on standard industrial inspection benchmarks using only a handful of normal reference images.

What Problem Does This Paper Address?

Automated anomaly detection is crucial for industrial quality control, but collecting large, annotated datasets for every possible defect is impractical. Few-Shot Anomaly Detection (FSAD) solves this by learning to spot defects using only a few normal reference images.

However, real-world defects vary wildly in size, shape, and contrast. The authors identify a fundamental flaw in existing deep-learning pipelines: defect cue fading. As visual features travel deeper through multi-stage neural networks, subtle and minor anomaly signals progressively wash out. This leads to three major failure modes in current state-of-the-art models:

  1. Missing minor or low-contrast anomalies.
  2. Misclassifying normal background regions as anomalous.
  3. Producing blurry, ambiguous segmentation boundaries.
Examples of common FSAD challenges: missed minor anomalies, ambiguous boundaries, and misclassified background regions.

Methods

DCP-SFR counteracts defect cue fading using a multi-stage information preservation strategy divided into three core modules:

  1. Conditional Anomaly Cue Amplification (CACA): To catch defects before they disappear, the model extracts multi-level patch features from the intermediate layers of a pretrained, frozen CLIP vision encoder. It interacts these features with learnable text prompts (anchored by the semantic word [damaged]) to generate an initial anomaly score map. A non-linear transformation then amplifies faint responses while suppressing normal regions, creating a high-contrast cue map.
  2. Anomaly Cue-guided Localization (ACL): This module uses the amplified cue map to guide a cross-attention feature reconstruction process based on DINOv2 features. By multiplying the query features by the inverse of the cue map, the network is forced to mask out suspected anomalous regions and reconstruct the image using only normal reference patterns. The difference between the original and reconstructed features (the residual map) cleanly pinpoints the defect locations.
  3. Structure-aware Segmentation Refinement (SSR): The localization map is fused with a non-parametric memory-bank cosine similarity map to filter out false positives caused by normal texture variations. To ensure sharp boundaries, the authors introduce a dedicated edge alignment regularization loss ($L_C$) that penalizes discrepancies between the predicted segmentation edges and the ground-truth boundaries during training.
Figure 2. Overview of the DCP-SFR framework. The architecture comprises a CACA Module and an ACL Module, forming a shared core built on pretrained features for both segmentation and classification subtasks. Besides, the SSR maintains geometric accuracy and edge sharpness of segmentation result.

Datasets

The framework was evaluated on two widely used public industrial anomaly detection benchmarks:

  • MVTec AD: Contains 15 categories of industrial products (e.g., screws, capsules, hazelnuts) with high-resolution images and pixel-level annotations.
  • VisA: Consists of 12 categories with complex structures and diverse, challenging defect types.

Key Insights and Ideas

  • Intermediate Layers are Goldmines: Waiting until the final layer of a deep network to detect anomalies means missing subtle details. Leveraging intermediate layers preserves early-stage cues before they are abstracted away.
  • Negative Guidance for Reconstruction: Instead of blindly reconstructing an entire image, explicitly masking out suspected anomalous regions prevents the reconstruction module from accidentally reconstructing the defect itself, making the anomaly localization far more robust.
  • Fusing Sensitivity and Precision: The reconstruction residual map provides high sensitivity (finding all potential defects), while the memory-bank similarity map provides high precision (rejecting false positives). Fusing them yields clean, accurate heatmaps.

Key Results

DCP-SFR achieves state-of-the-art performance across 1-, 2-, and 4-shot settings on both datasets:

  • 1-Shot Performance: On MVTec AD, it achieves an image-level AUROC of 97.3%. On VisA, it reaches a pixel-level AUROC of 98.2%.
  • Boundary Precision: Thanks to the SSR module, the model significantly outperforms competing methods in Average Precision (p-AP), beating the previous best method (AnomalyDINO) by about 5 points on the MVTec AD segmentation task.

Qualitatively, the model excels at cleanly separating background noise from true defects and accurately capturing sharp boundaries for complex, multi-spot anomalies.

Figure 3. Qualitative comparison of segmentation results between DCP-SFR and the competing methods. The results demonstrate that DCP-SFR accurately detects minor anomalies, minimizes background false positives, and preserves sharp segmentation edges.

Limitations and Future Work

Not discussed in the paper.

Summary updated

BibTeX
@inproceedings{jiang2026defect,
  author = {Le Jiang and Yan Huang and Zhen Xu and Yong Xu and Hau-San Wong and Si Wu},
  title = {{Defect Cue-Preserved Structural Feature Refinement for Few-Shot Anomaly Detection}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2026},
  url = {https://openreview.net/forum?id=6OIkw42amK},
}
Figure