MCPcopy Create free account
hub / github.com/00why00/JoDiffusion / decode_seg

Function decode_seg

utils/utils.py:116–125  ·  view source on GitHub ↗
(array_seg_t, cmap=None)

Source from the content-addressed store, hash-verified

114 return array_seg_t
115
116def decode_seg(array_seg_t, cmap=None):
117 # we will decode the semseg map with a fixed color map
118 if cmap is None:
119 cmap = color_map()
120 seg_t = array_seg_t.astype(np.uint8)
121 array_semseg = np.zeros((seg_t.shape[0], seg_t.shape[1]), dtype=np.uint8)
122 for i, color in enumerate(cmap):
123 equal = np.all(seg_t == color, axis=-1)
124 array_semseg[equal] = i
125 return array_semseg

Callers

nothing calls this directly

Calls 1

color_mapFunction · 0.85

Tested by

no test coverage detected