(semseg, cmap=None)
| 104 | return cmap |
| 105 | |
| 106 | def encode_seg(semseg, cmap=None): |
| 107 | # we will encode the semseg map with a fixed color map |
| 108 | if cmap is None: |
| 109 | cmap = color_map() |
| 110 | seg_t = semseg.astype(np.uint8) |
| 111 | array_seg_t = np.empty((seg_t.shape[0], seg_t.shape[1], seg_t.shape[2], cmap.shape[1]), dtype=cmap.dtype) |
| 112 | for class_i in np.unique(seg_t): |
| 113 | array_seg_t[seg_t == class_i] = cmap[class_i] |
| 114 | return array_seg_t |
| 115 | |
| 116 | def decode_seg(array_seg_t, cmap=None): |
| 117 | # we will decode the semseg map with a fixed color map |
no test coverage detected