Method and apparatus for learning efficient detection transformers

WO2024212034A9PCT designated stage expired Publication Date: 2024-12-19ROBERT BOSCH GMBH +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/087225
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-04-10
Publication Date
2024-12-19

Smart Images

  • Figure CN2023087225_19122024_PF_FP_ABST
    Figure CN2023087225_19122024_PF_FP_ABST
Patent Text Reader

Abstract

A computer implemented method for machine learning is disclosed. The method comprises training, a first Detection Transformer (DETR) model; training a second DETR model based on a loss which weights feature differences between layers of an encoder of the trained first DETR model and an encoder of the second DETR model with a mean attention map, wherein the encoder of the second DETR model has less layers than the encoder of the first DETR model; and wherein the mean attention map is based on one or more of an average of attention maps of multi-heads and one or more object queries of a decoder of the trained first DETR model or an average of attention maps of multi-heads and one or more object queries of a decoder of the second DETR model.
Need to check novelty before this filing date? Find Prior Art

Description

METHOD AND APPARATUS FOR LEARNING EFFICIENT DETECTION TRANSFORMERSFIELD

[0001] Aspects of the present disclosure relate generally to artificial intelligence, and more particularly, to method and apparatus provided for learning efficient detection transformers via query-guided knowledge distillation.BACKGROUND

[0002] The goal of object detection is to predict a set of bounding boxes and category labels for each object of interest. Detection Transformer (DETR) and its variants have become new paradigm of object detection, by virtue of their direct set prediction capability. However, existing DETR-like models (DETRs) suffer heavy backbone and Transformer head, which limits their practical applications. To address this problem, the possibility of improving their efficiency is being explored.

[0003] Knowledge distillation, which is known as a popular practice for learning efficient models, could significantly improve efficiency while maintaining performance by transferring learned knowledge from a large teacher model to a smaller student model. Therefore, there exists a motivation to apply knowledge distillation to DETRs.

[0004] SUMMARY

[0005] The following presents a simplified summary of one or more aspects to provide a basic understanding of such aspects. This summary is not an extensive overview of all contemplated aspects, and is intended to neither identify key or critical elements of all aspects nor delineate the scope of any or all aspects. Its sole purpose is to present some concepts of one or more aspects in a simplified form as a prelude to the more detailed description that is presented later.

[0006] It is disclosed herein that how to efficiently apply knowledge distillation to DETRs. To achieve this goal, at least two main aspects are needed to be considered: 1) which components of a DETR model should be scaled down; and 2) how to improve the performance of the scaled down DETR model with knowledge distillation, in other words where to distill and how to distill effectively.

[0007] In an aspect, a computer implemented method for machine learning is disclosed. The method comprises training, a first Detection Transformer (DETR) model; training a second DETR model based on a loss which weights feature differences between layers of an encoder of the trained first DETR model and an encoder of the second DETR model with a mean attention map, wherein the encoder of the second DETR model has less layers than the encoder of the first DETR model; and wherein the mean attention  map is based on one or more of an average of attention maps of multi-heads and one or more object queries of a decoder of the trained first DETR model or an average of attention maps of multi-heads and one or more object queries of a decoder of the second DETR model.

[0008] In a further aspect, the mean attention map is based on a ratio combination of the average of attention maps of multi-heads and one or more object queries of the decoder of the trained first DETR model and the average of attention maps of multi-heads and one or more object queries of decoder of the second DETR model of the decoder of the second DETR model.

[0009] In a further aspect, the attention maps of the trained first DETR model and the attention maps of the second DETR model are attention maps from the last layer of respective decoders.

[0010] In a further aspect, the one or more object queries of the decoder of the trained first DETR model and the one or more object queries of the decoder of the second DETR model are positive ones.

[0011] In a further aspect, the feature differences are calculated between output features of each layer of the encoder of the second DETR model and an output feature of a final layer of the encoder of the trained first DETR model.

[0012] In a further aspect, the feature differences are calculated between output features of each layer of the encoder of the second DETR model and output features of each corresponding intermediate layer of the encoder of the trained first DETR model.

