Skip to content

Commit 6e013f4

Browse files
committed
fix colorization
1 parent e21b8e2 commit 6e013f4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

utils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,11 @@ def colorEncode(labelmap, colors):
8585
labelmap_rgb = np.zeros((labelmap.shape[0], labelmap.shape[1], 3),
8686
dtype=np.uint8)
8787
for label in unique(labelmap):
88-
labelmap_rgb += (labelmap == label)[:, :, np.newaxis] * \
89-
np.tile(colors[label],
90-
(labelmap.shape[0], labelmap.shape[1], 1))
88+
if label < 0:
89+
continue
90+
labelmap_rgb += (labelmap == label)[:, :, np.newaxis] * \
91+
np.tile(colors[label],
92+
(labelmap.shape[0], labelmap.shape[1], 1))
9193
return labelmap_rgb
9294

9395

0 commit comments

Comments
 (0)