Abstract
Zero-shot anomaly segmentation (ZSAS) aims to identify and localize defects in industrial products without any prior training on the specific object categories. While Contrastive Language-Image Pre-training (CLIP) models have shown promise in this domain, they typically rely on manually crafted, category-specific text prompts. This dependency introduces challenges regarding data privacy, category ambiguity, and prompt sensitivity. We present VCP-CLIP, a framework that replaces manual text prompts with "visual context prompts" derived directly from the input image. By dynamically aligning text embeddings with visual features through Pre-VCP and Post-VCP modules, VCP-CLIP achieves state-of-the-art performance across multiple industrial benchmarks without requiring prior knowledge of the product category.
Introduction
In industrial visual inspection, the ability to detect defects on a brand-new product without training data—the "holy grail" of Zero-Shot Anomaly Segmentation—is critical for flexible manufacturing. Recent advancements have leveraged the CLIP vision-language model, which possesses a broad understanding of "normal" versus "damaged" states. However, existing CLIP-based methods face a significant bottleneck: they require product-specific text prompts (e.g., "a photo of wood").
This reliance creates two primary hurdles. First, in many industrial settings, the specific category of a product may be unknown or restricted due to privacy concerns. Second, static text prompts often fail to capture the inherent variability within a category; a "bottle" may be glass, plastic, or various colors, leading to poor alignment and "hallucinated" anomalies. VCP-CLIP addresses these issues by shifting the burden of context from the user to the image itself.
Methodology
VCP-CLIP introduces a visual context prompting mechanism that allows the model to "see" the object type before attempting to describe its condition. The architecture consists of three core components:
Pre-Visual Context Prompting (Pre-VCP)
Instead of requiring a manual label like "wood," the Pre-VCP module extracts global features from the input image. These features are mapped into the word embedding space using a lightweight "Mini-Net." This process provides the text encoder with the necessary object context automatically, ensuring the model knows what it is looking at before processing the anomaly descriptions.
Post-Visual Context Prompting (Post-VCP)
Anomaly detection requires high-resolution, fine-grained detail. The Post-VCP module utilizes a multi-head attention mechanism to refine text embeddings based on local, dense image features. This ensures that the descriptions of "normal" and "abnormal" states are dynamically adjusted to the specific textures and colors of the current image, reducing the sensitivity to generic text descriptions.
Deep Text Prompting (DTP)
To ensure the text encoder fully integrates this visual information, the authors implement Deep Text Prompting. Rather than only inserting learnable embeddings at the input layer, DTP inserts them into every layer of the CLIP text encoder, allowing for more robust semantic activation throughout the model's hierarchy.
Experimental Setup and Results
The model was evaluated on a comprehensive suite of 10 real-world industrial datasets, including the industry-standard MVTec-AD and VisA, as well as specialized sets like BSD (ball bearings), GC (steel surfaces), and Road (cracks). The evaluation followed a strict zero-shot protocol: the model was trained on a limited set of "seen" products and tested on entirely "unseen" categories.
Performance Benchmarks
VCP-CLIP established new state-of-the-art (SOTA) results for ZSAS:
- MVTec-AD: Achieved a pixel-level AUROC of 92.0% and an Average Precision (AP) of 49.4%, significantly outperforming previous methods such as WinCLIP and AnVoL.
- VisA: Reached 95.7% AUROC, demonstrating strong performance on complex objects with multiple components.
- Efficiency: The model maintains an inference time of approximately 127ms per image, making it suitable for real-time industrial applications.
Discussion and Insights
The success of VCP-CLIP highlights that the image itself contains the most effective "prompt" for the text encoder. By anchoring text to visual evidence, the model becomes more stable; traditional methods often see performance swings of ±8% based on minor wording changes (e.g., "bottle" vs. "container"), a volatility VCP-CLIP avoids. Furthermore, the authors argue that visual context "activates" CLIP’s latent ability to perceive anomalous semantics that are often buried under generic category descriptions.
Limitations and Future Work
Despite its performance, VCP-CLIP has limitations. It occasionally "over-segments" minor anomalies due to its patch-based processing, marking areas slightly larger than the actual defect. Additionally, it struggles with "logical" or structural anomalies—such as a missing component on a PCB—because it lacks a "perfect" template of the specific product to compare against. Future research may explore few-shot techniques, where providing the model with a few "normal" examples of a new product could help bridge the gap for structural defect detection.
Conclusion
VCP-CLIP represents a significant step forward in zero-shot industrial inspection. By automating context through visual prompting, it removes the need for manual labeling and improves the robustness of CLIP-based anomaly detection, paving the way for more autonomous and privacy-preserving inspection systems.
Summary updated