|
| 1 | +# Variational Autoencoders |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +- We add a constraint on the encoding network, that forces it to generate latent vectors that roughly follow a unit gaussian distribution. |
| 8 | +- Generating new images is now easy: all we need to do is sample a latent vector from the unit gaussian and pass it into the decoder. |
| 9 | + |
| 10 | +```python |
| 11 | +image_loss = mean((generated_image - real_image)**2) |
| 12 | +latent_loss = kl_divergence(latent_variable, unit_gaussian) |
| 13 | +loss = image_loss + latent_loss |
| 14 | +``` |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +- the KL divergence of two gaussians is easy to compute in its closed form. |
| 19 | +- In order to optimize the KL divergence, we need to apply a simple reparameterization trick: instead of the encoder generating a vector of real values, it will generate a vector of means and a vector of standard deviations. |
| 20 | + |
| 21 | +```python |
| 22 | +samples = random_normal([batchsize, n_z], mean=0, std=1, dtype=tf.float32) |
| 23 | +sampled_z = z_mean + (z_stddev * samples) |
| 24 | +``` |
| 25 | + |
| 26 | +## More |
| 27 | + |
| 28 | +- <https://wiseodd.github.io/techblog/2016/12/10/variational-autoencoder/> |
| 29 | +- <https://hameddaily.blogspot.com/2018/12/yet-another-tutorial-on-variational.html> |
| 30 | +- <https://jaan.io/what-is-variational-autoencoder-vae-tutorial/> |
| 31 | +- <https://towardsdatascience.com/generating-images-with-autoencoders-77fd3a8dd368> |
| 32 | +- <https://wiseodd.github.io/techblog/2017/01/24/vae-pytorch/> |
| 33 | +- <https://jhui.github.io/2017/03/06/Variational-autoencoders/> |
| 34 | +- <https://www.jeremyjordan.me/variational-autoencoders/> |
| 35 | +- <http://kvfrans.com/variational-autoencoders-explained/> |
| 36 | +- <https://miro.medium.com/max/2255/1*ejNnusxYrn1NRDZf4Kg2lw@2x.png> |
| 37 | +- <https://www.assemblyai.com/blog/variational-autoencoders-for-dummies/> |
| 38 | +- Invariant Representations without Adversarial Training : <https://dcmoyer.github.io/selfhosted/blag.html> |
0 commit comments