Last active
January 16, 2019 22:28
-
-
Save karolzak/698c5890fdfd8f46be47cf4a5bcdc9f6 to your computer and use it in GitHub Desktop.
simple iou metric with 0.5 rounding (treshold)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ################### metrics ############################ | |
| from keras import backend as K | |
| SMOOTH = 1e-12 | |
| def iou(true, pred): | |
| y_pred_pos = K.round(K.clip(pred, 0, 1)) | |
| intersection = true * y_pred_pos | |
| union = true + y_pred_pos | |
| return K.sum(intersection + SMOOTH) / K.sum(union - intersection + SMOOTH) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment