Neural network target detection training method based on dynamic component allocation and gradient optimization

By employing dynamic group allocation, gradient optimization, and redundant query filtering strategies, the problems of positive and negative sample imbalance, unreasonable information propagation, and redundant queries in deformable DETR training are solved, thereby improving the accuracy and efficiency of UAV image target detection.

CN121640035APending Publication Date: 2026-03-10BEIJING INFORMATION SCI & TECH UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511844651.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-09
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing training methods based on deformable DETR suffer from problems such as an imbalance in the ratio of positive to negative samples, unreasonable information propagation between decoder layers, insufficient quality of auxiliary branch initialization, and redundant queries interfering with training, which affect model performance and efficiency.

Method used

A dynamic group allocation strategy is adopted to balance the ratio of positive and negative samples. A gradient optimization mechanism is used to distinguish the gradient propagation in the coarse-grained and fine-grained detection stages. A hybrid query reselection strategy is used to generate high-quality initial anchor boxes. A redundant query filtering strategy is used to eliminate redundant queries. Finally, a total loss function is constructed to optimize the model parameters.

Benefits of technology

It significantly improves the detection accuracy of small and dense targets in UAV images, shortens model training time, and meets the detection performance and efficiency requirements of UAV scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121640035A_ABST
    Figure CN121640035A_ABST
Patent Text Reader

Abstract

The invention discloses a neural network target detection training method based on dynamic component allocation and gradient optimization, and relates to the technical field of computer target detection. Comprising the steps of S1, extracting initial features of an unmanned aerial vehicle image through a backbone network; s2, decoding query is initialized based on a mixed query reselection strategy; s3, realizing gradient separation and directional propagation of coarse granularity detection and fine granularity detection; and S4, constructing a total loss function based on the sum of the main branch loss and the auxiliary branch loss. According to the neural network target detection training method, through a dynamic component allocation strategy, loss calculation is more fit with data distribution, the influence of unbalance of positive and negative samples on the generalization ability of the model is reduced, the classification and regression precision is improved, and through a gradient optimization mechanism of a forward looking stage, through a gradient propagation mode of distinguishing coarse granularity detection and fine granularity detection, the classification and regression precision is improved. The target positioning precision is effectively improved, and the model convergence speed is increased.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer target detection, in particular to a neural network target detection training method based on dynamic group allocation and gradient optimization. BACKGROUND

[0002] Target detection is one of the core tasks in the field of computer vision, aiming to accurately locate and identify target objects from images. In recent years, end-to-end target detection models based on Transformers (such as DETR) have become a research hotspot due to their characteristics of not needing to manually design anchor boxes and directly associating predicted boxes with real boxes through bipartite matching. Among them, deformable DETR, as an improved version of DETR, focuses on feature sampling in the target area by introducing a deformable attention mechanism, effectively improving the detection performance of small targets and dense targets, and showing application potential in unmanned aerial vehicle image detection and other scenarios.

[0003] However, the existing training methods based on deformable DETR still have the following technical problems, which affect their performance and efficiency:

[0004] Positive and negative sample ratio imbalance: The traditional mixed branch strategy only increases the number of positive samples, without dynamically adjusting the positive and negative sample ratio in the decoding query, resulting in imbalance between positive and negative samples during model training, affecting the effectiveness of loss calculation and the model's generalization ability.

[0005] Unreasonable inter-decoder layer information propagation: The existing iterative box refinement method does not distinguish the gradient propagation needs of coarse-grained and fine-grained detection stages, resulting in insufficient information feedback in the fine-grained stage and interference from the coarse-grained stage, leading to low target positioning accuracy and slow model convergence.

[0006] Insufficient initialization quality of auxiliary branch: The initial anchor box of the auxiliary branch relies on the preliminary screening of the encoding features, which has low accuracy, and the content query lacks prior knowledge support, which easily introduces noise, leading to unstable training and difficulty in playing a strong supervision role.

[0007] Redundant query interference in training: The bipartite matching mechanism has a large number of redundant decoding queries in the early stage of training, which are easily misjudged by the model as effective target boxes, consuming computing resources and leading to low training efficiency and unstable convergence.

[0008] Therefore, there is an urgent need for a training strategy that can dynamically balance the positive and negative sample ratio, optimize the gradient propagation mechanism, improve the initialization quality, and eliminate redundant queries, to solve the defects of existing methods and improve the detection performance and training efficiency of the model. SUMMARY

