Save indexed png for DAVIS.
(filename, array, color_palette)
| 164 | |
| 165 | |
| 166 | def 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 | |
| 176 | def to_one_hot(y_tensor, n_dims=None): |
no outgoing calls
no test coverage detected