参考文献:Loss odyssey in medical image segmentation loss

函数代码库 github-SegLoss

本文在四个典型的三维分割任务上对20个一般的损失函数进行了首次大规模的分析,涉及10多个医疗中心的六个公共数据集。结果显示,没有一个损失函数能在四个分割任务上持续取得最佳性能,但复合损失函数(如Dice with TopK loss, focal loss, Hausdorff distance loss,和 boundary loss)是最稳健的损失


Recently, cross entropy and Dice loss have become the most commonly used loss functions in medical image segmentation tasks (Milletari et al., 2016). For example, in the proceedings of MICCAI 2018, 47 out of 77 CNN-based segmentation papers (Bertels et al., 2019) chose cross entropy loss as their target loss. Dice loss has been widely used in many top solutions of medical image segmentation challenges (Bernard et al., 2018; Bakas et al., 2018). In addition to cross entropy and Dice loss, more than 10 loss functions have been proposed for segmentation CNNs. Most of them are designed to address the class imbalance problem, which is one of the main challenges when the object to be segmented is small relative to the size of the image volume, for example the segmentation of tumors or small organs.

最近,交叉熵和Dice损失已经成为医学图像分割任务中最常用的损失函数(Milletari等人,2016)。例如,在MICCAI 2018的论文集中,77篇基于CNN的分割论文中,有47篇(Bertels等人,2019)选择交叉熵损失作为他们的目标损失。骰子损失已被广泛用于医学图像分割挑战的许多顶级解决方案中(Bernard等人,2018;Bakas等人,2018)。除了交叉熵和Dice损失外,还有10多个损失函数被提出用于分割CNN。其中大多数是为了解决类的不平衡问题,当需要分割的对象相对于图像体积的大小较小时,这是主要的挑战之一,例如肿瘤或小器官的分割。

In this paper, we focus on the plug-and-play loss functions that can be used in any segmentation tasks,
本文中,我们专注于可用于任何分割任务的即插即用的损失函数

一、基于分布的损失函数

旨在最小化两个分布之间的不相似性。这一类中最基本的函数是交叉熵;所有其他函数都是由交叉熵衍生出来的。
1、交叉熵 CE
加权的交叉熵 WCE

2、TopK loss
3、Focal los

调整了标准的交叉熵,减少分配给分类良好的例子的损失来关注困难的例子,这也可以处理前景与背景类不平衡的问题。
4、基于距离图罚项的交叉熵 DPCE

二、基于区域的损失函数

旨在最小化不匹配,或最大化真实标签G和预测分割S之间的重叠区域。
1、敏感度-特异性loss
通过提高特异性的权重来解决类不平衡的问题
2、Dice loss
与加权交叉熵不同,Dice损失不需要对不平衡的分割任务进行类别重新加权。
3、IoU (Jaccard) loss
基于交并比的损失,与Dice loss类似。
4、Lovász loss
5、Tversky loss
为了在精度和召回率之间实现更好的权衡,Tversky损失调整了Dice损失以强调假阴性。
6、广义Dice loss
广义Dice损失是Dice损失的多类扩展,其中每个类别的权重与标签频率成反比。
7、Focal Tversky loss
8、非对称相似性损失 Asymmetric similarity loss
引入一个加权参数β来更好地调整FPs和FNs的权重,并实现精度和召回率之间的更好平衡。
9、**Penalty loss
引入非负的惩罚系数k。**当k=0时,pGD等同于广义的Dice。当k>0时,pGD对假阳性和假阴性给予额外的权重。

三、基于边界的损失函数

1、边界损失 BD loss
有两种不同的框架来计算两个边界之间的距离。一个是差分框架,它将边界曲线上每一个点的运动计算为沿曲线的法线的速度。另一个是积分框架,通过计算两个边界不匹配区域的界面上的积分来近似计算距离。
2、Hausdorff距离(HD)损失
Hausdorff距离是一个基于边界的指标,被广泛用于评估分割方法。然而,在训练过程中直接最小化HD是难以实现的,并可能导致不稳定的训练。为了解决这个问题,HD可以通过距离变换来近似。距离变换计算的是每个像素与物体边界之间的最短距离。需要注意的是,边界损失和Hausdorff距离损失在被用于训练神经网络时,都应该与基于区域的损失(如Dice损失)相配合,以减少训练的不稳定性。

四、混合的损失函数

1、**Combo损失

交叉熵和Dice loss的总和**
2、指数对数损失(ELL)
为了解决目标大小极不平衡的问题,对Dice损失和交叉熵损失都进行指数和对数转换,迫使网络内在地更多地关注不太准确的预测结构。
3、Dice loss 结合 focal loss

缓解不平衡的器官分割问题,迫使模型更好地从分割不好的图片学习
4、Dice loss结合TopK loss
用于多发性硬化症的自动容积评估
5、超越即插即用的损失函数:量身定做的损失
除了上述可用于任何分割任务的即插即用的损失函数外,还有一些为特殊分割任务量身定做的损失函数。超出了本文的讨论范围。

五、训练说明

Data augmentation: To avoid overfitting, data augmentation methods are applied on the fly during training, including randomly mirroring along all axes, random cropping, scaling, rotation and deformation, and gamma transformation. In addition, oversampling of foreground regions is employed to eliminate the label imbalance. Specifically, 33% of the samples in a minibatch are guaranteed to contain at least one of the foreground classes.
数据扩增。为了避免过度拟合,在训练过程中采用了数据增强的方法,**包括沿所有轴线的随机镜像、随机裁剪、缩放、旋转和变形以及伽玛变换。此外,还采用了对前景区域的过度取样来消除标签的不平衡性。**具体来说,在一个mini batch中,33%的样本保证至少包含一个前景类别。

Optimization: All the losses are minimized by stochastic descent with the Adam optimizer (Kingma and Ba, 2015) (β1=0.9, β2=0.999) and a mini-batch size of 2. The training process takes up to 10 00 epochs, where one epoch is defined as the iteration over 250 training batches. Whenever the moving average of the training loss does not improve for 50 epochs, the learning rate is reduced by multiplying it with 0.2 until a minimum learning rate of 1e-6 has been reached.
优化。所有的损失都通过**Adam优化器(β1=0.9,β2=0.999)的随机下降法和mini batch进行最小化。**训练过程需要10 00个epochs,其中一个历时被定义为250个训练批的迭代。每当训练损失的移动平均数在50个历时中没有改善,学习率就会通过乘以0.2来降低,直到达到最小学习率1e-6。


此外,三个损失函数在训练期间需要额外的调度策略,包括Lov ́ asz损失、边界损失和Hausdorff距离损失。
对于Lov ́ asz损失建议先用交叉熵进行优化,然后用Lov ́ asz损失进行微调。
边界损失和Hausdorff距离损失应与Dice损失相结合,具体如下。L = αLDice + βL(-),其中α,β > 0是一个权重超参数,(-)表示边界损失或Hausdorff距离损失。
对于边界损失,建议使用Dice损失来主导初始训练,以便稳定训练过程,快速获得合理的初始分割结果。具体来说,最初设定权重β=1-α,α=1,在每个epoch后将α减少0.01,直到达到0.01的值。
对于Hausdorff距离损失,设定α为基于HD的损失项的平均值与DSC损失项的平均值之比,β=1。最近的一项实证研究表明,实施细节会导致对性能的明显影响。
在我们的实验中,首先用Dice损失来训练网络,然后用建议的调度策略对BD损失和HD损失进行微调,因为我们发现这种训练技巧可以获得稳健的训练过程,也可以得到最好的性能。
其他17个损失函数都可以以即插即用的方式使用,在训练过程中不需要任何特定的调度技巧。

六、实验效果



轻度不平衡的任务:
在肝脏分割数据集上对它们进行了评估。大多数损失函数(17/20)获得了高度准确的结果,DSC高于0.90。DiceTopK损失获得了最好的DSC和NSD,而pGDice损失获得了最低的DSC,TopK损失在DSC和NSD上都获得了最低的性能。
进一步分析显示,pGDice损失和TopK损失往往会产生过度分割的结果。可能的原因是这两个损失函数是为高度不平衡的分割任务设计的,当它们被应用于更平衡的任务时,会导致对前景的偏见。

高度不平衡的任务:
DiceHD损失获得了最好的DSC,DiceBD损失和DiceHD损失获得了最好的NSD,而加权交叉熵获得的DSC和NSD较差。
需要注意的是,一些为高度不平衡问题设计的损失函数(如Dice loss、DiceFocal loss、Tversky loss和Asym loss)并没有取得最好的性能,但它们与表现最好的损失函数相比较,差距很小。然而,其他一些损失函数(如Focal loss、pGDice、SS loss、WCE)在这个任务上没有取得令人满意的性能。大多数损失函数的DSC值具有双峰分布,模式接近0.8和0.1。换句话说,分割结果是两极化的,有些肿瘤的分割结果相对较好,而有些则非常差。这是因为肿瘤的外观、位置、形状和大小各不相同。具有均匀外观的较大肿瘤的DSC达到了0.85,而小肿瘤只有一小部分被分割出来。

轻度和高度不平衡标签的多类分割:
在包含8个标签的多器官数据集上评估了这20个损失函数。一些器官,如肝脏和胃,占据了很大的体积,而其他一些器官,如胆囊和食道,则小得多。
DiceHD损失和DiceTopK损失获得了最好的NSD,而DiceFocal损失、DiceCE损失和DiceTopK损失获得了最好的DSC。GDice损失获得了最低的DSC和NSD,其变体pGDice损失也是如此。
一些损失函数(如Asym损失和FocalTversky损失)在二元分割任务中获得了与表现最好的损失函数相当的结果,差距很小,但在标签有各种不平衡的多器官分割中存在较大差距。DiceCE损失产生了相当准确的结果,而WCE的结果包括一些孤立的异常值。

Different variants of Dice loss
There are two different variants of Dice Loss (with and without squared terms in the denominator) as introduced in Section 2.2.2. Moreover, there are also two different implementations of Dice loss: sample Dice and batch Dice. Specifically, sample Dice computes the Dice loss for each sample in the minibatch independently and averages across the minibatch. Batch Dice treats the minibatch as a pseudo-volume and computes the Dice loss as if all voxels in the samples belonged to one training case (Isensee et al., 2021). Thus, there are in total four different Dice loss variants with the combination between w/wo squared terms and sample/batch Dice12 . We compare the four Dice loss variants on four segmentation tasks where only plain Dice losses are used (without cross entropy). Table 4 presents the quantitative results. Overall the default setting achieved the best average DSC and NSD. BatchSquareDice loss outperformed the default Dice loss in liver segmentation tasks, but the improvements were marginal. SampleSquareDice achieved slightly better NSD and DSC than the default Dice loss in liver tumor and pancreas segmentation tasks, respectively, while the average DSC and NSD were inferior than Dice loss.
Dice loss有两种不同的变体(分母中含有和不含有平方项)。
此外,也有两种不同的Dice loss实现方式:样本Dice和批量Dice。具体来说,样本Dice对mini batch中的每个样本独立计算Dice损失,并对mini batch进行平均。批量Dice将minibatch视为一个伪体积,并计算Dice损失,好像样本中的所有体素都属于一个训练案例(Isensee等人,2021)。因此,总共有四种不同的Dice损失变体,它们是w/wo平方项和样本/批次Dice12的组合。
我们在四个分割任务上比较了这四种Dice损失变体,**其中只使用了普通Dice损失(没有交叉熵)。总的来说,默认设置取得了最佳的平均DSC和NSD。**在肝脏分割任务中,BatchSquareDice损失的表现优于默认的Dice损失,但改进幅度很小。在肝脏肿瘤和胰腺分割任务中,SampleSquareDice的NSD和DSC分别比默认的Dice损失略好。

