leVirve/lsun-room

TypeError: img should be PIL Image. Got <class 'torch.Tensor'>

huangshizhong opened this issue · 1 comments

File "/home/mj/PycharmProjects/lsun-room-master/datasets/lsunroom.py", line 49, in getitem
label = F.resize(label, self.target_size, Image.NEAREST)
File "/home/mj/anaconda3/envs/huangsz/lib/python3.8/site-packages/torchvision/transforms/functional.py", line 319, in resize
raise TypeError('img should be PIL Image. Got {}'.format(type(img)))
TypeError: img should be PIL Image. Got <class 'torch.Tensor'>
how to solve it thank you every much

Hi, maybe you should use the newer version torchvision, the input can be either a tensor or a PIL image.
Reference: https://pytorch.org/vision/stable/transforms.html#torchvision.transforms.functional.resize