python img.show()报下面的错是为什么??
from torch.utils.data import dataset
from PIL import Image
img_path = 'dataset/hymenoptera_data/train/ants/0013035.jpg'
img = Image.open(img_path)
img.show()
Error: no "view" rule for type "image/png" passed its test case
(for more information, add "--debug=1" on the command line)
ipy不支持显示这类图片
可以考虑转cv2或者换个集成环境就行,pycharm试过了是可以的
先 print 一下 img 的形状,检查是否正确读取到图像
你这个图片路径,写的是相对路径还是绝对路径?