An improved YOLOv8-based unmanned aerial vehicle aerial small target detection method
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2026-08-11
AI Technical Summary
YOLO系列前沿算法具有较高的实时性和较快的检测速度,适合无人机航拍小目标的实时检测,但将YOLO系列前沿版本YOLOv8应用于无人机航拍小目标检测仍然存在检测精度不高的问题
[0031](1)本发明构建的基于改进YOLOv8的无人机航拍小目标检测方法中,将SPD层和RFAConv相结合,设计了SR-Conv模块,替代原有骨干网络中的Conv模块,通过将空间维度的信息转换为深度维度并且自适应地调整网络对不同尺度目标的关注程度,提取更多的小目标特征的细粒度信息。
Smart Images

Figure CN119152390B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer vision target detection technology, specifically relating to a drone aerial target detection method based on an improved YOLOv8 algorithm. Background Technology
[0002] Unmanned aerial vehicles (UAVs) are automatic or semi-automatic aircraft controlled by remote or ground control systems. They offer advantages such as low cost, high maneuverability, portability, multiple perspectives, and small size, enabling them to perform tasks such as terrain surveying, power line inspection, urban patrol, and emergency rescue. However, due to the altitude limitations of UAVs and the fact that they are typically used for aerial photography in large-scale scenarios, UAV aerial images often suffer from problems such as a large number of small target instances, complex backgrounds, and unclear features, thus affecting target detection performance. Therefore, UAV target detection technology has become a research hotspot for experts and scholars both domestically and internationally.
[0003] Object detection involves using detection algorithms to extract features from regions in an input image that may contain objects, and then outputting the detection results using a pre-trained classifier. Traditional object detection algorithms employ a sliding window strategy to select candidate regions on a given image, extract features from these regions, and finally classify them using a trained classifier. This method suffers from drawbacks such as weak region selection specificity, high time complexity, and poor robustness. With the continuous development of deep learning, deep learning-based object detection algorithms have become mainstream. Currently, deep learning-based object detection algorithms can be divided into two categories: single-stage and two-stage. Single-stage object detection algorithms directly detect objects on the input image and output the detection boxes and categories, thus offering faster detection speeds and suitability for real-time applications. Common single-stage object detection algorithms include SSD and the YOLO series. Two-stage object detection algorithms first generate a series of candidate boxes based on the input image, and then extract features and classify these candidate boxes. They offer higher detection accuracy but require higher computational resources. Common two-stage object detection algorithms include the R-CNN series.
[0004] With continuous improvements to the YOLO series algorithms, their detection accuracy has reached or even surpassed that of two-stage algorithms. The YOLO series of cutting-edge algorithms has high real-time performance and fast detection speed, making it suitable for real-time detection of small targets in UAV aerial photography. However, applying the cutting-edge version YOLOv8 to UAV aerial target detection still suffers from low detection accuracy. Summary of the Invention
[0005] In order to overcome the problems existing in the prior art, the purpose of this invention is to provide a method, system, device and medium for small target detection in UAV aerial photography based on improved YOLOv8, so as to improve the accuracy of small target detection in UAV aerial photography and ensure that UAV can successfully complete various tasks.
[0006] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0007] Firstly, a method for detecting small targets in UAV aerial photography based on an improved YOLOv8 is provided, including the following steps:
[0008] Step 1: Obtain the drone aerial image dataset;
[0009] Step 2: Convert the format of the acquired drone aerial image dataset and divide it into training set, validation set and test set;
[0010] Step 3: Construct an improved YOLOv8 small target detection network for drone aerial photography. This network improves the backbone network, neck network, and loss function of the YOLOv8 network.
[0011] Step 4: Using the improved YOLOv8 drone aerial small target detection network as the detection model, train and validate the detection model using the training set and validation set to obtain the final detection model;
[0012] Step 5: Using the final detection model, and taking drone aerial images as input, test the improved YOLOv8 drone aerial small target detection model.
[0013] Preferably, in step 1, the drone aerial photography dataset is the VisDrone dataset, which is the VisDrone2019-DET aerial photography dataset downloaded from the official website.
[0014] Preferably, in step 2, the drone aerial photography dataset file is converted into a YOLO sequence txt file, and the VisDrone2019-DET aerial photography dataset is divided into a training set, a validation set, and a test set.
[0015] Preferably, step 3 includes:
[0016] The YOLOv8 model was chosen as the basis for improvement. The improvements to the YOLOv8 model are in four aspects: designing the SR-Conv module to improve the backbone network, adding a small object detection layer, introducing a bidirectional feature pyramid network (BiFPN) to improve the neck network, and introducing a normalized weighted distance (NWD) loss function to optimize the loss function.
[0017] The SR-Conv module was designed to improve the backbone network: the original YOLOv8 backbone network suffers from a certain degree of fine-grained information loss during convolution and pooling operations. To reduce the false positive and false negative rates of small targets in UAV images, the Space-to-Depth (SPD) layer and Receptive Field Attention Convolution (RFAConv) were combined, and the SR-Conv module was designed to replace the standard convolutional modules (Conv) in layers 1, 3, 5, and 7 of the original backbone network. First, the SPD layer maps the spatial dimension of the input feature map to the channel dimension while preserving the information within each channel, avoiding information loss in traditional methods. After the SPD layer, RFAConv is used for further feature extraction. RFAConv introduces the Receptive Field Attention (RFA) mechanism to solve the problem of convolutional kernel parameter sharing and fully considers the importance of each feature in the receptive field in the global context. It can adaptively adjust the network's attention to targets of different scales, thereby improving the detection performance of small and dense targets. The SR-Conv module combines the SPD layer's ability to retain all information in the channel dimension with RFAConv's ability to adaptively adjust the network's attention to targets of different scales, replacing the Conv module in the original backbone network, thereby extracting more fine-grained information about small target features.
[0018] Adding a small object detection layer: The feature fusion of the original YOLOv8 network usually starts from the third layer, introducing feature maps of three different scales into the neck network for fusion to form three prediction heads. To improve the ability to detect small objects, a small object detection layer is added, which fuses the second layer features into the feature fusion network, retains more shallow semantic information, and forms a fourth prediction head for dealing with small objects;
[0019] This invention improves the neck network by introducing BiFPN: The original YOLOv8 neck layer, inspired by PANet, uses a dual feature pyramid structure of FPN+PAN to fuse features at different scales. However, the input features in the PAN network are processed by the FPN network, which leads to the loss of original features and low feature fusion efficiency. This invention improves the feature fusion method of the neck network by using BiFPN, which better utilizes the original feature information and enhances the ability to extract small-scale target features.
[0020] The NWD loss function is introduced to optimize the loss function: The YOLOv8 algorithm uses the CIoU bounding box regression loss function, which is based on the traditional Intersection over Union (IoU) metric. This has certain limitations, being highly sensitive to label positional deviations of small targets and exhibiting significant differences in sensitivity across different target scales. To improve the network's performance in detecting small targets, the NWD loss function is introduced and combined with the CIoU loss function to optimize the overall loss function. NWD possesses scale invariance and smoothness against positional deviations in detecting small objects, and it has the ability to measure the similarity between non-overlapping or mutually containing bounding boxes, capturing more details and spatial information, effectively improving the performance of aerial target detection algorithms.
[0021] Preferably, in step 4, the improved YOLOv8 drone aerial image target detection network is used as the target detection model. The training set of VisDrone DET is input into the improved YOLOv8 drone aerial image target detection network for training. The validation set data is used to monitor whether the model is overfitting until the loss curve converges, thus completing the training of the model and obtaining the final improved YOLOv8 drone aerial image target detection model.
[0022] Preferably, in step 5, the trained model weight file is input into the test set of the VisDrone dataset. The model will then outline and label the detected targets on the output image to obtain the actual recognition result of the targets in the drone aerial image.
[0023] Secondly, this invention provides a small target detection system for UAV aerial photography based on an improved YOLOv8 algorithm, comprising:
[0024] Dataset processing module: configured to acquire drone aerial image datasets, preprocess the drone aerial image datasets to obtain training set, validation set and test set;
[0025] Network building module: configured to build a small target detection model for UAV aerial photography based on the improved YOLOv8 algorithm;
[0026] The network training module is used to train the UAV aerial small target detection model based on the improved YOLOv8 algorithm using the training set according to the set network training parameters. After training, it outputs the training weight file. The training weight file is validated using the validation set, and the training weight file with the highest accuracy is selected as the optimal weight file, resulting in the trained UAV aerial small target detection model based on the improved YOLOv8 algorithm.
[0027] The target detection module is used to input the test set and the obtained optimal weight file into the trained UAV aerial photography small target detection model based on the improved YOLOv8 algorithm to perform target detection and obtain the target detection results.
[0028] The present invention also provides an electronic device, including a memory and one or more processors, wherein the memory is used to store one or more programs; when the one or more programs are executed by the one or more processors, they implement a method for detecting small targets in UAV aerial photography based on an improved YOLOv8.
[0029] The present invention also provides a computer storage medium storing a computer program thereon, wherein the computer program, when executed by a processor, implements the steps of a UAV aerial photography small target detection method based on an improved YOLOv8.
[0030] Compared with the prior art, the present invention has the following beneficial effects:
[0031] (1) In the UAV aerial photography small target detection method based on improved YOLOv8 constructed in this invention, the SPD layer and RFAConv are combined to design the SR-Conv module, which replaces the Conv module in the original backbone network. By converting the spatial dimension information into the depth dimension and adaptively adjusting the network’s attention to targets of different scales, more fine-grained information of small target features is extracted.
[0032] (2) This invention introduces a small target detection layer and a BiFPN network into the YOLOv8 network to improve the neck network and enhance the feature extraction and feature fusion capabilities for small targets.
[0033] (3) This invention introduces the NWD loss function into the YOLOv8 network and combines it with the CIoU loss function as the localization regression loss function to enhance the model’s sensitivity to small targets.
[0034] In summary, this invention first combines the SPD layer and RFAConv to design the SR-Conv module, replacing the original Conv module in the backbone network. This module extracts more fine-grained information about small target features by converting spatial dimension information into depth dimension and adaptively adjusting the network's focus on targets of different scales. Second, a small target detection layer and a BiFPN network are introduced to improve the neck network, enhancing the feature extraction and fusion capabilities for small targets. Finally, the NWD loss function is introduced and combined with the CIoU loss function as a localization regression loss function, strengthening the model's sensitivity to small targets. This method is better suited for small target detection tasks in UAV aerial photography, improving the accuracy of small target detection in UAV aerial photography, and has broad applicability. Attached Figure Description
[0035] Figure 1 This is the overall flowchart of the present invention.
[0036] Figure 2 The overall structure diagram of the improved YOLOv8 network designed for embodiments of the present invention;
[0037] Figure 3 This is a diagram of the SPD layer structure.
[0038] Figure 4 Here is a structural diagram of RFAConv;
[0039] Figure 5 This is a comparison chart of PANet and BiFPN. Detailed Implementation
[0040] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0041] Firstly, this example provides a method for small target detection in UAV aerial photography based on an improved YOLOv8, with the specific implementation steps as follows: Figure 1 As shown, it includes:
[0042] Step 1: Obtain the drone aerial image dataset;
[0043] Step 2: Convert the format of the acquired drone aerial image dataset and divide it into training set, validation set and test set;
[0044] Step 3: Construct an improved YOLOv8 small target detection network for drone aerial photography. This network improves the backbone network, neck network, and loss function of the YOLOv8 network.
[0045] Step 4: Using the improved YOLOv8 drone aerial small target detection network as the detection model, train and validate the monitoring model using the training set and validation set to obtain the final detection model;
[0046] Step 5: Using the final detection model and drone aerial images as input, test the improved YOLOv8 drone aerial small target detection network.
[0047] In this embodiment, step 1 specifically includes:
[0048] This invention uses the VisDrone 2019 DET aerial photography dataset downloaded from the official website. This dataset contains pre-labeled files and a total of 10 classes, including pedestrians, people, bicycles, cars, vans, trucks, tricycles, awning tricycles, buses, and cars. The training images are all uniformly sized at 640×640. Simultaneously, image detection and processing are performed, including the removal of images with blurred small targets or indistinct feature points.
[0049] In this embodiment, step 2 specifically includes:
[0050] First, the labeled VisDrone2019 DET dataset file is converted into a YOLO sequence txt file using a Python script. Then, the VisDrone2019DET aerial dataset is randomly divided into training, validation, and test sets to prepare for subsequent training and testing.
[0051] In this embodiment, step 3 specifically includes:
[0052] The YOLOv8 model was chosen as the base for improvement. The improvements to the YOLOv8 model are in four aspects: designing the SR-Conv module to improve the backbone network, adding a small object detection layer, introducing a BiFPN network to improve the neck network, and introducing the NWD loss function to optimize the loss function. The improved YOLOv8 model structure diagram is shown below. Figure 2 .
[0053] Furthermore, the SR-Conv module is designed to improve the backbone network:
[0054] The original YOLOv8 backbone network suffers from a certain degree of fine-grained information loss during convolution and pooling operations. To reduce the false positive and false negative rates of small targets in UAV images, a new SR-Conv module was designed to replace the standard convolutional modules (Conv) in layers 1, 3, 5, and 7 of the original backbone network. The SR-Conv module combines the ability of the SPD layer to retain all information in the channel dimension with the ability of RFAConv to adaptively adjust the network's attention to targets of different scales, thus extracting more fine-grained information about small target features.
[0055] First, the SPD layer maps the spatial dimension of the input feature map to the channel dimension while preserving the information within each channel, thus avoiding information loss in traditional methods. Assuming a general input image X of size S×S×C1, each step involves cutting it into a series of sub-feature sequences as shown in formulas (1) to (3):
[0056]
[0057] Generally, given any (original) feature map X, a subgraph consists of all terms, where terms are proportionally separable. Therefore, each subgraph is downsampled to X by a scaling factor. Figure 3 (a) and (b) provide an example when scale = 2, which produces 4 subgraphs, each with a shape of... Downsample X by a factor of 2. Then, concatenate these sub-feature maps along the channel dimension to obtain, as shown below. Figure 3 (c) shows the feature map. The SPD layer transforms the feature map X(S,S,C1) into... Feature map.
[0058] Following the SPD layer, RFAConv is used for further feature extraction. RFAConv introduces a receptive field attention mechanism (RFA) to solve the problem of kernel parameter sharing and fully considers the global importance of each feature within the receptive field. It can adaptively adjust the network's attention to targets of different scales, thereby improving the detection performance of small and dense targets. The structure diagram of RFAConv is shown below. Figure 4 As shown. Suppose there is a general input image of size C×H×W. To improve network performance, interactive receptive field feature information is used. At the same time, to minimize the amount of computation and parameters, average pooling is used to aggregate the global information of the receptive field features of the first branch, and information is passed through 1x1 group convolution. Finally, an attention map of size 9C×H×W is obtained through the Softmax activation function. Normalization is performed on the other branch using 3×3 group convolution, and nonlinear conditions are provided for it through the ReLU activation function. Finally, a receptive field spatial feature of size 9C×H×W is obtained. The feature maps of the two branches are multiplied to reshape the weights, aggregate the correlation information from different processing channels, and obtain a non-overlapping receptive field spatial feature map of size C×3H×3W after shape adjustment. Finally, the length and width of the feature map are shaped by convolution to keep it the same size as the input. The specific calculation process is shown in formula (4):
[0059]
[0060] Where s represents the kernel size, g (1×1) This represents a 1×1 group convolution, Norm is normalization, AvgPool is average pooling, ReLU and Softmax are activation functions, X represents the input feature map, and RFA is the transformed receptive field space feature F. rfa And attention map Arfa Multiply them to get the result.
[0061] Furthermore, a small target detection layer is added:
[0062] The original YOLOv8 network incorporates three feature maps of different scales into the neck network for fusion, forming three detection heads. When the input image resolution is 640×640, the original YOLOv8 algorithm downsamples the input image by 8x, 16x, and 32x respectively, generating predicted feature maps of 80×80, 40×40, and 20×20, used to detect targets larger than 8×8, 16×16, and 32×32. The original YOLOv8 performs multiple downsampling operations, resulting in very sparse target information in the feature maps, making it difficult for deeper feature maps to learn the feature information of small targets. This invention, while maintaining the scale of other feature maps, introduces a new 160×160 small target detection layer on top of the original three detection layers, forming four detection heads to better acquire the category and location information of small targets.
[0063] Furthermore, a BiFPN structure is introduced to improve the neck network.
[0064] The original YOLOv8 neck layer, inspired by PANet, employs a dual feature pyramid structure of FPN+PAN to fuse features at different scales. However, the input features in the PAN network are processed by the FPN network, leading to the loss of original features and resulting in low feature fusion efficiency. This invention improves the feature fusion method of the neck network using a BiFPN network, better utilizing original feature information and enhancing the ability to extract features from small-scale targets.
[0065] Compared to PANet, the BiFPN network combines downsampling and upsampling paths, preserving more contextual information through feature information transfer in two directions, thus enhancing the efficiency of feature information transfer and improving the feature representation capability of small-scale targets. BiFPN removes edge nodes with weak feature fusion capabilities, enabling cross-scale interaction of features at different levels and improving the feature extraction capability for small-scale targets. A comparison of PANet and BiFPN is shown below. Figure 5 As shown.
[0066] Since different features have different resolutions, their output contributions are also different. The BiFPN network uses weighted feature fusion to add an extra weight to each feature, so that the network continuously adjusts the weights. The weights are normalized to the range [0,1] by dividing by the sum of all the weights, which improves the computation speed and can better control the contribution of features at different scales. The weighted feature fusion calculation method is shown in Equation (5):
[0067]
[0068] Where, ω i and ω j represents the weights of the feature maps at layers i and j, respectively, which determine the contribution of the feature maps at layers i and j during the fusion process. i Represents the input features, ε = 10 -4 This is used to avoid numerical instability.
[0069] Furthermore, the NWD loss function is optimized.
[0070] Intersection over Union (IoU) is a commonly used metric for evaluating the performance of object detection algorithms. It measures the degree of overlap between the detected results and the ground truth labels. The YOLOv8 algorithm uses the CIoU bounding box regression loss function, which is based on the traditional IoU metric. This has certain limitations, being highly sensitive to label position deviations of small targets and exhibiting significant differences in sensitivity across different target scales. To improve the network's detection performance for small targets, the Non-Wide Wrap (NWD) loss function is introduced and combined with the CIoU loss function to optimize the overall loss function.
[0071] NWD is a normalized Gaussian distance metric based on Wasserstein distance. It uses a two-dimensional Gaussian distribution to model the bounding boxes of targets and calculates the similarity between predicted and real targets by the similarity of their corresponding Gaussian distributions. For detected targets, regardless of whether they overlap, the similarity can be measured by the distribution similarity. The calculation method of NWD is shown in Equation (6):
[0072]
[0073] Where C is a constant closely related to the dataset. It is a distance measure, calculated as shown in formula (7):
[0074]
[0075] N a and N b It is composed of the real box A = (cx a ,cy a ,w a ,h a ) and prediction box B = (cx b ,cy b ,w b ,h b The model uses a Gaussian distribution, where cx is the horizontal coordinate of the center point, cy is the vertical coordinate of the center point, w is the width, h is the height, and T is the transpose. a and cx bcy represents the horizontal coordinates of the center points of ground truth bounding boxes A and B, respectively. a and cy b These are the vertical coordinates of the center points of ground truth boxes A and B, respectively. a and w b Here, h represents the width of the ground truth bounding box A and the width of the ground truth bounding box, respectively. a and h b Let A and B be the heights of the real bounding boxes.
[0076] Compared to CIoU, NWD can capture more details and spatial information, making it more suitable for measuring the similarity between small targets. However, directly replacing CIoU with NWD, while improving the detection accuracy of small and tiny targets, will significantly reduce the convergence speed of the network, resulting in a huge time cost. Therefore, this invention retains CIoU and combines CIoU and NWD with a certain weight ratio. Its complete position loss function Loss is shown in Equation (8):
[0077] Loss=α1×CIoU+α2×NWD (8)
[0078] Where CIoU is the CIoU loss function, NWD is the NWD loss function, and α1 and α2 are the weight parameters of CIoU and NWD, respectively, with a sum of 1. By adjusting α1 and α2, different similarity calculation methods are obtained to adapt to different application scenarios and task requirements. In this embodiment, both α1 and α2 are set to 0.5, and the introduction of NWD fully compensates for the shortcomings of CIoU in small target detection, improving the model's detection accuracy for small targets.
[0079] In this embodiment, step 4 specifically includes:
[0080] Input the VisDrone training set from step 2 into the configured network environment, and train on the VisDrone dataset training set until the loss curve converges. Simultaneously, use the precision, recall, and mean average precision (mAP) on the validation set as metrics to evaluate model performance.
[0081] Precision P represents the proportion of true positives among all samples predicted as positive by the model. Recall R represents the proportion of true positives successfully predicted as positive by the model among all actual positive samples. P and R are calculated as shown in formulas (9) and (10):
[0082]
[0083] Where TP indicates correct classification; FP indicates that a negative sample is predicted as a positive sample; FN indicates that a positive sample is predicted as a negative sample; and TN indicates that a negative sample is predicted as a negative sample.
[0084] With P as the ordinate and R as the abscissa, the area enclosed by the PR curve and the coordinate axis is the average precision (AP). The average AP of each target category in the same dataset is called mAP, and mAP is calculated as shown in formula (11):
[0085]
[0086] Where r represents the r-th type of target being detected.
[0087] In this embodiment, step 5 specifically includes:
[0088] Import the weight file obtained from step 4 into the detection program, add the prepared test set data path to the program, and run the program to obtain the actual detection effect of the improved YOLOv8 model for drone aerial targets.
[0089] Secondly, this example also provides a small target detection system for UAV aerial photography based on an improved YOLOv8 algorithm, including:
[0090] Dataset processing module: used to obtain the drone aerial image dataset in steps 1-2; preprocess the drone aerial image dataset to obtain the training set, validation set and test set;
[0091] Network building module: used to implement the construction of the UAV aerial photography small target detection model based on the improved YOLOv8 algorithm in step 3;
[0092] The network training module is used to implement the network training parameters set in step 3 in step 4, and to train the UAV aerial small target detection model based on the improved YOLOv8 algorithm using the training set. After training, the training weight file is output. The training weight file is validated by the validation set, and the training weight file with the highest accuracy is selected as the optimal weight file to obtain the trained UAV aerial small target detection model based on the improved YOLOv8 algorithm.
[0093] Target recognition module: This module is used to input the test set and the obtained optimal weight file into the trained UAV aerial photography small target detection model based on the improved YOLOv8 algorithm in step 5 to perform target detection and obtain the target detection results.
[0094] Thirdly, this example also provides an electronic device, including a memory and one or more processors, wherein the memory is used to store one or more programs; when the one or more programs are executed by the one or more processors, they implement a UAV aerial photography small target detection method based on improved YOLOv8.
[0095] Fourthly, this example also provides a computer storage medium storing a computer program that, when executed by a processor, implements the steps of a UAV aerial photography small target detection method based on the improved YOLOv8.
[0096] The above-described embodiments further illustrate the purpose, technical solution, and advantages of the present invention. It should be understood that the above-described embodiments are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made to the present invention within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for detecting small targets in UAV aerial photography based on an improved YOLOv8, characterized in that, Includes the following steps: Step 1: Obtain the drone aerial image dataset; Step 2: Convert the format of the acquired drone aerial image dataset and divide it into training set, validation set and test set; Step 3: Construct an improved YOLOv8 small target detection network for drone aerial photography. This network improves the backbone network, neck network, and loss function of the YOLOv8 network. Step 4: Using the improved YOLOv8 drone aerial small target detection network as the detection model, train and validate the detection model using the training set and validation set to obtain the final detection model; Step 5: Using the final detection model and drone aerial images as input, test the improved YOLOv8 drone aerial small target detection network. Step 3 specifically involves: selecting the YOLOv8 network as the basis for improvement. The improvement of the YOLOv8 network is in four aspects: designing the SR-Conv module to improve the backbone network, adding a small target detection layer, introducing the Bi-FPN bidirectional feature pyramid network to improve the neck network, and introducing the normalized weighted distance (NWD) loss function to optimize the loss function. The SR-Conv module is designed to improve the backbone network. Specifically, it combines the spatial-to-depth (SPD) layer and the receptive field attention convolution (RFAConv) to replace the standard Conv convolutional modules (layers 1, 3, 5, and 7) in the original backbone network. First, the SPD layer maps the spatial dimension of the input feature map to the channel dimension while preserving information within each channel. Following the SPD layer, RFAConv is used for further feature extraction. RFAConv introduces the receptive field attention mechanism (RFA) to solve the problem of convolutional kernel parameter sharing and fully considers the global importance of each feature in the receptive field, adaptively adjusting the network's attention to targets at different scales, thereby improving the detection performance of small and dense targets. The SR-Conv module combines the SPD layer's ability to preserve all information in the channel dimension with RFAConv's ability to adaptively adjust the network's attention to targets at different scales, replacing the Conv modules in the original backbone network, thus extracting more fine-grained information about small target features. Add a small target detection layer, specifically: add a small target detection layer, fuse the features of the second layer into the feature fusion network, retain more shallow semantic information, and form a fourth prediction head for dealing with small targets; BiFPN is introduced to improve the neck network. Specifically, BiFPN is used to improve the feature fusion method of the neck network, so as to better utilize the original feature information and enhance the ability to extract small-scale target features. The loss function is optimized by introducing the NWD loss function. Specifically, the NWD loss function is introduced and combined with the CIoU loss function to optimize the loss function. NWD has scale invariance and smoothness to positional deviation in detecting small objects, and it has the ability to measure the similarity between non-overlapping or mutually contained bounding boxes. It can capture more details and spatial information, thereby improving the performance of aerial target detection algorithms.
2. The method for detecting small targets in UAV aerial photography based on improved YOLOv8 according to claim 1, characterized in that, In step 1, the drone aerial photography dataset is the VisDrone dataset, specifically the publicly available VisDrone2019-DET aerial photography dataset.
3. The method for detecting small targets in UAV aerial photography based on improved YOLOv8 according to claim 2, characterized in that, In step 2, the drone aerial image dataset file is converted into a YOLO sequence txt file, and the VisDrone2019-DET aerial dataset is divided into training set, validation set, and test set.
4. The method for detecting small targets in UAV aerial photography based on improved YOLOv8 according to claim 1, characterized in that, In step 4, the improved YOLOv8 drone aerial image target detection network is used as the target detection model. The training set of VisDrone DET is input into the improved YOLOv8 drone aerial image target detection network for training. The validation set data is used to monitor whether the model is overfitting until the loss curve converges, thus completing the training of the model and obtaining the final improved YOLOv8 drone aerial image target detection model.
5. The method for detecting small targets in UAV aerial photography based on improved YOLOv8 according to claim 1, characterized in that, In step 5, the trained model weight file is input into the test set of the VisDrone dataset. The model will then outline and label the detected targets on the output image, thus obtaining the actual recognition result of the targets in the drone aerial image.
6. A small target detection system for UAV aerial photography based on an improved YOLOv8 algorithm, characterized in that, include: Dataset processing module: configured to acquire drone aerial image datasets, preprocess the drone aerial image datasets to obtain training set, validation set and test set; Network building block: Configured to build an improved YOLOv8 model for small target detection in drone aerial photography; The network training module is used to train the improved YOLOv8 drone aerial small target detection model using the training set according to the set network training parameters. After training, it outputs the training weight file. The training weight file is validated by the validation set, and the training weight file with the highest accuracy is selected as the optimal weight file to obtain the trained improved YOLOv8 drone aerial small target detection model. The target detection module is used to input the test set and the obtained optimal weight file into the trained improved YOLOv8 drone aerial small target detection model to perform target detection and obtain the target detection results. The YOLOv8 network was chosen as the basis for improvement. The improvements to the YOLOv8 network are in four aspects: designing the SR-Conv module to improve the backbone network, adding a small target detection layer, introducing the Bi-FPN bidirectional feature pyramid network to improve the neck network, and introducing the normalized weighted distance (NWD) loss function to optimize the loss function. The SR-Conv module is designed to improve the backbone network. Specifically, it combines the spatial-to-depth (SPD) layer and the receptive field attention convolution (RFAConv) to replace the standard Conv convolutional modules (layers 1, 3, 5, and 7) in the original backbone network. First, the SPD layer maps the spatial dimension of the input feature map to the channel dimension while preserving information within each channel. Following the SPD layer, RFAConv is used for further feature extraction. RFAConv introduces the receptive field attention mechanism (RFA) to solve the problem of convolutional kernel parameter sharing and fully considers the global importance of each feature in the receptive field, adaptively adjusting the network's attention to targets at different scales, thereby improving the detection performance of small and dense targets. The SR-Conv module combines the SPD layer's ability to preserve all information in the channel dimension with RFAConv's ability to adaptively adjust the network's attention to targets at different scales, replacing the Conv modules in the original backbone network, thus extracting more fine-grained information about small target features. Add a small target detection layer, specifically: add a small target detection layer, fuse the features of the second layer into the feature fusion network, retain more shallow semantic information, and form a fourth prediction head for dealing with small targets; BiFPN is introduced to improve the neck network. Specifically, BiFPN is used to improve the feature fusion method of the neck network, so as to better utilize the original feature information and enhance the ability to extract small-scale target features. The loss function is optimized by introducing the NWD loss function. Specifically, the NWD loss function is introduced and combined with the CIoU loss function to optimize the loss function. NWD has scale invariance and smoothness to positional deviation in detecting small objects, and it has the ability to measure the similarity between non-overlapping or mutually contained bounding boxes. It can capture more details and spatial information, thereby improving the performance of aerial target detection algorithms.
7. An electronic device, characterized in that, The method includes a memory and one or more processors, the memory being used to store one or more programs; when the one or more programs are executed by the one or more processors, they implement the method as described in any one of claims 1 to 5.
8. A computer storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the steps of the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Unmanned aerial vehicle aerial photography small target detection method based on improved YOLOv8s algorithm and electronic equipment
CN118230194A