[CVPR2026] InvAD: Inversion-based Reconstruction-Free Anomaly Detection with Diffusion Models

February 27, 2026 · View on GitHub

arXiv  Project Page AlphaArXiv

This is an official PyTorch implementation of the paper InvAD:Reconstruction-Free Anomaly Detection with Diffusion Models accepted at CVPR 2026:

@article{sakai2026invnad,
      title={InvAD: Inversion-based Reconstruction-Free Anomaly Detection with Diffusion Models}, 
      author={Shunsuke Sakai, Xiangteng He, Chunzhi Gu, Leonid Sigal, Tatsuhito Hasegawa},
      year={2026},
      booktitle={Proceedings of the Computer Vision and Pattern Recognition Conference},
      year={2026}
}

Preparation

Installation

Download the code:

git clone https://github.com/SkyShunsuke/InversionAD.git
cd InversionAD

A suitable conda environment named invad can be created and activated with:

conda env create -f environment.yaml
conda activate invad

For pip installation, you can install the required packages with:

pip install -r requirements.txt

Set up for Evaluation

To run the evaluation, you need to install the adeval package. You can do this by running the following command:

cd src && git clone https://github.com/winggan/adeval.git && cd ..

Dataset

Download MVTecAD dataset with the following command:

bash scripts/download_datasets.sh

and place it in the data directory.

Wandb Logging [Optional]

If you want to use Weights & Biases for logging, please make .env file in the root directory and set your wandb API key as follows:

WANDB_API_KEY=your_api_key

You can get your API key from here. You can also set the project name and entity from the .env file:

WANDB_PROJECT=your_project_name
WANDB_ENTITY=your_entity_name

Usage

Training

To train the model, run the following command:

bash scripts/train.sh

This will train the model on the MVTecAD dataset. The training process will save the model checkpoints in the results directory.

And you can change training parameters in configs/xxx.yaml file.

⚠️ NOTE — Training requirements

Training diffusion models requires significant compute. We recommend a machine with at least 24 GB of GPU memory. You do not need H200 GPUs as used in the paper — any GPU with larger memory will make training easier. To reduce memory requirements consider using mixed precision (AMP), smaller batch sizes, or gradient accumulation.

Evaluation

To evaluate the model, run the following command:

bash scripts/eval.sh

This will evaluate the model on the MVTecAD dataset.

Pre-trained Models

We provide pre-trained models for accelerating reproduction process. You can download the pre-trained models from Google Drive and place them in the weights directory.

Loaded weights and configs are compressed in the weights/[model_name]_[dataset].zip file. You need to unzip them before evaluation. Then, you can specify the model name and dataset in the scripts/eval.sh file.

For now, we only provide models for multi-class AD on following datasets:

  • MVTecAD
  • VisA
  • MPDD

If you want to get the access to the other pre-trained models, including single-class AD models, Real-IAD/BMAD models, ablation models, please contact me via email(sshunsuke0102@gmail.com) or build issue.

Acknowledgements

We thank for very nice diffusion implementation from OpenAI.

Contact

If you have any questions, feel free to contact me through email (sshunsuke0102@gmail.com).