Skip to main content
QUICK REVIEW

[Paper Review] Anchor DETR: Query Design for Transformer-Based Object Detection

Ying‐Ming Wang, Xiangyu Zhang|arXiv (Cornell University)|Sep 15, 2021
Advanced Neural Network ApplicationsComputer Science26 citations
TL;DR

Anchor DETR redesigns object queries as anchor-point based queries with multiple prediction patterns per anchor, achieving better accuracy and faster training than DETR, plus a memory-efficient Row-Column Decoupled Attention variant.

ABSTRACT

In this paper, we propose a novel query design for the transformer-based object detection. In previous transformer-based detectors, the object queries are a set of learned embeddings. However, each learned embedding does not have an explicit physical meaning and we cannot explain where it will focus on. It is difficult to optimize as the prediction slot of each object query does not have a specific mode. In other words, each object query will not focus on a specific region. To solved these problems, in our query design, object queries are based on anchor points, which are widely used in CNN-based detectors. So each object query focuses on the objects near the anchor point. Moreover, our query design can predict multiple objects at one position to solve the difficulty: "one region, multiple objects". In addition, we design an attention variant, which can reduce the memory cost while achieving similar or better performance than the standard attention in DETR. Thanks to the query design and the attention variant, the proposed detector that we called Anchor DETR, can achieve better performance and run faster than the DETR with 10$ imes$ fewer training epochs. For example, it achieves 44.2 AP with 19 FPS on the MSCOCO dataset when using the ResNet50-DC5 feature for training 50 epochs. Extensive experiments on the MSCOCO benchmark prove the effectiveness of the proposed methods. Code is available at \url{https://github.com/megvii-research/AnchorDETR}.

Motivation & Objective

  • Motivate and motivate why learned object queries in DETR lack explicit spatial meaning and are hard to optimize.
  • Propose an anchor-point based object query design with multiple patterns per anchor to handle "one region, multiple objects".
  • Introduce Row-Column Decoupled Attention (RCDA) to reduce memory usage while maintaining or improving accuracy.
  • Demonstrate through extensive experiments on MS COCO that Anchor DETR outperforms DETR with 10x fewer training epochs and compares favorably with other DETR-like methods.
  • Provide practical insights and ablations to validate the effectiveness of each component.

Proposed method

  • Encode anchor points as object queries to provide explicit spatial meaning (Q_p = Encode(Pos_q)).
  • Attach multiple patterns per anchor point to allow predicting multiple objects per position (Q_f^init expanded to Q_f^init + Q_p with patterns).
  • Use a position-encoding function g to compute Q_p and K_p, optionally enhanced by a small two-layer MLP.
  • Introduce Row-Column Decoupled Attention (RCDA) that decouples K_f into row and column components and applies sequential row and column attention to reduce memory usage.
  • Keep RCDA compatible with cross-attention and self-attention in DETR-like decoders while maintaining performance.
  • Train and evaluate on MS COCO with ResNet-50-DC5 features, comparing to DETR and other DETR-like detectors.

Experimental results

Research questions

  • RQ1Does anchoring object queries to explicit anchor points provide clearer inductive bias and improve optimization compared to learned embeddings?
  • RQ2Can multiple prediction patterns per anchor point enable effective handling of multiple objects within a single region?
  • RQ3Does Row-Column Decoupled Attention reduce memory consumption without sacrificing accuracy compared to standard DETR attention?
  • RQ4How does Anchor DETR perform in terms of accuracy and speed relative to DETR and other DETR-like detectors on COCO?
  • RQ5What ablations demonstrate the contribution of anchor-point queries, multi-pattern predictions, and RCDA?

Key findings

  • Anchor-point based queries with multi-pattern predictions achieve higher AP than DETR (e.g., 44.2 AP vs DETR baselines in their experiments).
  • The RCDA attention variant provides similar or better accuracy than standard DETR attention while substantially reducing memory usage, particularly with high-resolution features.
  • With 50 epochs on a single ResNet-50-DC5 feature, Anchor DETR reaches 44.2 AP at 19 FPS, outperforming DETR variants trained for 500 epochs that use multi-level features.
  • Using a single DC5 feature, Anchor DETR achieves competitive results compared to Deformable DETR and SMCA that rely on multi-level features, while requiring significantly fewer training epochs.
  • Ablations show that multiple predictions per anchor point and the anchor-point query design jointly contribute to substantial AP gains (e.g., 4.9 AP gain from anchor-point query design).
  • Anchor points can be grid or learned, with learned points distributing uniformly similarly to grids, and both yielding comparable performance.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.