读取.npy文件,并保存为所需的图片格式
import numpy as np
import scipy.misc
imgs_test = np.load('./xxx.npy') #读入.npy文件
print(imgs_test.shape)
for i in range (imgs_test.shape[0]):
B = imgs_test[i, 0, : ,:]#对图像维度进行改变
scipy.misc.imsave("./图片所储存的位置/" + str(i) + "_predResults" + ".jpg",B) # 保存为png格式,也可将png换位jpg等其他格式