dice loss源自于dice coefficient分割效果评价标准, dice coefficient具体内容如下:
def dice_coefficient(y_true, y_pre): eps=1e-5 intersection = tf.reduce_sum(y_true * y_pre) union = tf.reduce_sum(y_true) + tf.reduce_sum(y_pre) + eps loss = 1. - (2 * intersection / union ) return lossdice loss:
适用场景: 医学影像 图像分割
ss loss来源于准确度计算公式,综合考虑灵敏度和准确度, 通过添加β系统平衡两者之间的权重
具体损失:
def ssl(y_true,y_pred): elpha = 0.1 TP = tf.reduce_sum(y_pred * y_true) TN = tf.reduce_sum((1-y_pred )*(1- y_true)) FP = tf.reduce_sum(y_pred * (1-y_true)) FN = tf.reduce_sum((1-y_pred )* y_true) eps = 1e-6 sensitivity = TP/(TP+FN) specificity = TN/(TN+FP) loss = elpha * sensitivity + (1-elpha) * specificity return loss使用场景: 需要侧重TP,TN其中一个的的场合
该损失由tversky loss改进,注重于困难样本的训练
首先, TI (tversky lndex):
A表示预测值,B表示真实值,|A-B|代表FP, |B-A|代表FN,调整α与β可调整权重.
然后,FTL( focal tversky loss):
FTL =Σ (1 − TI )^γ
γ取[1,3]