'Transfer the VOC color palette to an output mask for visualization.'

def palette(self, label_im):

    if (label_im.ndim == 3):
        label_im = label_im[0]
    label = Image.fromarray(label_im, mode='P')
    label.palette = copy.copy(self.palette)
    return label
