Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A survey of loss function for semantic segmentation #39

Open
masa-suke opened this issue Jan 29, 2024 · 0 comments
Open

A survey of loss function for semantic segmentation #39

masa-suke opened this issue Jan 29, 2024 · 0 comments

Comments

@masa-suke
Copy link

Shruti Jadon. 2020. "A survey of loss function for semantic segmentation" arXiv [eess.IV]. https://arxiv.org/abs/2006.14822.

  • 損失関数は、モデルの性能を決定する上で重要な役割を果たす。
    • セグメンテーションのような複雑な目的においては、普遍的な損失関数を決定することは困難
    • 多くの場合は、分布、歪度、境界など、学習に用いるデータセットの特性に依存する。

本論文では、セマンティックセグメンテーションのための14のよく知られた損失関数をまとめた

TABLE I:
Types of Semantic Segmentation Loss Functions

Type Loss Function
Distribution-based Loss Binary Cross-Entropy
Weighted Cross-Entropy
Balanced Cross-Entropy
Focal Loss
Distance map derived loss penalty term
Region-based Loss Dice Loss
Sensitivity-Specificity Loss
Tversky Loss
Focal Tversky Loss
Log-Cosh Dice Loss(ours)
Boundary-based Loss Hausdorff Distance loss
Shape aware loss
Compounded Loss Combo Loss
Exponential Logarithmic Loss

また、良い正確な最適化のために、Dice損失関数を扱いやすい新たな損失関数を提案した。

※本サマリーでは、論文中に列挙されている各損失関数の概要とメインの式を記載しているが、詳細は、それぞれの論文を確認してほしい。

Abstract

Image Segmentation has been an active field of research as it has a wide range of applications, ranging from automated disease detection to self driving cars. In the past 5 years, various papers came up with different objective loss functions used in different cases such as biased data, sparse segmentation, etc. In this paper, we have summarized some of the well-known loss functions widely used for Image Segmentation and listed out the cases where their usage can help in fast and better convergence of a model. Furthermore, we have also introduced a new log-cosh dice loss function and compared its performance on NBFS skull-segmentation open source data-set
with widely used loss functions. We also showcased that certain loss functions perform well across all data-sets and can be taken as a good baseline choice in unknown data distribution scenarios.

(DeepL翻訳)
画像セグメンテーションは、病気の自動検出から自動運転車まで、幅広い用途があるため、活発な研究分野となっている。過去5年間で、様々な論文が、偏ったデータ、スパースセグメンテーションなど、様々なケースで使用される様々な目的損失関数を発表した。本論文では、画像分割に広く使われている有名な損失関数のいくつかを要約し、その使用によってモデルの高速かつ良好な収束に役立つケースを列挙した。さらに、新しいlog-cosh dice損失関数を導入し、NBFS skull-segmentationオープンソースデータセットでその性能を比較した。
また、特定の損失関数が全てのデータセットで良好な性能を示し、未知のデータ分布シナリオにおける良いベースライン選択として捉えることができることを紹介した。

コード

https://github.com/shruti-jadon/Semantic-Segmentation-Loss-Functions

技術・手法のポイント

A. Binary Cross-Entropy

Binary Cross-Entropyは2値分類の損失関数で、ピクセル与えられた確率変数またはイベントの集合に対する2つの確率分布の差の尺度として定義される。セグメンテーションはピクセルレベルの分類であるため、うまく機能する。
次のように定義される[4]。

$$L_{BCE}(y, \hat{y}) = −(y\log(\hat{y}) + (1 −y)log(1 −\hat{y})) \tag{1}$$

B. Weighted Binary Cross-Entropy(WCE)

重み付きのBinary Cross-Entropyで、Binary Cross-Entropyの変種。
不均衡データ(分類するラベルに偏りがある)の場合に広く用いられており、次のように定義される[5]。

$$L_{W−BCE}(y, \hat{y}) = −(\beta ∗ ylog(\hat{y}) + (1 − y)log(1 −\hat{y})) \tag{2}$$

β値で偽陰性と偽陽性を調整するすることができる。
偽陰性の数を減らしたい場合はβ > 1, 偽陽性の数を減らしたい場合はβ < 1に設定する。

C. Balanced Cross-Entropy(BCE)

WCEと類似の損失関数。違いは、WCEが陽性のサンプルにのみ重みづけするのに対し、BCEは陰性のサンプルにも重み付けをすること。次のように定義される[7]。

$$L_{BCE}(y,\hat{y}) = −(\beta ∗ ylog(\hat{y})+(1−\beta)∗(1−y)log(1−\hat{y})) \tag{3}$$

D. Focal Loss(FL)

Binary Cross-Entropyの派生で、(判別が)簡単なサンプルの寄与を重み付けし、判別が難しいサンプルの学習により焦点を当てる損失関数。Binary Cross-Entropyと同様に、不均衡データに有効とされ、次のように定義される[9]。

