Dense target detection model training method, detection method, device and medium

By integrating a detection network that predicts center points and bounding box parameters, a target loss function is generated to train the model, which solves the problem of low detection accuracy in dense semiconductor material detection and achieves higher detection accuracy and generalization.

CN120976528APending Publication Date: 2025-11-18WUXI UNICOMP TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511083712.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-04
Publication Date
2025-11-18

AI Technical Summary

Technical Problem

Traditional semiconductor material detection methods suffer from inaccurate results, low recall, and reduced model detection accuracy in high-resolution images due to the dense and arbitrarily oriented nature of the materials.

Method used

A first detection network integrating center point prediction and a second detection network based on center point prediction of bounding box parameters are used. The model is trained by generating a target loss function to improve the generalization of the detection model.

Benefits of technology

It improves the accuracy and generalization of dense target detection, and solves the problem of low detection accuracy in traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120976528A_ABST
    Figure CN120976528A_ABST
Patent Text Reader

Abstract

The invention discloses a dense target detection model training method, a dense target detection method, a dense target detection device and a medium. The dense target detection model training method comprises the steps of obtaining a sample data set; performing identification processing on the training sample image based on a first detection network in the to-be-trained detection model, determining a prediction thermodynamic diagram corresponding to the training sample image, and determining a central point coordinate prediction value of each target object according to the prediction thermodynamic diagram; performing prediction processing on the prediction thermodynamic diagram and the central point coordinate prediction value based on a second detection network in the to-be-trained detection model, and determining a bounding box parameter prediction value of a prediction bounding box where each target object is located; and generating a target loss function according to the central point coordinate true value, the bounding box parameter true value, the central point coordinate predicted value and the bounding box parameter predicted value, and training the to-be-trained detection model to obtain a trained dense target detection model. According to the technical scheme, the generalization of the dense target detection model is improved by integrating the first detection network and the second detection network, so that the detection accuracy of the dense target is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a training method, detection method, device and medium for a dense target detection model. Background Technology

[0002] In recent years, with the rapid development of the semiconductor industry, the precision and miniaturization of semiconductor materials have been continuously improving. For semiconductor materials of fixed size and uniform distribution, traditional counting methods still perform well; however, when detecting and counting relatively high-resolution images, traditional counting methods struggle to achieve accurate counting because semiconductor materials typically have very precise dimensions and significant distribution variations.

[0003] Currently, deep learning-based counting methods are commonly used to detect and count semiconductor materials. However, since semiconductor materials are densely packed and arbitrarily oriented on the production line, if the aspect ratio of the semiconductor materials is large and their orientation is arbitrary, the horizontal bounding boxes used in traditional target detection will generate more redundant background information, leading to inaccurate detection results. In addition, if semiconductor materials in arbitrary orientations are densely arranged together, the horizontal bounding boxes will also fail to assign many semiconductor materials to positive sample bounding boxes due to the overlap of background information, resulting in low recall of the model and thus reduced detection accuracy. Summary of the Invention

[0004] This application provides a training method, detection method, device, and medium for a dense target detection model. By integrating a first detection network that predicts center points and a second detection network that predicts bounding box parameters based on center points, the generalization ability of the dense target detection model is improved, thereby increasing the accuracy of dense target detection.

[0005] According to one aspect of this application, a method for training a dense object detection model is provided, the method comprising:

[0006] Obtain a sample dataset; wherein the sample dataset includes training sample images and label information corresponding to the training sample images, the label information includes the true coordinates of the center point of the true bounding box in the training sample image and the true values ​​of the bounding box parameters, the true bounding box being a rectangular box containing the target object in the training sample image;

[0007] The training sample image is identified based on the first detection network in the detection model to be trained, and a predicted heatmap corresponding to the training sample image is determined. The predicted center point coordinates of each target object are then determined based on the predicted heatmap.

[0008] Based on the second detection network in the detection model to be trained, the predicted heatmap and the predicted center point coordinates are predicted to determine the predicted bounding box parameters of each target object.

[0009] A target loss function is generated based on the true values ​​of the center point coordinates, the true values ​​of the bounding box parameters, the predicted values ​​of the center point coordinates and the predicted values ​​of the bounding box parameters. The detection model to be trained is trained with the goal of reducing the loss function, and a trained dense target detection model is obtained.

[0010] According to another aspect of this application, a dense target detection method is provided, the method comprising:

[0011] Acquire an image to be detected; wherein the image to be detected includes at least one target object;

[0012] The dense target detection model is used to identify target objects in the image to be detected, and the bounding box detection results corresponding to each target object are determined respectively; wherein, the dense target detection model is trained based on the training method of any of the dense target detection models described in this application.

[0013] According to another aspect of this application, a training apparatus for a dense object detection model is provided, the apparatus comprising:

[0014] A sample dataset acquisition module is used to acquire a sample dataset; wherein, the sample dataset includes training sample images and label information corresponding to the training sample images, the label information includes the true coordinates of the center point of the true bounding box in the training sample image and the true values ​​of the bounding box parameters, and the true bounding box is a rectangular box containing the target object in the training sample image;

[0015] The center point coordinate prediction module is used to perform recognition processing on the training sample image based on the first detection network in the detection model to be trained, determine the prediction heatmap corresponding to the training sample image, and determine the center point coordinate prediction value of each target object based on the prediction heatmap.

[0016] The bounding box parameter prediction module is used to perform prediction processing on the predicted heatmap and the predicted center point coordinates based on the second detection network in the detection model to be trained, and to determine the predicted bounding box parameter values ​​of the predicted bounding boxes of each target object.

