Logical Anomaly Detection with Masked Image Modeling
Abstract
Detecting anomalies such as an incorrect combination of objects or deviations in their positions is a challenging problem in unsupervised anomaly detection (AD). Since conventional AD methods mainly focus on local patterns of normal images, they struggle with detecting logical anomalies that appear in the global patterns. To effectively detect these challenging logical anomalies, we introduce \textbf{L}ogical \textbf{A}nomaly \textbf{D}etection with \textbf{M}asked \textbf{I}mage \textbf{M}odeling (\textbf{LADMIM}), a novel unsupervised AD framework that harnesses the power of masked image modeling and discrete representation learning. Our core insight is that predicting the missing region forces the model to learn the long-range dependencies between patches. Specifically, we formulate AD as a mask completion task, which predicts the distribution of discrete latents in the masked region. As a distribution of discrete latents is invariant to the low-level variance in the pixel space, the model can desirably focus on the logical dependencies in the image, which improves accuracy in the logical AD. We evaluate the AD performance on five benchmarks and show that our approach achieves compatible performance without any pre-trained segmentation models. We also conduct comprehensive experiments to reveal the key factors that influence logical AD performance. Code is available at: \url{https://github.com/SkyShunsuke/LADMIM}.
Cite
Text
Sakai et al. "Logical Anomaly Detection with Masked Image Modeling." Transactions on Machine Learning Research, 2026.Markdown
[Sakai et al. "Logical Anomaly Detection with Masked Image Modeling." Transactions on Machine Learning Research, 2026.](https://mlanthology.org/tmlr/2026/sakai2026tmlr-logical/)BibTeX
@article{sakai2026tmlr-logical,
title = {{Logical Anomaly Detection with Masked Image Modeling}},
author = {Sakai, Shunsuke and Hasegawa, Tatsuhito and Koshino, Makoto},
journal = {Transactions on Machine Learning Research},
year = {2026},
url = {https://mlanthology.org/tmlr/2026/sakai2026tmlr-logical/}
}