Hands-On Convolutional Neural Networks with TensorFlow
by Iffat Zafar, Giounona Tzanidou, Richard Burton, Nimesh Patel, Leonardo Araujo
Training the VAE
In order for us to train the VAE and use the KL divergence loss, we will first need to play around with how we generate the latent vectors. Rather than having the encoder produce a latent vector exactly directly, we will make the encoder produce two vectors. The first will be a vector μ of mean values, and the second will be a vector σ of standard deviation values. From these, we can create a third vector, where the ith element is sampled from a Gaussian distribution using the ith values of our μ and σ vectors as the mean and standard deviation for that Gaussian distribution. This third sampled vector is then sent to the decoder.
Our model now looks something like this:
The mean and standard deviation blocks in the preceding ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access