# Introduction
๋ ผ๋ฌธ์์๋ multi-grained video editing์ด๋ผ๋ ๊ฐ๋ ์ ์๊ฐํ๋ค. ์ด๋ ํธ์ง์ ์ธ๋ฐํ ์์ค์ ๋ฐ๋ผ class-level, instance-level, part-level์ ์ธ ๊ฐ์ง๋ก ๊ตฌ๋ถ๋๋ค. (Figure 2 ์ผ์ชฝ)
- Class-level editing์ ๋์ผํ ํด๋์ค ๋ด์์ ๊ฐ์ฒด๋ฅผ ๊ต์ฒดํ๋ ์์ ์ ์๋ฏธํ๋ค.
- Instance-level editing์ ์๋ก ๋ค๋ฅธ ๊ฐ์ฒด ์ธ์คํด์ค๋ฅผ ๊ตฌ๋ถํ๊ณ ์์ ํ๋ ๊ฒ์ด๋ค.
- Part-level editing์ ์๋ก์ด ๊ฐ์ฒด๋ฅผ ์ถ๊ฐํ๊ฑฐ๋ ๊ธฐ์กด ๊ฐ์ฒด์ ์์ฑ(attribute)์ ๋ถ๋ถ์ ์ผ๋ก ๋ณ๊ฒฝํ๋ ์์ ์ ํฌํจํ๋ค.
๊ธฐ์กด์ ๋ฐฉ๋ฒ๋ค์ instance-agnostic(๊ฐ์ฒด๋ฅผ ๊ตฌ๋ถํ์ง ๋ชปํจ)ํ๊ธฐ์ editing์ ํ ๋ ์๋ก ๋ค๋ฅธ instance์ feature์ด ํผํฉ๋๋ค.
Figure 2์ ์ค๋ฅธ์ชฝ์ ๋ณด๋ฉด, ์ต์ T2V ๋ชจ๋ธ๋ค์ multi-grained editing์๋ ์ทจ์ฝํ ๋ฉด์ ๋ณด์ธ๋ค.
์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด ๋ณธ ๋ ผ๋ฌธ์ ๋ค์ ๋ ๊ฐ์ง๋ฅผ ํต์ฌ ๋ชจํฐ๋ฒ ์ด์ ์ผ๋ก ์ผ๋๋ค.
- ํ ์คํธ๋ก ํน์ ์์ญ(region) ์ ์ ์ดํ ์ ์๋ text-to-region control์ ๊ฐ๋ฅํ๊ฒ ํ๊ณ ,
- ์์ญ ๊ฐ feature๊ฐ ์์ด์ง ์๋๋ก feature separation์ ์ ์งํ๋ ๊ฒ์ด๋ค.
์ผ๋ฐ์ ์ธ diffusion ๋ชจ๋ธ์์
- Cross-attention layer๋ text feature๋ฅผ ํ์ฉํด ๊ฐ spatial region์ ์ ์ดํ๊ณ ,
- Self-attention layer๋ ์๊ฐ ์ถ์ ๋ฐ๋ผ ํ๋ ์ ๊ฐ ํ ํฐ์ ์ฐ๊ฒฐํ๋ฉฐ global coherence์ ํ์ฑํ๋ค.
ํ์ง๋ง ๊ธฐ์กด ๋ฐฉ์์๋ ๋ค์๊ณผ ๊ฐ์ ๋ฌธ์ ๊ฐ ์กด์ฌํ๋ค.
Cross-Attention Layer์ ๋ฌธ์ ์ ํด๊ฒฐ
- ๋ฌธ์ ์ : ๋ชจ๋ ํ๋ ์ ํ ํฐ์ ๋์ผํ ๊ธ๋ก๋ฒ ํ
์คํธ ํ๋กฌํํธ๊ฐ ์ ์ฉ๋์ด,
→ ๊ฐ ์์ญ์ ๋ง์ง ์๋ ์๋ฏธ์ ๋ถ์ผ์น(semantic misalignment)๊ฐ ๋ฐ์ํ๋ค. - ํด๊ฒฐ์ฑ : ๊ฐ ๋ก์ปฌ ํ๋กฌํํธ(local prompt)๊ฐ ๊ทธ์ ๋์๋๋ ๊ณต๊ฐ ๋ถ๋ฆฌ๋ ์์ญ(spatially-disentangled region)์ ์ง์คํ ์ ์๋๋ก cross-attention์ ์กฐ์ (amplify)ํ์ฌ, ๋ถํ์ํ ์์ญ์ ๋ํ ์ฃผ์๋ฅผ ์ต์ ํ๋ค.
Self-Attention Layer์ ๋ฌธ์ ์ ํด๊ฒฐ
- ๋ฌธ์ ์ : ํ ์์ญ์ ํฝ์
์ด ๊ฐ์ ํด๋์ค ๋ด์ ์ธ๋ถ ์์ญ์ด๋ ์ ์ฌํ ์ธ์ ์์ญ๊น์ง ์ํฅ์ ๋ฏธ์ณ
→ feature coupling๊ณผ texture mixing์ด ๋ฐ์ํ๋ค. - ํด๊ฒฐ์ฑ : self-attention์ด intra-region (์์ญ ๋ด) ๊ด๊ณ์ ์ง์คํ๊ณ , inter-region (์์ญ ๊ฐ) ๊ด๊ณ๋ ์ต์ ํ ์ ์๋๋ก ์กฐ์ ํ์ฌ → ๊ฐ query๊ฐ ์์ ์ ๋์ ์์ญ(target region)์๋ง ์ง์คํ๋๋ก ํ๋ค.
์ด๋ฌํ ๋ฌธ์ ๋ฅผ ํตํฉ์ ์ผ๋ก ํด๊ฒฐํ๊ธฐ ์ํด, ์ฐ๋ฆฌ๋ Spatial-Temporal Layout-Guided Attention (ST-Layout Attn)์ ์ ์ํ๋ค.
์ด๋ spacetime cross-attention๊ณผ self-attention์ ํจ๊ป ์กฐ์ ํจ์ผ๋ก์จ,
์ ํํ text-to-region control๊ณผ feature separation์ ๋์์ ๋ฌ์ฑํ๋ค.
Contribution
- multi-grained video editing์ ๋ํ ์ฒซ ์๋
- cross attention์ ํตํด text-to-region control์ ํ๊ณ , self-attention์ ํตํด feature separation์ ํ๋ VideoGrain
- parameter tuning์ ํ์ง ์๊ณ ๋ SOTA ์ฑ๋ฅ ๋๋ฌ
# METHOD
## 3.1 Motivation
๋ณธ ๋ ผ๋ฌธ์ DDIM Inversion๊ณผ์ ์์ Self-Attention์ ๋ถ์ํ์๋ค.
๊ฐ ํ๋ ์์์ self-attention feature์ K-Means๋ก ํด๋ฌ์คํ
ํ์ ๋, semantic segmentation์ ์ด๋์ ๋ ๋์ง๋ง, ๋ ๋จ์๋ฅผ ๊ตฌ๋ถํ๋ ๊ฒ์ ์คํจํ๋ค.
ํด๋ฌ์คํฐ ์๋ฅผ ๋๋ ค๋ ๊ฐ๋ณ ์ธ์คํด์ค๋ฅผ ๋ถ๋ฆฌํ์ง ๋ชปํ๊ณ ์ด๋ instance-level editing์ด ์ด๋ ค์ด ์ด์ ๋ฅผ ๋ณด์ฌ์ค๋ค.
๋ํ, SDEdit์ ์ฌ์ฉํด์ ์ผ์ชฝ ๋จ์๋ฅผ Iron Man, ์ค๋ฅธ์ชฝ ๋จ์๋ฅผ Spiderman์ผ๋ก editํ๋ ค๊ณ ํ๋ค.
๊ทธ๋ฌ๋ cross-attention map์ ๋ณด๋ฉด Iron Man๊ณผ Spiderman์ attention์ด ๋ชจ๋ ์ผ์ชฝ ๋จ์์ ์ง์ค๋๊ณ , blossom์ attention์ ์ค๋ฅธ์ชฝ ๋จ์์๊ฒ๊น์ง ํผ์ ธ์ ์คํจํ์๋ค.
๋ฐ๋ผ์, ์ ์๋ค์ ๋ค์๊ณผ ๊ฐ์ ์์ด๋์ด๋ฅผ ์ ์ํ๋ค.
"๊ฐ ์ง์ญ(local)์ attention์ด ์ ํํ๊ฒ ๋ถํฌ๋๋๋ก ์กฐ์ ํ ์ ์๋๊ฐ?"
์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด VideoGrain์ด๋ผ๋ ๋ฐฉ๋ฒ ์ ์ํ๋ค.
- (1) Cross-attention modulation: text embedding์ด ์ฌ๋ฐ๋ฅธ spatial region์ ์ง์คํ๋๋ก ์กฐ์ .
- (2) Self-attention modulation: ์ง์ญ ๋ด focus๋ ๋์ด๊ณ ์ง์ญ ๊ฐ ๊ฐ์ญ์ ์ค์ด๋๋ก ์ค๊ณ.
## 3.3 Overall Framework
์ ์ฒด ํ์ดํ๋ผ์ธ์ ๋ค์๊ณผ ๊ฐ๋ค.
Input: Video frames $V$, Text prompt
Step 1: DDIM Inversion → Noisy latent $x_t$
- Clean latent $x_0$๋ฅผ DDIM Inversion์ผ๋ก ์ญ์ถ๋ก ํ์ฌ $x_t$ ํ๋
- ์ด๋ high-fidelity reconstruction์ ์ํ ์ด๊ธฐ ๋จ๊ณ
Step 2: Semantic layout condition $e$
- Self-attention features๋ฅผ clusteringํ์ฌ semantic layout ์์ฑ
- ํ์ง๋ง 3.1์ ์์ ๋ณด์๋ฏ, self-attention๋ง์ผ๋ก๋ instance ๊ตฌ๋ถ์ด ๋ถ๊ฐ๋ฅ
- ๋ฐ๋ผ์ SAM-Track์ ํ์ฉํด ๊ฐ ์ธ์คํด์ค๋ฅผ ๋ถ๋ฆฌ(segment)
- ํ์์ ๋ฐ๋ผ ControlNet condition $e$ ์ ์ฉ ๊ฐ๋ฅ (e.g., pose map or depth map for structural guidance)
Step 3. Spatial-Temporal Layout-Guided Attention
- Cross-attention๊ณผ self-attention ๋ชจ๋์ layout mask๋ฅผ ์ ์ฉํ์ฌ
→ ํ ์คํธ๊ฐ ์ฌ๋ฐ๋ฅธ ์์น(region) ์ ์ง์คํ๋๋ก ์ ๋
→ ์๋ก ๋ค๋ฅธ ์ธ์คํด์ค ๊ฐ feature interference๋ฅผ ๋ฐฉ์ง
Step 4: DDIM Denoising → Output frames $V'$
- ์กฐ์ ๋ attention์ ๊ธฐ๋ฐ์ผ๋ก ์ต์ข ์์ ์์ฑ
## 3.4 SPATIAL-TEMPORAL LAYOUT-GUIDED ATTENTION
Cross-attention์ ๊ฐ์ค์น ๋ถํฌ๊ฐ ํธ์ง ๊ฒฐ๊ณผ์ ์ง์ ์ ์ธ ์ํฅ์ ์ฃผ๋ ์ญํ ์ ํ๊ณ
Self-attention์ ํ๋ ์ ๊ฐ ์ผ๊ด์ฑ์ ์ ์งํ๋ ๋ฐ ์ค์ํ ์ญํ ์ ํ๋ค.
๋ณธ ๋ ผ๋ฌธ์์๋ ๋ ์ข ๋ฅ์ attention ๋ชจ๋์ ๋ํด "๊ธ์ ์์ ๊ฐ์กฐ, ๋ถ์ ์์ ์ต์ "ํ๋ ๋ฐฉ์์ผ๋ก score๋ฅผ ์กฐ์ ํ๋ค.
- ๊ธฐ์กด attention score $QK^T$์ mask $M$์ ๋ํด์ modulation
- $\lambda$: modulation ๊ฐ๋๋ฅผ ์กฐ์ ํ๋ ํ์ดํผํ๋ผ๋ฏธํฐ
- ๊ฒฐ๊ณผ์ ์ผ๋ก ๊ธ์ ๊ด๊ณ๋ ๊ฐ์กฐ๋๊ณ , ๋ถ์ ๊ด๊ณ๋ ์ฝํ๋จ
- $R_i$: ์ด๋ค query-key ์์ด positive pair์ธ์ง negative pair์ธ์ง ์๋ ค์ฃผ๋ binary mask
- $M_i^{pos}$: ๊ฐ์กฐํ ๊ด๊ณ์ score
- $M_i^{neg}$: ์ต์ ํ ๊ด๊ณ์ score
์ฆ, "๊ฐ์กฐํ ์์ pos score ์ฌ์ฉ, ์ต์ ํ ์์ neg score ์ฌ์ฉ"์ unified ํฌ๋ฎฌ๋ ์ด์ ์ด๋ค.
[Modulate Cross-Attention for Text-to-Region Control.]
Cross-attention์์๋ ํ ์คํธ ์๋ฒ ๋ฉ์ด key/value๋ก ์ฌ์ฉ๋๊ณ , ๋น๋์ค latent์์ ์จ feature๊ฐ query๋ก ์ฌ์ฉ๋๋ค.
๊ทธ๋ฆฌ๊ณ , ์ด query๊ฐ ์ด๋ค key์ ์ง์คํ๋์ ๋ฐ๋ผ, ์ด๋ ์์น์ ์ด๋ค ํ ์คํธ ์กฐ๊ฑด์ด ๋ฐ์๋ ์ง ๊ฒฐ์ ๋๋ค.
1. Attention Modulation Score ๊ณ์ฐ
- positive: ์๋ attention score์ ์ต๋๊ฐ์ ์ฐจ๋ก ๊ณ์ฐ
- --> ํฐ attention score์ผ์๋ก ์๊ฒ ๋์ค๋ฏ๋ก, ์์ modulation์ผ๋ก ๋ฐ์๋ ๊ฒ
- negative: ์๋ score์์ ์ต์๊ฐ์ ๋นผ์ ์์ ์ํฅ์ ์ฃผ๋๋ก ๊ตฌ์ฑ
2. ์ด๋ค ์์ด positive/negative์ธ๊ฐ?
- $x: query index (๋น๋์ค latent์ ๊ณต๊ฐ ์์น)
- $y: key index (ํ ์คํธ ํ ํฐ ์์น)
- $\tau_k$: ํด๋น ํ ์คํธ๊ฐ ํ๊ฒ์ผ๋ก ํ๋ ์ธ์คํด์ค
- $m_{i,k}$: ์ธ์คํด์ค $k์ ๋ง์คํฌ์์ ์์น $x๊ฐ ์ํด ์๋์ง ์ฌ๋ถ
--> ์ฆ, ํ ์คํธ $\tau_k$๊ฐ ํน์ ์ธ์คํด์ค์ ๋์๋๋ค๊ณ ํ ๋, ๊ทธ ์ธ์คํด์ค์ ์์น์๋ง positive modulation์ ์ฃผ๊ณ , ๋๋จธ์ง๋ 0 ์ฒ๋ฆฌ (negative)
[Modulate Self-Attention to Keep Feature Separation.]
๊ธฐ์กด Text-to-Image(T2I) ๋ชจ๋ธ์ ๋จ์ผ ํ๋ ์๋ง ๋ณด์ง๋ง, ์์ ํธ์ง์์๋ ์ฌ๋ฌ ํ๋ ์์ ๋ณด๋ฉฐ ์๊ฐ์ ์ธ ์ผ๊ด์ฑ๋ ๊ณ ๋ คํด์ผ ํ๋ค. --> ๊ทธ๋์ spatial attention → spatial-temporal self-attention์ผ๋ก ํ์ฅํจ
ํ์ง๋ง, ๋จ์ํ self-attention์ ๋ค๋ฅธ ์ธ์คํด์ค๋ผ๋ฆฌ ์๋ชป ์ฐ๊ฒฐ๋ ์ ์๋ค๋ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ค.
์๋ ๊ทธ๋ฆผ์ ๋ด๋ self-attention modulation์ ํ๊ธฐ ์ ์๋ ๋ ์ธ์คํด์ค ๊ฐ์ feature๊ฐ ์์ฌ๋ฒ๋ฆฐ ๊ฒ์ ๋ฐ๊ฒฌํ ์ ์๋ค.
์ด๋ฅผ ์ํด์ ๊ฐ์ instance ๋ด์์ attention์ ๊ฐํํ๊ณ , ๋ค๋ฅธ instance ๊ฐ์๋ attention์ ์ต์ ํ๋ ๊ตฌ์กฐ๋ฅผ ์ค๊ณํ๋ค.
- positive: ๊ฐ์ ์ธ์คํด์ค์ ํ ํฐ๋ค๋ผ๋ฆฌ attention์ ์ฃผ๊ฒ๋ ๊ฐ์กฐ
--> max ๊ธฐ์ค์ผ๋ก ํ์คํํ์ฌ ๊ฐํ๊ฒ ์ฐ๊ฒฐ๋๋๋ก ์ ๋ - negative: ์๋ก ๋ค๋ฅธ ์ธ์คํด์ค ๊ฐ์ attention์ ์ค์ด๋๋ก ์กฐ์
--> min ๊ธฐ์ค์ผ๋ก ๋ฎ์ถ๋๋ก ์ ๋
- ๋ง์ฝ $x์ $y๊ฐ ๋ค๋ฅธ ์ธ์คํด์ค์ ์ํ๋ฉด → 0 (attention ์ฐจ๋จ)
- ๊ฐ์ ์ธ์คํด์ค์ ์ํ๋ฉด → 1 (attention ํ์ฉ)
→ ์ฆ, ์ด mask๋ ์ธ์คํด์ค ๊ฐ ๊ฒฝ๊ณ๋ฅผ ๋ช ํํ ํ๊ธฐ ์ํ ๋ฐ์ด๋๋ฆฌ ํํฐ ์ญํ
# Evaluation Result