'Saving GAN generated images
I am following the DC GAN tutorial of pytorch for generating synthetic images. I want to store generated after the last epoch individually. https://pytorch.org/tutorials/beginner/dcgan_faces_tutorial.html I am new to this. I don't know how to save these images individually in a folder on local drive. Please help me.
I am not able to save images after trying different solutions available online. As I am new to this, it is hard for me to understand this.
Solution 1:[1]
I was able to save the images individually like this:
import os
sample_dir = ‘samples’
if not os.path.exists(sample_dir):
os.makedirs(sample_dir)
if(epoch == num_epochs-1 ):
fake_fname = ‘fake-{0:0=4d}.png’.format(i)
save_image(fake[i], os.path.join(sample_dir, fake_fname), nrow=1)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | hassanali |
