Anomaly detectors are widely used in industrial production to detect and localize unknown defects in query images. These detectors are trained on nominal images and have shown success in distinguishing anomalies from most normal samples. However, hard-nominal examples are scattered and far apart from most normalities, they are often mistaken for anomalies by existing anomaly detectors. To address this problem, we propose a simple yet efficient method: \textbf{H}ard Nominal \textbf{E}xample-aware \textbf{T}emplate \textbf{M}utual \textbf{M}atching (HETMM). Specifically, \textit{HETMM} aims to construct a robust prototype-based decision boundary, which can precisely distinguish between hard-nominal examples and anomalies, yielding fewer false-positive and missed-detection rates. Moreover, \textit{HETMM} mutually explores the anomalies in two directions between queries and the template set, and thus it is capable to capture the logical anomalies. This is a significant advantage over most anomaly detectors that frequently fail to detect logical anomalies. Additionally, to meet the speed-accuracy demands, we further propose \textbf{P}ixel-level \textbf{T}emplate \textbf{S}election (PTS) to streamline the original template set. \textit{PTS} selects cluster centres and hard-nominal examples to form a tiny set, maintaining the original decision boundaries. Comprehensive experiments on five real-world datasets demonstrate that our methods yield outperformance than existing advances under the real-time inference speed. Furthermore, \textit{HETMM} can be hot-updated by inserting novel samples, which may promptly address some incremental learning issues.
翻译:异常检测器广泛应用于工业生产中,用于检测和定位查询图像中的未知缺陷。这类检测器基于正常图像进行训练,在区分异常与大多数正常样本方面已取得显著成效。然而,困难正常样本分布稀疏且远离多数正常特征,现有异常检测器常将其误判为异常。为解决这一问题,我们提出一种简洁高效的方法:困难正常样本感知的模板互匹配(HETMM)。具体而言,HETMM旨在构建基于稳健原型的决策边界,能够精确区分困难正常样本与异常,从而降低误检率和漏检率。此外,HETMM通过查询图像与模板集之间的双向互探索机制捕捉异常特征,尤其擅长检测逻辑异常——这是多数异常检测器难以突破的瓶颈。为兼顾速度与精度,我们进一步提出像素级模板选择(PTS)方法,通过选取聚类中心与困难正常样本构建精简模板集,在保持原始决策边界的同时压缩数据规模。在五个真实数据集上的综合实验表明,所提方法在实时推理速度下性能超越现有先进方法。更为重要的是,HETMM支持通过插入新样本实现热更新,可快速应对增量学习场景的部分挑战。