Hard Nominal Example-aware Template Mutual Matching for Industrial Anomaly Detection

Zixuan Chen, Xiaohua Xie, Lingxiao Yang, Jianhuang Lai · DOI

Abstract

Industrial anomaly detection (IAD) typically operates as a one-class problem, where models are trained on abundant normal data to identify rare defects. However, existing detectors often struggle with "hard-normal" examples—healthy samples with rare but acceptable variations—leading to high false-positive rates. We introduce HETMM (Hard-normal Example-aware Template Mutual Matching), a training-free framework designed to address these challenges. By specifically identifying hard-normal samples and utilizing a bi-directional matching strategy, HETMM achieves state-of-the-art accuracy (99.8% AUROC on MVTec AD) while maintaining real-time performance at 26.1 FPS.

The Challenge: "Hard-Normal" and Logical Anomalies

In manufacturing, most normal samples are "easy"—they look nearly identical. However, some healthy products may be slightly rotated, shifted, or possess rare acceptable variations. Standard detectors often misclassify these outliers as defects. Furthermore, many methods fail to detect "logical anomalies," where individual components appear normal but are incorrectly placed or missing.

Comparison of existing methods vs. HETMM in handling hard-normal examples and defining decision boundaries.

As shown in the figure above, existing methods often create overly restrictive decision boundaries that exclude hard-normal examples. HETMM explicitly incorporates these outliers to define a more robust boundary, significantly reducing false alarms.

Methodology

HETMM consists of two primary innovations: Affine-invariant Template Mutual Matching (ATMM) and Pixel-level Template Selection (PTS).

Affine-invariant Template Mutual Matching (ATMM)

ATMM employs a bi-directional matching strategy to ensure both local consistency and global logical integrity:

  • Forward Matching: The system evaluates a patch in the query image against a local neighborhood in the normal template set, providing robustness to small shifts or rotations.
  • Backward Matching: The system takes a normal template and attempts to locate its components within the query image. If a required component is missing or misplaced, the backward match fails, allowing the model to detect complex logical anomalies that forward matching might overlook.
The HETMM pipeline, illustrating the integration of Forward and Backward ATM to produce a final anomaly score map.

Pixel-level Template Selection (PTS)

Storing every normal image as a template is computationally prohibitive. PTS compresses the template set into a "tiny set" (e.g., 60 images). Unlike standard methods that prioritize "average" images, PTS uses the OPTICS clustering algorithm to identify both cluster centers (easy-normals) and outliers (hard-normals). Retaining these hard-normals is essential for defining the true limits of acceptable variation.

Key Results and Insights

The researchers evaluated HETMM across six diverse datasets, including MVTec AD, VisA, and MVTec LOCO. Key findings include:

  • Superior Accuracy: HETMM achieved a 99.8% image-level AUROC on MVTec AD, outperforming established methods like PatchCore.
  • Real-Time Efficiency: By utilizing the PTS tiny set, the model achieved a 5x speedup over full-set matching, reaching 26.1 FPS on a Quadro 8000 GPU.
  • Sample Efficiency: The model demonstrates remarkable few-shot performance. With only 1 to 5 normal images, it significantly outperforms competitors in both defect detection and localization.
  • Zero Training: Because HETMM relies on template matching rather than weight optimization, it requires no training phase. New normal variations can be added to the template set for instant "hot-updates" on the assembly line.

Conclusion

HETMM shifts the focus of anomaly detection toward the importance of outliers. By treating hard-normal examples as critical boundary markers rather than noise, and employing a mutual matching strategy, it provides a robust, efficient, and easily updatable solution for modern industrial quality control.

Summary updated

BibTeX
@article{chen2025hard,
  author = {Zixuan Chen and Xiaohua Xie and Lingxiao Yang and Jianhuang Lai},
  title = {{Hard Nominal Example-aware Template Mutual Matching for Industrial Anomaly Detection}},
  journal = {Int. J. Comput. Vis.},
  year = {2025},
  doi = {10.1007/s11263-024-02323-0},
}
Figure