Skip to content

Instantly share code, notes, and snippets.

View amartya-k's full-sized avatar
🏠
Working from home

Amartya Kalapahar amartya-k

🏠
Working from home
View GitHub Profile
@wassname
wassname / dice_loss_for_keras.py
Created September 26, 2016 08:32
dice_loss_for_keras
"""
Here is a dice loss for keras which is smoothed to approximate a linear (L1) loss.
It ranges from 1 to 0 (no error), and returns results similar to binary crossentropy
"""
# define custom loss and metric functions
from keras import backend as K
def dice_coef(y_true, y_pred, smooth=1):