[0017] The target detection model training module is used to generate a target loss function based on the true values ​​of the center point coordinates, the true values ​​of the bounding box parameters, the predicted values ​​of the center point coordinates and the predicted values ​​of the bounding box parameters, and to train the detection model to be trained with the goal of reducing the loss function, so as to obtain a trained dense target detection model.

[0018] According to another aspect of this application, a dense target detection device is provided, the device comprising:

[0019] An image acquisition module is used to acquire an image to be detected; wherein the image to be detected includes at least one target object;

[0020] The target bounding box detection module is used to identify target objects in the image to be detected based on the dense target detection model, and to determine the bounding box detection results corresponding to each target object; wherein, the dense target detection model is trained based on the training method of any of the dense target detection models described in this application.

[0021] According to another aspect of this application, an electronic device is provided, the device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform a training method or a dense target detection method for a dense target detection model as described in any embodiment of this application.

[0022] According to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the training method or dense target detection method of the dense target detection model according to any embodiment of this application.

[0023] According to another aspect of this application, a computer program product is provided, the computer program product comprising a computer program that, when executed by a processor, implements the training method of the dense target detection model described in any embodiment of this application.

[0024] The technical solution provided in this application involves: acquiring a sample dataset; performing recognition processing on training sample images based on a first detection network in the detection model to be trained, determining the predicted heatmap corresponding to the training sample images, and determining the predicted center point coordinates of each target object based on the predicted heatmap; performing prediction processing on the predicted heatmap and the predicted center point coordinates based on a second detection network in the detection model to be trained, determining the predicted bounding box parameters of the predicted bounding boxes containing each target object; generating a target loss function based on the actual center point coordinates, the actual bounding box parameters, the predicted center point coordinates, and the predicted bounding box parameters; and training the detection model to be trained to obtain a trained dense target detection model. This technical solution, by integrating the first and second detection networks, improves the generalization of the dense target detection model, thereby improving the detection accuracy of dense targets.

[0025] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description

[0026] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0027] Figure 1 This is a flowchart illustrating a training method for a dense target detection model provided in Embodiment 1 of this application.

[0028] Figure 2 This is a schematic diagram of a gating network provided in Embodiment 1 of this application.

[0029] Figure 3 This is a flowchart of a training method for a dense target detection model provided in Embodiment 2 of this application.

[0030] Figure 4 This is a flowchart of a dense target detection method provided in Embodiment 3 of this application.

[0031] Figure 5 This is a schematic diagram of the structure of a training device for a dense target detection model provided in Embodiment 4 of this application.

[0032] Figure 6 This is a schematic diagram of a dense target detection device provided in Embodiment 5 of this application.

[0033] Figure 7This is a schematic diagram of the structure of a device for implementing a training method for a dense target detection model according to an embodiment of this application. Detailed Implementation

[0034] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0035] It should be noted that the terms "first," "second," "third," "fourth," "predicted," "true," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0036] Example 1

[0037] Figure 1 This is a flowchart illustrating a training method for a dense target detection model according to Embodiment 1 of this application. This embodiment is applicable to target identification and detection, particularly to the identification and detection of dense targets. The method can be executed by a training device for the dense target detection model, which can be implemented in hardware and / or software and can be configured in a device with data processing capabilities. Figure 1 As shown, the method includes the following steps.

[0038] S110. Obtain the sample dataset. The sample dataset includes training sample images and corresponding label information. The label information includes the true coordinates of the center point of the ground truth bounding box in the training sample image and the true values ​​of the bounding box parameters. The ground truth bounding box is a rectangular box containing the target object in the training sample image.

[0039] The target object can be any object that needs to be detected and identified, such as different types of semiconductor materials. The training sample images can be images containing the target objects, such as images of semiconductor materials taken using X-ray imaging equipment. The label information can be annotation information for each target object in the training sample images, such as the type of each target object, the coordinates of the center point of its bounding box, and the bounding box parameters.

[0040] Bounding box parameters are typically represented using the five-parameter method and the eight-parameter corner point method. However, the periodicity of angles can lead to discontinuities in the loss function. For example, a sharp change in angle at the boundary can cause a significant change in the angle loss function. Furthermore, changes in angle can cause the length and width of the bounding box to flip abruptly. Directly regressing the height and width of the bounding box can reduce the network's convergence performance, leading to training instability and performance degradation. Therefore, in this application, polar coordinates are used to represent the center point coordinates of the target object and the bounding box parameters.

[0041] For example, the true values ​​of the center point coordinates and the true values ​​of the bounding box parameters in the training sample image can be determined by the following process: determine the coordinates of each corner point of the true bounding box in the Cartesian coordinate system; determine the true value of the center point coordinates of the true bounding box based on the coordinates of each corner point; take the true value of the center point coordinates as the pole in the polar coordinate system, and determine the true value of the bounding box parameters in the polar coordinate system based on the pole.

[0042] Each corner point can be one of the four vertices of the true bounding box. In this application, the four corner points of the true bounding box are represented by {(x1,y1),(x2,y2),(x3,y3),(x4,y4)}, and the maximum value of the coordinates of the four corner points in each coordinate system is obtained. max ,y max ) and minimum value (x) min ,y min ); Calculate the average of the maximum and minimum values ​​in each coordinate system, i.e. (x) center ,y center () is used as the true value of the center point coordinates.

[0043] The offset of the center point at the output scale is determined based on its true coordinates. Specifically, the offset on the x-axis is... The offset on the y-axis is In the formula, d represents the downsampling factor, and [·] represents the floor function.

[0044] Furthermore, using the true coordinates of the center point as the pole, the positive x-axis as the positive direction of the polar coordinate system, and clockwise as the positive direction of rotation, the polar angles and polar radii of the midpoints of the four sides of the true bounding box are determined respectively:

