I have problems with transforms for images. Specifically, if I try to use RandomCrop or RandomSizedCrop, any kind of argument, from int, tuple or list, gives errors.
img = t(img)
File “/scratch/Dimitris/software/pytorch/pytorchenv/lib/python2.7/site-packages/torchvision/transforms.py”, line 238, in call
area = img.size[0] * img.size[1]
TypeError: ‘int’ object has no attribute ‘getitem’
or
img = t(img)
File “/scratch/Dimitris/software/pytorch/pytorchenv/lib/python2.7/site-packages/torchvision/transforms.py”, line 204, in call
w, h = img.size
TypeError: ‘int’ object is not iterable
I’m facing the same error with RandomResizedCrop. I’ll try the solution you said. Do we need to implement vision.transforms.ToPILImage() to use torchvision Transforms? Won’t numpy arrays be acceptable?