A directional object detection method based on oriented ellipse and ranking-guided alignment loss

Through the method of directed ellipse and ranking guidance alignment loss, the angular discontinuity and classification-positioning inconsistency in directed object detection are solved, and higher prediction stability and accuracy are achieved, and are suitable for multi-directional object detection tasks such as remote sensing images.

CN120339846BActive Publication Date: 2025-08-15NANJING UNIV OF INFORMATION SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510771962.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-11
Publication Date
2025-08-15
Estimated Expiration
2045-06-11

AI Technical Summary

Technical Problem

The existing directional object detection model has problems such as discontinuous angles, blurred corner points and uncertain directions, and the classification and positioning tasks are inconsistent, which affects the detection accuracy and stability.

Method used

Directional ellipses are used to replace traditional rectangular bounding boxes, combined with ranking guidance alignment loss and multi-candidate matching mechanism, feature extraction and prediction are performed through Transformer model, Hungarian matching algorithm is introduced to optimize sample allocation, and stable regression process is stabilized through Cholesky decomposition.

Benefits of technology

The prediction stability and directional accuracy of directional target detection are improved, the consistency between classification and positioning is enhanced, the angular discontinuity and classification-positioning misalignment are solved, and the detection accuracy and rationality of sample allocation are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120339846B_ABST
    Figure CN120339846B_ABST
Patent Text Reader

Abstract

This invention belongs to the field of target detection and recognition. It discloses a method for directional target detection based on oriented ellipses and ranking-guided alignment loss. The method first uses a Transformer to extract multi-scale image features. A query vector and features are then used to generate candidate bounding boxes. A multi-candidate matching mechanism is introduced to improve the quality of positive samples. KL divergence is then used to calculate the ellipse positioning loss. A loss function is constructed by combining classification scores and angle consistency to guide the model to focus on high-quality predictions. Finally, a dynamic angle adjustment factor is introduced to accommodate targets of different shapes. This method uses an oriented ellipse representation to address the angular discontinuity and ambiguity of traditional bounding boxes. This method improves positioning accuracy and directional perception while enhancing the consistency between classification and positioning. It is suitable for multi-directional target detection tasks such as remote sensing images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to long-term target detection and recognition technology, and in particular to a directional target detection method based on oriented ellipse and ranking-guided alignment loss. Background Art

[0002] Directed object detection is an important research area in the field of object detection. Compared with traditional horizontal bounding box detection methods, directional object detection can more accurately represent the target's position and orientation information by using methods such as rotated bounding boxes or point set localization. This feature is particularly critical in natural scenes (such as vehicles in traffic scenes) and remote sensing imagery (such as aircraft and ships), because objects in these scenes often exhibit multi-angle distribution, dense arrangement, or significant aspect ratio differences. Traditional horizontal detection boxes in such situations easily introduce a large amount of background interference and have difficulty closely fitting the actual shape of the object, which limits positioning accuracy and scene understanding.

[0003] Current methods for oriented object detection can be categorized based on bounding box representation: oriented bounding box methods (OBB), quadrilateral bounding box methods (QBB), and point set representation methods (PS). Initially proposed methods for oriented object detection generally employed rotated bounding boxes. For example, the R²CNN proposed by Jiang et al. built on Faster R-CNN by introducing rotated candidate boxes, improving the detection accuracy of objects at arbitrary angles (such as scene text). The RRPN designed by Ma et al. introduced rotated anchor boxes and rotated RoIPooling, enabling the model to directly generate tilted candidate boxes with orientation information and accurately extract features. The RoITransformer proposed by Ding et al. uses a spatial geometric transformation module (RRoILearner) to learn the offset from the horizontal RoI to the rotated RoI. Combined with the rotated RoIAlign, it effectively improves the localization accuracy of rotated objects. To improve detection accuracy and robustness, Yang et al. proposed R3Det. This alleviates the angular sensitivity of objects with large aspect ratios by using a progressive regression mechanism from horizontal to rotated boxes, combined with a feature reconstruction module and an approximate SkewIoU loss. Han et al. proposed S²A-Net, which addresses the problem of misalignment between features and anchor boxes by introducing an anchor box refinement and feature alignment mechanism (FAM), as well as a direction detection module (ODM) with a classification / regression separation design, significantly improving the model's expressiveness and positioning consistency.

