NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Improving the Robustness of Capsule Networks to Image Affine Transformations

Jindong Gu, Volker Tresp

Abstract

This paper challenges the long-held belief that "dynamic routing" is the key to the robustness of Capsule Networks (CapsNets). The authors demonstrate that routing contributes little to generalization; instead, they achieve state-of-the-art results on affine-transformed images by removing routing entirely and implementing a simple weight-sharing strategy across primary capsules. This approach, termed Affine Capsule Networks (Aff-CapsNets), achieves 93.21% accuracy on the AffNIST benchmark, significantly outperforming standard CapsNets and CNN baselines.

Introduction

Convolutional Neural Networks (CNNs) are the workhorses of computer vision, but they struggle to recognize objects subjected to affine transformations (rotation, scaling, or skewing) unless trained on massive augmented datasets. This is largely due to pooling layers that discard precise spatial relationships. Capsule Networks were introduced to solve this by representing entities as vectors and using a "dynamic routing" algorithm to model part-whole relationships. However, even standard CapsNets show a massive performance gap when moving from standard datasets (like MNIST) to transformed ones (like AffNIST). This research investigates the source of this gap and the actual utility of iterative routing.

Methods

The authors take a two-pronged approach to improve CapsNet robustness:

  1. Deconstructing Routing: By mathematically "unrolling" the backpropagation of the iterative routing process, the authors prove that the gradients flowing through the routing coefficients are negligible. Comparisons between "Dynamic Routing" and a "No Routing" baseline confirmed that routing is not essential for performance.
  2. Identifying the Bottleneck: In standard CapsNets, each primary capsule has its own unique transformation matrix ($W_{ij}$). Because each capsule only "sees" a specific receptive field, its matrix only learns to handle objects in that specific spot. If an object moves, the local matrix fails.
  3. Aff-CapsNets: To fix this, the authors propose sharing the same transformation matrix across all primary capsules. This allows the network to apply a learned transformation globally, regardless of where an entity appears in the input.
Architecture of the proposed Capsule Network showing the transformation matrices $W_{ij}$ and $W_{kj}$.

Key Results

The results on the AffNIST benchmark (trained on MNIST, tested on AffNIST) are striking. While a CNN baseline achieves ~66% accuracy and a standard CapsNet achieves ~79%, the Aff-CapsNet (No Routing) reaches 93.21% accuracy.

Accuracy comparison on MNIST and AffNIST datasets across different training epochs.

Remarkably, Aff-CapsNet achieves this superior performance while being more computationally efficient by removing iterative routing loops and reducing parameter count. Furthermore, the model maintains the ability to reconstruct disentangled features (like thickness and skew) and recognize overlapping digits in MultiMNIST.

Conclusion

This work demonstrates that the "agreement" routing is supposed to find can be learned implicitly within transformation matrices. The primary obstacle to affine robustness in CapsNets is not the lack of routing, but the lack of transformation invariance in primary capsules. By implementing weight sharing, Aff-CapsNets provide a significant boost to robustness. Future work should explore these architectures on larger, more complex datasets like ImageNet.

Summary updated

BibTeX
@inproceedings{gu2020improving,
  author = {Jindong Gu and Volker Tresp},
  title = {{Improving the Robustness of Capsule Networks to Image Affine Transformations}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2020},
  doi = {10.1109/cvpr42600.2020.00731},
}
Figure