HarmoniAD: Harmonizing Local Structures and Global Semantics for Anomaly Detection

Naiqi Zhang, Chuancheng Shi, Jingtong Dou, Wenhua Wu, Fei Shen, Jianhua Cao

TL;DR

HarmoniAD is a novel frequency-guided dual-branch framework that tackles the long-standing structure-semantics trade-off in anomaly detection. By adaptively splitting image features into high- and low-frequency components, it effectively captures both fine-grained structural details and global semantic context, leading to more accurate and robust anomaly localization.

What Problem Does This Paper Address?

Industrial quality inspection heavily relies on anomaly detection to identify defects. However, existing methods struggle with a fundamental challenge: balancing the need to detect tiny, localized structural anomalies (like scratches or texture deviations) with the requirement to understand the overall semantic context of an object.

  • Structure-oriented methods are good at spotting fine details but are often fooled by noise or irrelevant textures, leading to false alarms.
  • Semantics-oriented methods, especially those leveraging powerful models like CLIP, excel at understanding the "big picture" but tend to miss subtle, localized defects.

This "structure-semantics trade-off" means that current approaches either miss small defects or generate spurious detections in normal regions, hindering reliable industrial inspection.

Methods

HarmoniAD introduces a frequency-guided dual-branch architecture to overcome this trade-off:

  1. CLIP Feature Extraction: It starts by using a pre-trained CLIP model to extract rich, high-level image embeddings.
  2. Frequency Domain Transformation: These embeddings are then transformed into the frequency domain. This is a key step, as different frequencies capture different types of information (high frequencies for details, low frequencies for overall structure).
  3. Adaptive Frequency Splitting (Soft Gate): A novel "Soft Gate" mechanism adaptively separates the frequency components into high- and low-frequency streams. Unlike hard thresholds, this adaptive approach learns to partition the frequencies based on the input data, making it more robust.
  4. Dual-Branch Processing:
    • High-Frequency Branch (FSAM): A Fine-grained Structural Attention Module (FSAM) is used to enhance texture and edge information. It employs frequency-to-spatial attention and amplitude modulation to precisely pinpoint small anomalies.
  5. Low-Frequency Branch (GSCM): A Global Structural Context Module (GSCM) captures long-range dependencies and semantic consistency. It uses dynamic modulation to ensure that the detected anomalies fit within the overall object's context.
  6. Reconstruction and Loss: The outputs from both branches are fused to reconstruct the image. A multi-class joint training strategy with several complementary loss terms (reconstruction, contrastive, triplet) is used to supervise the model.

Datasets

The paper evaluates HarmoniAD on three widely used industrial anomaly detection benchmarks:

  • MVTec-AD [15]: A comprehensive dataset with various object categories and anomaly types.
  • VisA [16]: Another dataset focusing on visual anomaly detection.
  • BTAD [17]: A dataset specifically designed for industrial anomaly detection.

The authors mention that they use the same training pipeline and data splitting as prior work for fair comparison.

Key Insights and Ideas

  • Frequency Domain as a Bridge: Transforming features into the frequency domain is a powerful way to disentangle structural details (high frequencies) from semantic context (low frequencies).
  • Adaptive Splitting is Crucial: A fixed frequency split would be suboptimal. The "Soft Gate" learns to adapt this split per image, leading to better performance.
  • Complementary Branches are Key: The FSAM and GSCM are not just separate modules; they are designed to complement each other. FSAM finds the "what" (fine details), and GSCM confirms the "where" (global context), preventing false positives and missed detections.
  • CLIP's Semantic Power Harnessed Differently: Instead of just using CLIP's embeddings directly, HarmoniAD leverages its semantic understanding in conjunction with frequency-based structural analysis, unlocking new potential.

Key Results

  • State-of-the-Art Performance: HarmoniAD consistently achieves state-of-the-art results across all three benchmarks (MVTec-AD, VisA, and BTAD) on both image-level (I-ROC, I-PR) and pixel-level (P-ROC, P-PR) anomaly detection metrics.
  • Superior Localization: On MVTec-AD, HarmoniAD achieved a P-PR score of 58.3, outperforming the next best method by 9.3 points, demonstrating its superior ability to suppress false alarms and accurately localize defects.
  • Robustness: Ablation studies show that the adaptive Soft Gate is more robust than fixed thresholding. The FSAM and GSCM modules are shown to be complementary, with their joint integration yielding the best results.
  • Efficiency: The paper notes that HarmoniAD achieves competitive inference latency compared to other methods, especially CLIP-based ones.

Limitations and Future Work

  • Single-Frame Focus: The current method is designed for single-frame images and does not inherently handle temporal information.
  • Future Work: The authors suggest extending HarmoniAD to video anomaly detection by incorporating temporal relation modeling and temporal consistency regularization. They also mention that while the model shows promising cross-domain robustness, a more comprehensive quantitative analysis is needed.

Summary updated

BibTeX
@inproceedings{zhang2026harmoniad,
  author = {Naiqi Zhang and Chuancheng Shi and Jingtong Dou and Wenhua Wu and Fei Shen and Jianhua Cao},
  title = {{HarmoniAD: Harmonizing Local Structures and Global Semantics for Anomaly Detection}},
  booktitle = {ICME},
  year = {2026},
  url = {https://openreview.net/forum?id=5DQwEp9zyW},
}
Figure