CoDo: Contrastive Learning with Downstream Background Invariance for Detection

Bing Zhao, Jun Li, Hong ZhuWorkshops @ CVPR 2022 · DOI

Introduction

Self-supervised learning (SSL) has achieved remarkable success in image classification, with models like MoCo and SimCLR approaching supervised performance levels on benchmarks like ImageNet. However, a significant "performance inconsistency" persists: improvements in classification accuracy do not always translate to gains in object detection performance on datasets like MSCOCO. This gap stems from two primary issues: a mismatch between classification-centric pretext tasks and the spatial requirements of detection, and the lack of architectural alignment, where only the backbone is pretrained while critical components like Feature Pyramid Networks (FPN) remain poorly initialized.

Methodology: The CoDo Framework

To address these challenges, we propose CoDo (Contrastive learning with Downstream background invariance). CoDo introduces three core innovations designed to align pretraining more closely with the requirements of downstream detection tasks.

Overview of the CoDo framework, illustrating the CPJ augmentation, structural alignment, and hierarchical contrastive learning.

1. Copy, Paste, and Jitter (CPJ)

To instill "background invariance," CoDo utilizes Selective Search to extract object proposals from ImageNet. These objects are then pasted onto unlabeled background images from the target downstream task (e.g., MSCOCO or VOC). By jittering the bounding boxes to include surrounding pixels, the model is forced to distinguish the object from its specific downstream context, enhancing spatial localization.

2. Structural Alignment

Unlike standard SSL which only pretrains the backbone, CoDo pretrains the entire detection pipeline, including the ResNet backbone, the FPN, and the R-CNN head. Utilizing RoIAlign during pretraining ensures that the learned features are directly compatible with the detector's region-based processing.

3. Hierarchical Contrastive Learning

CoDo employs a multi-view contrastive loss (InfoNCE) across multiple levels of the FPN (P2 through P5). This hierarchical approach ensures the model learns robust representations at various scales, which is essential for detecting objects of varying sizes.

Key Results

CoDo demonstrates state-of-the-art transfer learning performance on MSCOCO for both object detection and instance segmentation.

Comparison of CoDo against state-of-the-art self-supervised methods on MSCOCO detection and segmentation tasks.

As shown in the comparative results, CoDo achieves 41.2 AP on MSCOCO with a 1x schedule, significantly outperforming MoCo v2 (40.4 AP) and SimCLR (39.6 AP). With extended pretraining (400 epochs), CoDo reaches 41.9 AP, and a multi-view variant (CoDo_m) further pushes performance to 43.1 AP. Ablation studies highlight the importance of background diversity; incorporating a mix of ImageNet, COCO, and VOC backgrounds yielded a +0.5 AP improvement over using ImageNet backgrounds alone, proving that pre-exposure to downstream visual textures is a critical factor in performance.

Conclusion

CoDo effectively bridges the gap between self-supervised pretraining and downstream detection by leveraging downstream background invariance and structural alignment. By teaching models to "see" like detectors during the pretraining phase, CoDo sets a new standard for self-supervised transfer learning in computer vision.

Summary updated

BibTeX
@inproceedings{zhao2022codo,
  author = {Bing Zhao and Jun Li and Hong Zhu},
  title = {{CoDo: Contrastive Learning with Downstream Background Invariance for Detection}},
  booktitle = {Workshops @ CVPR},
  year = {2022},
  doi = {10.1109/cvprw56347.2022.00464},
}
Figure