Capsule Network

Image classification with capsule network

A Capsule Network (CapsNet) is a type of artificial neural network proposed by Geoffrey Hinton and his team. In a CapsNet, 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 the activity vector is used to represent the probability that the entity exists, and its orientation represents the instantiation parameters. Code

Dynamic routing is a key component of Capsule Networks. It determines the modification of weights in the network. This defines the strategy for assigning weights to the neurons’ connections. A Capsule Network adjusts the weights such that a low-level capsule is strongly associated with high-level capsules that are in its proximity. In the context of dynamic routing, lower capsules send data to the most suitable parent capsule based on dot product. The parent capsule is chosen through an agreement mechanism, utilizing the highest dot product between prediction vectors from lower capsules and the weight matrix.
The dynamic routing algorithm by agreement allows to train the CapsNet. The most important idea is that similarity between input and output is measured as dot product between input and output of a capsule and then routing coefficient is updated correspondingly. By allowing the network to iteratively refine the coupling coefficients between capsules based on the agreement of their pose parameters, capsules enable dynamic routing. As a result, CapsNets can better recognize intricate patterns in data, capture complex spatial hierarchies, and improve generalization.
MNIST digit reconstruction with CapsNet
Real-time hand written digit classification with CapsNet
Confusion matrix for CIFAR10 classification with CapsNet
Real-time image classification with CapsNet