A method for detecting rotating targets in aerial photography vehicles based on an improved YOLOv5

By improving the YOLOv5 algorithm and combining Diamond Mapping Unit, Ghost mapping technology, and ASFF mechanism, feature extraction and detection were optimized, solving the problem of poor detection of rotating targets in aerial photography and achieving high-precision and efficient rotating target detection.

CN116363610BActive Publication Date: 2025-10-28HENAN UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310347944.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-31
Publication Date
2025-10-28
Estimated Expiration
2043-03-31

AI Technical Summary

Technical Problem

The existing YOLOv5 algorithm performs poorly in aerial vehicle rotating target detection, especially under complex conditions where it cannot effectively utilize the rotating frame for detection, leaving room for improvement.

Method used

A vehicle rotation target detection model based on an improved YOLOv5 was constructed. By designing a Diamond Mapping Unit module in the Backbone shallow network, applying Ghost mapping technology and the Adaptive Spatial Feature Fusion (ASFF) mechanism, and introducing an angle category prediction branch, the model was trained using bounding box, confidence, category, and angle classification loss functions to optimize feature extraction and detection performance.

Benefits of technology

It improves the accuracy and reliability of aerial vehicle rotating target detection, effectively handles small rotating targets, and enhances detection performance and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116363610B_ABST
    Figure CN116363610B_ABST
Patent Text Reader

Abstract

This invention relates to the field of rotating vehicle target detection technology, specifically to a method for aerial vehicle rotating target detection based on an improved YOLOv5. The method includes: constructing an aerial vehicle rotating target detection model based on the improved YOLOv5; constructing an aerial vehicle detection dataset; training the aerial vehicle rotating target detection network using bounding box loss function, confidence loss function, class loss function, and angle classification loss function; detecting the trained model; evaluating the model based on the detection results to determine if it meets practical requirements; if it meets practical requirements, applying the trained model to vehicle detection in aerial photography scenarios; if it does not meet practical requirements, correcting the model and continuing training until it meets practical requirements. The final model achieves good detection results for aerial vehicle rotating targets, effectively addressing the problems of poor detection performance and high computational cost in aerial photography.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of rotating vehicle target detection technology, and specifically to a method for detecting rotating aerial vehicles based on an improved YOLOv5. Background Technology

[0002] With the continuous development of technology in recent years, the field of artificial intelligence has remained highly popular, achieving remarkable results in many applications. Intelligent image recognition and detection technologies have also been continuously developed, with vehicle target detection technology experiencing rapid advancements. Furthermore, with the development of modern economy and society, people's living standards are constantly improving, and the number of cars is continuously increasing. Vehicle target detection is the foundation for vehicle recognition and tracking. Traditional target detection algorithms suffer from low detection efficiency, poor results, and high resource consumption, and cannot accurately detect vehicles in complex situations. With the development of machine learning and GPU parallel technology in recent years, numerous target detection algorithms have emerged. Among them, the YOLO series is one of the most widely used target detection algorithms. Through continuous iteration and algorithm optimization, YOLO has demonstrated good performance advantages; however, the YOLO algorithm still has a way to go to achieve accurate detection of aerial vehicle images.

[0003] A YOLOv5-based rotating target detection method is proposed for target detection. It employs a coordinate offset regression algorithm and adds an Attention-Net module after the YOLOv5 backbone for feature extraction, reducing noise in the feature map. During training, offset loss functions and Attention-Net module loss functions are incorporated. The predicted target boxes are processed by rotating the target, and the horizontal box loss function is replaced with a rotation box loss function using matrix operations, improving computational efficiency. The final model achieves good detection results for rotating targets in aerial images, effectively handling the problem of detecting small rotating targets. However, the method for detecting target rotation is not yet simple, and the chosen rotation algorithm has room for improvement, indicating a gap before practical application.

[0004] A proposed vehicle target detection algorithm based on an improved YOLOv5 model is presented. This algorithm introduces an OSA (One-Time Aggregation) module to optimize the backbone network within the YOLOv5s network model framework, enhancing its feature extraction capabilities. Furthermore, it employs a non-local attention mechanism for feature enhancement and utilizes non-maximum suppression to filter detection boxes. While this method optimizes the backbone network structure and introduces the OSA module and non-local attention mechanism, resulting in improved detection speed and average accuracy compared to the original YOLOv5s model, it only supports horizontal bounding boxes for vehicle target detection under complex conditions and cannot utilize rotated bounding boxes. Its performance is also poor for detecting rotating vehicles in aerial photography, indicating room for further improvement. Summary of the Invention

[0005] The summary section of this invention provides a brief overview of the concepts, which will be described in detail in the detailed description section that follows. This summary section is not intended to identify key or essential features of the claimed invention, nor is it intended to limit the scope of the claimed invention.

[0006] To address the technical problem of poor performance in detecting rotating targets of aerial vehicles, this invention proposes a method for detecting rotating targets of aerial vehicles based on an improved YOLOv5.

[0007] This invention provides a method for detecting rotating targets in aerial photography vehicles based on an improved YOLOv5, the method comprising:

[0008] Construct an aerial vehicle rotating target detection model based on an improved YOLOv5;

[0009] A dataset for detecting rotating targets of aerial vehicles was established and preprocessed to obtain a dataset based on the improved YOLOv5 model for detecting rotating targets of aerial vehicles.

[0010] Using a dataset of an aerial vehicle rotating target detection model based on improved YOLOv5, an improved YOLOv5-based aerial vehicle rotating target detection model was trained and constructed.

[0011] The test results were obtained for the aerial vehicle rotating target detection model based on the improved YOLOv5 that had been trained.

[0012] Based on the test results, evaluate whether the performance of the trained aerial vehicle rotating target detection model based on the improved YOLOv5 meets the requirements of practical applications.

[0013] If the performance of the trained aerial vehicle rotating target detection model based on the improved YOLOv5 meets the actual application requirements, then the trained aerial vehicle rotating target detection model based on the improved YOLOv5 will be used for aerial vehicle rotating target detection.

[0014] If the performance of the trained aerial vehicle rotation target detection model based on improved YOLOv5 does not meet the requirements of practical applications, the parameters of the aerial vehicle rotation target detection model based on improved YOLOv5 are corrected, and the model is trained again until its performance meets the requirements of practical applications. The trained aerial vehicle rotation target detection model based on improved YOLOv5 is then used for aerial vehicle rotation target detection.

[0015] Furthermore, the construction of the aerial vehicle rotation target detection model based on the improved YOLOv5 includes:

[0016] Construct a Focus module that performs slicing operations on the input image;

[0017] In the Backbone shallow network based on the improved YOLOv5 aerial vehicle rotating target detection model, the Diamond Mapping Unit module is designed to improve the feature extraction process of the shallow network.

[0018] Based on the improved YOLOv5 aerial vehicle rotating target detection model, Ghost mapping technology is applied to construct Cheap Backbone Network and Cheap Neck Network, where Cheap CSP module is a key component.

[0019] An adaptive spatial feature fusion (ASFF) mechanism is introduced into the Head network of the aerial vehicle rotating target detection model based on the improved YOLOv5 to form the ASFF-Head network. The ASFF mechanism performs adaptive spatial fusion on the feature maps from the Cheap Backbone Network and the Cheap Neck Network to regenerate feature maps of three different scales.

[0020] An angle category prediction branch is added to the ASFF-Head network, which is based on an improved YOLOv5 aerial vehicle rotation target detection model. The bounding box loss, confidence loss, category loss and angle classification loss are calculated on the feature maps of different scales to complete the prediction.

[0021] Furthermore, the establishment and preprocessing of the aerial vehicle rotation target detection dataset to obtain a dataset based on the improved YOLOv5 aerial vehicle rotation target detection model includes:

[0022] Using a drone platform, urban roads were photographed under different weather conditions. The collected vehicle images were preprocessed using flipping and cropping methods. The preprocessed vehicle images were then labeled using the rotation annotation tool roLabelImg to create a label file. The dataset obtained by using a drone platform to photograph urban roads under different weather conditions is an aerial vehicle rotation target detection dataset.

[0023] A predetermined percentage of vehicle images and their corresponding label files are randomly selected from the preprocessed vehicle images as the training set, and the remaining vehicle images and their corresponding label files are selected as the test set. The training set and the test set together form a dataset for an aerial vehicle rotation target detection model based on the improved YOLOv5.

[0024] Furthermore, the dataset used to train and construct the improved YOLOv5-based aerial vehicle rotation target detection model includes:

[0025] Initialize the training parameters of the aerial vehicle rotating target detection model based on the improved YOLOv5;

[0026] The training set is input into the improved YOLOv5-based aerial vehicle rotation target detection model, and the model is trained by performing a preset number of epochs using the bounding box loss function, confidence loss function, class loss function, and angle classification loss function, resulting in the trained aerial vehicle rotation target detection model based on the improved YOLOv5.

[0027] Furthermore, the test results of the improved YOLOv5-based aerial vehicle rotation target detection model, which has been trained and completed, include:

[0028] The test set was input into the trained aerial vehicle rotation target detection model based on the improved YOLOv5 for testing, and the test results were obtained.

[0029] Furthermore, the evaluation of whether the performance of the trained aerial vehicle rotation target detection model based on the improved YOLOv5 meets the requirements of practical applications, based on the test results, includes:

[0030] Based on the test results, the trained aerial vehicle rotation target detection model based on the improved YOLOv5 was evaluated using precision, recall, and mean average precision (mAP).

[0031] Furthermore, the Diamond Mapping Unit module performs feature extraction through a dual-branch approach. The first branch consists of a max pooling operation and a 1x1 convolution operation, while the second branch consists of a 1x1 convolution and a 3x3 convolution.

[0032] Furthermore, the Cheap CSP module consists of three convolutional modules and a GhostBottleneck module, wherein the GhostBottleneck module is formed by stacking two Ghost modules.

[0033] Furthermore, the bounding box loss function for:

[0034]

[0035] in, The intersection-union ratio (IUU) of the predicted bounding box and the ground truth bounding box. The parameter representing the prediction center, The parameter representing the center of the true target bounding box. It is the square of the distance between the two center points. and Aspect ratio, and These represent the width and height of the prediction box, respectively. and These represent the width and height of the actual bounding box, respectively. It's a 180° arc. It is the arctangent function;

[0036] Confidence loss function for:

[0037]

[0038] in, Indicates the number of grid cells. This represents the number of anchors in each grid cell. This indicates whether a target exists in the j-th anchor of the i-th grid. If a target exists, It is 1 if it is true, otherwise it is 0. Represents the actual value. Indicates the predicted value. Indicates the constraint coefficient;

[0039] Category loss function for:

[0040]

[0041] in, Indicates the number of grid cells. This indicates whether a target exists in the j-th anchor of the i-th grid. If a target exists, It is 1 if it is true, otherwise it is 0. Represents the true class probability. Indicates the predicted category probability;

[0042] Angle classification loss function for:

[0043]

[0044]

[0045]

[0046] in, It's a window function. It is the radius of the window function. It is the angle of the bounding box; The number of samples; A total of 180 categories; It is the sigmoid function; To predict the first The first sample The probability of each angle. The maximum value is 1, which is the predicted value; For the first One sample in The expression below The labels from each angle represent the true values. The maximum value is 1; according to the first The predicted and actual values ​​of each sample from various angles are sequentially passed through... Calculate, the first The summation of 180 angle results for each sample yielded the following result. ,Will The angle loss is obtained by averaging the calculation results of each sample.

[0047] Furthermore, the ASFF mechanism adaptively spatially fuses the feature maps from the Cheap Backbone Network and the Cheap Neck Network, regenerating feature maps at three different scales using the following formulas:

[0048]

[0049]

[0050] in, , For the first Feature maps output after layer fusion Representing the The weight matrix of the layer, These are constraints; Representing the first The feature map is obtained by adjusting the size and number of channels of the other two layers based on the first layer.

[0051] The purpose of this invention is to provide an aerial vehicle rotation target detection method based on an improved YOLOv5, which has high reliability and practicality, aiming to improve the accuracy of the original YOLOv5 network in detecting aerial vehicle rotation targets. The technical approach of this invention is as follows: constructing a deep learning model for aerial vehicle rotation target detection based on an improved YOLOv5, establishing a dataset, and preprocessing the dataset. The model is evaluated and corrected through training and detection, and finally, the trained aerial vehicle rotation target detection network is used to detect aerial vehicles.

[0052] The present invention has the following beneficial effects:

[0053] First, an angle classification loss is added. The angle regression problem is transformed into an angle classification problem using CSL technology. The model network is trained using bounding box loss function, confidence loss function, class loss function and angle classification loss function. This invention can train more fully on the samples in the dataset, thereby improving the detection performance and detection effect of the network.

[0054] Secondly, by designing a Diamond Mapping Unit module in the Backbone shallow network, this invention minimizes the information loss of the original input image compared to the original shallow network design, improves the feature extraction process of the shallow network, effectively represents target features, and improves the performance of vehicle detection.

[0055] Third, the ASFF (Adaptive Spatial Feature Fusion) mechanism is introduced into the Head network to construct the ASFF-Head network. This mechanism learns the connections between feature maps at different scales. Compared with the original Head network that directly generates feature maps, the ASFF mechanism ensures that feature maps can adaptively fuse feature information at different levels at each spatial location.

[0056] Fourth, Ghost mapping technology is used in the Backbone network and Neck network to construct a network structure with lightweight effect. Compared with directly using Conv to generate feature maps, this invention uses Ghost mapping technology to generate complete and similar feature maps from partial feature maps, which compresses the number of network parameters and optimizes the gradient update process. Attached Figure Description

[0057] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0058] Figure 1 A flowchart of a method for detecting rotating targets in aerial photography vehicles based on an improved YOLOv5 according to the present invention;

[0059] Figure 2 This is yet another flowchart according to the present invention;

[0060] Figure 3 This is a schematic diagram of the network structure according to the present invention;

[0061] Figure 4 Illustration of the identification results according to the present invention Figure 1 ;

[0062] Figure 5 Illustration of the identification results according to the present invention Figure 2 ;

[0063] Figure 6 Illustration of the identification results according to the present invention Figure 3 ;

[0064] Figure 7 Illustration of the identification results according to the present invention Figure 4 . Detailed Implementation

[0065] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the specific implementation methods, structures, features, and effects of the technical solution proposed according to the present invention are described in detail below with reference to the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.

[0066] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0067] This invention provides a method for detecting rotating targets in aerial photography vehicles based on an improved YOLOv5, the method comprising the following steps:

[0068] Construct an aerial vehicle rotating target detection model based on an improved YOLOv5;

[0069] A dataset for detecting rotating targets of aerial vehicles was established and preprocessed to obtain a dataset based on the improved YOLOv5 model for detecting rotating targets of aerial vehicles.

[0070] Using a dataset of an aerial vehicle rotating target detection model based on improved YOLOv5, an improved YOLOv5-based aerial vehicle rotating target detection model was trained and constructed.

[0071] The test results were obtained for the aerial vehicle rotating target detection model based on the improved YOLOv5 that had been trained.

[0072] Based on the test results, evaluate whether the performance of the trained aerial vehicle rotating target detection model based on the improved YOLOv5 meets the requirements of practical applications.

[0073] If the performance of the trained aerial vehicle rotating target detection model based on the improved YOLOv5 meets the actual application requirements, then the trained aerial vehicle rotating target detection model based on the improved YOLOv5 will be used for aerial vehicle rotating target detection.

[0074] If the performance of the trained aerial vehicle rotation target detection model based on improved YOLOv5 does not meet the requirements of practical applications, the parameters of the aerial vehicle rotation target detection model based on improved YOLOv5 are corrected, and the model is trained again until its performance meets the requirements of practical applications. The trained aerial vehicle rotation target detection model based on improved YOLOv5 is then used for aerial vehicle rotation target detection.

[0075] The following is a detailed explanation of each of the above steps:

[0076] refer to Figure 1 The flowchart illustrates some embodiments of an aerial vehicle rotation target detection method based on improved YOLOv5 according to the present invention. This aerial vehicle rotation target detection method based on improved YOLOv5 includes the following steps:

[0077] Step S1: Construct an aerial vehicle rotation target detection model based on the improved YOLOv5.

[0078] In some embodiments, an aerial vehicle rotating target detection model based on improved YOLOv5 can be constructed.

[0079] It should be noted that another flowchart of the present invention can be as follows: Figure 2 As shown. The network structure of the aerial vehicle rotating target detection model based on the improved YOLOv5 can be as follows: Figure 3 As shown.

[0080] As an example, this step may include the following steps:

[0081] The first step is to build the Focus module.

[0082] The Focus module described above performs a slicing operation on the input image.

[0083] For example, the Focus module is constructed. In YOLOv5, the Focus module performs a slicing operation on the image before it enters the backbone. Specifically, it takes a value for every pixel in an image, resulting in four complementary images that look similar without information loss. This concentrates the W and H information into the channel space, expanding the input channels by four times. That is, the stitched image becomes 12 channels compared to the original RGB three-channel mode. Finally, the new image is subjected to a convolution operation to obtain a double-downsampled feature map without information loss.

[0084] The second step involves designing the Diamond Mapping Unit module within the Backbone shallow network based on the improved YOLOv5 aerial vehicle rotation target detection model.

[0085] The Diamond Mapping Unit module described above improves the feature extraction process of shallow networks and enhances their expressive power. This module performs feature extraction through a dual-branch approach. The first branch consists of a max-pooling operation and a 1x1 convolution operation. The second branch consists of a 1x1 convolution and a 3x3 convolution.

[0086] For example, a Diamond Mapping Unit module can be designed in the Backbone shallow network of the improved YOLOv5 aerial vehicle rotation target detection model. This module divides the feature map input from the first step (as an example, step S1) into two branches. The first branch performs max pooling to enhance the main features of the feature map and halves the resolution. A 1*1 convolution is then performed on the feature map obtained after max pooling to increase the number of channels. The second branch first performs a 1*1 convolution to reduce the number of channels, and then uses a 3*3 convolution with a stride of 2 to downsample the resulting feature map. The resulting feature map is then fused with the feature map generated by the first branch in the channel dimension and fed into a 1*1 convolution to further reduce the number of channels.

[0087] The third step involves applying Ghost mapping technology to construct the Cheap Backbone Network and Cheap Neck Network in the Backbone and Neck networks of the aerial vehicle rotation target detection model based on the improved YOLOv5.

[0088] The Cheap CSP module is a key component, used to reduce computational load and lower network parameters. The Cheap CSP module mainly consists of three convolutional modules and a GhostBottleneck module. The GhostBottleneck module is primarily composed of two stacked Ghost modules.

[0089] For example, Ghost mapping techniques can be applied to the Backbone and Neck networks of an improved YOLOv5-based aerial vehicle rotation target detection model to construct lightweight Cheap Backbone Network and Cheap Neck Network. The Ghost module first obtains a subset of feature maps through ordinary convolutions, then performs a cheap transformation on these feature maps to generate more similar feature maps. Finally, the two sets of feature maps are fused. The specific formula is as follows:

[0090]

[0091] in, Enter height ,width The feature map, For convolution operations, It is used A convolution kernel of a certain size, For bias terms, To generate height ,width Each feature map. Then for Each feature map in the dataset is then regenerated using a series of linear operations. Feature maps:

[0092]

[0093] in, yes The Middle Each feature map Yes The first The nth linear operation (except the last one) generates the nth... Ghost feature maps. Final output. Feature map .

[0094] Compared to the original network, Cheap Backbone Network and Cheap Neck Network utilize Ghost mapping technology to compress the number of network parameters and reduce computational load.

[0095] The fourth step involves introducing an adaptive spatial feature fusion (ASFF) mechanism into the Head network of the aerial vehicle rotation target detection model based on the improved YOLOv5, forming an ASFF-Head network. The ASFF mechanism adaptively fuses feature maps from the Cheap Backbone Network and Cheap Neck Network to regenerate feature maps of three different scales (denoted as P1, P2, and P3), thus solving the problem of inconsistent features at different levels.

[0096] For example, step S1 includes the ASFF mechanism in step four, which adjusts the feature maps of the three levels to the same resolution and dimension as itself. During training, feature fusion is performed according to a formula, and then three feature maps of different scales are regenerated. The formula for the ASFF mechanism to adaptively fuse feature maps from Cheap Backbone Network and Cheap Neck Network to regenerate feature maps of three different scales is as follows:

[0097]

[0098]

[0099] in, , For the first Feature maps output after layer fusion Representing the The weight matrix of the layer, These are constraints. Representing the first The feature map is obtained by adjusting the size and number of channels of the other two layers based on the first layer.

[0100] when At that time, P1 maintains the same size and number of channels. P1 and P2 are obtained by downsampling and adjusting their size and number of channels to be the same as P1. P3 was obtained by adjusting its size and number of channels after being downsampled four times. , The weight matrix represents the first level. Then, the three adjusted feature maps are multiplied by their respective weight matrices and summed, then fused to obtain the final result. .

[0101] when At that time, P1 is enlarged to the same size as P2 using interpolation, and the number of channels is adjusted to be the same as P2 by doubling the upsampling. P2 retains its size and number of channels unchanged. P2 and P3 are obtained by downsampling and adjusting their size and number of channels to be the same as P2. , The weight matrix represents the second level. Then, the adjusted feature maps are multiplied by their respective weight matrices and summed, and then fused to obtain the final result. .

[0102] when At that time, P1 was enlarged to the same size as P3 using interpolation, and the number of channels was adjusted to be the same as P3 by four times upsampling. P2 is enlarged to the same size as P3 using interpolation, and the number of channels is adjusted to be the same as P3 by doubling the upsampling. P3 retains its size and dimensions. That's P3. The weight matrix represents the third level. Then, the adjusted feature maps are multiplied by their respective weight matrices and summed, and then fused to obtain the final result. .

[0103] The constraint is obtained by using a 1*1 convolutional layer with 3 output channels and the Softmax function to obtain weights in the range [0, 1].

[0104] The fifth step involves adding an angle category prediction branch to the ASFF-Head network, which is based on the improved YOLOv5 aerial vehicle rotation target detection model. The bounding box loss, confidence loss, category loss, and angle classification loss are calculated on the feature maps of different scales to complete the prediction.

[0105] For example, an angle category prediction branch can be added to the ASFF-Head network based on the improved YOLOv5 aerial vehicle rotation target detection model. The angle regression problem can be transformed into an angle classification problem using the circular smooth label CSL. The bounding box loss, confidence loss, category loss and angle classification loss can be calculated on the feature maps of different scales obtained in step S1 (as an example, step 4) to complete the prediction.

[0106] For example, the functions corresponding to bounding box loss, confidence loss, class loss, and angle classification loss are as follows:

[0107] Bounding box loss function for:

[0108]

[0109] in, The intersection-union ratio (IUU) of the predicted bounding box and the ground truth bounding box. The parameter representing the prediction center, The parameter representing the center of the true target bounding box. It is the square of the distance between the two center points. and Aspect ratio, and These represent the width and height of the prediction box, respectively. and These represent the width and height of the actual bounding box, respectively. It's a 180° arc. It is the arctangent function.

[0110] Confidence loss function for:

[0111]

[0112] in, Indicates the number of grid cells. This represents the number of anchors in each grid cell. This indicates whether a target exists in the j-th anchor of the i-th grid. If a target exists, It is 1 if it is true, otherwise it is 0. Represents the actual value. Indicates the predicted value. This represents the constraint coefficient.

[0113] Category loss function for:

[0114]

[0115] in, Indicates the number of grid cells. This indicates whether a target exists in the j-th anchor of the i-th grid. If a target exists, It is 1 if it is true, otherwise it is 0. Represents the true class probability. This indicates the predicted category probability.

[0116] Angle classification loss function for:

[0117]

[0118]

[0119]

[0120] in, It's a window function; you can choose the Gaussian function. It is the radius of the window function. It is the angle of the bounding box. This represents the number of samples. There are a total of 180 categories. This is the sigmoid function. To predict the first The first sample The probability of each angle. The maximum value is 1, which is the predicted value. For the first One sample in The expression below The labels from each angle, i.e., the true value. The maximum value is 1. According to the... The predicted and actual values ​​of each sample from various angles are sequentially passed through... Calculate, the first The summation of 180 angle results for each sample yielded the following result. ,Will The average of the calculation results for each sample yields the angle loss for that instance. For example, the angle loss can be calculated by averaging the results for the first sample. Substitute the predicted and actual values ​​of each sample from each angle into the input... Calculate, the first The summation of 180 angle results for each sample yielded the following result. ,Will The average of the calculation results for each sample is the angle loss for this operation.

[0121] Step S2: Establish a dataset for detecting rotating targets of aerial vehicles and perform preprocessing to obtain a dataset based on the improved YOLOv5 model for detecting rotating targets of aerial vehicles.

[0122] In some embodiments, a dataset based on an improved YOLOv5 aerial vehicle rotating target detection model can be constructed.

[0123] As an example, this step may include the following steps:

[0124] The first step involves using a drone platform to photograph urban roads under different weather conditions. The acquired vehicle images are preprocessed using flipping and cropping methods. The preprocessed vehicle images are then labeled using the rotation annotation tool roLabelImg to create label files.

[0125] Among them, an unmanned aerial vehicle (UAV) platform was used to take pictures of urban roads under different weather conditions, and the resulting dataset is an aerial vehicle rotating target detection dataset.

[0126] For example, a drone platform can be used to photograph urban roads under different weather conditions. The acquired images can be preprocessed using methods such as flipping and cropping. The preprocessed vehicle images can then be labeled using a rotation annotation tool like roLabelImg to create label files. Alternatively, a drone equipped with a high-definition camera can be used to photograph vehicle targets at different heights and angles on different road sections at different times, under varying weather conditions. The captured images can be preprocessed, discarding aerial images that do not contain vehicle information, and flipping and cropping the remaining images to expand the training dataset and enrich the image data.

[0127] The second step involves randomly selecting a predetermined percentage of vehicle images and their corresponding label files from the preprocessed vehicle images as the training set, and using the remaining vehicle images and their corresponding label files as the test set.

[0128] The training and test sets together form the dataset for an aerial vehicle rotation target detection model based on an improved YOLOv5. The preset percentage can be a pre-defined percentage, such as 60%.

[0129] For example, 60% of the sample images and corresponding label files in the first step included in step S2 can be randomly selected as the training set, and 40% of the sample images and corresponding label files can be selected as the test set.

[0130] Step S3: Using the dataset of the aerial vehicle rotation target detection model based on the improved YOLOv5, train the constructed aerial vehicle rotation target detection model based on the improved YOLOv5.

[0131] In some embodiments, an aerial vehicle rotating target detection model based on an improved YOLOv5 can be trained.

[0132] As an example, this step may include the following steps:

[0133] The first step is to initialize the training parameters of the aerial vehicle rotating target detection model based on the improved YOLOv5.

[0134] For example, during training, the training epochs are set to 250, the batch size is 8, the initial learning rate (lr) is 0.01, the momentum and weight decay are 0.937 and 0.0005 respectively, and the training warmup is set to 3.

[0135] The second step involves inputting the training set into the improved YOLOv5-based aerial vehicle rotation target detection model, and then using the bounding box loss function, confidence loss function, class loss function, and angle classification loss function to iterate the rotating vehicle target detection model for a predetermined number of epochs to obtain the trained aerial vehicle rotation target detection model based on the improved YOLOv5.

[0136] The preset quantity can be a pre-set number. For example, the preset quantity can be 300. The preset number of epochs can be 300 epochs.

[0137] For example, the training set included in step S2 (as an example) from the second step can be fed into the aerial vehicle rotation target detection model based on the improved YOLOv5 constructed in step S1. The rotating vehicle target detection model can be trained iteratively for 300 epochs using the bounding box loss function, confidence loss function, class loss function, and angle classification loss function to obtain a preliminarily trained aerial vehicle rotation target detection model. During the training process, when the aerial vehicle rotation target detection model based on the improved YOLOv5 enters the training set, it determines whether the aerial image contains a complete vehicle target based on the read label data, and automatically deletes aerial images in the training set where the vehicle target is less than half displayed, so as not to interfere with the model training.

[0138] Step S4: Test the trained aerial vehicle rotation target detection model based on the improved YOLOv5 and obtain the test results.

[0139] In some embodiments, the test set can be input into the trained aerial vehicle rotation target detection model based on improved YOLOv5 for testing to obtain test results.

[0140] As an example, the test set included in step S2 (as an example, the second step) can be input into the aerial vehicle rotation target detection model obtained after training in step S3 (as an example, the second step) for detection. The detection result obtained is the aerial vehicle rotation target detection model based on the improved YOLOv5 that has been trained as described above, and the test result is obtained.

[0141] Step S5: Based on the test results, evaluate whether the performance of the trained aerial vehicle rotating target detection model based on the improved YOLOv5 meets the requirements of practical applications.

[0142] In some embodiments, the trained aerial vehicle rotation target detection model based on the improved YOLOv5 can be evaluated using precision, recall, and average accuracy based on the test results.

[0143] As an example, the aerial vehicle rotation target detection model can be evaluated using precision, recall, and mean average precision (mAP) based on the test results in step S4. Recall represents the percentage of positive examples correctly predicted (complete detection); it's the proportion of correctly predicted positive examples out of all positive examples. Precision represents the percentage of truly positive examples among the predicted positive samples. In the field of object detection in machine learning, mAP (mean average precision) is a crucial metric used to measure the performance of object detection algorithms. Generally, the average precision (mAP, also known as the average accuracy across all classes) is obtained by weighted averaging of the average precision (AP) of all classes.

[0144] Step S6: If the performance of the trained aerial vehicle rotation target detection model based on the improved YOLOv5 meets the actual application requirements, then the trained aerial vehicle rotation target detection model based on the improved YOLOv5 will be used for aerial vehicle rotation target detection.

[0145] In some embodiments, if the evaluation results of the aerial vehicle rotating target detection model obtained in step S5 meet the actual needs, the aerial vehicle rotating target detection model based on the improved YOLOv5 will be applied to the actual aerial rotating vehicle target detection.

[0146] Step S7: If the performance of the trained aerial vehicle rotation target detection model based on improved YOLOv5 does not meet the actual application requirements, then the parameters of the aerial vehicle rotation target detection model based on improved YOLOv5 are corrected, and the training of the aerial vehicle rotation target detection model based on improved YOLOv5 is repeated until the performance of the aerial vehicle rotation target detection model based on improved YOLOv5 meets the actual application requirements. The trained aerial vehicle rotation target detection model based on improved YOLOv5 is then used for aerial vehicle rotation target detection.

[0147] In some embodiments, if the evaluation result of the aerial vehicle rotating target detection model obtained in step S5 does not meet the actual needs, the parameters of the model constructed in step S1 are corrected and then the process jumps to step S3 for retraining.

[0148] The identification results of this invention can be as follows: Figure 4 , Figure 5 , Figure 6 and Figure 7 As shown. In summary, by incorporating angle classification loss and utilizing CSL technology to transform the angle regression problem into an angle classification problem, and training the model network using bounding box loss function, confidence loss function, class loss function, and angle classification loss function, this invention can train the network more fully on the samples in the dataset, improving the network's detection performance and accuracy. First, by designing a Diamond Mapping Unit module in the Backbone shallow network, compared with the original shallow network design, this invention minimizes the information loss of the original input image, improves the feature extraction process of the shallow network, effectively represents target features, and improves vehicle detection performance. An adaptive spatial feature fusion (ASSF) mechanism is introduced into the Head network to construct an ASFF-Head network. This mechanism learns the connections between feature maps at different scales. Compared with the original Head network directly generating feature maps, the ASFF mechanism ensures that feature maps at each spatial location can adaptively fuse feature information from different levels. By utilizing Ghost mapping technology in the Backbone and Neck networks, a lightweight network structure is constructed. Compared with directly using Conv to generate feature maps, this invention uses Ghost mapping technology to generate complete and similar feature maps from partial feature maps, thereby compressing the number of network parameters and optimizing the gradient update process.

[0149] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A method for detecting rotating targets in aerial photography vehicles based on an improved YOLOv5, characterized in that, Includes the following steps: Construct an aerial vehicle rotating target detection model based on an improved YOLOv5; A dataset for detecting rotating targets of aerial vehicles was established and preprocessed to obtain a dataset based on the improved YOLOv5 model for detecting rotating targets of aerial vehicles. Using a dataset of an aerial vehicle rotating target detection model based on improved YOLOv5, an improved YOLOv5-based aerial vehicle rotating target detection model was trained and constructed. The test results were obtained for the aerial vehicle rotating target detection model based on the improved YOLOv5 that had been trained. Based on the test results, evaluate whether the performance of the trained aerial vehicle rotating target detection model based on the improved YOLOv5 meets the requirements of practical applications. The trained aerial vehicle rotating target detection model based on the improved YOLOv5 was used for aerial vehicle rotating target detection. The construction of the aerial vehicle rotation target detection model based on the improved YOLOv5 includes: Construct a Focus module that performs slicing operations on the input image; In the Backbone shallow network design of the aerial vehicle rotating target detection model based on the improved YOLOv5, the Diamond Mapping Unit module is used to improve the feature extraction process of the shallow network. Based on the improved YOLOv5 aerial vehicle rotating target detection model, Ghost mapping technology is applied to construct Cheap Backbone Network and Cheap Neck Network, where Cheap CSP module is a key component. An adaptive spatial feature fusion (ASFF) mechanism is introduced into the Head network of the aerial vehicle rotating target detection model based on the improved YOLOv5 to form the ASFF-Head network. The ASFF mechanism performs adaptive spatial fusion on the feature maps from the Cheap Backbone Network and the Cheap Neck Network to regenerate feature maps of three different scales. An angle category prediction branch is added to the ASFF-Head network based on the improved YOLOv5 aerial vehicle rotating target detection model. The bounding box loss, confidence loss, category loss and angle classification loss are calculated on the feature maps of different scales to complete the prediction. The Diamond Mapping Unit module performs feature extraction through a dual-branch approach. The first branch consists of a max pooling operation and a 1x1 convolution operation; the second branch consists of a 1x1 convolution and a 3x3 convolution. The Cheap CSP module consists of three convolutional modules and a GhostBottleneck module, wherein the GhostBottleneck module is composed of two Ghost modules stacked together.

2. The aerial vehicle rotation target detection method based on improved YOLOv5 according to claim 1, characterized in that, The process of establishing and preprocessing a dataset for detecting rotating targets of aerial vehicles yields a dataset based on an improved YOLOv5 model for detecting rotating targets of aerial vehicles, including: Using a drone platform, urban roads were photographed under different weather conditions. The collected vehicle images were preprocessed using flipping and cropping methods. The preprocessed vehicle images were then labeled using the rotation annotation tool roLabelImg to create a label file. The dataset obtained by using a drone platform to photograph urban roads under different weather conditions is an aerial vehicle rotation target detection dataset. A predetermined percentage of vehicle images and their corresponding label files are randomly selected from the preprocessed vehicle images as the training set, and the remaining vehicle images and their corresponding label files are selected as the test set. The training set and the test set together form a dataset for an aerial vehicle rotation target detection model based on the improved YOLOv5.

3. The aerial vehicle rotation target detection method based on improved YOLOv5 according to claim 2, characterized in that, The dataset used for training and constructing the aerial vehicle rotation target detection model based on the improved YOLOv5 includes: Initialize the training parameters of the aerial vehicle rotating target detection model based on the improved YOLOv5; The training set is input into the improved YOLOv5-based aerial vehicle rotation target detection model, and the model is trained by performing a preset number of epochs using the bounding box loss function, confidence loss function, class loss function, and angle classification loss function, resulting in the trained aerial vehicle rotation target detection model based on the improved YOLOv5.

4. The aerial vehicle rotation target detection method based on improved YOLOv5 according to claim 3, characterized in that, The test results obtained from the improved YOLOv5-based aerial vehicle rotation target detection model, which was trained and completed during the test, include: The test set was input into the trained aerial vehicle rotation target detection model based on the improved YOLOv5 for testing, and the test results were obtained.

5. The aerial vehicle rotation target detection method based on improved YOLOv5 according to claim 4, characterized in that, The evaluation of whether the performance of the trained aerial vehicle rotation target detection model based on the improved YOLOv5 meets the requirements of practical applications, based on the test results, includes: Based on the test results, the trained aerial vehicle rotation target detection model based on the improved YOLOv5 was evaluated using precision, recall, and average accuracy.

6. The aerial vehicle rotation target detection method based on improved YOLOv5 according to claim 3, characterized in that, Bounding box loss function for: in, The intersection-union ratio (IUU) of the predicted bounding box and the ground truth bounding box. The parameter representing the prediction center, The parameter representing the center of the true target bounding box. It is the square of the distance between the two center points. and Aspect ratio, and These represent the width and height of the prediction box, respectively. and These represent the width and height of the actual bounding box, respectively. It's a 180° arc. It is the arctangent function; Confidence loss function for: in, Indicates the number of grid cells. This represents the number of anchors in each grid cell. This indicates whether a target exists in the j-th anchor of the i-th grid. If a target exists, It is 1 if it is true, otherwise it is 0. Represents the actual value. Indicates the predicted value. Indicates the constraint coefficient; Category loss function for: in, Indicates the number of grid cells. This indicates whether a target exists in the j-th anchor of the i-th grid. If a target exists, It is 1 if it is true, otherwise it is 0. Represents the true class probability. Indicates the predicted category probability; Angle classification loss function for: in, It's a window function. It is the radius of the window function. It is the angle of the bounding box; The number of samples; A total of 180 categories; It is the sigmoid function; To predict the first The first sample The probability of each angle. The maximum value is 1, which is the predicted value; For the first One sample in The expression below The labels from each angle represent the true values. The maximum value is 1; according to the first The predicted and actual values ​​of each sample from various angles are sequentially passed through... Calculate, the first The summation of 180 angle results for each sample yielded the following result. ,Will The angle loss is obtained by averaging the calculation results of each sample.

7. The aerial vehicle rotation target detection method based on improved YOLOv5 according to claim 1, characterized in that, The ASFF mechanism adaptively fuses feature maps from the Cheap Backbone Network and Cheap Neck Network, and regenerates feature maps at three different scales using the following formulas: in, , For the first Feature maps output after layer fusion Representing the The weight matrix of the layer, These are constraints; Representing the first The feature map is obtained by adjusting the size and number of channels of the other two layers based on the first layer.