The benefits of Incorporating Shape Priors in Contrastive Learning

Junru Zhao, Tianqin Li, Tai Sing LeeRe-Align @ ICLR 2024

TL;DR

This paper introduces Shape Prototype Contrastive Learning (S-PCL), a self-supervised learning method that leverages object silhouettes to improve representation learning. By incorporating global shape priors early in training, S-PCL accelerates learning and enhances shape bias in neural networks, leading to more robust object recognition, especially when combined with texture-focused methods in a "coarse-to-fine" approach.

What Problem Does This Paper Address?

Deep neural networks, particularly Convolutional Neural Networks (CNNs), often exhibit a "texture bias," meaning they rely more on surface textures than on the overall shape of an object for recognition. This contrasts with human visual perception, where shape is a primary cue, especially for learning new object categories. While contrastive learning has shown promise in self-supervised representation learning, it often leads to this texture bias and requires extensive training. This paper aims to bridge this gap by investigating how to imbue deep networks with a stronger "shape bias" through self-supervised learning, mimicking how humans leverage global shape information for efficient learning.

Methods

The core contribution is the Shape Prototype Contrastive Learning (S-PCL) framework. Here's how it works:

  • Shape Silhouettes as Input: The method utilizes pre-computed shape silhouettes (object masks) of images. These silhouettes are obtained offline using figure-ground segmentation.
  • Momentum Encoder for Shapes: These shape silhouettes are fed into a momentum encoder, separate from the main encoder processing the original images.
  • Momentum Clustering for Shape Prototypes: The embeddings of these shape silhouettes are then clustered using K-Means with momentum. The centroids of these clusters are termed "shape prototypes." These prototypes act as a "memory mechanism," representing common global shapes learned over time.
  • ShapeProtoNCE Loss: A novel loss function, LShapeProtoNCE, is introduced. This loss encourages the embeddings of original images to align with these learned shape prototypes, effectively guiding the network to prioritize shape information.
  • Hybrid "Coarse-to-Fine" Training (S-PCL+X): Recognizing that shape alone might not be sufficient for fine-grained recognition, the authors propose a hybrid approach. S-PCL is used as a "warm-up" phase for the initial epochs (e.g., 100 epochs), focusing on global shape. Subsequently, the network is fine-tuned using established contrastive learning methods like MoCoV2 or PCL, which focus more on local features and textures. This "shape-to-texture" or "coarse-to-fine" strategy aims to leverage the benefits of both shape and texture cues.

Datasets

The experiments were conducted on three standard datasets:

  • Imagenette: A subset of ImageNet-1K, often used for faster experimentation.
  • ImageNet-100: A subset of ImageNet-1K, containing 100 object categories.
  • STL10: A dataset commonly used for self-supervised learning benchmarks.

Key Insights and Ideas

  • Shape Priors Accelerate Learning: Incorporating global shape information early in the training process significantly speeds up representation learning, particularly in the initial stages, mirroring human infant learning.
  • Shape Prototypes as a "Memory": The learned shape prototypes act as a form of memory, guiding the embedding space towards shape-centric representations.
  • "Coarse-to-Fine" is Key: While shape priors are beneficial for initial learning and shape bias, they can hinder learning detailed features for fine-grained recognition if relied upon exclusively. A hybrid approach that transitions from shape to texture is crucial for achieving high performance.
  • Shape Bias Enhances Robustness: Models trained or warmed-up with S-PCL demonstrate increased robustness to style and texture changes, indicating a stronger reliance on shape for classification.
  • Human-like Learning: The findings suggest that leveraging global shape information in self-supervised learning can bring neural network representations closer to human visual perception.

Key Results

  • Faster Convergence: S-PCL+MoCoV2 and S-PCL+PCL achieved comparable accuracy to MoCoV2 and PCL but with approximately half the training epochs on ImageNet-100.
  • Improved Shape Bias: On style-transferred images (where texture is altered but shape is preserved), S-PCL-based models showed significantly higher top-1 and top-5 accuracies compared to standard MoCoV2 and PCL. For instance, on ImageNet-100, S-PCL+PCL achieved 30.0% top-1 accuracy on style-transferred images versus 26.0% for PCL.
  • Sensitivity Maps: Visualizations using SmoothGrad revealed that S-PCL-trained networks focus more on object contours and boundaries, even during inference when silhouettes are not provided, while MoCoV2 and PCL showed a stronger preference for local textures.
  • Highest Overall Accuracy: After extensive training (400 epochs), the hybrid S-PCL+X approaches achieved the highest accuracies on ImageNet-100.

Limitations and Future Work

  • Plateauing Effect: Pure S-PCL training leads to an early plateau in performance, suggesting that shape alone is insufficient for optimal recognition. The authors propose a hybrid approach to mitigate this.
  • Inference Phase: The shape silhouettes are used during training but not during inference. The paper suggests exploring whether providing figure-ground information during inference could further enhance recognition.
  • Nature of Prototypes: Further investigation into the learned shape prototypes and how they can be utilized more effectively is suggested.
  • Multi-layer Clustering: The current approach clusters shapes at the highest layer. Exploring shape clustering at multiple layers of the network is proposed as a future direction.
  • AMI Drop: The Adjusted Mutual Information (AMI) for S-PCL+PCL was observed to drop with longer training, which the authors identify as a key area for future study to understand the plateauing phenomenon.

Summary updated

BibTeX
@inproceedings{zhao2024benefits,
  author = {Junru Zhao and Tianqin Li and Tai Sing Lee},
  title = {{The benefits of Incorporating Shape Priors in Contrastive Learning}},
  booktitle = {Re-Align @ ICLR},
  year = {2024},
  url = {https://openreview.net/forum?id=9eg3xk9RZU},
}
Figure