Kernel-Aware Graph Prompt Learning for Few-Shot Anomaly Detection [AAAI 2025]

December 20, 2024 ยท View on GitHub

Fenfang Tao, Guo-Sen Xie1, Fang Zhao, Xiangbo Shu.

Overview of KAG-prompt

Overview of KAG-prompt

How to Run

Environment installation

Install the required packages:

pip install -r requirements.txt

Prepare your dataset

You can download MVTec-AD dataset from [this link] and VisA from [this link]. After downloading, please modify the corresponding data loading path.

Prepare checkpoint

You can download the pre-trained ImageBind model using [this link]. After downloading, put the downloaded file (imagebind_huge.pth) in [./pretrained_ckpt/imagebind_ckpt/] directory.

You can download the the pre-trained weights using [this link] and [this link]. After downloading, place them into [./code/ckpt/train_mvtec] and [./data//ckpt/train_visa] directory respectively.

Test

  • Quick start (use the pre-trained weights)
cd /KAG-prompt/code
python test_visa.py
pyhton test_mvtec.py

Train your KAG-prompt

bash ./scripts/train_mvtec.sh
bash ./scripts/train_visa.sh