an extremyly each-to-follow pytorch implement of Hinton's capsule network.
It is hard to believe that if you search "capsule+pytorch" in github, the top three repos all contain serious mistakes (see their corresponding issues pages).
The mistakes include:
- wrong softmax dimention for the calculation of c_ij in Eq.3 of the original paper.
- wrong margin loss function.
- wrong dimention to which the squash function is applied.
Once these mistakes are corrected, their models cannot learn at all. I guess there are some other mistakes.
Besides, most of the pytorch-implemented capsule network are based on pytorch 0.3 and are a bit of outdated.
python3 train.py
-
The best tutorials of capsule network (which, of course, is not the original paper): Understanding Hinton’s Capsule Networks
-
The only bug-free pytorch implementation I found: capsule-netwprks-pytorch.
-
A well-structured implemention: pytorch-capsule.