文章目录
摘要
The diffusion model is a generative model of the Encoder-Decoder architecture, which is divided into a diffusion stage and an inverse diffusion stage. In the diffusion stage, by continuously adding noise to the original data, the data is changed from the original distribution to the distribution we expect, for example, the original data distribution is changed to a normal distribution by continuously adding Gaussian noise. During the inverse diffusion stage, a neural network is used to restore the data from a normal distribution to the original data distribution. Its advantage is that each point on the normal distribution is a mapping of the real data, and the model has better interpretability. The disadvantage is that iterative sampling is slow, resulting in low model training and prediction efficiency.
扩散模型是Encoder-Decoder架构的生成模型,分为扩散阶段和逆扩散阶段。 在扩散阶段,通过不断对原始数据添加噪声,使数据从原始分布变为我们期望的分布,例如通过不断添加高斯噪声将原始数据分布变为正态分布。 在逆扩散阶段,使用神经网络将数据从正态分布恢复到原始数据分布。 它的优点是正态分布上的每个点都是真实数据的映射,模型具有更好的可解释性。 缺点是迭代采样速度慢,导致模型训练和预测效率低。
一、简介
Diffusion model模型分为扩散过程和逆扩散过程,扩散过程通过对原始数据不断加入高斯噪音,使原始数据变为高斯分布的数据,即从 X 0 X_0 X0 − > -> −> X T X_T XT。逆扩散过程通过高斯噪声还原出图片,即从 X T X_T XT − > -> −> X 0 X_0 X0。
二、扩散过程
2.1 定义扩散过程
在设定扩散过程是一个马尔可夫链的条件下,向原始信息中不断添加高斯噪声,每一步添加高斯噪声的过程是从 X t − 1 − > X t X_{t-1} -> X_t Xt−1−>Xt,于是定义公式:
q ( x t ∣ x t − 1 ) = N ( x t ; 1 − β t x t − 1 , β t I ) q(x_t|x_{t-1}) = N(x_t;\sqrt{1-\beta_t}x_{t-1} ,\beta_tI) q(xt∣xt−1)=N(xt;1−βtxt−1,βtI)
该公式表示从 x t − 1 − > x t x_{t-1}->x_t xt−1−>xt是一个以 1 − β t x t − 1 \sqrt{1-\beta_t}x_{t-1} 1−βtxt−1为均值 β t \beta_t βt为方差的高斯分布变换。
2.2 重参数技巧得到迭代公式
利用重参数技巧得到每一次添加高斯噪声的公式如下:
X t = 1 − β t X t − 1 + β t Z t X_t = \sqrt{1-\beta_t}X_{t-1} + \sqrt{\beta}_tZ_t Xt=1−βtXt−1+βtZt
- X t X_t Xt表示 t 时刻的数据分布
- Z t Z_t Zt表示 t 时刻添加的高斯噪音,一般固定是均值为0方差为1的高斯分布
- 1 − β t X t − 1 \sqrt{1-\beta_t}X_{t-1} 1−βtXt−1