Hamiltonian latent operators for content and motion disentanglement in image sequences

Asif Khan, Amos Storkey

TL;DR

HALO (HAmiltonian Latent Operators) is a deep generative model that uses the principles of Hamiltonian mechanics to cleanly separate "content" (what an object looks like) from "motion" (how it moves) in video sequences. By enforcing physical constraints like energy conservation and reversibility in the latent space, HALO achieves superior disentanglement and generates more stable, realistic long-term sequences than standard recurrent models.

What Problem Does This Paper Address?

Generating realistic image sequences requires a model to understand two distinct factors: the static identity of the subject (content) and the dynamic process of their actions (motion). Current deep generative models, like standard Variational Autoencoders (VAEs) or Generative Adversarial Networks (GANs), often struggle to keep these factors separate.

Common issues include:

  • Information Leakage: Appearance details often "leak" into motion variables, making it impossible to apply one person's motion to another person's face.
  • Dynamic Drift: Sequential models often accumulate errors over time, causing generated videos to quickly become blurry or deviate into unrealistic states.
  • Lack of Control: It is difficult to precisely control specific actions (e.g., "make this character walk") without affecting their appearance.

Methods

The authors introduce HALO, a VAE-based framework that imposes a Hamiltonian structure on the latent space.

Key technical components include:

  • Latent Decomposition: The latent space is split into a static content variable ($z$) and a dynamic motion space ($S$).
  • Phase Space Dynamics: The motion space is treated as a physical phase space consisting of generalized position ($q$) and momentum ($p$).
  • Hamiltonian Operators: Instead of using a standard RNN to predict the next frame, HALO uses learnable linear Hamiltonian operators ($H$). The evolution of a sequence is modeled as a group action: $s_t = e^{tH}s_0$.
  • Symplectic Properties: By definition, Hamiltonian dynamics are symplectic (volume-preserving) and reversible. This ensures that latent trajectories don't collapse or explode over time and can be unrolled both forward and backward.
  • Action Subspaces: For datasets with multiple distinct actions (like "walking" vs. "slashing"), the motion space is partitioned into subspaces, each governed by a unique Hamiltonian operator.
The HALO framework: Encoding frames into content and phase space, unrolling dynamics via Hamiltonian operators, and decoding back to image sequences.

Datasets

The model was evaluated on four diverse datasets:

  1. Rotating Balls: A synthetic dataset of colored balls moving in orbits, used to empirically demonstrate energy conservation in the latent space.
  2. Sprites: Animated characters performing actions like walking, spell-casting, and slashing from multiple viewing angles.
  3. MUG Facial Expression Database: Videos of 52 individuals performing six basic facial expressions (e.g., anger, happiness, surprise).
  4. Rotating MNIST: Sequences of the digit "3" rotating, used to test long-term trajectory prediction.

Key Insights and Ideas

  • Conservation as a Disentanglement Tool: The most powerful insight is that physical conservation laws are an excellent inductive bias for disentanglement. Because Hamiltonian dynamics must conserve energy, the motion coordinates are forced to change over time. This prevents the encoder from "hiding" static appearance information in the motion variables, effectively pushing it all into the content variable.
  • Stability through Symplectic Geometry: The volume-preserving nature of the latent space acts as a stabilizer. Unlike RNNs, which can drift off the "data manifold," HALO's trajectories are constrained to stay on a continuous, non-divergent path.
  • Linearity for Interpretability: While the mapping from latent space to pixels is highly non-linear (handled by deep neural networks), the dynamics themselves are linear in the latent space. This makes the motion highly controllable and mathematically elegant.
Figure 1: Left: we empirically demonstrate the benefits of learning Hamiltonian operator in the latent space. Consider (32, 32) image sequence of a ball rotating in a fixed orbit; the (i, j) centre of a ball moves under constraint i2 + j2 = c, where c is a constant. We generated a data set of sequences with different initial condition and same number of time steps. Next, we trained a VAE with Hamiltonian operator in the latent space. We use an encoder to transform sequences to a 2-dimensional phase space, next we unroll a trajectory using a learnable Hamiltonian operator and finally use decoder to obtain the sequence. Top row is the original sequence, second row is the reconstructed sequence and below are three sequences generated from random initial states. Middle: the coordinates in the phase space are coloured by the energy value, alongwith a representation of a sequence generated from a random initial coordinate. Right: is the probabilistic graph of our generative and inference model.

Key Results

  • Superior Disentanglement: On the MUG dataset, HALO achieved an action classification accuracy of 92.9% for generated sequences, significantly outperforming baselines like DSVAE (54.3%) and MoCoGAN (63.1%).
  • High-Quality Motion Swapping: The model successfully performs "motion swaps," where the specific facial expression of one person is applied to the identity of another with high fidelity.
  • Controlled Generation: HALO can generate diverse, long-term sequences from a single starting frame by simply applying different learned Hamiltonian operators.
  • Ablation Success: Comparisons showed that HALO maintains consistent dynamics over long sequences where standard Linear and RNN models often fail or produce static, non-moving results.
Qualitative results showing successful motion swapping between different characters and facial expressions.

Limitations and Future Work

  • Sampling Frequency: The current model assumes equally spaced time steps and may struggle with irregularly sampled data.
  • Temporal Flexibility: HALO is less adept at handling sudden changes in tempo or mid-action reversals.
  • Discrete Actions: While an unconditional version exists, the model performs best when actions are categorized into discrete sets. Future work aims to allow for a more flexible prior on time-step spacing and more complex, unconstrained motion types.

Summary updated

Abstract

We introduce \textit{HALO} -- a deep generative model utilising HAmiltonian Latent Operators to reliably disentangle content and motion information in image sequences. The \textit{content} represents summary statistics of a sequence, and \textit{motion} is a dynamic process that determines how information is expressed in any part of the sequence. By modelling the dynamics as a Hamiltonian motion, important desiderata are ensured: (1) the motion is reversible, (2) the symplectic, volume-preserving structure in phase space means paths are continuous and are not divergent in the latent space. Consequently, the nearness of sequence frames is realised by the nearness of their coordinates in the phase space, which proves valuable for disentanglement and long-term sequence generation. The sequence space is generally comprised of different types of dynamical motions. To ensure long-term separability and allow controlled generation, we associate every motion with a unique Hamiltonian that acts in its respective subspace. We demonstrate the utility of \textit{HALO} by swapping the motion of a pair of sequences, controlled generation, and image rotations.
BibTeX
@inproceedings{khan2022hamiltonian,
  author = {Asif Khan and Amos Storkey},
  title = {{Hamiltonian latent operators for content and motion disentanglement in image sequences}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=83OXtpgeSr},
}
Figure