计算机工程与应用 ›› 2024, Vol. 60 ›› Issue (19): 242-249.DOI: 10.3778/j.issn.1002-8331.2307-0076

• 图形图像处理 • 上一篇    下一篇

考虑数据分布损失的图像分割

张震,彭景昊,田鸿朋   

  1. 郑州大学  电气与信息工程学院,郑州  450001
  • 出版日期:2024-10-01 发布日期:2024-09-30

Design of Loss Function Considering Data Distribution

ZHANG Zhen, PENG Jinghao, TIAN Hongpeng   

  1. School of Electrical and Information Engineering, Zhengzhou University, Zhengzhou 450001, China
  • Online:2024-10-01 Published:2024-09-30

摘要: 在图像分割任务中,损失函数的选择直接影响模型的收敛过程和最终精度。交叉熵损失函数(cross-entropy loss,CEL)具有稳定的收敛性,但在面临数据分布不均衡的情况下精度较低。Dice损失函数(Dice loss,DL)通过区域面积计算,在处理不均衡数据时能够获得较高的精度,但在多类别数据集上难以训练。为了解决这些问题,提出了一种的交叉熵损失函数(Dice cross-entropy loss,DCEL),它对正样本使用交叉熵计算损失值,而对负样本使用交叉熵与交并比(IOU)的乘积计算损失值。这样设计使得DCEL在多类别数据集上梯度与误差正相关,有利于模型的收敛性,并通过压缩负样本损失值提升对正样本的关注度,从而提升了图像分割算法的精度。DCEL的性能在ADE20k、PASCAL VOC、LoveDA和HRF数据集上进行了验证。

关键词: 损失函数, 图像分割, 不平衡数据, 深度学习

Abstract: The choice of loss function in image segmentation tasks directly impacts the convergence process and final accuracy of the models. Cross-entropy loss (CEL) exhibits stable convergence but achieves lower accuracy when dealing with imbalanced data distributions. Dice loss (DL), which calculates based on region overlap, achieves higher accuracy in handling imbalanced data but faces difficulties when applied to multi-class datasets. To address these issues, a modified loss function called Dice cross-entropy loss (DCEL) is proposed. DCEL computes the loss value using cross-entropy for positive samples and the product of cross-entropy and intersection over union (IOU) for negative samples. This design enables DCEL to have gradients positively correlated with errors on multi-class datasets, facilitating convergence. Furthermore, by compressing the loss value of negative samples, DCEL enhances the focus on positive samples, thereby improving the accuracy of image segmentation algorithms. The performance of DCEL is validated on ADE20k, PASCAL VOC, LoveDA, and HRF datasets.

Key words: loss function, image segmentation, imbalanced data, deep learning