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.
翻译:大多数异常检测模型仅以无监督方式使用正常样本进行学习,这可能导致决策边界模糊和判别能力不足。实际上,真实应用中常存在少量异常样本,已知异常的宝贵知识也应得到有效利用。然而,训练中利用少量已知异常可能引发另一个问题:模型可能被这些已知异常所偏置,导致无法泛化到未见异常。本文研究监督异常检测问题,即利用少量可用异常样本训练异常检测模型,旨在同时检测已见和未见异常。我们提出一种新颖的显式边界引导半推拉对比学习机制,该机制可增强模型判别能力同时缓解偏置问题。本方法基于两个核心设计:首先,我们找到一个显式且紧凑的分离边界作为后续特征学习的引导。由于该边界仅依赖正常特征分布,可减轻由少量已知异常引起的偏置问题。其次,我们开发了边界引导的半推拉损失函数,该损失仅将正常特征拉近,同时将异常特征推离分离边界的特定间隔区域之外。通过这种方式,我们的模型能够形成更显式、更具判别性的决策边界,从而更有效地区分正常样本与已知及未见异常。代码将在 https://github.com/xcyao00/BGAD 提供。