Official Implementation of "DeepCaps: Going Deeper with Capsule Networks" paper, will be presented at CVPR 2019.
This code provides deep capsule neural networks (DeepCaps) implemented in Keras with Tensorflow backend. The code supports training the model in multiple GPUs.
The current test error on CIFAR10 = 7.26%
.
conda install -c anaconda tensorflow-gpu=1.13.1
conda install -c anaconda keras-gpu
conda install -c anaconda scipy=1.2*
conda install -c conda-forge matplotlib
conda install -c conda-forge pillow
git clone https://github.com/brjathu/deepcaps.git
cd deepcaps
CIFAR10
CIFAR100
SVHN
F-MNIST
MNIST
tiny-imagenet
If you are training on multiple GPUs change the numGPU
parameter in args
class in train.py
file.
CUDA_VISIBLE_DEVICES=0,1,2,3 python train.py
If you are training on single GPU change the numGPU
parameter in args
class in train.py
file to 1.
CUDA_VISIBLE_DEVICES=0 python train.py or python train.py
To test with several other datasets commnet out the required dataset in the train.py
file.
Dataset | Test error |
---|---|
CIFAR10 | 7.26% |
SVHN | 2.44% |
MNIST | 0.28% |
FMNIST | 5.27% |
Download this CIFAR10 - pretrained models and extract the files inside model directory. Then run ensemble.py
file.
python ensemble.py
We have used this as the base CapsNet implementation. We thank and credit the contributors of this repository.
Jathushan Rajasegaran - [email protected]
Discussions, suggestions and questions are welcome!
[1] J. Rajasegaran, V. Jayasundara, S.Jeyasekara, N. Jeyasekara, S. Seneviratne, R. Rodrigo. "DeepCaps : Going Deeper with Capsule Networks." Conference on Computer Vision and Pattern Recognition. 2019. [arxiv]
If you found this code useful in your research, please consider citing
@InProceedings{Rajasegaran_2019_CVPR,
author = {Rajasegaran, Jathushan and Jayasundara, Vinoj and Jayasekara, Sandaru and Jayasekara, Hirunima and Seneviratne, Suranga and Rodrigo, Ranga},
title = {DeepCaps: Going Deeper With Capsule Networks},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2019}
}