自己实现的 SoftIoU Loss,用于前景背景的图像分割,相较于 Focal Loss,SoftIoU Loss 的好处是不需要设置 Loss 的参数了,只要关注 Model 就好了
from gluoncv.loss import Loss as gcvLoss
class SoftIoULoss(gcvLoss):
def __init__(self, batch_axis=0, weight=None):
super(SoftIoULoss, self).__init__(weight, batch_axis)
def hybrid_forward(self, F, pred, target):
pred = F.sigmoid(pred)
smooth = 1
intersection = pred * target
loss = (intersection.sum() + smooth) / (pred.sum() + target.sum() -
intersection.sum() + smooth)
loss = 1 - loss
return loss
您好,请问将SoftIoU Loss应用在红外小目标分割有什么好处吗?