[0045]

[0046] In the formula, ρ represents the polar angle at the midpoint of the i-th edge. i Let x represent the polar radius of the midpoint of the i-th edge. i This represents the x-coordinate of the i-th corner point on the x-axis. i+1 This represents the x-coordinate of the (i+1)th corner point on the x-axis, and y-coordinate... i This represents the y-coordinate of the i-th corner point. i+1 This represents the y-coordinate of the (i+1)th corner point.

[0047] Furthermore, the polar radii are sorted from largest to smallest, and the longest side ρ1 and its corresponding polar angle are selected. By combining the shortest side ρ2, we obtain the converted label file. in,

[0048] The advantage of the above technical solution is that, by using the center point coordinates as the pole, it avoids the interchange of length and width compared to the long side definition method.

[0049] In this application, the sample dataset can be divided into a training set and a test set according to a preset ratio, and the training sample images can be overlapped and cropped. For example, the cropping size can be set to 640 and the overlap size can be set to 320. The cropped training sample images can then be preprocessed.

[0050] S120. Based on the first detection network in the detection model to be trained, the training sample image is identified and processed to determine the predicted heatmap corresponding to the training sample image, and the predicted coordinates of the center point of each target object are determined according to the predicted heatmap.

[0051] The "detection model to be trained" refers to a dense object detection model whose parameters have not yet been optimized. It consists of a first detection network and a second detection network. The first detection network can be used to extract features from training sample images and predict the location of the center point of the target object. The first detection network can be a keypoint detection network. The keypoint detection network can be used to identify and locate the location of predefined structured points of specific objects in the image, such as locating the center of a wheel or the corner point of a headlight.

[0052] Specifically, training sample images can be input into the first detection network to enable the first detection network to perform forward propagation calculations; the first detection network extracts features from the training sample images through the backbone network; then, based on the extracted features, the existence probability of target objects and bounding box predictions are determined at different locations in the training sample images; finally, based on the existence probability of target objects at different locations in the image and the bounding box prediction results, the predicted coordinates of the center point of each target object are determined.

[0053] Optionally, the step of performing recognition processing on the training sample image based on the first detection network in the detection model to be trained, and determining the predicted heatmap corresponding to the training sample image, includes: determining the category of each target object in the training sample image based on the first detection network in the detection model to be trained; and determining the predicted heatmap corresponding to the training sample image based on the category of each target object.

[0054] The first detection network can be a LiteHRNet model, which uses a bottom-up structure to directly predict the coordinates of the center point. It should be noted that the model structure is not limited in this embodiment and can be determined according to actual needs.

[0055] Because different categories of objects have different sizes and shapes, the methods for determining their center point coordinates also differ. Therefore, this application identifies the category of the target object before determining its center point coordinates. Specifically, a category prediction branch can be set in the first detection network, and a training sample image of size (w,h) can be input into the first detection network to output a shape... The feature map is generated, where d represents the downsampling factor and c represents the category of the target object. Further, based on the category of each target object, the confidence score of the region where each target object is located belonging to the center point of that category is determined, thus generating a corresponding heatmap. In the heatmap, the value of each pixel position represents the confidence that the point is the center point of the target object; the closer the value of each pixel position is to 1, the higher the probability that the pixel is the center point of a certain category of object. Finally, the heatmap is decoded, and the peak points in the heatmap are determined as the predicted coordinates of the center point of the target object.

[0056] The advantage of the above technical solution is that generating a heatmap based on the object category can improve the accuracy of predicting the center point of the object.

[0057] S130. Based on the second detection network in the detection model to be trained, perform prediction processing on the predicted heatmap and the predicted center point coordinates to determine the predicted bounding box parameter values ​​of each target object.

[0058] The second detection network can extract features based on the center point coordinates to predict the regression features of the bounding box containing the target object. This second detection network can be a CenterNet model, using ResNet as the backbone network and upsampling methods to learn the regression features of the bounding box.

[0059] In some embodiments, optionally, the step of performing prediction processing on the predicted heatmap and the predicted center point coordinates based on the second detection network in the detection model to be trained, and determining the predicted bounding box parameter values ​​of the predicted bounding boxes of each target object, includes: based on the second detection network in the detection model to be trained, using the predicted center point coordinates as the pole of the polar coordinate system, determining the first polar angle and the first polar radius of the midpoint of each side of the predicted bounding box respectively; performing elliptic processing on the Gaussian kernel of the predicted heatmap to obtain a rotating heatmap; performing Gaussian smoothing on the first polar angle based on the rotating heatmap to determine the second polar angle; and determining the predicted bounding box parameter values ​​of the predicted bounding boxes of each target object according to the second polar angle and the first polar radius of the midpoint of each side of the predicted bounding box.

