Deficiency-Aware Masked Transformer for Video Inpainting

Yongsheng Yu, Heng Fan, Libo ZhangarXiv 2023 · DOI

Introduction

Video inpainting—the process of filling in missing or removed regions in a video—traditionally relies on temporal propagation: if a pixel is missing in one frame, the model searches for it in another. However, this approach fails in "deficiency cases," where the masked content is absent throughout the entire video sequence. In such scenarios, even state-of-the-art models often produce blurry artifacts or repetitive patterns because they lack the generative capacity to "imagine" complex textures from scratch.

The Deficiency-aware Masked Transformer (DMT) framework addresses this by bridging the gap between image-based generative priors and video-based temporal consistency. By teaching video models to leverage pre-trained image inpainting knowledge, DMT can coherently fill large, persistent occlusions that stump traditional methods.

Methodology

The DMT framework introduces several innovations to handle the transition from retrieval-based to generative-based inpainting.

Knowledge Migration and Dual-Modality Training

A core challenge in video inpainting is the "stability-plasticity trade-off." Simply fine-tuning an image model on video data often leads to "catastrophic forgetting" of spatial priors or getting stuck in local optima. DMT solves this through a two-stage process:

  1. Image Pre-training: An image-only version ($DMT_{img}$) is trained on the Places2 dataset to master generative "hallucination."
  2. Video Migration: The video version ($DMT_{vid}$) is trained from scratch but utilizes a Migration Regularization loss. This loss acts as a distillation mechanism, forcing the video model to retain the generative priors of the image model while simultaneously learning temporal dynamics.
Comparison of learning strategies for image and video inpainting. DMT (c) uses a pre-training stage and migration regularization to bridge the gap between image priors and video dynamics.

Efficient Transformer Architecture

To manage the computational complexity of Transformers, DMT employs a Token Selection mechanism that drops "invalid" tokens (patches that are entirely masked) before processing. A Mask Activation algorithm then iteratively "reactivates" and fills these patches as data flows through the Transformer layers. Additionally, a Receptive Field Contextualizer (RFC) module uses large-kernel depthwise convolutions to capture high-frequency spatial details often lost during patch-based tokenization.

Results and Discussion

DMT was evaluated on industry-standard benchmarks, including YouTube-VOS and DAVIS.

Quantitative Performance

DMT sets new records across multiple metrics (PSNR, SSIM, and VFID). On the DAVIS dataset, it achieved a 0.81 dB PSNR increase over the previous state-of-the-art, FGT. On YouTube-VOS, it demonstrated a 0.56 dB improvement, highlighting its robustness across different video types.

Qualitative Superiority

The model excels in challenging "in-the-wild" scenarios, such as anime inpainting or handling massive masks covering nearly half the frame. While previous models like $E^2FGVI$ often produce "ghosting" or mosaic artifacts in deficiency cases, DMT maintains sharp textures and temporal stability.

Qualitative results of DMT across three scenarios: (a) deficiency cases with large masks, (b) in-the-wild video inpainting, and (c) one-shot object removal.

One-Shot Object Removal

The framework is highly adaptable to real-world editing tasks. By integrating with text-guided segmentation, DMT can perform one-shot object removal (e.g., "remove the person"), seamlessly filling the resulting large holes with contextually appropriate background textures.

Conclusion

The Deficiency-aware Masked Transformer (DMT) represents a significant step forward in video inpainting by explicitly addressing the "deficiency" problem. By decoupling generative "hallucination" from temporal propagation through knowledge migration, it achieves superior visual quality and consistency. While memory constraints for high-resolution video remain a challenge for Transformer-based architectures, DMT's ability to leverage image priors provides a powerful blueprint for future unified image-video generative models.

Summary updated

BibTeX
@misc{yu2023deficiency,
  author = {Yongsheng Yu and Heng Fan and Libo Zhang},
  title = {{Deficiency-Aware Masked Transformer for Video Inpainting}},
  year = {2023},
  eprint = {2307.08629},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2307.08629},
}
Figure