[0013] In a further aspect, training the second DETR model is further based on a loss which evaluating the difference between outputs of the decoder of the second DETR model and ground-truth labels.

[0014] In a further aspect, the first DETR model and the second DETR model are trained with image data, and the output of the first DETR model and the second DETR model are category labels and bounding boxes corresponding to one or more object queries.

[0015] In an aspect, a computer implemented method for object detection using a DETR model trained with one of the methods disclosed herein is disclosed. The method comprises obtaining, image data captured during vehicle movement; inputting, the image data into the DETR model; outputting, object category labels and bounding boxes corresponding to one or more object queries by the DETR model; and assisting, vehicle travelling based on the output object category labels and bounding boxes.

[0016] In an aspect, a computer system is disclosed. The computer system comprises one or more processors; and one or more storage devices storing computer-executable instructions that, when executed, cause the one or more processors to perform the operations of one of the methods disclosed herein.

[0017] In an aspect, one or more computer readable storage media storing computer-executable instructions that, when executed, cause one or more processors to perform the operations of one of the methods disclosed herein is disclosed.

[0018] In an aspect, a computer program product comprising computer-executable instructions that, when executed, cause one or more processors to perform the operations of one of the methods disclosed herein is disclosed.

[0019] In an aspect, a vehicle comprising one or more means for performing one of the methods disclosed herein is disclosed.BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The disclosed aspects will be described in connection with the appended drawings that are provided to illustrate and not to limit the disclosed aspects.

[0021] Fig. 1 illustrates an example structure of Detection Transformer, in accordance with various aspects of the present disclosure.

[0022] Fig. 2 illustrates an example structure of knowledge distillation, in accordance with various aspects of the present disclosure.

[0023] Fig. 3 illustrates examples of inference time of DETRs, in accordance with various aspects of the present disclosure.

[0024] Fig. 4 illustrates example distillation strategies, in accordance with various aspects of the present disclosure.

[0025] Fig. 5 illustrates example structure of Query-guided Knowledge distillation, in accordance with various aspects of the present disclosure.

[0026] Fig. 6 illustrates two example distillation options, in accordance with various aspects of the present disclosure.

[0027] Fig. 7 illustrates an exemplary flow chart for learning an efficient DETR, in accordance with various aspects of the present disclosure.

[0028] Fig. 8 illustrates an exemplary flow chart for using the trained DETR, in accordance with various aspects of the present disclosure.

[0029] Fig. 9 illustrates an exemplary computer system, in accordance with various aspects of the present disclosure.DETAILED DESCRIPTION

[0030] The present disclosure will now be discussed with reference to several example implementations. It is to be understood that these implementations are discussed only for enabling those skilled in the art to better understand and thus implement the embodiments of the present disclosure, rather than suggesting any limitations on the scope of the present disclosure.

[0031] Various embodiments will be described in detail with reference to the accompanying drawings. Wherever possible, the same reference numbers will be used throughout the drawings to refer to the same or like parts. References made to examples and embodiments are for illustrative purposes, and are not intended to limit the scope of the disclosure.

[0032] Object detection is an important computer vision task that deals with detecting instances of visual objects of a certain class, such as humans, animals, vehicles or traffic signs, in digital images. The goal of object detection is usually to predict a set of bounding boxes and category labels for each object of interest. The object detection task could be widely used in real world applications, for example, autonomous driving, video surveillance and robot vision, etc.

[0033] Detection Transformer (DETR) and its variants (uniformly referred to as DETRs or DETR model herein) have grown into a new paradigm for object detection. DETRs use Transformer as the detection head to predict the set of objects directly through the interaction between object queries and visual features, free from multiple hand-designed components such as anchors and NMS.

[0034] However, existing DETRs suffer from large computational overhead due to their heavy backbone (e.g., ResNet-101) and Transformer-based head. Scaling down the model (e.g. using a lightweight backbone or fewer encoder / decoder layers) directly may decrease the detection performance significantly.

