Explicitly disentangling image content from translation and rotation with spatial-VAE

Tristan Bepler, Ellen D. Zhong, Kotaro Kelley, Edward Brignole, Bonnie Berger

Abstract

Standard Variational Autoencoders (VAEs) often conflate an object's semantic content with its spatial orientation, leading to entangled latent representations. We present Spatial-VAE, a framework that explicitly separates "pose" (rotation and translation) from content by re-defining the decoder as a continuous function of spatial coordinates. This structural disentanglement allows the model to learn invariant representations in an unsupervised manner, significantly improving performance on datasets with random orientations, such as cryo-electron microscopy and astronomical imaging.

Introduction

In unsupervised representation learning, the goal is to extract a compact latent vector $z$ that describes the intrinsic properties of an object in an image. However, standard models struggle when objects appear at varying angles or positions. Without prior knowledge of geometry, a VAE must use its limited capacity to encode these spatial transformations as part of the "content," resulting in a lack of interpretability and poor generalization. This is particularly problematic in scientific domains like single-particle electron microscopy (EM), where proteins are captured at random orientations. Distinguishing between a protein's internal conformational change and a simple camera rotation is critical for accurate 3D reconstruction.

Methods: The Spatial Generator Network

The core innovation of Spatial-VAE is the shift from a grid-based decoder to a coordinate-based generator. In a traditional VAE, the decoder outputs a fixed grid of pixels. In contrast, the Spatial-VAE decoder is a function $f(x, y, z)$ that predicts the pixel intensity at a specific coordinate $(x, y)$ given a content latent $z$.

Architecture of Spatial-VAE: (a) The spatial generator network takes coordinates and latent variables to predict pixel values. (b) The inference network predicts pose parameters and content latents from an input image.

This formulation allows for explicit geometric transformations. By applying a rotation matrix $R(\theta)$ and a translation vector $\Delta x$ to the coordinates before they enter the decoder, the model can "undo" the pose of the input image. The inference network predicts three distinct components: the content ($z$), the rotation ($\theta$), and the translation ($\Delta x$). Because the coordinate transformation is differentiable, the model is forced to use the dedicated pose variables for spatial shifts, leaving $z$ to represent only the object's intrinsic style or shape.

Key Results

The authors evaluated Spatial-VAE on several benchmarks, including MNIST (standard, rotated, and translated), simulated protein projections (5HDB), and astronomical images (Galaxy Zoo).

Comparison of latent space traversals on MNIST variants. Spatial-VAE successfully disentangles digit style from rotation and translation, whereas vanilla VAEs struggle.

On rotated and translated MNIST, Spatial-VAE achieved a significantly higher Evidence Lower Bound (ELBO) compared to standard VAEs, particularly at low latent dimensions. As shown in the results above, the model effectively ignores spatial noise, producing clean latent traversals that capture digit identity regardless of orientation. In scientific applications, the model demonstrated high fidelity; for the 5HDB protein dataset, the latent variable $z$ showed a 0.95 correlation with ground-truth protein conformations, whereas standard VAEs failed to separate internal movement from global rotation.

Discussion and Conclusion

Spatial-VAE demonstrates that structural constraints can be more effective than loss-function penalties (like those in $\beta$-VAE) for achieving disentanglement. By hard-coding the geometric relationship between coordinates and pixels, the model achieves a mathematically grounded separation of pose and content.

While currently limited to 2D transformations, the coordinate-based approach provides a foundation for extending to 3D pose inference in cryo-EM. Future work may also integrate additional nuisance variables, such as lighting or scale, into this structural framework to further enhance the robustness of unsupervised representation learning in complex scientific datasets.

Summary updated

BibTeX
@inproceedings{bepler2019explicitly,
  author = {Tristan Bepler and Ellen D. Zhong and Kotaro Kelley and Edward Brignole and Bonnie Berger},
  title = {{Explicitly disentangling image content from translation and rotation with spatial-VAE}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2019},
  url = {https://openreview.net/forum?id=E551Wj9s7Z},
}
Figure