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

Minsong Ki, Youngjung Uh, Wonyoung Lee, Hyeran Byun

Introduction

Weakly Supervised Object Localization (WSOL) aims to identify the spatial extent of objects using only image-level category labels. This approach significantly reduces the need for labor-intensive bounding box annotations. However, the standard baseline, Class Activation Mapping (CAM), typically highlights only the most discriminative parts of an object (e.g., the head of a bird) rather than its entire body. While previous attempts to address this—such as adversarial erasing—force the model to explore non-discriminative regions, they often lead to "background bleeding," where the activation maps over-expand into the surrounding environment.

This paper proposes a novel framework that leverages in-sample contrastive learning and foreground consistency to achieve precise localization that covers the full object while strictly adhering to its boundaries.

Methodology

The proposed architecture introduces two primary loss functions and a structural enhancement to refine the attention maps.

1. In-sample Contrastive Attention Loss ($L_{ca}$)

Unlike traditional contrastive learning that requires large batches of different images, this method operates within a single image. It defines three regions: the main foreground, the "dropped" (less discriminative) foreground, and the background. By treating the dropped foreground as an anchor, the loss pulls its representation closer to the main foreground in latent space while pushing it away from background features. This ensures that all parts of the object are represented homogeneously and remain distinct from the background.

2. Foreground Consistency Loss ($L_{fc}$)

Early layers in convolutional neural networks (CNNs) often capture local textures that can lead to noisy activations in the background. To mitigate this, the authors introduce a consistency loss where the cleaner, more global attention map from a later layer acts as a "teacher" for earlier layers. This hierarchical guidance suppresses irrelevant local noise and aligns the model's focus across different depths.

Overview of the proposed framework featuring Foreground Consistency and Contrastive Attention losses.

3. Non-local Attention and Masking

The framework utilizes non-local attention blocks to capture long-range spatial dependencies, allowing the model to "boost" the importance of regions that are visually similar to the object. Additionally, a new Dropped Foreground Mask ($M_{dfg}$) is employed. Unlike standard erasing, this mask hides both the most active pixels and the background, forcing the model to specifically learn the less obvious parts of the object without drifting into the environment.

Experimental Results

The model was evaluated on the CUB-200-2011 and ImageNet (ILSVRC) benchmarks using the MaxBoxAccV2 metric, which provides a robust evaluation across multiple Intersection-over-Union (IoU) thresholds.

Quantitative Performance

The proposed method achieved state-of-the-art results across various backbones:

  • CUB-200-2011: On a ResNet50 backbone, the method reached a MaxBoxAccV2 of 63.20%, a significant improvement over the ADL baseline (58.34%).
  • ImageNet: The model achieved a mean MaxBoxAccV2 of 63.1%, outperforming other competitive methods like CutMix and SPG.

Qualitative Analysis

Visualizations demonstrate that the proposed method produces significantly tighter heatmaps compared to existing techniques. While models like ADL and SPG often include background elements like branches or water, this approach maintains high activation strictly within the object's silhouette.

Qualitative comparison of localization results between the proposed method and existing WSOL techniques (ADL and SPG).

Conclusion

By treating the background as a crucial negative signal and enforcing hierarchical attention consistency, this framework effectively addresses the "background bleeding" problem in WSOL. The "in-sample" nature of the contrastive loss makes it computationally efficient compared to batch-based alternatives. Future work may involve exploring fully self-supervised variants or refining hyperparameter sensitivity for different architectures.

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