Generative AI with Python and TensorFlow by Joseph Babcock Raghav Bali

Generative AI with Python and TensorFlow by Joseph Babcock Raghav Bali

Author:Joseph Babcock, Raghav Bali
Language: eng
Format: epub
Publisher: Packt
Published: 2021-04-28T07:43:56+00:00


The training loop for CycleGAN is mostly similar to that of pix2pix with a few additions. As we have two pairs of generators and discriminators, the function takes all four models as input along with a combined gan object. The training loop starts with the generation of fake samples from both generators and then uses them to update weights for their corresponding discriminators. These are then combined to train the overall GAN model as well.

Using the components described in this section, we experimented with two sets of style transfer datasets, turning apples into oranges and turning photographs into Van Gogh paintings. Figure 7.11 shows the output of the apples to oranges experiment through different stages of training:

Figure 7.11: CycleGAN generated outputs at different stages of training for the apples to oranges experiment

Similarly, Figure 7.12 shows how CycleGAN learns to transform photographs into Van Gogh style artwork:

Figure 7.12: CycleGAN generated outputs at different stages of training for the photographs to Van Gogh style paintings experiment

As is evident from the samples above (Figures 7.11 and 7.12), CycleGAN seems to have picked up the nuances from both domains without having paired training samples. This is a good leap forward in cases where paired samples are hard to get.

Another important observation from the two experiments is the amount of training required. While both experiments used exactly the same setup and hyperparameters, the apples to oranges experiment trained much faster compared to the photograph to Van Gogh style painting setup. This could be attributed to the large number of modes in the case of the second experiment, along with diversity in the training samples.

This ends our section on unpaired style transfer. Now we're going to explore some work relating to and branching off from both paired and unpaired style transfer.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.