MCPcopy Create free account
hub / github.com/alinlab/SelfPatch / imwrite_indexed

Function imwrite_indexed

eval_video_segmentation.py:166–173  ·  view source on GitHub ↗

Save indexed png for DAVIS.

(filename, array, color_palette)

Source from the content-addressed store, hash-verified

164
165
166def imwrite_indexed(filename, array, color_palette):
167 """ Save indexed png for DAVIS."""
168 if np.atleast_3d(array).shape[2] != 1:
169 raise Exception("Saving indexed PNGs requires 2D array.")
170
171 im = Image.fromarray(array)
172 im.putpalette(color_palette.ravel())
173 im.save(filename, format='PNG')
174
175
176def to_one_hot(y_tensor, n_dims=None):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected