Conditional Variational Autoencoders --- 条件式变换自编码机

  Goal of a Variational Autoencoder:

  一个 VAE(variational autoencoder)是一个产生式模型,意味着我们可以产生看起来像我们的训练数据的 samples。以 mnist 数据集为例,这些伪造的样本可以看做是手写字体的合成图像。我们的 VAE 将会提供我们一个空间,我们称之为 latent space (潜在空间),我们可以从这里采样出 points。任何这些点都可以 decoded into 一个合理的手写字体的图像。

  Structure of a VAE :

  任何自编码机的目标都是重建其输入。通常,自编码机首先讲 input 压缩为一个小的 form,然后将其转换成 input的一个估计。这个被用于压缩图像的函数,称为 "encoder",解压该数据的函数称为 “decoder”。这些函数都可以是神经网络,我们这个文档中考虑的都是这种情况。

 

 

  标准的自编码机可以工作的很好,如果你的目标是简单的重建你的输入,但是作为产生式模型,其效果并不是很好,因为随机的采样一个输入 V 给 decoder,并不能使得 decoder 产生合理的图像。 V 可能距离任何输入都很远,所以 decoder 可能永远都不会训练得到合理的数字图像,当给定的输入像 V 的时候。

  

  我们需要一些方法来确认 the decoder 已经准备好了可以去 decode 出任何我们给定的合理的数字图像。为了达到这个目的,我们将会需要预先定义 decoder 希望看到的 输入的分布 (the distribution of inputs)。我们将会使用一种标准的 正态分布 来定义 decoder 将会接收到的 输入的分布。

  

  

    我们想要训练 the decoder 从这个分布中随机的采样一个点,并且可以恢复出合理的 数字图像。

  

  我们现在需要一个 encoder。在传统的自编码机当中,the encoder 从数据中采样出一个样本,并且在 latent space 中返回给一个点,然后将其传给 decoder。在一个 Variational autoencoder 中,编码机在 latent space 中产生一个概率分布。

  

    The latent distributions 其输出是和 latent space 相同纬度的高斯 (gaussians of the same dimensionality as the latent space)。The encoder 产生这些高斯的参数。

  所以我们有一个 encoder 从图像中采样,产生 latent space 的概率分布,the decoder 在 latent space 中采样该点,然后返回一个伪造的图像。所以对于一张给定的图像来说,the  encoder 产生一个分布,在 latent space 中该分布中采样出一个点出来,然后将该点输入到 decoder 当中,产生一个人造图像。

  

  

    The Structure of the Latent Space.

    我们看到了之前 the decoder 应该期望看到从标准正态分布中采样的点。但是,现在我们已经表明,decoder 接收到的 samples 并非是标准的正态分布。这两个东西都不是非常的奇怪,即使,当从 encoder 中采样出的 points 仍然近似的拟合一个标注的正态分布的情况。我们想要这样的情况:

    

    其中,不同分布的平均值 对应了 不同训练训练样本估计的标准正态 (a standard normal)。现在的假设是 the decoder 看到的 points, drawn from a standard normal distribution holds.

  很明显,我们需要一些方法来衡量是否 the encoder 产生的分布的和 (sum)可以估计 (approximat)标准的正太分布。我们可以利用KL-散度(Kullback-Leibler divergence)衡量该估计的质量。KL-散度 衡量了两个分布的差异程度 (measures how different two probability distributions are)。

  Training a VAE with The Representrization Trick.

  在上述讨论的 VAE 当中,网络的输入和输出之间,有一个随机的变量。通过一个随机变量是无法后向传播的,其代表了一个很明显的问题是:你现在无法训练 the encoder。为了解决这个问题,the VAE 被表达成不同的方式,使得 the latent distribution 的参数可以分解为随机变量的参数,使得后向传播可以沿着latent distribution 的参数继续传播。

  具体来说,就是。但是,一个很重要的启发是:一个 VAE 可以利用 BP 算法进行 end-to-end 的训练。但是,由于仍然存在一些随机的元素,所以不被称为随机梯度下降,该训练过程被称为:随机梯度变化的贝叶斯(stochastic gradient variational Bayes (SGVB))。

  

  Conditional Variational Autoencoder :

  到目前为止,我们已经创造了一个 autoencoder 可以重建起输入,并且 decoder 也可以产生一个合理的手写字体识别的图像。该产生器,但是,仍然无法产生一个需要的特定数字的图像。进入 the conditional variational auroencoder (CVAE)。该条件式变换自编码机 有一个额外的输入给 encoder 和 decoder。

  

  在训练的时候,输入给 encoder and decoder 的图像对应的数字是给定的。在这种情况下,将会被表示成 one-hot vector.

  为了产生一个特定数字的图像,将该数字输入给 the decoder 以及服从标准正态分布采样出的 latent space 中的一个随机点。尽管 同样的点 被输入进来来产生呢两个不同的数字,这个过程将会正确的工作,因为系统不在依赖于 the latent space 来编码你要处理的数字。相反的,the latent space 编码了其他的信息,像 stroke width 或者说 the angle。

  

  下面的这些数字图像就是通过固定所需要的数字输入给 the decoder,然后从 the latent space 中取一些随机的样本来产生一些有用的,不同版本的那个数字。像您所看到的那样,这些数字在类型上有所不同,但是同一行的数字,很明显是同一个数字。

  Conclusion

  VAEs 是非常有效的无监督学习工具。标准 VAE 的 latent space 应该捕获到你的数据中有用的模式。例如,我们可以看到,一个 VAE 在没有任何 label 的情况下训练,可以成功的分类出 mnist 图像,分为 latent space 中 10个具有区分度的区域,每个区域包含几乎某个数字所有的图像。 CVAEs 对于产生匹配 某些 labels 的伪造样本来说,是非常有用的。对于处理 时序数据,VAEs 也非常有用,只需将 the encoder and the decoder 替换为 RNNs 即可。

  (完毕)

  ----------------------------------------------------------------------------

  原文链接: http://ijdykeman.github.io/ml/2016/12/21/cvae.html

