Deep Diffeomorphic Transformer Networks

Oren Freifeld, Søren Hauberg, Nicki Skafte DetlefsenCVPR 2018

Abstract

Spatial Transformer layers allow neural networks, at least in principle, to be invariant to large spatial transformations in image data. The model has, however, seen limited uptake as most practical implementations support only transformations that are too restricted, e.g. affine or homographic maps, and/or destructive maps, such as thin plate splines. We investigate the use of flexible diffeomorphic image transformations within such networks and demonstrate that significant performance gains can be attained over currently-used models. The learned transformations are found to be both simple and intuitive, thereby providing insights into individual problem domains. With the proposed framework, a standard convolutional neural network matches state-of-the-art results on face verification with only two extra lines of simple TensorFlow code.

Introduction

Convolutional Neural Networks (CNNs) have revolutionized computer vision, yet they remain surprisingly sensitive to spatial variations such as large rotations, scaling, or non-rigid warping. While pooling layers provide a degree of local translation invariance, they fail to account for more complex geometric distortions. The Spatial Transformer (ST) layer was proposed to address this by explicitly warping input data into a canonical pose before further processing. However, standard ST implementations often rely on restrictive affine transforms or potentially destructive thin-plate splines (TPS), which can lead to information loss or training instability.

The Spatial Transformer Framework

The core of the proposed approach is an enhanced Spatial Transformer architecture. An ST layer consists of three components: a localization network that predicts transformation parameters $\theta$, a grid generator that creates a sampling grid based on $\theta$, and a sampler that produces the output feature map.

Architecture of a Spatial Transformer (ST) layer, showing the localization network, grid generator, and sampler.

The authors identify a critical flaw in existing ST layers: non-invertible transformations. When a transformation is not guaranteed to be a diffeomorphism (a differentiable, invertible map), the network can learn "destructive" warps that collapse the image into a single point or line, effectively destroying gradients and halting training.

Diffeomorphic Transformations with CPAB

To overcome these limitations, this work introduces Continuous Piecewise-Affine (CPAB) transformations into the ST framework. CPAB transformations are generated by integrating velocity fields defined over a simplicial tessellation. This mathematical formulation ensures that the resulting warps are diffeomorphic.

Key advantages of CPAB include:

  1. Invertibility: The map is always invertible, preventing the "image collapse" seen in affine or TPS models.
  2. Flexibility: It can represent highly local, non-rigid deformations that affine maps cannot.
  3. Efficiency: The authors provide a high-performance CUDA implementation, making the forward pass significantly faster than naive integration methods.

Results and the "Squarification" Strategy

The model was evaluated on several benchmarks, most notably the Labeled Faces in the Wild (LFW) dataset. By stacking an affine layer (for coarse alignment) with a CPAB layer (for fine warping), a standard CNN achieved 95.43% accuracy on LFW, matching state-of-the-art systems that often rely on much more complex 3D modeling or massive external datasets.

A fascinating qualitative insight emerged from the learned transformations: the network consistently learned to "squarify" faces.

Learned transformations on face images. The network learns to 'squarify' faces, aligning features into a consistent geometry for the CNN.

As shown in the figure above, the CPAB layer stretches oval-shaped faces into a more rectangular geometry. This process removes irrelevant background information and aligns facial features (eyes, nose, mouth) into a fixed spatial arrangement, significantly simplifying the classification task for the subsequent convolutional layers.

Stability and Robustness

Beyond accuracy, the diffeomorphic approach offers superior training stability. Experiments on distorted MNIST and CelebA showed that CPAB-based STNs are far less sensitive to the choice of learning rate compared to affine or TPS-based models. Because the transformation is guaranteed to be invertible, the network cannot easily fall into degenerate states where the input is warped into oblivion.

Conclusion

Deep Diffeomorphic Transformer Networks provide a robust and expressive way to handle spatial variance in deep learning. By ensuring transformations are diffeomorphic, the authors solve the stability issues plaguing previous ST implementations while unlocking new levels of performance in tasks like face verification. The "squarification" strategy demonstrates that these layers do not just improve metrics but also learn intuitive, domain-specific geometric priors.

Summary updated

BibTeX
@inproceedings{freifeld2018deep,
  author = {Oren Freifeld and Søren Hauberg and Nicki Skafte Detlefsen},
  title = {{Deep Diffeomorphic Transformer Networks}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2018},
  url = {https://openreview.net/forum?id=M1W5Fzio5I},
}
Figure