giddyyupp/DIVAD

[ICPR 2026] Training Free Zero-Shot Visual Anomaly Localization via Diffusion Inversion

13

stars

4

commits

Python

primary language

Aug 15, 2026

updated

README

📚 Training Free Zero-Shot Visual Anomaly Localization via Diffusion Inversion

Samet Hicsonmez#, Abd El Rahman Shabayek#, Djamila Aouada#

#Interdisciplinary Centre for Security, Reliability, and Trust (SnT), University of Luxembourg,

arXiv License


🧠 Abstract

Zero-shot Visual Anomaly Detection (ZSAD) aims to detect and localize anomalies without access to any normal training samples. While recent ZSAD approaches leverage additional modalities such as language to generate fine-grained prompts for localization, vision-only methods remain limited to image-level classification, lacking spatial precision. In this work, we introduce a simple yet effective training-free vision-only ZSAD framework that circumvents the need for fine-grained prompts by leveraging the inversion of a pretrained Denoising Diffusion Implicit Model (DDIM). Specifically, given an input image and a generic text description (e.g., "an image of an [object class]"), we invert the image to obtain latent representations and initiate the denoising process from a fixed intermediate timestep to reconstruct the image. Since the underlying diffusion model is trained solely on normal data, this process yields a normal-looking reconstruction. The discrepancy between the input image and the reconstructed one highlights potential anomalies. Our method achieves performance on par with state-of-the-art ZSAD techniques, demonstrating strong localization capabilities without auxiliary modalities and facilitating a shift away from prompt dependence for anomaly detection research.


📦 Repository Overview

This repository contains the official implementation of the paper:

Training Free Zero-Shot Visual Anomaly Localization via Diffusion Inversion

[arXiv]


🚀 Features

  • 🔎 Training-free zero shot anomaly detection on [MVTec-AD / VISA / MPDD / BTAD] using Diffusion Inversion
  • 📈 Includes reproduction code
  • 🧪 Evaluation scripts for pixel- and image-level metrics

🖥️ Quick Start

1. Clone and Install

git clone https://gitlab.com/uniluxembourg/snt/cvi2/open/space/divad
cd divad

conda create -n divad python=3.10
conda activate divad
conda install pytorch==2.1.0 torchvision==0.16.0 pytorch-cuda=11.8 -c pytorch -c nvidia
pip install -r requirements.txt

2. Prepare Dataset

Download and organize the dataset as follows (e.g., MVTec-AD):

|-- /path/to/data/dir
    |-- mvtec_anomaly_detection
        |-- bottle
            |-- ground_truth
                |-- broken_large
                    |-- 000_mask.png
                |-- broken_small
                    |-- 000_mask.png
                |-- contamination
                    |-- 000_mask.png
            |-- test
                |-- broken_large
                    |-- 000.png
                |-- broken_small
                    |-- 000.png
                |-- contamination
                    |-- 000.png
                |-- good
                    |-- 000.png
            |-- train
                |-- good
                    |-- 000.png

3. Run the Inversion

python ddim_inversion.py --data_set mvtec --data_path /path/to/data/mvtec_anomaly_detection --save_inverted_image --nis 50 --inf_step 100 --ss 40 --sd_version 21

4. Evaluate the Performance

Optionally extract foreground masks from CutLER for the test images:

  • First download and setup CutLER repository following official instructions.
  • Copy cutler/demo_batch_mvtec_visa.py to the CutLER/cutler/demo folder.
  • Run below command:
python demo_batch_mvtec_visa.py --opts "MODEL.WEIGHTS" "../cutler_cascade_final.pth"

Run the inference and metric calculation:

python test.py --data_set mvtec --data_path /path/to/data/mvtec_anomaly_detection --use_dino --dino_version v1s8 --save_visuals --mask_dir /path/to/cutler_masks_mvtec --res_dir /path/to/save/results --input_dir /path/to/ddim_results

📊 Results

DatasetROCIROCPPRORAPPF1-maxP
MVTec-AD75.988.072.531.235.5
VISA69.793.478.219.524.0
MPDD63.494.982.022.927.0
BTAD79.868.429.113.119.1

📜 Citation

If you find this work useful, please cite:

@misc{hicsonmez2026training,
      title={Training Free Zero-Shot Visual Anomaly Localization via Diffusion Inversion}, 
      author={Samet Hicsonmez and Abd El Rahman Shabayek and Djamila Aouada},
      year={2026},
      eprint={2601.08022},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2601.08022}, 
}

🪪 License

This repository is licensed under the Apache License. See the LICENSE file for details.


🙏 Acknowledgements

This repo builds upon open-source contributions from:

Contributors

giddyyupp

4 commits

