Coder Social home page Coder Social logo

capsnet-keras's Introduction

CapsNet-Keras

A Keras implementation of CapsNet in Hinton's paper Dynamic Routing Between Capsules

Requirements

Usage

Training

Step 1. Install Keras:

$ pip install keras

Step 2. Clone this repository with git.

$ git clone https://github.com/xifengguo/CapsNet-Keras.git
$ cd CapsNet-Keras

Step 3. Training:

$ python CapsNet.py

Training without reconstruction network by setting lam_recon=0.

$ python CapsNet.py --lam_recon 0.

Results

Accuracy with data augmentation (shift at most 2 pixels in each direction):
The code is ready, I'm running it to get results. Feel free to run on your own computer.

Waiting for the results

Accuracy during training with reconstruction coefficient lam_recon=0.0005:

Epoch 1 2 3 4 5 6 7 8 9 10 11
train_acc 94.8 98.9 99.3 99.4 99.6 99.7 99.8 99.8 99.9 99.9 99.95
vali_acc 98.7 99.0 99.2 99.2 99.39 99.30 99.38 99.35 99.46 99.38 99.45

Accuracy during training without reconstruction:

Epoch 1 2 3 4 5 6 7 8 9 10 11
train_acc 94.4 98.9 99.2 99.5 99.6 99.7 99.8 99.9 99.9 99.9 99.95
vali_acc 98.5 99.1 99.2 99.3 99.36 99.36 99.43 99.34 99.42 99.41 99.44

Every epoch consumes more than 300s on a single GTX 1070 GPU.
Maybe there're some problems in my implementation. Contributions are welcome.

TODO:

  • Optimize the code implementation and comments. The paper says the CapsNet has 11M parameters, but my model only has 8M. There may be something wrong.

Other Implementations

capsnet-keras's People

Watchers

 avatar  avatar  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.