Closed mehran66 closed 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
Hi @mehran66 ,
thank you for mentioning the bug, I have pushed a fix.
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