I have neural network where I feed numerous normalized image data and need to save the output. Below is the code I found but it only saves like 2x2 and 5x5 kind of square groups. How can I save one image?
def save_imgs(epoch):
r, c = 4, 4
noise = np.random.normal(0, 1, (r * c, latent_dim))
gen_imgs = generator.predict(noise)
global save_name
save_name += 0.00000001
# Rescale images 0 - 1
gen_imgs = (gen_imgs + 1) / 2.0
fig, axs = plt.subplots(r, c)
cnt = 0
for i in range(r):
for j in range(c):
axs[i,j].imshow(gen_imgs[cnt])
axs[i,j].axis('off')
cnt += 1
fig.savefig("currentgeneration.png")
fig.savefig("generated_images/%.8f.png" % save_name)
plt.close()