[0060] The first polar angle and first polar radius of the midpoints of each side of the predicted bounding box can be determined by referring to the method described in step S110. That is, assuming the predicted coordinates of the center point are (x... c ,y c Based on the predicted center point coordinates, its offset at the output scale is determined, with the offset on the x-axis being... The offset on the y-axis is In the formula, d represents the downsampling factor, and [·] represents the floor function.

[0061] Furthermore, using the predicted coordinates of the center point as the pole, the positive x-axis as the positive direction of the polar coordinate system, and clockwise as the positive direction of rotation, the polar angles and polar radii of the midpoints of the four sides of the predicted bounding box are determined respectively:

[0062]

[0063] In the formula, Let ρ′ represent the polar angle at the midpoint of the i-th edge. i Let x′ represent the polar radius of the midpoint of the i-th edge. i Let x' represent the x-coordinate of the i-th corner point on the x-axis. i+1 Let y′ represent the x-coordinate of the (i+1)th corner point. i Let y′ represent the y-coordinate of the i-th corner point. i+1 This represents the y-coordinate of the (i+1)th corner point.

[0064] Furthermore, the polar radii are sorted from largest to smallest, and the longest side ρ′1 and its corresponding polar angle are selected. By combining the shortest side ρ′2, we obtain the converted label file. in,

[0065] Accurate prediction of poles is crucial for bounding box localization. However, semiconductor materials vary greatly in size and aspect ratio. When using the shorter side as the Gaussian kernel diameter, the response area around the center point becomes too small for objects with large aspect ratios, easily leading to target center drift. Therefore, this application proposes a rotational heatmap, which adjusts the Gaussian kernel shape according to the aspect ratio of the target object, stretching it along the target direction. Specifically, this can be expressed by the following formula:

[0066]

[0067] In the formula, For the Gaussian kernel of the rotating heatmap, (x p ,y p (x, y) represents a feature point in the rotating heatmap, and (x, y) represents the coordinates of the center point after downsampling from the true values. θ represents the target scale adaptive variance, which is the bandwidth related to the true bounding box length and width and is used to control the range of the Gaussian scattering kernel function. θ represents the rotation angle.

[0068] Because the rotation angle is periodic, direct regression will lead to gradient anomalies, making training unstable. Furthermore, for target objects with large aspect ratios, they are highly sensitive to changes in angle; if the gradient of the regressed target changes significantly, optimization becomes difficult. Therefore, this application discretizes the angle and represents it using a Gaussian heatmap.

[0069] Specifically, the rotation angle θ can be mapped to [-90°, 90°] and quantized into K classes. For example, K can take a value of 180, with each class corresponding to 2°. Furthermore, to make the angle regression more stable, each angle class can be smoothed in the angle space using a Gaussian distribution. This smoothing can be performed using the following formula:

[0070]

[0071] In the formula, θ c This indicates the category to which the angle belongs after discretization, and σ represents the parameter used to control the degree of smoothness.

[0072] Since current object detection methods draw predicted bounding boxes in a Cartesian coordinate system, results in polar coordinates need to be decoded to a Cartesian coordinate system. Specifically, the predicted center point coordinates (x, y, z) can be converted to Cartesian coordinates. c ,y c) is used as the pole of the polar coordinate system, and based on the two polar radii ρ in the prediction results ′1 Calculate the relative coordinates of the horizontal bounding box using ρ′2: (x1=-ρ′1,y1=-ρ′2),(x2=ρ′1,y2=-ρ′2),(x3=ρ′1,y1=ρ′2),(x4=-ρ′1,y4=ρ′2). Here, (x1,y1) represents the top-left corner of the horizontal bounding box, and the calculation direction is clockwise.

[0073] Furthermore, a clockwise rotation transformation matrix is ​​constructed based on the rotation angle in the prediction results. The resulting matrix is ​​multiplied by the predicted bounding box coordinates to obtain the relative rotation coordinates. Then, the relative rotation coordinates are added to the predicted center point coordinates to obtain the final rotation coordinates.

[0074]

[0075] In the formula, i = 1, 2, 3, 4, and Rm represents the clockwise rotation transformation matrix.

[0076]

[0077] S140. Generate a target loss function based on the true value of the center point coordinates, the true value of the bounding box parameters, the predicted value of the center point coordinates, and the predicted value of the bounding box parameters. Train the detection model to be trained with the goal of reducing the loss function, and obtain a trained dense target detection model.

[0078] The objective loss function can be used to evaluate and optimize the model parameters of the detection model being trained. Specifically, the objective loss function can be represented by a multi-task loss function, such as center point coordinate loss and bounding box parameter regression loss. Common loss functions include L1 loss function, L2 loss function, Smooth L1 loss function, 100U loss function, cross-entropy loss function, focus loss function, etc. This application does not limit the specific loss function; it can be selected according to actual needs.

[0079] For example, SGD can be used as the optimizer for the model, with momentum set to 0.9, an initial learning rate of 0.0005, cosine descent, a batch size of 12, and a total of 50 training epochs. For the UCAS-AOD dataset, due to its small pixel range, images are cropped to 640×640 pixels with a repetition rate of 0.5; for images smaller than 640 pixels, grayscale images can be used to supplement them to prevent information loss. The training dataset is input into the detection model to be trained for iterative training, and the model parameters are iteratively optimized according to the target loss function until the target loss function converges or the required number of training epochs is reached, resulting in a trained dense object detection model.

[0080] In some embodiments, the detection model to be trained is optionally a model obtained by fusing the first detection network and the second detection network based on a gating network.

[0081] Among them, the gating network can be used to control the information flow and feature selection between the first detection network and the second detection network. For example... Figure 2 The diagram of the gated network structure illustrates a hybrid expert model that fuses the first and second detection networks to decouple the output results. Specifically, the outputs of the first and second detection networks are convolved through the first branch, and then convolved, activated, and sorted through the second branch. Weight coefficients are then assigned to the features obtained from the first and second branches, and a weighted sum is applied. Finally, the features are fused to obtain the final output result.

[0082] During the training process of the model, the first detection network and the second detection network can be pruned and trained separately, and the model structure parameters after training can be saved to obtain the model files of the first detection network and the second detection network. Then, the trained model structure is reloaded, and the reloaded model structure is fused through a gating network to obtain a dense target detection model.

[0083] This invention provides a training method for a dense target detection model. The method involves acquiring a sample dataset; performing recognition processing on training sample images based on a first detection network in the detection model to be trained, determining a predicted heatmap corresponding to the training sample images, and determining the predicted center point coordinates of each target object based on the predicted heatmap; performing prediction processing on the predicted heatmap and the predicted center point coordinates based on a second detection network in the detection model to be trained, determining the predicted bounding box parameters of the predicted bounding boxes containing each target object; generating a target loss function based on the actual center point coordinates, the actual bounding box parameters, the predicted center point coordinates, and the predicted bounding box parameters; and training the detection model to be trained to obtain a trained dense target detection model. This technical solution, by integrating the first and second detection networks, improves the generalization ability of the dense target detection model, thereby improving the accuracy of detecting dense targets.

[0084] Example 2

[0085] Figure 2 This is a flowchart illustrating a training method for a dense target detection model provided in Embodiment 2 of this application. This embodiment is an optimization based on the above embodiment. Figure 2 As shown, the method in this embodiment specifically includes the following steps.

[0086] S210. Obtain a sample dataset. The sample dataset includes training sample images and corresponding label information. The label information includes the true coordinates of the center point of the ground truth bounding box in the training sample image and the true values ​​of the bounding box parameters. The ground truth bounding box is a rectangular box containing the target object in the training sample image.

[0087] S220. Based on the first detection network in the detection model to be trained, the training sample image is identified and processed to determine the predicted heatmap corresponding to the training sample image, and the predicted coordinates of the center point of each target object are determined according to the predicted heatmap.

[0088] S230. Based on the second detection network in the detection model to be trained, perform prediction processing on the predicted heatmap and the predicted center point coordinates to determine the predicted bounding box parameter values ​​of each target object.

[0089] S240. Generate a first loss function based on the actual value of the center point coordinates and the predicted value of the center point coordinates.

[0090] The first loss function is used to represent the center point coordinate loss, which is determined by the difference between the actual center point coordinates and the predicted center point coordinates.

[0091] Since the accuracy of center point coordinate prediction is closely related to the category of the target object, and the scale differences among target objects in dense target images are large, which can easily lead to an imbalance between positive and negative samples, this application uses the focus loss function as the first loss function to determine the loss value of the positive sample corresponding to each target object at different scales. Specifically, the first loss function can be determined by the following formula:

[0092]

[0093] In the formula, N represents the number of positive samples corresponding to the target object in the image to be trained, which is used to normalize the loss value. α and γ represent the hyperparameters of Focalloss. pt∈[cls and obj] represents the conditional class probability and confidence of selecting positive samples predicted by the network. y∈[0,1] represents the target value, and each target value corresponds to several positive samples predicted by the network.

[0094] Optionally, this application may set α to 4 and γ to 2.

[0095] S250. Generate a second loss function based on the true values ​​of the bounding box parameters and the predicted values ​​of the bounding box parameters.

[0096] The second loss function represents the regression loss of the bounding box parameters, which is determined by the difference between the true values ​​and the predicted values ​​of the bounding box parameters.

[0097] In this application, for bounding box parameters represented in polar coordinates, in order to ensure the stability of the regression, the second loss function can use the Smooth L1 loss function to regress the bounding box parameters.

[0098] Optionally, the true values ​​of the bounding box parameters include the true values ​​of the bounding box polar angle, the true values ​​of the bounding box polar diameter, and the true values ​​of the bounding box offset; the predicted values ​​of the bounding box parameters include the predicted values ​​of the bounding box polar angle, the predicted values ​​of the bounding box polar diameter, and the predicted values ​​of the bounding box offset. The step of generating a second loss function based on the true values ​​of the bounding box parameters and the predicted values ​​of the bounding box parameters includes: generating a second loss function based on the true values ​​of the bounding box polar angle, the true values ​​of the bounding box polar diameter, the true values ​​of the bounding box offset, the predicted values ​​of the bounding box polar angle, the predicted values ​​of the bounding box polar diameter, and the predicted values ​​of the bounding box offset.

[0099] In polar coordinates, bounding box parameters can be represented by polar angle, polar radius, and offset. Therefore, in this application, the second loss function can be determined based on the predicted and actual values ​​of the bounding box's polar angle, polar radius, and offset. For example, using the Smooth L1 loss function, the second loss function can be expressed by the following formula:

[0100]

[0101] In the formula, This represents the actual values ​​of the bounding box parameters. This represents the predicted values ​​of the bounding box parameters.

[0102] Since directly regressing all parameters of the bounding box results in a slow decrease in the model loss value, and the model is unstable during the regression process due to the periodicity of the angle, this application approximates the rotated rectangular bounding box with an ellipse to address the correlation between the regression of the rotated bounding box and the angle, as well as the instability caused by the periodicity of the angle. This ensures that any rectangular bounding box has a unique ellipse equation after transformation, thereby improving the stability of the model regression.

[0103] Optionally, generating a second loss function based on the true values ​​and predicted values ​​of the bounding box parameters further includes: generating a third loss function based on the true values ​​of the bounding box polar radius, the true values ​​of the bounding box offset, the predicted values ​​of the bounding box polar radius, and the predicted values ​​of the bounding box offset; performing elliptical approximation and discretization on the predicted bounding box based on the predicted values ​​of the bounding box parameters to obtain a first discrete elliptical polar coordinate equation; and performing elliptical approximation and discretization on the true bounding box based on the true values ​​of the bounding box parameters to obtain a second discrete elliptical polar coordinate equation; determining the predicted discrete polar radius values ​​corresponding to each discrete angle based on the first discrete elliptical polar coordinate equation; and determining the true discrete polar radius values ​​corresponding to each discrete angle based on the first discrete elliptical polar coordinate equation; wherein the discrete angles represent the angles after the ellipse is equally divided after discretization; generating a fourth loss function based on each predicted discrete polar radius value and each true discrete polar radius value; and generating a second loss function based on the third and fourth loss functions.

[0104] First, for the bounding box polar radius and offset, the Smooth L1 loss function can still be used to generate a third loss function through regression, i.e.

[0105] Secondly, for the bounding box rotation angle, the bounding box can be approximated as an elliptical polar coordinate equation; then it can be discretized to obtain a discrete elliptical polar coordinate equation; finally, the area intersection-union ratio of the predicted ellipse and the real ellipse can be determined to obtain the fourth loss function.

[0106] When approximating the polar coordinate equation of an ellipse, the longest and shortest sides of the polar radius in the bounding box parameters can be taken as the major and minor axes of the ellipse, respectively. The polar coordinate equation of the ellipse can be expressed by the following formula:

[0107]

[0108] In the formula, a represents the major axis of the ellipse, and b represents the minor axis of the ellipse. This indicates the rotation angle of the bounding box.

[0109] To facilitate the calculation of the area intersection ratio between the predicted ellipse and the actual ellipse, the above elliptical polar coordinate equation needs to be discretized to obtain the discrete elliptical polar coordinate equation. Specifically, taking the center point of the target object as the pole, the polar coordinate plane is divided into n equal parts, with each part corresponding to a polar angle of 2π / n. Therefore, a polar coordinate plane is divided into n angles as shown below:

[0110]

[0111] In the formula,

[0112] After discretizing the angles in the polar coordinate plane, we can obtain the discrete elliptic polar coordinate equation, which is expressed as follows:

[0113] When determining the area intersection-union ratio of the predicted ellipse and the true ellipse, to ensure that the polar radii of corresponding discrete angular positions of the two discrete ellipses match, the equally divided angles need to be rotated by a fixed amount. Specifically, the calculation method is as follows:

[0114]

[0115] In the formula, This represents the angle that divides the polar coordinate plane into n equal parts. Indicates the rotation angle of the bounding box. This represents the angle by which the polar coordinate plane is divided into n equal parts after rotation.

[0116] Divide the angles after rotation Substituting these values ​​into the expression for calculating the polar radius of a discrete ellipse, we can obtain n polar radii with the x-axis as the starting edge:

[0117] For the mapped predicted values ​​and label values, the Euclidean distance can be used to calculate the distance between the n polar radii of the discrete ellipse.

[0118]

[0119] In the formula, L Oval This represents the fourth loss function. and These represent the predicted and actual polar diameter values ​​at the corresponding discrete angles, respectively.

[0120] The advantages of the above approach are that the Oval loss function can solve the periodicity problem in the angle regression process, thereby accelerating the training descent speed; secondly, compared with directly using the Smooth L1 loss function as the bounding box parameter loss function, the Oval loss function greatly improves the correlation between the polar angle and polar radius of the bounding box, thereby effectively improving the overall performance of the model.

[0121] In summary, the second loss function can be expressed by the following formula:

[0122]

[0123] In the formula, γ represents the reduction of L reg The weighting coefficient for balancing the loss can be set to 3.

[0124] S260. Generate a target loss function based on the first loss function and the second loss function; and train the detection model to be trained with the goal of reducing the loss function, to obtain a trained dense target detection model.

[0125] In this application, a multi-task loss function can be used to optimize the model parameters. Based on the loss function described in steps S240 and S250, the target loss function can be expressed as:

[0126]

[0127] In the formula, N pos This indicates the number of positive samples that match the target label.

[0128] This invention provides a training method for a dense object detection model. When determining the target loss function, this method first generates a first loss function based on the actual and predicted center point coordinates; then, it generates a second loss function based on the actual and predicted bounding box parameters; finally, it generates the target loss function based on the first and second loss functions. This technical solution, through multi-task loss functions, calculates the loss for both center point coordinates and bounding box parameters separately, improving the generalization and robustness of the detection model under training, thereby enhancing the prediction accuracy of the dense object detection model.

[0129] Example 3

[0130] Figure 3 This is a flowchart of a dense target detection method provided in Embodiment 3 of this application. This embodiment is applicable to the identification and detection of targets, especially dense targets. The method can be executed by a dense target detection device, which can be implemented in hardware and / or software and can be configured in a device with data processing capabilities. Figure 3 As shown, the method includes the following steps.

[0131] S310. Obtain the image to be detected; wherein the image to be detected includes at least one target object.

[0132] S320. Based on the dense target detection model, identify the target objects in the image to be detected, and determine the bounding box detection results corresponding to each target object; wherein, the dense target detection model is trained based on the training method of any of the dense target detection models described in this application.

[0133] This invention provides a dense target detection method. The method involves acquiring an image to be detected, wherein the image includes at least one target object; identifying the target objects in the image based on a dense target detection model, and determining the bounding box detection results corresponding to each target object. This technical solution solves the problem of low detection accuracy in dense target detection using traditional methods by employing a first detection network that predicts center points and a second detection network that predicts bounding box parameters based on center points.

[0134] Example 4

[0135] Figure 4 This is a schematic diagram of the structure of a training device for a dense target detection model provided in Embodiment 4 of the present invention. Figure 4 As shown, the device includes:

[0136] The sample dataset acquisition module 410 is used to acquire a sample dataset; wherein, the sample dataset includes training sample images and label information corresponding to the training sample images, the label information includes the true values ​​of the center point coordinates and the true values ​​of the bounding box parameters in the training sample images, and the true bounding box is a rectangular box containing the target object in the training sample images;

[0137] The center point coordinate prediction module 420 is used to perform recognition processing on the training sample image based on the first detection network in the detection model to be trained, determine the prediction heatmap corresponding to the training sample image, and determine the center point coordinate prediction value of each target object according to the prediction heatmap.

[0138] The bounding box parameter prediction module 430 is used to perform prediction processing on the predicted heatmap and the predicted center point coordinates based on the second detection network in the detection model to be trained, and to determine the bounding box parameter prediction values ​​of the predicted bounding boxes of each target object.

[0139] The target detection model training module 440 is used to generate a target loss function based on the true value of the center point coordinates, the true value of the bounding box parameters, the predicted value of the center point coordinates and the predicted value of the bounding box parameters, and to train the detection model to be trained with reducing the loss function as the training objective, so as to obtain a trained dense target detection model.

[0140] This invention provides a training device for a dense target detection model. By integrating a first detection network that predicts center points and a second detection network that predicts bounding box parameters based on center points, the device improves the generalization of the dense target detection model, thereby improving the detection accuracy of dense targets.

[0141] Furthermore, the center point coordinate prediction module 420 includes:

[0142] An object category determination unit is used to determine the category of each target object in the training sample image based on the first detection network in the detection model to be trained;

[0143] A heatmap generation unit is used to determine a predicted heatmap corresponding to the training sample image based on the category of each of the target objects.

[0144] Furthermore, the bounding box parameter prediction module 430 includes:

[0145] The polar coordinate representation unit is used to determine the first polar angle and the first polar radius of the midpoint of each side of the predicted bounding box, based on the second detection network in the detection model to be trained, using the predicted coordinates of the center point as the pole of the polar coordinate system.

[0146] A heatmap rotation unit is used to ellipticize the Gaussian kernel of the predicted heatmap to obtain a rotated heatmap.

[0147] A Gaussian processing unit is used to perform Gaussian smoothing on the first polar angle based on the rotating heatmap to determine the second polar angle;

[0148] The bounding box parameter prediction unit is used to determine the predicted bounding box parameter values ​​of each target object based on the second polar angle and the first polar diameter of the midpoint of each side of the predicted bounding box.

[0149] Furthermore, the target detection model training module 440 includes:

[0150] The first loss function determination unit is used to generate a first loss function based on the true value of the center point coordinates and the predicted value of the center point coordinates;

[0151] The second loss function determination unit is used to generate a second loss function based on the true values ​​of the bounding box parameters and the predicted values ​​of the bounding box parameters;

[0152] The target loss function determination unit is used to generate a target loss function based on the first loss function and the second loss function.

[0153] Furthermore, the true values ​​of the bounding box parameters include the true values ​​of the polar angle, polar radius, and offset of the bounding box, and the predicted values ​​of the bounding box parameters include the predicted values ​​of the polar angle, polar radius, and offset of the bounding box.

[0154] The second loss function determination unit includes:

[0155] The second loss function determination sub-unit is used to generate a second loss function based on the true value of the bounding box polar angle, the true value of the bounding box polar diameter, the true value of the bounding box offset, the predicted value of the bounding box polar angle, the predicted value of the bounding box polar diameter, and the predicted value of the bounding box offset.

[0156] Furthermore, the second loss function determines the sub-unit, specifically for:

[0157] A third loss function is generated based on the true value of the bounding box polar radius, the true value of the bounding box offset, the predicted value of the bounding box polar radius, and the predicted value of the bounding box offset.

[0158] Based on the predicted bounding box parameter values, the predicted bounding box is approximated and discretized to obtain a first discrete elliptical polar coordinate equation; and based on the true bounding box parameter values, the true bounding box is approximated and discretized to obtain a second discrete elliptical polar coordinate equation.

[0159] Based on the first discrete ellipse polar coordinate equation, the predicted discrete polar radius corresponding to each discrete angle is determined, and the true discrete polar radius corresponding to each discrete angle is determined based on the first discrete ellipse polar coordinate equation; wherein, the discrete angle is used to represent the angle of the ellipse after being equally divided after discretization.

[0160] A fourth loss function is generated based on the predicted values ​​of each discrete extreme path and the actual values ​​of each discrete extreme path.

[0161] A second loss function is generated based on the third loss function and the fourth loss function.

[0162] Furthermore, the detection model to be trained is a model obtained by fusing the first detection network and the second detection network based on a gating network.

[0163] The training apparatus for the dense target detection model provided in the embodiments of the present invention can execute the training method for the dense target detection model provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0164] Example 5

