Free-Bloom: Zero-Shot Text-to-Video Generator with LLM Director and LDM Animator 学习笔记
motivation: 缺少text-video数据(zero-shot),之前的t2v工作更像是生成“moving images”(Text2Video-Zero),该工作想生成语义连贯的视频而不是仅仅让图片动起来
contribution:
1、free bloom:一种新的zero-shot text-to-video pipeline 利用了llm rich world knowledge和ldm生成能力
2、joint noise sampling(联合噪声采样)和step-aware attention shift(步骤感知注意力偏移)提高相似连贯性和时间连贯性
3、无训练的双路径插值策略:保与上下文的一致性,同时保持保真度。
method
包含三个部分:serial prompting, video generation, and interpolation empowerment.
LLMs as The Director and LDMs as The Frame Animator(LLM作为指导者,LDM作为绘制者)
LLM作用 (serial prompting):给定一个prompt,输出一整个frame的prompt(句式一致,包含时间变化)
video generation
joint noise sampling(联合噪声采样)
从帧的联合概率分布而不是独立分布中采样帧扩散过程中的初始噪声
每一帧的相同噪声导致ldm在相似的文本条件下生成具有相似内容的图像序列,一致性好但限制帧间变化;
从f个独立噪声生成图像,能产生多样性帧帧间的一致性差
对 视频帧之间的统一噪声 和 每个视频帧的独立噪声 进行加权求和
x
T
1
:
f
=
[
x
T
∗
,
⋯
,
x
T
∗
]
T
,
x
T
∗
∼
N
(
0
,
I
n
)
⇒
p
(
x
T
1
:
f
)
=
N
(
0
,
J
f
⊗
I
n
)
δ
T
1
:
f
=
[
x
T
1
,
⋯
,
x
T
f
]
T
,
x
T
i
∼
N
(
0
,
I
n
)
⇒
p
(
δ
T
1
:
f
)
=
N
(
0
,
I
n
f
)
(
3
)
\begin{aligned}\mathbf{x}_T^{1:f}&=[\mathbf{x}_T^*,\cdots,\mathbf{x}_T^*]^T,\mathbf{x}_T^*\sim\mathcal{N}(\mathbf{0},\mathbf{I}_n)&&\Rightarrow\quad p(\mathbf{x}_T^{1:f})=\mathcal{N}(\mathbf{0},\mathbf{J}_f\otimes\mathbf{I}_n)\\\delta_T^{1:f}&=[\mathbf{x}_T^1,\cdots,\mathbf{x}_T^f]^T,\mathbf{x}_T^i\sim\mathcal{N}(\mathbf{0},\mathbf{I}_n)&&\Rightarrow\quad p(\delta_T^{1:f})=\mathcal{N}(\mathbf{0},\mathbf{I}_{nf})\end{aligned}\quad(3)
xT1:fδT1:f=[xT∗,⋯,xT∗]T,xT∗∼N(0,In)=[xT1,⋯,xTf]T,xTi∼N(0,In)⇒p(xT1:f)=N(0,Jf⊗In)⇒p(δT1:f)=N(0,Inf)(3)
x
T
∗
\mathbf{x}_{T}^{*}
xT∗ 表示联合噪声,
x
T
i
\mathbf{x}_{T}^{i}
xTi 表示独立噪声
噪声加权和:
x
~
T
1
:
f
:
=
cos
(
π
2
λ
)
x
T
1
:
f
+
sin
(
π
2
λ
)
δ
T
1
:
f
\tilde{\mathbf{x}}_T^{1:f}:=\cos(\frac{\pi}{2}\lambda)\mathbf{x}_T^{1:f}+\sin(\frac{\pi}{2}\lambda)\delta_T^{1:f}
x~T1:f:=cos(2πλ)xT1:f+sin(2πλ)δT1:f
p
(
x
~
T
1
:
f
)
=
N
(
0
,
sin
2
(
π
2
λ
)
I
n
f
+
cos
2
(
π
2
λ
)
J
f
⊗
I
n
)
)
=
N
(
0
,
I
n
f
+
cos
2
(
π
2
λ
)
(
(
J
f
−
I
f
)
⊗
I
n
)
)
.
\begin{aligned} p(\tilde{\mathbf{x}}_{T}^{1:f})& =\mathcal{N}(0,\sin^{2}(\frac{\pi}{2}\lambda)\mathbf{I}_{nf}+\cos^{2}(\frac{\pi}{2}\lambda)\mathbf{J}_{f}\otimes\mathbf{I}_{n})) \\ &=\mathcal{N}(\mathbf{0},\mathbf{I}_{nf}+\cos^2(\frac\pi2\lambda)((\mathbf{J}_f-\mathbf{I}_f)\otimes\mathbf{I}_n)). \end{aligned}
p(x~T1:f)=N(0,sin2(2πλ)Inf+cos2(2πλ)Jf⊗In))=N(0,Inf+cos2(2πλ)((Jf−If)⊗In)).
λ
=
0
\lambda=0
λ=0 表示统一噪声
λ
=
1
\lambda=1
λ=1 表示独立噪声
step-aware attention shift(步骤感知注意力偏移)
之前的做法:从前一帧和第一帧中检索键和值,执行sparse spatio-temporal attention(稀疏时空注意)
本文:帧以不同的prompt为条件,不仅需要保持时间和相似的连贯性,还需要与它们各自的prompt的保持语义连贯性
做法:随着time step的增加,将attention转移到当前帧本身
Self-Attention
i
:
=
{
Attention
(
Q
i
,
[
K
0
,
K
i
−
1
,
K
i
]
,
[
V
0
,
V
i
−
1
,
V
i
]
)
,
t
≥
τ
Attention
(
Q
i
,
K
i
,
V
i
)
,
t
<
τ
\left.\text{Self-Attention}_i:=\left\{\begin{matrix}\text{Attention}(Q_i,[K_0,K_{i-1},K_i],[V_0,V_{i-1},V_i]),&t\geq\tau\\\text{Attention}(Q_i,K_i,V_i),&t<\tau\end{matrix}\right.\right.
Self-Attentioni:={Attention(Qi,[K0,Ki−1,Ki],[V0,Vi−1,Vi]),Attention(Qi,Ki,Vi),t≥τt<τ
Interpolation Empowerment
插值赋权模块,在不增加训练资源的情况下进一步提高帧率
插值中间帧考虑双路径插值:Contextual path(上下文路径,从帧的latent域插值),Denoising path(考虑prompt插值)
Contextual path:
x
~
t
f
=
k
x
t
f
−
1
+
(
1
−
k
)
x
t
f
+
1
.
\tilde{\mathbf{x}}_t^f=k\mathbf{x}_t^{f-1}+(1-k)\mathbf{x}_t^{f+1}.
x~tf=kxtf−1+(1−k)xtf+1. 从前后帧的latent域插值
Denoising path:考虑插值的中间帧的语义信息
插值前一帧和下一帧的text embedding(文本嵌入),得到中间帧的text embedding
T
f
\mathcal{T}^{f}
Tf
以
T
f
\mathcal{T}^{f}
Tf为条件执行DDIM(初始噪声同video generation),得到结果与
x
~
t
f
\tilde{\mathbf{x}}_t^f
x~tf,进行插值
x
t
f
=
(
1
−
m
(
t
)
)
x
~
t
f
+
m
(
t
)
(
α
t
P
t
+
1
f
+
D
t
+
1
f
+
σ
t
z
t
)
.
\mathbf{x}_t^f=(1-m(t))\tilde{\mathbf{x}}_t^f+m(t)(\sqrt{\alpha_t}\mathbf{P}_{t+1}^f+\mathbf{D}_{t+1}^f+\sigma_t\mathbf{z}_t).
xtf=(1−m(t))x~tf+m(t)(αtPt+1f+Dt+1f+σtzt).
插值系数 m(t) 根据时间步长变化,早期Denoising path中的值较小,后一步增加。
experiments
A没有联合噪声采样,帧间内容不一致
B有联合初始噪声,不修改自注意力层,没有shift self attention,不关注上下文帧,很难保持前景和背景内容的相似一致性和时间连续性
C采用 Text2Video-Zero ,移动图像
D Tune a Video中提出的时空注意层(只考虑第一帧和前一帧)。生成的帧表现出改进的时间一致性,显示出帧之间的平滑转换。帧看起来几乎相同,仅基于第一帧创建一系列无意义的和抖动帧,这与预期的时间语义不一致;长序列中的长时间上下文注意力可以显着损害各个帧的保真度。
E 基于D考虑当前帧,但不会进行step-aware shift,改善了保真度,由于缺乏在去噪时间步长上不同的推理策略,结果仍然与语义不一致
Interpolation Empowerment
去噪前期
m
(
t
)
m(t)
m(t) 较小,Denoising path(考虑prompt插值)比重较小,后期增大
当
τ
∗
\tau^{*}
τ∗ 接近 1 时,
m
(
t
)
m(t)
m(t) 在整个去噪过程中仍然相对较小,这表明上下文路径主要决定了插值结果,生成的图像呈现模糊和重影伪影
τ
∗
\tau^{*}
τ∗ 较大时,严重依赖 DDIM Denoising path会导致内容出现重大偏差。