Skip to content

Commit

Permalink
Update 2024-07-04-GAMES001-NOTES-14.md
Browse files Browse the repository at this point in the history
  • Loading branch information
peng00bo00 committed Jul 4, 2024
1 parent 6372e9d commit 8904789
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions _posts/2024-07-04-GAMES001-NOTES-14.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,59 @@ $$
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/BcrDPPV.png" width="100%">
</div>

再结合正态分布的性质,我们对$$x_t$$的迭代公式进行展开,最终得到$$x_t$$与初始图像$$x_0$$之间的关系式

$$
x_t = \sqrt{\bar{\alpha}_t} x_0 + \sqrt{1 - \bar{\alpha}_t} \varepsilon_t
$$

$$
\bar{\alpha}_t = \alpha_t \alpha_{t-1} \cdots \alpha_1
$$

<div align=center>
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/HpfYlfM.png" width="100%">
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/1oPLF6W.png" width="100%">
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/xjNRAqL.png" width="100%">
</div>

总结一下,扩散模型的前向过程是一个马尔科夫链,也可以通过一次采样从$$x_0$$直接得到$$x_t$$

<div align=center>
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/XTeuLkC.png" width="100%">
</div>

### 反向过程

扩散模型的反向过程是从噪声$$x_t$$中逐步恢复$$x_0$$的过程,其中的每一步都可以使用神经网络来表示反向概率$$p_\theta (x_{t-1} \vert x_t)$$。类似于VAE,我们同样假设$$p_\theta (x_{t-1} \vert x_t)$$是正态分布,其均值由网络给出。

<div align=center>
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/XBEr4To.png" width="100%">
</div>

### 损失函数

扩散模型的损失函数与VAE同样是类似的,不过这里我们需要把单个隐变量$$z$$替换为一系列变量$$x_t$$,...,$$x_1$$

<div align=center>
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/rwei8VQ.png" width="100%">
</div>

<div align=center>
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/eod4vua.png" width="100%">
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/TEr0UaC.png" width="100%">
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/eN3CQVp.png" width="100%">
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/Ne7VuGZ.png" width="100%">
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/Yab3Psz.png" width="100%">
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/KWSYLPg.png" width="100%">
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/F3g7N8w.png" width="100%">
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/t9b0Hpt.png" width="100%">
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/RvP9Ws5.png" width="100%">
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/M0P3C0b.png" width="100%">
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/4Bzwrhk.png" width="100%">
<img src="https://search.pstatic.net/common?src=https://i.imgur.com/iwG0eED.png" width="100%">
</div>

## Reference

- [Lecture 15: 生成模型](https://www.bilibili.com/video/BV1MF4m1V7e3?p=14&vd_source=7a2542c6c909b3ee1fab551277360826)

0 comments on commit 8904789

Please sign in to comment.