$$FL(p_t) = −\alpha t(1 − p_t)\gamma log(p_t) \tag{7}$$

E. Dice Loss(DL)

ダイス係数は、2つの画像の類似度の指標として、コンピュータビジョンのコミュニティで広く使用されている。
本章の損失関数は、2016年にダイス損失として損失関数として適応されたもので、次のように定義される[10]

$$DL(y, \hat{p}) = \frac{2y\hat{p}+1}{1 − y + \hat{p} + 1} \tag{8}$$

F. Tverskey Loss

Dices係数を一般化、重みづけしたTversky index(TI)を損失関数としたものがTverskey Loss(TL)。
TLは、判別が難しいサンプルに焦点を当てることが特徴。
TIとTLは、次のように定義される[11]。

$$TI(p,\hat{p}) = \frac{p\hat{p}}{p\hat{p}+ \gamma(1 −p)\hat{p}+ (1 − \gamma)p(1 − \hat{p})} \tag{9}$$ $$TL(p,\hat{p}) = \frac{1+p\hat{p}}{1+p\hat{p}+\beta(1−p)\hat{p}+(1−\beta)p(1−\hat{p})} \tag{10}$$

G. Focal Tversky Loss

FLと同様に、判別が難しいサンプルに焦点を当てることが特徴。
以下のようにγ係数を用いて、小さなROI(関心領域)のような難しい事例を学習しようとする。

$$FTL = \sum_c(1 − TI_c)^\gamma \tag{11}$$

H. Sensitivity Specificity Loss

DLと同様に、SensitivitySpecificityはセグメンテーション予測値を評価するために広く用いられている指標である。
この損失関数(Sensitivity Specificity Loss, SSL)は、SensitivitySpecificity、およびパラメータで下記のように定義され、不均衡データに有効とされる。

$$SSL = w * sensitivity + (1-w)*specificity \tag{12} $$$$

I. Shape-aware Loss

名前からもわかるように、Shape-aware Lossは、形状を考慮した損失関数。
一般に、すべての損失関数はピクセルレベルで動作するが、Shape-aware Lossは、予測されたセグメンテーションの曲線付近の点間のユークリッド距離を曲線にする平均点を計算し、それをクロスエントロピーの損失関数として使用する。

$$L_{shape−aware} = −\sum_i CE(y, \hat{y}) − \sum_i i E_iCE(y, \hat{y}) \tag{16} $$$$

J. Combo Loss

Combo Lossは、Dice Lossとモディファイされたクロスエントロピーの加重和として定義される。
これは、不均衡データによるダイスロスの柔軟性を活用しようとすると同時に、クロスエントロピーをcurve smoothingに利用するものである。

$$L_{m−bce} = −\frac{1}{N} \sum_i \beta(y−log(\hat{y}))+(1−\beta)(1−y)log(1−\hat{y}) \tag{17}$$ $$CL(y,\hat{y}) = \alpha L_{m-bce}-(1-\alpha)DL(y,\hat{y}) \tag{18}$$

K. Exponential Logarithmic Loss

DLとCross Entropy Lossを組み合わせより、予測精度が低いものに着目した損失関数。
次のように定義される[16]。

$$L_{Exp} = w_{Dice} L_{Dice} + w_{cross}L_{cross}$$

L. Distance map derived loss penalty term

距離マップは、Ground truthと予測されたマップの距離(ユークリッド距離、絶対値など)として定義することができる。
本章の損失関数は、グランドトゥルースマスクから得られた距離マップを使用し、カスタムペナルティに基づく損失関数として次のように定義される[17]。

$$L(y,p) = \frac{1}{N} \sum^N_{i=1} (1+\phi)(⊙)(L_{CE})(y,p) \tag{22}$$

M. Hausdorff Distance Loss

Hausdorff Distance (HD) は、セグメンテーションアプローチによって、モデルの性能を追跡するために使用されるメトリックで、以下のように定義される。

$$d(X,Y) = \max_{xεX} min_{yεY} ||x − y||^2 \tag{23}$$

N. Correlation Maximized Structural Similarity Loss

セマンティックセグメンテーションの損失関数は、ピクセルレベルの構造情報を無視し、ピクセルレベルでの分類誤差に着目していることが多いが、本章の損失関数[20]は、CRF、GANなどの構造的事前分布を用いて情報を追加することを試みている。また、グランドトゥルースマップと予測マップの間に高い正の線形相関を達成するために、構造的類似性損失(SSL)を導入していることが特徴。

$$Loss_{ssl}(y_{n,c},p_{n,c}) = e_{n,c}f_{n,c}L_{CE}(y_{n,c},p_{n,c})$$

O. Log-Cosh Dice Loss

