CapsNet — Talks, Press, and Discussion
Press & Blog Coverage
-
Dynamic Routing Between Capsules, NeurIPS proceedings. The NIPS 2017 version of the paper (preprint: arXiv:1710.09829).
-
Sarasra/models: research/capsules, GitHub. TensorFlow code for the capsule model used in the paper.
-
Capsule Networks (CapsNets) – Tutorial, Aurélien Géron, YouTube. A video walkthrough of the architecture and routing.
-
Understanding Hinton’s Capsule Networks. Part 1. Intuition., Max Pechyonkin. The first part of a blog series on the paper.
Q&A (answers from the paper)
Q1: What is a capsule? “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 the vector is the probability that the entity exists, and its orientation encodes the instantiation parameters (Abstract).
Q2: How does routing-by-agreement work? A lower-level capsule predicts each parent’s output with a weight matrix. The coupling coefficients start equal (all logits b_ij are zero) and, at each iteration, the logit for a parent grows by the scalar product of the prediction with the parent’s output, so a capsule sends more of its output to parents that agree with it (Section 2, Procedure 1; Section 4).
Q3: Why is the squashing function needed? It shrinks short vectors to almost zero and long vectors to a length just below 1, so the length can be read as a probability (Section 2, Eq. 1).
Q4: How accurate is it on MNIST? 0.25% ± 0.005 test error with 3 routing iterations and the reconstruction loss, 0.35% with 3 iterations and no reconstruction loss, and 0.39% for the CNN baseline (Section 5, Table 1). The baseline has 35.4M parameters and CapsNet 8.2M (Section 5).
Q5: What does the reconstruction decoder do? During training all digit capsules except the correct one are masked out, and a decoder of 3 fully connected layers reconstructs the image from it. The sum of squared differences is scaled by 0.0005 “so that it does not dominate the margin loss” (Section 4.1). Perturbing single dimensions of a 16D digit capsule by steps of 0.05 in [−0.25, 0.25] changes properties such as scale, thickness, skew and width (Section 5.1, Figure 4).
Q6: Where does it do worse? On CIFAR10 an ensemble of 7 models reached 10.6% error, “about what standard convolutional nets achieved when they were first applied to CIFAR10”. The authors say capsules like “to account for everything in the image”, and CIFAR10 backgrounds are too varied to model in a reasonably sized network (Section 7).
Common Misconceptions
-
“Capsules replace convolutions.” Correction: the first layer of CapsNet is an ordinary convolution with 256 9×9 kernels, and PrimaryCapsules is also convolutional (Section 4).
-
“Routing is learned by backpropagation like attention weights.” Correction: the coupling coefficients are computed by the routing procedure at each forward pass, starting from zero logits; only the weight matrices W_ij are learned by backpropagation (Sections 2 and 4).
-
“CapsNet beat CNNs everywhere.” Correction: on MNIST the paper notes that Wan et al. reach 0.21% with ensembling and data augmentation, against CapsNet’s 0.25% from a 3-layer network (Section 5). On smallNORB it reports 2.7%, on par with the state of the art, but on CIFAR10 10.6%, which it compares with early CNN results (Section 7).
-
“The notebook reproduces the 0.25% MNIST error.” Correction: the notebook’s scaled-down model reached 1.88% test error on 5,000 test images after 5 epochs on 20,000 training images. It is much smaller than the paper’s model and has no CNN baseline.