[0004] However, existing bounding box methods may suffer from angular discontinuities. For example, bounding boxes at 0° and 359° may produce significantly different results due to loss calculation issues. The QBB method also faces the problem of ambiguous corner point representation. Inconsistent point representation orders can lead to mismatches between predictions and ground truth, resulting in errors. Point set representation methods (PS) also suffer from uncertainty in directional perception, which can result in large regression errors.

[0005] In addition, current directional target detection models generally have the problem of inconsistency between classification and positioning tasks, that is, samples with high classification confidence do not necessarily have good positioning quality, and vice versa, which seriously affects the accuracy and stability of the detector. Summary of the Invention

[0006] Purpose of the invention: The purpose of the present invention is to address the deficiencies in the prior art and to provide a method for detecting oriented targets based on oriented ellipses and ranking-guided alignment losses. The oriented ellipses replace the traditional rectangular bounding boxes, and utilize their advantages of continuity, rotational symmetry, and compact parameters to solve problems such as angle discontinuity, corner ambiguity, and direction uncertainty. While maintaining geometric expression capabilities, the method provides higher prediction stability and direction accuracy. In order to enhance the consistency between classification and positioning, the ranking-guided alignment loss is introduced as the main loss function, and the multi-candidate matching mechanism MCMS based on the Hungarian matching algorithm is used to improve the quality distribution of positive and negative samples, thereby achieving end-to-end accurate detection of oriented targets.

[0007] Technical solution: A method for detecting directional targets based on oriented ellipses and ranking-guided alignment loss in the present invention comprises the following steps:

[0008] Step 1: For the input image, first extract the features through the pre-trained backbone network to generate the initial feature map ;

[0009] The obtained initial feature map is flattened and embedded in the position code, and then input into the Transformer model. The encoder of the Transformer model models the global context relationship through the self-attention mechanism, so that the features of each position dynamically aggregate the information of all other positions in the image, and finally obtains a set of image token representations containing global context information. The image token representation is used for the location and recognition of the target in the subsequent decoder. ;

[0010] Step 2: For the image token representation obtained in step 1, first, in the decoder of the Transformer model, a set of learnable query vectors Query is used to interact with the output features of the encoder, that is, the cross-attention mechanism is used to focus on potential areas of interest and gradually decode the preliminary prediction results, including the preliminary predicted target bounding box. and preliminary classification scores and positioning score ; Then predict the target bounding box Inverse transformation to oriented elliptical target bounding box ;

[0011] Then, for the prediction results of decoders at different layers, a multi-candidate matching strategy MCMS is introduced, using the parameters To expand the number of ground-truth bounding boxes, thereby enhancing the coverage of positive samples and obtaining real boxes;

[0012] Finally, a cost matrix is constructed based on multiple cost indicators such as classification, positioning, and angle. And complete the one-to-one matching between the predicted box and the real box through the Hungarian matching method;

[0013] Step 3: For the classification score obtained in step 2 and positioning score Calculate the classification loss separately and positioning loss Optimize, the specific method is:

[0014] For the obtained classification scores and positioning scores, dynamic weights based on ranking are introduced into them, and the results are unified through joint alignment loss to obtain the final loss result;

[0015] At the same time, considering the impact of different aspect ratio targets on the angle, a dynamic adjustment factor is used Make adjustments and calculate the corresponding angle loss .

[0016] The oriented elliptical target bounding box of the present invention is denoted as ,in are the coordinates of the center point of the oriented ellipse, The result of Cholesky decomposition of the covariance matrix of the oriented ellipse is obtained by utilizing the symmetric positive definiteness of the covariance matrix, thereby better simplifying the calculation and regressing the oriented ellipse. In addition, the present invention also proposes a related improvement method for the classification-positioning misalignment problem, and proposes a multi-candidate matching MCMS and ranking-guided classification loss. To alleviate the classification-localization misalignment problem in oriented target detection.