[0165] Figure 5 This is a schematic diagram of a dense target detection device provided in Embodiment 5 of the present invention. Figure 5 As shown, the device includes:

[0166] The detection image acquisition module 510 is used to acquire an image to be detected; wherein the image to be detected includes at least one target object;

[0167] The target bounding box detection module 520 is used to identify target objects in the image to be detected based on the dense target detection model, and to determine the bounding box detection results corresponding to each target object; wherein, the dense target detection model is trained based on the training method of any of the dense target detection models described in this application.

[0168] The dense target detection device provided in the embodiments of the present invention can execute the dense target detection method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method execution.

[0169] Example 6

[0170] Figure 6 A schematic diagram of the structure of a device 10 that can be used to implement embodiments of this application is shown. The device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the application described and / or claimed herein.

[0171] like Figure 6 As shown, device 10 includes at least one processor 11 and a memory, such as read-only memory (ROM) 12, random access memory (RAM) 13, etc., communicatively connected to at least one processor 11. The memory stores computer programs executable by at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of device 10. The processor 11, ROM 12, and RAM 13 are interconnected via bus 14. Input / output (I / O) interface 15 is also connected to bus 14.

[0172] Multiple components in device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of monitors, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0173] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as training methods for dense object detection models or dense object detection methods.

[0174] In some embodiments, the training method for the dense object detection model may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the training method for the dense object detection model described above may be performed. Alternatively, in other embodiments, processor 11 may be configured by any other suitable means (e.g., by means of firmware) to perform the training method for the dense object detection model or a dense object detection method.

