guided-diffusion icon indicating copy to clipboard operation
guided-diffusion copied to clipboard

file npz change to picture

Open GYiFeng opened this issue 2 years ago • 2 comments

Could you tell me how to change the 64_samples.npz file to picture?

GYiFeng avatar May 23 '23 02:05 GYiFeng

import numpy as np from PIL import Image
data = np.load('xxx.npz') k = 0 for i in data['arr_0']: if k%1000==0: print(k) img = Image.fromarray(i) img.save(str(k)+".jpg") k = k+1

lowestbuaaer avatar May 28 '23 07:05 lowestbuaaer

从 PIL 导入 numpy 作为 np 导入 图像数据 = np.load('xxx.npz') k = 0 for i in data['arr_0']: 如果 k%1000==0: print(k) img = Image.fromarray(i) img.save(str(k)+“.jpg”) k = k+1

感谢,很有用

zouyunpeng666 avatar Jul 18 '23 12:07 zouyunpeng666