Skip to main content
QUICK REVIEW

[Paper Review] Random Word Data Augmentation with CLIP for Zero-Shot Anomaly Detection

Masato Tamura|arXiv (Cornell University)|Aug 22, 2023
Anomaly Detection Techniques and ApplicationsComputer Science7 citations
TL;DR

Proposes a zero-shot, category-agnostic anomaly detector trained with diverse CLIP text embeddings generated via random word augmentations, eliminating the need for target object prompts during inference and matching or surpassing prompt-ensembled baselines in several benchmarks.

ABSTRACT

This paper presents a novel method that leverages a visual-language model, CLIP, as a data source for zero-shot anomaly detection. Tremendous efforts have been put towards developing anomaly detectors due to their potential industrial applications. Considering the difficulty in acquiring various anomalous samples for training, most existing methods train models with only normal samples and measure discrepancies from the distribution of normal samples during inference, which requires training a model for each object category. The problem of this inefficient training requirement has been tackled by designing a CLIP-based anomaly detector that applies prompt-guided classification to each part of an image in a sliding window manner. However, the method still suffers from the labor of careful prompt ensembling with known object categories. To overcome the issues above, we propose leveraging CLIP as a data source for training. Our method generates text embeddings with the text encoder in CLIP with typical prompts that include words of normal and anomaly. In addition to these words, we insert several randomly generated words into prompts, which enables the encoder to generate a diverse set of normal and anomalous samples. Using the generated embeddings as training data, a feed-forward neural network learns to extract features of normal and anomaly from CLIP's embeddings, and as a result, a category-agnostic anomaly detector can be obtained without any training images. Experimental results demonstrate that our method achieves state-of-the-art performance without laborious prompt ensembling in zero-shot setups.

Motivation & Objective

  • Motivate category-agnostic anomaly detection that does not require object-category prompts at inference.
  • Leverage CLIP as a data source to generate diverse training embeddings for normal vs. anomalous samples.
  • Eliminate laborious prompt ensembling by using random word data augmentation to create robust detectors.
  • Demonstrate competitive zero-shot performance on standard AD benchmarks (MVTec-AD, VisA) and real-world, diverse anomaly datasets (SewerML).

Proposed method

  • Use two-class prompt templates with normal and anomaly words to guide CLIP-based anomaly scores.
  • Introduce random word data augmentation by inserting randomly generated words into prompts to create diverse embedding pairs for normal and anomalous samples.
  • Train a four-layer feed-forward network (FNN) on CLIP text embeddings to classify normal vs. anomaly without object-specific training images.
  • Obtain anomaly scores from the trained FNN on image embeddings from CLIP’s image encoder and optionally combine with CLIP-based prompt scores.
  • Evaluate zero-shot performance in unknown-object and known-object setups, and explore combinations with other CLIP-based scores (s_pr, s_img).
  • Keep prompt ensembles out of the training loop to avoid laborious prompting and still achieve strong zero-shot results.

Experimental results

Research questions

  • RQ1Can CLIP be used as a training data source to build a category-agnostic anomaly detector that works without target object information at inference?
  • RQ2Does random word data augmentation provide sufficient diversity in embeddings to distinguish normal vs. anomalous samples across unknown object categories?
  • RQ3How does the proposed method compare to prompt-guided AD methods and prompt-ensembling baselines on standard AD benchmarks in zero-shot settings?
  • RQ4What is the impact of the number of random-prompt pairs (N_p) and word choices on zero-shot performance?

Key findings

  • The proposed method achieves competitive zero-shot performance on MVTec-AD and VisA, often surpassing CLIP-based prompt-guided AD and WinCLIP in unknown-object settings.
  • CLIP + ours consistently improves over CLIP alone in zero-shot unknown-object setups, with notable gains when object categories are not specified.
  • Using random word data augmentation provides diverse embeddings enabling a category-agnostic FNN to detect anomalies without trained object-specific data.
  • In SewerML, the method without prompt-guided AD achieves the best performance among the three methods, highlighting robustness to highly diverse defects.
  • Optimal results are observed around N_p = 10,000 training pairs; too few or too many pairs can degrade performance due to underfitting or overfitting.
  • The approach achieves strong AUROC, AUPR, and F1-max across datasets, and the combination CLIP + ours often yields the best scores in zero-shot evaluations.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.