Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Advanced Deep Learning with Keras

You're reading from  Advanced Deep Learning with Keras

Product type Book
Published in Oct 2018
Publisher Packt
ISBN-13 9781788629416
Pages 368 pages
Edition 1st Edition
Languages
Author (1):
Rowel Atienza Rowel Atienza
Profile icon Rowel Atienza

Table of Contents (13) Chapters

Preface 1. Introducing Advanced Deep Learning with Keras 2. Deep Neural Networks 3. Autoencoders 4. Generative Adversarial Networks (GANs) 5. Improved GANs 6. Disentangled Representation GANs 7. Cross-Domain GANs 8. Variational Autoencoders (VAEs) 9. Deep Reinforcement Learning 10. Policy Gradient Methods Other Books You May Enjoy Index

Conditional VAE (CVAE)

Conditional VAE [2] is similar to the idea of CGAN. In the context of the MNIST dataset, if the latent space is randomly sampled, VAE has no control over which digit will be generated. CVAE is able to address this problem by including a condition (a one-hot label) of the digit to produce. The condition is imposed on both the encoder and decoder inputs.

Formally, the core equation of VAE in Equation 8.1.10 is modified to include the condition c:

Conditional VAE (CVAE)

(Equation 8.2.1)

Similar to VAEs, Equation 8.2.1 means that if we want to maximize the output conditioned on c,

Conditional VAE (CVAE)

, then the two loss terms must be minimized:

  • Reconstruction loss of the decoder given both the latent vector and the condition.
  • KL loss between the encoder given both the latent vector and the condition and the prior distribution given the condition. Similar to a VAE, we typically choose
    Conditional VAE (CVAE)

    .

Listing 8.2.1, cvae-cnn-mnist-8.2.1.py shows us the Keras code of CVAE using CNN layers. In the code that is highlighted...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}