UniPaint: Unified Space-time Video Inpainting via Mixture-of-Experts
Abstract
UniPaint is a novel diffusion-based framework designed to unify video inpainting and video interpolation into a single "mask-filling" task. By integrating a plug-and-play adapter with a Mixture-of-Experts (MoE) attention mechanism, UniPaint effectively handles both spatial and temporal gaps. This approach allows the model to adaptively specialize its reasoning based on mask characteristics, leading to state-of-the-art performance in object removal, frame synthesis, and temporal consistency.
Introduction
Traditionally, the computer vision community has treated video inpainting (spatial editing) and video interpolation (temporal synthesis) as distinct challenges. Inpainting focuses on removing unwanted elements or watermarks within a frame, while interpolation aims to generate smooth transitions between distant keyframes. However, existing diffusion models often struggle to balance these dimensions; spatial-focused models frequently suffer from temporal flickering, and temporal-focused models often lack the precision required for fine-grained spatial edits.
UniPaint addresses this dichotomy by proposing that these tasks are fundamentally identical: filling missing data based on surrounding context. By unifying them, the framework leverages mutual performance gains, where spatial tasks provide texture detail and temporal tasks provide motion priors.
Methodology
UniPaint is built upon Stable Diffusion (v1.5) and AnimateDiff, enhanced by two primary architectural innovations:
Space-time Inpainting Adapter
To preserve the generative capabilities of the foundation model, UniPaint utilizes a "plug-and-play" adapter branch. This adapter processes noisy latents, masked frames, and the masks themselves, fusing extracted features into the main model without requiring a full fine-tuning of the base parameters.
Mixture-of-Experts (MoE) Attention
The core of UniPaint’s adaptability is its MoE attention mechanism. Since different tasks (e.g., filling a small spatial hole vs. synthesizing an entire frame) require different reasoning, the model employs a set of "expert" feed-forward networks. A Gating Network analyzes the input mask's shape and type to dynamically weight these experts, allowing the model to specialize its behavior on the fly.
Unified Masking Strategy
Training involves a diverse mix of four mask types to ensure robustness: segmentation-based masks for objects, random masks for general robustness, marginal masks for out-painting, and interpolation masks for entire missing frames.
Experimental Setup and Results
The researchers utilized a two-stage training pipeline, pre-training on WebVid-10M for motion priors and fine-tuning on YouTubeVOS for aesthetic refinement. Evaluation on the DAVIS dataset showed that UniPaint demonstrates superior performance over existing state-of-the-art methods like VideoComposer and AVID.
- Spatial Inpainting: The model achieved top scores in Background Preservation (BP) and Textual Alignment (TA), indicating high fidelity to text prompts while keeping unmasked areas unchanged.
- Temporal Inpainting: In interpolation tasks, UniPaint achieved a PSNR of 20.01 and a leading SSIM of 0.4814, outperforming specialized models like VIDIM.
- Qualitative Quality: Visual outputs exhibit sharper edges and better semantic alignment. In object replacement tasks, the model maintains consistent textures and shapes across the entire video sequence.
Discussion and Limitations
The unification of spatial and temporal tasks proves beneficial; spatial tasks enhance texture, while temporal tasks improve motion understanding. The MoE gating mechanism further ensures that the model is "shape-aware," distinguishing between minor repairs and large-scale synthesis. However, UniPaint faces challenges with highly complex or rapid human movements (e.g., breakdancing), which can lead to ghosting artifacts. Future work will explore integrating video super-resolution and video prediction into this unified framework.
Summary updated