AdaCLIP: Adapting CLIP with Hybrid Learnable Prompts for Zero-Shot Anomaly Detection

Yunkang Cao, Jiangning Zhang, Luca Frittoli, Yuqi Cheng, Weiming Shen, Giacomo Boracchi

arXiv:2407.15795 · 2026-07-27 공개 · arXiv · PDF

anomaly-detection vision-language-model clip pre-trained-model industrial-applications medical-applications zero-shot-anomaly-detection hybrid-prompts

Abstract

Zero-shot anomaly detection (ZSAD) targets the identification of anomalies within images from arbitrary novel categories. This study introduces AdaCLIP for the ZSAD task, leveraging a pre-trained vision-language model (VLM), CLIP. AdaCLIP incorporates learnable prompts into CLIP and optimizes them through training on auxiliary annotated anomaly detection data. Two types of learnable prompts are proposed: static and dynamic. Static prompts are shared across all images, serving to preliminarily adapt CLIP for ZSAD. In contrast, dynamic prompts are generated for each test image, providing CLIP with dynamic adaptation capabilities. The combination of static and dynamic prompts is referred to as hybrid prompts, and yields enhanced ZSAD performance. Extensive experiments conducted across 14 real-world anomaly detection datasets from industrial and medical domains indicate that AdaCLIP outperforms other ZSAD methods and can generalize better to different categories and even domains. Finally, our analysis highlights the importance of diverse auxiliary data and optimized prompts for enhanced generalization capacity. Code is available at https://github.com/caoyunkang/AdaCLIP.

한국어 요약

한 줄 요약

AdaCLIP은 CLIP에 하이브리드 학습 가능한 프롬프트를 결합해 제로샷 이상 탐지 성능을 향상시키는 모델이다.

핵심 기여도

핵심 아이디어

AdaCLIP은 CLIP의 제로샷 학습 원리를 기반으로, **학습 가능한 프롬프트**(prompting)와 **프로젝션**(projection) 레이어를 추가하여 모델을 ZSAD에 최적화한다. 기존 ZSAD 방법은 CLIP을 그대로 사용하거나, 단순 텍스트 프롬프트만 사용해 성능 한계가 있었으나, AdaCLIP은 **정적**(static)과 **동적**(dynamic) 프롬프트를 결합한 **하이브리드 프롬프트**(hybrid prompts)를 도입한다. 정적 프롬프트는 모든 이미지에 공유되어 CLIP을 ZSAD에 사전 적응시키고, 동적 프롬프트는 테스트 이미지에 따라 생성되어 **동적 적응**(dynamic adaptation)을 가능하게 한다. 이는 기존 정적 프롬프트만 사용하는 방법(V1)이나 동적 프롬프트만 사용하는 방법(V3)보다 더 높은 성능을 보인다. 또한, **HSF**(Hybrid-Semantic Fusion) 모듈을 통해 패치 수준 이상 정보를 이미지 수준으로 집약하여, 전체 이미지의 이상 여부를 정확히 판단한다.

기술적 접근법

주요 결과

의의 및 한계

AdaCLIP은 CLIP과 같은 사전 학습된 시각-언어 모델(VLM)을 ZSAD에 효과적으로 적응시키는 새로운 방법을 제시한다. 특히, **하이브리드 프롬프트**와 **HSF 모듈**을 통해 기존 ZSAD 방법 대비 더 높은 일반화 능력을 보인다. 또한, 다양한 **보조 데이터**(auxiliary data)를 활용함으로써, 새로운 범주와 도메인에 대한 탐지 성능을 향상시킬 수 있다. 그러나, 테스트 데이터가 보조 훈련 데이터와 **매우 다를 경우 성능 저하**가 발생할 수 있으며, 이는 모든 ZSAD 방법의 한계로 작용한다. 또한, 프롬프트 수와 깊이가 증가할수록 **과적합**(overfitting) 위험이 있으므로, 적절한 하이퍼파라미터 설정이 필요하다.

실용적 활용

AdaCLIP은 **의료 이미지**(예: 병변 탐지)와 **산업 검사**(예: 제품 결함 탐지) 등에서 **무참조**(zero-reference) 환경에서도 이상 탐지를 수행할 수 있어, **데이터 수집이 어려운 신규 범주**에 적용 가능하다. 또한, **다양한 도메인 간 일반화**가 가능하므로, **다양한 산업 분야에서 즉시 활용**할 수 있는 유연한 모델로 활용될 수 있다.