Methods Using Selective Query Recollection for Enhanced Training of Query-Based Object Detectors

Information

  • Patent Application
  • 20240161469
  • Publication Number
    20240161469
  • Date Filed
    November 14, 2023
    a year ago
  • Date Published
    May 16, 2024
    7 months ago
  • CPC
    • G06V10/774
  • International Classifications
    • G06V10/774
Abstract
Disclosed herein are training strategies for query-based object detectors, referred to herein as Query Recollection (QR). In one variation or QR, dense query recollection, every intermediate query is collected and independently forwarded to every downstream stage. In a second variation or QR, selective query recollection, intermediate queries are collected from the two nearest previous stages and forwarded to the next downstream stage. This eliminates the phenomena wherein intermediate stages of the decoder produce more accurate results than later stages of the decoder.
Description
BACKGROUND OF THE INVENTION

Object detection is a long-established topic in computer vision aiming to localize and categorize objects of interest. Prior art methods rely on dense priors tiled at feature grids so as to detect in a sliding-window paradigm and have dominated object detection for the last few years, but these methods fail to overcome many hand-crafted processing steps such as anchor generation or non-maximum suppression, which block end-to-end optimization.


Recent research attention has been geared towards query-based object detection. By viewing detection as a direct set prediction problem, the new archetype represents the set of objects using a set of learn-able embeddings, termed as queries, which are fed to a decoder consisting of a stack (typically six) of decoding stages. Each stage performs similar operations: (1) interacting queries with image features via an attention-like mechanism, so the queries are aggregated with valuable information that represents objects; (2) reasoning the relation among all queries so that global dependency on objects cooccurrence and duplicates could be captured; and (3) interpreting bounding box and category from each query by a feed forward network. Queries are sequentially processed stage-by-stage, and each stage is formulated to learn a residual function with reference to the former stage's output, aiming to refine queries in a cascaded style.


As such, the decoding procedure implies that detection should be stage-by-stage enhanced in terms of intersection over union (IoU) and confidence score. Indeed, monotonically improved average precision (AP) is empirically achieved by this procedure. However, when visualizing the stage-wise predictions, it is surprising to note that the decoder makes mistakes in a significant proportion of cases where the later stages degrade true-positives and upgrade false-positives from the former stages. As shown in FIG. 1, the traffic light at stage 1 gets categorical confidence of 0.41, while from stage 2 to 5 the confidence gradually decreases to 0.21; the remote at stage 3 was wrongly classified as a cell phone, while from stage 3 to 6 the error was exacerbated from 0.26 to 0.42.


This phenomenon may be explained as such. First, the responsibility that each stage takes is unbalanced, while supervision applied to them is analogous. An early stage could make mistakes without causing too much impact because it gets chances to be corrected later, and the later stages are more responsible for the final prediction. But during training, all of these stages are supervised in an equivalent manner and there lacks such a mechanism that places particular training emphasis on later stages. Second, due to the sequential structure of the decoder, an intermediate query refined by a stage regardless of whether this refinement brings positive or negative effects, will be cascaded to the following stages, while the query prior to the refinement never gets an opportunity to be propagated forward even though it emerges unscathed and might be more representative than the refined one. The cascading errors increase the difficulty of convergence and the sequential structure impedes the later stages from seeing prior queries during training.


SUMMARY OF THE INVENTION

Disclosed herein is a training strategy for query-based object detectors, referred to herein as Query Recollection (QR). QR cumulatively collects intermediate queries as stages go deeper and feeds the collected queries to the downstream stages aside from the sequential structure. By each stage, the new add-ins alongside the original inputs are independently treated among each other, so the attentions and losses are calculated individually. In such a manner, QR enjoys two key features: (1) The number of supervision signals per stage grows in geometric progression, so that later stages get more supervision than the former ones. For example, the sixth stage got 32 times more supervision than the first stage; (2) Later stages get chance to view the outputs beyond its neighboring stage for training, which mitigates the potential impact due to cascading errors.


Further, selective forward queries to each stage, not with the entire query collection but only those from the prior two stages, raises the number of supervision in a Fibonacci sequence which halves the extra computing cost and brings even better results. This enhancement is referred to herein as Selective Query Recollection (SQR), which can be summarized as an effective training strategy that elegantly fits query-based object detectors.





BRIEF DESCRIPTION OF THE DRAWINGS


FIG. 1 shows examples of a query-based object detector performing stage-by-stage prediction enhancement.



FIG. 2 is a block diagram of a single decoding stage of a query-based object detector.



FIG. 3 is a block diagram showing a basic process for coding queries stage-by-stage (a); Dense Query Recollection (b); and Selective Query Recollection (c).





DETAILED DESCRIPTION

In query-based object detection, queries are updated successively. A typical structure of a single decoding stage of a query-based object detector is illustrated in FIG. 2. An initial query qi0(i∈N={1, 2, . . . , n}) is an embedding trained through back-propagation, and n is the total number of initial queries. During inference, the first stage updates the initial query by adding a residual term to it, producing intermediate query qi1, followed by later stages sequentially updating the intermediate query in the same way. The procedure can be formulated as:






