Calibrating deep learning models to yield uncertainty-aware predictions is crucial as deep neural networks get increasingly deployed in safety-critical applications. While existing post-hoc calibration methods achieve impressive results on in-domain test datasets, they are limited by their inability to yield reliable uncertainty estimates in domain-shift and out-of-domain (OOD) scenarios. We aim to bridge this gap by proposing DAC, an accuracy-preserving as well as Density-Aware Calibration method based on k-nearest-neighbors (KNN). In contrast to existing post-hoc methods, we utilize hidden layers of classifiers as a source for uncertainty-related information and study their importance. We show that DAC is a generic method that can readily be combined with state-of-the-art post-hoc methods. DAC boosts the robustness of calibration performance in domain-shift and OOD, while maintaining excellent in-domain predictive uncertainty estimates. We demonstrate that DAC leads to consistently better calibration across a large number of model architectures, datasets, and metrics. Additionally, we show that DAC improves calibration substantially on recent large-scale neural networks pre-trained on vast amounts of data.
翻译:校准深度学习模型以生成不确定性感知的预测,对于深度神经网络在安全关键型应用中的日益部署至关重要。尽管现有的后处理方法在领域内测试数据集上取得了显著成果,但它们无法在领域偏移和域外(OOD)场景中提供可靠的不确定性估计。我们旨在通过提出DAC(一种基于k近邻(KNN)的保持精度且密度感知的校准方法)来填补这一空白。与现有的后处理方法不同,我们利用分类器的隐藏层作为不确定性相关信息的来源,并研究其重要性。我们表明DAC是一种通用方法,可轻松与最先进的后处理方法结合使用。DAC增强了校准性能在领域偏移和OOD场景中的鲁棒性,同时保持出色的领域内预测不确定性估计。我们证明,DAC在大量模型架构、数据集和指标上持续带来更好的校准效果。此外,我们展示DAC在近期预训练于海量数据的大规模神经网络上显著提升了校准性能。