def show(img, name = "output.png"):
"""
Show MNSIT digits in the console.
"""
np.save(name, img)
fig = np.around((img + 0.5)*255)
fig = fig.astype(np.uint8).squeeze()
pic = Image.fromarray(fig)
# pic.resize((512,512), resample=PIL.Image.BICUBIC)
pic.save(name)
remap = " .*#"+"#"*100
img = (img.flatten()+.5)*3
if len(img) != 784: return
print("START")
for i in range(28):
print("".join([remap[int(round(x))] for x in img[i*28:i*28+28]]))
评论列表
文章目录