Skip to content

Official implementation of the paper 'GlocalCLIP: Object-agnostic Global-Local Prompt Learning for Zero-shot Anomaly Detection'

Notifications You must be signed in to change notification settings

YUL-git/GlocalCLIP

Repository files navigation

GlocalCLIP

by Jiyul Ham, Yonggon Jung, Jun-Geol Baek

Introduction

Zero-shot anomaly detection (ZSAD) plays a vital role in identifying anomalous patterns in target datasets without relying on training samples. Recently, pre-trained vision-language models demonstrated strong zero-shot performance across various visual tasks, which accelerate ZSAD. However, their focus on learning class semantics makes their direct application to ZSAD challenging. To address this scenario, we propose GlocalCLIP, which uniquely separates global and local prompts and jointly optimizes them. First, we design object-agnostic semantic prompts to detect fine-grained anomalous patterns. Then, we build a global-local branch, where the global prompt is optimized for detecting normal and anomalous patterns, and the local prompt focuses on anomaly localization. Finally, we introduce glocal contrastive learning to enhance the complementary interaction between global and local prompts, enabling more effective detection of anomalous patterns across diverse domains. The generalization performance of GlocalCLIP was demonstrated on 15 real-world datasets from both the industrial and medical domains, achieving superior performance compared to existing methods.

overview

Overview of GlocalCLIP

overview

Motivation of GlocalCLIP

Fig1

Quantitative results

overview

Table 2 Table 3

Additional qualitative results of GlocalCLIP

overview overview overview overview overview overview overview overview

Reproducibility

Implementation environment

  • Ubuntu==22.04.1 LTS
  • cuda==12.1.0
  • cudnn==8
  • python==3.10.15
  • pytorch==2.5.1

Create anaconda enviornment

conda env create --file GlocalCLIP_env.tml

First, download MVTecAD and VisA datasets. and then generate json files.

cd generate_dataset_json
python mvtec.py
python visa.py

Second, run GlocalCLIP python file.

bash train.sh

Acknowledgement

🤗 Thanks for the OpenCLIP, AnomalyCLIP

About

Official implementation of the paper 'GlocalCLIP: Object-agnostic Global-Local Prompt Learning for Zero-shot Anomaly Detection'

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published