[0035] Knowledge distillation is an effective technique to promote the performance of a low capacity model by transferring "dark knowledge" from a larger model. To transfer the knowledge of a complicated model as a teacher model to a simplified model which is deploy friendly as a student model, the output of the trained teacher model can be provided to the student model for training.

[0036] Existing works usually are unable or difficult to apply to DETRs (sparse object detectors) , due to their specialized designs. Different from previous works, it is disclosed herein how to apply knowledge distillation for learning efficient DETRs. To achieve this goal, there may be two aspects to be considered: 1) how to design a reasonable student network, i.e., which components should be scaled down; 2) how to improve the performance of student networks with knowledge distillation, i.e., where to distill and how to distill effectively.

[0037] For the first aspect, an additional direction of distilling DETRs -distillation for the Transformer-based head is mainly considered in this disclosure, based on the observation that the Transformer-based head of DETRs usually occupies an extremely large portion of computational overhead. And for the second aspect, feature distillation on Transformer encoder is deemed as a more effective way to learn a well performed student model by a comparison between different distillation strategies.

[0038] Based on the above, to further improve the effectiveness of encoder distillation, a query-guided knowledge distillation (QGD) strategy is disclosed herein, motivated by the idea that where the model pays attention is more important. Specifically, the attention maps corresponding to multi-heads and object queries are used to guide the mimicking of encoder features, which can promote the student to effectively learn discriminative features. As DETRs require much time to learn reasonable attention maps, the guidance of query attention allows the student network to bypass the coarse attention to converge fast. More details would be discussed below with figures.

[0039] Fig. 1 illustrates an example structure of Detection Transformer, in accordance with various aspects of the present disclosure.

[0040] Existing object detection methods can be roughly divided into two-stage and one-stage methods. Two-stage methods typically generate dense proposals via RPN, and then extract RoI features to refine the prediction results. One-stage methods directly predict the bounding boxes and classification probabilities with dense anchor boxes or anchor points. Duplicate predictions are removed through NMS in these methods.

[0041] Detection Transformer (DETR) and its variants regard object detection as a set prediction problem, directly predicting bounding boxes and classes of objects. Being free of redundant designs such as anchor and NMS makes DETR much more concise. As shown in Fig. 1, an example DETR model would be composed of a backbone 101, a Transformer encoder 102, a Transformer decoder 103, and a plurality of prediction heads 105. Additionally, the Transformer decoder 103 could take a small fixed number of learned positional embeddings, which are known as object queries 104, as input, and a number of the plurality of prediction heads 105 equals to the fixed number of object queries 104.

[0042] As an example, DETR uses a conventional CNN as backbone 101 to learn a 2D representation of an input image, which in real world applications can be an image captured by a camera installed on a vehicle. The model flattens it and supplements it with a positional encoding before passing it into the Transformer encoder 102. The Transformer decoder 103 then takes as input a fixed number of object queries 104, and additionally attends to the Transformer encoder output. Each output embedding of the decoder 103 would be passed to a prediction head 105 that predict either a detection (category label and bounding box) or a “no object” class. Fig. 1 shown as an example that the second and fourth object queries are detected as “no object” .

[0043] However, the existing DETR-like methods still suffer from heavy backbone and Transformer heads. Therefore, knowledge distillation is considered as an approach to improve the efficiency of DETRs.

[0044] Fig. 2 illustrates an example structure of knowledge distillation, in accordance with various aspects of the present disclosure.

[0045] Knowledge distillation is a method for learning compact models, which can be called student models, with the supervision of large and accurate models, which can be called teacher models. As shown in Fig. 2, the model 202 on the upper side is a teacher model, and the model 205 on the lower side is a student model, which is also known as a distilled model. The teacher model and the student model both have multiple layers, the student model has less layers than the teacher model in an aspect.

[0046] It is generally known that the objective function used for training should reflect the true objective of the user as closely as possible. Despite this, models are usually trained to optimize performance on the training data when the real objective is to generalize well to test data, which are new to the models. The purpose is to train models to generalize well, which requires information about the correct way to generalize and this information is not normally available.

