Recent advances in vision-language models have facilitated zero-shot anomaly detection (ZSAD) through transferable visual-semantic representations. However, detecting fine-grained anomalies remains challenging due to inadequate modeling of diverse anomaly patterns and their spatial context. To address these challenges, we propose SCRA-CLIP, a Spherical-Contextual Representation Adaptation framework that jointly enhances anomaly-aware textual semantics and context-sensitive visual representations. Specifically, we introduce Spherical Prototype-Conditioned Prompting (SPCP), which employs von Mises--Fisher mixtures to model the directional distributions of normal and abnormal patch features. These state-specific prototypes are incorporated into textual contexts to guide the learning of more discriminative textual representations. Furthermore, we develop Context-Deviation Guided Visual Adaptation (CGVA), which captures local feature deviations relative to multi-scale neighborhood contexts and refines patch representations through adaptive gating. By integrating distribution-aware semantic modeling with context-sensitive visual adaptation, SCRA-CLIP facilitates more discriminative cross-modal matching for fine-grained anomaly detection and localization. Extensive experiments on 11 industrial and medical benchmarks demonstrate the effectiveness and generalization capability of SCRA-CLIP across diverse unseen categories and domains. The code will be publicly available upon publication.
Figures & tables
Figure 1: Comparison of existing CLIP-based ZSAD methods and SCRA-CLIP. (a) Existing methods rely on image-text matching with limited local semantic and contextual modeling. (b) SCRA-CLIP enhances anomaly discrimination through spherical prototype modeling and context-guided visual adaptation.
Figure 2: Overall architecture of SCRA-CLIP. SPCP learns state-specific spherical prototypes to enhance anomaly-aware textual representations, while CGVA refines local visual features through multi-scale context-deviation modeling and constrained residual adaptation. Their complementary adaptation improves cross-modal matching for zero-shot anomaly detection and localization.
Method
Venue
Industrial Defects
Medical Anomalies
VisA
MVTec-AD
BTAD
DAGM
DTD-Synthetic
ISIC
CVC-ClinicDB
Kvasir
CLIP [ 26 ]
ICML’21
46.6
38.4
30.6
30.6
33.9
33.1
47.5
44.6
CoOp [ 37 ]
IJCV’22
24.2
33.3
15.4
17.5
66.5
51.7
34.8
44.1
WinCLIP [ 16 ]
CVPR’23
79.6
85.1
72.7
87.6
83.9
83.3
51.2
69.7
CLIP-AD [ 6 ]
IJCAI’24
95.0
89.8
93.1
96.5
97.1
81.6
85.8
82.5
AnomalyCLIP [ 38 ]
ICLR’24
95.5
91.1
94.2
95.6
97.9
88.4
82.9
78.9
Table 1: Comparison of pixel-level AUROC (%) on industrial and medical anomaly detection datasets. The best and second-best results are highlighted in bold and underlined, respectively.
Method
Venue
Industrial Defects
Medical Anomalies
VisA
MVTec-AD
BTAD
DAGM
DTD-Synthetic
HeadCT
BrainMRI
Br35H
CLIP [ 26 ]
ICML’21
66.4
74.1
34.5
79.6
71.6
56.5
73.9
78.4
CoOp [ 37 ]
IJCV’22
62.8
88.8
66.8
87.5
63.4
78.4
61.3
86.0
WinCLIP [ 16 ]
CVPR’23
78.8
91.8
68.2
91.8
93.2
83.7
86.6
80.5
CLIP-AD [ 6 ]
IJCAI’24
79.8
89.8
85.8
90.8
91.5
93.8
92.8
96.0
AnomalyCLIP [ 38 ]
ICLR’24
82.1
91.5
88.3
97.5
93.5
95.3
90.3
94.6
Table 2: Comparison of image-level AUROC (%) on industrial and medical anomaly detection datasets. The best and second-best results are highlighted in bold and underlined, respectively.
Figure 3: Qualitative comparison of anomaly localization results on industrial and medical datasets.
SPCP
CGVA
MVTec-AD
VisA
I-AUROC
P-AUROC
I-AUROC
P-AUROC
✗
✗
89.0
90.3
84.1
94.5
✓
✗
91.7
90.9
86.7
94.9
✗
✓
90.3
91.7
85.6
95.6
✓
✓
92.4
92.3
87.2
96.0
Table 3: Ablation study of SPCP and CGVA on MVTec-AD and VisA. I-AUROC and P-AUROC denote image-level and pixel-level AUROC (%), respectively.
Prototype Modeling
MVTec-AD
VisA
I-AUROC
P-AUROC
I-AUROC
P-AUROC
K-means Prototypes
90.6
91.1
85.1
94.9
Learnable Prototypes
90.9
91.5
85.8
95.3
Spherical Prototypes
91.8
91.9
86.5
95.3
vMF Mixture (Ours)
92.4
92.3
87.2
96.0
Table 4: Comparison of different prototype modeling strategies on MVTec-AD and VisA. I-AUROC and P-AUROC denote image-level and pixel-level AUROC (%), respectively.
Figure 4: Qualitative comparison of anomaly localization results with and without CGVA. Zoomed-in views show the predicted anomaly responses and corresponding GT boundaries.
K
MVTec-AD
VisA
I-AUROC
P-AUROC
I-AUROC
P-AUROC
4
91.3
91.5
85.8
95.3
8
91.9
92.0
86.5
95.7
16
92.4
92.3
87.2
96.0
32
92.3
92.4
87.0
95.9
64
92.1
92.2
86.9
95.6
Table 5: Sensitivity analysis of the number of prototypes K .
Figure 5: Image–text similarity margin distributions for normal and anomalous samples in the zipper (top row) and pill (bottom row) categories of MVTec-AD, with and without SPCP.
Lvmf
Ldisc
MVTec-AD
VisA
I-AUROC
P-AUROC
I-AUROC
P-AUROC
✗
✗
91.2
91.8
86.0
95.5
✗
✓
91.8
91.9
86.6
95.6
✓
✗
91.5
92.1
86.3
95.8
✓
✓
92.4
92.3
87.2
96.0
Table 6: Ablation of individual auxiliary losses in SPCP.
Vision-language models offer a promising approach for zero-shot anomaly detection (ZSAD). However, due to object-centric bias, normal and anomalous text prototypes exhibit a high semantic overlap. While enforcing strict orthogonality between them improves discriminability, mapping highly contiguous visual inputs onto drastically orthogonal prototypes introduces a geometric dilemma, disrupting the pre-trained structural continuity. To address this problem, we propose Proximity-CLIP, a framework that visually calibrates the semantic margin to guide visual adaptation. First, we introduce a visually-calibrated semantic proximity learning mechanism that uses a bounded dynamic regularization to learn an appropriate semantic margin, ensuring discriminative separation while preserving structural alignment. Second, we design an Anomaly Query Module (AQM) driven by these text priors. Using the calibrated anomalous prototype as a semantic query, the AQM actively retrieves localized defect cues from contextual visual patches, mitigating the dilution of subtle anomalies during global pooling. Extensive experiments demonstrate that Proximity-CLIP outperforms current state-of-the-art methods across multiple ZSAD benchmarks with minimal architectural modifications.
Manwen Yang, Leqian Ding, Yu Guo +1
School of Software Engineering, Xi’an Jiaotong University · State Key Laboratory of Human-Machine Hybrid Augmented Intelligence, Institute of Artificial Intelligence and Robotics, Xi’an Jiaotong University
Zero-shot anomaly detection (ZSAD) aims to detect and localize anomalies in unseen categories without access to target-specific training data. Although recent CLIP-based methods have demonstrated promising generalization through vision-language alignment, they remain limited in capturing diverse anomaly semantics and subtle local variations. To address these limitations, we propose VFAD, a unified framework that combines variational semantic prompting with frequency-adaptive representation learning. Specifically, we introduce a Variational Semantic Prompt Extractor (VSPE), which adaptively aggregates anomaly-relevant local semantics from dense patch tokens and regularizes them through a variational information bottleneck, thereby incorporating fine-grained visual cues and enabling more precise cross-modal alignment. Furthermore, we develop a Frequency-Adaptive Representation Aggregation (FARA) module that leverages wavelet-based frequency decomposition and frequency-specific expert aggregation to enhance anomaly-discriminative visual representations. By jointly strengthening semantic guidance and visual representation learning, VFAD improves both anomaly discrimination and fine-grained localization. Extensive experiments on 13 industrial and medical benchmarks demonstrate that VFAD consistently outperforms existing state-of-the-art ZSAD methods across diverse anomaly scenarios. The code will be publicly available upon publication.
Peng Chen, Kaige Li, Wei Wang +5
School of Cyber Science and Technology, Shenzhen Campus of Sun Yat-sen University, Shenzhen, China
Fine-grained anomaly detection is crucial in industrial and medical applications, but labeled anomalies are often scarce, making zero-shot detection challenging. While vision-language models like CLIP offer promising solutions, they struggle with foreground-background feature entanglement and coarse textual semantics. We propose FB-CLIP, a framework that enhances anomaly localization via multi-strategy textual representations and foreground-background separation. In the textual modality, it combines End-of-Text features, global-pooled representations, and attention-weighted token features for richer semantic cues. In the visual modality, multi-view soft separation along identity, semantic, and spatial dimensions, together with background suppression, reduces interference and improves discriminability. Semantic Consistency Regularization (SCR) aligns image features with normal and abnormal textual prototypes, suppressing uncertain matches and enlarging semantic gaps. Experiments show that FB-CLIP effectively distinguishes anomalies from complex backgrounds, achieving accurate fine-grained anomaly detection and localization under zero-shot settings.
Ming Hu, Yongsheng Huo, Mingyu Dou +6
Xi’an Institute of Optics and Precision Mechanics, Chinese Academy of Sciences · University of Chinese Academy of Sciences · Xi’an Jiaotong University +1