Coder Social home page Coder Social logo

zhiyong-zhou / capsule-networks-pytorch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from manuelsh/capsule-networks-pytorch

0.0 0.0 0.0 49 KB

Reproduction of the model from the paper “Dynamic Routing Between Capsules”.

Jupyter Notebook 100.00%

capsule-networks-pytorch's Introduction

Capsules Network Implementation in PyTorch

Work done with Pau Rué (https://github.com/paurue).

Reproduction of the model from the paper “Dynamic Routing Between Capsules” (https://arxiv.org/abs/1710.09829). This model achieves the best performance in the CapsNet implementations available in GitHub that publishes their results (as of 31 March 2018).

Why another model?

After reviewing a number of implementations of the model, we found several bugs on them. Once these bugs were corrected, we still were not able to arrive close to the performance of the paper. The main reason for that is in the way the optimisation is performed, which is not fully explained in the original paper. The authors employ an exponential decay on the learning rate, with a decay rate of 0.96 which is updated every 2000 steps.

The model results are very sensitive to the correct selection of these parameters. We were able to arrive to 0.28% error rate, which is very close to the performance of the paper (0.25%). We believe that with further tuning a 0.25% error rate is attainable.

Other critical parts that needs to be correctly addressed to make the model work are:

  • There should not be backpropagation through each of the steps of the routing mechanism, only on the last step (use .detach method).
  • The individual capsules of the second layer (PrimaryCaps) should be built with the .view method in the correct way, and for that one needs to set the dimensions in the correct order (in our case we use .permute). Many implementations were reshaping the tensor incorrectly, and hence the resulting capsules were not transversal to the filters, but contained in the filters.

We hope this implementation may be helpful for other researchers.

Other Implementations

(Credit to XifengGuo for compiling the list)

capsule-networks-pytorch's People

Contributors

manuelsh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.