import numpy as np
import cv2
import torch
# opencv支持的图像数据是numpy格式,数据类型为uint8,而且像素值分布在[0,255]之间
data,labels = torch.load("F:/zmz/pycharm/Co-teaching-master/data/processed/test.pt")
print(data[0])
print(labels[0].data)
# 将tensor转化成numpy
img_numpy = data[0].numpy()
img = np.uint8(img_numpy)
cv2.imshow("7",img)
cv2.waitKey(0)
结果: