...

/

Having Fun with the Generator Network

Having Fun with the Generator Network

Explore characteristics of generator network and learn about image interpolation.

Now that our first image generator is trained, aren’t we curious about what it is capable of and how images are generated from random noise vectors? In this section, we will have some fun with the generator network. First, we will choose two random vectors and calculate the interpolation between them to see what images will be generated. Second, we will choose some exemplary vectors and perform arithmetic calculations on them to find out what changes appear in the generated samples.

First, we need a test version of the DCGAN code. Copy the original dcgan.py file to dcgan_test.py. Next, we need to make some Generator changes to our new file. First, we need to replace these lines of just the Generator class.

Press + to interact
netG = Generator().to(device)
netG.apply(weights_init)
print(netG)

We replace them with the following lines (we can either delete them or simply comment them out):

Press + to interact
netG = Generator()
negG.load_state_dict(torch.load(os.path.join(OUT_PATH, 'netG_24.pth')))
netG.to(device)

Next, we need to remove (or comment out) the ...