[0047] A promising approach to transfer the generalization ability of the teacher model to the student model is to use the classification probabilities produced by the teacher model as "soft targets" 210 for training the student model. Besides the soft target 210, it is more beneficial to introduce a hard target 211 which is calculated based on difference between outputs of the student model and ground-truth labels, as a part of the objective function as well, which encourages the student model to predict the true targets as well as the labels provided by the teacher model.

[0048] Coming back to Fig. 2, the teacher model 202 is firstly trained, the output of the teacher model is distillated by a temperature to produce a soft set of targets 204. Then the student model 205 is trained, the output of the student model is distillated by the same temperature to produce a soft set of predictions 207, besides the output of the student model with a temperature set to 1 to produce a hard set of predictions 208. The soft loss 210 is generated based on soft set of targets 204 and soft set of predictions 207, and hard loss 211 is generated based on hard set of predictions 208 and ground-truth labels 209. The soft loss 210 and hard loss 211 can be combined to train the student model 205.

[0049] In order to apply knowledge distillation on DETRs, an empirical study is first conducted to explore the two aspects mentioned above. As an example, Conditional DETR are mainly considered in this part due to its simplicity and faster convergence. Noted that, it is easily understood for a skilled one in the art that other DETRs would possess similar characteristics as Conditional DETR.

[0050] Firstly, it is started with inference time analysis for the critical components of DETR and Conditional DETR, including the backbone, Transformer encoder and decoder. Fig. 3 illustrates examples of inference time of DETRs, in accordance with various aspects of the present disclosure.

[0051] As shown in Fig. 3, inference time of each critical component of DETRs are illustrated, with (a) represents DETR and (b) represents Conditional DETR, wherein 301 and 301’  indicate inference time of backbone, 302 and 302’ indicate inference time of Transformer encoder, 303 and 303’ indicate inference time of Transformer decoder, and 304 and 304’ indicate the time cost of pre-processing and post-processing. It can be observed in Fig. 3 that the inference time of the Transformer-based head (including both encoder and decoder) is as large as the inference time of the backbone. For example, in conditional DETR, the Transformer head occupies 40%of the total inference time (302’ + 303’ ) , which is close to the time of backbone (301’ , 42%) . It suggests that, apart from backbone, the compression of the Transformer head is also essential to build an efficient student network.

[0052] Then, ablation experiments are conducted to explore the effect of each component of Conditional DETR on final detection performance. The number of layers of Transformer encoder and decoder are gradually decreased to observe their impact on mAP. As shown in Table 1 below, the number of decoder layers has a more significant impact on detection performance than the encoder. R18-x-y indicates model (with ResNet-18 as backbone) contains x layers of encoder and y layers of decoder, and ΔAP stands for AP change relative to R50-6-6.

[0053] Table 1 -Ablation study of each component in Conditional DETR

[0054] As can be seen in Table 1, keeping half of the encoder and decoder layers (i.e. R18-3-3) can still achieve reasonable performance (4.6%AP drop) , but further reducing the number of decoder layers results in dramatic performance degradation. The above analysis indicates that it is more reasonable to compress the Transformer encoder in DETRs than the decoder.

[0055] Based on the above, where to distill for DETRs is further investigated. Existing knowledge distillation methods could be roughly divided into two types: distillation of features and distillation of logits. These two paradigms are followed, with using feature distillation for backbone and Transformer encoder, and logits distillation for Transformer decoder, respectively.

[0056] Fig. 4 illustrate example distillation strategies, in accordance with various aspects of the present disclosure. In Fig. 4, the above DETR model T represents a teacher model, and below DETR model S represents a student model, wherein each model has similar  structure with Fig. 1. For further explanation, 101T and 101S stands for backbone for Teacher model and student model, 102T and 102S stands for Transformer encoder for Teacher model and student model, 103T and 103S stands for Transformer decoder for Teacher model and student model, and 105T and 105S stands for output object queries for Teacher model and student model. Fig. 4 illustrates three distillation strategies 401-403, which is to be discussed with more details below.

