Update app.py
Browse files
app.py
CHANGED
|
@@ -94,14 +94,19 @@ def get_predictions(y_prediction_encoded):
|
|
| 94 |
|
| 95 |
def predict_on_train(image, mask):
|
| 96 |
|
| 97 |
-
#
|
|
|
|
|
|
|
| 98 |
mask_resized = resize_image(mask)
|
| 99 |
|
| 100 |
# Create a figure
|
| 101 |
fig, ax = plt.subplots()
|
| 102 |
|
| 103 |
# Display the image
|
| 104 |
-
ax.imshow(
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
# Convert the figure to a PIL Image
|
| 107 |
image_buffer = io.BytesIO()
|
|
@@ -115,7 +120,6 @@ def predict_on_train(image, mask):
|
|
| 115 |
# ----------------------------------------------
|
| 116 |
|
| 117 |
# Steps to get prediction of the satellite image
|
| 118 |
-
sample_image_resized = resize_image(image)
|
| 119 |
y_pred = ensemble_predict(sample_image_resized)
|
| 120 |
y_pred = get_predictions(y_pred).squeeze()
|
| 121 |
|
|
|
|
| 94 |
|
| 95 |
def predict_on_train(image, mask):
|
| 96 |
|
| 97 |
+
# Get the resized image
|
| 98 |
+
sample_image_resized = resize_image(image)
|
| 99 |
+
# Get the resized mask
|
| 100 |
mask_resized = resize_image(mask)
|
| 101 |
|
| 102 |
# Create a figure
|
| 103 |
fig, ax = plt.subplots()
|
| 104 |
|
| 105 |
# Display the image
|
| 106 |
+
ax.imshow(sample_image_resized)
|
| 107 |
+
|
| 108 |
+
# Display the image
|
| 109 |
+
cax = ax.imshow(mask_resized, alpha=0.5)
|
| 110 |
|
| 111 |
# Convert the figure to a PIL Image
|
| 112 |
image_buffer = io.BytesIO()
|
|
|
|
| 120 |
# ----------------------------------------------
|
| 121 |
|
| 122 |
# Steps to get prediction of the satellite image
|
|
|
|
| 123 |
y_pred = ensemble_predict(sample_image_resized)
|
| 124 |
y_pred = get_predictions(y_pred).squeeze()
|
| 125 |
|