Spaces:
Runtime error
Runtime error
shivamkunkolikar commited on
Commit ·
0af2f6b
1
Parent(s): feece80
edit May15 5:09PM
Browse files- inference.py +7 -1
inference.py
CHANGED
|
@@ -134,10 +134,16 @@ def preprocess(image, mask):
|
|
| 134 |
if mask.shape[2]:
|
| 135 |
mask = cv2.cvtColor(mask, cv2.COLOR_BGR2GRAY)
|
| 136 |
|
|
|
|
|
|
|
| 137 |
image = image.astype(np.float32) / 255.0
|
| 138 |
mask = mask.astype(np.float32) / 255.0
|
| 139 |
mask = (mask > 0.5).astype(np.float32)
|
| 140 |
-
mask = cv2.resize(mask, (image.shape[0], image.shape[1]))
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
|
| 142 |
mask = np.expand_dims(mask, axis=-1)
|
| 143 |
|
|
|
|
| 134 |
if mask.shape[2]:
|
| 135 |
mask = cv2.cvtColor(mask, cv2.COLOR_BGR2GRAY)
|
| 136 |
|
| 137 |
+
|
| 138 |
+
|
| 139 |
image = image.astype(np.float32) / 255.0
|
| 140 |
mask = mask.astype(np.float32) / 255.0
|
| 141 |
mask = (mask > 0.5).astype(np.float32)
|
| 142 |
+
# mask = cv2.resize(mask, (image.shape[0], image.shape[1]))
|
| 143 |
+
|
| 144 |
+
image = cv2.resize(image, (512, 512))
|
| 145 |
+
mask = cv2.resize(mask, (512, 512))
|
| 146 |
+
|
| 147 |
|
| 148 |
mask = np.expand_dims(mask, axis=-1)
|
| 149 |
|