[0057] To get started, distillation strategy 401 may be called Backbone-Knowledge Distillation (KD) , referring to the learned knowledge could be transferred from teacher’s backbone to the student’s backbone with feature distillation. As an example, distillation is directly performed on the single-scale output features of backbones (C5 feature for ResNet) . As an example, the difference between features of teacher and student backbones can be calculated as the L2 loss as:

[0058] where FT, FS are features from the teacher and student backbones, respectively, and φ is a 1X1 convolutional layer to align the channels.

[0059] Since the Transformer encoder in DETRs is usually a module to enhance the features generated from backbone and occupies considerable large computational overhead a simple solution is to directly apply feature distillation strategy to the encoder, which is illustrated as distillation strategy 402, called Encoder-KD, in Fig. 4. Same as backbone distillation, as an example, the L2 loss is used to transfer the learned knowledge of teacher’s encoder as:

[0060] where and ψ denote output features of the teacher and student encoders and a fully-connected layer, respectively,

[0061] Another way is to distill the predicted results of Transformer decoder, termed query-KD and shown as distillation strategy 403 in Fig. 4. As an example, KL Divergence is used to transfer the classification knowledge. Besides, the attention maps of decoder are also distilled, which can further boost the performance. The classification probability and attention maps from students and teachers are denoted as ps, pT and AS, AT, respectively. The loss is:

[0062] where Q and σ are the set of target queries and the correspondence between teacher and student queries, respectively. An important question for query-KD is how to determine the correspondence σ . Two types of correspondence are explored: direct one-to-one matching of all queries (termed slot) , and matching the positive queries by the assigned ground-truth instances (termed GT) .

[0063] In the case of matching by slot, queries of student and teacher in a direct one-to-one manner (i.e., σi=i) . All queries are used for knowledge distillation (i.e., Q contains all queries) . Since the object queries of the student network are randomly initialized, this method would force the student’s queries to be aligned with the teacher’s queries. While in the case of matching by GT, the method is to match the queries by the assigned ground-truth instances. The bipartite matching training in DETR established a one-to-one correspondence between the queries and the ground-truth instances (GT) . This correspondence is reused to match the student and teacher query corresponding to the same GT. In this case, only the queries that have matched with GT (i.e., positive queries) are used.

[0064] Table 2 below shows a comparison of the three distillation strategies. The empirical experiments are conducted on the MSCOCO dataset and reported the detection AP on the validation set. The teacher network was trained for 50 epochs and with ResNet-50 as the backbone. The student networks were trained for 24 epochs for fast comparison. From Table 2, it can be concluded that: (1) Feature distillation (of backbone and encoder) was superior to logits distillation (of decoder) for DETRs; (2) For query-KD, aligning with GT resulted in 1.2%AP improvement; (3) Applying feature distillation to encoder worked better than to backbone.

[0065] Table 2 –Comparison of distillation strategies

[0066] Thus, it is empirically found that combining query-KD on the basis of encoder-KD would bring modest gains on DETRs. Therefore, the disclosure focuses on encoder-KD instead of backbone and decoder because of its effectiveness and simplicity. How to distill learned knowledge from encoder features effectively is to be discussed with more details hereinafter.

[0067] To start with a brief review of the cross-attention mechanism of Transformer decoder in DETRs. Given a set of object queries Q∈RN×C (e.g., 104 in Fig. 1) , DETR aggregates features Z from image features F∈RH×W×C (obtained from encoder, e.g., 102 in Fig. 1) with cross-attention (N denotes the number of object queries) ,

[0068] where e indicates head (in multi-head attention) and Q (e) , K (e) and V (e) are obtained by linear projection of Q and F , respectively. This can be interpreted as  weighting image features from encoder with attention maps A (e) ∈ (0, 1) N×H×W. After that, the output feature Z is obtained by concatenating features from different heads and applying a linear transformation Wo o to obtain output features, Z=Concat (Z (1) , …, Z (E) ) Wo      (5)

[0069] where E stands for the number of multi-heads.

[0070] Motivated by the idea that where the model pays attention is more important, it is proposed in the disclosure a query-guided knowledge distillation (QGD) strategy for encoder-KD. Fig. 5 illustrates example structure of Query-guided Knowledge distillation, in accordance with various aspects of the present disclosure.

