Existing approaches towards anomaly detection~(AD) often rely on a substantial amount of anomaly-free data to train representation and density models. However, large anomaly-free datasets may not always be available before the inference stage; in which case an anomaly detection model must be trained with only a handful of normal samples, a.k.a. few-shot anomaly detection (FSAD). In this paper, we propose a novel methodology to address the challenge of FSAD which incorporates two important techniques. Firstly, we employ a model pre-trained on a large source dataset to initialize model weights. Secondly, to ameliorate the covariate shift between source and target domains, we adopt contrastive training to fine-tune on the few-shot target domain data. To learn suitable representations for the downstream AD task, we additionally incorporate cross-instance positive pairs to encourage a tight cluster of the normal samples, and negative pairs for better separation between normal and synthesized negative samples. We evaluate few-shot anomaly detection on on 3 controlled AD tasks and 4 real-world AD tasks to demonstrate the effectiveness of the proposed method.
翻译:现有异常检测方法通常依赖大量无异常数据来训练表征和密度模型。然而在实际推理阶段前,大规模无异常数据集并非总可获得,此时异常检测模型必须仅依靠少量正常样本进行训练,即少样本异常检测。本文提出一种融合两项关键技术的新方法以应对少样本异常检测挑战。首先,我们采用在大规模源数据集上预训练的模型初始化权重参数。其次,为缓解源域与目标域间的协变量偏移,我们采用对比训练策略对少样本目标域数据进行微调。为获取适用于下游异常检测任务的表征,我们额外引入跨实例正样本对以促进正常样本紧密聚类,并引入负样本对以更好分离正常样本与合成的负样本。我们在3个受控异常检测任务和4个真实异常检测任务上评估了少样本异常检测性能,实验证明了所提方法的有效性。