torchvision/transforms/functional.py", line 743, in to_grayscale
raise TypeError('img should be PIL Image. Got {}'.format(type(img)))
TypeError: img should be PIL Image. Got <class 'torch.Tensor'>
Hello, I understand the error. However, this should not happen. Transformation toGrayScale accepts both PIL images and Tensors according to the documentation. Also, this error only comes up on my machine and it doesn’t while running my script on Google Colab.
Thank you. My torchvision version is in fact outdated. However, I can’t update it for lack of permission. I found out that linalg from scipy somehow conflicted with my torchvision version. I swapped the import statements (FIST: scipy, SECOND: torchvision) and now it works.