[0175] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0176] Computer programs used to implement the methods of this application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0177] In the context of this application, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0178] To provide interaction with a user, the systems and techniques described herein can be implemented on a device having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or haptic feedback); and input from the user can be received in any form (including sound input, voice input, or haptic input).

[0179] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0180] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0181] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this application can be achieved, and this is not limited herein.

[0182] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A training method for a dense target detection model, characterized in that, The method includes: Obtain a sample dataset; wherein the sample dataset includes training sample images and label information corresponding to the training sample images, the label information includes the true coordinates of the center point of the true bounding box in the training sample image and the true values ​​of the bounding box parameters, the true bounding box being a rectangular box containing the target object in the training sample image; The training sample image is identified based on the first detection network in the detection model to be trained, and a predicted heatmap corresponding to the training sample image is determined. The predicted center point coordinates of each target object are then determined based on the predicted heatmap. Based on the second detection network in the detection model to be trained, the predicted heatmap and the predicted center point coordinates are predicted to determine the predicted bounding box parameters of each target object. A target loss function is generated based on the true values ​​of the center point coordinates, the true values ​​of the bounding box parameters, the predicted values ​​of the center point coordinates and the predicted values ​​of the bounding box parameters. The detection model to be trained is trained with the goal of reducing the loss function, and a trained dense target detection model is obtained.

