search
HomeTechnology peripheralsAIDetailed comparison of generative models VAE, GAN and flow-based models

Two years after Ian Goodfellow and other researchers introduced generative adversarial networks in a paper, Yann LeCun called adversarial training "the most interesting idea in ML in the past decade." Although GANs are interesting and promising, they are only part of a family of generative models that solve traditional AI problems from a completely different perspective. In this article we will compare three common generative models.

Generation algorithm

When we think of machine learning, the first thing that probably comes to mind is the discriminant algorithm. Discriminative models are the prediction of labels or categories of input data based on its characteristics and are at the heart of all classification and prediction solutions. In contrast to these models, generative algorithms help us tell stories about the data and provide possible explanations of how the data was generated. Unlike discriminative algorithms, which map features to labels, generative models try to predict features given a label.

Distinguish the relationship between the label y and the feature x defined by the model, and generate the model to answer the question "How do you get y". The generative model model is P(Observation/Cause), and then uses Bayes' theorem to calculate P(Cause/Observation). In this way, they can capture p(x|y), the probability of x given y, or the probability of a feature given a label or class. So in fact, generative algorithms can also be used as classifiers, probably because they model the distribution of individual classes.

There are many generative algorithms, but the most popular models that fall into the category of deep generative models are variational autoencoders (VAEs), gans, and flow-based models.

VAE

A variational autoencoder (VAE) is a generative model that "provides a probabilistic description of observations in a latent space." Simply put, this means that VAE stores latent attributes as probability distributions.

The idea of ​​variational autoencoders (Kingma & Welling, 2014) or VAEs is deeply rooted in variational Bayesian and graphical model methods.

Detailed comparison of generative models VAE, GAN and flow-based models

The standard autoencoder consists of 2 similar networks, an encoder and a decoder. The encoder takes the input and converts it into a smaller representation, which the decoder can use to convert it back to the original input. The latent space into which they transform the input and the space in which their encoding vectors lie may not be continuous. This is a problem for generative models, as we all want to sample randomly from a latent space, or generate variations of the input image from a continuous latent space.

The variational autoencoder has a continuous latent space, which makes random sampling and interpolation more convenient. To achieve this, the hidden nodes of the encoder do not output the encoding vector, but instead output two vectors of the same size: a mean vector and a standard deviation vector. Each hidden node considers itself Gaussian distributed. The i-th element of the mean and standard deviation vector here corresponds to the mean and standard deviation value of the i-th random variable. We sample from this distribution vector and the decoder randomly samples from the probability distribution of the input vector. This process is random generation. This means that even for the same input, when the mean and standard deviation are held constant, the actual encoding will differ in each pass.

Detailed comparison of generative models VAE, GAN and flow-based models

The loss of the autoencoder is to minimize the reconstruction loss (how similar the output is to the input) and the latent loss (how close the hidden nodes are to the normal distribution). The smaller the potential loss, the less information can be encoded, so the reconstruction loss will increase, so there is a trade-off between the potential loss and the reconstruction loss. When the potential loss is small, the generated image will be too similar to the training image, resulting in poor performance. When the reconstruction loss is small, the reconstructed image effect during training is better, but the generated new image is quite different from the reconstructed image, so a good balance needs to be found.

VAEs can handle various types of data, sequential and non-sequential, continuous or discrete, even labeled or unlabeled, which makes them very powerful generation tools.

But a major drawback of VAEs is the blurry output they generate. As Dosovitskiy and Brox pointed out, VAE models often produce unrealistic and ambiguous samples. This is caused by the way the data distribution is recovered and the loss function is calculated. A 2017 paper by Zhao et al. suggested modifying VAEs without using variational Bayesian methods to improve output quality.

Detailed comparison of generative models VAE, GAN and flow-based models

Generative adversarial networks

Generative adversarial networks (GANs) are a generative model based on deep learning that can generate new content. The GAN architecture was first described in a 2014 paper titled "Generative Adversarial Networks" by Ian Goodfellow et al.

GANs employ a supervised learning approach using two sub-models: a generator model that generates new examples and a discriminator model that attempts to classify examples as real or fake (generated).

Generator: A model used to generate new plausible examples from the problem domain.

Frequency Discriminator: A model used to classify examples as real (from the domain) or fake (generated).

The two models are trained as competitors. Generators produce sample data directly. Its opponent, the discriminator, attempts to distinguish between samples drawn from the training data and samples drawn from the generator. This competitive process continues during training until the discriminator model fails to tell true or false more than half the time, which means that the generator model is generating very realistic data.

Detailed comparison of generative models VAE, GAN and flow-based models

#When the discriminator successfully identifies a real or fake sample, it is rewarded while its parameters remain unchanged. If the generator makes a mistake, it is punished and its parameters are updated. In an ideal world, whenever the discriminator can't tell the difference and predicts "uncertain" (e.g., 50% true or false), the generator can produce a perfect copy from the input domain.

