[Paper Review] Explicit Boundary Guided Semi-Push-Pull Contrastive Learning for Supervised Anomaly Detection
This paper proposes BGAD, a novel supervised anomaly detection method that uses explicit boundary guidance and a semi-push-pull contrastive loss to enhance model discriminability while reducing bias from limited known anomalies. By learning a normalized normal feature distribution to define a compact separating boundary and applying a boundary-guided loss that only pulls normal features and pushes abnormal ones beyond a margin, BGAD achieves state-of-the-art performance on MVTec AD with +2.5% to +8.6% improvements in AUROC and PRO across categories.
Most anomaly detection (AD) models are learned using only normal samples in an unsupervised way, which may result in ambiguous decision boundary and insufficient discriminability. In fact, a few anomaly samples are often available in real-world applications, the valuable knowledge of known anomalies should also be effectively exploited. However, utilizing a few known anomalies during training may cause another issue that the model may be biased by those known anomalies and fail to generalize to unseen anomalies. In this paper, we tackle supervised anomaly detection, i.e., we learn AD models using a few available anomalies with the objective to detect both the seen and unseen anomalies. We propose a novel explicit boundary guided semi-push-pull contrastive learning mechanism, which can enhance model's discriminability while mitigating the bias issue. Our approach is based on two core designs: First, we find an explicit and compact separating boundary as the guidance for further feature learning. As the boundary only relies on the normal feature distribution, the bias problem caused by a few known anomalies can be alleviated. Second, a boundary guided semi-push-pull loss is developed to only pull the normal features together while pushing the abnormal features apart from the separating boundary beyond a certain margin region. In this way, our model can form a more explicit and discriminative decision boundary to distinguish known and also unseen anomalies from normal samples more effectively. Code will be available at https://github.com/xcyao00/BGAD.
Motivation & Objective
- To address the insufficient discriminability of unsupervised anomaly detection models that rely only on normal samples.
- To mitigate the bias issue in supervised anomaly detection where models overfit to limited known anomalies.
- To improve generalization to unseen anomalies by effectively leveraging a few known anomalies during training.
- To develop a more explicit and reliable decision boundary that clearly separates normal from anomalous samples.
- To enhance feature learning efficiency in rare anomaly scenarios through pseudo-anomaly generation.
Proposed method
- The method uses normalizing flows to learn a normalized normal feature distribution and derive an explicit, compact separating boundary based on a hyperparameter β.
- It introduces a boundary-guided semi-push-pull (BG-SPP) contrastive loss that only pulls normal features with log-likelihood below the boundary closer together.
- Abnormal features with log-likelihood above the boundary are pushed away from the boundary beyond a defined margin, ensuring clear separation.
- The semi-push-pull mechanism avoids full pushing of all abnormal features, reducing overfitting risk and preserving normal feature compactness.
- A RandAugment-based pseudo-anomaly generation strategy is used to simulate local irregularities in normal samples, addressing the rarity of real anomalies.
- The model is trained end-to-end with the BG-SPP loss, enabling discriminative feature learning while maintaining robustness to unseen anomalies.
Experimental results
Research questions
- RQ1Can an explicit, normal-distribution-based separating boundary improve the discriminability of anomaly detection models?
- RQ2Does a semi-push-pull contrastive loss mechanism reduce bias from known anomalies while enhancing generalization to unseen anomalies?
- RQ3How does explicit boundary guidance compare to conventional contrastive learning in terms of AUROC and PRO metrics on anomaly detection benchmarks?
- RQ4To what extent can pseudo-anomaly generation improve feature learning in low-data anomaly scenarios?
- RQ5Can the proposed method maintain high performance when trained on easy subsets and tested on hard, unseen anomaly subsets?
Key findings
- BGAD achieves a 2.5% relative improvement in image AUROC (0.992 vs. 0.968) on the MVTec AD dataset compared to the baseline NFAD.
- On hard subsets, BGAD generalizes effectively, achieving a 6.7% relative improvement in PRO (0.930 vs. 0.863) despite being trained only on easy anomalies.
- The BG-SPP loss outperforms a full-pushing variant (BGAD†), which suffers from overfitting and lower AUROC, especially on complex categories like Capsule and Transistor.
- Visualization shows that BGAD reduces ambiguous log-likelihood regions and produces more discriminative feature distributions than unsupervised or biased supervised methods.
- Anomaly localization maps generated by BGAD are more accurate than ground truth in some cases, demonstrating superior localization capability.
- The method achieves state-of-the-art performance across all evaluated metrics, including image AUROC, pixel AUROC, and PRO, on the MVTec AD benchmark.
Better researchstarts right now
From reading papers to final review, dramatically reduce your research time.
No credit card · Free plan available
This review was created by AI and reviewed by human editors.