The official repository for RAID: Retrieval-Augmented Anomaly Detection, accepted at IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR 2026).
We propose RAID, a retrieval-augmented UAD framework designed for noise-resilient anomaly detection and localization. Unlike standard RAG that enriches context or knowledge, we focus on using retrieved normal samples to guide noise suppression in anomaly map generation. RAID retrieves class-, semantic-, and instance-level representations from a hierarchical vector database, forming a coarse-to-fine pipeline. A matching cost volume correlates the input with retrieved exemplars, followed by a guided Mixture-of-Experts (MoE) network that leverages the retrieved samples to adaptively suppress matching noise
and produce fine-grained anomaly maps.
Create a new conda environment and install the required packages using the environment.yml file
conda env create -f environment.ymlDownload and prepare the datasets MVTec-AD and VisA from their official sources.
python run_train_visa.py --dataset VisA --num_seeds 1 --preprocess masking_onlyor
python run_train_mvtec.py --dataset MVTec --num_seeds 1 --preprocess masking_onlyThis project is licensed under the MIT License - see the LICENSE file for details.
- Nov 13, 2025 β Paper submitted to CVPR 2026
- Feb 22, 2026 β Paper accepted π
- Feb 23, 2026 β Paper released on arXiv
- Apr 12, 2026 β Code released
We sincerely thank AnomalyDINO and CostFilter-AD for their concise, effective, and well-organized implementations.
If you find this repository useful in your research/project, please consider citing the paper:
@article{cai2026raid,
title={RAID: Retrieval-Augmented Anomaly Detection},
author={Cai, Mingxiu and Zhang, Zhe and Wu, Gaochang and Chai, Tianyou and Zhu, Xiatian},
journal={arXiv preprint arXiv:2602.19611},
year={2026}
}