NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Stacked Capsule Autoencoders

Adam R. Kosiorek, Sara Sabour, Yee Whye Teh, Geoffrey E. Hinton

Introduction

Standard Convolutional Neural Networks (CNNs) are incredibly good at pattern matching, but they possess a fundamental gap in "understanding": they do not explicitly model the spatial relationships between parts of an object. A traditional CNN might recognize a face because it detects two eyes, a nose, and a mouth, even if they are scrambled in the wrong positions. Furthermore, CNNs struggle with viewpoint changes—like rotation or scaling—unless they are trained on massive amounts of augmented data.

To tackle the challenge of unsupervised object discovery, researchers introduced the Stacked Capsule Autoencoder (SCAE). The goal is to build a system that can look at a pile of unlabelled images and figure out that objects are composed of parts arranged in specific, geometrically consistent ways. By explicitly modeling how parts (like strokes or shapes) arrange themselves into wholes, the SCAE achieves state-of-the-art unsupervised classification results on benchmarks like MNIST and SVHN.

How Stacked Capsule Autoencoders Work

The SCAE architecture operates in two distinct stages to learn the geometric structure of objects without any human labels:

SCAE Architecture
  1. Part Capsule Autoencoder (PCAE): This initial stage looks at raw pixels and attempts to "explain" the image as a collection of parts. It predicts the presence and the pose (position, rotation, scale, and shear) of several learned templates. It then tries to reconstruct the original image by arranging these templates according to the predicted poses.
  2. Object Capsule Autoencoder (OCAE): This subsequent stage takes the parts discovered by the PCAE and organizes them into a smaller set of "objects." It learns viewpoint-invariant Object-Part (OP) relationships. For example, the relationship between the crossbar of a "T" and its vertical stem remains constant, regardless of where the "T" is located or how it is rotated.

Unlike previous Capsule Networks that relied on a slow, iterative process called "routing by agreement," SCAE uses amortized inference. This allows it to use standard, efficient neural encoders (like CNNs and Set Transformers) to predict capsule parameters in a single forward pass.

Key Insights and Geometric Reasoning

  • Geometric Inductive Bias: By forcing the model to reconstruct images using affine-transformed templates, the authors bake "geometry" directly into the architecture. The model must learn about poses and parts to succeed.
  • Viewpoint Invariance via Relationships: Because the relationship between an object and its parts is constant, the model becomes naturally robust to viewpoint changes. If the whole object moves, the parts move with it, but their relative positions stay the same.
  • Capsules as Classifiers: A surprising insight is that even though the model is never given labels (e.g., "this is a 3"), the presence of specific object capsules correlates almost perfectly with human-defined classes. The model effectively performs classification as a side effect of learning to represent geometry.
  • Sparsity is Key: To prevent the model from using every capsule for every image—which would result in a jumbled mess—the authors use sparsity constraints. This forces the model to be selective, leading to cleaner and more interpretable object discovery.

Datasets and Key Results

The model was evaluated on several standard benchmarks, including MNIST (handwritten digits), SVHN (Street View House Numbers), CIFAR-10 (natural images), AFFNIST (MNIST with extreme affine transformations), and Synthetic Constellations.

  • Unsupervised Accuracy: On MNIST, the model achieved an impressive 98.7% accuracy without seeing a single label during training. On the much harder SVHN dataset, it reached 55% (and up to 67% with a tiny bit of linear supervision).
  • Robustness: The model outperformed previous unsupervised capsule models on the AFFNIST dataset, proving that its geometric approach helps it generalize to unseen viewpoints.
  • Interpretability: The learned templates clearly resemble the "strokes" of digits or the edges of numbers, demonstrating that the model is successfully decomposing objects into logical components.
Learned Templates

Limitations and Future Work

The primary limitation of the SCAE is its performance on complex natural images like CIFAR-10. The current model tries to explain the entire image as a set of parts. In natural images, complex backgrounds can overwhelm the "object," leading the model to spend its capsules on background noise rather than the primary subject.

To address this, future work could involve:

  • Deeper Hierarchies: Moving beyond just "parts and objects" to modeling "parts of parts of objects."
  • Dynamic Templates: Instead of fixed templates, using templates that can slightly deform to better match the input.
  • Background Modeling: Adding a specific "background" component to the mixture model so the capsules can focus solely on foreground objects.

Summary updated

BibTeX
@inproceedings{kosiorek2019stacked,
  author = {Adam R. Kosiorek and Sara Sabour and Yee Whye Teh and Geoffrey E. Hinton},
  title = {{Stacked Capsule Autoencoders}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2019},
}
Figure