Dice Lossのバリエーションと、回帰ログコシュアプローチにインスパイアされた平滑化手法で、本論文で提案する損失関数。
歪んだデータセットにも対応可能とされている。

$$L_{lc−dce} = log(cosh(DiceLoss)) \tag{32}$$

また、NBFS Skill Stripping Dataset を用いて、他の損失関数と比較検証し、優位性を示している。

TABLE III:
Comparison of some above mentioned loss functions on basis of Dice scores, Sensitivity and Specificity for Skull Segmentation
Loss
Functions
Evaluation Metrics
Dice Coefficient
Evaluation Metrics
Sensitivity
Evaluation Metrics
Specificity
Binary Cross-Entropy 0.968 0.976 0.998
Weighted Cross-Entropy 0.962 0.966 0.998
Focal Loss 0.936 0.952 0.999
Dice Loss 0.970 0.981 0.998
Tversky Loss 0.965 0.979 0.996
Focal Tversky Loss 0.977 0.990 0.997
Sensitivity-Specificity Loss 0.957 0.980 0.996
Exp-Logarithmic Loss 0.972 0.982 0.997
Log Cosh Dice Loss 0.989 0.975 0.997

重要な引用

  • [4] Ma Yi-de, Liu Qing, and Qian Zhi-Bai. Automated image segmentation using improved pcnn model based on cross-entropy. In Proceedings of 2004 International Symposium on Intelligent Multimedia, Video and Speech Processing, 2004., pages 743–746. IEEE, 2004.
  • [5] Vasyl Pihur, Susmita Datta, and Somnath Datta. Weighted rank aggregation of cluster validation measures: a monte carlo cross-entropy approach. Bioinformatics, 23(13):1607–1615, 2007.
  • [7] Saining Xie and Zhuowen Tu. Holistically-nested edge detection. In Proceedings of the IEEE international conference on computer vision, pages 1395–1403, 2015.
  • [9] TY Lin, P Goyal, R Girshick, K He, and P Doll ́ar. Focal loss for dense object detection. arxiv 2017. arXiv preprint arXiv:1708.02002, 2002.
  • [10] Carole H Sudre, Wenqi Li, Tom Vercauteren, Sebastien Ourselin, and M Jorge Cardoso. Generalised dice overlap as a deep learning loss function for highly unbalanced segmentations. In Deep learning in medical image analysis and multimodal learning for clinical decision support, pages 240–248. Springer, 2017.
  • [11] Seyed Sadegh Mohseni Salehi, Deniz Erdogmus, and Ali Gholipour. Tversky loss function for image segmentation using 3d fully convolutional deep networks. In International Workshop on Machine Learningin Medical Imaging, pages 379–387. Springer, 2017.
  • [12] Nabila Abraham and Naimul Mefraz Khan. A novel focal tversky loss function with improved attention u-net for lesion segmentation. In 2019 IEEE 16th International Symposium on Biomedical Imaging (ISBI 2019), pages 683–687. IEEE, 2019.
  • [13] Seyed Raein Hashemi, Seyed Sadegh Mohseni Salehi, Deniz Erdogmus, Sanjay P Prabhu, Simon K Warfield, and Ali Gholipour. Asymmetric loss functions and deep densely-connected networks for highly-imbalanced medical image segmentation: Application to multiple sclerosis lesion detection. IEEE Access, 7:1721–1735, 2018.
  • [14] Zeeshan Hayder, Xuming He, and Mathieu Salzmann. Shape-aware instance segmentation. arXiv preprint arXiv:1612.03129, 2(5):7, 2016.
  • [15] Saeid Asgari Taghanaki, Yefeng Zheng, S Kevin Zhou, Bogdan Georgescu, Puneet Sharma, Daguang Xu, Dorin Comaniciu, and Ghassan Hamarneh. Combo loss: Handling input and output imbalance in multi-organ segmentation. Computerized Medical Imaging and Graphics, 75:24–33, 2019.
  • [16] Ken CL Wong, Mehdi Moradi, Hui Tang, and Tanveer Syeda-Mahmood. 3d segmentation with exponential logarithmic loss for highly unbalanced object sizes. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pages 612–619. Springer, 2018.
  • [19] Javier Ribera, David G ̈uera, Yuhao Chen, and Edward J. Delp. Weighted hausdorff distance: A loss function for object localization. ArXiv, abs/1806.07564, 2018.
  • [20] Shuai Zhao, Boxi Wu, Wenqing Chu, Yao Hu, and Deng Cai. Correlation maximized structural similarity loss for semantic segmentation. arXiv preprint arXiv:1910.08711, 2019.
  • [21] Maxim Berman, Amal Rannen Triki, and Matthew B. Blaschko. The lovsz-softmax loss: A tractable surrogate for the optimization of the intersection-over-union measure in neural networks, 2017.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant