Anomaly detection (AD) is a crucial machine learning task that aims to learn patterns from a set of normal training samples to identify abnormal samples in test data. Most existing AD studies assume that the training and test data are drawn from the same data distribution, but the test data can have large distribution shifts arising in many real-world applications due to different natural variations such as new lighting conditions, object poses, or background appearances, rendering existing AD methods ineffective in such cases. In this paper, we consider the problem of anomaly detection under distribution shift and establish performance benchmarks on three widely-used AD and out-of-distribution (OOD) generalization datasets. We demonstrate that simple adaptation of state-of-the-art OOD generalization methods to AD settings fails to work effectively due to the lack of labeled anomaly data. We further introduce a novel robust AD approach to diverse distribution shifts by minimizing the distribution gap between in-distribution and OOD normal samples in both the training and inference stages in an unsupervised way. Our extensive empirical results on the three datasets show that our approach substantially outperforms state-of-the-art AD methods and OOD generalization methods on data with various distribution shifts, while maintaining the detection accuracy on in-distribution data.
翻译:异常检测(Anomaly Detection, AD)是一项关键的机器学习任务,旨在从一组正常训练样本中学习模式,以识别测试数据中的异常样本。现有大多数AD研究假设训练数据和测试数据来自相同的数据分布,但在许多实际应用中,测试数据可能因不同自然变化(如新的光照条件、物体姿态或背景外观)而出现较大的分布偏移,导致现有AD方法在此类情况下失效。本文考虑分布偏移下的异常检测问题,并在三个广泛使用的AD和分布外(Out-of-Distribution, OOD)泛化数据集上建立了性能基准。我们证明,由于缺乏标注的异常数据,直接将最先进的OOD泛化方法简单适应于AD场景无法有效工作。此外,我们提出了一种新颖的鲁棒AD方法,通过无监督方式在训练和推理阶段最小化分布内和分布外正常样本之间的分布差距,从而应对多种分布偏移。我们在三个数据集上的大量实验结果表明,我们的方法在具有各种分布偏移的数据上显著优于最先进的AD方法和OOD泛化方法,同时保持了对分布内数据的检测精度。