Spaces:
Runtime error
Runtime error
Tobias Cornille
commited on
Commit
·
dd286da
1
Parent(s):
392fde6
Fix shrink 0
Browse files
app.py
CHANGED
|
@@ -176,8 +176,10 @@ def semantic_inds_to_shrunken_bool_masks(
|
|
| 176 |
bool_masks = torch.zeros((num_categories, *semantic_inds.shape), dtype=bool)
|
| 177 |
for category in range(num_categories):
|
| 178 |
binary_mask = semantic_inds == category
|
| 179 |
-
shrunken_binary_mask_array =
|
| 180 |
-
binary_mask.numpy(), structure=shrink_kernel
|
|
|
|
|
|
|
| 181 |
)
|
| 182 |
bool_masks[category] = torch.from_numpy(shrunken_binary_mask_array)
|
| 183 |
|
|
|
|
| 176 |
bool_masks = torch.zeros((num_categories, *semantic_inds.shape), dtype=bool)
|
| 177 |
for category in range(num_categories):
|
| 178 |
binary_mask = semantic_inds == category
|
| 179 |
+
shrunken_binary_mask_array = (
|
| 180 |
+
ndimage.binary_erosion(binary_mask.numpy(), structure=shrink_kernel)
|
| 181 |
+
if shrink_kernel_size > 0
|
| 182 |
+
else binary_mask.numpy()
|
| 183 |
)
|
| 184 |
bool_masks[category] = torch.from_numpy(shrunken_binary_mask_array)
|
| 185 |
|