SandHouse
Pages and contents

DETR & Object Queries

Field
Value
โ‹ฎโ‹ฎ
Authors
Carrion, Massa, et. al.
โ‹ฎโ‹ฎ
Year
2020
โ‹ฎโ‹ฎ
Link / arXiv
https://arxiv.org/pdf/2005.12872
โ‹ฎโ‹ฎ
Code
https://github.com/facebookresearch/detr
โ‹ฎโ‹ฎ
My relevance (1-5)
3
โ‹ฎโ‹ฎ
Tags
#object #detection #transformer

1\. Main Idea

This is an older paper, but the object query terminology and treating object learning as sets is useful for compositional and object-centric learning.

2\. Method

Set Prediction

The authors frame object detection as a set prediction problem (the mathematical object of a set). The DEtection TRansformer predicts all objects at once, and is trained end-to-end with a set loss function which performs bipartite matching between predicted and ground-truth objects. The usual solution to set prediction is to design a loss based on the Hungarian algorithm, to find a bipartite matching between ground-truth and prediction. This enforces permutation-invariance, and guarantees that each target element has a unique match.

Decoder

DETR infers a fixed-size set of N predictions, in a single pass through the decoder, where N is set to be significantly larger than the typical number of objects in an image. The decoder follows the standard architecture of the transformer, transforming N embeddings of size d using multi-headed self-attention and encoder-decoder attention mechanisms.

DETR decodes the Nobjects in parallel at each decode layer. Since the decoder is also permutation-invariant, the N input embeddings must be different to produce different results. These input embeddings are learnt positional encodings that we refer to as object queries.

To understand this better, suppose that the decoder receives Nquery vectors, where each query is a learned parameter q1,โ€ฆ,qNโˆˆโ„d. During the cross-attention step of decoding, each query references the encoded image features to extract information for one possible object

zi=CrossAttention(qi,x)

ziis then mapped to a class label and bounding box. This differs from slot attention, which forms vector latents through a Softmax, GRU competition architecture.