def METHOD_NAME(self, logits, labels):
    '''
    Args:
        logits (Tensor): [N, C, H, W]
        lables (Tensor): [N, H, W]
    '''
    preds = paddle.argmax(logits, axis=1) if self.use_argmax else logits
    preds_np = preds.astype('uint8').numpy()
    labels_np = labels.astype('uint8').numpy()
    preds = paddle.to_tensor(preds, 'float32', stop_gradient=False)
    multi_class_sc_loss = paddle.zeros([preds.shape[0]])
    zero = paddle.to_tensor([0.])  # for accelerating
    # Traverse each image
    for i in range(preds.shape[0]):
        sc_loss = 0
        class_num = 0
        pred_i = preds[i]
        preds_np_i = preds_np[i]
        labels_np_i = labels_np[i]
        # Traverse each class
        for class_ in np.unique(labels_np_i):
            if class_ == self.ignore_index:
                continue
            class_num += 1
            # Connected Components Calculation
            preds_np_class = preds_np_i == class_
            labels_np_class = labels_np_i == class_
            pred_num_conn, pred_conn = cv2.connectedComponents(
                preds_np_class.astype(np.uint8))  # pred_conn.shape = [H,W]
            label_num_conn, label_conn = cv2.connectedComponents(
                labels_np_class.astype(np.uint8))
            origin_pred_num_conn = pred_num_conn
            if pred_num_conn > 2 * label_num_conn:
                pred_num_conn = min(pred_num_conn, self.max_pred_num_conn)
            real_pred_num = pred_num_conn - 1
            real_label_num = label_num_conn - 1
            # Connected Components Matching and SC Loss Calculation
            if real_label_num > 0 and real_pred_num > 0:
                img_connectivity = compute_class_connectiveity(
                    pred_conn, label_conn, pred_num_conn,
                    origin_pred_num_conn, label_num_conn, pred_i,
                    real_label_num, real_pred_num, zero)
                sc_loss += 1 - img_connectivity
            elif real_label_num == 0 and real_pred_num == 0:
                # if no connected component, SC Loss = 0, so pass
                pass
            else:
                preds_class = pred_i == int(class_)
                not_preds_class = paddle.bitwise_not(preds_class)
                labels_class = paddle.to_tensor(labels_np_class)
                missed_detect = labels_class * not_preds_class
                missed_detect_area = paddle.sum(missed_detect).astype(
                    'float32')
                sc_loss += missed_detect_area / missed_detect.numel() + 1
        multi_class_sc_loss[
            i] = sc_loss / class_num if class_num != 0 else 0
    multi_class_sc_loss = paddle.mean(multi_class_sc_loss)
    return multi_class_sc_loss