Overview
Few-shot anomaly detection often struggles because comparing a potentially defective image to a generic "normal" reference image introduces noise from natural, non-anomalous variations (like lighting or position). This paper introduces a "One-to-Normal" approach that uses a customized diffusion model to transform a query image into its own perfect, anomaly-free counterpart. By comparing the original image to its personalized normal version—alongside generated samples and text prompts—the method achieves state-of-the-art accuracy across industrial, medical, and semantic datasets.
The Challenge of Natural Variation
Anomaly Detection (AD) is crucial for tasks like manufacturing inspection and medical diagnostics. Traditionally, AD models learn by looking at thousands of "normal" (defect-free) images so they can flag anything that deviates from that distribution. Recently, few-shot AD has emerged, using large Vision-Language Models (VLMs) like CLIP to detect anomalies using only a handful of normal reference images.
However, current state-of-the-art few-shot methods rely on directly comparing the features of a query image to those few normal reference images. This is fundamentally flawed: if your query image and your reference image differ in perfectly normal ways (e.g., a slightly different camera angle, lighting, or object shape), the model might falsely flag those natural variations as anomalies. The authors hypothesize that for precise detection, a query image shouldn't be compared to a generic normal image, but rather to a normal version of itself.
Methodology: Anomaly Personalization
To achieve this, the authors propose an Anomaly Personalization framework, broken down into two main innovations:
1. One-to-Normal Personalization
Instead of using standard reference images, the authors use the few available normal images to fine-tune a diffusion model. This creates an "anomaly-free customized model" that deeply understands the normal distribution of the specific object.
When a new query image comes in, they partially add noise to it and then denoise it using this customized model, guided by text prompts like "a photo of a normal [object] without flaw." Because the diffusion process is constrained, it retains the healthy structural features of the original query image but "heals" the anomalous regions, creating a personalized, 1-to-1 normal counterpart.
2. Triplet Contrastive Anomaly Inference
To make the final prediction robust, the authors don't rely on a single comparison. They extract multi-level features using CLIP and calculate an anomaly score based on a triplet of comparisons:
- One-to-one: Comparing the query image directly to its personalized "healed" version.
- Sample pool: Comparing the query to a memory bank of diverse, anomaly-free images generated by their customized diffusion model.
- Text prompts: Comparing the query's features to text embeddings of normal vs. abnormal descriptions.
These three scores are combined to yield the final anomaly prediction.
Key Insights and Ideas
- The best reference is a healed query: The core breakthrough is shifting from inter-image comparison (Query vs. Reference) to intra-image comparison (Query vs. Healed Query). This elegantly bypasses the false positives caused by natural variations in object pose or lighting.
- Diffusion models as targeted healers: By carefully tuning the diffusion timestep ($t$), the model acts as a localized editor. A low $t$ keeps the image exactly the same, while a high $t$ generates a completely new image. The "Goldilocks" zone allows the model to keep the background intact while forcing anomalous pixels back onto the "normal" data manifold.
- Synthetic data is a rising tide that lifts all boats: The customized diffusion model generates high-quality normal samples that can be exported. The authors showed that simply plugging these generated images into other existing AD algorithms drastically improves their performance.
Datasets and Results
The method was extensively evaluated across 11 datasets spanning three distinct domains: Industrial (MVTec-AD, VisA, KSDD, AFID, ELPV), Medical (OCT2017, BrainMRI, HeadCT, RESC), and Semantic (MNIST, CIFAR-10).
- State-of-the-Art Performance: The proposed method consistently outperformed baselines (like WinCLIP, InCTRL, PatchCore, and RegAD) across 2-shot, 4-shot, and 8-shot settings.
- Industrial Domain: In the 8-shot setting, the method achieved higher AUROC scores by 3.4% on KSDD, 4.1% on ELPV, and 4.1% on AFID compared to the latest SOTA (InCTRL).
- Medical Domain: Standard VLMs often struggle here due to a lack of domain-specific pre-training. The triplet inference strategy shined here, beating the second-best method on the RESC dataset by 4.6% (8-shot).
- Boosting Baselines: When the generated anomaly-free samples were used to augment the training data of older methods, performance spiked. For example, RegAD's AUROC improved by up to 10.2% in the 8-shot setting.
Limitations and Future Work
- Not Zero-Shot: Because the method relies on fine-tuning a customized diffusion model to understand the "normal" manifold, it strictly requires at least a few reference images. It cannot currently be applied to zero-shot scenarios.
- Inference Latency: The "One-to-Normal" personalization requires running a diffusion generation step during inference. This adds roughly 200-300ms per query image compared to faster, single-pass methods like WinCLIP.
- Future Work: The authors plan to explore ways to adapt this high-precision approach to zero-shot settings, open-vocabulary scenarios, and real-time applications where latency is a strict bottleneck.
Summary updated