import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import matplotlib.pyplot as plt
import torchvision
import torchvision.transforms as transforms
data2=torchvision.datasets.VOCDetection("./",download=True,transform=transforms.ToTensor(),target_transform=transforms.ToTensor())
img,tar =data2[0]
I get the following error:
----> 1 img,tar=data1[0]
/usr/local/lib/python3.6/dist-packages/torchvision/transforms/functional.py in to_tensor(pic)
48     “”"
49     if not(_is_pil_image(pic) or _is_numpy_image(pic)):
—> 50         raise TypeError(‘pic should be PIL Image or ndarray. Got {}’.format(type(pic)))
51
52     if isinstance(pic, np.ndarray):
TypeError: pic should be PIL Image or ndarray. Got <class ‘dict’>