Rotating target detection method and device based on gaussian distribution
By replacing the rotating frame with a two-dimensional Gaussian distribution and designing a corresponding loss function, a rotating target detection model is constructed, which solves the problem of angular periodicity in rotating target detection and improves the positioning accuracy and model stability of target detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-01
- Publication Date
- 2026-04-10
AI Technical Summary
In rotating target detection, the introduction of angle parameters leads to problems such as angle periodicity, boundary exchange, and inconsistency between model loss and evaluation metric, resulting in unstable model training and reduced target localization accuracy.
A two-dimensional Gaussian distribution is used to represent the target instead of a rotated box, and a loss function based on the two-dimensional Gaussian distribution is designed. A target pre-detection model is constructed through a deep residual network, a feature pyramid network, and a regression sub-network. The parameters of the Gaussian distribution are optimized to achieve coupling between the parameters.
Without increasing computational load, the model's detection accuracy was improved, problems such as angular periodicity were resolved, the localization accuracy of target detection was enhanced, and the model's convergence was promoted.
Smart Images

Figure CN115424267B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a rotating target detection method and device based on Gaussian distribution and equipment. BACKGROUND
[0002] As one of the most basic and challenging problems in the field of computer vision, target detection has attracted great attention in recent years, and its task involves positioning (where are the positions of the predefined class targets in the given remote sensing image?) and identification (which predefined class do these targets belong to?), which needs to distinguish the predefined class targets from the given image by regressing precise positioning and predicting correct class labels. The development process of target detection can mainly be divided into two stages: the traditional target detection stage and the deep learning-based target detection stage.
[0003] The traditional target detection algorithm mainly contains three parts: feature extraction, classifier training and classifier discrimination. Before target detection, the labeled training samples are first used to extract features and train the classifier. Then, when performing target detection on the input image, the sliding window method is usually used to extract the corresponding features of each sliding window and input them to the trained classifier to determine whether there is a target at the sliding position. After traversing the entire image, the positions of the targets on the image are finally obtained. Therefore, the feature description and classifier used for target discrimination are two important contents of the target detection algorithm. Common feature descriptions mainly include Haar wavelet features, Histograms of Oriented Gradients (HOG), Local Binary Pattern (LBP), etc., and the classifiers mainly include Support Vector Machines (SVM), Boosting and Random Forest (RF), etc.
[0004] With the performance of traditional target detection tending to saturation and the advanced semantic representation ability of deep learning to image, a large number of deep learning-based target detection methods are used for target detection of natural images (i.e. general target detection, using a horizontal box (x, y, w, h) to represent the position and size of the target, where x and y represent the center of the target, and w and h represent the width and height of the target respectively), such as Faster RCNN, YOLO series, etc., which have shown much better performance than traditional target detection methods. Rotated target detection adds a direction parameter θ to the general target detection, and uses a rotated box (x, y, w, h, θ) to represent the position and size of the target, which can more accurately locate the target and improve the direction information, so it is widely used in remote sensing target detection, scene text detection, face detection, etc.
[0005] However, due to the introduction of the angle parameter, the positioning of the rotated target detection still has the following problems: angle periodicity, boundary exchange, model loss and evaluation measure inconsistency, etc., which will cause the model training to be unstable, limit the optimization effect, and thus reduce the accuracy of target positioning. SUMMARY
[0006] Therefore, it is necessary to provide a rotated target detection method, device and equipment based on Gaussian distribution to solve a series of problems affecting positioning accuracy caused by the rotation angle, such as angle periodicity.
[0007] A rotated target detection method based on Gaussian distribution, comprising:
[0008] Obtaining image data, labeling the target in the image data with a rotated box, and constructing a training data set and a test data set according to the image data;
[0009] According to the deep residual network, the feature pyramid network, the classification subnetwork and the regression subnetwork, a target pre-detection model is constructed;
[0010] Using a two-dimensional Gaussian distribution to replace the rotated box to represent the target, and designing a loss function based on the two-dimensional Gaussian distribution;
[0011] According to the loss function and the training data set, the target pre-detection model is trained to obtain a rotated target detection model;
[0012] According to the rotated target detection model, the test data set is tested to obtain the final target detection result.
[0013] In one embodiment, using a two-dimensional Gaussian distribution to replace the rotated box to represent the target comprises:
[0014] A rotation box (x, y, w, h, θ) is used to mark the target, wherein (x, y) represents the coordinates of the center point of the rotation box in the original image, w and h represent the long side and short side of the rotation box respectively, and θ represents the angle between the long side of the rotation box and the horizontal direction to the right of the original image;
[0015] Two-dimensional Gaussian distribution Contains 5 different parameters (μ x , μ y , σ x , σ y , σ xy ), wherein:
[0016] μ = (μ x , μ y )
[0017]
[0018] The process of converting the rotation box (x, y, w, h, θ) into a two-dimensional Gaussian distribution is as follows:
[0019] (μ x , μ y ) = (x, y)
[0020]
[0021] That is, σ x , σ y , σ xy can be represented as:
[0022]
[0023]
[0024]
[0025] In one embodiment, the loss function based on the two-dimensional Gaussian distribution includes: the loss function uses a multi-task joint loss function;
[0026] L = L cls + λL reg
[0027] In the formula, L is a multi-task joint loss function, L cls is a classification loss, L reg is a regression loss based on Gaussian distribution, and λ is an adjustable hyperparameter;
[0028]
[0029] c n = [c n(0) ,c n (1) ,c n (2) ,…,c n (C) ]
[0030] c n (0) ∈[0,1]
[0031] c n (i) ∈[0,1]
[0032]
[0033] In the formula, N p N represents the number of predicted results. pos γ represents the number of positive samples, and γ is an adjustable hyperparameter.
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041] In the formula, obj n Let L1(a,b) represent a binary value, and let L1(a,b) represent the L1 norm of vectors a and b, where (μ) x p ,μ y p ,σ x p ,σ y p ,σ xy p ) represents the Gaussian distribution of the target predicted by the network, (μ) x t ,μ y t ,σ x t ,σ y t ,σ xy t (x) represents the true value of the target Gaussian distribution.a , y a , w a , h a ) represents the center point and the width and height of the current anchor box.
[0042] In one embodiment, converting the two-dimensional Gaussian distribution representation corresponding to the preferred target category into a rotated box comprises:
[0043] (x, y) = (μ x , μ y )
[0044]
[0045]
[0046]
[0047] atan2(x, y) returns the argument of the vector (x, y) according to the signs of x and y.
[0048] In one embodiment, training the target pre-detection model according to the loss function and the training data set comprises:
[0049] Let the iteration number be 0, and initialize the target pre-detection model;
[0050] Increase the iteration number by 1, input the image in the training data set into the target pre-detection model, and calculate the loss function; when the iteration number is less than a preset threshold, update the parameters of the target pre-detection model according to the loss function to obtain a current target pre-detection model;
[0051] Increase the iteration number by 1, re-input the image in the training data set into the current target pre-detection model, re-calculate the loss function, and re-judge the iteration number, until the iteration number reaches the preset threshold, stop training, and output the current target pre-detection model as a rotated target detection model.
[0052] In one embodiment, constructing a target pre-detection model according to a deep residual network, a feature pyramid network, a classification sub-network, and a regression sub-network comprises:
[0053] Using a deep residual network as a feature extraction network;
[0054] Using a feature pyramid network to realize feature fusion between different levels through top-down connection and horizontal connection to obtain multi-scale feature maps;
[0055] The target category and the target position are obtained through a classification sub-network and a regression sub-network, wherein the classification sub-network outputs a classification feature map, and the regression sub-network outputs a regression feature map.
[0056] According to the feature extraction network, the multi-scale feature map, the classification feature map, and the regression feature map, a target pre-detection model is constructed.
[0057] In one embodiment, image data is obtained, the target in the image data is labeled by using a rotating box, and a training data set and a test data set are constructed according to the image data, which includes:
[0058] Image data is obtained, the image data contains a plurality of images, the images contain one or more targets, and the targets have a predefined category;
[0059] Data augmentation processing is performed on all images to obtain a plurality of processed images;
[0060] The target is labeled by using a rotating box, and an image annotation file is generated according to the rotating box and the corresponding predefined category;
[0061] According to the image data, the processed images, and the image annotation file, a training data set and a test data set are constructed according to a preset ratio.
[0062] In one embodiment, the test data set is tested according to the rotating target detection model to obtain a final target detection result, which includes:
[0063] The image in the test data set is input into the rotating target detection model, and a multi-scale feature map is obtained through a deep residual network and a feature pyramid network; for the multi-scale feature map, a classification sub-network and a regression sub-network are input respectively to obtain a classification map and a regression map, wherein each pixel position corresponds to a target category and a target position of an anchor box; the target category is represented by a confidence vector, and the target position is represented by a two-dimensional Gaussian distribution; target categories with a confidence lower than a set value are screened out to obtain preferred target categories; the two-dimensional Gaussian distribution corresponding to the preferred target categories is converted into a rotating box to obtain a final target detection result.
[0064] A rotating target detection device based on a Gaussian distribution includes:
[0065] An acquisition module is configured to obtain image data, label the target in the image data by using a rotating box, and construct a training data set and a test data set according to the image data;
[0066] A construction module is configured to construct a target pre-detection model according to a deep residual network, a feature pyramid network, a classification sub-network, and a regression sub-network;
[0067] The design module is used to represent the target using a two-dimensional Gaussian distribution instead of the rotating box, and to design a loss function based on the two-dimensional Gaussian distribution;
[0068] The training module is used to train the target pre-detection model based on the loss function and the training dataset to obtain a rotated target detection model.
[0069] The output module is used to test the test dataset according to the rotating target detection model to obtain the final target detection result.
[0070] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program performing the following steps:
[0071] Acquire image data, label the targets in the image data with a rotated bounding box, and construct a training dataset and a test dataset based on the image data;
[0072] A target pre-detection model is constructed based on deep residual networks, feature pyramid networks, classification subnetworks, and regression subnetworks.
[0073] A two-dimensional Gaussian distribution is used to represent the target instead of the rotating frame, and a loss function based on the two-dimensional Gaussian distribution is designed.
[0074] The target pre-detection model is trained based on the loss function and the training dataset to obtain a rotated target detection model;
[0075] The rotating target detection model is tested on the test dataset to obtain the final target detection result.
[0076] The aforementioned rotating target detection method based on Gaussian distribution addresses a series of problems in the localization and regression of rotating targets caused by angle parameters by using Gaussian distribution. Instead of using a rotated bounding box (x, y, w, h, θ) to represent the target's position and size, the detection accuracy of the model is improved without increasing computational cost. Based on this, a Gaussian distribution-based loss function is designed for training and optimization to regress a Gaussian distribution. The parameters are used to achieve coupling between parameters; then the mean μ of the Gaussian distribution is... x ,μ y Covariance σ x ,σ y ,σ xyThe transformation is performed to obtain the corresponding center (x, y), width w, height h and angle θ of the target, thereby further improving the positioning accuracy of target detection. The method can solve a series of problems affecting the positioning accuracy caused by the rotation angle, such as angle periodicity, thereby improving the positioning accuracy of target detection. In addition, the loss function based on the Gaussian distribution is designed to realize the coupling between parameters and calculate the normalized target value of the Gaussian distribution, which is conducive to the convergence of the model. The method can be widely embedded in the rotating target detection model, has a wide application range and strong practicability. BRIEF DESCRIPTION OF DRAWINGS
[0077] Figure 1 An application scenario diagram of the rotating target detection method based on the Gaussian distribution in an embodiment is shown in the figure.
[0078] Figure 2 A flowchart of the rotating target detection method based on the Gaussian distribution in an embodiment is shown in the figure.
[0079] Figure 3 A flowchart of the rotating target detection method based on the Gaussian distribution in another embodiment is shown in the figure.
[0080] Figure 4 A network structure diagram of the rotating target detection method based on the Gaussian distribution in an embodiment is shown in the figure.
[0081] Figure 5 A structure block diagram of the rotating target detection device based on the Gaussian distribution in an embodiment is shown in the figure.
[0082] Figure 6 An internal structure diagram of the computer device in an embodiment is shown in the figure. DETAILED DESCRIPTION
[0083] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application is further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.
[0084] The method provided by the present application can be applied to the application environment as shown in the figure. Figure 1 Wherein, the terminal 102 communicates with the server 104 through the network, and the terminal 102 can include but is not limited to various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices, and the server 104 can be various portal websites, servers corresponding to the background of the work system, etc.
[0085] As shown in the figure Figure 2 or Figure 3 In an embodiment, a rotating target detection method based on the Gaussian distribution is provided, which is applied to the terminal in the figure Figure 1 for example, including:
[0086] In step 202, image data is obtained, the target in the image data is labeled by using a rotating box, and a training data set and a test data set are constructed according to the image data.
[0087] Specifically,
[0088] Obtaining image data, labeling the target in the image data by using a rotating box, and constructing a training data set and a test data set according to the image data includes:
[0089] Obtaining image data, the image data containing a plurality of images, each image containing one or more targets, the target having a predefined category;
[0090] Performing data enhancement processing on all images to obtain a plurality of processed images;
[0091] Labeling the target by using a rotating box, generating an image annotation file according to the rotating box of the target and the corresponding predefined category;
[0092] According to the image data, the processed images and the image annotation file, constructing a training data set and a test data set according to a preset ratio.
[0093] In this step, the rotating target detection is widely used in the field of remote sensing. The size of a remote sensing image is usually very large, about tens of thousands of pixels x tens of thousands of pixels, which cannot be directly input into a detection model for training or testing. Therefore, it is necessary to perform preprocessing operation on the large-size remote sensing image: dividing an arbitrary-size remote sensing image into sub-images with fixed size. In order to prevent some targets from being divided into two halves in the process of division and affecting the training effect, the sub-image division is performed with an overlap rate of 25%. All sub-images containing predefined target categories (assuming a total of C categories) are saved, which are images in the image data.
[0094] Performing data enhancement processing on all images means that a series of preprocessing operations such as random flipping, random rotation, normalization, cropping and translation are performed on all images by using data enhancement processing technology. The generated data after enhancement not only increases the data amount of the data set, but also is more complex and diverse compared with the original image, thereby preventing the model from overfitting in the training process and improving the robustness of the model after training.
[0095] The target is labeled by using a rotating box (x, y, w, h, θ) to accurately represent the position information of the target in the image, that is, the minimum bounding rectangle of the target, wherein (x, y) represents the coordinates of the center point of the rotating box in the original image, w and h represent the long side and short side of the rotating box respectively, and θ represents the angle between the long side of the rotating box and the horizontal right direction of the original image.
[0096] Save each image containing the target information of the rotation frame and the category to generate an image annotation file.
[0097] Step 204, constructing a target pre-detection model according to the deep residual network, the feature pyramid network, the classification subnetwork and the regression subnetwork.
[0098] Specifically,
[0099] The deep residual network (ResNet) is adopted as the feature extraction network.
[0100] The feature pyramid network (FPN) is adopted to realize the feature fusion between different levels through top-down connection and horizontal connection, so as to obtain a multi-scale feature map.
[0101] The target category and the target position are obtained through the classification subnetwork and the regression subnetwork, wherein the classification subnetwork outputs a classification feature map, and the regression subnetwork outputs a regression feature map.
[0102] A target pre-detection model is constructed according to the feature extraction network, the multi-scale feature map, the classification feature map and the regression feature map.
[0103] In this step, as shown in the formula (1), the classification feature map output by the classification subnetwork is represented as: Figure 4
[0104]
[0105] The classification feature map contains (C+1)K channels, each of which represents the confidence of K anchor frames belonging to C categories plus the background, wherein W and H represent the length and width of the original image, s represents the reduction ratio of the feature map relative to the original image, and K represents the number of anchor frames at each pixel position of the feature map.
[0106] The regression feature map output by the regression subnetwork is represented as:
[0107]
[0108] The regression feature map is a Gaussian distribution representation (μ x ,μ y ,σ x ,σ y ,σ xy ) of each anchor frame.
[0109] Step 206, using a two-dimensional Gaussian distribution to represent the target instead of the rotation frame, and designing a loss function based on the two-dimensional Gaussian distribution.
[0110] Specifically,
[0111] Adopting a two-dimensional Gaussian distribution instead of the rotating frame to represent the target includes:
[0112] Adopting a rotating frame (x, y, w, h, θ) to label the target, wherein (x, y) represents the coordinates of the center point of the rotating frame in the original image, w and h respectively represent the long side and short side of the rotating frame, and θ represents the included angle between the long side of the rotating frame and the horizontal right direction of the original image;
[0113] Two-dimensional Gaussian distribution Contains 5 different parameters (μ x , μ y , σ x , σ y , σ xy ), wherein:
[0114] μ=(μ x , μ y )
[0115]
[0116] The process of converting the rotating frame (x, y, w, h, θ) into a two-dimensional Gaussian distribution is as follows:
[0117] (μ x , μ y )=(x, y)
[0118]
[0119] That is, σ x , σ y , σ xy can be represented as:
[0120]
[0121]
[0122]
[0123] Adopting (μ x , μ y , σ x , σ y , σ xy ) instead of the rotating frame (x, y, w, h, θ) to represent the rotating target, not only can effectively avoid the influence of angle periodicity, but also can make parameter coupling, improve the correlation of parameters in the optimization process, and improve the positioning accuracy.
[0124] Designing a loss function based on a two-dimensional Gaussian distribution includes that the loss function adopts a multi-task joint loss function;
[0125] L=L cls+ λL reg
[0126] where L is the multi-task joint loss function, L cls is the classification loss, L reg is the regression loss based on Gaussian distribution, and λ is an adjustable hyperparameter (used to balance the loss function, with a default value of λ = 1).
[0127] L cls Focal Loss is used as the loss function: Let there be N p predicted results in total, of which N pos are positive samples, let c n = [c n (0) , c n (1) , c n (2) , …, c n (C) ] represent the class prediction value of the nth sample, where c n (0) ∈ [0, 1] represents the probability that the sample belongs to the background, and c n (i) ∈ [0, 1] represents the probability that the sample belongs to the ith class; the one-hot code is used: y represents the true value assigned to the nth sample, and when the sample true value belongs to the ith class, the ith + 1 item of y
[0128]
[0129] c n = [c n (0) , c n (1) , c n (2) , …, c n (C) ]
[0130] c n (0) ∈ [0, 1]
[0131] c n (i) ∈ [0, 1]
[0132]
[0133] where N p is the number of predicted results, and N posis the number of positive samples, and γ is a tunable hyper-parameter (default value is γ = 2).
[0134] L reg is the regression loss based on Gaussian distribution, the normalized target value of Gaussian distribution output by the network and the normalized target value of Gaussian distribution true value .
[0135]
[0136]
[0137]
[0138]
[0139]
[0140]
[0141]
[0142] where obj n is a binary value (obj n = 1 for correct prediction, otherwise obj n = 0, that is, only the regression loss is calculated for the correctly predicted samples), L1(a, b) represents the L1 norm of vectors a and b, (μ x p , μ y p , σ x p , σ y p , σ xy p ) represents the target Gaussian distribution representation predicted by the network, (μ x t , μ y t , σ x t , σ y t , σ xy t ) represents the target Gaussian distribution representation true value, (x a , y a , w a , h a ) represents the center point and width and height of the current anchor box.
[0143] Step 208, according to the loss function and the training data set, the target pre-detection model is trained to obtain a rotating target detection model.
[0144] Specifically:
[0145] Let the iteration number be 0, initialize the target pre-detection model;
[0146] The iteration number is added by 1, the image in the training data set is input into the target pre-detection model, and the loss function is calculated; when the iteration number is less than a preset threshold, the parameters of the target pre-detection model are updated according to the loss function to obtain a current target pre-detection model;
[0147] The iteration number is added by 1, the image in the training data set is input into the current target pre-detection model, the loss function is recalculated, and the iteration number is rejudged, until the iteration number reaches the preset threshold, the training is stopped, and the current target pre-detection model is output as a rotating target detection model.
[0148] Step 210, according to the rotating target detection model, the test data set is tested to obtain a final target detection result.
[0149] Specifically:
[0150] The image in the test data set is input into the rotating target detection model, and multi-scale feature maps are obtained through a deep residual network and a feature pyramid network; for the multi-scale feature maps, classification sub-networks and regression sub-networks are input respectively to obtain classification maps (corresponding to the classification sub-networks) and regression maps (corresponding to the regression sub-networks), wherein each pixel position corresponds to a target class and a target position of an anchor box, that is, each pixel position of the multi-scale feature maps corresponds to an anchor box, and each anchor box corresponds to a target class (obtained by the classification sub-network) and a target position (obtained by the regression sub-network) at the same time; the target class is represented by a (C+1) -dimensional category confidence vector of K anchor boxes, and the target position is represented by a two-dimensional Gaussian distribution; target classes with a confidence lower than a set value (such as 0.05) are screened out to obtain preferred target classes; the two-dimensional Gaussian distribution representation corresponding to the preferred target classes is converted into a rotating box to obtain a final target detection result.
[0151] In this step, anchor boxes with a confidence lower than a set value are screened out, and a non-maximum suppression operation is performed on the remaining anchor boxes. The Gaussian distribution representation (μ x ,μ y ,σ x ,σ y ,σ xy ) of the anchor boxes finally retained is converted into a rotating box (x, y, w, h, θ) to obtain a final detection result.
[0152] wherein converting the two-dimensional Gaussian distribution representation corresponding to the preferred target class to a rotated box comprises:
[0153] (x, y) = (μ x , μ y )
[0154]
[0155]
[0156]
[0157] wherein atan2(x, y) returns the argument of the vector (x, y) according to the signs of x, y.
[0158] In the prior art, the rotated box (x, y, w, h, θ) of the target is directly regressed, and when calculating the loss function, the normalized target values of the predicted box (x p , y p , w p , h p , θ p ) and the true value (x t , y t , w t , h t , θ t ) are calculated first, then the difference of the normalized target values is calculated, and the loss function of the regression is obtained therefrom. The above method has the following problems: assuming 359° and 1°, when calculating the angle loss, it will cause the loss function to be larger, and in fact the two angles only differ by 2°, that is, the angle periodicity affects the loss function, causing incorrect regression; when calculating the loss function, each parameter is independent of each other, and is not coupled. These two problems will affect the accuracy of target positioning.
[0159] In the present application, σ x , σ y , σ xy are all composed of w, h, θ, as follows:
[0160]
[0161]
[0162]
[0163] Therefore, the correlation among w, h and theta can be fully considered when calculating the target value and the loss function, and the mutual influence and mutual balance are realized, so as to realize the coupling among parameters and improve the positioning accuracy; in addition, theta has been converted into cos theta and sin theta in the application, both of which are periodic functions, and there is no influence on the loss function due to the angle periodicity in the prior art, the regression is accurate, and therefore the angle regression accuracy can be improved, so as to improve the positioning accuracy.
[0164] After the angle periodicity problem and the parameter coupling problem are solved, the back propagation of the model is propagated in a more favorable direction, so as to improve the convergence speed.
[0165] The above-mentioned rotating target detection method based on Gaussian distribution uses Gaussian distribution to solve a series of problems of rotating target positioning regression caused by angle parameters , and uses a Gaussian distribution instead of a rotating frame (x, y, w, h, theta) to represent the position and size of the target, so as to improve the detection accuracy of the model without increasing the calculation amount; and a loss function based on Gaussian distribution is designed based on this for training optimization to regress the parameters of the Gaussian distribution , so as to realize the coupling among parameters; and the mean mu x , mu y and the covariance sigma x , sigma y , sigma xy of the Gaussian distribution are converted to obtain the center (x, y), the width w, the height h and the angle theta of the target, so as to further improve the positioning accuracy of target detection. By using this method, a series of problems affecting the positioning accuracy caused by the rotating angle, such as angle periodicity, can be solved, and the positioning accuracy of target detection can be improved; in addition, the loss function based on Gaussian distribution realizes the coupling among parameters and can calculate the normalized target value of the Gaussian distribution, which is beneficial to the convergence of the model; this method only needs to replace the original traditional loss function calculation method with the method of the application, so that it can be widely embedded in the rotating target detection model, and has a wide application range and strong practicability.
[0166] It should be understood that, although Figure 2 the steps in the flowchart are shown in order according to the arrows, these steps are not necessarily executed in order according to the arrows. Unless otherwise specified herein, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, Figure 2 at least part of the steps in the flowchart can include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily sequential, but can be alternately or alternately executed with at least part of other steps or sub-steps or stages of other steps.
[0167] In one embodiment, as shown in Figure 5 a Gaussian distribution based rotating target detection apparatus is provided, comprising an acquisition module 502, a construction module 504, a design module 506, a training module 508 and an output module 510, wherein:
[0168] The acquisition module 502 is configured to acquire image data, label a target in the image data by using a rotating box, and construct a training data set and a test data set according to the image data;
[0169] The construction module 504 is configured to construct a target pre-detection model according to a deep residual network, a feature pyramid network, a classification sub-network and a regression sub-network;
[0170] The design module 506 is configured to represent a target by using a two-dimensional Gaussian distribution instead of the rotating box, and design a loss function based on the two-dimensional Gaussian distribution;
[0171] The training module 508 is configured to train the target pre-detection model according to the loss function and the training data set, to obtain a rotating target detection model;
[0172] The output module 510 is configured to test the test data set according to the rotating target detection model, to obtain a final target detection result.
[0173] For specific limitations of the Gaussian distribution based rotating target detection apparatus, refer to the limitations of the Gaussian distribution based rotating target detection method in the foregoing, which will not be repeated here. Each module in the apparatus can be realized by software, hardware and a combination thereof in whole or in part. Each module can be embedded in or independent of a processor in a computer device in hardware form, or can be stored in a memory in the computer device in software form, so as to be called and executed by a processor to perform the operations corresponding to each module.
[0174] In one embodiment, a computer device is provided, which can be a terminal, and an internal structure diagram of the computer device can be as shown in Figure 6As shown in the figure. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium, an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The network interface of the computer device is used to communicate with the external terminal through the network connection. The computer program is executed by the processor to implement a Gaussian distribution-based rotating target detection method. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball or touchpad arranged on the shell of the computer device, or an external keyboard, touchpad or mouse, etc.
[0175] Those skilled in the art can understand that, Figure 6 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0176] In one embodiment, a computer device is provided, comprising a memory and a processor, the memory stores a computer program, and the processor executes the computer program to implement the steps of the method in the above embodiments.
[0177] The technical features of the above embodiments can be combined in any way. In order to make the description simple, not all possible combinations of the technical features in the above embodiments are described, but as long as the combination of the technical features does not exist contradictory, it should be considered as the scope of the present application.
[0178] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the scope of the present application. Therefore, the scope of the patent of the present application should be subject to the appended claims.
Claims
1. A method for detecting a rotating target based on a Gaussian distribution, characterized in that, The method comprises the following steps: acquiring image data, labeling a target in the image data by using a rotating bounding box, and constructing a training data set and a test data set according to the image data; constructing a target pre-detection model according to a deep residual network, a feature pyramid network, a classification subnetwork and a regression subnetwork; using a two-dimensional Gaussian distribution to replace the rotating bounding box to represent the target, and designing a loss function based on the two-dimensional Gaussian distribution; training the target pre-detection model according to the loss function and the training data set to obtain a rotating target detection model; testing the test data set according to the rotating target detection model to obtain a final target detection result; using a two-dimensional Gaussian distribution to replace the rotating bounding box to represent the target comprises: Adopting a rotating frame Annotate the target, wherein, represents the coordinate of the center point of the rotating frame in the original image, respectively represent the long side and the short side of the rotating frame, represents the angle between the long side of the rotating frame and the horizontal right direction of the original image; Two-dimensional Gaussian distribution Comprises five different parameters Wherein: By the rotating frame The process of converting to a two-dimensional Gaussian distribution is as follows: That is, may be expressed as: ; testing the test data set according to the rotating target detection model to obtain a final target detection result comprises: inputting an image in the test data set into the rotating target detection model to obtain a multi-scale feature map through a deep residual network and a feature pyramid network; inputting the multi-scale feature map into a classification subnetwork and a regression subnetwork respectively to obtain a classification map and a regression map, wherein each pixel position corresponds to a target class and a target position of an anchor box; the target class is represented by a confidence vector, and the target position is represented by a two-dimensional Gaussian distribution; screening out a target class with a confidence lower than a set value to obtain an optimal target class; and converting a two-dimensional Gaussian distribution representation corresponding to the optimal target class into a rotating bounding box to obtain a final target detection result; converting a two-dimensional Gaussian distribution representation corresponding to the optimal target class into a rotating bounding box comprises: wherein According to the symbol return vector the argument of designing a loss function based on a two-dimensional Gaussian distribution comprises: the loss function adopts a multi-task joint loss function; wherein, is a multi-task joint loss function, is a classification loss, is a regression loss based on Gaussian distribution, is an adjustable hyper-parameter; wherein is the number of predicted results, is the number of positive samples, is a tunable hyper-parameter; wherein denotes a binary value, denotes a vector and the norm of denotes a network predicted target Gaussian distribution representation, denotes a target Gaussian distribution representation ground truth, denotes the center point and width height of the current anchor box.
2. The method of claim 1, wherein, training the target pre-detection model according to the loss function and the training data set to obtain a rotating target detection model comprises: initializing the target pre-detection model by setting an iteration number to 0; increasing the iteration number by 1, inputting an image in the training data set into the target pre-detection model to calculate the loss function; when the iteration number is less than a preset threshold, updating parameters of the target pre-detection model according to the loss function to obtain a current target pre-detection model; increasing the iteration number by 1, re-inputting the image in the training data set into the current target pre-detection model, recalculating the loss function, and re-judging the iteration number until the iteration number reaches the preset threshold, stopping training, and outputting the current target pre-detection model as the rotating target detection model.
3. The method according to claim 1 or 2, characterized in that, constructing a target pre-detection model according to a deep residual network, a feature pyramid network, a classification subnetwork and a regression subnetwork comprises: using a deep residual network as a feature extraction network; using a feature pyramid network to realize feature fusion between different levels through top-down connection and horizontal connection to obtain a multi-scale feature map; obtaining a target class and a target position through a classification subnetwork and a regression subnetwork, wherein the classification subnetwork outputs a classification feature map, and the regression subnetwork outputs a regression feature map; According to the feature extraction network, the multi-scale feature map, the classification feature map, and the regression feature map, a target pre-detection model is constructed.
4. The method according to claim 1 or 2, characterized in that, Obtaining image data, labeling targets in the image data by using a rotated bounding box, and constructing a training data set and a test data set according to the image data include: Obtaining image data, the image data containing a plurality of images, the images containing one or more targets, and the targets having predefined categories; Performing data enhancement processing on all images to obtain a plurality of processed images; Labeling the targets by using a rotated bounding box, and generating an image annotation file according to the rotated bounding box and the corresponding predefined categories; According to the image data, the processed images, and the image annotation file, constructing a training data set and a test data set according to a preset ratio.
5. A rotating target detection apparatus based on Gaussian distribution, characterized by, The method of any one of claims 1 to 4, comprising: An obtaining module configured to obtain image data, label targets in the image data by using a rotated bounding box, and construct a training data set and a test data set according to the image data; A constructing module configured to construct a target pre-detection model according to a deep residual network, a feature pyramid network, a classification subnetwork, and a regression subnetwork; A designing module configured to represent the targets by using a two-dimensional Gaussian distribution instead of the rotated bounding box, and design a loss function based on the two-dimensional Gaussian distribution; A training module configured to train the target pre-detection model according to the loss function and the training data set to obtain a rotated target detection model; An output module configured to test the test data set according to the rotated target detection model to obtain a final target detection result. 6.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-6 when the computer program is executed by the processor. The processor executes the computer program to implement the steps of the method of any one of claims 1 to 4.
Citation Information
Patent Citations
Single-stage target detection method based on convolution region reregistration
CN112529095A
License plate detection method based on two-dimensional Gaussian bounding box overlapping degree measurement
CN114677501A