Despite of doing

transform = transforms.Compose([transforms.Resize(256),  transforms.ToTensor()])



voc_data = torchvision.datasets.VOCSegmentation('/home/as/Desktop/mi/datasets/', download = True, transform=transform)
data_loader = torch.utils.data.DataLoader(voc_data, batch_size)

Getting error"
Using downloaded and verified file: /home/as/Desktop/mi/datasets/VOCtrainval_11-May-2012.tar
Traceback (most recent call last):
  File "main.py", line 108, in <module>
    train(10)
  File "main.py", line 63, in train
    for batch_idx, image, segment in enumerate(data_loader):
  File "/home/as/vir_env/mine/local/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 560, in __next__
    batch = self.collate_fn([self.dataset[i] for i in indices])
  File "/home/as/vir_env/mine/local/lib/python2.7/site-packages/torch/utils/data/_utils/collate.py", line 68, in default_collate
    return [default_collate(samples) for samples in transposed]
  File "/home/as/vir_env/mine/local/lib/python2.7/site-packages/torch/utils/data/_utils/collate.py", line 70, in default_collate
    raise TypeError((error_msg_fmt.format(type(batch[0]))))
TypeError: batch must contain tensors, numbers, dicts or lists; found <class 'PIL.PngImagePlugin.PngImageFile'>