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

Improving the Robustness of Capsule Networks to Image Affine Transformations

Jindong Gu, Volker Tresp

Abstract

Capsule Networks (CapsNets) were introduced to overcome the limitations of Convolutional Neural Networks (CNNs) regarding spatial hierarchies and affine transformations. However, the specific contribution of their hallmark "dynamic routing" mechanism to this robustness has remained unclear. This paper demonstrates that dynamic routing provides negligible benefits for generalization. Instead, the authors propose Aff-CapsNet, an architecture that shares transformation matrices across primary capsules. This simple modification leads to a significant performance breakthrough, increasing accuracy on the AffNIST benchmark from 79% to 93.21% while maintaining computational efficiency.

Introduction

While CNNs excel at image classification, they are notoriously sensitive to affine transformations—such as rotation, scaling, and skewing—unless specifically trained on such variations. Capsule Networks aimed to solve this by representing entities as vectors and using dynamic routing to model part-whole relationships. Despite this promise, original CapsNets exhibit a substantial performance gap when tested on transformed data (AffNIST) after being trained on standard data (MNIST). This research investigates whether the computationally intensive routing process is truly necessary and proposes a more robust architectural alternative.

Methods

The study re-evaluates the standard CapsNet framework through two primary lenses:

1. Deconstructing Dynamic Routing

The authors mathematically analyzed the backpropagation of routing iterations by "unrolling" the process. They found that the gradients flowing through coupling coefficients are nearly zero, suggesting that routing does not significantly influence the learning of transformation matrices. To validate this, they compared a "Dynamic Routing" model against a "No Routing" baseline, where capsule outputs are simply averaged.

2. The Aff-CapsNet Architecture

A key structural flaw in standard CapsNets is the localization of transformation matrices. Each primary capsule uses a unique matrix for its specific spatial location, preventing the network from generalizing a learned transformation to other parts of the image. Aff-CapsNet addresses this by sharing a single transformation matrix across all primary capsules. This provides a global inductive bias, allowing the model to recognize entities regardless of their position or orientation.

Architecture of the proposed Aff-CapsNet showing shared transformation matrices.

Key Insights

  • The Routing Myth: Dynamic routing contributes almost nothing to affine robustness. In experiments across MNIST, FMNIST, SVHN, and CIFAR10, a simple uniform averaging (No Routing) performed comparably to or better than iterative routing.
  • Implicit Agreement: The "agreement" logic intended for routing is likely learned implicitly by the transformation matrices during standard gradient descent, rendering the iterative routing step redundant.
  • Global vs. Local Inductive Bias: The failure of standard CapsNets on AffNIST is largely due to the "localization trap." By sharing weights, Aff-CapsNet gains the ability to apply learned transformations globally across the visual field.
  • Efficiency: By removing iterative routing and utilizing shared weights, Aff-CapsNet is significantly more efficient than its predecessors.

Key Results

The models were evaluated on several benchmarks, with a focus on the transition from MNIST (training) to AffNIST (testing).

  • AffNIST Breakthrough: Aff-CapsNet achieved a massive leap in accuracy, reaching 93.21% compared to the standard CapsNet's 79%.
  • MNIST Performance: On standard MNIST, the "No-Routing" version achieved 99.54% accuracy, matching the performance of dynamic routing (99.41%).
  • MultiMNIST Success: Even in tasks involving overlapping objects, the "No-Routing" model achieved 95.49% accuracy, slightly outperforming the routing-based version.
Comparison of test accuracy on MNIST and AffNIST for standard CapsNet and Aff-CapsNet.

Conclusion

This work challenges the necessity of dynamic routing for the robustness of Capsule Networks. By identifying that the true bottleneck lies in the localization of transformation matrices, the authors provide a more effective and efficient path forward with Aff-CapsNet. Future research should investigate these findings on larger-scale datasets like ImageNet and explore the utility of routing in domains beyond affine transformations, such as 3D viewpoint changes or complex scene decomposition.

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