[0017] Furthermore, the detailed process of step 1 is as follows:

[0018] Step 1.1 Input image Generate a set of 5-layer multi-scale feature maps through the pre-trained backbone network Backbone (such as ResNet50, Swin Transformer) , where each layer of feature map ; In order to reduce the amount of calculation, multi-layer feature maps are usually selected and through Convolution compresses the channels to Dimension, get the initial feature map ;

[0019] Initial feature map Flattened into dimensional space dimensions sequence , and superimpose the sinusoidal position code , as follows:

[0020] ;

[0021] Step 1.2, the encoder of the Transformer model consists of 6 layers of identical stacked structures, each layer of which includes multi-head self-attention MSA and feedforward network FFN. Layer Input , and its corresponding output The calculation is as follows:

[0022] ;

[0023] ;

[0024] in, , The m-th layer encoder is the output of the encoder after adding the residual and normalizing it after the multi-head self-attention mechanism. is the final result of the m-th layer encoder, MSA is achieved by The head will dimensional input is split into indivual Dimensional subspace, calculate attention weight :

[0025] ;

[0026] in, is the weight matrix used for linear transformation in the self-attention mechanism;

[0027] Finally, the encoder output of the Transformer model is , The global context information is aggregated, that is, F0 is processed by six layers of encoder and outputs F6.

[0028] Furthermore, the detailed process of step 2 is as follows:

[0029] Step 2.1: In the decoding phase, a set of learnable query vectors Multi-scale features output by the encoder The process of each decoder layer is as follows: first, the deformable cross-attention is used for calculation, then the query vector is updated through self-attention (SA), and finally the output is output through the feed-forward network (FFN).

[0030] ;

[0031] ;

[0032] ;

[0033] Among them, the output of each layer decoder Both predict the target bounding box through the linear projection layer , forming a preliminary classification score and positioning score ; is the coordinate of the center point of the prediction box, The parameters obtained by Cholesky decomposition of the prediction box covariance matrix;

[0034] Step 2.2: For the prediction results of each layer of Decoder in step 2.1, the ground-truth frame is copied through the multi-candidate matching mechanism MCMS. , increase the number of results obtained by the subsequent Hungarian matching method to expand the positive samples and obtain the real frame , as follows:

[0035] ;

[0036] The ground truth after the MCMS strategy is expanded is recorded as , ,in is the set expansion multiple;

[0037] Step 2.3: After expanding the true frame in step 2.2, construct a cost matrix for the predicted result and the expanded positive sample true frame. ,in Indicates the Prediction boxes With the Real frame The matching cost is calculated as follows:

[0038] ;

[0039] in, represents the ranking-guided classification loss, represents the positioning loss, represents the angle loss, Respectively represent the corresponding balance weights;

[0040] The optimal bipartite graph matching is solved by the Hungarian algorithm to ensure that each augmented ground truth box is assigned at most one prediction result, and unmatched predictions are regarded as negative samples.

[0041] Furthermore, step 2 obtains the oriented elliptical target bounding box based on Gaussian distribution , as follows:

[0042] For OBB bounding box representation , first convert it into a Gaussian distribution ,in represents the center coordinate of the Gaussian distribution, Represents the covariance matrix of the Gaussian distribution. The covariance matrix is calculated as follows:

[0043] ;

[0044] Will Simplified to ;

[0045] represents the rotation matrix, represents the eigenvalue diagonal matrix;

[0046] If and only if and hour, is a positive definite matrix, the equal probability contour of the Gaussian distribution is an ellipse, and the direct regression Need to limit This may lead to unstable gradients and poor training results.

[0047] To avoid constrained optimization problems, consider using Cholesky decomposition to parameterize the matrix as follows:

[0048] ;

[0049] ;

[0050] Through Cholesky decomposition, we only need to ensure It can satisfy The positivity of .

[0051] Furthermore, the detailed process of step 3 is as follows:

[0052] Step 3.1: Use Kullback-Leibler divergence to calculate the distance between the predicted box and the true box to obtain the positioning loss. , the formula is as follows:

