One-to-Normal: Anomaly Personalization for Few-shot Anomaly Detection

Yiyue Li, Shaoting Zhang, Kang Li, Qicheng Lao

Introduction

Anomaly Detection (AD) is a critical computer vision task focused on identifying rare defects or outliers within a dataset, typically using only "normal" examples for training. While recent advancements in large Vision-Language Models (VLMs) like CLIP have enabled "few-shot" AD—learning from as few as 2 to 8 samples—achieving high precision remains a significant challenge. The "One-to-Normal" framework addresses these limitations by shifting the focus from generic reference comparisons to personalized image reconstruction.

The Challenge of Feature Misalignment

A core obstacle in few-shot AD is feature misalignment. Traditional methods compare a query image (e.g., a defective industrial part) against a small pool of "good" reference images. However, harmless variations in orientation, lighting, or background between the query and the references can lead the model to trigger false positives. The authors argue that the most effective way to detect anomalies is to compare a query image not to a different normal sample, but to a normal version of itself.

Proposed Method: Anomaly Personalization

The framework introduces a two-stage process called Anomaly Personalization to create these self-references:

  1. Anomaly-Free Customization: A diffusion model (Stable Diffusion V1.5) is fine-tuned using a few normal samples. This process teaches the model the specific distribution of the target object, whether it is a healthy retina or a flawless mechanical component.
  2. One-to-Normal Personalization: When presented with a query image, the system adds controlled noise and then uses the customized model to "denoise" it. This effectively "heals" the image, removing anomalies while preserving the original pose, lighting, and structure.
Overview of the One-to-Normal framework, featuring Anomaly-Free Customization and Triplet Contrastive Anomaly Inference.

To finalize detection, the system employs Triplet Contrastive Anomaly Inference, which aggregates three distinct scores: a personalized score ($S_P$) comparing the query to its healed version, a normal pool score ($S_N$) comparing it to a memory bank of samples, and a textual score ($S_{text}$) derived from CLIP prompts.

Experimental Evaluation

The researchers evaluated the model across 11 datasets spanning industrial (e.g., MVTec-AD, VisA), medical (e.g., BrainMRI, OCT2017), and semantic (MNIST, CIFAR-10) domains.

Visualization of the "healing" process: the model transforms an anomalous query image into a personalized normal reference.

Key Results

  • State-of-the-Art Performance: The approach consistently outperformed leading baselines like WinCLIP and InCTRL. In 8-shot industrial scenarios, it achieved AUROC improvements of up to 4.1% on the VisA dataset.
  • Medical Robustness: On the RESC skin cancer dataset, the model surpassed the second-best method by 4.6%, demonstrating its ability to handle complex organic textures where "normal" is highly variable.
  • Stability: The method exhibited lower variance across runs, indicating it is less sensitive to the specific choice of few-shot training samples compared to existing methods.

Discussion and Conclusion

The "One-to-Normal" paradigm demonstrates that the best reference for anomaly detection is the query image itself. By using diffusion models as "healers" to project anomalous images back onto a normal manifold, the system effectively cancels out non-anomalous noise like rotation or lighting changes.

While the personalization step introduces a slight inference latency (approximately 200-300ms per image), the gains in accuracy and stability are substantial. Furthermore, the anomaly-free images generated by this method can serve as high-quality synthetic data to boost the performance of other AD models, marking a significant step forward for low-data regime inspection tasks.

Summary updated

BibTeX
@inproceedings{li2024one,
  author = {Yiyue Li and Shaoting Zhang and Kang Li and Qicheng Lao},
  title = {{One-to-Normal: Anomaly Personalization for Few-shot Anomaly Detection}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=tIzW3l2uaN},
}
Figure