HyperTrans: Efficient Hypergraph-Driven Cross-Domain Pattern Transfer in Image Anomaly Detection

Tengyu Zhang, Deyu Zeng, Baoqiang Li, Wei Wang, Wei Liu, Zongze Wu

TL;DR

This paper introduces HyperTrans, a novel framework for cross-domain image anomaly detection, particularly for few-shot scenarios where target domain data is scarce. By leveraging hypergraphs to model complex relationships between image patches and employing a perturbation-rectification-scoring architecture, HyperTrans effectively transfers knowledge from a source domain to a target domain, achieving state-of-the-art performance.

What Problem Does This Paper Address?

Industrial quality assurance heavily relies on anomaly detection to identify defects. Traditionally, this has been done using RGB images. However, the shift towards 3D imaging (e.g., depth sensors) presents a significant "cross-domain" challenge: models trained on RGB data don't perform well on depth data due to fundamental differences in image characteristics (style, boundaries, class variance). This is exacerbated by the "few-shot" problem in the target domain, where very few (or no) labeled anomaly examples are available for retraining. Existing methods either require extensive target domain data, retrain models from scratch (losing valuable source domain knowledge), or struggle with multi-modal data acquisition and alignment. This paper tackles the critical need for effective anomaly detection when transitioning to new sensor modalities with limited target data.

Methods

HyperTrans tackles the cross-domain few-shot anomaly detection problem with a three-pronged approach:

  • Domain Perturbation (DP): This module simulates target domain styles by injecting channel-level statistical perturbations (mean and variance) into image features. Instead of simple noise, it uses Perlin noise to better mimic natural variations. This helps the model adapt to unseen domain characteristics before encountering them in the target domain. A domain perturbation loss (MSE) is used to encourage the perturbed features to be close to the original ones.
  • Hypergraph Domain Rectification (HDR): This is the core novelty. It constructs a cross-domain hypergraph where image patches from both source and target domains are treated as vertices. Hyperedges capture higher-order correlations between patches, going beyond pairwise relationships in traditional graphs. A residual hypergraph convolutional network (ResHGNN) then processes this hypergraph to align features and correct cross-domain shifts. Pseudo-features are generated to guide this alignment. A domain rectification loss (MSE) is used to minimize the difference between rectified features and pseudo-features, as well as between rectified and original features.
  • Cross-Domain Scoring (CDS): During inference, this module leverages both the source and target domain feature banks. It splits the hypergraph into source-specific and target-specific subhypergraphs. Anomaly scores are computed independently for each subhypergraph, and these scores are then combined (weighted by a parameter $\beta$) to produce the final anomaly score and segmentation map. This allows the model to benefit from the rich information in the source domain feature bank even when inferring on target domain data.

Datasets

The primary dataset used for evaluation is the MVTec-3D AD dataset. This dataset is a standard benchmark for 3D anomaly detection and consists of 10 categories. The experiments utilize RGB data as the source domain and depth images (derived from XYZ data) as the target domain.

Key Insights and Ideas

  • Hypergraphs for Higher-Order Correlations: The paper highlights that simple pairwise relationships between image patches are insufficient for cross-domain anomaly detection. Hypergraphs are crucial for capturing more complex, higher-order correlations that better represent the underlying structure of anomalies and normal patterns across domains.
  • Proactive Domain Adaptation: The Domain Perturbation module's ability to simulate target domain styles before actual exposure is a key insight. This "pre-training" for domain shift significantly improves the model's robustness and adaptability.
  • Synergy of Source and Target Information at Inference: The Cross-Domain Scoring module's strategy of jointly reasoning over both source and target domain feature banks at inference time is critical. This prevents discarding valuable source domain knowledge and allows for more robust anomaly detection, especially in few-shot scenarios.
  • Balancing Source and Target Influence: The introduction of parameters $\alpha$ (for rectification) and $\beta$ (for scoring) allows for fine-tuning the balance between leveraging source domain knowledge and adapting to the target domain, demonstrating that a careful balance is essential for optimal performance.

Key Results

HyperTrans demonstrates significant advantages in cross-domain anomaly classification and segmentation on the MVTec-3D AD dataset. Specifically, it outperforms state-of-the-art non-cross-domain methods by:

  • 13% in image-wise ROCAUC for 1-shot settings.
  • 12% in image-wise ROCAUC for 2-shot settings.
  • 15% in image-wise ROCAUC for 5-shot settings.

Qualitative results also show that HyperTrans achieves the best segmentation maps, effectively addressing issues like blurred boundaries. Ablation studies confirm the effectiveness of each proposed module (DP, HDR, CDS), with their combination leading to the best overall performance.

Limitations and Future Work

  • Parameter Sensitivity: The paper acknowledges the need to balance parameters $\alpha$ and $\beta$, suggesting that finding optimal values is important. Future work could explore more automated or adaptive methods for setting these parameters.
  • Computational Cost: While not explicitly detailed as a limitation, hypergraph construction and processing can be computationally intensive. Future work might focus on optimizing the efficiency of the hypergraph operations.
  • Generalizability to Other Modalities: The current work focuses on RGB to depth transfer. Extending HyperTrans to other cross-modal scenarios (e.g., thermal to RGB, or different types of 3D data) would be a valuable future direction.
  • Real-world Industrial Deployment: Further validation and fine-tuning for specific industrial applications with diverse defect types and sensor configurations would be beneficial for practical deployment.

Summary updated

Abstract

Anomaly detection plays a pivotal role in industrial quality assurance processes, with cross-domain problems, exemplified by the model upgrade from RGB to 3D, being prevalent in real-world scenarios yet remaining systematically underexplored. To address the severe challenges posed by the extreme lack of datasets in target domain, we retain the knowledge from source models and explore a novel solution for anomaly detection through cross-domain learning, introducing HyperTrans. Targeting few-shot scenarios, HyperTrans centers around hypergraphs to model the relationship of the limited patch features and employs a perturbation-rectification-scoring architecture. The domain perturbation module injects and adapts channel-level statistical perturbations, mitigating style shifts during domain transfer. Subsequently, a residual hypergraph restoration module utilizes a cross-domain hypergraph to capture higher-order correlations in patches and align them across domains. Ultimately, with feature patterns exhibiting reduced domain shifts, an inter-domain scoring module aggregates similarity information between patches and normal patterns within the multi-domain subhypergraphs to make an integrated decision, generating multi-level anomaly predictions. Extensive experiments demonstrate that HyperTrans offers significant advantages in anomaly classification and anomaly segmentation tasks, outperforming state-of-the-art non-cross-domain methods in image-wise ROCAUC by 13%, 12%, and 15% in 1-shot, 2-shot, and 5-shot settings on MVTec3D AD.
BibTeX
@inproceedings{zhang2025hypertrans,
  author = {Tengyu Zhang and Deyu Zeng and Baoqiang Li and Wei Wang and Wei Liu and Zongze Wu},
  title = {{HyperTrans: Efficient Hypergraph-Driven Cross-Domain Pattern Transfer in Image Anomaly Detection}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.24963/ijcai.2025/267},
}
Figure