Spaces:
Sleeping
Sleeping
Yao Zhang
commited on
Commit
·
85df3b7
1
Parent(s):
f9ca5f7
init
Browse files
app.py
CHANGED
|
@@ -23,8 +23,8 @@ from skimage import io, segmentation, morphology, measure, exposure
|
|
| 23 |
def visualize_instance_seg_mask(mask):
|
| 24 |
image = np.zeros((mask.shape[0], mask.shape[1], 3))
|
| 25 |
labels = np.unique(mask)
|
| 26 |
-
label2color = {0: (0, 0, 0)}
|
| 27 |
label2color = {label: (random.randint(0, 1), random.randint(0, 255), random.randint(0, 255)) for label in labels if label > 0}
|
|
|
|
| 28 |
for i in range(image.shape[0]):
|
| 29 |
for j in range(image.shape[1]):
|
| 30 |
image[i, j, :] = label2color[mask[i, j]]
|
|
|
|
| 23 |
def visualize_instance_seg_mask(mask):
|
| 24 |
image = np.zeros((mask.shape[0], mask.shape[1], 3))
|
| 25 |
labels = np.unique(mask)
|
|
|
|
| 26 |
label2color = {label: (random.randint(0, 1), random.randint(0, 255), random.randint(0, 255)) for label in labels if label > 0}
|
| 27 |
+
label2color[0] = (0, 0, 0)
|
| 28 |
for i in range(image.shape[0]):
|
| 29 |
for j in range(image.shape[1]):
|
| 30 |
image[i, j, :] = label2color[mask[i, j]]
|