Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,19 +7,8 @@ import base64
|
|
7 |
|
8 |
H = 256
|
9 |
W = 256
|
10 |
-
|
11 |
-
|
12 |
-
def dice_loss(y_true, y_pred):
|
13 |
-
y_true = tf.keras.layers.Flatten()(y_true)
|
14 |
-
y_pred = tf.keras.layers.Flatten()(y_pred)
|
15 |
-
intersection = tf.reduce_sum(y_true * y_pred)
|
16 |
-
return 1.0 - (2. * intersection + smooth) / (tf.reduce_sum(y_true) + tf.reduce_sum(y_pred) + smooth)
|
17 |
-
|
18 |
-
def dice_coef(y_true, y_pred):
|
19 |
-
y_true = tf.keras.layers.Flatten()(y_true)
|
20 |
-
y_pred = tf.keras.layers.Flatten()(y_pred)
|
21 |
-
intersection = tf.reduce_sum(y_true * y_pred)
|
22 |
-
return (2. * intersection + smooth) / (tf.reduce_sum(y_true) + tf.reduce_sum(y_pred) + smooth)
|
23 |
|
24 |
model_path = "model.h5"
|
25 |
|
|
|
7 |
|
8 |
H = 256
|
9 |
W = 256
|
10 |
+
|
11 |
+
from metrics import dice_loss, dice_coef
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
model_path = "model.h5"
|
14 |
|