Logical Anomaly Detection Using Segmentation Transformers

Yunfei Liang, Matic Fučka, Danijel Skočaj

Yunfei Liang: University of Ljubljana, Faculty of Computer and Information Science, Ljubljana, Slovenia · Matic Fučka: University of Ljubljana, Faculty of Computer and Information Science, Ljubljana, Slovenia · Danijel Skočaj: University of Ljubljana, Faculty of Computer and Information Science, Ljubljana, Slovenia

Industrial visual inspection aims to detect and localize defects in manufactured products. This task is commonly addressed using anomaly detection methods that model the appearance of defect-free samples. Such methods perform well on structural anomalies, such as dents and scratches, but they often struggle with logical anomalies. For logical anomalies, individual components appear normal in isolation but their composition may violate constraints of the category (when a component is missing, duplicated, or misplaced). To detect logical anomalies, we propose a two-branch method that uses a Mask2Former-based component segmenter to model both local appearance and global composition. The structural branch extracts local information from a frozen backbone’s patch-level features and scores each patch against a coreset-reduced memory bank of defect-free patches. The compositional branch derives a descriptor from the predicted segmentation masks by pooling the same frozen features inside each component region, and compares each component against defect-free components of the same class in a class-partitioned memory bank. The regions establish correspondence with normality through their given class labels, without open-world object detection or inference-time bipartite matching. During inference, anomaly scores are obtained by comparing the local and compositional representations of a query image with those of defect-free training samples, and the two resulting maps are fused into a single prediction. On the MVTec LOCO dataset, the proposed method achieves an image-level AUROC of 95.7% using hand-labeled part maps released with PSAD and 92.9% using automatically generated composition maps released with SALAD, two component-based anomaly detection methods.

Keywords: anomaly detection, logical anomaly detection, semantic segmentation, visual inspection, machine vision

Pages: 293–296

DOI: 10.70314/is.2026.sikdd.115

Download PDF