q
i
s
=D
s(qis−1, qs−1, x)=qis−1+(custom-charactercustom-character)(qis−1, qs−1,x)   (1)


where:


Ds is a decoding stage;


s is a stage index;


qis is the ith query at stage s;


qs is a set of queries qs={qis, |i∈N};


(custom-charactercustom-character) stands for a bundle of modules including self and cross attention and feed forward network; and


x means features.


A normalization function that applied on each module has been omitted for simplicity. Afterward, qis predicts an object Pis via two multi-layer perceptrons for classification and regression:






P
i
s=(MLPcls(qis), MLPreg(qis)   (2)


Pi1˜6 are predicted by the qi1˜6 rooted in qi0, where Pi6 is the expected outcome and Pib 1˜5 are intermediate results. Pis is regarded as a true-positive towards a ground-truth G only if the IoU(Pis, G) exceeds a threshold, its category matches with G, and the categorical score is ranked as the highest among all other counterparts.


Query-based models frequently predict the optimum at intermediate stages instead of the last one. Two obstacles impeding the occurrence of the most reliable predictions in the last stage, include the lack of training emphasis and the cascading errors from query sequence.


Disclosed herein is the Query Recollection (QR) training strategy that embraces uneven supervision applied to decoding stages that places emphasis on later ones, enhancing later stages for better final outcomes, and a variety of early-stage queries directly introduced to later stages, mitigating the impact of cascading errors.


Compared with prior art methods, QR collects intermediate queries at every stage and forwards them along the original pathway. Dense Query Recollection (DQR) is the fundamental form and Selective Query Recollection (SQR) is an advanced variant.


The process of single decoding stage (self-attention, cross-attention, FFN), the ground-truth assignment, and loss calculations are applied within a set of queries {qi|i∈{1, 2, . . . , n}} where n is typically 100/300/500. The set of queries is regarded as a basic unit in the disclosed methods and is generally denoted as q.


Basic Pathway—Query along the basic pathway is refined by all stages and is illustrated in FIG. 3(a). Taking a 4-stages decoder as an example, we denote q0-1-2-3-4 as the final query that is that is refined by all stages. The basic custom-character finally produces:











q

0
-
1
-
2
-
3
-
4


=


𝒟
4

(


𝒟
2

(


𝒟
1

(

q
0

)

)

)


)




(
3
)












=


𝒫𝒯

1
-
2
-
3
-
4


(

q
0

)





(
4
)







