Method and system for slanted target training and detection
By combining the six-parameter representation of the tilted target box with the angle-predicted pseudo-anchor box, the problem of angle boundary rotation sensitivity error in tilted target detection is solved, achieving high-precision and high-efficiency detection results, which are suitable for various engineering tasks.
Patent Information
- Application Number
- CN202210758629.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-30
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2042-06-30
AI Technical Summary
Existing tilted target detection technologies face challenges in terms of rapid and accurate localization and identification, especially for targets with very large aspect ratios, where existing methods struggle to achieve high-precision and high-efficiency detection.
By employing a six-parameter representation of tilted target boxes and angle-predicted pseudo-anchor boxes, and combining the characteristics of anchor boxes and non-anchor boxes, a decoupled prediction branch group is designed. A truth heatmap of a rotating elliptical Gaussian function is introduced to optimize the loss function, thereby solving the problem of rotational sensitivity error at angle boundaries and improving detection accuracy and inference efficiency.
It achieves high-precision and high-efficiency tilt target detection, solves the problem of rotation sensitivity error at angle boundaries, improves detection accuracy and inference efficiency, and is suitable for a variety of engineering tasks.
Smart Images

Figure CN115223007B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer vision, and more specifically, to methods and systems for training and detecting tilted targets. Background Technology
[0002] Object detection aims to find all objects of interest in an image, determine their category and location, and is one of the core problems in the field of computer vision. It is widely used in industrial defect detection, obstacle detection such as vehicles and pedestrians around autonomous driving, face detection, security liveness detection, license plate detection and other fields.
[0003] Based on the shape of the bounding box, object detection techniques can be divided into horizontal object detection and tilted object detection. Compared with horizontal object detection, tilted object detection has the following advantages: 1) For targets with a very large aspect ratio, tilted bounding box representation will obtain more of the target's pixel proportion within the box, resulting in higher classification accuracy; 2) For tasks such as text detection and remote sensing monitoring, tilted bounding box representation can obtain the target's angle information, which is crucial for the realization of the algorithm's value.
[0004] Currently, most academic and engineering research focuses on horizontal target detection, while research on tilted target detection is relatively limited due to its later development. However, compared to horizontal target detection, tilted frame detection has greater practical application value in engineering tasks, but how to quickly and accurately locate and identify the position of tilted targets remains one of the most challenging issues in the field. Summary of the Invention
[0005] The embodiments of this application provide a method and system for tilted target detection, which combines the characteristics of anchor frames and no anchor frames to propose an angle prediction pseudo anchor frame, solves the problem of angle boundary rotation sensitivity error, and thus achieves better detection accuracy and prediction efficiency.
[0006] According to a first aspect of this application, a method for training a tilted target is provided, the method comprising: acquiring a training dataset, wherein the training dataset includes training images and tilted target bounding box data; preprocessing the training images and the tilted target bounding box data to obtain preprocessed training data; introducing a decoupled prediction branch group based on pseudo-anchor boxes to construct a tilted target detection model; and training the tilted target detection model using the preprocessed training data to obtain a trained tilted target detection model.
[0007] In some embodiments of the first aspect of this application, optionally, the decoupled prediction branch group includes: a tilted target classification branch, a tilted target size regression branch, a tilted target center point offset regression branch, a tilted target angle pseudo-anchor box classification branch, and a tilted target angle pseudo-anchor box offset regression branch.
[0008] In some embodiments of the first aspect of this application, optionally, the step of preprocessing the training images includes: reducing the original size of the training images... Convert to target size with equal height and width ,in The width represents the original size of the training image. The height represents the original size of the training image. The side length represents the target size of the training image.
[0009] In some embodiments of the first aspect of this application, optionally, the step of preprocessing the tilted target box data includes: converting the tilted target box data into a six-parameter representation, wherein the six-parameter representation includes the angle interval category of the tilted target box and the angle interval category regression correction value.
[0010] In some embodiments of the first aspect of this application, optionally, the step of converting the tilted target box data into a six-parameter representation includes: based on the original dimensions of the training image. Convert to target size with equal height and width The redirection scaling factor obtained during the process converts the tilted target box data into a five-parameter representation, wherein the redirection scaling factor is the long side of the original size. Side length of the target size The ratio; and converting the five-parameter representation of the tilted target box into a six-parameter representation.
[0011] Optionally, in some embodiments of the first aspect of this application, a Cartesian coordinate system is established on the training image, and the five parameters are represented as follows: In the formula, This indicates the x-axis position of the center point of the tilted target box. This indicates the y-axis position of the center point of the tilted target box. Indicates the width value of the tilted target box, Indicates the height value of the tilted target box, This represents the angle value of the tilted target box, wherein the angle value The angle between the wide side of the tilted target box and the x-axis is defined as follows, and the angle range is as follows: ;as well as The six parameters of the tilted target bounding box are represented as follows: In the formula For the angle interval category parameter, use the rounding function. The calculation formula is as follows: In the formula The angle difference parameter is calculated using the following formula: .
[0012] In some embodiments of the first aspect of this application, the method for training the tilted target may optionally further include: introducing a ground truth heatmap based on a rotated elliptical Gaussian function, and constructing a ground truth heatmap of the target category based at least on the training dataset.
[0013] Optionally, in some embodiments of the first aspect of this application, the expression for the Gaussian function of the rotated ellipse is: In the formula Take the angle value of the tilted target box. The x-axis position of the center point of the tilted target box is taken as the value. The value is the y-axis position of the center point of the tilted target box. and Calculate using the following formulas respectively: In the formula is the convergence factor.
[0014] In some embodiments of the first aspect of this application, optionally, the method for training the tilted target further includes: designing a loss function based at least on the decoupled prediction branch group, and training the tilted target detection model using the loss function.
[0015] In some embodiments of the first aspect of this application, optionally, the expression for the loss function is: In the formula L Kernal For the target category classification loss, L size For size regression loss, L offset For center point offset regression loss, L angc For the angular pseudo-anchor box classification loss, L angcr For the angular pseudo-anchor frame offset regression loss, λ size , λ offset , λ angc , λ angcr These are the weighting factors for size regression loss, center point offset regression loss, angle pseudo-anchor box classification loss, and angle pseudo-anchor box offset regression loss, respectively.
[0016] Optionally, in some embodiments of the first aspect of this application, the target category classification loss... Calculate using the following formula: In the formula, The values of the true heatmap are... For the predicted value of the tilted target classification branch, Number of feature map elements for the tilted target classification branch ,as well as , This is a hyperparameter.
[0017] Optionally, in some embodiments of the first aspect of this application, the size regression loss Only the locations of feature maps where the true heatmap is not zero are calculated; the expression is: In the formula, To regress the true value of the size, The predicted value for the regression branch of the tilted target size. For smooth L1 function, For the heatmap corresponding to the size regression feature map The number of elements.
[0018] Optionally, in some embodiments of the first aspect of this application, the center point offset regression loss Only the locations of feature maps where the true heatmap is not zero are calculated; the expression is: In the formula, The center point offset is the true value of the regression. The predicted value is the value of the regression branch for the tilted target center point offset. Heatmap of the corresponding ground truth in the center point offset regression feature map The number of elements.
[0019] Optionally, in some embodiments of the first aspect of this application, the angular pseudo-anchor frame classification loss... Only the locations of feature maps where the true heatmap is not zero are calculated; the expression is: In the formula, For the classification of angular pseudo-anchor boxes, The predicted value for the pseudo-anchor box classification branch at the tilted target angle is... For the heatmap of ground truth in the feature map of the angular pseudo-anchor box classification, The number of elements, This is the cross-entropy function for multi-class classification.
[0020] Optionally, in some embodiments of the first aspect of this application, the angular pseudo-anchor frame offset regression loss Calculate using the following formula: In the formula, The true value of the angular pseudo-anchor box offset regression is given. The regression prediction value is the angle pseudo-anchor frame offset. For the heatmap of ground truth in the feature map of the angular pseudo-anchor box classification, And the number of elements whose one-hot encoding is 1 for the true value category of the pseudo-anchor box classification.
[0021] According to a second aspect of this application, a method for detecting tilted targets is provided, characterized in that the method includes: obtaining a trained tilted target detection model according to the tilted target training method according to any one of the first aspects of this application; obtaining an image to be detected; preprocessing the image to be detected to obtain preprocessed detection data; inputting the preprocessed detection data into the trained tilted target detection model for prediction; and postprocessing the prediction result to obtain a detection result.
[0022] In some embodiments of the second aspect of this application, optionally, the prediction results include: tilted target classification prediction, tilted target size regression prediction, tilted target center point offset regression prediction, tilted target angle pseudo-anchor box classification prediction, and tilted target angle pseudo-anchor box offset regression prediction.
[0023] In some embodiments of the second aspect of this application, optionally, the step of post-processing the prediction result includes: taking the tilted target center point offset to correct the center point position of the tilted target box, and taking the tilted target angle pseudo-anchor box offset to correct the classification center line angle of the tilted target pseudo-anchor box.
[0024] According to a third aspect of this application, a system for training and detecting tilted targets is provided, the system comprising: a memory configured to store instructions; and a processor configured to execute the instructions such that the system performs any of the methods described in the first and / or second aspects of this application.
[0025] According to a fourth aspect of this application, a computer-readable storage medium is provided, wherein instructions are stored therein, which, when executed by a processor, cause the processor to perform any one of the methods described in the first and / or second aspects of this application.
[0026] This application proposes a training method and detection method for tilted targets. It innovatively designs a six-parameter representation of tilted target boxes and a rotated elliptical Gaussian heatmap. It also proposes an angle prediction pseudo-anchor box by combining the characteristics of anchor boxes and no anchor boxes, which solves the problem of rotation sensitivity error of angle boundaries, thereby achieving better detection accuracy and inference efficiency. Attached Figure Description
[0027] The above and other objects and advantages of this application will become more fully clear from the following detailed description taken in conjunction with the accompanying drawings, wherein the same or similar elements are denoted by the same reference numerals.
[0028] Figure 1 A schematic diagram of a method 100 for training a tilted target according to an embodiment of this application is shown; Figure 2 A five-parameter representation of a tilted target box according to an embodiment of this application is described; Figure 3A and Figure 3B A six-parameter representation of a tilted target box according to an embodiment of this application is described; Figure 4 A schematic diagram of a method 400 for detecting tilted targets according to an embodiment of this application is shown; Figure 5 A schematic diagram of a system 500 for training and detecting tilted targets according to an embodiment of this application is shown. Detailed Implementation
[0029] For purposes of brevity and illustration, the principles of this application are described herein primarily with reference to exemplary embodiments thereof. However, those skilled in the art will readily recognize that the same principles can be equivalently applied to all types of methods and systems for training and detecting tilted targets, and that these same or similar principles can be implemented therein, without departing from the true spirit and scope of this application.
[0030] Below, we will combine Figure 1 This invention describes a method 100 for training a tilted target according to one embodiment of the present application.
[0031] Figure 1 A method 100 for training a tilted target according to an embodiment of this application is shown. Figure 1 As shown, the method 100 for training a tilted target includes steps S102, S104, S106, S108, and S110.
[0032] In step S102, a training dataset is obtained, which includes training images and tilted bounding box data. The training images have a certain width and height. In some embodiments, a specific method may be used. To label the original size of the training images, where The width represents the original size of the training image. The height represents the original dimensions of the training image. The tilted bounding box data includes label data describing the position, size, and shape of the tilted bounding boxes; this label data may be an initial representation of the tilted bounding boxes. In some embodiments, a Cartesian coordinate system is established on the training image, and the initial representation of the tilted bounding boxes includes the coordinate positions of the four endpoints of the tilted bounding boxes.
[0033] In step S104, the training images and tilted target box data in the training dataset are preprocessed to obtain preprocessed training data.
[0034] In some embodiments, the preprocessing step of training images includes: transforming the original size of the training images into a uniform target size. A uniform target size facilitates the participation of training images in subsequent model training. Optionally, the original size of the training images... Redirect to target size with equal height and width ,in, This represents the side length (i.e., equal height and width) of the target size of the training image. In some embodiments, the longer side of the original height and width of the training image is denoted as . , make the long side and The ratio is defined as the retargeting scaling factor. In the process of converting the original size of the training image to the target size, the longer side of the original size can be adapted to the side length of the target size. When the shorter side of the original size is smaller than the side length of the target size, the insufficient portion of the shorter side can be padded with pixel values of 0.
[0035] In some embodiments, the preprocessing step for tilted target box data includes transforming the representation of the tilted target boxes. Because tilted target boxes have the unique characteristic of angle prediction, the appropriateness of their representation is crucial to prediction accuracy. Both the five-parameter long-side definition method and the eight-parameter ordered quadrilateral definition method suffer from angle boundary rotation sensitivity errors. If the prediction results exceed the defined range during training, boundary problems arise, resulting in a large loss value, making model training difficult to converge and achieving satisfactory prediction accuracy.
[0036] This application innovatively designs a six-parameter representation method for tilted target boxes to address the problem of rotation sensitivity errors at angle boundaries, making the algorithm easier to converge during training and achieving better prediction accuracy. Specifically, the steps for transforming the tilted target box representation method may include: converting the initial representation of the tilted target boxes in the tilted target box data into a six-parameter representation method, wherein the six-parameter representation method may include the angle interval category parameter and the angle interval category regression correction value parameter of the tilted target box.
[0037] In some embodiments, the specific steps of converting the initial representation of the tilted target box into a six-parameter representation may include: redirecting the tilted target box data accordingly based on the redirection scaling factor obtained during the preprocessing of the training image. The process of redirecting the tilted target box data includes: first converting the initial representation of the tilted target box into a five-parameter representation, and then converting the five-parameter representation into a six-parameter representation. When using the coordinate positions of the four endpoints of the tilted target box as the initial representation, the process of redirecting the tilted target box data may include: first converting the initial representation of the coordinate positions of the four endpoints of the tilted target box into a five-parameter representation, and then converting the five-parameter representation into a six-parameter representation.
[0038] The following will combine Figure 2 A five-parameter representation used to describe the position, size, and shape of a tilted target bounding box. Figure 2 This paper illustrates a five-parameter representation of a tilted target bounding box according to an embodiment of this application. In some embodiments, based on a Cartesian coordinate system established on the training image, the five-parameter representation of the tilted target bounding box, describing its position, size, and angle, is as follows: .
[0039] Combination Figure 2 As can be seen in the formula, This indicates the x-axis position of the center point of the tilted target box. This indicates the y-axis position of the center point of the tilted target box. Indicates the width value of the tilted target box, Indicates the height value of the tilted target box, This represents the angle value of the tilted target box, wherein the angle value The angle between the wide side of the tilted target box and the x-axis is defined as follows, and the angle range is as follows: .
[0040] Next, we will combine Figure 3A and Figure 3B This describes the six-parameter representation of the tilted target box. Figure 3A and Figure 3B A six-parameter representation of a tilted target box according to one embodiment of this application is described. (Combined with...) Figure 3A As can be seen, based on the Cartesian coordinate system established on the training images, the six parameters of the tilted target box can be represented as follows: .
[0041] Embodiments of this application can convert angle values into angle interval categories and angle interval category regression correction values. Wherein, The angle interval category parameter can be obtained using the rounding function. The calculation formula is as follows: .
[0042] In this embodiment, refer to Figure 3A As can be seen, the angle value The angle from 0 to 180 degrees is divided into 12 intervals, each interval being 15 degrees, with interval numbers from 0 to 11. It can represent angle values. The interval number corresponding to the angle interval, and the angle interval category parameter. The value can be an integer between 0 and 11. In other embodiments, the number of angle intervals for the tilted target box pseudo-anchor box can also be other values, including but not limited to 8, 10, 12, and 16.
[0043] In the formula, This is an angle difference parameter, used to represent the difference between the angle value of the tilted target box and the angle corresponding to the center line of the angle interval. In some embodiments, The calculation formula can be: .
[0044] in, The value can be between -7.5 and 7.5.
[0045] Figure 3B The diagram illustrates the six-parameter representation of tilted bounding boxes. Redirecting the tilted bounding box data in the training dataset to a six-parameter representation can resolve the issue of rotation sensitivity errors at angular boundaries, making the algorithm easier to converge during training and facilitating the construction and training of tilted object detection models.
[0046] Next, let's turn back to... Figure 1 In order to combine Figure 1 Steps S106 and S108 will be described further.
[0047] In step S106, a decoupled prediction branch group based on pseudo-anchor boxes is introduced to construct a tilted target detection model. In some embodiments, the tilted target detection model is divided into three parts: an image feature encoder module, an upsampling module, and a decoupled prediction branch group.
[0048] The image feature encoder module can consist of multiple convolutional and pooling layers. The image feature encoder module is responsible for processing the image features obtained after preprocessing (e.g., the preprocessing in step S104) to obtain a feature size of [missing information]. Feature extraction is performed on the image to generate a shallow feature map with semantic information, wherein the size of the shallow feature map is [size missing]. As candidates, the image feature encoder module includes, but is limited to, network structures such as Resenet-18, DLA-34, and Hourglass-104. In some embodiments, the feature encoder convolutional layer used in this application can be replaced with other forms of convolutional layers, including but not limited to grouped convolution, separable convolution, dilated convolution, and depthwise convolution.
[0049] Optionally, the upsampling module is responsible for upsampling the upstream feature map (i.e., the one with a size of [missing information]). The shallow feature map is upsampled and decoded to obtain the deep feature map, where the size of the deep feature map is... Optionally, the network structure of the upsampling module includes, but is not limited to, deconvolution, unpooling, bilinear interpolation, etc. In some embodiments, layers to avoid overfitting can be added to the network architecture, including but not limited to regularization and dropout. When obtaining a size of... After obtaining the deep feature map, the deep feature map can be input into the decoupled prediction branch group for prediction.
[0050] In some embodiments, the decoupled prediction branch group may consist of five prediction branches, namely: a tilted target classification branch, a tilted target size regression branch, a tilted target center point offset regression branch, a tilted target angle pseudo-anchor box classification branch, and a tilted target angle pseudo-anchor box offset regression branch. Each prediction branch of the decoupled prediction branch group can be obtained by a single convolutional layer. The decoupled prediction branch group of this application introduces pseudo-anchor boxes, decomposing angle prediction into an angle pseudo-anchor box prediction stage and an angle pseudo-anchor box angle regression correction stage.
[0051] Common tilted target detection techniques are mainly divided into two types: anchor-frame-based and anchor-free methods. Anchor-frame-based methods pre-select several anchor frames of different scales and aspect ratios for each pixel in the feature map, then classify each anchor frame and regress the positive class anchor frames to adjust their position and size. Because it simplifies the detection process, anchor-frame-based methods have good accuracy, but they also have many drawbacks. They require a lot of manual parameter setting, and the pre-set anchor frame size and proportion are not flexible enough when detecting objects with large differences. Furthermore, the model inference time is relatively long. Anchor-free methods do not use anchor frames and directly predict on the feature map. This method has high inference efficiency and does not require many hyperparameter settings, but the detection accuracy is relatively poor. This application combines the characteristics of anchor frames and anchor-free methods to propose an angle prediction pseudo-anchor frame, solving the problem of angle boundary rotation sensitivity error, thereby achieving better prediction accuracy and inference efficiency, and realizing end-to-end training and detection of tilted targets in images.
[0052] Optionally, the feature map size of the tilted target classification branch is ,in The number of tilted target categories; the feature map size of the tilted target size regression branch is [value missing]. The feature map size of the tilted target center point offset regression branch is The feature map size of the pseudo-anchor box classification branch with tilted target angle is The feature map size of the tilted target angle pseudo-anchor box offset regression branch is [size missing]. .
[0053] This application specifically designs a ground truth heatmap based on a rotated elliptic Gaussian function for the tilted target detection task, enabling the tilted target detection model to better learn the features of tilted targets. In some embodiments, the tilted target training method 100 may further include: introducing a ground truth heatmap based on a rotated elliptic Gaussian function, and constructing a target category ground truth heatmap based at least on the training dataset.
[0054] Alternatively, the expression for the Gaussian function of the rotated ellipse is: .
[0055] In the formula, The angle is a Gaussian function, and its value is related to the angle of the tilted target box. same; The x-coordinate of the center point of the Gaussian function is the same as the x-axis position of the center point of the tilted target box (i.e., the same as the x-axis position of the center point of the target box). (The values are the same) The y-coordinate of the center point of the Gaussian function is the same as the y-axis position of the center point of the tilted target box (i.e., the same as the center point of the target box). (The values are the same) and The variances of the Gaussian function, represented by the x-coordinate and y-coordinate respectively, can be calculated using the following formula: , .
[0056] In the formula, is the convergence factor.
[0057] Optionally, the specific method for generating the target category truth heatmap includes: first, rounding the coordinates of the center point of the tilted target box; second, calculating the parameters of the Gaussian function of the rotating ellipse based on the length, width, and angle of the tilted target box; and then, according to the number of categories of the tilted target... ,structure A ground truth heatmap with an initial value of 0 is generated, and its size is consistent with the feature map size of the tilted target classification branch in the decoupled prediction branch group. For each category's ground truth heatmap, a Gaussian function is used to fill the heatmap with the integer coordinates of the bounding box center point as the center of a rotation ellipse. The integer coordinates of the bounding box center point are the maximum value, decreasing outwards along the axis of the rotation ellipse according to the Gaussian function. If the Gaussian regions of two targets of the same category overlap, the maximum value of both is taken as the calculated heatmap value. In some embodiments, the ground truth heatmap based on the rotation ellipse Gaussian can be applied to the training dataset and / or validation dataset to generate ground truth heatmaps for target categories. This application employs a ground truth heatmap based on the rotation ellipse Gaussian, enabling the tilted target detection model to better learn the features of tilted targets.
[0058] In step S108, the tilted target detection model constructed in step S106 is trained using the preprocessed training data obtained in step S104 to obtain a trained tilted target detection model. In some embodiments, the tilted target training method further includes: designing a loss function based at least on decoupled prediction branch groups, and using the loss function to train the tilted target detection model.
[0059] Optionally, the expression for the loss function is: In the formula, Classification loss for the target category, For size regression loss, For center point offset regression loss, For the angular pseudo-anchor box classification loss, The regression loss is for the angular pseudo-anchor frame offset. , , , These are the weighting factors for size regression loss, center point offset regression loss, angle pseudo-anchor box classification loss, and angle pseudo-anchor box offset regression loss, respectively.
[0060] It should be noted that the target category classification loss The size regression loss corresponds to the tilted target classification branch of the decoupled prediction branch group. and size regression loss weight factor Corresponding to the tilted target size regression branch, the center point offset regression loss and center point offset regression loss weighting factor Corresponding to the tilted target center point offset regression branch, the angle pseudo-anchor box classification loss And the weighting factor of the pseudo-anchor box classification loss. Corresponding to the tilted target angle pseudo-anchor box classification branch, the angle pseudo-anchor box offset regression loss and the weighting factor of regression loss for pseudo-anchor frame offset. This corresponds to the pseudo-anchor frame offset regression branch at the tilted target angle.
[0061] Optionally, tilted target category classification loss Calculate using the following formula: In the formula, The values of the true heatmap are... For the predicted value of the tilted target classification branch, Number of feature map elements for the tilted target classification branch , , This is a hyperparameter.
[0062] Optionally, tilt target size regression loss Only the locations of feature maps where the true heatmap is not zero are calculated; the expression is: In the formula, To regress the true value of the size, For the size regression branch prediction value, For smooth L1 function, For the heatmap corresponding to the size regression feature map The number of elements.
[0063] Optionally, center point offset regression loss Only the locations of feature maps where the true heatmap is not zero are calculated; the expression is: In the formula, The center point offset is the true value of the regression. The predicted value is the value of the regression branch for the tilted target center point offset. Heatmap of the corresponding ground truth in the center point offset regression feature map The number of elements.
[0064] Optionally, angular pseudo-anchor box classification loss Only the locations of feature maps where the true heatmap is not zero are calculated; the expression is: In the formula, The ground truth for classifying angular pseudo-anchor boxes is determined using one-hot class encoding. The predicted value for the pseudo-anchor box classification branch at the tilted target angle is... For the heatmap of ground truth in the feature map of the angular pseudo-anchor box classification, The number of elements, This is the cross-entropy function for multi-class classification.
[0065] Optionally, angular pseudo-anchor frame offset regression loss Calculate using the following formula: In the formula, The pseudo-anchor box offset regression ground truth is obtained using one-hot class encoding. The regression prediction value is the angle pseudo-anchor frame offset. For the heatmap of ground truth in the feature map of the angular pseudo-anchor box classification, And the number of elements whose one-hot encoding is 1 for the true value category of the pseudo-anchor box classification.
[0066] In some embodiments, step S108 may further include: designing a training strategy to train the training dataset using a loss function and a training strategy until the model converges to the minimum loss value. Optionally, the specific implementation of the training strategy includes: training the tilted object detection model multiple times using the training dataset, and using online data augmentation methods in the training dataset, including but not limited to rotation, translation, and mirroring, to train until the loss of the validation dataset and / or the training dataset is continuous. Training stops when the learning rate does not decrease. To ensure the stability of training in the early stages, a warm-up strategy was used, where the learning rate was initially increased and then gradually decreased.
[0067] After the tilted target detection model is trained, the optimal weight parameters can be obtained to optimize the tilted target detection model.
[0068] In step S110, the trained tilt target detection model, including the optimal weight parameters, is saved to a specified file for subsequent detection applications.
[0069] Next, we will combine Figure 4 This application describes a method 400 for detecting tilted targets according to an embodiment of the present application.
[0070] Figure 4 A method 400 for detecting tilted targets according to an embodiment of this application is shown. Figure 4 As shown, the tilted target detection method 400 includes steps S402, S404, S406, S408 and S410, to detect the image to be detected using a trained tilted target detection model.
[0071] In step S402, the image to be detected is acquired. In some embodiments, the image to be detected can be acquired according to detection requirements.
[0072] In step S404, the image to be detected obtained in step S402 is preprocessed to obtain preprocessed detection data. In some embodiments, the preprocessing step of the image to be detected in step S404 is similar to the preprocessing step of the training dataset in step S104, and will not be described again here.
[0073] In step S406, a trained tilted target detection model is obtained according to the tilted target training method 100 described in any of the embodiments of this application above. In some embodiments, corresponding to the tilted target training method 100, a model file loaded with optimal weight parameters is saved in a specified file in step S110, and the trained tilted target detection model can be directly obtained from the corresponding specified file.
[0074] In step S408, the preprocessed data to be detected obtained in step S404 is input into the trained tilted target detection model for prediction. In some embodiments, the prediction results of step S408 may include: tilted target classification prediction, tilted target size regression prediction, tilted target center point offset regression prediction, tilted target angle pseudo-anchor box classification prediction, and tilted target angle pseudo-anchor box offset regression prediction.
[0075] In step S410, the predicted results are post-processed to obtain the detection results. In some embodiments, the post-processing specifically includes: a) first, taking the maximum value of the feature map of the predicted branch of the tilted target classification branch in the category dimension, and recording the category of the target corresponding to each position; b) using a size of If the calculated value of the convolution kernel performing two-dimensional max pooling is not equal to the position value, then the value at that position is set to 0; c) Next, the position values of the feature map that are less than the class score threshold are set to 0; d) Then, the value of the corresponding position on the feature map of the new tilted target classification branch prediction branch is taken from the non-zero position; e) The center point offset is used to correct the position of the tilted target center point, and then the angle pseudo-anchor box offset is used to correct the angle of the pseudo-anchor box classification center line, and finally the predicted tilted target box result is obtained.
[0076] Next, combined Figure 5 This application describes a system 500 for training and detecting tilted targets, based on one embodiment of the present application.
[0077] Figure 5 A system 500 for training and detecting tilted targets according to an embodiment of this application is shown. Figure 5 As shown, the tilt target training and detection system 500 includes a memory 502 and a processor 504. The memory 502 is configured to store instructions. The processor 504 is communicatively connected to the memory 502 and is configured to execute the instructions in the memory 502 to cause the system to perform any of the tilt target training methods 100 and / or tilt target detection methods 400 described above.
[0078] According to another aspect of this application, a computer-readable storage medium is provided, wherein instructions are stored that, when executed by a processor, cause the processor to perform any of the tilt target training methods 100 and / or tilt target detection methods 400 described above. The computer-readable medium referred to in this application includes various types of computer storage media, and can be any available medium accessible by a general-purpose or special-purpose computer. For example, the computer-readable medium may include RAM, ROM, EPROM, E... 2 PROM, registers, hard disks, removable disks, CD-ROMs or other optical disc storage, magnetic disk storage or other magnetic storage devices, or any other temporary or non-temporary medium capable of carrying or storing desired units of program code in the form of instructions or data structures and accessible by a general-purpose or special-purpose computer, or a general-purpose or special-purpose processor. As used herein, disks typically magnetically copy data, while discs optically copy data using lasers. Combinations of the above should also be included within the scope of computer-readable media. An exemplary storage medium is coupled to a processor so that the processor can read and write information from / to the storage medium. In an alternative, the storage medium may be integrated into the processor. The processor and storage medium may reside in an ASIC. The ASIC may reside in a user terminal. In an alternative, the processor and storage medium may reside as discrete components in the user terminal.
[0079] The method and system for training and detecting tilted targets presented in this application offer advantages such as high detection accuracy, high inference efficiency, and high generalization for engineering applications. This application designs a six-parameter representation of tilted target boxes to address the sensitivity error problem caused by angle boundary rotation, making the model easier to converge during training. Simultaneously, a ground truth heatmap based on a rotating elliptic Gaussian is designed, enabling the model to better learn the features of tilted targets, thereby significantly improving the detection accuracy of tilted target detection tasks. Furthermore, this application combines the advantages of both anchor-box and anchorless algorithms, proposing angle-predicted pseudo-anchor boxes and employing decoupled prediction branch groups based on this, saving a large amount of anchor-box matching calculations. This achieves high accuracy while maintaining short inference time, greatly improving inference efficiency. This application also employs a novel network model structure, eliminating the need to design numerous empirical hyperparameters for specific tasks, resulting in low difficulty in algorithm development for engineering applications and good generalization.
[0080] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Those skilled in the art can conceive of other feasible variations or substitutions based on the technical scope disclosed in this application, and such variations or substitutions are all covered within the scope of protection of this application. Where there is no conflict, the embodiments and features described in the embodiments of this application can also be combined with each other. The scope of protection of this application is determined by the claims.
Claims
1. A method for training and detecting tilted targets, characterized in that, The method for training and detecting tilted targets includes: Obtain a training dataset, wherein the training dataset includes training images and tilted bounding box data; The training images and the tilted target box data are preprocessed to obtain preprocessed training data; A decoupled prediction branch group based on pseudo-anchor boxes is introduced to construct a tilted target detection model; The tilted target detection model is trained using the preprocessed training data to obtain a trained tilted target detection model; Acquire the image to be detected; The image to be detected is preprocessed to obtain preprocessed detection data; The preprocessed data to be detected is input into the trained tilted target detection model for prediction; and The prediction results are post-processed to obtain the detection results, including: correcting the center point position of the tilted target box by taking the center point offset, and correcting the classification center line angle of the pseudo-anchor box by taking the angle pseudo-anchor box offset. The decoupled prediction branch group includes: a tilted target classification branch, a tilted target size regression branch, a tilted target center point offset regression branch, a tilted target angle pseudo-anchor box classification branch, and a tilted target angle pseudo-anchor box offset regression branch. Furthermore, the method further includes: introducing a ground truth heatmap based on a rotated elliptic Gaussian function, and constructing a target category ground truth heatmap based at least on the training dataset, wherein the expression for the rotated elliptic Gaussian function is: In the formula, θ is the angle value of the tilted target box, and x0 and y0 are the x-axis coordinates and y-axis coordinates of the center point of the Gaussian function, respectively, and their values are related to the x-axis coordinate of the center point of the tilted target box. c and y-axis coordinates c same, and Calculate using the following formulas respectively: In the formula Let w be the convergence factor, and h be the width of the tilted target box. The preprocessing step for the training image includes: adjusting the original dimensions of the training image... Convert to target size with equal height and width ,in The width represents the original size of the training image. The height represents the original size of the training image. The side length represents the target size of the training image. Furthermore, the preprocessing step for the tilted target box data includes: converting the tilted target box data into a six-parameter representation, wherein the six-parameter representation includes the angle interval category of the tilted target box and the angle interval category regression correction value, and the step of converting the tilted target box data into a six-parameter representation includes: Based on the original size of the training images Convert to target size with equal height and width The redirection scaling factor obtained during the process converts the tilted target box data into a five-parameter representation, wherein the redirection scaling factor is the long side of the original size. Side length of the target size The ratio; and The five-parameter representation of the tilted target box is transformed into a six-parameter representation. A Cartesian coordinate system is established on the training image. The five-parameter representation is as follows: In the formula, x c The x-axis position of the center point of the tilted target box is indicated by the x-axis position, and the y-axis position is indicated by the x-axis position. c The x-axis represents the center point position of the tilted target box, and ang represents the angle value of the tilted target box, where the angle value ang refers to the angle between the wide side of the tilted target box and the x-axis, and the angle range is [insert range here]. ;as well as The six parameters of the tilted target bounding box are represented as follows: In the formula, angc is the angular interval category parameter, obtained through the rounding function. The calculation formula is as follows: In the formula, angcr is the angle difference parameter, and the calculation formula is: 。 2. The method according to claim 1, characterized in that, The prediction results include: tilted target classification prediction, tilted target size regression prediction, tilted target center point offset regression prediction, tilted target angle pseudo-anchor frame classification prediction, and tilted target angle pseudo-anchor frame offset regression prediction.
3. A system for training and detecting tilted targets, characterized in that, The system includes: Memory configured to store instructions; and A processor configured to execute the instructions such that the system performs the method as described in claim 1 or 2.
4. A computer-readable storage medium storing instructions, characterized in that, When the instruction is executed by the processor, it causes the processor to perform the method as described in claim 1 or 2.
Citation Information
Patent Citations
Channel gate detection method, device and equipment and storage medium
CN112733630A
Typical target detection method and system under complex background based on deep learning
CN113128564A
Rotating target detection method and device based on convolutional neural network
CN113298169A