[0009] To achieve the above purpose, the present application is implemented by the following technical scheme: a neural network target detection training method based on dynamic group allocation and gradient optimization, comprising:

[0010] S1, extracting initial features of the UAV image through the backbone network, and generating encoded features after enhancement by a multi-layer encoder;

[0011] S2, initializing a decoding query based on a hybrid query reselection strategy, the decoding query including a main branch query and an auxiliary branch query, to improve the quality of the initial anchor frame of the auxiliary branch;

[0012] S3, in the decoder training process, a dynamic group allocation strategy is used to dynamically balance the positive and negative sample ratio, a gradient optimization mechanism in the forward-looking stage is used to realize gradient separation and directional propagation of coarse-grained detection and fine-grained detection, and a redundant query screening strategy is used to eliminate redundant queries between decoder layers;

[0013] S4, constructing a total loss function based on the sum of the main branch loss and the auxiliary branch loss, optimizing the model parameters through the total loss function, and completing the training of the UAV image target detection model.

[0014] Preferably, the dynamic group allocation strategy in step S3 comprises:

[0015] S301, constructing a main branch query set and an auxiliary branch query set , wherein the main branch query is processed by an L-layer decoder to generate L groups of main branch prediction results , and the auxiliary branch query is processed by the L-layer decoder to generate L groups of auxiliary branch prediction results ;

[0016] S302, associating each layer of main branch prediction results with the real frame G through binary matching, calculating the main branch loss , and the calculation formula is:

[0017] ;

[0018] wherein, is a loss function, represents the i-th layer prediction result;

[0019] S303, calculating the supervision signal coefficient λ according to the number of real frames and the total number of decoding queries , and the calculation formula is:

[0020] ;

[0021] wherein, r is the ratio of negative samples to positive samples, and the value is 1-9;

[0022] S304, associating each layer of auxiliary branch prediction results Calculate the auxiliary branch loss by associating it with a λ times the true bounding box. The calculation formula is:

[0023] ;

[0024] in, This represents the prediction result of the i-th auxiliary branch;

[0025] S305, the total loss function is and The sum of .

[0026] Preferably, the gradient optimization mechanism in the look-forward phase of step S3 includes:

[0027] S311, the L layer of the decoder is divided into a coarse-grained detection stage and a fine-grained detection stage, namely the first k layer and the last Lk layer, where k is an integer from 1 to L-1;

[0028] S312, In the coarse-grained detection stage, gradient separation is applied to the i-th layer, based on the input box of the (i-1)-th layer. Calculate the prediction box of the i-th layer The calculation formula is:

[0029] ;

[0030] in, The gradient separation function is... It is a feedforward neural network. The calculation process for the i-th layer decoder is as follows: For the input box of the i-th layer, For the (i-1)th level decoding query, i≤k;

[0031] S313, In the fine-grained detection stage, gradient propagation is enabled for the j-th layer, based on the input box of the (j-1)-th layer. Calculate the prediction box of the j-th layer :

[0032] ;

[0033] in, It is a feedforward neural network. For the calculation process of the j-th layer decoder, For the input box of the j-th layer, For the (j-1)th layer decoding query, j>k.

[0034] Preferably, the hybrid query reselection strategy in step S2 includes generating initial anchor boxes for auxiliary branches based on a sub-network of a convolutional neural network. The construction steps of the sub-network are as follows:

[0035] The sub-network input end is sequentially connected with three continuous 3*3 convolution layers, GroupNorm layers and ReLU activation function layers to preliminarily process the encoding features;

[0036] The preliminary processing result is divided into a classification branch and a regression branch, each branch comprising a 3*3 convolution layer, a GroupNorm layer, a ReLU activation function layer and a feedforward neural network, and respectively outputting a target category probability and a bounding box coordinate;

[0037] The outputs of the classification branch and the regression branch are fused to generate high-quality initial anchor boxes for assisting the initialization of branch queries.

[0038] Preferably, the mixed query reselection strategy further comprises:

[0039] The high-quality initial anchor boxes generated by the sub-network are used to initialize the content query of the auxiliary branch;

[0040] The content query of the main branch is set as a learnable parameter, and the initialization mode of the remaining queries is consistent with the mixed query selection strategy, that is, the anchor boxes preliminarily screened based on the encoding features are used for initialization.

[0041] Preferably, the redundant query screening strategy in step S3 comprises:

