
EfficientCapsNet
Image classification62 ops1.6M params
Capsule networks: dynamic-routing CapsNet, EM routing, Efficient-CapsNet and stacked capsule autoencoders.
Image classification · 407 operations Checked
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.
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
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.
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
@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},
}