Keyframing the Future: Keyframe Discovery for Visual Prediction and Planning

Karl Pertsch, Oleh Rybkin, Jingyun Yang, Shenghao Zhou, Konstantinos G. Derpanis, Kostas Daniilidis, Joseph J. Lim, Andrew Jaegle · DOI

Abstract

Temporal observations such as videos contain essential information about the dynamics of the underlying scene, but they are often interleaved with inessential, predictable details. One way of dealing with this problem is by focusing on the most informative moments in a sequence. We propose a model that learns to discover these important events and the times when they occur and uses them to represent the full sequence. We do so using a hierarchical Keyframe-Inpainter (KeyIn) model that first generates a video's keyframes and then inpaints the rest by generating the frames at the intervening times. We propose a fully differentiable formulation to efficiently learn this procedure. We show that KeyIn finds informative keyframes in several datasets with different dynamics and visual properties. KeyIn outperforms other recent hierarchical predictive models for planning. For more details, please see the project website at https://sites.google.com/view/keyin.

Introduction

Most video prediction models treat every frame as equally important, wasting computational effort on redundant, predictable transitions. In contrast, humans naturally plan using temporal abstractions—focusing on major milestones rather than every individual step. Standard frame-by-frame prediction suffers from two major flaws: extreme redundancy and error accumulation (drift) over long horizons.

To address this, we introduce KEYIN (Keyframe-Inpainter), a model designed to automatically discover informative "keyframes" in a sequence. By identifying these temporal bottlenecks, the model enables more effective long-horizon hierarchical planning for robotic agents.

The KEYIN Architecture

KEYIN is a hierarchical model composed of two primary components that work in tandem to represent video sequences efficiently:

  1. The Keyframe Predictor: A stochastic latent variable model (implemented via an LSTM) that predicts a sequence of keyframes ($K$) and the specific timestamps ($\tau$) at which they occur.
  2. The Sequence Inpainter: A simpler network that takes two consecutive keyframes and fills in the predictable frames between them.
Overview of the KEYIN architecture showing the hierarchical prediction of keyframes and the subsequent inpainting of intermediate frames.

A core challenge in learning keyframes is that selecting a specific frame index is a discrete operation, which is typically non-differentiable. We overcome this using a continuous relaxation strategy. Instead of selecting a single frame, the model predicts a probability distribution over time and creates an "expected" target frame by linearly interpolating between ground-truth images. This allows the entire system to be optimized using standard backpropagation.

Experimental Evaluation

We evaluated KEYIN across three distinct environments with varying dynamics:

  • Structured Brownian Motion (SBM): A 2D environment where a ball moves linearly and changes direction at random intervals. KEYIN achieved an F1 score of 0.94 in identifying these direction changes, significantly outperforming surprise-based baselines (0.73).
  • Gridworld: An egocentric navigation task requiring interaction with objects.
  • Pushing Dataset: A complex MuJoCo simulation of a robot arm pushing a puck around a barrier. This task requires multi-step reasoning and precise physical interaction.

In the robotic pushing task, KEYIN achieved a 64.2% success rate in planning. This significantly outperformed a "Flat" planner (15% success) and a "Jumpy" planner using fixed intervals (58.8% success), demonstrating the value of adaptive temporal resolution.

Discussion and Conclusion

The success of KEYIN stems from the "Inpainting as a Teacher" principle: the keyframe predictor is forced to find the most informative moments because the inpainter requires that specific information to reconstruct the full sequence. Unlike fixed-interval models, KEYIN adapts its temporal resolution to the complexity of the scene, capturing fast events with high density and slow events with low density.

While effective, the current model requires a pre-specified number of keyframes and utilizes a two-stage training process. Future work will focus on learning the optimal number of keyframes dynamically and enabling end-to-end training from scratch. By reducing the planning search space to a handful of discovered subgoals, KEYIN provides a robust path toward long-horizon visual reasoning in complex environments.

Summary updated

BibTeX
@inproceedings{pertsch2020keyframing,
  author = {Karl Pertsch and Oleh Rybkin and Jingyun Yang and Shenghao Zhou and Konstantinos G. Derpanis and Kostas Daniilidis and Joseph J. Lim and Andrew Jaegle},
  title = {{Keyframing the Future: Keyframe Discovery for Visual Prediction and Planning}},
  booktitle = {L4DC},
  year = {2020},
}
Figure