[0053] ;

[0054] represents the prediction box, represents the ground truth box;

[0055] in, and Represent the coordinates of the prediction box, and They represent the corresponding covariance matrices, is the operator that computes the trace of a matrix;

[0056] The coordinates of the predicted box and the corresponding covariance matrix are calculated based on the oriented ellipse, as shown in the following formula:

[0057] ;

[0058] ;

[0059] Step 3.2: Ranking-guided classification loss The calculation formula is:

[0060] ;

[0061] In the above formula, is the balance weight of the ranking-based IoU-Classification, and the calculation formula is:

[0062] ;

[0063] In the above formula, The angle consistency term is introduced to take the effect of angle on the result into consideration. represents the ranking of the joint quality measure among all predictions, Indicates ranking-based The dynamic weight of is the parameter that controls the exponential decrease, A joint quality metric for balancing classification and localization;

[0064] ;

[0065] in, To balance the joint quality metric of classification and localization, is a hyperparameter to balance the classification score and localization score, represents the classification score, represents the positioning score;

[0066] The calculation is: ;

[0067] Step 3.3: Angle loss , considering the dynamic adjustment factor Dynamically adjust targets of different aspect ratios as follows:

[0068] ;

[0069] in, and The calculation formula is as follows:

[0070] ;

[0071] In the above formula, and is the covariance matrix The corresponding eigenvalues are two eigenvalues.

[0072] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages:

[0073] 1. In terms of bounding box representation, the present invention uses an oriented ellipse to more clearly and precisely characterize the position, size, and direction of the target, effectively alleviating problems that may arise with other types of bounding boxes in oriented target detection, such as the angle discontinuity and square-like problems that may arise with the OBB model, the fuzzy representation problem that may arise with the QBB model, and the difficulty in handling isotropic targets that may arise with the point set model. It can be seen that the use of an oriented elliptical target box can effectively improve the model's ability in bounding box alignment.

[0074] 2. To address the classification-localization misalignment issue, this paper uses RGA Loss to correlate classification scores with localization scores, making the classification scores IoU-aware. By introducing ranking-based dynamic weights, bounding boxes with relatively good joint quality can be effectively selected, while those with only a single good result can be eliminated.

[0075] 3. Regarding the distribution of positive and negative samples, this paper expands the positive samples through the MCMS strategy based on the original model, effectively alleviating the problem of missing positive samples caused by the DETR model. BRIEF DESCRIPTION OF THE DRAWINGS

[0076] Figure 1 This is a model structure diagram of the present invention;

[0077] Figure 2 It is a schematic diagram of the oriented ellipse representation of the present invention;

[0078] Figure 3 This is a flow chart for calculating the classification loss of the present invention;

[0079] Figure 4 This is a target detection result diagram obtained by using the prior art in the embodiment;

[0080] Figure 5 This is a target detection result diagram obtained by using the technical solution of the present invention in an embodiment. DETAILED DESCRIPTION

[0081] The technical solution of the present invention is described in detail below, but the protection scope of the present invention is not limited to the embodiments.

[0082] The present invention replaces the traditional rectangular bounding box structure with an oriented ellipse, and takes advantage of its continuity, rotational symmetry, and compact parameters to solve problems such as angle discontinuity, corner blur, and directional uncertainty. Compared with the OBB model, which is susceptible to angle jumps, the QBB model has point order confusion problems, and the Point Set method, which has difficulty in stably perceiving directionality, this method provides higher prediction stability and directional accuracy while maintaining geometric expression capabilities. In addition, to enhance the consistency between classification and positioning, the Rank-Guided Alignment Loss (RGA Loss) is introduced as the main loss function, and a Multi-Candidate Matching Strategy (MCMS) based on the Hungarian algorithm is designed to improve the quality distribution of positive and negative samples, thereby achieving end-to-end accurate detection of directional targets.

[0083] like Figure 1 As shown, the directional target detection method based on oriented ellipse and ranking-guided alignment loss of the present invention includes the following steps:

