Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
import os
|
2 |
import cv2
|
3 |
from PIL import Image
|
|
|
4 |
import numpy as np
|
5 |
-
from sklearn.preprocessing import MinMaxScaler, StandardScaler
|
6 |
-
|
7 |
from matplotlib import pyplot as plt
|
8 |
import random
|
9 |
|
10 |
-
from keras.
|
11 |
from keras import backend as K
|
|
|
12 |
import gradio as gr
|
13 |
|
14 |
def jaccard_coef(y_true, y_pred):
|
@@ -23,7 +23,6 @@ def jaccard_coef(y_true, y_pred):
|
|
23 |
|
24 |
weights = [0.166,0.166,0.166,0.166,0.166,0.166]
|
25 |
|
26 |
-
import segmentation_models as sm
|
27 |
|
28 |
dice_loss = sm.losses.DiceLoss(class_weights = weights)
|
29 |
|
@@ -33,8 +32,6 @@ focal_loss = sm.losses.CategoricalFocalLoss()
|
|
33 |
total_loss = dice_loss + (1 * focal_loss)
|
34 |
|
35 |
|
36 |
-
from keras.models import load_model
|
37 |
-
|
38 |
|
39 |
saved_model = load_model('model/satellite_segmentation_full.h5',
|
40 |
custom_objects=({'dice_loss_plus_1focal_loss': total_loss,
|
|
|
1 |
import os
|
2 |
import cv2
|
3 |
from PIL import Image
|
4 |
+
import segmentation_models as sm
|
5 |
import numpy as np
|
|
|
|
|
6 |
from matplotlib import pyplot as plt
|
7 |
import random
|
8 |
|
9 |
+
from keras.models import load_model
|
10 |
from keras import backend as K
|
11 |
+
|
12 |
import gradio as gr
|
13 |
|
14 |
def jaccard_coef(y_true, y_pred):
|
|
|
23 |
|
24 |
weights = [0.166,0.166,0.166,0.166,0.166,0.166]
|
25 |
|
|
|
26 |
|
27 |
dice_loss = sm.losses.DiceLoss(class_weights = weights)
|
28 |
|
|
|
32 |
total_loss = dice_loss + (1 * focal_loss)
|
33 |
|
34 |
|
|
|
|
|
35 |
|
36 |
saved_model = load_model('model/satellite_segmentation_full.h5',
|
37 |
custom_objects=({'dice_loss_plus_1focal_loss': total_loss,
|