(译) Conditional Variational Autoencoders 条件式变换自编码机的更多相关文章

  1. 条件式变分自编码机(Conditional Variational Autoencoders)

    Conditional Variational Autoencoders 条件式变换自编码机 摘要: Conditional Variational Autoencoders --- 条件式变换自编码 ...

  2. Latent Representation Learning For Artificial Bandwidth Extension Using A Conditional Variational Auto-Encoder

    博客作者:凌逆战 论文地址:https://ieeexplore.ieee.xilesou.top/abstract/document/8683611/ 地址:https://www.cnblogs. ...

  3. Understanding Variational Autoencoders (VAEs)

    Understanding Variational Autoencoders (VAEs) 2019-09-29 11:33:18 This blog is from: https://towards ...

  4. Improving Variational Auto-Encoders using Householder Flow

    目录 概 主要内容 代码 Tomczak J. and Welling M. Improving Variational Auto-Encoders using Householder Flow. N ...

  5. [Bayesian] “我是bayesian我怕谁”系列 - Variational Autoencoders

    本是neural network的内容,但偏偏有个variational打头,那就聊聊.涉及的内容可能比较杂,但终归会 end with VAE. 各个概念的详细解释请点击推荐的链接,本文只是重在理清 ...

  6. 基于图嵌入的高斯混合变分自编码器的深度聚类(Deep Clustering by Gaussian Mixture Variational Autoencoders with Graph Embedding, DGG)

    基于图嵌入的高斯混合变分自编码器的深度聚类 Deep Clustering by Gaussian Mixture Variational Autoencoders with Graph Embedd ...

  7. Variational Autoencoders and Nonlinear ICA: A Unifying Framework

    目录 概 主要内容 本文的模型 Identifiability Khemakhem I., Kingma D. P., Monti R. P. and Hyv"{a}rinen A. Var ...

  8. Variational Auto-Encoders原理

    目录 AE v.s. VAE Generative model VAE v.s. GAN AE v.s. VAE Generative model VAE v.s. GAN

  9. PP: Time series anomaly detection with variational autoencoders

    Problem: unsupervised anomaly detection Model: VAE-reEncoder VAE with two encoders and one decoder. ...

随机推荐

  1. 大视野3562 [SHOI2014]神奇化合物

    http://www.lydsy.com/JudgeOnline/problem.php?id=3562 //Accepted 6020 kb 1012 ms //由于题目的特殊要求:然而,令科学家们 ...

  2. JAVA双列集合HashMap

    HashMap 双列集合HashMap是属于java集合框架3大类接口的Map类,   Map接口储存一组成对的键-值对象,提供key(键)到value(值)的映射.Map中的key不要求有序,不允许 ...

  3. 修改HTTPD.CONF中的DocumentRoot,出现 You don't have permission to access /??? on this server.

    apache 2.4 修改/conf/extra/httpd-vhosts.conf <VirtualHost _default_:80> DocumentRoot '${SRVROOT} ...

  4. 【其他】win7创建wifi热点共享给手机使用

    出门在外,有时候网络有诸多不便,需要用笔记本创建wifi热点给手机用:本人测试xp怎么配置都不好使,但win7有可行的方案,不依赖第三方软件. 详述如下: 场景一:win7 + A(PC机)(用无线连 ...

  5. Struts2版本升级到struts2 2.3.15.1操作说明

    Struts2的官网公布了一个远程命令执行漏洞,官方强烈建议升级到2.3.15.1或者以上版本,该版本包含校正过的struts2核心库. 我们之前开发项目主要采用的Struts2版本是2.2.1,本文 ...

  6. 用递归法判断字符串A中包含多少个字符串B

    string类提供了判断字符串B在字符串A中首次(或最后)出现的Index的方法,但有时候需要判断B在A中出现了多少次. 为此想了一个算法. public static void CountIndex ...

  7. BZOJ 1468 树分治

    求出子树的重心后求出它每个子节点的距离,排序后就可以统计距离小于等于K的点对的个数了,但是会在同一子树内重复,然后在每个子树里面减去小于等于K的点对个数就可以了. #include <iostr ...

  8. Binary Tree Preorder Traversal -- LEETCODE 144

    方法一:(迭代) class Solution { public: vector<int> preorderTraversal(TreeNode* root) { vector<in ...

  9. spring.net 如何让xml智能提示

    tools ->options ->Text Editor ->xml ->miscellaneous ->network ->勾选 automatically d ...

  10. hibernate.hbm2ddl.auto配置详解

    hibernate.cfg.xml 中hibernate.hbm2ddl.auto配置节点如下:<properties><property name="hibernate. ...