• Stars
    star
    162
  • Rank 232,284 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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

More Repositories

1

transferlearning

Transfer learning / domain adaptation / domain generalization / multi-task learning etc. Papers, codes, datasets, applications, tutorials.-迁移学习
Python
13,147
star
2

transferlearning-tutorial

《迁移学习简明手册》LaTex源码
TeX
2,486
star
3

MachineLearning

一些关于机器学习的学习资料与研究介绍
1,927
star
4

activityrecognition

Resources about activity recognition-行为识别资料
MATLAB
878
star
5

tlbook-code

Code for Transfer Learning book--《迁移学习导论》配套代码
Python
243
star
6

Deep-learning-activity-recognition

A tutorial for using deep learning for activity recognition (Pytorch and Tensorflow)
Python
215
star
7

ProbabilityHomework

中国科学院大学(计算所)《概率方法与随机图》课程作业与教材
TeX
55
star
8

EasyEspnet

Making Espnet easier to use
Python
51
star
9

aqistudy

全国122个城市历史空气质量爬取
Python
40
star
10

maml

Python implementation MAML (model-agnostic meta learning)
Python
26
star
11

informationretrieval

信息检索检索器的Java实现
Roff
17
star
12

BUAA-Recommend-Graduate-Test

北航2013年计算机夏令营机试题,2 problems written in C language,2013
C++
9
star
13

graph

Java实现图,邻接矩阵和邻接表两种方式
Java
8
star
14

ActivationMapVisualization

Visualize the activation map using Grad CAM
Jupyter Notebook
7
star
15

kaggle-bikesharing

Python
6
star
16

DataBaseOperation

Java和C#简单的数据库操作类,支持Sql Server和Sqlite及mysql
C#
4
star
17

learning_to_match

Jupyter Notebook
3
star
18

jindongwang

2
star
19

SyntaxAnalysis

syntax analytics
C#
2
star