Need help with CapsNet?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

147 Stars 40 Forks MIT License 56 Commits 1 Opened issues


A PyTorch implementation of CapsNet based on NIPS 2017 paper "Dynamic Routing Between Capsules"

Services available


Need anything else?

Contributors list

# 44,215
56 commits


A PyTorch implementation of CapsNet based on NIPS 2017 paper Dynamic Routing Between Capsules.


  • Anaconda
  • PyTorch
    conda install pytorch torchvision -c soumith
    conda install pytorch torchvision cuda80 -c soumith # install it if you have installed cuda
  • PyTorchNet
    pip install git+[email protected]


git clone
cd CapsNet
python -m visdom.server & python

Visdom now can be accessed by going to
in your browser, or your own host address if specified.


Highest accuracy was 99.57% after 30 epochs. The model may achieve a higher accuracy as shown by the trend of the loss/accuracy graphs below.

The confusion matrix of the digit numbers are showed below.

The reconstructions of the digit numbers are showed at right and the ground truth at left.

Default PyTorch Adam optimizer hyperparameters were used with no learning rate scheduling. Epochs with batch size of 100 takes ~2 minutes on a NVIDIA GTX 1070 GPU.

Other Implementations


Primarily referenced this implementation: PyTorch implementation by @Gram.AI

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.