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)以精简原始模板集。PTS通过选取聚类中心和困难正常样本形成小型集合,保持原有决策边界。在五个真实世界数据集上的全面实验表明,本方法在实时推理速度下优于现有先进技术。此外,HETMM可通过插入新样本进行热更新,从而快速应对增量学习问题。