FateZero
[ICCV 2023 Oral] "FateZero: Fusing Attentions for Zero-shot Text-based Video Editing"
Install / Use
/learn @ChenyangQiQi/FateZeroREADME
FateZero: Fusing Attentions for Zero-shot Text-based Video Editing (ICCV23 Oral')
Chenyang Qi, Xiaodong Cun, Yong Zhang, Chenyang Lei, Xintao Wang, Ying Shan, and Qifeng Chen
<a href='https://arxiv.org/abs/2303.09535'><img src='https://img.shields.io/badge/ArXiv-2303.09535-red'></a>
<a href='https://fate-zero-edit.github.io/'><img src='https://img.shields.io/badge/Project-Page-Green'></a>
🎏 Abstract
<b>TL; DR: <font color="red">FateZero</font> is the first zero-shot framework for text-driven video editing via pretrained diffusion models without training.</b>
<details><summary>CLICK for the full abstract</summary></details>The diffusion-based generative models have achieved remarkable success in text-based image generation. However, since it contains enormous randomness in generation progress, it is still challenging to apply such models for real-world visual content editing, especially in videos. In this paper, we propose <font color="red">FateZero</font>, a zero-shot text-based editing method on real-world videos without per-prompt training or use-specific mask. To edit videos consistently, we propose several techniques based on the pre-trained models. Firstly, in contrast to the straightforward DDIM inversion technique, our approach captures intermediate attention maps during inversion, which effectively retain both structural and motion information. These maps are directly fused in the editing process rather than generated during denoising. To further minimize semantic leakage of the source video, we then fuse self-attentions with a blending mask obtained by cross-attention features from the source prompt. Furthermore, we have implemented a reform of the self-attention mechanism in denoising UNet by introducing spatial-temporal attention to ensure frame consistency. Yet succinct, our method is the first one to show the ability of zero-shot text-driven video style and local attribute editing from the trained text-to-image model. We also have a better zero-shot shape-aware editing ability based on the text-to-video model. Extensive experiments demonstrate our superior temporal consistency and editing capability than previous works.
📋 Changelog
- 2023.06.10 Two examples of large motion and multiple object.
- 2023.04.18 Code refactoring and support local blending using blend_latents option.
- 2023.04.04 Release Enhanced Tuning-a-Video configs and shape editing ckpts, data and config
- 2023.03.31 Refine hugging face demo.
- 2023.03.27 Excited to Release
Hugging face demo,attribute editing configanddata
-
2023.03.22 Upload
style editing configand <!--[`data`](https://hkustconnect-my.sharepoint.com/:u:/g/personal/cqiaa_connect_ust_hk/EaTqRAuW0eJLj0z_JJrURkcBZCC3Zvgsdo6zsXHhpyHhHQ?e=FzuiNG) -->dataand acolab notebook.
-
2023.03.21 Provide Editing guidance for in-the-wild video. Update the
configfor lower resources computers (16G GPU and less than 16G CPU RAM).
- 2023.03.17 Release Code and Paper!
🚧 Todo
<details><summary>Click for Previous todos </summary>- [x] Release the edit config and data for all results, Tune-a-video optimization
- [x] Memory and runtime profiling and Editing guidance documents
- [x] Colab and hugging-face
- [x] code refactoring
- [ ] time & memory optimization
- [ ] Release more application
🛡 Setup Environment
Our method is tested using cuda11, fp16 of accelerator and xformers on a single A100 or 3090.
conda create -n fatezero38 python=3.8
conda activate fatezero38
pip install -r requirements.txt
xformers is recommended for A100 GPU to save memory and running time.
We find its installation not stable. You may try the following wheel:
wget https://github.com/ShivamShrirao/xformers-wheels/releases/download/4c06c79/xformers-0.0.15.dev0+4c06c79.d20221201-cp38-cp38-linux_x86_64.whl
pip install xformers-0.0.15.dev0+4c06c79.d20221201-cp38-cp38-linux_x86_64.whl
</details>
Validate the installation by
python test_install.py
You may download all data and checkpoints using the following bash command
bash download_all.sh
The above command take minutes and 100GB. Or you may download the required data and ckpts latter according to your interests.
Our environment is similar to Tune-A-video (official, unofficial) and prompt-to-prompt. You may check them for more details.
⚔️ FateZero Editing
Style and Attribute Editing in Teaser
Download the stable diffusion v1-4 (or other interesting image diffusion model) and put it to ./ckpt/stable-diffusion-v1-4.
mkdir ./ckpt
cd ./ckpt
# download from huggingface face, takes 20G space
git lfs install
git clone https://huggingface.co/CompVis/stable-diffusion-v1-4
</details>
Then, you could reproduce style and shape editing results in our teaser by running:
accelerate launch test_fatezero.py --config config/teaser/jeep_watercolor.yaml
# or CUDA_VISIBLE_DEVICES=0 python test_fatezero.py --config config/teaser/jeep_watercolor.yaml
<details><summary>The result is saved at `./result` . (Click for directory structure) </summary>
result
├── teaser
│ ├── jeep_posche
│ ├── jeep_watercolor
│ ├── cross-attention # visualization of cross-attention during inversion
│ ├── sample # result
│ ├── train_samples # the input video
</details>
Editing 8 frames on an Nvidia 3090, use 100G CPU memory, 12G GPU memory for editing. We also provide some low-cost setting of style editing by different hyper-parameters on a 16GB GPU.
You may try these low-cost settings on colab.
More speed and hardware benchmarks are here.
Shape and large motion editing with Tune-A-Video
Besides style and attribution editing above, we also provide a Tune-A-Video checkpoint. You may download from onedrive or from [hugging face model
Related Skills
qqbot-channel
349.9kQQ 频道管理技能。查询频道列表、子频道、成员、发帖、公告、日程等操作。使用 qqbot_channel_api 工具代理 QQ 开放平台 HTTP 接口,自动处理 Token 鉴权。当用户需要查看频道、管理子频道、查询成员、发布帖子/公告/日程时使用。
docs-writer
100.4k`docs-writer` skill instructions As an expert technical writer and editor for the Gemini CLI project, you produce accurate, clear, and consistent documentation. When asked to write, edit, or revie
model-usage
349.9kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
Design
Campus Second-Hand Trading Platform \- General Design Document (v5.0 \- React Architecture \- Complete Final Version)1\. System Overall Design 1.1. Project Overview This project aims t
