All models

CapsNet

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

Image classification · 82 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 (35 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
8.2M
Operations
82
Framework
PyTorch
Recurrent
No
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
m322
Graph hash
3e1cf90bbc72b6f19ac6baf2efb29a98b8e45b1078049e6c1ed589b46db65f5c
Skeleton hash
fcbb56df9295aef6be0a946e9e46f24b22b26e5dd0501d2ac43802f7f0f71250
Architecture hash
6af9ee423016063326c12950b37b76755702822455ce63cfcb50c9b5ae19d6fb
Diagram SHA-256
a3b26a6ebf7b38f5c1ee2096bd2310760178bf49b8fc80b31f2e1f8d1ae4d8fd
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

The original CapsNet with iterative routing-by-agreement, where a lower-level capsule prefers to send its output to higher level capsules whose activity vectors agree with its prediction.

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}, 
}