[0071] In Fig. 5, the same reference numbers are used to refer to the same or like parts as in Fig. 4, while block 501 refers to Encoder KD, and block 502 refers to query attention maps, which would be used to guide the Encoder KD in the proposed method.

[0072] The attention map corresponding to different object queries to emphasize valuable encoder features in the teacher model are reused to achieve the idea of emphasizing valuable regions. Intuitively, regions with larger attention weights have a stronger influence on the final prediction and are thus more important. For the example in Fig. 5, attention is focused on the head and extremas of the birds, containing information valuable for classification and localization.

[0073] Therefore, the query-guided knowledge distillation could be derived as a loss weighted by multi-head attention maps of queries. As an example, it could be derived as a L2 loss weighted by multi-head attention maps of queries is derived as:

[0074] In an example, P can denote the set of all the object queries, such as the case of matching by slot described before. In a further example, to further improve AP, P can denote the set of positive object queries (i.e., the ones matched the ground-truth instances) , such as the case of matching by the assigned ground-truth instances described before. For the original Transformer head, it is equivalent to weighting the feature distillation using the mean attention map of different heads and object queries as below,

[0075] In the present disclosure, the feature distillation could be applied in the last encoder layer in an example, but it can be also applied to the preceding layers of encoder in another example.

[0076] In the present disclosure, as an example the attention maps from the last layer of decoder are utilized, in another example the attention maps from other layers of decoder may be used.

[0077] In order to combine attention maps from different models and balance the ratio of two attention maps, a hyper-parameter ρ∈ [0, 1] to balance the ratio of two attention maps from teacher model and student model is introduced, resulting the following generic form: M=ρ·MT+ (1-ρ) ·MS                    (9)

[0078] where MS and MT denote the attention maps from student and teacher, respectively. With different value of ρ, the attention maps in Eq. (6) could be either come from teacher model or student model, or both. As a further example, for deformable attention it can refer to Eq. (6) and apply the same sampling points as query to the L2 loss.

[0079] In the present disclosure, it is further disclosed how to efficiently transfer knowledge among different layers of encoder, as the encoder typically consists of multiple Transformer layers. The function of Transformer encoder could be treated as an iterative process of refining image features. By guiding the learning of earlier layers of the student encoder not only the last layer, the quality of its final output features can be further improved. Two distillation options are proposed in the disclosure and as illustrated in Fig. 6.

[0080] In an example, the shallow features of the student can be guided with the deep features of the teacher, as shown in (a) of Fig. 6. As an example, feature of each layer of encoder of the student model could be guided with the output features of last layer of encoder of the teacher model as a shared target for different student layers.

[0081] In another example, the shallow features of the student can be guided with corresponding shallow features of the teacher, as shown in (b) of Fig. 6. As an example, feature of each layer of encoder of the student model could be guided with the feature of corresponding intermediate layer of encoder of the teacher model with the progressive manner.

[0082] The overall distillation loss is defined as below:

[0083] where L is the number of student encoder layers, s is the multiplicity of the number of teacher layers relative to that of student (for deep supervision, sl is replaced with the number of teacher encoder layers) , and F (l) denotes the output of the l-th encoder layer,  is the loss weight for the l-th layer. LQGD is then added to the original DETR Loss for end-to-end training.

[0084] Fig. 7 illustrates an exemplary flow chart for learning an efficient DETR, in accordance with various aspects of the present disclosure. As described below, some or all illustrated features may be omitted in a particular implementation within the scope of the present disclosure, and some illustrated features may not be required for implementation of all embodiments. Further, some of the blocks may be performed parallel or in a different order. In some examples, the method may be carried out by any suitable apparatus or means for carrying out the functions or algorithm described below.

[0085] The method begins at block 701, with training a first Detection Transformer (DETR) model. As an example, the first DETR model comprises at least a backbone, a Transformer encoder, a Transformer decoder, wherein the encoder comprises multiple Transformer layers.

