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在近期基于海量数据预训练的大型神经网络上显著提升了校准性能。