A bounding box regression optimization method and system for weak and small targets
Patent Information
- Application Number
- CN202611097451.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-23
- Publication Date
- 2026-10-27
AI Technical Summary
[0004]鉴于上述的分析,本发明实施例旨在提供一种面向弱小目标的边界框回归优化方法和系统,用以解决现有弱小目标回归中特征学习不准、梯度分配失衡、训练收敛不稳定的问题
[0015]与现有技术相比,本发明至少可实现如下有益效果之一:
Smart Images

Figure CN122990362A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of target detection technology, and in particular to a bounding box regression optimization method and system for weak targets. Background Technology
[0002] Small targets refer to targets with a pixel area smaller than 32×32 pixels, including small buildings in remote sensing images, distant vehicles in surveillance footage, and distant pedestrians in drone images. Target detection is a core foundational task in computer vision, and its core process includes feature extraction, target classification, and bounding box regression. The accuracy of bounding box regression directly determines the final result of target detection. Compared to targets of normal scale, small targets are characterized by low pixel proportion, sparse features, low contrast, and susceptibility to background noise, making bounding box regression extremely difficult.
[0003] The core of bounding box regression lies in the design of the loss function. The loss function quantifies the deviation between the predicted and ground truth bounding boxes, guiding the iterative optimization of the object detection network's parameters. Traditional L1 and L2 coordinate losses suffer from a disconnect between training and evaluation metrics, easily resulting in a minimum loss function value but suboptimal detection accuracy. To address this, a series of cross-union (CUnion)-based loss functions have been proposed, including the Cross-Union Ratio (CUnion) loss function, generalized CUnion loss function, distance-based CUnion loss function, complete CUnion loss function, and efficient CUnion loss function. These functions unify loss calculation with CUnion evaluation metrics, effectively optimizing bounding box regression performance for targets of conventional scales. However, existing CUnion loss functions still have significant drawbacks for small targets. Due to the extremely small pixel base of small targets, a positional offset of only 1 to 2 pixels between the predicted and ground truth bounding boxes can cause a precipitous drop in the CUnion value, leading to severe oscillations in the gradient of the loss function. This makes it difficult for the object detection network to converge, resulting in unstable training convergence. Summary of the Invention
[0004] Based on the above analysis, the embodiments of the present invention aim to provide a bounding box regression optimization method and system for weak targets, in order to solve the problems of inaccurate feature learning, unbalanced gradient allocation, and unstable training convergence in existing weak target regression.
[0005] On one hand, embodiments of the present invention provide a bounding box regression optimization method for weak targets, characterized by comprising: Obtain the predicted bounding box and the ground truth bounding box, and decouple them to obtain the bounding box parameters, which include the center point coordinates, geometric mean scale factor and aspect ratio shape factor. Based on the bounding box parameters of the predicted bounding box and the ground truth bounding box, a location dimension distance metric, a scale dimension distance metric, and a shape dimension distance metric are constructed, and a scale-invariant distance is obtained based on the location dimension distance metric, the scale dimension distance metric, and the shape dimension distance metric. Obtain the intersection-union ratio (IU) between the predicted bounding box and the ground truth bounding box. Construct a log-smoothed IU term based on the IU term and a scale-invariant distance similarity term based on the scale-invariant distance. Obtain the decoupled scale-invariant IU similarity measure based on the log-smoothed IU term and the scale-invariant distance similarity term. A loss function is constructed based on the decoupling scale-invariant cross-union similarity metric, and the bounding box regression optimization is performed using the loss function.
[0006] Further, obtaining the decoupled scale-invariant intersection-union similarity measure based on the log-smoothed intersection-union ratio term and the scale-invariant distance similarity term includes: The logarithmic smoothed cross-union ratio term is obtained by calculating the natural logarithm of the cross-union ratio plus one based on the cross-union ratio of the predicted bounding box and the true bounding box. The scale-invariant distance similarity term is obtained by calculating an exponential function with the natural constant as the base and the negative of the scale-invariant distance as the exponent based on the scale-invariant distance. The decoupled scale-invariant cross-union ratio (CUNR) similarity measure is obtained by weighted summation of the log-smoothed CUNR and scale-invariant distance similarity terms.
[0007] Furthermore, the construction of the location-dimensional distance metric includes: Obtain the center point coordinates of the predicted bounding box and the center point coordinates of the ground truth bounding box; Calculate the Euclidean distance between the center point coordinates of the predicted bounding box and the center point coordinates of the true bounding box; Obtain the geometric mean scale factor of the predicted bounding box and the geometric mean scale factor of the true bounding box, and take the maximum value of the geometric mean scale factor of the predicted bounding box and the geometric mean scale factor of the true bounding box. The location dimension distance metric is obtained based on the ratio of the Euclidean distance to the maximum value.
[0008] Furthermore, the construction of the scale-dimensional distance metric includes: Obtain the geometric mean scale factor of the predicted bounding box and the geometric mean scale factor of the true bounding box; Calculate the natural logarithm of the geometric mean scale factor of the predicted bounding box and the natural logarithm of the geometric mean scale factor of the true bounding box, respectively. The scale dimension distance metric is obtained by calculating the absolute value of the difference between the natural logarithm of the geometric mean scale factor of the predicted bounding box and the natural logarithm of the geometric mean scale factor of the true bounding box.
[0009] Furthermore, the construction of the shape dimension distance metric includes: Obtain the aspect ratio shape factor of the predicted bounding box and the aspect ratio shape factor of the ground truth bounding box; Calculate the natural logarithm of the aspect ratio shape factor of the predicted bounding box and the natural logarithm of the aspect ratio shape factor of the true bounding box, respectively. The absolute value of the difference between the natural logarithm of the aspect ratio shape factor of the predicted bounding box and the natural logarithm of the aspect ratio shape factor of the true bounding box is calculated to obtain the shape dimension distance metric.
[0010] Furthermore, the decoupling of the bounding box to obtain the bounding box parameters includes: Obtain the top-left and bottom-right pixel coordinates of the bounding box; Calculate the width and height of the bounding box based on the top-left and bottom-right pixel coordinates; Calculate the coordinates of the center point of the bounding box based on the width and height values; Calculate the geometric mean scale factor of the bounding box based on the width and height values; The aspect ratio shape factor of the bounding box is calculated based on the width and height values.
[0011] Furthermore, the scale-invariant distance obtained based on the location dimension distance metric, the scale dimension distance metric, and the shape dimension distance metric includes: Obtain the position distance adjustment coefficient, scale distance adjustment coefficient, and shape distance adjustment coefficient; The location adjustment distance is obtained by multiplying the location dimension distance metric by the location distance adjustment coefficient. The scale-adjusted distance is obtained by multiplying the scale dimension distance metric by the scale distance adjustment coefficient. The shape adjustment distance is obtained by multiplying the shape dimension distance metric by the shape distance adjustment coefficient. The scale-invariant distance is obtained based on the position adjustment distance, the scale adjustment distance, and the shape adjustment distance.
[0012] Furthermore, the loss function is constructed based on the decoupling scale-invariant intersection-union similarity metric as shown in the following equation; ; in, For loss function, To decouple scale-invariant intersection-union similarity measure; = ; in, To predict the intersection-union ratio (IU / UK) between the bounding box and the ground truth bounding box, For scale-invariant distances, It is an exponential function. To integrate the weighting coefficients, It is the natural logarithm function.
[0013] Furthermore, the fusion weight coefficient is 1.0, the position distance adjustment coefficient is 1.0, the scale distance adjustment coefficient is 0.5, and the shape distance adjustment coefficient is 0.5.
[0014] On the other hand, embodiments of the present invention provide a bounding box regression optimization system for weak targets, the system comprising: The decoupling module is used to obtain the predicted bounding box and the ground truth bounding box, and decouple them to obtain the bounding box parameters, which include the center point coordinates, geometric mean scale factor and aspect ratio shape factor. The calculation module is used to construct position dimension distance metrics, scale dimension distance metrics, and shape dimension distance metrics based on the bounding box parameters of the predicted bounding box and the true bounding box, and to obtain the scale-invariant distance based on the position dimension distance metrics, the scale dimension distance metrics, and the shape dimension distance metrics; A construction module is used to obtain the intersection-union ratio (IU) between the predicted bounding box and the ground truth bounding box, construct a log-smoothed IU term based on the IU term, construct a scale-invariant distance similarity term based on the scale-invariant distance, and obtain a decoupled scale-invariant IU similarity measure based on the log-smoothed IU term and the scale-invariant distance similarity term. The optimization module is used to construct a loss function based on the decoupling scale-invariant cross-comparison similarity metric, and to perform bounding box regression optimization using the loss function.
[0015] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects: 1. This invention decouples the bounding box into three independent bounding box parameters: center point coordinates, geometric mean scale factor, and aspect ratio shape factor. This allows the three geometric attributes of position, scale, and shape to be represented independently. It constructs distance metrics for position dimension, scale dimension, and shape dimension, respectively, to achieve differentiated optimization for different geometric attributes. This solves the problem of inaccurate learning of small targets caused by the coupling of position, scale, and shape, and realizes the learning of the geometric features of small targets, thereby improving the regression accuracy of small targets.
[0016] 2. This invention constructs distance metrics in the position dimension, scale dimension, and shape dimension, respectively. The position dimension distance metric normalizes the positional deviation by dividing by the maximum value of the geometric mean scale factor in the predicted bounding box and the ground truth bounding box. The scale dimension distance metric calculates the absolute value of the difference after taking the natural logarithm of the geometric mean scale factor, transforming the relative scale change into an absolute difference. The shape dimension distance metric calculates the absolute value of the difference after taking the natural logarithm of the aspect ratio shape factor, eliminating the influence of the target's absolute size on shape similarity evaluation, mapping the deviation error of targets at different scales to a uniform order of magnitude, and solving the problem of gradient imbalance during training for small targets.
[0017] 3. This invention obtains the intersection-union ratio (IU) of the predicted bounding box and the ground truth bounding box. Based on the IU, the natural logarithm plus one is calculated to obtain the log-smoothed IU term. The scale-invariant distance (SIN) similarity term is obtained by calculating an exponential function with the natural constant as the base and the negative of the SIN as the exponent based on the scale-invariant distance. The fusion weight coefficients are obtained, and the first weighting term is obtained by multiplying the fusion weight coefficients by the log-smoothed IU term. The second weighting term is obtained by multiplying the difference between one and the fusion weight coefficients by the SIN term. The first and second weighting terms are added to obtain the decoupled SIN similarity measure. A loss function is constructed based on the decoupled SIN similarity measure, solving the problem of gradient vanishing and unstable training convergence in traditional IU loss functions in non-overlapping regions.
[0018] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained from what is particularly pointed out in the description and drawings. Attached Figure Description
[0019] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts. Figure 1 is a schematic flowchart of a bounding box regression optimization method for weak targets provided by an embodiment of the present invention. Detailed Implementation
[0020] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.
[0021] Example 1 A specific embodiment of the present invention discloses a bounding box regression optimization method for weak targets, such as... Figure 1 As shown, it includes: S1. Obtain the predicted bounding box and the true bounding box, and decouple them to obtain the bounding box parameters, which include the center point coordinates, geometric mean scale factor and aspect ratio shape factor. A bounding box is a rectangular box output by an object detection algorithm, with sides parallel to the image coordinate axes, used to enclose objects in an image. Its traditional representation is the pixel coordinates of the top-left and bottom-right corners. , and The coordinates of the top left pixel. and The coordinates are the bottom right pixel coordinates. To eliminate the coupling effect of position, scale, and shape, the bounding box is decoupled to obtain the bounding box parameters. The predicted bounding box refers to the bounding box output by the object detection network in the current iteration, and its coordinate values are calculated by the network's forward propagation. The ground truth bounding box refers to the manually labeled bounding boxes in the training data, and its coordinate values come from the annotation file.
[0022] Furthermore, the bounding box is decoupled, and the bounding box parameters are obtained as follows: S11. Obtain the pixel coordinates of the top left and bottom right corners of the bounding box; In object detection algorithms, for each detected object in an image, the prediction result typically includes four coordinate values of the bounding box: the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner. These coordinate values can be directly read from the output tensor of the object detection network. An object detection network refers to a deep convolutional neural network used to perform object detection tasks, such as the YOLO series of detection networks, the Faster R-CNN two-stage detection network, or the RT-DETR end-to-end detection network. Taking YOLOv8 as an example, this network consists of three parts: a backbone feature extraction network, a neck feature fusion network, and a detection head network. After the input image is processed by the backbone network to extract multi-scale feature maps, the detection head network outputs a prediction tensor. The shape of this prediction tensor is the batch size multiplied by the number of predicted boxes multiplied by the bounding box coordinates plus the class score. The bounding box coordinates are the values of the top-left, top-left, bottom-right, and bottom-right x-coordinates.
[0023] S12. Calculate the width and height of the bounding box based on the upper left corner pixel coordinates and the lower right corner pixel coordinates; The width value is calculated by subtracting the top-left x-coordinate from the bottom-right x-coordinate, i.e., w = - The height value is calculated by subtracting the top-left ordinate from the bottom-right ordinate, i.e., h = - Both the width and height values are positive numbers in pixels.
[0024] S13. Calculate the coordinates of the center point of the bounding box based on the width value and the height value; The center point coordinates include a central x-coordinate and a central y-coordinate. The central x-coordinate is calculated as half the sum of the x-coordinates of the upper left and lower right corners, i.e. =( + The center ordinate is calculated as half the sum of the upper left and lower right ordinates, i.e., ) / 2; =( + ) / 2. The center point coordinates are used to characterize the absolute position of the bounding box in the image.
[0025] S14. Calculate the geometric mean scale factor of the bounding box based on the width value and the height value; The geometric mean scale factor is calculated as the square root of the product of the width and height values, i.e., s = The geometric mean scale factor is used to uniformly characterize the size of a target, eliminating the interference of separate width and height values on scale determination.
[0026] S15. Calculate the aspect ratio shape factor of the bounding box based on the width value and the height value.
[0027] The aspect ratio shape factor is calculated by dividing the width value by the height value, i.e., r = w / h. The aspect ratio shape factor is used to characterize the geometry of a target and can be used as a distance measure of the shape dimension.
[0028] It should be noted that at a resolution of In the image, if the geometric mean scale of the bounding box (in ), and the aspect ratio If so, the target corresponding to the bounding box is defined as a weak target.
[0029] After obtaining the bounding box parameters, the bounding box is represented as follows: ,in, s= , r=w / h.
[0030] S2. Based on the bounding box parameters of the predicted bounding box and the true bounding box, construct the position dimension distance metric, the scale dimension distance metric, and the shape dimension distance metric, and obtain the scale-invariant distance based on the position dimension distance metric, the scale dimension distance metric, and the shape dimension distance metric; To achieve an adaptive constraint that tolerates absolute offsets for large targets and strictly controls minute offsets for small targets, a positional distance metric is constructed. This metric is used to evaluate the positional deviation between the predicted and ground truth bounding boxes on the image plane. The center coordinates of the predicted and ground truth bounding boxes are obtained. The Euclidean distance between the center coordinates of the predicted and ground truth bounding boxes is calculated. The Euclidean distance is the straight-line distance between the two points in a two-dimensional plane, calculated as the square root of the sum of the squares of the differences in the horizontal and vertical coordinates. The geometric mean scale factor of the predicted and ground truth bounding boxes is obtained, and the maximum value is taken. The positional distance metric is obtained based on the ratio of the Euclidean distance to the maximum value. The positional distance metric is shown in the following formula: ; in, To predict the location dimension distance metric between the bounding box and the ground truth bounding box, To predict the Euclidean distance between the center point coordinates of the bounding box and the ground truth bounding box, To predict the coordinates of the center point of the bounding box, The coordinates of the center point of the actual bounding box. To predict the geometric mean scale factor of the bounding box, This represents the geometric mean scale factor of the true bounding box. The location dimension distance metric is scale-invariant; when the target is scaled as a whole, the criteria for judging the relative positional deviation remain unchanged, effectively solving the problem of excessive penalty for small offsets of weak targets.
[0031] The scale-dimensional distance metric is used to evaluate the deviation in size between the predicted bounding box and the ground truth bounding box, and this deviation should be independent of the absolute scale of the target itself. The geometric mean scale factor of both the predicted and ground truth bounding boxes is obtained. The natural logarithm of the geometric mean scale factor of both the predicted and ground truth bounding boxes is calculated, with the natural logarithm base e. The absolute value of the difference between the natural logarithm of the geometric mean scale factor of the predicted and ground truth bounding boxes is calculated to obtain the scale-dimensional distance metric. The scale-dimensional distance metric is shown in the following formula: ; in, To predict the scale-dimensional distance metric between the bounding box and the ground truth bounding box, To predict the geometric mean scale factor of the bounding box, The geometric mean scale factor of the true bounding box. To predict the natural logarithm of the geometric mean scale factor of the bounding box, is the natural logarithm of the geometric mean scale factor of the true bounding box.
[0032] Scale-dimensional distance metrics utilize the multiplication and addition transformation properties of logarithmic functions to convert relative scale changes into absolute differences, eliminating the influence of absolute size on similarity assessments, and smoothing out scale fluctuations in small targets. For example... (Weak targets) and The scale distances of large targets are completely equal, which shields the influence of target size on scale measurement; at the same time, logarithmic transformation can compress the drastic fluctuations caused by the 1-pixel scale change of small targets, avoiding metric jumps.
[0033] The shape dimension distance metric is used to evaluate the deviation between the predicted bounding box and the ground truth bounding box in terms of aspect ratio shape, and this deviation should satisfy the symmetry constraint of interchangeable aspect ratios. The aspect ratio shape factors of the predicted and ground truth bounding boxes are obtained. The natural logarithm of the aspect ratio shape factors of both the predicted and ground truth bounding boxes is calculated. The absolute value of the difference between the natural logarithm of the aspect ratio shape factors of the predicted and ground truth bounding boxes is calculated to obtain the shape dimension distance metric. The shape dimension distance metric is shown in the following formula: ; in, To predict the shape dimension distance metric between the bounding box and the ground truth bounding box, To predict the aspect ratio shape factor of the bounding box, The aspect ratio shape factor of the actual bounding box. To predict the natural logarithm of the aspect ratio shape factor of the bounding box, This is the natural logarithm of the aspect ratio shape factor of the true bounding box.
[0034] For the problem of discrete noise in aspect ratio for weak targets, the shape dimension distance metric can simultaneously achieve the symmetry constraint of aspect ratio flipping, because ,and Therefore, the shape distance of interchangeable width and height is consistent, which conforms to the physical intuition of target detection; at the same time, logarithmic transformation can compress the discrete pixel fluctuations of weak target aspect ratios and avoid meaningless over-penalization.
[0035] Furthermore, a scale-invariant distance is obtained based on the location dimension distance metric, the scale dimension distance metric, and the shape dimension distance metric, and the three distance metrics are integrated into a unified distance value. Location distance adjustment coefficients, scale distance adjustment coefficients, and shape distance adjustment coefficients are then obtained. The location distance adjustment coefficient controls the proportion of location dimension distance in the total distance, the scale distance adjustment coefficient controls the proportion of scale dimension distance in the total distance, and the shape distance adjustment coefficient controls the proportion of shape dimension distance in the total distance.
[0036] In this embodiment, the positional distance adjustment coefficient is set to 1.0, the scale distance adjustment coefficient is set to 0.5, and the shape distance adjustment coefficient is set to 0.5. The positional adjustment distance is obtained by multiplying the positional dimension distance metric by the positional distance adjustment coefficient. The scale adjustment distance is obtained by multiplying the scale dimension distance metric by the scale distance adjustment coefficient. The shape adjustment distance is obtained by multiplying the shape dimension distance metric by the shape distance adjustment coefficient. The scale-invariant distance is then obtained based on the positional adjustment distance, scale adjustment distance, and shape adjustment distance. The scale-invariant distance is shown in the following formula: ; in, To predict the scale-invariant distance between the bounding box and the ground truth bounding box, This is the location distance adjustment coefficient. This is the scale distance adjustment coefficient. This is the shape distance adjustment coefficient. The weights are set based on the principle of prioritizing positional accuracy and using scale and shape auxiliary constraints. There is no need to set adaptive factors for targets of different scales; fixed weights can achieve full-scale adaptation and improve engineering practicality.
[0037] Scale-invariant distance satisfies the metric space axiom. A metric space is a set equipped with a distance function that measures the distance between any two elements in the set and must satisfy four fundamental axioms: nonnegativity, identity, symmetry, and the triangle inequality. The loss function corresponding to a distance function satisfying the metric axiom has a convex optimization space, which avoids gradient oscillations and local optima traps. This is especially important for training weak targets with extremely small pixel proportions, because the gradients of weak targets are inherently weak, and once trapped in local optima or gradient oscillations, recovery is difficult. The proof is as follows: Nonnegativity: All are non-negative, weights All are non-negative, therefore ; Identity: If and only if ,Right now , , ,at this time ; symmetry: All satisfy symmetry ( (and so on), therefore ; Triangle Inequality: Both Euclidean norm and absolute value functions satisfy the triangle inequality, and this property is preserved after weighted summation. .
[0038] Scale-invariant distance satisfies the four major metric axioms of nonnegativity, identity, symmetry, and triangle inequality. Therefore, the loss function built based on scale-invariant distance has a convex optimization space, which can effectively avoid the gradient oscillation and local optimum problems caused by pixel sensitivity in traditional cross-union ratio variant loss functions in weak target scenes, and improve the training convergence stability of weak target bounding box regression.
[0039] S3. Obtain the intersection-union ratio (IU) between the predicted bounding box and the true bounding box. Construct a log-smoothed IU term based on the IU term and a scale-invariant distance similarity term based on the scale-invariant distance. Obtain the decoupled scale-invariant IU similarity measure based on the log-smoothed IU term and the scale-invariant distance similarity term. The Intersection over Union (IoU) ratio is the ratio of the pixel area of the intersection region between the predicted bounding box and the ground truth bounding box to the pixel area of the union region. It measures the degree of overlap between the two bounding boxes. The intersection region is the pixel area shared by the predicted and ground truth bounding boxes on the image plane, and its area is calculated by multiplying the horizontal and vertical overlap lengths of the two boxes. The union region is the entire pixel area covered by the predicted and ground truth bounding boxes on the image plane, and its area equals the sum of the pixel areas of the predicted and ground truth bounding boxes, minus the area of the intersection region. The IoU value ranges between 0 and 1; it is 1 when the two bounding boxes completely overlap and 0 when they do not intersect at all.
[0040] The decoupled scale-invariant cross-union similarity measure obtained based on the log-smooth cross-union term and the scale-invariant distance similarity term includes: S31. Calculate the natural logarithm of the intersection-union ratio (IU) plus one based on the IU of the predicted bounding box and the true bounding box to obtain the log-smoothed IU term; calculate the exponential function value with the natural constant as the base and the negative of the scale-invariant distance as the exponent based on the scale-invariant distance to obtain the scale-invariant distance similarity term. The log-smoothed intersection-union ratio (CURRR) term compresses the sharp fluctuations in the CURRR as it approaches zero, while maintaining the same monotonicity as the CURRR. The log-smoothed CURRR term is obtained by adding one to the CURRR and taking its natural logarithm. The scale-invariant distance similarity term maps the scale-invariant distance from the non-negative real number space to a similarity score between 0 and 1. When two bounding boxes are identical, the scale-invariant distance is 0, and the corresponding exponential function value is 1; the greater the difference between the two bounding boxes, the larger the scale-invariant distance, and the corresponding exponential function value approaches 0. Even if two bounding boxes have no overlapping areas, the scale-invariant distance similarity term can still provide effective non-zero gradients, thus avoiding the gradient vanishing problem during training.
[0041] S32. The decoupled scale-invariant cross-union similarity measure is obtained by weighted summation of the log-smooth cross-union similarity term and the scale-invariant distance similarity term.
[0042] The decoupling scale-invariant intersection-union similarity measure is shown in the following formula: = ; in, To predict the intersection-union ratio (IU / UK) between the bounding box and the ground truth bounding box, For scale-invariant distances, It is an exponential function. To integrate the weighting coefficients, It is the natural logarithm function.
[0043] The fusion weighting coefficient is used to balance the contribution ratios of the log-smooth intersection-union (IUU) term and the scale-invariant distance similarity term in the final similarity metric. In this embodiment, the fusion weighting coefficient is set to 0.6. For scenarios with densely distributed weak targets, the fusion weighting coefficient can be lowered to 0.4 to increase the weighting of the scale-invariant distance similarity term.
[0044] S4. Construct a loss function based on the decoupling scale-invariant cross-union similarity metric, and use the loss function to perform bounding box regression optimization.
[0045] A higher similarity metric indicates a better match between the predicted and ground truth bounding boxes, and the corresponding loss value should be lower; conversely, a lower similarity metric value should result in a higher loss value. Specifically, the decoupled scale-invariant cross-section similarity metric is obtained, and the difference between this metric and the calculated value yields the loss function. The loss function is shown in the following equation: .
[0046] During model training, the aforementioned loss function is used as the optimization objective of the bounding box regression branch. The gradient of the loss function relative to the parameters of each layer of the object detection network is calculated using the backpropagation algorithm, layer by layer, following the chain rule of derivative of the loss function with respect to the network output and input. After obtaining the gradients of each layer's parameters, an optimizer is used to update the network weights. For example, the AdamW adaptive moment estimator optimizer is selected, with an initial learning rate of 0.001 and a weight decay coefficient of 0.0005. The momentum parameter β1 can be set to 0.9, and β2 can be set to 0.999. The momentum parameter refers to the exponential decay rate of the first and second moment estimates used to calculate the gradient.
[0047] During training, the number of input images per batch was set to 16, and a total of 300 iterations were trained. Through the above optimization process, the predicted bounding boxes output by the object detection network gradually approximate the true bounding boxes, thus achieving high-precision bounding box regression for small targets. The loss function of this invention can directly replace the original intersection-union (IoU) series loss functions in object detection frameworks without modifying the network structure or adjusting the training configuration. Applicable object detection frameworks include the YOLO series, Faster R-CNN, SSD, and RT-DETR, etc.
[0048] Example 2 A specific embodiment of the present invention discloses a bounding box regression optimization system for weak targets, the system comprising: The decoupling module is used to obtain the predicted bounding box and the ground truth bounding box, and decouple them to obtain the bounding box parameters, which include the center point coordinates, geometric mean scale factor and aspect ratio shape factor. The calculation module is used to construct position dimension distance metrics, scale dimension distance metrics, and shape dimension distance metrics based on the bounding box parameters of the predicted bounding box and the true bounding box, and to obtain the scale-invariant distance based on the position dimension distance metrics, the scale dimension distance metrics, and the shape dimension distance metrics; A construction module is used to obtain the intersection-union ratio (IU) between the predicted bounding box and the ground truth bounding box, construct a log-smoothed IU term based on the IU term, construct a scale-invariant distance similarity term based on the scale-invariant distance, and obtain a decoupled scale-invariant IU similarity measure based on the log-smoothed IU term and the scale-invariant distance similarity term. The optimization module is used to construct a loss function based on the decoupling scale-invariant cross-comparison similarity metric, and to perform bounding box regression optimization using the loss function. Those skilled in the art will understand that all or part of the processes of the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.
[0049] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A bounding box regression optimization method for weak targets, characterized in that, include: Obtain the predicted bounding box and the ground truth bounding box, and decouple them to obtain the bounding box parameters, which include the center point coordinates, geometric mean scale factor and aspect ratio shape factor. Based on the bounding box parameters of the predicted bounding box and the ground truth bounding box, a location dimension distance metric, a scale dimension distance metric, and a shape dimension distance metric are constructed, and a scale-invariant distance is obtained based on the location dimension distance metric, the scale dimension distance metric, and the shape dimension distance metric. Obtain the intersection-union ratio (IU) between the predicted bounding box and the ground truth bounding box. Construct a log-smoothed IU term based on the IU term and a scale-invariant distance similarity term based on the scale-invariant distance. Obtain the decoupled scale-invariant IU similarity measure based on the log-smoothed IU term and the scale-invariant distance similarity term. A loss function is constructed based on the decoupling scale-invariant cross-union similarity metric, and the bounding box regression optimization is performed using the loss function.
2. The method according to claim 1, characterized in that, The decoupled scale-invariant cross-union similarity measure obtained based on the log-smooth cross-union term and the scale-invariant distance similarity term includes: The logarithmic smoothed cross-union ratio term is obtained by calculating the natural logarithm of the cross-union ratio plus one based on the cross-union ratio of the predicted bounding box and the true bounding box. The scale-invariant distance similarity term is obtained by calculating an exponential function with the natural constant as the base and the negative of the scale-invariant distance as the exponent based on the scale-invariant distance. The decoupled scale-invariant cross-union ratio (CUNR) similarity measure is obtained by weighted summation of the log-smoothed CUNR and scale-invariant distance similarity terms.
3. The method according to claim 1, characterized in that, The constructed location dimension distance metric includes: Obtain the center point coordinates of the predicted bounding box and the center point coordinates of the ground truth bounding box; Calculate the Euclidean distance between the center point coordinates of the predicted bounding box and the center point coordinates of the true bounding box; Obtain the geometric mean scale factor of the predicted bounding box and the geometric mean scale factor of the true bounding box, and take the maximum value of the geometric mean scale factor of the predicted bounding box and the geometric mean scale factor of the true bounding box. The location dimension distance metric is obtained based on the ratio of the Euclidean distance to the maximum value.
4. The method according to claim 1, characterized in that, The constructed scale dimension distance metric includes: Obtain the geometric mean scale factor of the predicted bounding box and the geometric mean scale factor of the true bounding box; Calculate the natural logarithm of the geometric mean scale factor of the predicted bounding box and the natural logarithm of the geometric mean scale factor of the true bounding box, respectively. The scale dimension distance metric is obtained by calculating the absolute value of the difference between the natural logarithm of the geometric mean scale factor of the predicted bounding box and the natural logarithm of the geometric mean scale factor of the true bounding box.
5. The method according to claim 1, characterized in that, The constructed shape dimension distance metric includes: Obtain the aspect ratio shape factor of the predicted bounding box and the aspect ratio shape factor of the ground truth bounding box; Calculate the natural logarithm of the aspect ratio shape factor of the predicted bounding box and the natural logarithm of the aspect ratio shape factor of the true bounding box, respectively. The absolute value of the difference between the natural logarithm of the aspect ratio shape factor of the predicted bounding box and the natural logarithm of the aspect ratio shape factor of the true bounding box is calculated to obtain the shape dimension distance metric.
6. The method according to claim 1, characterized in that, The decoupling of the bounding box to obtain bounding box parameters includes: Obtain the top-left and bottom-right pixel coordinates of the bounding box; Calculate the width and height of the bounding box based on the top-left and bottom-right pixel coordinates; Calculate the coordinates of the center point of the bounding box based on the width and height values; Calculate the geometric mean scale factor of the bounding box based on the width and height values; The aspect ratio shape factor of the bounding box is calculated based on the width and height values.
7. The method according to claim 2, characterized in that, The scale-invariant distance obtained based on the location dimension distance metric, the scale dimension distance metric, and the shape dimension distance metric includes: Obtain the position distance adjustment coefficient, scale distance adjustment coefficient, and shape distance adjustment coefficient; The location adjustment distance is obtained by multiplying the location dimension distance metric by the location distance adjustment coefficient. The scale-adjusted distance is obtained by multiplying the scale dimension distance metric by the scale distance adjustment coefficient. The shape adjustment distance is obtained by multiplying the shape dimension distance metric by the shape distance adjustment coefficient. The scale-invariant distance is obtained based on the position adjustment distance, the scale adjustment distance, and the shape adjustment distance.
8. The method according to claim 2, characterized in that, The loss function is constructed based on the decoupling scale-invariant cross-comparison similarity metric as shown in the following equation; ; in, For loss function, To decouple scale-invariant intersection-union similarity measure; = ; in, To predict the intersection-union ratio (IU / UK) between the bounding box and the ground truth bounding box, For scale-invariant distances, It is an exponential function. To integrate the weighting coefficients, It is the natural logarithm function.
9. The method according to claim 7, characterized in that, The fusion weight coefficient is 1.0, the position distance adjustment coefficient is 1.0, the scale distance adjustment coefficient is 0.5, and the shape distance adjustment coefficient is 0.
5.
10. A bounding box regression optimization system for weak targets, characterized in that, The system includes: The decoupling module is used to obtain the predicted bounding box and the ground truth bounding box, and decouple them to obtain the bounding box parameters, which include the center point coordinates, geometric mean scale factor and aspect ratio shape factor. The calculation module is used to construct position dimension distance metrics, scale dimension distance metrics, and shape dimension distance metrics based on the bounding box parameters of the predicted bounding box and the true bounding box, and to obtain the scale-invariant distance based on the position dimension distance metrics, the scale dimension distance metrics, and the shape dimension distance metrics; The module is used to obtain the intersection-union ratio (IUR) between the predicted bounding box and the ground truth bounding box, construct a log-smoothed IUR term based on the IUR, construct a scale-invariant distance similarity term based on the scale-invariant distance, and obtain a decoupled scale-invariant IUR similarity measure based on the log-smoothed IUR term and the scale-invariant distance similarity term. The optimization module is used to construct a loss function based on the decoupling scale-invariant cross-comparison similarity metric, and to perform bounding box regression optimization using the loss function.