Visual anomaly detection (VAD) is a critical component in automated industrial inspection and medical diagnostics. While existing methods excel at identifying local structural defects, they often struggle with high-level logical anomalies where the components themselves appear normal but violate functional constraints. This paper introduces the Global-Local Correspondence Framework (GLCF), a dual-branch architecture designed to bridge this gap by reconciling local textures with global semantic context.
The Challenge: Structural vs. Logical Anomalies
Traditional VAD algorithms are highly effective at spotting local structural anomalies—low-level defects like scratches, dents, or stains where pixels differ significantly from their immediate surroundings. However, they frequently fail to detect global logical anomalies.
Consider a package that should contain exactly two items; if it contains only one, the single item looks perfectly normal locally. The anomaly is only apparent when considering the high-level logical rule (the count). Detecting these requires a model to understand the "big picture" (global semantics) and how it relates to specific parts (local features).
Methodology: The GLCF Architecture
The proposed GLCF architecture addresses these challenges by splitting the detection task into two specialized branches connected by a novel bottleneck.
Dual-Branch Design
- The Local Branch: Focuses on extracting and estimating fine-grained structural features to catch texture-based defects.
- The Global Branch: Focuses on high-level semantic relationships and logical constraints to identify functional violations.
The Semantic Bottleneck (SB)
The core innovation is the Semantic Bottleneck, which utilizes a Vision Transformer (ViT) architecture to compress multi-scale features into a set of "semantic tokens." This forces the model to discard redundant pixel-level information and retain only the essential logic of the scene. It consists of two sub-modules:
- Multi-scale Patch Embedding (MS-PEM): Fuses features from different encoder stages to provide the bottleneck with both coarse and fine information.
- Semantic Aggregation Module (SAM): Uses learnable tokens to capture long-range dependencies, effectively summarizing the image's logical state.
Feature Estimation Networks
Rather than relying on image reconstruction—which can be prone to errors—GLCF employs Feature Estimation Networks. During training on normal data, the model learns to predict the expected features in both local and global spaces. At test time, anomalies are flagged if the actual extracted features deviate significantly from these estimated "normal" features.
Experimental Results
The framework was evaluated across three major benchmarks, demonstrating state-of-the-art (SOTA) performance, particularly in logical anomaly detection:
- Mvtec LOCO AD: On this challenging dataset specifically designed for logical constraints, GLCF achieved a massive leap in performance. In the pixel-level localization metric (sPRO), it outperformed the previous SOTA (DREAM) by 24.9%.
- Mvtec AD: The model remained highly competitive on standard structural anomalies, achieving a 94.6% image-level AUROC.
- Retinal-OCT: In medical utility tests for detecting lesions in eye scans, it reached 96.7% AUROC, surpassing existing medical VAD baselines.
Conclusion and Future Work
GLCF demonstrates that a dual-space approach, combined with a semantic bottleneck, provides a robust solution for the full spectrum of visual anomalies. By forcing data through a ViT-based bottleneck, the model moves beyond pixel memorization toward understanding underlying logical rules.
Current limitations include the reliance on manual empirical weighting to fuse the local and global branch results. Future research will focus on developing automated, data-driven methods to determine these weights, enhancing the framework's adaptability across diverse real-world environments.
Summary updated