fradinho commited on
Commit
5a73aef
·
1 Parent(s): 44cb6dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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
- 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))
 
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))