2. The method according to claim 1, characterized in that, The step of performing recognition processing on the training sample images based on the first detection network in the detection model to be trained, and determining the predicted heatmap corresponding to the training sample images, includes: Based on the first detection network in the detection model to be trained, the category of each target object in the training sample image is determined; Based on the category of each target object, a predicted heatmap corresponding to the training sample image is determined.

3. The method according to claim 1, characterized in that, The process of predicting the predicted heatmap and the predicted center point coordinates based on the second detection network in the detection model to be trained, and determining the predicted bounding box parameters of each target object, includes: Based on the second detection network in the detection model to be trained, the predicted coordinates of the center point are used as the pole of the polar coordinate system, and the first polar angle and the first polar radius of the midpoint of each side of the predicted bounding box are determined respectively. The Gaussian kernel of the predicted heatmap is ellipticized to obtain a rotating heatmap; Based on the rotating heatmap, the first polar angle is Gaussian smoothed to determine the second polar angle; Based on the second polar angle and the first polar radius of the midpoint of each side of the predicted bounding box, the predicted bounding box parameter values ​​of each target object are determined.

4. The method according to claim 1, characterized in that, The step of generating the target loss function based on the true values ​​of the center point coordinates, the true values ​​of the bounding box parameters, the predicted values ​​of the center point coordinates, and the predicted values ​​of the bounding box parameters includes: A first loss function is generated based on the actual value of the center point coordinates and the predicted value of the center point coordinates; A second loss function is generated based on the true values ​​of the bounding box parameters and the predicted values ​​of the bounding box parameters; A target loss function is generated based on the first loss function and the second loss function.

