title: TypeError: default_collate: batch must contain tensors, numpy arrays, numbers, dicts or lists; found <class 'PIL.PngImagePlugin.PngImageFile'>
body: <pre><code>@_add_dataset
  def voc(root, config):
      print(&quot;dataset.py: &quot; + root)
      #print(config)
      from torchvision.datasets import VOCSegmentation
      img_size=224
      transform = transforms.Compose([
          transforms.ToTensor(),
          transforms.Resize((img_size,img_size,)),
          transforms.Normalize((0.5071, 0.4867, 0.4408), (0.2675, 0.2565, 0.2761)),   
      ])
      #print(transforms.Resize)
      trainset = VOCSegmentation(root, image_set = 'train', transform=transform, download=True)# 
      testset = VOCSegmentation(root, transform=transform)
      return trainset, testset
  </code></pre>
  <p>I already transform it to tensor, however, I am still having this error.</p>