Object Localization and Motion Transfer learning with Capsules

Weitang Liu, Emad Barsoum, John D. Owens

Abstract

Inspired by CapsNet's routing-by-agreement mechanism with its ability to learn object properties, we explore if those properties in turn can determine new properties of the objects, such as the locations. We then propose a CapsNet architecture with object coordinate atoms and a modified routing-by-agreement algorithm with unevenly distributed initial routing probabilities. The model is based on CapsNet but uses a routing algorithm to find the objects' approximate positions in the image coordinate system. We also discussed how to derive the property of translation through coordinate atoms and we show the importance of sparse representation. We train our model on the single moving MNIST dataset with class labels. Our model can learn and derive the coordinates of the digits better than its convolution counterpart that lacks a routing-by-agreement algorithm, and can also perform well when testing on the multi-digit moving MNIST and KTH datasets. The results show our method reaches the state-of-art performance on object localization without any extra localization techniques and modules as in prior work.

Introduction

Object localization—the task of identifying where an object resides within an image—typically requires extensive supervision via manually annotated bounding boxes. Weakly Supervised Object Localization (WSOL) seeks to achieve this using only image-level class labels. While traditional WSOL methods rely on Convolutional Neural Networks (CNNs) and activation mapping (e.g., Grad-CAM), these approaches are often limited by the lack of explicit part-whole hierarchies in CNN architectures.

Capsule Networks (CapsNets) offer a promising alternative by modeling the relationships between object parts and the whole. This paper investigates how to extract precise spatial coordinates from capsule vector representations to perform effective localization without explicit spatial supervision.

Methodology

The proposed architecture introduces two significant modifications to the standard CapsNet framework to enable precise localization.

Coordinate Atoms and Routing-by-Agreement

To capture spatial information, the researchers explicitly concatenate two "coordinate atoms" to each capsule, representing the $[x, y]$ coordinates of the receptive field center. These coordinates are propagated through the routing-by-agreement process. The final object position is derived as a weighted average of these coordinates, where the weights are determined by the coupling coefficients—the strength of agreement between lower and higher-level capsules.

The proposed CapsNet encoder architecture featuring coordinate atom concatenation.

Sparse Routing via Bias Initialization

A critical challenge in standard CapsNets is that initial routing probabilities are uniformly distributed, which can lead to spatial information being "washed out" as noise is averaged. To enforce sparsity, a bias routing probability initializer is introduced. By initially biasing the network toward an "unknown" class, the model is forced to be selective, assigning high probabilities only to the capsules that truly represent the object. This sparsity is essential for accurate localization.

Spatial Reconstruction

The standard fully-connected layers used for reconstruction in original CapsNets are replaced with convolution-transpose (deconvolution) layers. This modification ensures that spatial information is preserved throughout the generative process.

The decoder architecture utilizing convolution-transpose layers for spatial reconstruction.

Results and Insights

The model was evaluated on dynamic datasets, including Moving MNIST (1, 2, and 3 digits), Moving Fashion MNIST, and the KTH human action dataset.

Localization Performance

The "CapsNet with bias initial" significantly outperformed benchmark models. On a 3-digit Moving MNIST test set, the model achieved a Mean Absolute Error (MAE) of 0.078, whereas the best CNN-based Grad-CAM benchmark achieved 0.160. These results demonstrate that the routing mechanism effectively acts as a spatial attention filter, deciding which image regions belong to a specific class.

Disentangled Representations

Manipulation experiments revealed that the network learns a disentangled representation of "what" an object is versus "where" it is. By manually altering the values of the coordinate atoms in a trained model, researchers could "move" the reconstructed digit across the frame. This confirms that the model has learned a fundamental property of translation through its coordinate atoms.

Discussion and Conclusion

While the results are state-of-the-art for weakly supervised localization, several challenges remain. Coordinate atoms can sometimes become entangled with other object properties, such as stroke thickness. Furthermore, the computational overhead of routing-by-agreement may limit real-time applications at high resolutions. Future work will investigate more efficient routing mechanisms, such as sparse entropy or argmax routing, to further enhance spatial sparsity and performance.

Summary updated

Abstract

Inspired by CapsNet's routing-by-agreement mechanism with its ability to learn object properties, we explore if those properties in turn can determine new properties of the objects, such as the locations. We then propose a CapsNet architecture with object coordinate atoms and a modified routing-by-agreement algorithm with unevenly distributed initial routing probabilities. The model is based on CapsNet but uses a routing algorithm to find the objects' approximate positions in the image coordinate system. We also discussed how to derive the property of translation through coordinate atoms and we show the importance of sparse representation. We train our model on the single moving MNIST dataset with class labels. Our model can learn and derive the coordinates of the digits better than its convolution counterpart that lacks a routing-by-agreement algorithm, and can also perform well when testing on the multi-digit moving MNIST and KTH datasets. The results show our method reaches the state-of-art performance on object localization without any extra localization techniques and modules as in prior work.
BibTeX
@misc{liu2018object,
  author = {Weitang Liu and Emad Barsoum and John D. Owens},
  title = {{Object Localization and Motion Transfer learning with Capsules}},
  year = {2018},
  eprint = {1805.07706},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1805.07706},
}
Figure