16.03.2021 Views

Advanced Deep Learning with Keras

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Variational Autoencoders (VAEs)

Figure 8.1.6 shows the continuous space of latent vector after 50 epochs using plot_

results(). For simplicity, the function is not shown here but can be found in the

rest of the code of vae-mlp-mnist-8.1.1.py. The function plots two images, the

test dataset labels (Figure 8.1.6) and the sample generated digits (Figure 8.1.7) both

as a function of z. Both plots demonstrate how the latent vector determines the

attributes of the generated digits.

Navigating through the continuous space will always result in an output that bears

a resemblance to the MNIST digits. For example, the region of digit 9 is close to

the region of digit 7. Moving from 9 near the center to the left morphs the digit

to 7. Moving from the center downward changes the generated digits from 3 to 8

and finally to 1. The morphing of the digits is more evident in Figure 8.1.7 which

is another way of interpreting Figure 8.1.6.

In Figure 8.1.7, instead of colorbar, the generator output is displayed. The

distribution of digits in the latent space is shown. It can be observed that all the

digits are represented. Since the distribution is dense near the center, the change is

rapid in the middle and slow as the mean values get bigger. We need to remember

that Figure 8.1.7 is a reflection of Figure 8.1.6. For example, digit 0 is on the top right

quadrant on both figures while digit 1 is on the lower right quadrant.

There are some unrecognizable digits in Figure 8.1.7, especially on the top left

quadrant. From the following figure, it can be observed that this region is mostly

empty and far away from the center:

Figure 8.1.6: The latent vector mean values for the test dataset (VAE MLP). The colorbar shows the

corresponding MNIST digit as a function of z. Color images can be found on the book GitHub repository:

https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras/tree/master/chapter8-vae.

[ 248 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!