In contrast, IoU loss and Dice loss drop three and nine places, respectively. In general, Dice-related compound losses are relatively robust, which have the best performance with all metrics in different ranking schemes.
**总的来说,与Dice有关的复合损失是相对稳健的,**在不同的排名方案中,它们在所有的指标上都有最好的表现。

Most of the distribution-based and region-based loss functions are the variants of cross entropy and Dice loss, respectively. Boundary-based losses are motivated by minimizing the distance between two boundaries, but we show that they have similarities to Dice loss in formulation, as both of them are computed in a region-based way, and the key difference is the way the mismatched region is weighted. Moreover, Focal loss and TopK loss follow the same goal (focus on hard training examples) but they approach it quite differently. Different loss functions may respond differently to annotation errors. Focal loss and TopK for example will focus on mislabelled pixels, potentially learning useless information from mislabelled training cases. Dice loss weights false positives and false negatives equally, while asymmetric similarity loss and Tversky loss give different weights to the false positives and false negatives, which could achieve a better balance between precision and recall. Generalised Dice (GDice) loss extends the standard Dice loss by assigning different weights to different classes. The penalized GDice further extends GDice by assigning different weights to false positives and false negatives.
大多数基于分布和基于区域的损失函数分别是交叉熵和Dice损失的变种。基于边界的损失的动机是最小化两个边界之间的距离,但我们表明它们在表述上与Dice损失有相似之处,因为它们都是以基于区域的方式计算的,关键区别在于不匹配区域的加权方式。此外,Focal loss和TopK loss遵循相同的目标(专注于困难的训练例子),但它们的方法却截然不同。不同的损失函数可能对注释错误有不同的反应。例如,Focal loss和TopK会关注误标的像素,可能会从误标的训练案例中学习无用的信息。Dice损失对假阳性和假阴性的权重相同,而不对称相似性损失和Tversky损失对假阳性和假阴性的权重不同,这可以在精确度和召回率之间取得更好的平衡。广义Dice(GDice)损失通过给不同的类别分配不同的权重,扩展了标准Dice损失。惩罚性的GDice通过给假阳性和假阴性分配不同的权重,进一步扩展了GDice。

Recommendations for choosing loss functions: With 20 loss functions to choose from, it is important but hard to identify the one to try first when we deal with a new segmentation task. However, our results show that for the QUESTION: which loss function should we choose for medical image segmentation tasks? The ANSWER could be that, overall, using Dice-related compound loss functions is a better choice.
关于选择损失函数的建议。有20个损失函数可供选择,当我们处理一个新的分割任务时,确定首先尝试的函数是很重要的,但很难。然而,我们的结果表明,对于问题:我们应该为医学图像分割任务选择哪个损失函数?答案可能是,总的来说,使用与Dice有关的复合损失函数是一个更好的选择。