[0084] Step 1: For the input image, first extract the features through the pre-trained backbone network to generate the initial feature map ;

[0085] The initial feature map obtained After flattening and embedding the positional encoding, it is input into the Transformer model. The encoder of the Transformer model models the global contextual relationship through the self-attention mechanism, so that the features of each position dynamically aggregate the information of all other positions in the image, and finally obtain a set of image token representations containing global contextual information. ;

[0086] Step 2: For the image token representation obtained in step 1, first, in the decoder of the Transformer model, a set of learnable query vectors Query is used to interact with the output features of the encoder, that is, the cross-attention mechanism is used to focus on potential areas of interest and gradually decode the preliminary prediction results, including the preliminary predicted target bounding box. and preliminary classification scores and positioning score ; Then predict the target bounding box Inverse transformation to oriented elliptical target bounding box ;

[0087] Then, for the prediction results of decoders at different layers, a multi-candidate matching strategy MCMS is introduced, using the parameters To expand the number of ground-truth bounding boxes, thereby enhancing the coverage of positive samples and obtaining real boxes;

[0088] Finally, a cost matrix is constructed based on multiple cost indicators such as classification, positioning, and angle. (matching matrix), and complete the one-to-one matching between the predicted box and the real box through the Hungarian matching method;

[0089] Step 3: For the classification score obtained in step 2 and positioning score , respectively calculate the classification loss and positioning loss Optimize, the specific method is:

[0090] For the obtained classification scores and positioning scores, dynamic weights based on ranking are introduced into them, and the results are unified through joint alignment loss to obtain the final loss result; at the same time, considering the impact of different aspect ratio targets on the angle, a dynamic adjustment factor is used Make adjustments and calculate the corresponding angle loss .

[0091] This embodiment uses the Transformer as the backbone network, enhancing understanding of rotating targets in complex scenes through global context modeling. It replaces traditional anchor boxes or rotation boxes with oriented ellipses in the form of Gaussian distributions, and uses Cholesky decomposition to perform parameterized regression on the covariance matrix, effectively improving the model's convergence stability and directional expression capabilities. Furthermore, a Rank-Guided Alignment Loss (Rank-Guided Alignment Loss) is designed that integrates KL divergence, a ranking guidance mechanism, and angular consistency modeling, and introduces a multiple candidate matching strategy (MCMS). This addresses issues such as classification-localization inconsistency, angular discontinuity, and insufficient positive samples in traditional methods, achieving a comprehensive breakthrough in remote sensing target detection in terms of stability, accuracy, and geometric consistency.

[0092] The detailed process of step 1 of this embodiment is as follows:

[0093] Step 1.1 Input image Generate a set of 5-layer multi-scale feature maps through the pre-trained backbone network Backbone , where each layer of feature map ; Select multi-layer feature map and through Convolution compresses the channels to dimension, and obtain the initial feature map ;

[0094] Initial feature map Flattened into dimensional space dimensions sequence , and superimpose the sinusoidal position code , as follows:

[0095] ;

[0096] Step 1.2, the encoder of the Transformer model consists of 6 layers of identical stacked structures, each layer of which includes multi-head self-attention MSA and feedforward network FFN. Layer Input , and its corresponding output The calculation is as follows:

[0097] ;

[0098] ;

[0099] in, , The m-th layer encoder is the output of the encoder after adding residuals and normalization after the multi-head self-attention mechanism. is the final result of the m-th layer encoder, MSA is achieved by The head will dimensional input is split into indivual Dimensional subspace, calculate attention weight :

[0100] ;

[0101] in, is the weight matrix used for linear transformation in the self-attention mechanism;

[0102] Finally, the encoder output of the Transformer model is , Aggregates have global context information.

[0103] The detailed process of step 2 of this embodiment is as follows:

[0104] Step 2.1: In the decoding phase, a set of learnable query vectors Multi-scale features output by the encoder Through the interaction of multiple layers of Transformer Decoder, the processing flow of each layer of decoder is: first, the deformable cross attention calculation is performed, then the query vector is updated through self-attention, and finally the output is output through the feedforward network FFN, as follows:

