Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,15 +18,15 @@ def jaccard_coef(y_true, y_pred):
|
|
| 18 |
intersection = K.sum(y_true_flatten * y_pred_flatten)
|
| 19 |
final_coef_value = (intersection + 1.0) / (K.sum(y_true_flatten) + K.sum(y_pred_flatten) - intersection + 1.0)
|
| 20 |
return final_coef_value
|
|
|
|
| 21 |
|
| 22 |
-
|
| 23 |
dice_loss = sm.losses.DiceLoss(class_weights = weights)
|
| 24 |
focal_loss = sm.losses.CategoricalFocalLoss()
|
| 25 |
-
total_loss = dice_loss + (1 * focal_loss)
|
| 26 |
|
| 27 |
-
satellite_model = load_model('model/C:/Users/sa/Desktop/Model_Training/satellite_segmentation_full.h5',
|
| 28 |
-
custom_objects=({'dice_loss_plus_1focal_loss': total_loss,'jaccard_coef': jaccard_coef}))
|
| 29 |
|
|
|
|
| 30 |
|
| 31 |
def process_input_image(image_source):
|
| 32 |
image = np.expand_dims(image_source, 0)
|
|
|
|
| 18 |
intersection = K.sum(y_true_flatten * y_pred_flatten)
|
| 19 |
final_coef_value = (intersection + 1.0) / (K.sum(y_true_flatten) + K.sum(y_pred_flatten) - intersection + 1.0)
|
| 20 |
return final_coef_value
|
| 21 |
+
|
| 22 |
|
| 23 |
+
weights = [0.2,0.2,0.2,0.2,0.2]
|
| 24 |
dice_loss = sm.losses.DiceLoss(class_weights = weights)
|
| 25 |
focal_loss = sm.losses.CategoricalFocalLoss()
|
| 26 |
+
total_loss = dice_loss + (1 * focal_loss)
|
| 27 |
|
|
|
|
|
|
|
| 28 |
|
| 29 |
+
satellite_model = load_model('model/satellite_segmentation_full.h5',custom_objects=({'dice_loss_plus_1focal_loss': total_loss,'jaccard_coef': jaccard_coef}))
|
| 30 |
|
| 31 |
def process_input_image(image_source):
|
| 32 |
image = np.expand_dims(image_source, 0)
|