UniVAD: A Training-free Unified Model for Few-shot Visual Anomaly Detection

Zhaopeng Gu, Bingke Zhu, Guibo Zhu, Yingying Chen, Ming Tang, Jinqiao Wang · DOI

Abstract

Visual Anomaly Detection (VAD) often faces challenges due to domain specialization, the need for category-specific models, and high data requirements. We introduce UniVAD, a training-free, unified framework designed for few-shot VAD across industrial, logical, and medical domains. UniVAD leverages vision foundation models and introduces a component-aware matching strategy to eliminate the need for expensive, domain-specific training. By decomposing images into semantic components and modeling their relationships, UniVAD achieves state-of-the-art performance with minimal reference data, demonstrating robust generalization across diverse visual tasks.

Introduction

Visual Anomaly Detection (VAD) is the task of identifying images that deviate from "normal" patterns, such as surface defects in manufacturing or lesions in medical imaging. Historically, VAD has been hindered by three major bottlenecks:

  1. Domain Specialization: Methods optimized for industrial defects often fail on medical or logical anomalies.
  2. The "One-Category-One-Model" Paradigm: Systems typically require separate models for every object type, which is difficult to scale.
  3. Data Hunger: Traditional models require hundreds of normal samples, which are often unavailable in real-world scenarios.

UniVAD addresses these issues by proposing a unified, training-free architecture that generalizes across different fields without retraining.

Methodology

UniVAD compares a "query" image against a few "normal" reference images using three primary modules:

The UniVAD architecture featuring Contextual Component Clustering, Component-Aware Patch Matching, and Graph-Enhanced Component Modeling.

Contextual Component Clustering ($C^3$)

Instead of global image analysis, UniVAD breaks images down into components. It utilizes foundation models like the Recognize Anything Model (RAM) and Grounded SAM to identify and mask individual segments. K-means clustering ensures these segments remain consistent across different images.

Component-Aware Patch Matching (CAPM)

Standard VAD methods often suffer from "false matches" between unrelated image patches. CAPM restricts matching to the same component type (e.g., comparing a bolt only to a bolt). It also incorporates CLIP-style image-text similarity to identify anomalies based on linguistic descriptions.

Graph-Enhanced Component Modeling (GECM)

To handle "logical" anomalies—where parts are present but incorrectly arranged—GECM treats components as nodes in a graph. Using a Graph Attention Network, it models relationships such as position and area, allowing the detection of missing or misplaced components.

Experiments and Datasets

UniVAD was evaluated across nine datasets in three distinct domains:

  • Industrial: MVTec-AD and VisA.
  • Logical: MVTec LOCO.
  • Medical: BrainMRI, LiverCT, Retinal RESC, ChestXray, HIS, and OCT17. The model was also tested on real-world wood defect and crack segmentation tasks to verify its practical viability.

Key Results

UniVAD establishes a new benchmark for few-shot anomaly detection, maintaining consistent performance across all tested domains using the same model weights.

Radar chart comparing UniVAD's performance against state-of-the-art models across industrial, logical, and medical datasets.
  • 1-Shot Performance: On MVTec-AD, UniVAD achieved an image-level AUC of 97.8%, significantly outperforming previous methods like PatchCore (84.0%).
  • Cross-Domain Mastery: It surpassed specialized medical models on datasets like LiverCT (70.0% AUC vs. 40.5% for MedCLIP) without domain-specific training.
  • Logical Reasoning: On MVTec LOCO, it achieved 71.0% AUC, outperforming general-purpose models that struggle with structural logic.

Discussion and Conclusion

UniVAD demonstrates that semantic constraints and foundation models can effectively replace domain-specific training for VAD. By forcing "like-with-like" comparisons through component-aware matching, the model reduces false positives in complex scenes.

However, limitations remain. The reliance on heavy foundation models (RAM, SAM, DINOv2) introduces computational latency, which may be a hurdle for high-speed industrial applications. Additionally, performance is tied to the quality of the initial component segmentation. Future work will focus on lightweight foundation models and improving adapter modules for enhanced domain adaptation.

Summary updated

BibTeX
@inproceedings{gu2025univad,
  author = {Zhaopeng Gu and Bingke Zhu and Guibo Zhu and Yingying Chen and Ming Tang and Jinqiao Wang},
  title = {{UniVAD: A Training-free Unified Model for Few-shot Visual Anomaly Detection}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.01415},
}
Figure