I have been using the pascal voc dataset directly from the torchvision.datasets as:
dataset = torchvision.datasets.VOCSegmentation(root='drive/My Drive/VOC/',
                                                 year='2012',
                                                 image_set='trainval',
                                                 download=False,
                                                 transform=transforms.Compose([
                                                                      transforms.Resize(144),
                                                                      transforms.CenterCrop(128),
                                                                      transforms.ToTensor()
                                                 ]),
                                                 target_transform=transforms.Compose([
                                                                             transforms.Resize(144),
                                                                             transforms.CenterCrop(128),
                                                                             transforms.ToTensor()
                                                 ]),
                                                 transforms=None)

but using this I am unsuccessful to do my task since I need a colorful segment of the images, the images, and their respective layers are


how can I make those labels colorful using palette as
[(0, 0, 0), 
                           (128, 0, 0), 
                           (0, 128, 0),
                           (128, 128, 0),
                           (0, 0, 128),
                           (128, 0, 128), 
                           (0, 128, 128), 
                           (128, 128, 128),
                           (64, 0, 0), 
                           (192, 0, 0), 
                           (64, 128, 0), 
                           (192, 128, 0), 
                           (64, 0, 128),
                           (192, 0, 128), 
                           (64, 128, 128), 
                           (192, 168, 128), 
                           (0, 64, 0),
                           (128, 64, 0), 
                           (0, 192, 0), 
                           (128, 192, 0), 
                           (0, 64, 128)]