Contrastive representation learning has emerged as an outstanding approach for anomaly detection. In this work, we explore the $\ell_2$-norm of contrastive features and its applications in out-of-distribution detection. We propose a simple method based on contrastive learning, which incorporates out-of-distribution data by discriminating against normal samples in the contrastive layer space. Our approach can be applied flexibly as an outlier exposure (OE) approach, where the out-of-distribution data is a huge collective of random images, or as a fully self-supervised learning approach, where the out-of-distribution data is self-generated by applying distribution-shifting transformations. The ability to incorporate additional out-of-distribution samples enables a feasible solution for datasets where AD methods based on contrastive learning generally underperform, such as aerial images or microscopy images. Furthermore, the high-quality features learned through contrastive learning consistently enhance performance in OE scenarios, even when the available out-of-distribution dataset is not diverse enough. Our extensive experiments demonstrate the superiority of our proposed method under various scenarios, including unimodal and multimodal settings, with various image datasets.
翻译:对比表示学习已成为异常检测领域的重要方法。本文探究了对比特征$\ell_2$范数及其在分布外检测中的应用。我们提出了一种基于对比学习的简易方法,通过在对比特征层空间中区分正常样本与分布外数据实现检测。该方法可灵活应用于两种场景:作为异常暴露方法时,分布外数据为大量随机图像的集合;作为完全自监督学习方法时,分布外数据通过施加分布偏移变换自生成。这种整合额外分布外样本的能力,为对比学习异常检测方法通常表现欠佳的数据集(如航拍图像或显微图像)提供了可行解决方案。此外,即便可用分布外数据集多样性不足,通过对比学习获得的高质量特征仍能持续提升异常暴露场景的性能。大量实验表明,本文方法在包括单模态与多模态设置在内的多种场景中均具有优越性,并在多个图像数据集上得到验证。