[0086] Then the method proceeds to block 702, with training a second DETR model based on a loss which weights feature differences between layers of an encoder of the trained first DETR model and an encoder of the second DETR model with a mean attention map. In an aspect of the disclosure, the method may be embodied in Eq. (7) described above. As an example, the second DETR model comprises at least a backbone, a Transformer encoder, a Transformer decoder, wherein the encoder comprises multiple Transformer layers. As an example, the encoder of the second DETR model has less layers than the encoder of the first DETR model.

[0087] As an example, the mean attention map is based on one or more of an average of attention maps of multi-heads and one or more object queries of a decoder of the trained first DETR model or an average of attention maps of multi-heads and one or more object queries of a decoder of the second DETR model. In an aspect of the disclosure, the method may be embodied in Eq. (8) described above.

[0088] As a further example, the mean attention map is based on a ratio combination of the average of attention maps of multi-heads and one or more object queries of the decoder of the trained first DETR model and the average of attention maps of multi-heads and one or more object queries of decoder of the second DETR model. In an aspect of the disclosure, the method may be embodied in Eq. (9) described above.

[0089] As an example, the attention maps of the trained first DETR model and the attention maps of the second DETR model are attention maps from the last layer of respective decoders.

[0090] As an example, the one or more object queries of the decoder of the trained first DETR model and the one or more object queries of the decoder of the second DETR model are positive ones.

[0091] As another example, the one or more object queries of the decoder of the trained first DETR model and the one or more object queries of the decoder of the second DETR model are all the object queries.

[0092] As an example, the feature differences are calculated between output features of each layer of the encoder of the second DETR model and an output feature of a final layer of the encoder of the trained first DETR model. In an aspect of the disclosure, the method may be embodied in a deep supervision manner described with (a) of Fig. 6 above.

[0093] As an example, the feature differences are calculated between output features of each layer of the encoder of the second DETR model and output features of each corresponding intermediate corresponding layer of the encoder of the trained first DETR model. In an aspect of the disclosure, the method may be embodied in a progressive way described with (b) of Fig. 6 above.

[0094] As a further example, training the second DETR model is further based on a loss which evaluating the difference between outputs of the decoder of the second DETR model and ground-truth labels. In an aspect of the disclosure, the loss of Eq. (6) or (10) can be added to the original DETR Loss for end-to-end training.

[0095] Taking a real-world application as example, the first DETR model and the second DETR model may be both trained for object detection for autonomous driving. The training set for the first and second DETR model may be a set of images, each of which containing a variety of different objects, such as traffic signs, road surfaces, pedestrians, vehicles, etc. The outputs of the first and second DETR model are expected to be categories and bounding boxes corresponding to objects in the images.

[0096] Fig. 8 illustrates an exemplary flow chart for using the trained DETR, in accordance with various aspects of the present disclosure. As described below, some or all illustrated features may be omitted in a particular implementation within the scope of the present disclosure, and some illustrated features may not be required for implementation of all embodiments. Further, some of the blocks may be performed parallel or in a different order. In some examples, the method may be carried out by any suitable apparatus or means for carrying out the functions or algorithm described below.

[0097] The method begins at block 801, with obtaining, image data captured during vehicle movement. As an example, the image data can be captured by means such as camera, LIDAR, etc. mounted on a vehicle.

[0098] The method proceeds to block 802, with inputting, the image data into the DETR model. The DETR model may be the second DETR model trained with one of the methods described with Fig. 7.

[0099] The method proceeds to block 803, with outputting, object category labels and bounding boxes corresponding to one or more object queries by the DETR model.

[0100] The method proceeds to block 804, with assisting, vehicle travelling based on the output object category labels and bounding boxes.

[0101] Fig. 9 illustrates an exemplary computer system, in accordance with various aspects of the present disclosure. The computer system may comprise at least one processor 910.  The computer system may further comprise at least one storage device 920. It should be appreciated that the storage device 920 may store computer-executable instructions that, when executed, cause the processor 910 to perform any operations according to the embodiments of the present disclosure as described in connection with Figs. 1-8.

