CostFilter-AD: Enhancing Anomaly Detection Through Matching Cost Filtering
Abstract
Unsupervised anomaly detection (UAD) seeks to localize the anomaly mask of an input image with respect to normal samples. Either by reconstructing normal counterparts (reconstruction-based) or by learning an image feature embedding space (embedding-based), existing approaches fundamentally rely on image-level or feature-level matching to derive anomaly scores. Often, such a matching process is inaccurate yet overlooked, leading to sub-optimal detection. To address this issue, we introduce the concept of cost filtering, borrowed from classical matching tasks, such as depth and flow estimation, into the UAD problem. We call this approach CostFilter-AD. Specifically, we first construct a matching cost volume between the input and normal samples, comprising two spatial dimensions and one matching dimension that encodes potential matches. To refine this, we propose a cost volume filtering network, guided by the input observation as an attention query across multiple feature layers, which effectively suppresses matching noise while preserving edge structures and capturing subtle anomalies. Designed as a generic post-processing plug-in, CostFilter-AD can be integrated with either reconstruction-based or embedding-based methods. Extensive experiments on MVTec-AD and VisA benchmarks validate the generic benefits of CostFilter-AD for both single- and multi-class UAD tasks. Code and models will be released at https://github.com/ZHE-SAPI/CostFilter-AD.
Cite
Text
Zhang et al. "CostFilter-AD: Enhancing Anomaly Detection Through Matching Cost Filtering." Proceedings of the 42nd International Conference on Machine Learning, 2025.Markdown
[Zhang et al. "CostFilter-AD: Enhancing Anomaly Detection Through Matching Cost Filtering." Proceedings of the 42nd International Conference on Machine Learning, 2025.](https://mlanthology.org/icml/2025/zhang2025icml-costfilterad/)BibTeX
@inproceedings{zhang2025icml-costfilterad,
title = {{CostFilter-AD: Enhancing Anomaly Detection Through Matching Cost Filtering}},
author = {Zhang, Zhe and Cai, Mingxiu and Wang, Hanxiao and Wu, Gaochang and Chai, Tianyou and Zhu, Xiatian},
booktitle = {Proceedings of the 42nd International Conference on Machine Learning},
year = {2025},
pages = {74540-74564},
volume = {267},
url = {https://mlanthology.org/icml/2025/zhang2025icml-costfilterad/}
}