[0105] ;

[0106] ;

[0107] ;

[0108] Among them, the output of each layer decoder Both predict the target bounding box through the linear projection layer , forming a preliminary classification score and positioning score ; is the coordinate of the center point of the prediction box, The parameters obtained by Cholesky decomposition of the prediction box covariance matrix;

[0109] Step 2.2: For the prediction results of each layer of Decoder in step 2.1, the ground-truth frame is copied through the multi-candidate matching mechanism MCMS. , to expand the positive sample and get the real frame , as follows: ;

[0110] The ground truth box expanded by the multi-candidate matching mechanism MCMS is recorded as , ;

[0111] Step 2.3: After expanding the true frame in step 2.2, construct a cost matrix for the predicted result and the expanded positive sample true frame. ,in Indicates the Prediction boxes With the Real frame The matching cost is calculated as follows:

[0112] ;

[0113] in, represents the ranking-guided classification loss, represents the positioning loss, represents the angle loss, Respectively represent the corresponding balance weights;

[0114] The optimal bipartite graph matching is solved by the Hungarian matching method to ensure that each augmented ground truth box is assigned at most one prediction result, and unmatched predictions are regarded as negative samples.

[0115] like Figure 2 As shown, this embodiment obtains the oriented elliptical target bounding box based on Gaussian distribution transformation , as follows:

[0116] For OBB bounding box representation , first convert it into a Gaussian distribution ,in represents the center coordinate of the Gaussian distribution, Represents the covariance matrix of the Gaussian distribution. The covariance matrix is calculated as follows:

[0117] ;

[0118] Will Simplified to ;

[0119] represents the rotation matrix, represents the eigenvalue diagonal matrix;

[0120] If and only if and hour, Is a positive definite matrix, the equiprobable contour of the Gaussian distribution is an ellipse;

[0121] To avoid constrained optimization problems, consider using Cholesky decomposition to parameterize the matrix as follows:

[0122] ;

[0123] ;

[0124] By Cholesky decomposition, we only need to ensure , then it satisfies The positivity of .

[0125] The above process uses an oriented ellipse representation modeled using a Gaussian distribution, expressing the target bounding box as a covariance matrix. This covariance matrix is parameterized via Cholesky decomposition. This not only effectively ensures positive definiteness and model regression stability, but also naturally embeds directional information into the overall shape representation of the ellipse, avoiding the discontinuity issues associated with explicit angular regression. Furthermore, the Kullback-Leibler (KL) divergence is introduced as a distribution difference metric to accurately measure the combined difference in shape and orientation between the predicted and true ellipses, thereby achieving a more stable, continuous, and geometrically consistent target regression optimization process.

[0126] like Figure 3 As shown, the detailed process of step 3 of this embodiment is as follows:

[0127] Step 3.1: Use Kullback-Leibler divergence to predict the box With real box The distance between them is calculated to get the positioning loss , the formula is as follows:

[0128] ;

[0129] in, and Represent the coordinates of the prediction box, and They represent the corresponding covariance matrices, is the operator for computing the trace of a matrix;

[0130] The coordinates of the predicted box and the corresponding covariance matrix are calculated based on the oriented ellipse, as shown in the following formula:

[0131] ;

[0132] ;

[0133] Step 3.2: Ranking-guided classification loss The calculation formula is:

[0134] ;

[0135] In the above formula, is the balance weight of the ranking-based IoU-Classification, and the calculation formula is:

[0136] ;

[0137] In the above formula, is the angle consistency term introduced, represents the ranking of the joint quality measure among all predictions, Indicates ranking-based The dynamic weight of is the parameter that controls the exponential decrease, A joint quality metric for balancing classification and localization;

[0138] ;

[0139] in, To balance the joint quality metric of classification and localization, is a hyperparameter to balance the classification score and localization score, represents the classification score, represents the positioning score;

[0140] The calculation is: ;

[0141] Step 3.3: Angle loss , considering the dynamic adjustment factor Dynamically adjust targets of different aspect ratios as follows:

[0142] ;