But here each model can overpower the other. If the discriminator is too good, it will return values ​​very close to 0 or 1, and the generator will have trouble getting updated gradients. If the generator is too good, it will exploit the discriminator's weaknesses and cause false negatives. Therefore, the two neural networks must have similar "skill levels" achieved through their respective learning rates. This is also one of the reasons why GAN is difficult to train.

Generator model

The generator takes a fixed-length random vector as input and generates a sample within the defined domain. This vector is randomly drawn from a Gaussian distribution. After training, the points in this multi-dimensional vector space will correspond to the points in the problem domain, forming a compressed representation of the data distribution. This step is similar to VAE. This vector space is called a latent space, or a vector space composed of latent variables. . The GAN's generator will average selected points in the latent space. New points extracted from the latent space can be provided as input to the generator model and used to generate new and different output examples. After training, the generator model is retained and used to generate new samples.

Discriminator model

The discriminator model takes an example as input (either a real sample from the training dataset or generated by a generator model) and predicts a binary class label of real or fake( has been generated). The discriminator is a normal (and easy to understand) classification model.

After the training process, the discriminator is discarded because we are interested in the generator. Of course the discriminator can also be used for other purposes.

GANs can produce feasible samples, but the original GAN ​​also has shortcomings:

  • The image is generated by some arbitrary noise. When generating an image with specific characteristics, one cannot be sure what initial noise value will generate that image, but instead needs to search the entire distribution.
  • GAN only differentiates between "real" and "fake" images. But there is no constraint that says a photo of a "cat" must look like a "cat." Therefore, it can result in generated images that don't have the actual objects in them, but the styles look similar.
  • GANs take a long time to train. A GAN may take several hours on a single GPU and more than a day on a single CPU.

Flow-based models

Flow-based generative models are exact log-likelihood models with tractable sampling and latent variable inference. Flow-based models apply a bunch of reversible transformations to samples from the prior so that the exact log-likelihood of an observation can be calculated. Unlike the previous two algorithms, this model explicitly learns the data distribution, so the loss function is negative log-likelihood.

Detailed comparison of generative models VAE, GAN and flow-based models

In nonlinear independent component analysis, the flow model f is constructed as an invertible mapping of high-dimensional random variables x to standard Gaussian latent variables z=f(x) Transform. The key idea in the design of the flow model is that it can be an arbitrary bijective function and can be formed by superposing simple reversible transformations. To summarize: the flow model f is composed of a series of reversible flows as f(x) =f1◦···◦fL(x), with each fi having a tractable inverse and a tractable Jacobian matrix. Mode.

There are two broad categories of flow-based models: models with normalized flow and models with autoregressive flow that attempt to enhance the performance of the base model.

Normalized Flow Model

Being able to perform good density estimation is essential for many machine learning problems. But it is inherently complex: when we need to perform backpropagation in a deep learning model, the embedded probability distribution needs to be simple enough so that the derivatives can be calculated efficiently. The traditional solution is to use Gaussian distributions in latent variable generation models, although most real-world distributions are much more complex. Normalized flow (NF) models, such as RealNVP or Glow, provide a robust approximation of the distribution. They transform a simple distribution into a complex distribution by applying a series of reversible transformation functions. Through a series of transformations, according to the variable transformation theorem, the original variables can be repeatedly replaced with new variables, and finally the probability distribution of the final target variable is obtained.

Model of Autoregressive Flow

When the flow transformation in the normalized flow is framed as an autoregressive model, where each dimension in the vector variable is conditioned on the previous dimension, the flow model This change in is called autoregressive flow. It is a step forward compared to models with standardized processes.

Commonly used autoregressive flow models are PixelCNN for image generation and WaveNet for one-dimensional audio signals. They all consist of a bunch of causal convolutions - convolution operations that take order into account: predictions at a specific timestamp only use data observed in the past. In PixelCNN, causal convolution is performed by a masked kernel. And WaveNet shifts the output through several timestamps into the future time.

Detailed comparison of generative models VAE, GAN and flow-based models

Flow-based models are conceptually very friendly to modeling complex distributions, but they suffer from density estimation performance issues compared to state-of-the-art autoregressive models limits. Although flow models may initially produce good output as an alternative to GANs, there is a significant gap in training computational cost between them, with flow-based models taking several times longer to generate images of the same resolution than GANs.

Summary

Each algorithm has its advantages and limitations in terms of accuracy and efficiency. Although GANs and process-based models generally generate better or closer to real images than VAE, the latter has faster time and better parameter efficiency than process-based models. Here is a comparison summary of the three models:

Detailed comparison of generative models VAE, GAN and flow-based models

You can see that GAN is very efficient because of its parallelism, but it is not reversible. In contrast, flow models are reversible but not efficient, while vae is reversible and efficient but cannot be computed in parallel. Based on these characteristics, we can make trade-offs between output, training process, and efficiency in actual use.

The above is the detailed content of Detailed comparison of generative models VAE, GAN and flow-based models. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:51CTO.COM. If there is any infringement, please contact admin@php.cn delete
2023年机器学习的十大概念和技术2023年机器学习的十大概念和技术Apr 04, 2023 pm 12:30 PM

