Training method, training device and storage medium for rotating ship target detection model
By dynamically adjusting the rotation trigger probability and designing a rotation feature alignment module, the data imbalance problem in the training of the rotating ship target detection model is solved, the detection accuracy and efficiency are improved, and it is suitable for ship target recognition from the perspective of drones.
Patent Information
- Application Number
- CN202111598964.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-24
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2041-12-24
AI Technical Summary
There is a data imbalance problem in the training process of rotating ship target detection model. It is difficult to provide sufficient angle information sample data, and the general data enhancement method is not effective.
A dynamic data enhancement strategy is adopted to adjust the rotation trigger probability through a loss feedback mechanism. Combined with the angle channel switching and angle distance modules, a rotation feature alignment and discretized angle classification method are designed, and the loss function is optimized to improve the detection accuracy.
The targetedness and efficiency of data enhancement are improved, and high-precision detection of rotating ship targets is achieved, which is suitable for flexible inspection tasks under the perspective of drones.
Smart Images

Figure CN114419467B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer vision technology, and in particular relates to a training method, a training device, a computer-readable storage medium and a computer device for a rotating ship target detection model. Background Art
[0002] Unmanned aerial vehicles (UAVs) have many advantages, including simple structure, easy maintenance and portability, high efficiency and reliability in mission execution. They can take off and land anytime and anywhere, have strong operational flexibility, can meet the needs of various emergency tasks, and are suitable for flexible inspections of ports, fishing grounds, tourist areas, etc. Compared with the synthetic aperture radar images used in the past for ship identification, the optical images from drones have more detailed information and more obvious geometric structures, and are more intuitive and easy to understand. Compared with satellite images, the drone's perspective is less affected by clouds and fog, the target image is clearer, and more effective features can be extracted. The drone inspection method is more suitable for flexible inspection tasks in specific areas. However, from the drone's perspective, the sea surface ship targets have uncertain directions and large aspect ratio features, and the general method cannot achieve high-precision and rapid identification.
[0003] Currently, the tasks of rotating target detection are mainly divided into two categories, namely the five-parameter method (angle-based method) and the eight-parameter method (corner-based method). The main research directions are to consider the improvement of anchor box and bounding box generation, feature alignment, extraction of rotation-invariant features, etc. In terms of directed bounding box generation, a method of using a generative probability model to extract OBB proposals has been spawned. For each proposed area, its position, size and direction are determined by searching for the local maximum likelihood. Some researchers have also designed a fast rotating bounding box estimation algorithm to generate the ground truth of the rotating bounding box from any segmented dataset, and use ellipse fitting to estimate the rotation angle and size of the bounding box with segmentation (mask) to train the rotation angle regression model. In addition, feature matching is a key task of target detection, and designing an optimization function with regularization to control the feature representation before and after the rotation mapping is a common method. In the field of rotating target detection, the most common approach recently is to build a separate rotation-invariant layer based on the convolutional neural network architecture, or to design a learner for the rotational region of interest based on the rotation characteristics of the target in aerial imagery, replacing the traditional horizontal region of interest and extracting rotation-invariant features from the RoI. These methods improve the adaptability of the network structure to the target rotation characteristics by processing the angle channel, and use a separate module design, so that it can be easily integrated into the traditional detector to improve the detection performance of rotating targets.
[0004] The current task of detecting ships in aerial imagery faces data imbalance. Data sets are limited, and the need for angular information makes it difficult to provide sufficient sample data. Common data augmentation methods are generally ineffective for this specific scenario. While they primarily optimize for scale, they struggle to meet the requirements for angular data augmentation in this scenario. Summary of the Invention
[0005] (1) Technical Problems to be Solved by the Present Invention
[0006] The technical problem solved by the present invention is how to overcome the problem of data imbalance during the training process of a rotating ship target detection model.
[0007] (2) Technical solution adopted by the present invention
[0008] A training method for a rotating ship target detection model, the training method comprising:
[0009] Preprocessing and angle annotation are performed on the original rotated ship image to obtain a ship annotation image;
[0010] The rotation trigger probability of the current training round is set according to the rotation loss after the previous round of training, and data enhancement processing is performed according to the ship annotated image to obtain a ship enhanced image;
[0011] Inputting the enhanced ship image into a rotating ship target detection model to be trained to obtain a prediction value;
[0012] Calculating a loss function value of a current training round based on the predicted value and the true value corresponding to the vessel annotated image;
[0013] The model parameters of the rotating ship target detection model to be trained are updated according to the loss function value to complete the current round of training.
[0014] Preferably, the method for setting the rotation trigger probability of the current training round according to the rotation loss situation after the previous training round includes:
[0015] After the last round of training is completed, determine whether there is a rotation loss imbalance;
[0016] If there is a rotation loss imbalance, the rotation trigger probability of the current training wheel is set to a first predetermined value; if there is no rotation loss imbalance, the rotation trigger probability of the current training wheel is set to a second predetermined value.
[0017] Preferably, the method of inputting the enhanced ship image into a rotating ship target detection model to be trained to obtain a prediction value includes:
[0018] After the enhanced ship image is input into the rotating ship target detection model to be trained, convolution feature maps of different levels are obtained;
[0019] Perform a rotation feature alignment operation on the convolution feature map of each level to obtain the convolution area after feature alignment;
[0020] The center coordinates, width, height, and angle of the prediction box are determined according to the convolution area after feature alignment as the prediction value.
[0021] Preferably, the method of performing a rotational feature alignment operation on the convolution feature map of each level to obtain the convolution region after feature alignment includes:
[0022] Traversing multiple angles, calculating the response value of the feature map area determined by the preset anchor frame in the convolution feature map and the feature map area corresponding to the target true value under each angle channel;
[0023] The convolution area after feature alignment is calculated based on the angle corresponding to the maximum response value.
[0024] Preferably, the true value is the center coordinate, width, height, and angle corresponding to the true frame of the ship annotated image. The method for calculating the loss function value of the current training round based on the predicted value and the true value corresponding to the ship annotated image includes:
[0025] According to the center coordinates, width, height, angle corresponding to the real frame and the center coordinates, width, height, angle of the predicted frame, a first loss value based on angular distance, a second loss value based on angle classification, and a third loss value based on category are calculated. The first loss value, the second loss value, and the third loss value constitute the loss function value.
[0026] Preferably, the method for calculating the first loss value based on the angular distance includes:
[0027] Calculate the intersection-over-union ratio of the real frame and the predicted frame according to the center coordinates, width, height, and angle corresponding to the real frame and the center coordinates, width, height, and angle of the predicted frame;
[0028] A weight parameter based on angle distance is calculated according to the angle of the real frame, the angle of the predicted frame, and the aspect ratio of the real frame;
[0029] The first loss value is calculated based on the angular distance-based weight parameter and the intersection-over-union ratio.
[0030] Preferably, the method for calculating the second loss value based on angle classification includes:
[0031] A second loss value is calculated based on the angle of the real frame and the angle of the predicted frame.
[0032] The present application also discloses a training device for a rotating ship target detection model, the training device comprising:
[0033] a preprocessing unit, configured to perform preprocessing and angle annotation processing on the original rotated ship image to obtain a ship annotated image;
[0034] a data enhancement unit, configured to set a rotation trigger probability of a current training round according to a rotation loss condition after a previous round of training, and perform data enhancement processing on the annotated ship image to obtain an enhanced ship image;
[0035] a data input unit, configured to input the enhanced ship image into a rotating ship target detection model to be trained to obtain a predicted value;
[0036] a loss calculation unit, configured to calculate a loss function value of a current training round based on the predicted value and a true value corresponding to the vessel annotated image;
[0037] A parameter updating unit is used to update the model parameters of the rotating ship target detection model to be trained according to the loss function value to complete the current round of training.
[0038] The present application also discloses a computer-readable storage medium, which stores a training program for a rotating ship target detection model. When the training program for a rotating ship target detection model is executed by a processor, the above-mentioned training method for a rotating ship target detection model is implemented.
[0039] The present application also discloses a computer device, which includes a computer-readable storage medium, a processor, and a training program for a rotating ship target detection model stored in the computer-readable storage medium. When the training program for the rotating ship target detection model is executed by the processor, the above-mentioned training method for the rotating ship target detection model is implemented.
[0040] (3) Beneficial effects
[0041] The present invention discloses a training method and a training device for a rotating ship target detection model, which have the following technical effects compared with existing methods:
[0042] This method adopts a new data enhancement strategy, which performs dynamic data enhancement during the training process through loss feedback, improves the sample imbalance problem, makes data enhancement more targeted, and improves the efficiency of data enhancement.
[0043] At the same time, this method aims at the feature alignment problem of one-stage target detection and designs a module based on angle channel switching and angle distance, which realizes the accurate extraction of angle-related image features and reduces the classification loss by learning the angle distance.
[0044] In addition, the discretized angle classification method for angular distance converts the 180-degree angle range into 180 classification dimensions for processing, transforming the regression problem of angular information into a classification problem, which can successfully avoid boundary discontinuities. At the same time, the pixel-level IOU is calculated as the loss function, which takes the influence of IOU into account during the loss calculation process, resulting in a more accurate matching scoring mechanism, thereby optimizing the training process. The rotation angle difference is then considered as a weighted optimization loss function, improving the detection accuracy of ship targets. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 This is an overall flow chart of a method for training a rotating ship target detection model according to a first embodiment of the present invention;
[0046] Figure 2 This is an overall structural diagram of a rotating ship target detection model according to the first embodiment of the present invention;
[0047] Figure 3 This is a functional block diagram of a training device for a rotating ship target detection model according to a third embodiment of the present invention;
[0048] Figure 4 Schematic diagram of a computer device according to a fourth embodiment of the present invention. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0050] Before describing the various embodiments of the present application in detail, the inventive concept of the present application is first briefly described: In the prior art, the task of detecting ships in aerial images faces the problem of data imbalance. The data set is small, and when it comes to angle information, it is difficult to provide sufficient sample data, and the general data enhancement method is difficult to meet the data enhancement requirements of angle information in this scenario. To this end, the present application provides a training method for a rotating ship target detection model. After annotating the original image data, the rotation trigger probability of the current round is calculated based on the rotation loss after the previous round of training. That is, by introducing a loss feedback mechanism, the rotation trigger probability in the data enhancement of each round of training is dynamically adjusted, and data enhancement in terms of angle information is performed more specifically, thereby improving data enhancement efficiency and alleviating the problem of sample imbalance. The obtained ship enhanced image is then input as a training sample into the rotating ship target detection model to be trained for model training to improve the detection efficiency of the model.
[0051] Specifically, if Figure 1 As shown, the training method of the rotating ship target detection model of the first embodiment includes the following steps:
[0052] Step S10: pre-processing and angle annotation processing are performed on the original rotated ship image to obtain a ship annotated image.
[0053] Step S20: setting the rotation trigger probability of the current training round according to the rotation loss after the previous round of training, performing data enhancement processing on the ship annotated image to obtain a ship enhanced image;
[0054] Step S30: input the enhanced image of the ship into the rotating ship target detection model to be trained to obtain a prediction value;
[0055] Step S40: Calculate the loss function value of the current training round based on the predicted value and the true value corresponding to the ship annotated image;
[0056] Step S50: Update the model parameters of the rotating ship target detection model to be trained according to the loss function value to complete the current round of training.
[0057] Specifically, before model training, ship image data of relevant scenes were obtained and angled. The ship image data were then annotated according to the angle coordinates and target tilt angle. The target coordinate and angle expressions used were (x, y, w, h, θ), where θ was defined using the long side method, that is, the angle passed by the first long side when rotating counterclockwise from the horizontal direction, with a value range of 0-180°. The dataset used for ship image data is HRSC2016, which is a ship detection dataset with a large aspect ratio and arbitrary orientation range. The dataset contains two scenes (sea ships and offshore ships) and has 15 object categories. The size of each image ranges from 300×300 to 1500×900. The dataset has 1061 images, of which 436 are used for training, 181 are used for validation, and 444 are used for testing.
[0058] In step S20, the annotated ship images required for each round of training are enhanced. This enhancement process involves splicing four images through random scaling, random cropping, random rotation, and random arrangement to form a new image, the enhanced ship image. The enhancement effect is controlled by setting a trigger probability for each enhancement method. This embodiment introduces a loss feedback mechanism. During training, various losses are calculated after each epoch, and the contribution of each loss is evaluated. If, after an epoch, the contribution of the angle loss is low or high (determined by setting a threshold), indicating a rotation loss imbalance, the trigger probability of rotation enhancement is adjusted during the data enhancement process, i.e., the rotation trigger probability is set to a first predetermined value, alleviating the data imbalance to a certain extent. If the rotation loss is determined to be unbalanced, data enhancement is performed according to the original trigger probabilities, i.e., the rotation trigger probability is set to a second predetermined value. For example, if the rotation loss is too low, the rotation trigger probability is increased by 50%, and if it is too high, it is decreased by 50%. This adjustment ratio can be set based on actual needs.
[0059] If there is no imbalance, the current trigger probability will not change, and the next step will be directly performed according to the current trigger probability value.
[0060] Furthermore, the rotating ship target detection model to be trained is based on the YOLOv5 architecture. Based on Darknet53, the CSP and Focus structures are introduced to form the basic backbone. To better extract fused features, a spatial pyramid pooling layer (SPP) and an FPN+PAN structure are introduced. In the SPP module, multiple pooling kernels are used to pool the input feature map, and then the feature maps processed by different pooling kernels are concat-operated. The FPN is a top-down structure that transfers and fuses high-level feature information through upsampling to obtain a feature map for prediction. At the same time, a bottom-up feature pyramid module containing two PAN structures is added to the FPN, which can convey positional features. The combination of the FPN and the feature pyramid structure containing PAN aggregates parameters of different detection layers from different backbone layers, further improving the model's feature extraction capabilities. The rotating ship target detection model also has a rotational feature alignment module. The rotational feature alignment module switches the angle channel and uses the maximum pooling method to evaluate the response strength of each feature area and the real target area. Then, through angle interpolation, the feature alignment effect for the angle value is obtained, which can make the subsequently extracted features more compatible with the rotating ship target.
[0061] Specifically, if Figure 2 As shown, after the enhanced image of the ship is input into the rotation ship target detection model to be trained, a convolution operation is performed to form a multi-layer convolution feature map, and the rotation feature alignment operation is performed on the convolution feature maps of different levels: for the pixel points in the image, the conventional feature extraction area can be determined by matching the preset anchor frame. This embodiment is improved on this basis. For a specific pixel point under a specific anchor frame matching state, the angle channel value is switched, and the corresponding feature map area is calculated for each angle channel value. The corresponding feature map area is compared with the feature map area corresponding to the target true value to obtain several direction values with a response greater than the threshold, and the direction channel value with the strongest response is used as the corresponding angle of the feature alignment. For the angle information after feature alignment, the deviation weight between the target true value and the prediction result on the feature map is calculated, and the deviation weight is incorporated into the convolution calculation for feature extraction. The process of determining the convolution area after feature alignment and the feature extraction process refer to the following formula:
[0062]
[0063] Y(p)=W(r)·X(L)
[0064] Where p is the coordinate position of the operation, w and h are the width and height of the rotation box, r is the radius of the convolution kernel, and R(θ) is the angular rotation matrix. The Mp operation is used to obtain the angle value that has the strongest response to the true value of the current operation position. The convolution region L after feature alignment is calculated using the angle with the strongest response. W(r) represents the convolution operation, X(L) represents the feature map region where the convolution operation is performed, and Y(p) represents the extracted features.
[0065] Furthermore, the convolution area L after feature alignment is regarded as the anchor box. Then, the offset between the two boxes can be calculated by combining the area covered by the true value box and the range covered by the current anchor box. The coordinates of the current prediction box are calculated using their coordinates. The formula is as follows:
[0066] t x =(xx a ) / w a ,t y =(yy a ) / h a
[0067] t w =log(w / w a ),t h =log(h / h a )
[0068] t θ =(θ-θ a )·π / 180
[0069] t' x =(x'-x a ) / w a ,t' y =(y'-y a ) / h a
[0070] t' w =log(w' / w a ),t' h =log(h' / h a )
[0071] t' θ =(θ'-θ a )·π / 180
[0072] L CSL =FL(θ,θ')
[0073] Among them, x, y, w, h, θ represent the center coordinates, width, height and angle of the true value box respectively; x', y', w', h', θ' represent the center coordinates, width, height and angle of the predicted box respectively; x a ,ya ,w a ,h a ,θ a Respectively represent the center coordinates, width, height and angle of the anchor box, and the symbols t and t' represent the offset. FL represents Focal loss, L CSL Represents the second loss value brought by the angle classification method itself.
[0074] Furthermore, the intersection-over-union (IOU) value is adjusted according to the weight parameter of the calculated angular distance to obtain the first loss value. The specific calculation process is as follows.
[0075] Considering the angular information of a rotated object, obtaining an accurate bounding box regression loss is a key research direction for improving detection performance. Commonly used bounding box loss functions include IOU, GIOU, CIOU, and DIOU, but they are all only suitable for horizontal bounding box detection and cannot accurately obtain rotational IOU. To design a better bounding box regression loss, this first embodiment improves the PIOU method to design a loss function for the rotated object detection task.
[0076] The calculation of IOU is to evaluate the degree of overlap of two bounding boxes. Since the oriented bounding box (OBB) and the intersection area are composed of pixels in the image space, their areas are approximated by the number of internal pixels. Since the OBB and the intersection area are composed of pixels in the image space, their areas are approximated by the number of internal pixels. In this embodiment 1, the true value box and the predicted box are represented by b and b' respectively, such as b is the rotated bounding box determined by the x, y, w, h, θ values in the above formula, and b' is the rotated bounding box determined by the x', y', w', h', θ' values in the above formula. In order to determine a point p i,j The relative position (inside or outside) of the bounding box OBB is defined as follows:
[0077]
[0078] Among them, d ij For point p i,j The L2 norm distance between the center coordinates (x, y) of the OBB, w, h are the width and height of the bounding box, d w and d h are the distances d in the horizontal and vertical directions respectively.
[0079] Set the intersection range of the true value box b and the predicted box b' to:
[0080]
[0081] The union range is:
[0082]
[0083] The intersection-over-union (IOU) of a pair of bounding boxes (b, b') is expressed as:
[0084]
[0085] When PIOU is greater than the threshold 0.5, b and b' are regarded as a bounding box pair of a positive sample (the matching of this pair of bounding boxes is regarded as a positive sample).
[0086] PIOU can well represent the degree of overlap between two OBBs, but cannot calculate their angular difference. In the entire rotating object detection task, in order to make more full use of the target's angular information, integrating angular information into the PIOU method can more accurately guide the regression direction. Constructing a weight parameter sensitive to angular distance and introducing the angular information of the rotating object into the calculation can improve the PIOU loss. This weight parameter can be expressed as:
[0087]
[0088] Among them, R is the aspect ratio of the real box, θ b and θ b’ They are the true value angle and the predicted angle respectively.
[0089] Therefore, the rotation-aware PIoU loss, that is, the first loss value based on angular distance, can be expressed as:
[0090]
[0091] Where M represents all bounding box pairs that are positive samples.
[0092] At the same time, the features extracted after feature alignment are used for category training. This step uses simple feature map matching and cross entropy loss to adjust the learning of category features in the model to obtain the third category-based loss value L cls (p n ,t n ).
[0093] The loss function value composed of the first loss value, the second loss value and the third loss value is as follows:
[0094]
[0095] Among them, N in the above formula represents the number of anchor boxes, obj n Is a binary value (obj n =1 indicates foreground, obj n=0 means background, and background has no regression). b and b' are the true value box and the predicted box respectively. θ n ,θ' n Represent the true value angle and the predicted angle respectively. n is the label of the object, p n are the probability distributions computed using the Sigmoid function. The hyperparameters λ1, λ2, and λ3 control this trade-off and default to {1, 0.5, 1}.
[0096] The acquired enhanced ship image data was divided into a training set and a test set in a ratio of approximately 9:1. The training set data and initial parameters were input into the object detection model constructed above for forward computation. Backpropagation and gradient descent were used to update the network weights until the network loss parameters converged to a minimum error. The Adam optimizer was used for gradient optimization.
[0097] Furthermore, by setting different hyperparameters, we focus the scenario on the inspection task of the drone near the coast, which has certain requirements for real-time performance. The present invention selects the one-stage detection framework YOLOv5l as a benchmark, and adds the above-mentioned dynamic data enhancement method, angle classification idea and feature alignment method to the training process. The model involved in the present invention is compared with known advanced models such as RoI Transformer and R2CNN. The method designed by the present invention has outstanding overall performance while taking into account both detection accuracy and detection speed. It avoids the periodicity problem of angle regression and has high real-time performance and extremely high detection accuracy at the same time, which is suitable for application in similar inspection scenarios with high real-time performance.
[0098] like Figure 3 As shown, embodiment 2 further discloses a training device for a rotating ship target detection model, which includes a preprocessing unit 100, a data enhancement unit 200, a data input unit 300, a loss calculation unit 400, and a parameter updating unit 500. The preprocessing unit 100 is used to preprocess and angle-label the original rotating ship image to obtain a labeled ship image; the data enhancement unit 200 is used to set the rotation trigger probability of the current training round and perform data enhancement processing based on the labeled ship image to obtain an enhanced ship image; the data input unit 300 is used to input the enhanced ship image into the rotating ship target detection model to be trained to obtain a predicted value; the loss calculation unit 400 is used to calculate the loss function value of the current training round based on the predicted value and the true value corresponding to the labeled ship image; and the parameter updating unit 500 is used to update the model parameters of the rotating ship target detection model to be trained based on the loss function value to complete the current round of training.
[0099] Specifically, the data enhancement unit 200 is also used to determine whether there is a rotation loss imbalance after the previous round of training is completed; if there is a rotation loss imbalance, the rotation trigger probability of the current training wheel is set to a first predetermined value; if there is no rotation loss imbalance, the rotation trigger probability of the current training wheel is set to a second predetermined value.
[0100] Furthermore, the loss calculation unit 400 is also used to calculate a first loss value based on angular distance, a second loss value based on angular classification, and a third loss value based on category according to the center coordinates, width, height, angle corresponding to the real frame and the center coordinates, width, height, angle of the predicted frame. The first loss value, the second loss value, and the third loss value constitute the loss function value.
[0101] Embodiment 3 further discloses a computer-readable storage medium, which stores a training program for a rotating ship target detection model. When the training program for a rotating ship target detection model is executed by a processor, the above-mentioned training method for a rotating ship target detection model is implemented.
[0102] Furthermore, the fourth embodiment also discloses a computer device, at the hardware level, such as Figure 4 As shown, the computer device includes a processor 12, an internal bus 13, a network interface 14, and a computer-readable storage medium 11. The processor 12 reads and executes the corresponding computer program from the computer-readable storage medium, forming a request processing device at the logical level. Of course, in addition to software implementation, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware. In other words, the execution of the following processing flow is not limited to individual logic units and can also be hardware or logic devices. The computer-readable storage medium 11 stores a training program for a rotating ship target detection model. When executed by the processor, this training program implements the aforementioned training method for the rotating ship target detection model.
[0103] Computer-readable storage media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer-readable storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0104] The above describes in detail the specific implementation methods of the present invention. Although some embodiments have been shown and described, those skilled in the art should understand that these embodiments can be modified and improved without departing from the principles and spirit of the present invention, the scope of which is defined by the claims and their equivalents. These modifications and improvements should also be within the scope of protection of the present invention.
Claims
1. A training method for a rotating ship target detection model, characterized in that: The training method comprises: Preprocessing and angle annotation are performed on the original rotated ship image to obtain a ship annotation image; The method further comprises: setting a rotation trigger probability of a current training wheel according to a rotation loss condition after a previous round of training, performing data augmentation processing on the annotated ship image, and obtaining an enhanced ship image, comprising: determining whether a rotation loss imbalance exists after the previous round of training; if a rotation loss imbalance exists, setting the rotation trigger probability of the current training wheel to a first predetermined value; and if no rotation loss imbalance exists, setting the rotation trigger probability of the current training wheel to a second predetermined value; wherein determining whether a rotation loss imbalance exists is based on an angular loss contribution after one epoch of training; Inputting the enhanced ship image into a rotating ship target detection model to be trained to obtain a prediction value; Calculating a loss function value of a current training round based on the predicted value and the true value corresponding to the vessel annotated image; The model parameters of the rotating ship target detection model to be trained are updated according to the loss function value to complete the current round of training.
2. The training method for a rotating ship target detection model according to claim 1, characterized in that: The method of inputting the enhanced ship image into the rotating ship target detection model to be trained to obtain a prediction value includes: After the enhanced ship image is input into the rotating ship target detection model to be trained, convolution feature maps of different levels are obtained; Perform a rotation feature alignment operation on the convolution feature map of each level to obtain the convolution area after feature alignment; The center coordinates, width, height, and angle of the prediction box are determined according to the convolution area after feature alignment as the prediction value.
3. The training method for a rotating ship target detection model according to claim 2, characterized in that: The method of performing a rotational feature alignment operation on the convolution feature map of each level to obtain a convolution region after feature alignment includes: Traversing multiple angles, calculating the response value of the feature map area determined by the preset anchor frame in the convolution feature map and the feature map area corresponding to the target true value under each angle channel; The convolution area after feature alignment is calculated based on the angle corresponding to the maximum response value.
4. The training method for a rotating ship target detection model according to claim 2, characterized in that: The true value is the center coordinate, width, height, and angle corresponding to the true frame of the ship annotated image. The method for calculating the loss function value of the current training round based on the predicted value and the true value corresponding to the ship annotated image includes: According to the center coordinates, width, height, angle corresponding to the real frame and the center coordinates, width, height, angle of the predicted frame, a first loss value based on angular distance, a second loss value based on angle classification, and a third loss value based on category are calculated. The first loss value, the second loss value, and the third loss value constitute the loss function value.
5. The training method for a rotating ship target detection model according to claim 4, characterized in that: The method for calculating the first loss value based on the angular distance includes: Calculate the intersection-over-union ratio of the real frame and the predicted frame according to the center coordinates, width, height, and angle corresponding to the real frame and the center coordinates, width, height, and angle of the predicted frame; A weight parameter based on angle distance is calculated according to the angle of the real frame, the angle of the predicted frame, and the aspect ratio of the real frame; The first loss value is calculated based on the angular distance-based weight parameter and the intersection-over-union ratio.
6. The training method for a rotating ship target detection model according to claim 5, characterized in that: The method for calculating the second loss value based on angle classification includes: A second loss value is calculated based on the angle of the real frame and the angle of the predicted frame.
7. A training device for a rotating ship target detection model, characterized in that: The training device comprises: a preprocessing unit, configured to perform preprocessing and angle annotation processing on the original rotated ship image to obtain a ship annotated image; a data enhancement unit, configured to set a rotation trigger probability of a current training wheel, perform data enhancement processing on the annotated ship image, and obtain an enhanced ship image, comprising: determining whether a rotation loss imbalance exists after a previous round of training is completed; if a rotation loss imbalance exists, setting the rotation trigger probability of the current training wheel to a first predetermined value; if no rotation loss imbalance exists, setting the rotation trigger probability of the current training wheel to a second predetermined value; wherein determining whether a rotation loss imbalance exists is based on an angular loss contribution after one epoch of training; a data input unit, configured to input the enhanced ship image into a rotating ship target detection model to be trained to obtain a predicted value; a loss calculation unit, configured to calculate a loss function value of a current training round based on the predicted value and a true value corresponding to the vessel annotated image; A parameter updating unit is used to update the model parameters of the rotating ship target detection model to be trained according to the loss function value to complete the current round of training.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a training program for a rotating ship target detection model, and when the training program for the rotating ship target detection model is executed by a processor, the training method for the rotating ship target detection model according to any one of claims 1 to 6 is implemented.
9. A computer device, characterized in that: The computer device includes a computer-readable storage medium, a processor, and a training program for a rotating ship target detection model stored in the computer-readable storage medium. When the training program for the rotating ship target detection model is executed by the processor, the training method for the rotating ship target detection model according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Rotating target detection method based on YOLOv5
CN113326734A