giddyyupp/DIVAD

[ICPR 2026] Training Free Zero-Shot Visual Anomaly Localization via Diffusion Inversion

13

stars

4

commits

Python

primary language

Aug 15, 2026

updated

README

📚 Training Free Zero-Shot Visual Anomaly Localization via Diffusion Inversion

Samet Hicsonmez#, Abd El Rahman Shabayek#, Djamila Aouada#

#Interdisciplinary Centre for Security, Reliability, and Trust (SnT), University of Luxembourg,

arXiv License


🧠 Abstract

Zero-shot Visual Anomaly Detection (ZSAD) aims to detect and localize anomalies without access to any normal training samples. While recent ZSAD approaches leverage additional modalities such as language to generate fine-grained prompts for localization, vision-only methods remain limited to image-level classification, lacking spatial precision. In this work, we introduce a simple yet effective training-free vision-only ZSAD framework that circumvents the need for fine-grained prompts by leveraging the inversion of a pretrained Denoising Diffusion Implicit Model (DDIM). Specifically, given an input image and a generic text description (e.g., "an image of an [object class]"), we invert the image to obtain latent representations and initiate the denoising process from a fixed intermediate timestep to reconstruct the image. Since the underlying diffusion model is trained solely on normal data, this process yields a normal-looking reconstruction. The discrepancy between the input image and the reconstructed one highlights potential anomalies. Our method achieves performance on par with state-of-the-art ZSAD techniques, demonstrating strong localization capabilities without auxiliary modalities and facilitating a shift away from prompt dependence for anomaly detection research.


📦 Repository Overview

This repository contains the official implementation of the paper:

Training Free Zero-Shot Visual Anomaly Localization via Diffusion Inversion

[arXiv]


🚀 Features

  • 🔎 Training-free zero shot anomaly detection on [MVTec-AD / VISA / MPDD / BTAD] using Diffusion Inversion
  • 📈 Includes reproduction code
  • 🧪 Evaluation scripts for pixel- and image-level metrics

🖥️ Quick Start

1. Clone and Install

git clone https://gitlab.com/uniluxembourg/snt/cvi2/open/space/divad
cd divad

conda create -n divad python=3.10
conda activate divad
conda install pytorch==2.1.0 torchvision==0.16.0 pytorch-cuda=11.8 -c pytorch -c nvidia
pip install -r requirements.txt

2. Prepare Dataset

Download and organize the dataset as follows (e.g., MVTec-AD):

|-- /path/to/data/dir
    |-- mvtec_anomaly_detection
        |-- bottle
            |-- ground_truth
                |-- broken_large
                    |-- 000_mask.png
                |-- broken_small
                    |-- 000_mask.png
                |-- contamination
                    |-- 000_mask.png
            |-- test
                |-- broken_large
                    |-- 000.png
                |-- broken_small
                    |-- 000.png
                |-- contamination
                    |-- 000.png
                |-- good
                    |-- 000.png
            |-- train
                |-- good
                    |-- 000.png

3. Run the Inversion

python ddim_inversion.py --data_set mvtec --data_path /path/to/data/mvtec_anomaly_detection --save_inverted_image --nis 50 --inf_step 100 --ss 40 --sd_version 21

4. Evaluate the Performance

Optionally extract foreground masks from CutLER for the test images:

  • First download and setup CutLER repository following official instructions.
  • Copy cutler/demo_batch_mvtec_visa.py to the CutLER/cutler/demo folder.
  • Run below command:
python demo_batch_mvtec_visa.py --opts "MODEL.WEIGHTS" "../cutler_cascade_final.pth"

Run the inference and metric calculation:

python test.py --data_set mvtec --data_path /path/to/data/mvtec_anomaly_detection --use_dino --dino_version v1s8 --save_visuals --mask_dir /path/to/cutler_masks_mvtec --res_dir /path/to/save/results --input_dir /path/to/ddim_results

📊 Results

DatasetROCIROCPPRORAPPF1-maxP
MVTec-AD75.988.072.531.235.5
VISA69.793.478.219.524.0
MPDD63.494.982.022.927.0
BTAD79.868.429.113.119.1

📜 Citation

If you find this work useful, please cite:

@misc{hicsonmez2026training,
      title={Training Free Zero-Shot Visual Anomaly Localization via Diffusion Inversion}, 
      author={Samet Hicsonmez and Abd El Rahman Shabayek and Djamila Aouada},
      year={2026},
      eprint={2601.08022},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2601.08022}, 
}

🪪 License

This repository is licensed under the Apache License. See the LICENSE file for details.


🙏 Acknowledgements

This repo builds upon open-source contributions from:

Contributors

giddyyupp

4 commits

Languages

Python

100.0%