In-sample Contrastive Learning and Consistent Attention for Weakly Supervised Object Localization

Minsong Ki, Youngjung Uh, Wonyoung Lee, Hyeran Byun

TL;DR

This paper introduces a novel approach to Weakly Supervised Object Localization (WSOL) that prevents models from "bleeding" into the background. By leveraging in-sample contrastive learning to distinguish foreground from background and a foreground consistency loss to align attention across network layers, the authors achieve state-of-the-art localization accuracy on benchmark datasets like CUB-200-2011 and ImageNet.

What Problem Does This Paper Address?

Weakly Supervised Object Localization (WSOL) is the challenge of finding where an object is in an image using only image-level labels (e.g., "this is a bird") during training, without any bounding box annotations.

The standard tool for this is the Class Activation Map (CAM), which highlights the most "discriminative" parts of an object (like a bird's head). To find the whole object, researchers often use "erasing" techniques that hide these discriminative parts, forcing the model to look elsewhere. However, these methods often backfire by over-estimating the object's size and including too much background. The authors identify a key gap: previous methods treat the background as something to ignore, rather than a valuable cue to define the object's boundaries.

Comparison of activation maps. Previous methods like ADL and SPG often over-estimate the object region, while the proposed method produces tighter, more accurate boundaries.

Methods

The authors propose a multi-pronged strategy to refine object boundaries:

  1. Contrastive Attention Loss ($L_{ca}$): Inspired by self-supervised learning, this loss treats the "dropped foreground" (the object region minus its most discriminative part) as an anchor. It forces the model to make this anchor's features similar to the original foreground and dissimilar to the background. This explicitly teaches the model to separate object features from background features.
  2. Foreground Consistency Loss ($L_{fc}$): Early layers in a CNN often produce noisy attention maps because they focus on local edges and textures. This loss encourages early layers to produce attention maps that resemble the more refined, object-centric maps of later layers, providing them with a "sense of backgroundness."
  3. Non-local Attention Blocks: Instead of simple channel pooling, the model uses non-local blocks to generate attention maps. These blocks consider spatial similarities across the entire feature map, helping the model activate regions that are semantically similar to the most discriminative parts.
  4. Dropped Foreground Mask ($M_{dfg}$): Unlike previous masks that only hide the most active parts, this new mask erases both the most discriminative region and the background. This forces the model to focus specifically on the less-discriminative parts of the object during training.
Overview of the proposed architecture, showing how non-local attention blocks and the two new loss functions are integrated into the training pipeline.

Datasets

The method was evaluated on two standard WSOL benchmarks:

  • CUB-200-2011: A dataset of 200 bird species, known for fine-grained classification and localization challenges.
  • ILSVRC (ImageNet): A massive-scale dataset with 1,000 object categories.

The authors followed the evaluation protocol suggested by Choe et al. (2020), which uses a small "full-supervision" set only for hyperparameter tuning to ensure a fair comparison between weakly supervised methods.

Key Insights and Ideas

  • Background as a Teacher: Instead of just trying to "find the object," the model is actively taught "what is not the object." By contrasting foreground and background features in the latent space, the boundary becomes much sharper.
  • Cross-Layer Alignment: The "Foreground Consistency Loss" acts as a powerful regularizer. It acknowledges that while early layers have a limited receptive field, they can still benefit from the global context captured by deeper layers.
  • In-Sample Contrast: Unlike many contrastive learning methods that require huge batches of different images, this method finds its positive and negative pairs within the same image, making it computationally efficient and highly relevant to the specific spatial layout of that image.
Detailed view of the contrastive attention loss. Features from different masked regions are projected into a latent space where foreground parts are pulled together and pushed away from background features.

Key Results

The proposed method achieved state-of-the-art (SOTA) results across multiple backbones (VGG16, InceptionV3, ResNet50):

  • MaxBoxAccV2: On the CUB-200-2011 dataset using a ResNet50 backbone, the method achieved a mean score of 63.20%, significantly outperforming the baseline ADL (58.34%).
  • ImageNet Localization: It reached a top-1 localization accuracy of 48.4% on ImageNet (ResNet50), surpassing previous methods like CutMix and CAM.
  • Ablation Studies: The authors proved that every component matters. Removing the contrastive loss dropped performance by 2%, while removing the consistency loss dropped it by nearly 0.8%.

Limitations and Future Work

  • Receptive Field Constraints: The authors noted that adding attention blocks to the very earliest layers (pool_1 and pool_2) actually decreased performance. They attribute this to the small receptive fields of these layers, which lead to noisy, overly-local activations that even the consistency loss couldn't fully fix.
  • Hyperparameter Sensitivity: The method relies on two key thresholds ($\theta_{fg}$ and $\theta_{bg}$) to define foreground and background regions. While the authors provide optimal values for common backbones, these might need careful tuning for new architectures.
  • Future Direction: A promising next step would be exploring how to automatically adapt these thresholds during training or applying similar contrastive principles to weakly supervised semantic segmentation.

Summary updated

BibTeX
@inproceedings{ki2020sample,
  author = {Minsong Ki and Youngjung Uh and Wonyoung Lee and Hyeran Byun},
  title = {{In-sample Contrastive Learning and Consistent Attention for Weakly Supervised Object Localization}},
  booktitle = {ACCV},
  year = {2020},
  url = {https://openreview.net/forum?id=-Q5nVKt5Ms1},
}
Figure