[0042] During the processing of the i-th layer to the i+1-th layer of the decoder, the decoding queries output by the i-th layer are screened by using a non-maximum suppression (NMS) algorithm: the prediction box with the highest confidence is retained, and other prediction boxes with an intersection over union (IoU) greater than a preset threshold are removed, to obtain non-redundant queries after screening;

[0043] The screened redundant queries are shielded by using an attention mask, wherein the positions with a value of 0 in the attention mask correspond to the retained non-redundant queries, and the positions with a value of 1 correspond to the redundant queries, so as to reduce the calculation consumption of the redundant queries.

[0044] Preferably, the redundant query screening strategy is applied to the intermediate processing process between the decoder layers, rather than the post-processing step of the prediction result, so that the model maintains the end-to-end training characteristics, and the initial training pressure of the model is reduced by reducing the number of redundant queries.

[0045] Preferably, the loss function The classification loss in the loss function adopts a Focalloss loss function aiming at solving the problem of extremely unbalanced positive and negative samples in dense target detection, so as to solve the class imbalance problem; the regression loss comprises an L1 loss and a GIoU loss, so as to improve the positioning accuracy of the bounding box.

[0046] Preferably, the dynamic component allocation strategy processes the main branch query and the auxiliary branch query in parallel through an attention mask, wherein the region with a value of 0 in the attention mask corresponds to the independent calculation space of the main branch and the auxiliary branch, and the region with a value of 1 shields the information interference between the branches to avoid additional training consumption.

[0047] Preferably, the gradient separation of the coarse-grained detection stage blocks the inter-layer gradient back propagation through a detach function, so that each layer learns the prior information independently to achieve the target rough positioning; and the fine-grained detection stage enables the gradient propagation, so that the decoding result of the subsequent layer reversely guides the parameter learning of the previous layer to achieve the target accurate positioning.

[0048] The application discloses a neural network target detection training method based on dynamic component allocation and gradient optimization.

[0049] The application dynamically calculates a supervision signal coefficient λ based on the number of real boxes and the total number of decoding queries through the dynamic component allocation strategy, balances the positive and negative sample ratios of the main branch and the auxiliary branch, makes the loss calculation more consistent with the data distribution, reduces the influence of positive and negative sample imbalance on the model generalization capability, and improves the classification and regression accuracy.

[0050] The application uses the gradient optimization mechanism of the forward-looking stage to distinguish the gradient propagation modes of coarse-grained detection and fine-grained detection, uses gradient separation to avoid inter-layer interference in the coarse-grained stage, enables gradient propagation in the fine-grained stage to realize the guidance of the later result to the earlier result, effectively improves the target positioning accuracy, and accelerates the model convergence speed.

[0051] The application uses the mixed query reselection strategy to generate high-quality initial anchor boxes through a subnetwork based on a convolutional neural network, provides accurate initialization input for the auxiliary branch, reduces the noise introduced by low-quality anchor boxes, enhances the strong supervision stability of the auxiliary branch, and improves the consistency of the training process.

[0052] The application uses the redundant query screening strategy to screen and shield redundant queries through the non-maximum suppression screening between the decoder layers and the attention mask, eliminates redundant queries, reduces invalid calculation consumption, reduces the initial training pressure of the model, improves the training efficiency while maintaining the end-to-end characteristics.

[0053] The application balances the positive and negative samples, optimizes the gradient propagation, improves the initialization quality, and eliminates redundant queries, significantly improves the detection accuracy of targets (especially small targets and dense targets) in the image of an unmanned aerial vehicle, accelerates the model training convergence speed, and meets the actual needs of the unmanned aerial vehicle scene for detection performance and efficiency. BRIEF DESCRIPTION OF DRAWINGS

[0054] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description only constitute some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings.

[0055] Figure 1 The framework diagram of the neural network target detection training method of the present application;

[0056] Figure 2 The decoder attention mask diagram of the present application;

[0057] Figure 3 The subnetwork structure diagram based on the convolutional neural network of the present application;

[0058] Figure 4 The structure diagram of the redundancy query screening strategy of the present application. DETAILED DESCRIPTION

[0059] The technical solutions in the embodiments of the present application will be described clearly and completely below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments only constitute some embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the present application.

[0060] The present application provides a neural network target detection training method based on dynamic component allocation and gradient optimization (EM-DETR, an end-to-end unmanned aerial vehicle image target detection model) as shown in Figures 1-4 S1, extracting initial features of an unmanned aerial vehicle image through a backbone network, generating coding features after enhancement by a multi-layer encoder; S2, initializing decoding queries based on a hybrid query reselection strategy, the decoding queries including a main branch query and an auxiliary branch query, so as to improve the initial anchor frame quality of the auxiliary branch; S3, in the decoder training process, adopting a dynamic component allocation strategy to dynamically balance the positive and negative sample ratio, realizing gradient separation and directional propagation of coarse-grained detection and fine-grained detection through a gradient optimization mechanism in the forward-looking stage, and combining a redundancy query screening strategy to eliminate redundant queries between decoder layers; S4, constructing a total loss function based on the sum of the main branch loss and the auxiliary branch loss, optimizing model parameters through the total loss function, and completing the training of the unmanned aerial vehicle image target detection model.

[0061] The dynamic component allocation strategy in step S3 includes: S301, constructing a main branch query set and an auxiliary branch query set wherein the main branch query is processed by an L-layer decoder to generate an L set of main branch prediction results , the auxiliary branch query is processed by the L-layer decoder to generate an L set of auxiliary branch prediction results ; S302, each layer of the main branch prediction results is associated with the ground truth box G, and the main branch loss is calculated , and the calculation formula is: ; wherein, is a loss function, represents the prediction result of the i-th layer; S303, according to the number of ground truth boxes and the total number of decoded queries , a supervision signal coefficient λ is calculated, and the calculation formula is: ; wherein, r is the ratio of negative samples to positive samples, and takes a value of 1-9; S304, each layer of the auxiliary branch prediction results is associated with the ground truth box multiplied by λ, and the auxiliary branch loss is calculated , and the calculation formula is: ; wherein, represents the prediction result of the i-th layer of the auxiliary branch; S305, the total loss function is and , the classification loss in the loss function uses a Focal loss (Focal Loss is a loss function specially designed to solve the class imbalance problem in object detection, proposed by He Kai-ming team in the paper "Focal Loss for Dense Object Detection" in 2017. Its core idea is to dynamically reduce the weight of easy-to-classify samples, so that the model pays more attention to difficult-to-classify samples, thereby significantly improving the detection performance in dense scenes) loss function to solve the class imbalance problem; the regression loss includes L1 loss and GIoU (GIoU is a loss function for bounding box regression in the field of object detection, proposed by Rezatofighi et al. in the paper "Generalized Intersection over Union: A Metric and A Loss for Bounding Box Regression" in 2019. Its core improvement is to solve the problem of gradient disappearance when the predicted box and the ground truth box do not overlap in traditional IoU, while retaining the scale invariance of IoU) loss, which is used to improve the positioning accuracy of the bounding box, and the dynamic component allocation strategy processes the main branch query and the auxiliary branch query in parallel through an attention mask, wherein the region with a value of 0 in the attention mask corresponds to the independent calculation space of the main branch and the auxiliary branch, and the region with a value of 1 shields the information interference between the branches, so as to avoid additional training consumption.

[0062] To accelerate the training speed, DGA (Dynamic Group Assignment) adopts attention mask to process two branches in parallel, as shown in Figure 2 Figure (green blocks represent values of 0, and gray blocks represent values of 1). This method not only prevents mutual interference between the two branches, but also avoids additional training consumption. The experimental part gives detailed comparison results of DGA and mixed branch strategy. In summary, DGA enhances the model's learning ability for data distribution by stabilizing the ratio of positive and negative samples. Compared with the mixed branch strategy, the method in this section is closer to the traditional one-to-many label assignment process of traditional target detectors.

[0063] In step S3, the gradient optimization mechanism of the look forward stage includes: S311, dividing the L layers of the decoder into a coarse-grained detection stage and a fine-grained detection stage, which are the first k layers and the last L-k layers, respectively, where k is an integer from 1 to L-1; S312, in the coarse-grained detection stage, gradient separation is used for the i-th layer, and based on the input box Calculate the i-th layer prediction box , the calculation formula is: ; wherein, is the gradient separation function, is the feedforward neural network, is the i-th layer decoder calculation process, is the input box of the i-th layer, is the i-1-th layer decoding query, i≤k; S313, in the fine-grained detection stage, gradient propagation is enabled for the j-th layer, and based on the input box Calculate the j-th layer prediction box : ; wherein, is the feedforward neural network, is the j-th layer decoder calculation process, is the input box of the j-th layer, is the j-1-th layer decoding query, j>k, through the LFS (Look Forward Stage, gradient optimization mechanism of the look forward stage), the model not only avoids the loss of interlayer information, but also eliminates information bias, thereby accelerating the model convergence speed, the gradient separation of the coarse-grained detection stage is blocked by the Detach (Detach function is a basic operation for gradient separation in deep learning frameworks such as PyTorch and TensorFlow, its core function is to separate the tensor from the computation graph, preventing gradient backpropagation to the calculation node before the tensor) function. The gradient is blocked between layers to make each layer learn the prior information independently to achieve rough positioning of the target; the fine-grained detection stage enables gradient propagation to make the decoding results of subsequent layers guide the parameter learning of the early stage to achieve accurate positioning of the target.

[0064] To solve the problem of low anchor quality for the auxiliary branch initialization, the MQR (Mixed Query Re-Selection) method adopts an innovative solution: a subnetwork based on convolutional neural network is designed specifically for initializing the auxiliary branch. The design of this subnetwork is inspired by the region proposal network in two-stage object detectors, which uses convolutional layers and feedforward neural networks in combination with a sliding window mechanism to directly regress high-quality anchor boxes from the encoded features. The structure of this subnetwork is shown in Figure 3 This way, the subnetwork can focus on identifying the location of potential objects from the encoded features of the image, generating anchor boxes that are not only accurate but also reliable, providing an ideal initialization input for the auxiliary branch. The mixed query re-selection strategy in step S2 includes a subnetwork based on convolutional neural network generating the initial anchor box of the auxiliary branch, and the construction steps of the subnetwork are as follows: the input end of the subnetwork is connected with 3 consecutive 3x3 convolutional layers, GroupNorm layers (GroupNorm is a normalization technique proposed by Wu and He in their 2018 paper "Group Normalization", which is used to replace Batch Normalization (BN). The core idea is to divide the input feature channels into multiple groups, and calculate the mean and variance independently for each group to normalize), and ReLU (Rectified Linear Unit, a nonlinear activation function) activation function layers, which perform preliminary processing on the encoded features; the preliminary processing results are divided into classification branch and regression branch, each branch contains 3x3 convolutional layers, GroupNorm layers, ReLU activation function layers and feedforward neural networks, which respectively output target class probability and boundary box coordinates; the outputs of the classification branch and the regression branch are fused to generate high-quality initial anchor boxes for the initialization of the auxiliary branch query. Through this carefully designed structure, the subnetwork can ensure that the auxiliary branch has higher precision initial values, thereby better achieving its strong supervision effect. This method effectively alleviates the noise problem introduced by anchor boxes with lower scores, improving the stability of the auxiliary branch.

[0065] The mixed query reselection strategy further includes: initializing the content query of the auxiliary branch by using the high-quality initial anchor frame generated by the sub-network; and setting the content query of the main branch as a learnable parameter, and initializing the remaining queries in a manner consistent with the mixed query selection strategy, that is, initializing based on the anchor frame preliminarily screened based on the encoded features. In view of the problem that the content query of the auxiliary branch lacks prior knowledge support, the MQR method adopts an effective strategy: using the high-quality anchor frame regressed by the sub-network to initialize the content query of the auxiliary branch, and the initialization method of the remaining queries remains the same as MQS. The design of this method takes into account that, in the target detection training process, the inconsistency of the optimization targets in adjacent rounds is one of the main reasons leading to unstable training. This inconsistency often originates from the use of anchor frames preliminarily screened based on encoded features, and the accuracy of these anchor frames is insufficient, which makes it difficult for the model to quickly and accurately locate the optimization target of each query. By using the high-quality anchor frame regressed by the sub-network to initialize the content query of the auxiliary branch, the MQR effectively solves this problem. These high-quality bounding boxes provide a more accurate starting point for the model, enabling the content query of the auxiliary branch to quickly determine the correct optimization direction. And because the auxiliary branch adopts a one-to-many label assignment scheme, each target is supervised by multiple queries, so the inconsistency problem of the optimization target between different training rounds does not occur in the decoding query auxiliary branch. Compared with MQS, the MQR method effectively stabilizes the decoding training process. The effect of this improvement will be demonstrated in detail in the experimental section. This shows that a carefully designed query initialization strategy can improve the training efficiency and detection effect of the target detection model in complex scene and multi-target detection tasks.

[0066] In the step S3, the redundant query screening strategy includes: in the processing process of the i th layer to the i+1 th layer of the decoder, the decoding query output by the i th layer is screened by using a Non-Maximum Suppression (NMS, which is an existing technical algorithm in the field of target detection in computer vision, and is used to eliminate redundant detection boxes) algorithm: the prediction box with the highest confidence is retained, and other prediction boxes with an Intersection over Union (IoU, which is an existing technical index for measuring the overlap degree of two regions in computer vision) greater than a preset threshold are removed, to obtain non-redundant queries after screening; and the screened redundant queries are shielded by using an attention mask, wherein the positions with a value of 0 in the attention mask correspond to the retained non-redundant queries, and the positions with a value of 1 correspond to the redundant queries, so as to reduce the calculation consumption of the redundant queries. The redundant query screening strategy is applied to the intermediate processing process between the layers of the decoder, rather than the post-processing step of the prediction result, so that the model maintains the end-to-end training characteristic, and the initial training pressure of the model is reduced by reducing the number of redundant queries.

[0067] The binary matching mechanism simplifies the processing flow by eliminating many complex manually designed components. However, due to the instability exhibited by binary matching in the early training phase, it requires a long training period to converge fully. Research shows that the instability of binary matching is mainly due to a large number of unnecessary decoding queries. These redundant queries may mislead the model during training, causing it to mistakenly identify them as correct bounding boxes, thus consuming a lot of training resources. To address this issue, this paper uses a Duplicate Query Selection (DQS) strategy, the structure of which is as follows: Figure 4 As shown, this method primarily employs the NMS algorithm to filter decoded queries. NMS, a widely used post-processing technique in traditional object detection, reduces redundancy in predictions by selecting the predicted bounding box with the highest confidence and excluding other bounding boxes that highly overlap with it. The DQS method borrows the core idea of ​​NMS, effectively eliminating redundant queries by filtering queries between decoder layers. This not only alleviates the initial training pressure on the model but also improves the accuracy and efficiency in determining the optimization objective. To minimize the impact on model training performance, DQS cleverly uses attention masks to reduce the computation of redundant queries. The advantage of this method is that it does not add additional model parameters and has only a minimal impact on computational efficiency. Importantly, DQS technology is applied during the inter-layer processing of the decoder, rather than as a post-processing step for the prediction results. This means that DETR-type models using DQS technology still maintain end-to-end characteristics. This design ensures both high efficiency in model processing and preserves the model's simplicity and end-to-end training and inference capabilities.

[0068] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A neural network target detection training method based on dynamic component allocation and gradient optimization, characterized in that, The method comprises the following steps: S1, extracting initial features of the UAV image through the backbone network, and generating encoded features after enhancement by a multi-layer encoder; S2, initializing the decoding query based on a mixed query reselection strategy, wherein the decoding query comprises a main branch query and an auxiliary branch query; S3, in the decoder training process, a dynamic group allocation strategy is used to dynamically balance the proportion of positive and negative samples, and a gradient optimization mechanism in the forward-looking stage is used to realize gradient separation and directional propagation of coarse-grained detection and fine-grained detection, and a redundant query screening strategy is used to remove redundant queries between decoder layers; S4, constructing a total loss function based on the sum of the main branch loss and the auxiliary branch loss, optimizing the model parameters through the total loss function, and completing the training of the UAV image target detection model.

2. The neural network target detection training method based on dynamic component allocation and gradient optimization according to claim 1, characterized in that, The dynamic group allocation strategy in step S3 comprises: S301, construct a main branch query set and an auxiliary branch query set wherein the main branch query is processed by an L-layer decoder to generate an L set of main branch prediction results and the auxiliary branch query is processed by the L-layer decoder to generate an L set of auxiliary branch prediction results ; S302, each layer main branch prediction result is matched by dichotomy Associated with the true box G, the main branch loss is calculated The calculation formula is: ; wherein, is a loss function, denotes the prediction result of the i-th layer; S303, according to the number of real frames and the total number of decoded queries , the supervision signal coefficient λ is calculated, and the calculation formula is: ; Wherein, r is the ratio of negative samples to positive samples, and the value is 1-9; S304, preform the auxiliary branch prediction result of each layer by dichotomy matching Calculate auxiliary branch loss associated with λ times real box The calculation formula is: ; wherein, represents the prediction result of the i-th layer auxiliary branch; S305, the total loss function is the sum of the sum of 3.The neural network target detection training method based on dynamic component allocation and gradient optimization of claim 1, wherein, The gradient optimization mechanism in the forward-looking stage in step S3 comprises: S311, dividing the L layers of the decoder into a coarse-grained detection stage and a fine-grained detection stage, which are the first k layers and the last L-k layers respectively, wherein k is an integer between 1 and L-1; S312, in the coarse-grained detection stage, gradient separation is adopted for the i-th layer, and the input box based on the (i-1)-th layer Calculate the i-th layer prediction box The calculation formula is: ; wherein, is a gradient separation function, is a feed forward neural network, is an i-th layer decoder computation process, is an input box of the i-th layer, is an i-1-th layer decoding query, i≤k; S313, in the fine-grained detection stage, open gradient propagation for the jth layer based on the input box of the (j-1)th layer Calculate the jth layer prediction box : ; wherein, is a feedforward neural network, is a jth layer decoder computation process, is an input box for the jth layer, is a j-1th layer decoding query, j>k.

4. The neural network target detection training method based on dynamic component allocation and gradient optimization according to claim 1, characterized in that, The mixed query reselection strategy in step S2 comprises generating an auxiliary branch initial anchor box based on a convolutional neural network subnetwork, and the construction steps of the subnetwork are as follows: The input end of the subnetwork is connected with three consecutive 3*3 convolution layers, a GroupNorm layer and a ReLU activation function layer in sequence, and the encoded features are preliminarily processed; The preliminary processing results are divided into a classification branch and a regression branch, each branch comprises a 3*3 convolution layer, a GroupNorm layer, a ReLU activation function layer and a feedforward neural network, and outputs target class probability and boundary box coordinates respectively; The outputs of the classification branch and the regression branch are fused to generate high-quality initial anchor boxes for the initialization of the auxiliary branch query.

5. The neural network target detection training method based on dynamic component allocation and gradient optimization according to claim 4, characterized in that, The mixed query reselection strategy further comprises: The high-quality initial anchor boxes generated by the subnetwork are used to initialize the content query of the auxiliary branch; The content query of the main branch is set as a learnable parameter, and the initialization mode of the remaining queries is consistent with the mixed query selection strategy, that is, the anchor boxes preliminarily screened based on the encoded features are used for initialization.

6. The neural network target detection training method based on dynamic component allocation and gradient optimization according to claim 1, characterized in that, The redundant query screening strategy in step S3 comprises: In the processing process of the i-th layer to the i+1-th layer of the decoder, the decoding queries output by the i-th layer are screened by using a non-maximum suppression algorithm: the prediction box with the highest confidence is retained, and other prediction boxes with an intersection over union greater than a preset threshold are removed, to obtain non-redundant queries after screening; The screened redundant queries are shielded by using an attention mask, wherein the positions with a value of 0 in the attention mask correspond to the retained non-redundant queries, and the positions with a value of 1 correspond to the redundant queries.

7. The neural network target detection training method based on dynamic component allocation and gradient optimization according to claim 6, characterized in that, The redundant query screening strategy is applied to the intermediate processing process between the decoder layers, rather than the post-processing step of the prediction result, so that the model maintains the end-to-end training characteristics, and the initial training pressure of the model is reduced by reducing the number of redundant queries. 8.The neural network target detection training method based on dynamic component allocation and gradient optimization of claim 2, wherein, The loss function The classification loss in the loss function adopts a Focalloss loss function to solve the class imbalance problem; the regression loss includes an L1 loss and a GIoU loss to improve the positioning accuracy of the bounding box. 9.The neural network target detection training method based on dynamic component allocation and gradient optimization of claim 2, wherein, The dynamic component allocation strategy processes the main branch query and the auxiliary branch query in parallel through an attention mask, wherein a region with a value of 0 in the attention mask corresponds to an independent calculation space of the main branch and the auxiliary branch, and a region with a value of 1 masks information interference between the branches.

10. The neural network target detection training method based on dynamic component allocation and gradient optimization according to claim 3, characterized in that, The gradient separation of the coarse-grained detection stage blocks the inter-layer gradient back propagation through a Detach function, so that each layer learns the prior information independently to achieve the target rough positioning; and the fine-grained detection stage enables gradient propagation, so that the decoding results of subsequent layers reversely guide the parameter learning of the previous layers.