All models

MatrixCapsules_EM

Capsule networks: dynamic-routing CapsNet, EM routing, Efficient-CapsNet and stacked capsule autoencoders.

Image classification · 407 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (191 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
316.5K
Operations
407
Framework
PyTorch
Recurrent
Yes
Published
NeurIPS 2017
Cited by
4,080 (as of 17 October 2026)
Authors
Sara Sabour, Nicholas Frosst, Geoffrey E. Hinton
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m1731
Graph hash
e46309f9d3520a2d80d8c15f035549738accd10ffbc006d42617e3ba33b3307b
Skeleton hash
809e9742a14cec6a8088e9d3cf84adace3a2464816eaca8804a87e9d3b71e674
Architecture hash
38a6c31fc45d639c8e8072e87da033c32958caed8b84c1d10c9df92b4dacd9cc
Diagram SHA-256
9c36ea62e5c585f51f82271775ec8dfebafe85677807ca0fc29b131e48130d26
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

A PyTorch implementation of Matrix Capsules with EM Routing.

About this model's family

A capsule is a group of neurons whose activity vector represents the instantiation parameters of a specific type of entity such as an object or an object part. The length of that activity vector represents the probability that the entity exists, and its orientation represents the instantiation parameters. Active capsules at one level make predictions, via transformation matrices, for the instantiation parameters of higher-level capsules, and when multiple predictions agree, a higher level capsule becomes active. The models traced here are PyTorch implementations of four capsule designs that grew from this idea.

The original CapsNet uses an iterative routing-by-agreement mechanism: a lower-level capsule prefers to send its output to higher level capsules whose activity vectors have a big scalar product with the prediction coming from the lower-level capsule. Its paper reports that a discriminatively trained, multi-layer capsule system achieves state-of-the-art performance on MNIST and is considerably better than a convolutional net at recognizing highly overlapping digits. The PyTorch port traced here departs from the paper by using MSE as the reconstruction loss. The Matrix Capsules with EM Routing member follows the paper of that name, and its README notes that the paper does not mention the specific scheduler for the inverse temperature, which the port fixes at 0.001.

Efficient-CapsNet pushes capsule capacity to the limits with an extreme architecture with barely 160K parameters, reporting state-of-the-art results on three different datasets with only 2% of the original CapsNet parameters. It replaces dynamic routing with a novel non-iterative, highly parallelizable routing algorithm. Its PyTorch implementation is based on the authors' original TensorFlow code and has been tested to match it numerically. Stacked Capsule Autoencoders take capsules unsupervised: in the first stage the model predicts presences and poses of part templates directly from the image and tries to reconstruct the image by arranging the templates. In the second stage it predicts parameters of a few object capsules, which are then used to reconstruct part poses. Object capsule presences turn out to be highly informative of the object class, which leads to state-of-the-art results for unsupervised classification on SVHN (55%) and MNIST (98.7%). The torch-scae port keeps the architecture of the model and the hyper-parameters the same as the official TensorFlow implementation.

Key idea. Capsules replace scalar feature detectors with activity vectors whose length gives the probability an entity exists and whose orientation gives its pose, routed between levels by agreement.

  • CapsNet
  • capsule network
  • capsules
  • dynamic routing
  • routing by agreement
  • Matrix Capsules
  • EM routing
  • Efficient-CapsNet
  • Stacked Capsule Autoencoders
  • SCAE
  • Hinton
  • Sabour
  • MNIST
  • smallNORB

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{sabour2017dynamicroutingcapsules,
      title={Dynamic Routing Between Capsules}, 
      author={Sara Sabour and Nicholas Frosst and Geoffrey E Hinton},
      year={2017},
      eprint={1710.09829},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/1710.09829}, 
}