Giter Site home page Giter Site logo

sr-capsnet's Introduction

SR-CapsNet

PyTorch implementation for our paper [Self-Routing Capsule Networks] in NeurIPS 2019.

[poster]

Prerequisites

  • Python >= 3.5.2
  • CUDA >= 9.0 supported GPU

Install required packages by:

pip3 install -r requirements.txt

Training

To train a model for CIFAR-10 or SVHN, run:

python3 main.py --dataset=cifar10 --name=resnet_[routing_method] --epochs=350
python3 main.py --dataset=svhn --name=resnet_[routing_method] --epochs=200

routing_method should be one of [avg, max, fc, dynamic_routing, em_routing, self_routing]. This will modify last layers of base model accordingly.

For SmallNORB, run:

python3 main.py --dataset=smallnorb --name=convnet_[routing_method] --epochs=200 --exp=elevation

Here --exp denotes which viewpoint data should be splitted on.

See config.py for more options and their descriptions.

Testing

To test a model, simply run:

python3 main.py --dataset=cifar10 --name=resnet_[routing_method] --is_train=False

You can perform adversarial attacks against a trained model by:

python3 main.py --dataset=cifar10 --name=resnet_[routing_method] --is_train=False --attack=True --attack_type=bim --attack_eps=0.1 --targeted=False

For SmallNORB, you can test against novel viewpoints by:

python3 main.py --dataset=smallnorb --name=convnet_[routing_method] --is_train=False --familiar=False

Citation

@inproceedings{hahn2019,
  title={Self-Routing Capsule Networks},
  author={Hahn, Taeyoung and Pyeon, Myeongjang and Kim, Gunhee},
  booktitle={NeurIPS},
  year={2019}
}

sr-capsnet's People

Contributors

coder3000 avatar mjpyeon avatar

Watchers

 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.