I’ve not personally verified this loss implentation with the original SOLO paper but check if it could help you as a baseline:

  

      github.com
  

  
    quanghona/SOLO_tf2/blob/master/train/loss.py 2


    import tensorflow as tf


class SOLOLoss(tf.keras.losses.Loss):
    """Loss for SOLO network

    Usage: This class can be use for built-in training method (keras) or custom
    training procedure
    - For built-in method, get the loss functions by invoke `get_category_loss`
    and `get_mask_loss` method and loss.weights to get the weights
    - For custom training function, Just invoke the functional method to get all
    losses at the same time

    Note: if call method is apply instead of __call__, please add `reduction`
    parameter to the constructor
    """
    def __init__(self, mask_weight=3, d_mask='dice', focal_gamma=2.0, focal_alpha=0.25, name='solo_loss'):
        super(SOLOLoss, self).__init__(name=name)
        self.mask_weight = mask_weight
        self.weights = [1, mask_weight]



  This file has been truncated. show original