opencv_transforms_torchvision icon indicating copy to clipboard operation
opencv_transforms_torchvision copied to clipboard

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

Open Sudhakar17 opened this issue 5 years ago • 1 comments

I am using data loader from pytorch and data transform using your code. I am getting this error, "TypeError: img should be CV Image. Got <class 'PIL.Image.Image'>"

How to feed cvImage instead of PIL image to the model? Is there any other way?

Pytorch Version : 1.1 Windows 10

Sudhakar17 avatar Jul 31 '19 08:07 Sudhakar17

I am using data loader from pytorch and data transform using your code. I am getting this error, "TypeError: img should be CV Image. Got <class 'PIL.Image.Image'>"

How to feed cvImage instead of PIL image to the model? Is there any other way?

Pytorch Version : 1.1 Windows 10

The image should be loaded by cv2.imread(), or converted to a numpy array if loaded by PIL

hityzy1122 avatar Jul 31 '19 16:07 hityzy1122