机器学习是一个不断发展的学科,一直在创造新的想法和技术。本文罗列了2023年机器学习的十大概念和技术。 本文罗列了2023年机器学习的十大概念和技术。2023年机器学习的十大概念和技术是一个教计算机从数据中学习的过程,无需明确的编程。机器学习是一个不断发展的学科,一直在创造新的想法和技术。为了保持领先,数据科学家应该关注其中一些网站,以跟上最新的发展。这将有助于了解机器学习中的技术如何在实践中使用,并为自己的业务或工作领域中的可能应用提供想法。2023年机器学习的十大概念和技术:1. 深度神经网

人工智能自动获取知识和技能,实现自我完善的过程是什么人工智能自动获取知识和技能,实现自我完善的过程是什么Aug 24, 2022 am 11:57 AM

实现自我完善的过程是“机器学习”。机器学习是人工智能核心,是使计算机具有智能的根本途径;它使计算机能模拟人的学习行为,自动地通过学习来获取知识和技能,不断改善性能,实现自我完善。机器学习主要研究三方面问题:1、学习机理,人类获取知识、技能和抽象概念的天赋能力;2、学习方法,对生物学习机理进行简化的基础上,用计算的方法进行再现;3、学习系统,能够在一定程度上实现机器学习的系统。

超参数优化比较之网格搜索、随机搜索和贝叶斯优化超参数优化比较之网格搜索、随机搜索和贝叶斯优化Apr 04, 2023 pm 12:05 PM

本文将详细介绍用来提高机器学习效果的最常见的超参数优化方法。 译者 | 朱先忠​审校 | 孙淑娟​简介​通常,在尝试改进机器学习模型时,人们首先想到的解决方案是添加更多的训练数据。额外的数据通常是有帮助(在某些情况下除外)的,但生成高质量的数据可能非常昂贵。通过使用现有数据获得最佳模型性能,超参数优化可以节省我们的时间和资源。​顾名思义,超参数优化是为机器学习模型确定最佳超参数组合以满足优化函数(即,给定研究中的数据集,最大化模型的性能)的过程。换句话说,每个模型都会提供多个有关选项的调整“按钮

得益于OpenAI技术,微软必应的搜索流量超过谷歌得益于OpenAI技术,微软必应的搜索流量超过谷歌Mar 31, 2023 pm 10:38 PM

截至3月20日的数据显示,自微软2月7日推出其人工智能版本以来,必应搜索引擎的页面访问量增加了15.8%,而Alphabet旗下的谷歌搜索引擎则下降了近1%。 3月23日消息,外媒报道称,分析公司Similarweb的数据显示,在整合了OpenAI的技术后,微软旗下的必应在页面访问量方面实现了更多的增长。​​​​截至3月20日的数据显示,自微软2月7日推出其人工智能版本以来,必应搜索引擎的页面访问量增加了15.8%,而Alphabet旗下的谷歌搜索引擎则下降了近1%。这些数据是微软在与谷歌争夺生

荣耀的人工智能助手叫什么名字荣耀的人工智能助手叫什么名字Sep 06, 2022 pm 03:31 PM

荣耀的人工智能助手叫“YOYO”,也即悠悠;YOYO除了能够实现语音操控等基本功能之外,还拥有智慧视觉、智慧识屏、情景智能、智慧搜索等功能,可以在系统设置页面中的智慧助手里进行相关的设置。

30行Python代码就可以调用ChatGPT API总结论文的主要内容30行Python代码就可以调用ChatGPT API总结论文的主要内容Apr 04, 2023 pm 12:05 PM

阅读论文可以说是我们的日常工作之一,论文的数量太多,我们如何快速阅读归纳呢?自从ChatGPT出现以后,有很多阅读论文的服务可以使用。其实使用ChatGPT API非常简单,我们只用30行python代码就可以在本地搭建一个自己的应用。 阅读论文可以说是我们的日常工作之一,论文的数量太多,我们如何快速阅读归纳呢?自从ChatGPT出现以后,有很多阅读论文的服务可以使用。其实使用ChatGPT API非常简单,我们只用30行python代码就可以在本地搭建一个自己的应用。使用 Python 和 C

人工智能在教育领域的应用主要有哪些人工智能在教育领域的应用主要有哪些Dec 14, 2020 pm 05:08 PM

人工智能在教育领域的应用主要有个性化学习、虚拟导师、教育机器人和场景式教育。人工智能在教育领域的应用目前还处于早期探索阶段,但是潜力却是巨大的。

人工智能在生活中的应用有哪些人工智能在生活中的应用有哪些Jul 20, 2022 pm 04:47 PM

人工智能在生活中的应用有:1、虚拟个人助理,使用者可通过声控、文字输入的方式,来完成一些日常生活的小事;2、语音评测,利用云计算技术,将自动口语评测服务放在云端,并开放API接口供客户远程使用;3、无人汽车,主要依靠车内的以计算机系统为主的智能驾驶仪来实现无人驾驶的目标;4、天气预测,通过手机GPRS系统,定位到用户所处的位置,在利用算法,对覆盖全国的雷达图进行数据分析并预测。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools