Unsupervised out-of-distribution (OOD) detection aims to identify out-of-domain data by learning only from unlabeled In-Distribution (ID) training samples, which is crucial for developing a safe real-world machine learning system. Current reconstruction-based methods provide a good alternative approach by measuring the reconstruction error between the input and its corresponding generative counterpart in the pixel/feature space. However, such generative methods face a key dilemma: improving the reconstruction power of the generative model while keeping a compact representation of the ID data. To address this issue, we propose the diffusion-based layer-wise semantic reconstruction approach for unsupervised OOD detection. The innovation of our approach is that we leverage the diffusion model's intrinsic data reconstruction ability to distinguish ID samples from OOD samples in the latent feature space. Moreover, to set up a comprehensive and discriminative feature representation, we devise a multi-layer semantic feature extraction strategy. By distorting the extracted features with Gaussian noise and applying the diffusion model for feature reconstruction, the separation of ID and OOD samples is implemented according to the reconstruction errors. Extensive experimental results on multiple benchmarks built upon various datasets demonstrate that our method achieves state-of-the-art performance in terms of detection accuracy and speed. Code is available at <https://github.com/xbyym/DLSR>.
翻译:无监督分布外检测旨在仅通过未标记的分布内训练样本来识别域外数据,这对于开发安全的现实世界机器学习系统至关重要。当前基于重建的方法通过在像素/特征空间中测量输入与其对应生成结果之间的重建误差,提供了一种良好的替代方案。然而,此类生成方法面临一个关键困境:在保持分布内数据紧凑表示的同时,提高生成模型的重建能力。为解决这一问题,我们提出了一种基于扩散的逐层语义重建方法用于无监督分布外检测。我们方法的创新之处在于利用扩散模型固有的数据重建能力,在潜在特征空间中区分分布内样本与分布外样本。此外,为建立全面且具有判别性的特征表示,我们设计了一种多层语义特征提取策略。通过对提取的特征施加高斯噪声扰动,并应用扩散模型进行特征重建,根据重建误差实现分布内与分布外样本的分离。在基于多种数据集构建的多个基准测试上的广泛实验结果表明,我们的方法在检测精度和速度方面均达到了最先进的性能。代码可在 <https://github.com/xbyym/DLSR> 获取。