All Projects → hli2020 → Nn_encapsulation

hli2020 / Nn_encapsulation

Capsule research with our trivial contribution

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Nn encapsulation

Artificial Intelligence Deep Learning Machine Learning Tutorials
A comprehensive list of Deep Learning / Artificial Intelligence and Machine Learning tutorials - rapidly expanding into areas of AI/Deep Learning / Machine Vision / NLP and industry specific areas such as Climate / Energy, Automotives, Retail, Pharma, Medicine, Healthcare, Policy, Ethics and more.
Stars: ✭ 2,966 (+5496.23%)
Mutual labels:  capsule-network
EasyRec
A framework for large scale recommendation algorithms.
Stars: ✭ 599 (+1030.19%)
Mutual labels:  capsule-network
Capsnet Tensorflow
A Tensorflow implementation of CapsNet(Capsules Net) in paper Dynamic Routing Between Capsules
Stars: ✭ 3,776 (+7024.53%)
Mutual labels:  capsule-network
Subject-and-Sentiment-Analysis
汽车行业用户观点主题及情感识别
Stars: ✭ 24 (-54.72%)
Mutual labels:  capsule-network
capsules-tensorflow
Another implementation of Hinton's capsule networks in tensorflow.
Stars: ✭ 18 (-66.04%)
Mutual labels:  capsule-network
Hands On Deep Learning Algorithms With Python
Master Deep Learning Algorithms with Extensive Math by Implementing them using TensorFlow
Stars: ✭ 272 (+413.21%)
Mutual labels:  capsule-network
Adv attack capsnet
Tensorflow Implementation of Adversarial Attack to Capsule Networks
Stars: ✭ 169 (+218.87%)
Mutual labels:  capsule-network
Capsgnn
A PyTorch implementation of "Capsule Graph Neural Network" (ICLR 2019).
Stars: ✭ 1,008 (+1801.89%)
Mutual labels:  capsule-network
heinsen routing
Official implementation of "An Algorithm for Routing Capsules in All Domains" (Heinsen, 2019) in PyTorch.
Stars: ✭ 41 (-22.64%)
Mutual labels:  capsule-network
Capsnet Visualization
🎆 A visualization of the CapsNet layers to better understand how it works
Stars: ✭ 371 (+600%)
Mutual labels:  capsule-network
CapsNet
Empirical studies on Capsule Network representation and improvements implemented with PyTorch.
Stars: ✭ 39 (-26.42%)
Mutual labels:  capsule-network
me recognition
CapsuleNet for Micro-expression Recognition (IEEE FG 2019)
Stars: ✭ 56 (+5.66%)
Mutual labels:  capsule-network
Capsule net pytorch
Readable implementation of a Capsule Network as described in "Dynamic Routing Between Capsules" [Hinton et. al.]
Stars: ✭ 301 (+467.92%)
Mutual labels:  capsule-network
LightCapsNet
A Matlab implementation of the capsule networks (or capsnet).
Stars: ✭ 47 (-11.32%)
Mutual labels:  capsule-network
Capsule Network Tutorial
Pytorch easy-to-follow Capsule Network tutorial
Stars: ✭ 722 (+1262.26%)
Mutual labels:  capsule-network
Capsnet Keras
A Keras implementation of CapsNet in NIPS2017 paper "Dynamic Routing Between Capsules". Now test error = 0.34%.
Stars: ✭ 2,428 (+4481.13%)
Mutual labels:  capsule-network
Hands-On-Deep-Learning-Algorithms-with-Python
Hands-On Deep Learning Algorithms with Python, By Packt
Stars: ✭ 76 (+43.4%)
Mutual labels:  capsule-network
Lung Diseases Classifier
Diseases Detection from NIH Chest X-ray data
Stars: ✭ 52 (-1.89%)
Mutual labels:  capsule-network
Awesome Capsule Networks
A curated list of awesome resources related to capsule networks
Stars: ✭ 896 (+1590.57%)
Mutual labels:  capsule-network
Capslayer
CapsLayer: An advanced library for capsule theory
Stars: ✭ 351 (+562.26%)
Mutual labels:  capsule-network

Neural Network Encapsulation

Hongyang Li, Xiaoyang Guo, Bo Dai, et al.

The official implementation in Pytorch, paper published in ECCV 2018.

capsule

Overview

  • PyTorch 0.3.x or 0.4.x; Linux; Python 3.x
    • I haven't tested on MacOS or Python 2.x, but it won't be a big problem; have a try!
  • Provide our own implementation of the original papers, namely dynamic and EM routing.
  • Datasets: MNIST, CIFAR-10/100, SVHN and a subset of ImageNet.

On a research side:

  • Analyze the two routing schemes (Dynamic and EM) in original capsule papers.
  • Propose an approximation routing workaround to tackle the computational inefficiency, in a supervised manner. Network elements are still in form of capsules (vector other than scalar).
  • That is why we call the network is encapsulated.
  • Adopt the optimal transport algorithm to make higher and lower capsules align better.

Grab and Go

The easiest way to run the code in the terminal, after cloning/downloading this repo is:

python main.py

If you are more ambitious to play with the parameters and/or assign the experiment to specific GPUs:

# gpu_id index
CUDA_VISIBLE_DEVICES=0,2 \
    python main.py \
        --device_id=0,2 \
        --experiment_name=encapnet_default \
        --dataset=cifar10 \
        --net_config=encapnet_set_OT \
        # other arguments here ...

For a full list of arguments, see option/option.py file. Note how we launch the multi-gpu mode above (pass index 0,2 to both environment variables and arguments).

A Deeper Look

File Structure

This project is organized in the most common manner:

| main.py
|       |
|       layers/train_val.py
|               |
|               layers/network.py               # forward flow control
|                       |
|                       -->  model define in net_config.py
|                       -->  cap_layer.py       # capsule layer submodules; core part
|                       -->  OT_module.py       # optimal transport unit; core part
|       data/create_dset.py
|       option/option.py
|       utils

Datasets will be automatically downloaded and put under data folder. Output files (log, model) reside in the --base_save_folder (default is result).

Adapting our work to your own task

  • To add more structures or change components:

    • write parallel network design in the if-else statement starting from this net_config.py file.
  • To add one encapsulated layer with (or not) OT unit in your own network:

    • see code block here in the net_config.py for layer definition and the forward flow here in the network.py.

Features to come

  • [x] Code release for original capsule papers
  • [x] Support PyTorch 0.4.x
  • [ ] Supoort visdom. Use visdom to visualize training dynamics.
  • [ ] h-ImageNet dataset and result
  • [ ] Better documentation and performance results

Citation

Please cite in the following manner if you find it useful in your research:

@inproceedings{li2018encapsulation,
  author = {Hongyang Li and Xiaoyang Guo and Bo Dai and Wanli Ouyang and Xiaogang Wang},
  title = {Neural Network Encapsulation},
  booktitle = {ECCV},
  year = {2018}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].