NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Unsupervised Pre-Training for Detection Transformers

Zhigang Dai, Bolun Cai, Yugeng Lin, Junying ChenOpenReview 2023

TL;DR

This paper introduces UP-DETR, a novel unsupervised pre-training method for Detection Transformers (DETR). By training DETR to locate randomly cropped image patches without human annotations, UP-DETR significantly improves convergence speed and detection performance, especially on datasets with limited data, and also enables unified fine-tuning for object detection and one-shot detection.

What Problem Does This Paper Address?

The DETR (DEtection TRansformer) architecture has shown great promise for object detection by framing it as a direct set prediction problem, eliminating the need for hand-designed components like anchor boxes and Non-Maximum Suppression (NMS). However, DETR suffers from significant drawbacks: it requires massive datasets and extremely long training schedules to achieve competitive performance, and it performs poorly on smaller datasets like PASCAL VOC. This is largely because DETR's transformer encoder-decoder module is trained from scratch, unlike the pre-trained CNN backbones often used for feature extraction. The paper aims to bridge this gap by proposing an unsupervised pre-training strategy specifically for DETR's transformer components, inspired by the success of pre-trained transformers in Natural Language Processing (NLP).

Methods

The core of UP-DETR is a novel pretext task called random query patch detection. During pre-training:

  • Input: The model receives an image and randomly cropped "query patches" from that same image.
  • Task: The transformer decoder is trained to predict the bounding boxes of these query patches within the original image. This is done without any human-provided labels for the patches themselves.
  • Key Innovations:
    • Frozen CNN Backbone: To balance the inherent trade-off between classification and localization, the authors found it crucial to freeze the pre-trained CNN backbone. This prevents the localization-focused pretext task from negatively impacting the feature extraction capabilities needed for classification.
  • Patch Feature Reconstruction: A reconstruction loss term is introduced to help preserve the discriminative power of the features extracted by the CNN backbone after they pass through the transformer.
  • Multi-Query Patch Detection with Attention Mask: To better mimic the multi-instance nature of real-world object detection datasets, the method supports using multiple query patches. An attention mask is employed in the decoder to control interactions between object queries, ensuring that unrelated queries don't interfere with each other.

After pre-training, the UP-DETR model can be fine-tuned for downstream tasks like object detection and one-shot detection.

Datasets

  • Pre-training: ImageNet (1.28M images) was used for unsupervised pre-training.
  • Fine-tuning:
    • PASCAL VOC (trainval07+12)
    • COCO (train2017)
    • COCO panoptic segmentation annotation

Key Insights and Ideas

  • DETR's Transformer Needs Pre-training: Just like NLP transformers, DETR's transformer encoder-decoder benefits immensely from unsupervised pre-training, especially when dealing with limited downstream data.
  • Localization is Key for DETR Pretext Task: Unlike general visual representation learning (e.g., contrastive learning), DETR's transformer is primarily for spatial localization. Therefore, the pretext task must focus on localization.
  • Freezing the Backbone is Crucial: The success of transformer pre-training in DETR is highly dependent on keeping the CNN backbone frozen. This preserves its feature extraction capabilities and prevents the localization-centric pre-training task from degrading them.
  • Unified Framework: UP-DETR naturally extends to both object detection and one-shot detection by simply altering the input to the transformer decoder, demonstrating its versatility.
  • Faster Convergence is a Major Win: UP-DETR significantly reduces training time, making DETR more practical for real-world applications.

Key Results

  • PASCAL VOC: UP-DETR achieved significantly higher AP scores compared to DETR trained from scratch, with a much faster convergence rate. For example, UP-DETR reached 56.1 AP in 150 epochs, while DETR only reached 54.1 AP after 300 epochs.
  • COCO: Even on the large COCO dataset, UP-DETR consistently outperformed DETR, achieving 43.1 AP with a 300-epoch schedule, which was 1.0 AP better than DETR.
  • One-Shot Detection: UP-DETR demonstrated substantial improvements, boosting performance by +22.8 AP50 on seen classes and +15.8 AP50 on unseen classes compared to DETR. It also outperformed existing state-of-the-art methods.
  • Panoptic Segmentation: UP-DETR also showed improvements in panoptic segmentation, outperforming DETR by +0.4 PQ and +1.4 Apseg.

Limitations and Future Work

  • Attention Mask Effectiveness: While the attention mask helps in the pre-training loss curves, its impact on fine-tuning performance was not noticeable. The authors suggest further investigation into its effectiveness.
  • Integrating CNN Pre-training: The current approach separates CNN and transformer pre-training. The authors suggest exploring unified end-to-end frameworks that integrate both.
  • Expanding Downstream Tasks: The paper proposes applying UP-DETR to more downstream tasks like few-shot object detection and object tracking.
  • Combining with Contrastive Learning: The authors believe combining random query patch detection with contrastive learning could lead to even better visual representations and a more robust pre-training strategy.

Summary updated

BibTeX
@misc{dai2023unsupervised,
  author = {Zhigang Dai and Bolun Cai and Yugeng Lin and Junying Chen},
  title = {{Unsupervised Pre-Training for Detection Transformers}},
  year = {2023},
  url = {https://openreview.net/forum?id=qTAQe3NFzD},
  howpublished = {OpenReview},
}

Loading related content...

Figure