Pseudocode – how does it work?
With every technique, we need to understand the baseline algorithm before we can lay down any code. So, in this section, we'll discuss how the training algorithm works.
Getting ready
In this section, we'll be referring to the SimGAN paper once again.
How to do it...
In the SimGAN paper, the authors provided a convenient graphic for users to base their development on. We already know that we need to develop models for each of the networks, but how do we train a network in the first place? The following diagram offers an explanation:
AlgorithmÂ
Let's convert the preceding diagram into the following, tangible steps:
- Read both synthetic images and real images into variables.
- Then, for every epoch, do the following:
- Train the refiner networks on a random mini batch for
K_G
times - Train the discriminator network on a random mini batch for
K_D
times
- Train the refiner networks on a random mini batch for
- Stop when the number of epochs reached, or lost, has not changed significantly for
n
epochs.
Â