An Internal Learning Approach to Video Inpainting

Haotian Zhang, Long Mai, Ning Xu, Zhaowen Wang, John P. Collomosse, Hailin Jin

TL;DR

This paper introduces a novel internal learning framework for video inpainting that "hallucinates" missing content by training a generative model on a single, masked video. By jointly predicting both appearance and optical flow, the method achieves high spatial-temporal consistency without requiring massive external datasets for training.

What Problem Does This Paper Address?

Video inpainting—the task of filling in missing regions or removing unwanted objects from a video—is significantly harder than image inpainting. It requires not just spatial plausibility (making a single frame look good) but also temporal coherence (ensuring the filled content moves naturally across frames).

Existing approaches generally fall into two camps:

  1. Patch-based methods: These rely on hand-crafted priors like patch recurrence. While effective, they often struggle with complex motions, leading to "shape distortion" where the inpainted region looks warped.
  2. External deep learning methods: These train large models on massive video corpora. However, the space of all possible videos is so vast that these models often fail to generalize to unique scenes not well-represented in their training data.

The authors address these gaps by extending the Deep Image Prior (DIP) concept to video. DIP suggests that the structure of a convolutional neural network (CNN) itself acts as a natural image prior. The challenge here is extending this "internal learning" (learning only from the video at hand) to maintain long-term temporal consistency.

Methods

The core of the approach is a single frame-wise generative CNN ($G_\theta$) with an Encoder-Decoder architecture.

Figure 2: Overview of our video inpainting framework. Given the input random noise Ni for each individual frame, a generative network Gθ is used to predict both frame ˆIi and optical flow maps ˆFi,i±t. Gθ is trained entirely on the in- put video (with holes) without any external data, optimizing the combination of the image generation loss Lr, perceptual loss Lp, flow generation loss Lf and consistency loss Lc.

Key technical components include:

  • Joint Appearance and Flow Prediction: Unlike standard DIP, which only outputs RGB values, this model simultaneously predicts the frame ($\hat{I}_i$) and optical flow maps ($\hat{F}_{i,j}$) for neighboring frames.
  • Consistency Loss ($L_c$): This is the "secret sauce." The model uses its predicted flow to warp a neighboring frame into the current frame's coordinate system. It then minimizes the difference between the warped frame and the current predicted frame within the "hole" region. This forces the network to learn a motion model that is consistent with the appearance it is generating.
  • Internal Learning: The model is trained from scratch for every new video. It uses the known (unmasked) parts of the video as ground truth to learn the specific textures and motions of that scene.
  • Curriculum-based Training: Instead of random frames, the model is trained on batches of consecutive frames to better propagate information across time.

Datasets

The authors evaluated their method using:

  • Real-world videos: 28 videos from the DAVIS dataset (collected by Huang et al.) and 13 videos from other prior works.
  • Composed Dataset: A new benchmark created by the authors to facilitate quantitative evaluation. It consists of 250 videos created by overlaying real object masks from DAVIS onto 50 high-quality background videos retrieved from Flickr. This allows for direct comparison against "ground truth" background frames.

Key Insights and Ideas

  • The Network as a Prior: The paper reinforces the idea that CNN architectures naturally favor "natural" looking textures over noise. By applying this to video, they show that a 2D CNN can actually capture temporal information if the training objective is designed correctly.
  • Breaking the Reflexive Cycle: Video consistency usually requires knowing pixel correspondences (flow), but you can't calculate flow in a hole until you've filled it. By jointly synthesizing both, the model bypasses this "chicken-and-egg" problem.
  • Flow as Guidance: The predicted flow doesn't just ensure smoothness; it acts as a mechanism to "pull" valid pixels from distant frames into the current hole, effectively handling long-term consistency.
  • Generalization vs. Overfitting: Interestingly, the authors found that as the training window (number of frames) increases, the model's ability to reconstruct known regions slightly decreases (less overfitting), but its ability to generalize and inpaint the holes improves significantly.

Key Results

The proposed method, DIP-Vid-Flow, outperformed several baselines, including frame-wise DIP and 3D-CNN versions.

  • Quantitative: On the Composed dataset, the full model achieved the best scores across FID (visual plausibility), PSNR/SSIM (reconstruction accuracy), and temporal consistency metrics. For example, it reached an FID of 10.4, compared to 22.3 for frame-wise DIP.
  • Qualitative: The method successfully avoided the shape distortions common in patch-based methods and the flickering/incoherence seen in frame-by-frame deep learning approaches.
Figure 5: Temporal consistency comparison (videos provided in [16]). We stack the pixels in a fixed row (indicated by the yellow line) from all the frames of the video. Our full model (DIP-Vid-Flow) shows the smoothest temporal transition.

As seen in Figure 1, the internal learning approach handles content unseen in multiple frames much better than frame-based baselines.

Figure 1: Video inpainting results for the ‘parkour’ sequence. Our video-based internal learning framework enables much more coherent video inpainting results compared to the frame-based baseline [40] (2nd row), even for content unseen in multiple frames (orange box). As a network-based synthesis framework, our method can employ natural image priors to avoid shape distortions, which often occur in patch-based methods such as [16] (3rd row) for challenging videos (red box).

Limitations and Future Work

  • Computational Cost: The primary drawback is speed. Because the model must be trained from scratch for every video, it can take hours to process a single clip.
  • Large Holes/Static Scenes: The method relies on motion to propagate information. If a hole is very large and there is little camera or background motion, there isn't enough "signal" to fill the gap effectively.
  • Future Directions: The authors suggest exploring more advanced architectures, such as recurrent networks (RNNs) or transformers, within the internal learning paradigm to better model complex temporal dependencies. They also propose hybrid models that combine internal learning with weights pre-trained on large external datasets.

Summary updated

Abstract

We propose a novel video inpainting algorithm that simultaneously hallucinates missing appearance and motion (optical flow) information, building upon the recent 'Deep Image Prior' (DIP) that exploits convolutional network architectures to enforce plausible texture in static images. In extending DIP to video we make two important contributions. First, we show that coherent video inpainting is possible without a priori training. We take a generative approach to inpainting based on internal (within-video) learning without reliance upon an external corpus of visual data to train a one-size-fits-all model for the large space of general videos. Second, we show that such a framework can jointly generate both appearance and flow, whilst exploiting these complementary modalities to ensure mutual consistency. We show that leveraging appearance statistics specific to each video achieves visually plausible results whilst handling the challenging problem of long-term consistency.
BibTeX
@misc{zhang2019internal,
  author = {Haotian Zhang and Long Mai and Ning Xu and Zhaowen Wang and John P. Collomosse and Hailin Jin},
  title = {{An Internal Learning Approach to Video Inpainting}},
  year = {2019},
  eprint = {1909.07957},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1909.07957},
}
Figure