Spaces:
Paused
Paused
update colorize mask
#1
by
johnnv
- opened
app.py
CHANGED
|
@@ -13,9 +13,10 @@ def visualize_instance_seg_mask(mask):
|
|
| 13 |
image = np.zeros((mask.shape[0], mask.shape[1], 3))
|
| 14 |
labels = np.unique(mask)
|
| 15 |
label2color = {label: (random.randint(0, 1), random.randint(0, 255), random.randint(0, 255)) for label in labels}
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
image[
|
|
|
|
| 19 |
image = image / 255
|
| 20 |
return image
|
| 21 |
|
|
|
|
| 13 |
image = np.zeros((mask.shape[0], mask.shape[1], 3))
|
| 14 |
labels = np.unique(mask)
|
| 15 |
label2color = {label: (random.randint(0, 1), random.randint(0, 255), random.randint(0, 255)) for label in labels}
|
| 16 |
+
|
| 17 |
+
for id in labels:
|
| 18 |
+
image[mask == id] = label2color[id]
|
| 19 |
+
|
| 20 |
image = image / 255
|
| 21 |
return image
|
| 22 |
|