JanMarcelKezmann / TensorFlow-Advanced-Segmentation-Models

A Python Library for High-Level Semantic Segmentation Models based on TensorFlow and Keras with pretrained backbones.
Other
151 stars 48 forks source link

score is misspelled in two function #21

Closed mehran66 closed 2 years ago

mehran66 commented 2 years ago

score is misspelled in these two function as sccore than results in an error:

def precision(y_true, y_pred, class_weights=1., smooth=1e-5, threshold=None): y_true, y_pred = gather_channels(y_true, y_pred) y_pred = round_if_needed(y_pred, threshold) axes = [1, 2] if K.image_data_format() == "channels_last" else [2, 3] tp = K.sum(y_true * y_pred, axis=axes) fp = K.sum(y_pred, axis=axes) - tp score = (tp + smooth) / (tp + fp + smooth) score = average(sccore, class_weights) return score

def recall(y_true, y_pred, class_weights=1., smooth=1e-5, threshold=None): y_true, y_pred = gather_channels(y_true, y_pred) y_pred = round_if_needed(y_pred, threshold) axes = [1, 2] if K.image_data_format() == "channels_last" else [2, 3] tp = K.sum(y_true * y_pred, axis=axes) fn = K.sum(y_true, axis=axes) - tp score = (tp + smooth) / (tp + fn + smooth) score = average(sccore, class_weights) return score

JanMarcelKezmann commented 2 years ago

Hi @mehran66 ,

thank you for mentioning the bug, I have pushed a fix.