During training, the queries from each stage (i.e., (q0-1, Q0-1-2, q0-1-2-3, q0-1-2-3-4) are independently followed by Hungarian Assignment that matches ground-truth with q in a one-to-one manner, and then followed by loss calculation for supervision. In FIG. 3, those q that require supervision are marked as {circumflex over (q)}. Along the basic pathway, the number of {circumflex over (q)} at each stage is 1.


Dense Query Recollection (DQR)—In this embodiment, every intermediate q is collected and independently forwarded to every downstream stage. This embodiment is illustrated in FIG. 3(b). After each stage, a collection C is formed where the number of q grows geometrically, namely 2s at sth stage. Formally:






C
0
={q
0}  (5)






C
s
={D
s(q)|q∈Cs−1}∪Cs−1   (6)


In a collection C, half of the queries inside are newly generated by the current stage (i.e., from {Ds(q)|q∈Cs−1}) while the other half are from previous stages, Cs−1. Separately, for each q in the former half, Hungarian assignment and loss calculation are applied, so the number of supervision signals grows in geometric progression as well, namely 2s−1 at the sth stage.


As such, Dense Query Recollection satisfies the expectancy where the number of supervision signals for each stage grows as (1, 2, 4, 8, 16, 32), meanwhile, all prior queries would be visible in all later stages.


During inference, only use the basic pathway is used, so the inference process is untouched. For a standard 6-stage decoder, the pathway is custom-character1-2-3-4-5-6.


DQR empirically enhances training, but the query collection process is indiscriminate, which brings two defects: First, the geometrical growth of the number of {circumflex over (q)} and their attention/loss calculations are costly to compute. Second, if an early q is input that skips too many stages to a far-away late stage, the potential benefit could be overshadowed by the huge learning gap between the stages and query. For instance, if the initial q0 is directly introduced to stage 6 and produces {circumflex over (q)}0-6, this query would have the highest difficulty among all queries at stage 6 and the calculated loss would dominate the overall losses. This motivates the second embodiment in which intermediate q's are selectively collected rather than densely collecting all of them.


In a variation of DQR, termed DQRR (Dense Query Recollection+Recurrence), the model size may be reduced. Existing methods typically have more than 6 decoding stages in the decoder. The detector can be trained where all decoding stages share parameters, however, the model cannot converge. However, DQR has the capability to achieve this goal. A strong decoding stage at the end (i.e., the final stage), is obtained after training with DQR. This stage has seen every possibly intermediate query that ever existed along the decoding process. A natural attempt is to replace the parameters of all stages with the final stage's parameters during inference, forming a pathway as custom-character6-6-6-6-6-6. However, this results in a 0 AP result! The reason is that the output of stage 6 shifts from its input, so stage 6 cannot recognize its own output, thus, it applies random refinement (negative effect) on it.


To address the problem, during training, the output of stage 6 is recollected and fed back to itself as its input. As such, stage 6 gets chance to learn to refine its output. Stage 6 is then recurrently used only for inference.


Selective Query Recollection (SQR)—The queries from the adjacent stage and the stage prior to the adjacent stage are more likely to bring positive effects. Therefore, collection is selectively operated along the basic pathway: before starting stage custom-characters, q is collected from the one or more nearest stages. For example, q can be collected from the 2 nearest stages, that is, the outputs of custom-characters−1 and Ds−2 are selected as the input of custom-characters.


Selective Query Recollection can be formulated as:










C
0

=



{

q
0

}




C
1


=

{


q
0

,

q

0
-
1



}






(
7
)













C
s

=


{



D
s

(
q
)

|

q


C

s
-
1




}



select



(

C

s
-
1


)







(
8
)
















=


{



D
s

(
q
)



q


C

s
-
1




}



{


D

s
-
1


(
q
)






"\[RightBracketingBar]"



q



C

s
-
2



}




(
9
)







As such, Selective Query Recollection, illustrated in FIG. 3(c), satisfies the expectancy that the number of supervision signals grows in a Fibonacci sequence (1, 2, 3, 5, 8, 13) rather than exponentially. Compared to the DSR, to a great extent, SQR reduces the computing burden and outperforms the dense counterpart in terms of precision.


In variations of this embodiment, the starting stage for SQR may be varied. In the example described above and shown in FIG. 3(c), queries are collected starting from stage 1. Instead, the starting stage can be practically varied, which will further reduce the total queries in each collection and further reduce the computing burden. For example, if SQR is started from stage 2, the Fibonacci sequence will start from stage 2 and results in (1, 1, 2, 3, 5, 8); if SQR starts from stage 3, the resulting sequence is (1, 1, 1, 2, 3, 5). The starting stage is regarded as a hyper-parameter for SQR.


The methods disclosed here in address the phenomenon wherein the optimal detections of query-based object detectors are not always from the last decoding stage but can sometimes come from an intermediate decoding stage. Two limitations or prior art methods cause the issue (i.e., lack of training emphasis and cascading errors from query sequence). The SQR training strategy provides the advantage of being able to overcome these limitations and addresses the limitations of the prior art methods.


As would be realized by those of skill in the art, the training techniques disclosed herein may be used in any combination on any dataset. Specific examples used herein are not meant to limit the invention in any way. The scope of the claimed invention is given by the following claims:

Claims
  • 1. A method of training a query-based object detector having a plurality of decoding stages, comprising: receiving an input query at a first stage;inputting an output collection of intermediary queries from each stage as input for a next stage in the decoder, wherein the output collection for a current stage includes intermediate queries in the input collection of the current stage;calculating, at each stage, a loss for each intermediate query from the current stage in the output collection.
  • 2. The method of claim 1 further comprising: calculating, for a last stage a loss for all intermediate queries in the output collection of the last stage.
  • 3. The method of claim 1 wherein the forwarding step comprises: adding the input query to the output collection of the first stage;for each successive stage, adding the output collection of the previous stage to the output collection of a current stage to form an input collection for a next stage.
  • 4. The method of claim 3 wherein every intermediate query, and the input query, are forwarded to every successive downstream stage.
  • 5. The method of claim 3 wherein, for each stage, half of the output collection comprises intermediate queries generated by the current stage and half of the output collection comprises intermediate queries generated by previous stages.
  • 6. The method of claim 2 further comprising: collecting the output collection of a last stage of the decoder;using the output collection of the last stage of the decoder as an input to the last stage; andcalculating a loss for the last stage.
  • 7. A method of training a query-based object detector having a plurality of decoding stages, comprising: receiving an input query at a first stage;inputting an output collection of intermediary queries from each stage as input for a next stage in the decoder, wherein the output collection for one or more stages includes outputs from one or more previous stages;calculating, at each stage, a loss for each intermediate query from the current stage in the output collection.
  • 8. The method of claim 7 wherein the one or more previous stages comprises an immediately preceding stage.
  • 9. The method of claim 7 wherein the one or more previous stages comprises two immediately preceding stages.
  • 10. The method of claim 7 wherein the output collection for all stages includes outputs from one or more previous stages.
  • 11. The method of claim 7 wherein a starting stage for including outputs from one or more previous stages in the output collection for the current stage varies.
  • 12. The method of claim 7 further comprising: calculating, for a last stage a loss for all intermediate queries in the output collection of the last stage.
RELATED APPLICATIONS

This application claims the benefit of U.S. Provisional Patent Applications No. 63/425,211, filed Nov. 14, 2022, the contents of which are incorporated herein in its entirety.

Provisional Applications (1)
Number Date Country
63425211 Nov 2022 US