Hey there!
I am using Pascal VOC dataset (from torchvision).
And I encounter this kind of error:
Traceback (most recent call last):
  File "mainv1.py", line 13, in <module>
    images, labels = next(data_iter)
  File "C:\Users\Asus\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 615, in __next__
    batch = self.collate_fn([self.dataset[i] for i in indices])
  ...
  File "C:\Users\Asus\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 229, in <listcomp>
    return {key: default_collate([d[key] for d in batch]) for key in batch[0]}
TypeError: list indices must be integers or slices, not str

Error occurs in this code:
T = transforms.Compose([transforms.Resize((224, 224)),transforms.ToTensor()])
voc_data = VOCDetection(root, year='2007', image_set='train', 
                        download=False, transform=T)
# VOCDetection taken from here: https://pytorch.org/docs/master/_modules/torchvision/datasets/voc.html
dl = DataLoader(voc_data, batch_size=32,shuffle=False)

data_iter = iter(dl)
images, labels = next(data_iter)