(self, alpha=1.0, beta=10, ohem_ratio=3, reduction='mean', eps=1e-6)
Implement PSE Loss.
        :param alpha: binary_map loss 前面的系数
        :param beta: threshold_map loss 前面的系数
        :param ohem_ratio: OHEM的比例
        :param reduction: 'mean' or 'sum'对 batch里的loss 算均值或求和
Implement PSE Loss.
        :param alpha: binary_map loss 前面的系数
        :param beta: threshold_map loss 前面的系数
        :param ohem_ratio: OHEM的比例
        :param reduction: 'mean' or 'sum'对 batch里的loss 算均值或求和
Implement PSE Loss . : param alpha : binary_map loss 前面的系数 : param beta : threshold_map loss 前面的系数 : param ohem_ratio : OHEM的比例 : param reduction : mean or sum 对 batch里的loss 算均值或求和
def __init__(self, alpha=1.0, beta=10, ohem_ratio=3, reduction='mean', eps=1e-6):
        """
        Implement PSE Loss.
        :param alpha: binary_map loss 前面的系数
        :param beta: threshold_map loss 前面的系数
        :param ohem_ratio: OHEM的比例
        :param reduction: 'mean' or 'sum'对 batch里的loss 算均值或求和
        """
        super().__init__()
        assert reduction in ['mean', 'sum'], " reduction must in ['mean','sum']"
        self.alpha = alpha
        self.beta = beta
        self.bce_loss = BalanceCrossEntropyLoss(negative_ratio=ohem_ratio)
        self.dice_loss = DiceLoss(eps=eps)
        self.l1_loss = MaskL1Loss(eps=eps)
        self.ohem_ratio = ohem_ratio
        self.reduction = reduction
def __init__ ( self , alpha = 1.0 , beta = 10 , ohem_ratio = 3 , reduction = 'mean' , eps = 1e-6 ) : super ( ) . __init__ ( ) assert reduction in [ 'mean' , 'sum' ] , " reduction must in ['mean','sum']" self . alpha = alpha self . beta = beta self . bce_loss = BalanceCrossEntropyLoss ( negative_ratio = ohem_ratio ) self . dice_loss = DiceLoss ( eps = eps ) self . l1_loss = MaskL1Loss ( eps = eps ) self . ohem_ratio = ohem_ratio self . reduction = reduction