Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -25,9 +25,9 @@ def dice_metric(y_pred, y_true):
|
|
25 |
|
26 |
def focal_loss(predict, true):
|
27 |
error = tf.keras.losses.binary_crossentropy(predict, true)
|
28 |
-
pt = tf.exp(error)
|
29 |
-
|
30 |
-
return dice_metric(predict, true) + (1*tf.reduce_mean(
|
31 |
|
32 |
def focal_iou(y_true, y_pred):
|
33 |
return focal_loss(y_true, y_pred) - K.log(jacard(y_true, y_pred))
|
|
|
25 |
|
26 |
def focal_loss(predict, true):
|
27 |
error = tf.keras.losses.binary_crossentropy(predict, true)
|
28 |
+
pt = tf.exp(-error)
|
29 |
+
focal_loss_ = (1 - pt) ** 2 * error
|
30 |
+
return dice_metric(predict, true) + (1*tf.reduce_mean(focal_loss_))
|
31 |
|
32 |
def focal_iou(y_true, y_pred):
|
33 |
return focal_loss(y_true, y_pred) - K.log(jacard(y_true, y_pred))
|