import h5py import numpy as np hr_dataset = h5py.File('fuzzy.h5')['data']//此文件下的data数据 label = h5py.File('fuzzy.h5')['lable']//此文件下的lable数据 lenght=len(hr_dataset)//获取数据的长度 for i in range(len(hr_dataset))://for循环提取数据 y = hr_dataset[i] x = label [i] cv2.imwrite(str(i)+"1.png",y) cv2.imwrite(str(i)+"0.png",x)