[0143] in, and The calculation formula is as follows:

[0144] ;

[0145] In the above formula, and is the covariance matrix The corresponding eigenvalues are two eigenvalues.

[0146] To verify the technical effect of the present invention, this example compares the technical solution of the present invention with the existing technology based on the DOTA data set. The comparison results are as follows: Figure 4 、 Figure 5 and as shown in Table 1.

[0147] Table 1

[0148]

[0149] Figure 4 To obtain the target detection results using existing technology, Figure 5 Target detection obtained by adopting the technical solution of the present invention.

[0150] It can be seen from the above embodiments that the present invention introduces a multi-candidate matching strategy MCMS in the allocation of positive and negative samples. By expanding multiple candidate matching pairs based on the original true frame, the Hungarian matching method is combined to achieve a one-to-one global optimal allocation of prediction results and true frames. It avoids the rigid dependence of fixed thresholds on sample selection and can achieve more reasonable matching between targets of different scales and angles. In addition, after the positive sample allocation is completed, a ranking guidance mechanism is introduced to calculate the joint quality index based on the classification score, positioning accuracy and angle consistency, and assign different optimization weights to the positive samples, thereby highlighting the training value of high-quality positive samples and suppressing the negative impact of mismatched samples. The present invention not only improves the accuracy and stability of sample allocation, but also significantly enhances the model's ability to focus on high-confidence targets, providing a stronger guarantee for the final detection performance.

Claims

1. A method for directional target detection based on oriented ellipses and ranking-guided alignment loss, characterized in that: The following steps are involved: Step 1: For the input image, first extract the features through the pre-trained backbone network to generate the initial feature map ; The initial feature map obtained After flattening and embedding the positional encoding, it is input into the Transformer model. The encoder of the Transformer model models the global contextual relationship through the self-attention mechanism, so that the features of each position dynamically aggregate the information of all other positions in the image, and finally obtain a set of image token representations containing global contextual information. ; Step 2: For the image token representation obtained in step 1, first, in the decoder of the Transformer model, a set of learnable query vectors Query is used to interact with the output features of the encoder, that is, the cross-attention mechanism is used to focus on potential areas of interest and gradually decode the preliminary prediction results, which include the preliminary predicted target bounding box. and preliminary classification scores and positioning score ; Then predict the target bounding box Inverse transformation to oriented elliptical target bounding box ; Then, for the prediction results of decoders at different layers, a multi-candidate matching strategy MCMS is introduced, using the parameters To expand the number of true bounding boxes, thereby enhancing the coverage of positive samples and obtaining true boxes; Finally, the cost matrix is constructed based on the classification, positioning and angle cost indicators And complete the one-to-one matching between the predicted box and the real box through the Hungarian matching method; Step 3: For the classification score obtained in step 2 and positioning score , respectively calculate the classification loss and positioning loss Optimize, the specific method is: For the obtained classification scores and positioning scores, dynamic weights based on ranking are introduced into them, and the results are unified through joint alignment loss to obtain the final loss result; at the same time, considering the impact of different aspect ratio targets on the angle, a dynamic adjustment factor is used Make adjustments and calculate the corresponding angle loss .

2. The method for directional target detection based on oriented ellipse and ranking-guided alignment loss according to claim 1, characterized in that: The detailed process of step 1 is as follows: Step 1.1 Input image Generate a set of 5-layer multi-scale feature maps through the pre-trained backbone network Backbone , where each layer of feature map ; Select multi-layer feature map and through Convolution compresses the channels to dimension, and obtain the initial feature map ; Initial feature map Flattened into dimensional space dimensions sequence , and superimpose the sinusoidal position code , as follows: ; Step 1.2, the encoder of the Transformer model consists of 6 layers of identical stacked structures, each layer of which includes multi-head self-attention MSA and feedforward network FFN. Layer Input , and its corresponding output The calculation is as follows: ; ; in, , The m-th layer encoder is the output of the encoder after adding the residual and normalizing it after the multi-head self-attention mechanism. is the final result of the m-th layer encoder, MSA is achieved by The head will dimensional input is split into indivual Dimensional subspace, calculate attention weight : ; in, is the weight matrix used for linear transformation in the self-attention mechanism; Finally, the encoder output of the Transformer model is , Aggregates have global context information.

