JianhongBai / UniEdit

UniEdit: A Unified Tuning-Free Framework for Video Motion and Appearance Editing
https://jianhongbai.github.io/UniEdit/
91 stars 4 forks source link
aigc video-editing

UniEdit: A Unified Tuning-Free Framework for Video Motion and Appearance Editing

[Project Page] [arXiv]

fig1_demo_video

Support Various Editing Scenarios

UniEdit supports both video motion editing in the time axis (i.e., from playing guitar to eating or waving) and various video appearance editing scenarios (i.e., stylization, rigid/non-rigid object replacement, background modification).

**1. Motion editing.**
**2. Stylization.**
**3. Rigid object replacement.**
**4. Non-rigid object replacement.**
**5. Background modification.**

Introduction

Abstract: Recent advances in text-guided video editing have showcased promising results in appearance editing (e.g., stylization). However, video motion editing in the temporal dimension (e.g., from eating to waving), which distinguishes video editing from image editing, is underexplored. In this work, we present UniEdit, a tuning-free framework that supports both video motion and appearance editing by harnessing the power of a pre-trained text-to-video generator within an inversion-then-generation framework. To realize motion editing while preserving source video content, based on the insights that temporal and spatial self-attention layers encode inter-frame and intra-frame dependency respectively, we introduce auxiliary motion-reference and reconstruction branches to produce text-guided motion and source features respectively. The obtained features are then injected into the main editing path via temporal and spatial self-attention layers. Extensive experiments demonstrate that UniEdit covers video motion editing and various appearance editing scenarios, and surpasses the state-of-the-art methods.

Features:

Demo

Please visit the project webpage to see more results and information.

Usage

Requirements

The code runs on Python 3.11.3 with Pytorch 2.0.1.

git clone https://github.com/JianhongBai/UniEdit.git
cd UniEdit
pip install -r requirements.txt

Checkpoints

LaVie: Our work primarily builds on the text-to-video generation framework LaVie, so we need to first download pretrained models according to its guidance here.

Generating Segmentation Masks

We utilize foreground/background segmentation masks to further enhance the performance of UniEdit, we can use SAM to generate the corresponding segmentation masks.

Editing

Last, you can perform video appearance or motion editing with following commands:

python uniedit_a.py
python uniedit_m.py

Acknowledgements

We express our gratitude for the awesome research works LaVie, MasaCtrl! Thanks for the valuable work!

Citation

@article{bai2024uniedit,
            title={UniEdit: A Unified Tuning-Free Framework for Video Motion and Appearance Editing},
            author={Bai, Jianhong and He, Tianyu and Wang, Yuchi and Guo, Junliang and Hu, Haoji and Liu, Zuozhu and Bian, Jiang},
            journal={arXiv preprint arXiv:2402.13185},
            year={2024}
          }