Learning Color Equivariant Representations

Yulong Yang, Felix O'Mahony, Christine Allen-Blanchette

Introduction

Standard Convolutional Neural Networks (CNNs) are surprisingly fragile when it comes to color variation. While they excel at handling spatial translations—recognizing an object regardless of its position in the frame—a simple shift in hue or lighting can severely degrade their accuracy. This vulnerability is a major hurdle in fields like medical imaging, where tissue samples from different labs often exhibit distinct color casts due to varying sensors or staining protocols.

The conventional workaround is data augmentation: training the network on thousands of color-jittered images. However, this is computationally expensive and does not guarantee that the network learns a fundamentally robust representation of color. A more elegant and mathematically rigorous solution is equivariance. In an equivariant network, if the input color changes in a specific way, the internal feature representations change in a predictable, corresponding manner.

Previous attempts to achieve color equivariance, such as CEConv, tried rotating RGB filters. Unfortunately, rotating a color vector in RGB space often results in "invalid" colors that fall outside the standard 0-255 range. Clipping these values breaks the mathematical symmetry of the group, degrading the network's performance and equivariance guarantees.

A New Approach: HSL and the Lifting Layer

To achieve true color equivariance, researchers have developed a new class of Group Convolutional Neural Networks (GCNNs) that resolve the geometric flaws of prior methods through a two-fold solution:

  1. Switching Color Spaces: Instead of operating in the restrictive RGB space, the model utilizes the HSL (Hue, Saturation, Luminance) color space. In HSL, hue is naturally circular (forming a 2D rotation group), while saturation and luminance can be modeled as translations along a line.
  2. Lifting the Image, Not the Filter: Rather than rotating the network's filters to match different hues, the authors introduce a novel lifting layer. This layer transforms the input image itself into multiple versions (e.g., across different hue shifts) before the first convolution is applied.
Hue equivariance and the lifting layer mechanism

Because HSL transformations are perfectly invertible—unlike the lossy, clipped RGB rotations in CEConv—the mathematical properties of the group remain intact. By modeling hue as a cyclic group and saturation/luminance as discrete translation groups, the network preserves exact color relationships throughout its layers.

Key Insights and Performance

This architectural shift yields significant improvements in both precision and generalization.

Drastic Error Reduction: The "invertibility loophole" was a critical realization. By lifting the input image in HSL space, the transformation becomes perfectly reversible. This approach reduced the equivariance error by more than three orders of magnitude compared to CEConv.

Feature map shifts demonstrating saturation equivariance

Out-of-Distribution (OOD) Generalization: Because the network mathematically "understands" the geometry of color, it does not need to see every possible color variation during training. On a Hue-shift MNIST task, when tested on hues entirely unseen during training, a standard CNN's error jumped to 57%. In contrast, the proposed Hue-equivariant model maintained a stable error rate of around 2%.

Real-World Impact: The researchers evaluated their models across various tasks, including the Camelyon17 medical imaging dataset (human tissue samples from five different hospitals). Here, the saturation-equivariant model achieved a 16.08% error rate, significantly outperforming a standard ResNet50 (28.91%). The models also consistently outperformed baselines on fine-grained classification datasets where color is a primary cue, such as Stanford Cars and Oxford-IIT Pets.

Limitations and Future Work

The primary trade-off for these robust representations is computational cost. GCNNs are more resource-intensive than standard CNNs because they effectively run multiple "versions" of filters (the filter orbit) at each layer. This cost scales linearly with the size of the chosen group (e.g., the number of discrete hue steps).

Additionally, the current framework relies on finite group approximations, discretizing hue, saturation, and luminance into distinct steps. Future research could explore continuous group representations to handle color shifts even more smoothly, eliminating the need for discretization while maintaining strict equivariance.

Summary updated

BibTeX
@inproceedings{yang2025learning,
  author = {Yulong Yang and Felix O'Mahony and Christine Allen-Blanchette},
  title = {{Learning Color Equivariant Representations}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=IXyfbaGlps},
}
Figure