• Stars
    star
    165
  • Rank 227,612 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 6 years ago

Reviews

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

Repository Details

PyTorch implementation of the paper Dynamic Routing Between Capsules by Sara Sabour, Nicholas Frosst and Geoffrey Hinton

Capsule Network

License

PyTorch implementation of the following paper:

Official implemenation

Visual represenation

capsules_visual_representation

Image source: Mike Ross, A Visual Representation of Capsule Network Computations

Run the experiment

  • For details, run python main.py --help

Example of reconstructed vs. original images

reconstructed


Requirements:

Default hyper-parameters (similar to the paper):

  • Per-GPU batch_size = 128
  • Initial learning_rate = 0.001
  • Exponential lr_decay = 0.96
  • Number of routing iteration (num_routing) = 3

Loss function hyper-parameters (see loss.py):

  • Lambda for Margin Loss = 0.5
  • Scaling factor for reconstruction loss = 0.0005

GPU Speed benchmarks:

(with above mentioned hyper-parameters)

  • Single GeForce GTX 1080Ti - 35.6s per epoch
  • Two GeForce GTX 1080Ti - 35.8s per epoch (twice the batch size -> half the iteration)