update
Browse files
seg2art/inference_util.py
CHANGED
@@ -33,15 +33,15 @@ colors = np.array(colors)
|
|
33 |
|
34 |
|
35 |
def remap_label(arr):
|
36 |
-
# compare only
|
37 |
-
|
38 |
|
39 |
# remap color to label
|
40 |
for i in range(len(colors)):
|
41 |
-
|
42 |
# others to 15
|
43 |
-
|
44 |
-
return
|
45 |
|
46 |
|
47 |
preprocess = transforms.Compose(
|
|
|
33 |
|
34 |
|
35 |
def remap_label(arr):
|
36 |
+
# compare only last color channel to speed up
|
37 |
+
arr_b = arr[:, :, 0]
|
38 |
|
39 |
# remap color to label
|
40 |
for i in range(len(colors)):
|
41 |
+
arr_b[arr_b == colors[i][2]] = values[i]
|
42 |
# others to 15
|
43 |
+
arr_b[arr_b > 15] = 15
|
44 |
+
return arr_b
|
45 |
|
46 |
|
47 |
preprocess = transforms.Compose(
|