Skip to content

semsegmetrics

semsegmetrics

Module for metrics for semantic segmentation

Classes

AvgNegPredSemSeg

AvgNegPredSemSeg(name='avg_neg_pred')

Negative Classification Values for semantic segmentation

Source code in niceml/dlframeworks/keras/metrics/semsegmetrics.py
def __init__(self, name: str = "avg_neg_pred"):
    self.__name__ = name

AvgNegTargetCountSemSeg

AvgNegTargetCountSemSeg(name='avg_neg_target_count')

Average negative target count for one image in semantic segmentation

Source code in niceml/dlframeworks/keras/metrics/semsegmetrics.py
def __init__(self, name: str = "avg_neg_target_count"):
    self.__name__ = name

AvgPosPredSemSeg

AvgPosPredSemSeg(name='avg_pos_pred')

Positive Classification Values for semantic segmentation

Source code in niceml/dlframeworks/keras/metrics/semsegmetrics.py
def __init__(self, name: str = "avg_pos_pred"):
    self.__name__ = name

AvgPosTargetCountSemSeg

AvgPosTargetCountSemSeg(name='avg_pos_target_count')

Average positive target count for one image in semantic segmentation

Source code in niceml/dlframeworks/keras/metrics/semsegmetrics.py
def __init__(self, name: str = "avg_pos_target_count"):
    self.__name__ = name

Functions

avg_mask_prediction_value

avg_mask_prediction_value(mask, prediction)

Average prediction value for a given mask

Source code in niceml/dlframeworks/keras/metrics/semsegmetrics.py
def avg_mask_prediction_value(mask, prediction):
    """Average prediction value for a given mask"""
    prob_values = tf.where(tf.equal(mask, 1.0), prediction, 0.0)
    probs = tf.reduce_sum(prob_values, axis=[-1, -2, -3])
    mask_count = tf.reduce_sum(mask, axis=[-1, -2, -3])
    avg_probs = tf.math.divide_no_nan(probs, mask_count)
    return avg_probs