Rotation target detection bounding box regression method based on Kullback Leibler divergence
By mapping the rotation box parameters into a two-dimensional Gaussian distribution and calculating the Kullback-Leibler divergence, the full parameter coupling and self-adjustment of the rotating object detector are achieved, which improves the detection accuracy and stability, solves the scale invariance and coupling problems of the rotating object detector in the existing technology, and is suitable for the horizontal detection framework.
Patent Information
- Application Number
- CN202510627128.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-15
- Publication Date
- 2025-09-26
AI Technical Summary
Existing rotating target detectors have difficulty in accurately locating targets with large aspect ratios, small sizes, and dense locations during the regression process. Existing methods, such as the Gaussian Wasserstein distance, also suffer from the problems of semi-coupling between the center point and the scale component and insufficient scale invariance.
A bounding box regression method for rotated object detection based on Kullback Leibler divergence is adopted. The rotation box parameters are mapped into a two-dimensional Gaussian distribution. The regression distance of full parameter coupling is obtained by calculating KLD. Nonlinear normalization and multi-task joint loss function are used to train the object detection network.
The performance of rotated target detection has been significantly improved, with particular emphasis on AP75, large aspect ratio, and dense scenes. It is scale-invariant and compatible with horizontal detection.
Smart Images

Figure CN120707975A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of computer vision and target detection, and relates to a bounding box regression method for detecting targets in arbitrary directions, and in particular to a bounding box regression method for detecting rotated targets based on Kullback Leibler divergence (KLD). Background Art
[0002] Most existing rotated object detectors directly inherit the loss function of horizontal bounding box detection (such as Smooth L1 and IoU family). Each parameter is optimized independently during the regression process, making it difficult to accurately locate objects with large aspect ratios, small sizes, and densely packed objects. Recent research has shown that after mapping the rotated bounding box to a two-dimensional Gaussian distribution, the distance between these distributions can be used to achieve coupled optimization properties. The Gaussian Wasserstein distance (GWD) has shown some advantages, but it still suffers from limitations such as semi-coupling of the center point and scale component and insufficient scale invariance. Summary of the Invention
[0003] The present invention provides a bounding box regression method for rotated object detection based on Kullback-Leibler divergence, which significantly improves the indicators of rotated object detection while maintaining the inference speed unchanged.
[0004] The purpose of the present invention is achieved through the following technical solutions:
[0005] A bounding box regression method for rotation object detection based on Kullback Leibler divergence includes the following steps:
[0006] Step 1: Feature prediction and decoding:
[0007] Step 1: Input the image to be detected, and the target detection network outputs five-dimensional offsets Δx, Δy, Δw, Δh, and Δθ, where Δx and Δy represent the normalized offsets of the center of the predicted box relative to the center of the prior box or feature point; Δw and Δh represent the logarithmic scale offsets of the width and height of the predicted box respectively; and Δθ represents the rotation angle difference between the predicted box and the prior box.
[0008] Step 1 and 2: Decode the predicted frame B based on the prior frame or feature points p (x p ,y p ,w p ,h p ,θ p ) and the real box B t (x t ,y t ,w t ,h t ,θ t ), where xp ,y p ,w p ,h p ,θ p Represents the prediction box B p The center horizontal and vertical coordinates, width and height, and rotation angle, x t ,y t ,w t ,h t ,θ t Represents the real box B t The center horizontal and vertical coordinates, width and height, and rotation angle;
[0009] Step 2: Map the rotation box to a two-dimensional Gaussian distribution:
[0010] The rotation box parameters (x, y, w, h, θ) are mapped to a two-dimensional Gaussian distribution N(μ, ∑), where μ = (x, y), ∑ = R·diag(w 2 / 4,h 2 / 4)·R T , R is the rotation matrix, which represents the two-dimensional rotation of angle θ, and x, y, w, h, θ represent the horizontal and vertical coordinates, width and height of the center of the rotation box, as well as the rotation angle;
[0011] Step 3: KLD regression distance D KLD calculate:
[0012]
[0013] Step 4: Nonlinear normalization and multi-task joint loss:
[0014] Step 4.1: Use nonlinear normalization to obtain the regression loss function L reg :
[0015] L reg =1-1 / (τ+f(D KLD ))
[0016] f(·) can be selected as sqrt(·) or ln(·+1), τ≥1
[0017] Step 4.2: Regression loss function L reg And the classification loss function L cls Jointly train the target detection network, and the total loss function L is:
[0018] L=λ1·L reg +λ2·L cls
[0019] In step 5, the inference phase only performs “feature prediction and decoding” and uses the object detection network trained in step 4 to output the rotated bounding box.
[0020] Compared with the prior art, the present invention has the following advantages:
[0021] 1. Full parameter coupling and self-adjustment: KLD gradient automatically adjusts the weight of each parameter according to the target size and angle, significantly improving the index, especially in AP 75 , large aspect ratio and dense scenes are better than GWD / SmoothL1.
[0022] 2. Scale invariance: KLD satisfies affine (including scale) invariance to avoid instability in small target regression.
[0023] 3. Horizontal detection compatibility: When θ = 0, it degenerates into the commonly used ln norm loss, which facilitates weight sharing in a unified framework. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 This is the test result of this embodiment;
[0025] Figure 2 The results are obtained without using this method. DETAILED DESCRIPTION
[0026] The technical solution of the present invention is further described below with reference to the accompanying drawings, but is not limited thereto. Any modification or equivalent replacement of the technical solution of the present invention that does not depart from the spirit and scope of the technical solution of the present invention should be included in the scope of protection of the present invention.
[0027] The present invention provides a bounding box regression method for rotating target detection based on Kullback Leibler divergence. First, the offset of the rotating box is predicted and the predicted box and the true box are mapped into a two-dimensional Gaussian distribution. The regression distance of the full parameter coupling is obtained by calculating the KLD between the distributions. The KLD gradient dynamically adjusts the parameter optimization weight according to the target size and angle, and has scale invariance. In the extreme case of the horizontal direction, it degenerates to the commonly used l n Norm loss ensures compatibility with existing detection frameworks. The specific steps include:
[0028] Step 1: Feature prediction and decoding:
[0029] Step 1. Input the image to be detected, and the object detection network outputs five-dimensional offsets Δx, Δy, Δw, Δh, and Δθ, where Δx and Δy represent the normalized offsets of the center of the predicted box relative to the center of the prior box or feature point; Δw and Δh represent the logarithmic scale offsets of the width and height of the predicted box respectively; and Δθ represents the rotation angle difference between the predicted box and the prior box.
[0030] Step 1 and 2: Decode the predicted frame B based on the prior frame or feature points p (x p ,y p,w p ,h p ,θ p ) and the real box B t (x t ,y t ,w t ,h t ,θ t ), where x p ,y p ,w p ,h p ,θ p Represents the prediction box B p The center horizontal and vertical coordinates, width and height, and rotation angle, x t ,y t ,w t ,h t ,θ t Represents the real box B t The center horizontal and vertical coordinates, width and height, and rotation angle.
[0031] Step 2: Map the rotation box to a two-dimensional Gaussian distribution:
[0032] The rotation box parameters (x, y, w, h, θ) are mapped to a two-dimensional Gaussian distribution N(μ, ∑), where μ = (x, y), ∑ = R·diag(w 2 / 4,h 2 / 4)·R T , R is the rotation matrix, which represents the two-dimensional rotation of angle θ, and x, y, w, h, θ represent the horizontal and vertical coordinates, width and height of the center of the rotation box, as well as the rotation angle.
[0033] Step 3: KLD regression distance D KLD calculate:
[0034] D KLD The calculation formula is:
[0035]
[0036] Step 4: Nonlinear normalization and multi-task joint loss:
[0037] Step 4.1: Use nonlinear normalization to obtain the regression loss function L reg :
[0038] L reg =1-1 / (1+f(D KLD ))
[0039] f(·) can be selected as sqrt(·) or ln(·+1), which is the gradient adjustment function.
[0040] Step 4.2: Regression loss function Lreg And the classification loss function L cls Jointly train the target detection network, and the total loss function L is:
[0041] L=λ1·L reg +λ2·L cls
[0042] Among them, λ1 and λ2 are the ratios of the two losses adjusted by hyperparameters.
[0043] In step 5, the inference phase only performs “feature prediction and decoding” without any additional computational overhead, and uses the object detection network trained in step 4 to output the rotated bounding box.
[0044] Example:
[0045] This embodiment is implemented in combination with a two-stage detector or an AnchorFree detector. The following takes RetinaNet R50 as an example:
[0046] Network modification: Keep the backbone and FPN unchanged, and only output (Δx, Δy, Δw, Δh, Δθ) in the regression head.
[0047] Training details: AdamW optimizer is used, with an initial learning rate of 1×10 -4 ,
[0048] Inference and deployment: The original model structure remains unchanged during the inference phase, without the need for additional tensor operations, and can be run directly in real time on the GPU / edge NPU.
[0049] Figure 1 The test results of this embodiment are: Figure 2 The results are obtained without using this method, and the differences are marked with arrows. Figure 1 and Figure 2 It can be seen that without the method of the present invention, the target frame position angle will be offset during the rotation target frame detection of such dense small objects, which will lead to missed detections and false detections. The method of the present invention can improve the target frame regression quality and reduce the false detection rate through bounding box regression based on Kullback Leibler divergence.
Claims
1. A bounding box regression method for rotation target detection based on Kullback-Leibler divergence, characterized in that The method comprises the following steps: Step 1: Feature prediction and decoding: Step 1: Input the image to be detected, and the target detection network outputs five-dimensional offsets Δx, Δy, Δw, Δh, and Δθ, where Δx and Δy represent the normalized offsets of the center of the predicted box relative to the center of the prior box or feature point; Δw and Δh represent the logarithmic scale offsets of the width and height of the predicted box respectively; and Δθ represents the rotation angle difference between the predicted box and the prior box. Step 1 and 2: Decode the predicted frame B based on the prior frame or feature points p (x p ,y p ,w p ,h p ,θ p ) and the real box B t (x t ,y t ,w t ,h t ,θ t ), where x p ,y p ,w p ,h p ,θ p Represents the prediction box B p The center horizontal and vertical coordinates, width and height, and rotation angle, x t ,y t ,w t ,h t ,θ t Represents the real box B t The center horizontal and vertical coordinates, width and height, and rotation angle; Step 2: Map the rotation box to a two-dimensional Gaussian distribution: The rotation box parameters (x, y, w, h, θ) are mapped to a two-dimensional Gaussian distribution N(μ, ∑), where μ = (x, y), ∑ = R·diag(w 2 / 4,h 2 / 4)·R T , R is the rotation matrix, which represents the two-dimensional rotation of angle θ, and x, y, w, h, θ represent the horizontal and vertical coordinates, width and height of the center of the rotation box, as well as the rotation angle; Step 3: Calculate the KLD regression distance D KLD : Step 4: Nonlinear normalization and multi-task joint loss: Step 4.1: Use nonlinear normalization to obtain the regression loss function L reg ; Step 4.2: Regression loss function L reg And the classification loss function L cls Jointly train the target detection network, and the total loss function L is: L=λ1·L reg +λ2·L cls Among them, λ1 and λ2 are the ratios of the two losses adjusted by hyperparameters; In step 5, the inference phase only performs "feature prediction and decoding" and uses the object detection network trained in step 4 to output the rotated bounding box.
2. The bounding box regression method for rotation target detection based on Kullback Leibler divergence according to claim 1 is characterized in that The KLD regression distance D KLD The calculation formula is:
3. The bounding box regression method for rotation target detection based on Kullback-Leibler divergence according to claim 1 is characterized in that The regression loss function L reg The calculation formula is: L reg =1-1 / (τ+f(D KLD )) f(·) is chosen to be sqrt(·) or ln(·+1), and τ ≥ 1.