5. The method according to claim 4, characterized in that, The true values ​​of the bounding box parameters include the true values ​​of the polar angle, polar radius, and offset of the bounding box, and the predicted values ​​of the bounding box parameters include the predicted values ​​of the polar angle, polar radius, and offset of the bounding box. The step of generating a second loss function based on the true values ​​of the bounding box parameters and the predicted values ​​of the bounding box parameters includes: A second loss function is generated based on the true values ​​of the bounding box polar angle, the true values ​​of the bounding box polar diameter, the true values ​​of the bounding box offset, the predicted values ​​of the bounding box polar angle, the predicted values ​​of the bounding box polar diameter, and the predicted values ​​of the bounding box offset.

6. The method according to claim 5, characterized in that, The step of generating a second loss function based on the true values ​​of the bounding box parameters and the predicted values ​​of the bounding box parameters further includes: A third loss function is generated based on the true value of the bounding box polar radius, the true value of the bounding box offset, the predicted value of the bounding box polar radius, and the predicted value of the bounding box offset. Based on the predicted bounding box parameter values, the predicted bounding box is approximated and discretized to obtain a first discrete elliptical polar coordinate equation; and based on the true bounding box parameter values, the true bounding box is approximated and discretized to obtain a second discrete elliptical polar coordinate equation. Based on the first discrete ellipse polar coordinate equation, the predicted discrete polar radius corresponding to each discrete angle is determined, and the true discrete polar radius corresponding to each discrete angle is determined based on the first discrete ellipse polar coordinate equation; wherein, the discrete angle is used to represent the angle of the ellipse after being equally divided after discretization. A fourth loss function is generated based on the predicted values ​​of each discrete extreme path and the actual values ​​of each discrete extreme path. A second loss function is generated based on the third loss function and the fourth loss function.

7. The method according to claim 1, characterized in that, The detection model to be trained is a model obtained by fusing the first detection network and the second detection network based on a gating network.

8. A method for detecting dense targets, characterized in that, The method includes: Acquire an image to be detected; wherein the image to be detected includes at least one target object; The dense target detection model is used to identify target objects in the image to be detected, and the bounding box detection results corresponding to each target object are determined respectively; wherein, the dense target detection model is trained based on the training method of the dense target detection model according to any one of claims 1-7.

9. An electronic device, characterized in that, The device includes: At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the training method of the dense target detection model according to any one of claims 1-7 or the dense target detection method according to claim 8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute and implement the training method of the dense target detection model according to any one of claims 1-7 or the dense target detection method according to claim 8.