Reliable use of deep neural networks (DNNs) for medical image analysis requires methods to identify inputs that differ significantly from the training data, called out-of-distribution (OOD), to prevent erroneous predictions. OOD detection methods can be categorised as either confidence-based (using the model's output layer for OOD detection) or feature-based (not using the output layer). We created two new OOD benchmarks by dividing the D7P (dermatology) and BreastMNIST (ultrasound) datasets into subsets which either contain or don't contain an artefact (rulers or annotations respectively). Models were trained with artefact-free images, and images with the artefacts were used as OOD test sets. For each OOD image, we created a counterfactual by manually removing the artefact via image processing, to assess the artefact's impact on the model's predictions. We show that OOD artefacts can boost a model's softmax confidence in its predictions, due to correlations in training data among other factors. This contradicts the common assumption that OOD artefacts should lead to more uncertain outputs, an assumption on which most confidence-based methods rely. We use this to explain why feature-based methods (e.g. Mahalanobis score) typically have greater OOD detection performance than confidence-based methods (e.g. MCP). However, we also show that feature-based methods typically perform worse at distinguishing between inputs that lead to correct and incorrect predictions (for both OOD and ID data). Following from these insights, we argue that a combination of feature-based and confidence-based methods should be used within DNN pipelines to mitigate their respective weaknesses. These project's code and OOD benchmarks are available at: https://github.com/HarryAnthony/Evaluating_OOD_detection.
翻译:在医学图像分析中可靠使用深度神经网络(DNNs)需要开发能够识别与训练数据显著不同的输入(称为分布外数据)的方法,以防止错误预测。分布外检测方法可分为基于置信度的方法(利用模型输出层进行检测)和基于特征的方法(不使用输出层)。我们通过将D7P(皮肤病学)和BreastMNIST(超声)数据集划分为包含伪影(分别为标尺或标注)与不包含伪影的子集,创建了两个新的分布外检测基准。模型使用无伪影图像进行训练,而包含伪影的图像作为分布外测试集。针对每幅分布外图像,我们通过图像处理手动移除伪影生成反事实样本,以评估伪影对模型预测的影响。研究表明,由于训练数据相关性等因素,分布外伪影可能提升模型预测的softmax置信度。这与"分布外伪影应导致更不确定输出"的普遍假设相悖,而大多数基于置信度的方法正依赖此假设。基于此,我们解释了为何基于特征的方法(如马氏距离评分)通常比基于置信度的方法(如最大类别概率)具有更好的分布外检测性能。然而,研究同时表明,基于特征的方法在区分导致正确与错误预测的输入方面(对分布外和分布内数据皆然)通常表现较差。基于这些发现,我们主张在深度神经网络流程中应结合使用基于特征和基于置信度的方法,以弥补各自缺陷。本项目代码及分布外检测基准已开源:https://github.com/HarryAnthony/Evaluating_OOD_detection。