3. The method for directional target detection based on oriented ellipse and ranking-guided alignment loss according to claim 1, characterized in that: The detailed process of step 2 is as follows: Step 2.1: In the decoding phase, a set of learnable query vectors Multi-scale features output by the encoder Through the interaction of multiple layers of Transformer Decoder, the processing flow of each layer of decoder is: first, the deformable cross attention calculation is performed, then the query vector is updated through self-attention, and finally the output is output through the feedforward network FFN, as follows: ; ; ; Among them, the output of each layer decoder Both predict the target bounding box through the linear projection layer , forming a preliminary classification score and positioning score ; is the coordinate of the center point of the prediction box, The parameters obtained by Cholesky decomposition of the prediction box covariance matrix; Step 2.2: For the prediction results of each layer of Decoder in step 2.1, the ground-truth frame is copied through the multi-candidate matching mechanism MCMS. , to expand the positive sample and get the real frame , as follows: ; The ground truth box expanded by the multi-candidate matching mechanism MCMS is recorded as , ; Step 2.3: After expanding the true frame in step 2.2, construct a cost matrix for the predicted result and the expanded positive sample true frame. ,in Indicates the Prediction boxes With the Real frame The matching cost is calculated as follows: ; in, represents the ranking-guided classification loss, represents the positioning loss, represents the angle loss, They represent the corresponding balance weights respectively; The optimal bipartite graph matching is solved by the Hungarian matching method to ensure that each augmented ground truth box is assigned at most one prediction result, and unmatched predictions are regarded as negative samples.

4. The method for directional target detection based on oriented ellipse and ranking-guided alignment loss according to claim 1 or 3, characterized in that: Step 2 obtains the oriented elliptical target bounding box based on Gaussian distribution transformation, as follows: For OBB bounding box representation , first convert it into a Gaussian distribution ,in represents the center coordinate of the Gaussian distribution, Represents the covariance matrix of the Gaussian distribution. The covariance matrix is calculated as follows: ; Will Simplified to ; represents the rotation matrix, represents the eigenvalue diagonal matrix; If and only if and hour, Is a positive definite matrix, the equiprobable contour of the Gaussian distribution is an ellipse; Finally, the Cholesky decomposition is used to parameterize the matrix as follows: ; ; By Cholesky decomposition, we only need to ensure , then it satisfies The positivity of .

5. The method for directional target detection based on oriented ellipse and ranking-guided alignment loss according to claim 1, characterized in that: The detailed process of step 3 is as follows: Step 3.1: Use Kullback-Leibler divergence to calculate the distance between the predicted box and the true box to obtain the positioning loss. , the formula is as follows: ; in, and Represent the coordinates of the prediction box, and They represent the corresponding covariance matrices, is the operator that computes the trace of a matrix; represents the prediction box, represents the ground truth box; The coordinates of the predicted box and the corresponding covariance matrix are calculated based on the oriented ellipse, as shown in the following formula: ; ; Step 3.2: Ranking-guided classification loss The calculation formula is: ; In the above formula, is the balance weight of the ranking-based IoU-Classification, and the calculation formula is: ; In the above formula, is the angle consistency term introduced, represents the ranking of the joint quality measure among all predictions, Indicates ranking-based The dynamic weight of is the parameter that controls the decline of the exponential, To balance the joint quality metrics of classification and localization, the following are given: ; in, is a hyperparameter to balance the classification score and localization score, represents the classification score, represents the positioning score; The calculation is: ; Step 3.3: Angle loss , considering the dynamic adjustment factor Dynamically adjust targets of different aspect ratios as follows: ; in, and The calculation formula is as follows: ; In the above formula, and is the covariance matrix The corresponding eigenvalues are two eigenvalues.

Citation Information

Patent Citations

  • Methods and system for multi-target tracking

    CN111527463A

  • Cow single target tracking method

    CN117671565A