GithubHelp home page GithubHelp logo

hunterhawk / pytorch-capsulenet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jindongwang/pytorch-capsulenet

0.0 1.0 0.0 51 KB

An easy-to-follow Pytorch implementation of Hinton's Capsule Network

License: MIT License

Python 100.00%

pytorch-capsulenet's Introduction

Pytorch-CapsuleNet

A flexible and easy-to-follow Pytorch implementation of Hinton's Capsule Network.

There are already many repos containing the code for CapsNet. However, most of them are too tight to customize. And as we all know, Hinton's original paper is only tested on MNIST datasets. We clearly want to do more.

This repo is designed to hold other datasets and configurations. And the most important thing is, we want to make the code flexible. Then, we can tailor the network according to our needs.

Currently, the code supports both MNIST and CIFAR-10 datasets.

Requirements

  • Python 3.x
  • Pytorch 0.3.0 or above
  • Numpy
  • tqdm (to make display better, of course you can replace it with 'print')

Run

Just run Python test_capsnet.py in your terminal. That's all. If you want to change the dataset (MNIST or CIFAR-10), you can easily set the dataset variable.

It is better to run the code on a server with GPUs. Capsule network demands good computing devices. For instance, on my device (Nvidia K80), it will take about 5 minutes for one epoch of the MNIST datasets (batch size = 100).

More details

There are 3 .py files:

  • capsnet.py: the main class for capsule network
  • data_loader.py: the class to hold many classes
  • test_capsnet.py: the training and testing code

The results on your device may look like the following picture:

Acknowledgements

pytorch-capsulenet's People

Contributors

jindongwang avatar

Watchers

James Cloos 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.