【文献阅读】医学图像分割中的loss函数选择-Loss odyssey in medical image segmentation loss相关推荐

  1. 医学图像分割新网络:Boundary-aware Context Neural Network for Medical Image Segmentation

    文章目录 摘要 一.引言及相关方法 二.本文主要方法 2.1 总体介绍 2.2 Pyramid Edge Extraction Module 2.3 Mini Multi-Task Learning ...

  2. 如何量化医学图像分割中的置信度?

    点击上方"小白学视觉",选择加"星标"或"置顶" 重磅干货,第一时间送达 本文转自:计算机视觉life 导读 利用变分推断进行分割置信度的预 ...

  3. 分享丨对医学图像分割中的置信度进行量化

    转自 AI公园 作者:Abhinav Sagar 编译:ronghuaiyang 导读 利用变分推断进行分割置信度的预测. 在过去的十年里,深度学习在一系列的应用中取得了巨大的成功.然而,为了验证和可 ...

  4. 【每周CV论文推荐】GAN在医学图像分割中的典型应用

    欢迎来到<每周CV论文推荐>.在这个专栏里,还是本着有三AI一贯的原则,专注于让大家能够系统性完成学习,所以我们推荐的文章也必定是同一主题的. 生成对抗网络是一项非常基础的技术,医学图像则 ...

  5. 医学图像分割中常用的度量指标

    从医学的角度来讲,大家关注的性能指标应该是两个:特异性和敏感性,敏感度其实指的是一种查全率,是不是把所有的结节都找到了.特异性是指假阳性的比例.在某种意义上,这是两个矛盾的指标,如果把一个指标调到最大 ...

  6. [概念]医学图像分割中常用的Loss function(损失函数) + 从loss处理图像分割中类别极度不均衡

    目录 一.前言 二.损失函数 2.1 根据像素正确与否设计的loss function 2.1.1  Log Loss 2.1.2 WCE Loss 2.1.3 Focal Loss 2.2 根据评测 ...

  7. 基于U-Net的递归残差卷积神经网络在医学图像分割中的应用

    转载: 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/weixin_45723705/ ...

  8. 深度学习核心技术精讲100篇(五十八)- 如何量化医学图像分割中的置信度?

    前言 在过去的十年里,深度学习在一系列的应用中取得了巨大的成功.然而,为了验证和可解释性,我们不仅需要模型做出的预测,还需要知道它在做出预测时的置信度.这对于让医学影像学的临床医生接受它是非常重要的. ...

  9. 文献阅读-医学超声图像分割-利用边界距离回归和像素分类网络实现超声图像肾脏自动分割

    原文:Yin S, Peng Q, Li H, et al. Automatic kidney segmentation in ultrasound images using subsequent b ...

最新文章

  1. linux 系统 UDP 丢包问题分析思路
  2. Win32 ListView控件基本使用
  3. C语言基础:时间转换成字符串 strftime的代码
  4. 分享15款为开发人员准备的开发移动应用程序必备的新资源和工具
  5. 十大经典排序算法之选择排序及其优化
  6. thinkphp中URL传参数的几种方式
  7. Python之数据分析(间接联合排序、所有最值相关函数、有序插入、定积分、插值器对象)
  8. windows server 2008 - 隐藏磁盘分区 (2)
  9. arduino接收hmi屏幕_汽车HMI设计中交互设计的发展趋势
  10. SQLite的使用一
  11. MS SQL基本语法及实例操作
  12. 7_22_html_美食网设计
  13. 爱签电子合同助力无纸化办公,青岛将推行存量房网签合同电子签名
  14. 微信公众号赞赏账户头像在哪里修改?附详细图文教程
  15. crmeb打通版开源微信公众号小程序商城框架源码
  16. cesium的鼠标事件
  17. 电脑上玩手机游戏,效果秒杀模拟器
  18. Arthas的使用与进阶
  19. DPDK — L3 Forwarding 与 IP 路由选择算法
  20. java aes对称加密算法_JavaAES128对称加密算法实现

热门文章

  1. 破解Zip加密文件常用的几种方法
  2. Android一点 仿淘宝购物车动画
  3. 《精力管理》读书笔记——第二部分
  4. SmartWin++笔记
  5. 堕落史话——一入学,就堕落
  6. 手机成移动互联网入口必争之地
  7. 货币金融学(1): 货币/ 信用/ 金融机构
  8. 角色动画(Character Animation)的现状与趋势
  9. 170713 逆向-填数游戏
  10. 观察 | 经济学诺奖的启示:金融科技的核心任务是什么?