[0102] The embodiments of the present disclosure may be embodied in one or more computer-readable medium such as non-transitory computer-readable medium. The non-transitory computer-readable medium may store instructions that, when executed, cause one or more processors to perform any operations according to the embodiments of the present disclosure as described in connection with Figs. 1-8.

[0103] The embodiments of the present disclosure may be embodied in a computer program product comprising computer-executable instructions that, when executed, cause one or more processors to perform any operations according to the embodiments of the present disclosure as described in connection with Figs. 1-8.

[0104] The embodiments of the present disclosure may be embodied in a vehicle comprising one or more means for performing any operations according to the embodiments of the present disclosure as described in connection with Figs. 8.

[0105] It should be appreciated that all the operations in the methods described above are merely exemplary, and the present disclosure is not limited to any operations in the methods or sequence orders of these operations, and should cover all other equivalents under the same or similar concepts.

[0106] It should also be appreciated that all the modules in the apparatuses described above may be implemented in various approaches. These modules may be implemented as hardware, software, or a combination thereof. Moreover, any of these modules may be further functionally divided into sub-modules or combined together.

[0107] The previous description is provided to enable any person skilled in the art to practice the various aspects described herein. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects. Thus, the claims are not intended to be limited to the aspects shown herein. All structural and functional equivalents to the elements of the various aspects described throughout the present disclosure that are known or later come to be known to those of ordinary skill in the art are expressly incorporated herein by reference and are intended to be encompassed by the claims.

Claims

1.A computer implemented method for machine learning, comprising:training, a first Detection Transformer (DETR) model;training a second DETR model based on a loss which weights feature differences between layers of an encoder of the trained first DETR model and an encoder of the second DETR model with a mean attention map, wherein the encoder of the second DETR model has less layers than the encoder of the first DETR model; andwherein the mean attention map is based on one or more of an average of attention maps of multi-heads and one or more object queries of a decoder of the trained first DETR model or an average of attention maps of multi-heads and one or more object queries of a decoder of the second DETR model.2.The method of claim 1, wherein the mean attention map is based on a ratio combination of the average of attention maps of multi-heads and one or more object queries of the decoder of the trained first DETR model and the average of attention maps of multi-heads and one or more object queries of decoder of the second DETR model.3.The method of claim 2, wherein the attention maps of the trained first DETR model and the attention maps of the second DETR model are attention maps from the last layer of respective decoders.4.The method of claim 1, wherein the one or more object queries of the decoder of the trained first DETR model and the one or more object queries of the decoder of the second DETR model are positive ones.5.The method of claim 1, wherein the feature differences are calculated between output features of each layer of the encoder of the second DETR model and an output feature of a final layer of the encoder of the trained first DETR model.6.The method of claim 1, wherein the feature differences are calculated between output features of each layer of the encoder of the second DETR model and output features of each corresponding intermediate layer of the encoder of the trained first DETR model.7.The method of claim 1, wherein training the second DETR model is further based on a loss which evaluating the difference between outputs of the decoder of the second DETR model and ground-truth labels.8.The method of claim 1, wherein the first DETR model and the second DETR model are trained with image data, and the output of the first DETR model and the second DETR model are category labels and bounding boxes corresponding to one or more object queries.9.A computer implemented method for object detection using a DETR model trained with one of claims 1-8, comprising:obtaining, image data captured during vehicle movement;inputting, the image data into the DETR model;outputting, object category labels and bounding boxes corresponding to one or more object queries by the DETR model; andassisting, vehicle travelling based on the output object category labels and bounding boxes.10.A computer system, comprising:one or more processors; andone or more storage devices storing computer-executable instructions that, when executed, cause the one or more processors to perform the operations of the method of one of claims 1-9.11.One or more computer readable storage media storing computer-executable instructions that, when executed, cause one or more processors to perform the operations of the method of one of claims 1-9.12.A computer program product comprising computer-executable instructions that, when executed, cause one or more processors to perform the operations of the method of one of claims 1-9.13.A vehicle, the vehicle comprising one or more means for performing the method of claims 9.