A Keras implementation of CapsNet in the paper:
Sara Sabour, Nicholas Frosst, Geoffrey E Hinton. Dynamic Routing Between Capsules. NIPS 2017
Differences with the paper:
- We use the learning rate decay with
decay factor = 0.9
andstep = 1 epoch
,
while the paper did not give the detailed parameters (or they didn't use it?). - We only report the test errors after
50 epochs
training.
In the paper, I suppose they trained for1250 epochs
according to Figure A.1? Sounds crazy, maybe I misunderstood. - We use MSE (mean squared error) as the reconstruction loss and
the coefficient for the loss is
lam_recon=0.0005*784=0.392
.
This should be equivalent with using SSE (sum squared error) andlam_recon=0.0005
as in the paper.
Install Keras>=2.0.7 with TensorFlow>=1.2 backend.**
pip install tensorflow-gpu
pip install keras
-
PyTorch:
-
TensorFlow:
- naturomics/CapsNet-Tensorflow
I referred to some functions in this repository. - InnerPeace-Wu/CapsNet-tensorflow
- chrislybaer/capsules-tensorflow
- naturomics/CapsNet-Tensorflow
-
MXNet:
-
Chainer:
-
Matlab: