Small target detection method based on improved YOLOv8n aerial photography visual angle

By introducing CRConv, Triplet Attention, and Dyhead detection heads into the YOLOv8n network and optimizing the model structure, the challenge of small target detection in UAV aerial images was solved, and more efficient target detection results were achieved.

CN120953846APending Publication Date: 2025-11-14XIDIAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511069204.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-31
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

Small target detection in UAV aerial images faces challenges such as small target size, complex background, and limited computing resources. Existing improved methods increase the number of model parameters and computational complexity, affecting real-time processing capabilities.

Method used

The CRConv convolutional module is introduced into the YOLOv8n network to enhance feature extraction capabilities; the Triplet Attention mechanism is introduced to capture cross-dimensional interactions; the Dyhead detection head is used to fuse multi-scale features; and a small object detection head is added to optimize the model structure.

Benefits of technology

It improves the accuracy and real-time performance of small target detection, enhances the model's detection capability in complex backgrounds, reduces feature loss of small targets, and improves detection performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120953846A_ABST
    Figure CN120953846A_ABST
Patent Text Reader

Abstract

The invention discloses a small target detection method based on an improved YOLOv8n aerial photography visual angle. The method comprises the following steps of: 1, performing image preprocessing by using an image data set acquired by aerial photography of an unmanned aerial vehicle; step 2, introducing the convolution after the C2f is improved into the YOLOv8n backbone network to form an improved YOLOv8n backbone network, and outputting a tensor; step 3, Triplet Attention attention is introduced into the feature fusion network; processing the tensor to form a comprehensive attention map; step 4, introducing a Dyhead detection head into the YOLOv8n backbone network to carry out dynamic adjustment feature mapping on the comprehensive attention map, and integrating context information; step 5, the improved YOLOv8n network is optimized, and a small target detection head with a higher resolution ratio is added; and step 6, training the improved network model by using the training set, completing model optimization and parameter adjustment, and finally obtaining a high-performance detection model suitable for small target detection in an aerial photography view angle, thereby realizing small target detection. According to the invention, the loss of the small target is reduced, and detection of the small target is facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of target detection technology, specifically relating to a small target detection method based on an improved YOLOv8n aerial photography perspective. Background Technology

[0002] With the rapid development and maturation of artificial intelligence, object detection technology has been widely applied in real life, such as in autonomous driving, traffic monitoring, facial recognition, and industrial manufacturing. Due to the continuous updates and iterations of computing power and deep learning-based object detection algorithms, deep learning-based aerial image object detection algorithms have become a research hotspot in the field of object detection.

[0003] With continuous technological advancements, UAV aerial photography technology has become increasingly mature, resulting in higher spatial resolution and richer detail in aerial images. This lays a solid foundation for research on small target detection, multi-scale target detection, and target detection in complex scenes. The combination of UAV aerial photography and target detection technologies can effectively promote human-machine collaborative operations, possessing extremely high application value and becoming an important research topic in the field of UAV applications.

[0004] Because aerial images differ significantly from general object detection datasets, they are characterized by a higher proportion of small targets, large differences in target size, and similarity between background and target information. Therefore, small target detection in UAV aerial photography faces several challenges: First, UAVs are positioned far from the ground, resulting in small targets and insufficient feature information; second, UAV scenes are varied and have complex backgrounds, leading to target-background aliasing; finally, UAVs are small and have limited computing resources, while traditional object detection algorithms have large and complex models with numerous parameters, failing to meet the requirements for lightweight and real-time deployment.

[0005] The YOLO series is currently the mainstream real-time object detector, characterized by its high efficiency in real-time detection and simple model structure. As a single-stage detection algorithm, the YOLO series surpasses some two-stage detection algorithms in object detection accuracy.

[0006] Many researchers have proposed methods for small target detection using drones, but several challenges remain.

[0007] Existing research mainly focuses on improvements in network architecture, feature extraction enhancement, the introduction of attention mechanisms, and loss function design. However, while these optimization methods improve detection performance, they also introduce problems such as increased model parameters and computational complexity. This not only places higher demands on computing hardware but also severely impacts the real-time processing capabilities of algorithms on resource-constrained platforms. Summary of the Invention

[0008] To overcome the shortcomings of the existing technologies, the present invention aims to provide a small target detection method based on an improved YOLOv8n aerial perspective. By redesigning the C2f convolutional module in the backbone network, features can be extracted more accurately, thereby reducing feature loss of small targets. In addition, the present invention introduces a new method to calculate attention weights by using a three-branch structure to capture cross-dimensional interactions, thereby enhancing the context awareness and region contrast capabilities of small target detection. The present invention replaces the original target detection head with a Dyhead detection head to compensate for the deficiency of single-scale detection in easily missing small targets. Finally, a new small target detection head is added to optimize the model structure.

[0009] To achieve the above objectives, the technical solution adopted by the present invention is as follows:

[0010] A method for small target detection based on an improved YOLOv8n aerial view includes the following steps;

[0011] Step 1, Data Preprocessing:

[0012] Image preprocessing was performed on the image dataset collected by drone aerial photography, and the processed dataset was divided into training set, validation set and test set.

[0013] Step 2, introduce CRConv convolution:

[0014] An improved C2f convolution is introduced into the YOLOv8n backbone network to form an improved YOLOv8n backbone network, which outputs tensors.

[0015] Step 3, Introduce an attention mechanism:

[0016] Triplet Attention is introduced into the feature fusion network; the tensor is processed to form a comprehensive attention map;

[0017] Step 4, introduce the Dyhead detection head:

[0018] The Dyhead detection head is introduced to dynamically adjust the feature mapping of the comprehensive attention map and integrate contextual information.

[0019] Step 5: Optimize the improved YOLOv8n network from the above steps by adding a small target detection head with higher resolution;

[0020] Step 6: Use the training set divided in Step 1 to train the improved network model in Step 5, complete the model optimization and parameter adjustment, and finally obtain a high-performance detection model suitable for small target detection from an aerial perspective, thus realizing small target detection.

[0021] The specific process of data preprocessing in step 1 is as follows:

[0022] Acquire the image dataset obtained from drone aerial photography. The dataset is in YOLO format. Adjust the images to a set size of 640×640 and convert them to tensor format. Adjust the bounding box coordinates.

[0023] The specific process of introducing CRConv convolution in step 2 is as follows:

[0024] Improvements were made to the C2f module in the YOLOv8n network;

[0025] The receptive field attention convolution RFAConv is used to replace the second Conv convolution in Bottleneck. The C2f module is improved to form the CRConv module, which strengthens the key region and extracts features more accurately, thereby reducing the feature loss of small targets. RFAConv is divided into two branches. The input features are extracted through the 1×1 branch and the k×k branch, which respectively form the attention map and the receptive field space features.

[0026] The input features converted to tensor format in step 1 are subjected to average pooling to obtain global information; the average pooled features are subjected to 1×1 grouped convolution, and the features after 1×1 grouped convolution are linearly combined; the features after 1×1 grouped convolution are subjected to softmax to generate attention maps for each receptive field.

[0027] Perform a k×k grouped convolution operation on the input features converted to tensor format in step 1, dividing the feature channels into three groups, and convolving each group separately to obtain a receptive field spatial feature map with an increased number of channels.

[0028] The obtained attention map and receptive field space feature map are weighted to suppress unimportant features. The weighted feature map is then shaped to form a tensor x for the next convolution operation.

[0029] RFAConv was used to replace the second Conv convolution in Bottleneck to obtain CRConv, which in turn replaced C2f in the feature extraction network. This improvement enhances the expressiveness and selectivity of Bottleneck, making the features output by C2f more accurate and globally perceptive, ultimately helping to detect small targets, complex structures, or hard-to-distinguish regions.

[0030] The specific process of introducing the attention mechanism in step 3 is as follows:

[0031] We introduce the Triplet Attention module, a novel approach to compute attention weights by capturing cross-dimensional interactions using a three-branch structure. This module captures the dependencies between the (C, H), (C, W), and (H, W) dimensions of the input tensor, respectively, thereby capturing the interaction between the spatial dimension and the channel dimension of the input tensor.

[0032] In each branch, the tensor x output by the improved backbone network in step 2 is used as the input tensor of the feature fusion network. The input tensor is rotated, Z-pooled to merge features, batch normalized, and activated by the Sigmoid function to generate attention weights, thereby obtaining the interaction results between different dimensions. Finally, the processing results of the three branches are summed and averaged to form a comprehensive attention map.

[0033] In the first branch, the Triplet Attention module establishes the interaction between the channel dimension C and the spatial dimension H. The input tensor x is rotated 90° counterclockwise along the H-axis to obtain... It then becomes through Z-pool The Z-pool layer reduces the tensor dimension W to 2 to obtain the average and maximum merged features through the tensors; the specific calculation formula is as follows:

[0034] Z-pool(x) = [MaxPool 0d (x),AvgPool 0d (x)]

[0035] In the formula 0 d Maxpool0 represents a dimension of 0. d Avgpool0 d These represent the max pooling layer and the average pooling layer, respectively.

[0036] The output is (1×H×C) through a standard convolutional layer and a normalized layer; then the tensor is passed through a sigmoid activation function to generate the final attention weights applied to x1; finally, it is rotated 90 degrees clockwise along the H axis to maintain the original input shape of the feature tensor;

[0037] The second branch process is similar to the first branch. The Triplet Attention module establishes the interaction between the channel dimension C and the spatial dimension width W; the input tensor x is rotated 90° counterclockwise along the W axis to obtain... It then becomes through Z-pool The Z-pool layer reduces the tensor dimension H to 2 to obtain average and maximum merged features from the tensor; the output is then passed through a standard convolutional layer and a normalization layer (1×C×W); the tensor is then passed through a sigmoid activation function to generate the final attention weights applied to x2. Finally, it is rotated 90 degrees clockwise along the W axis to preserve the original input shape of the feature tensor.

[0038] In the third branch, the Triplet Attention module establishes the interaction between the spatial dimension height H and the spatial dimension width W; the input tensor x is transformed through Z-pooling. The Z-pool layer reduces the tensor dimension C to 2 to obtain the average and maximum merged features through the tensor; it outputs (1×H×W) through standard convolutional layers and normalization layers; then the tensor is passed through the sigmoid activation function to generate the final attention weights applied to x3; after three branches, the triple attention feature tensor y is finally obtained, and the specific calculation formula is as follows:

[0039]

[0040] In the formula Let ψi and ψ2 represent the rotation operations of the first and second branches, respectively; let ψ1, ψ2, and ψ3 represent the convolutional layers of the three branches, respectively; and let σ() represent the sigmoid activation function. The tensor obtained from the first branch via Z-pooling. The tensor obtained from the second branch via Z-pooling. Let x be the tensor obtained from the third branch via Z-pooling, and let x be the input tensor.

[0041] The specific process of introducing the Dyhead detection head in step 4 is as follows:

[0042] The dynamic detection head DyHead is introduced into the YOLOv8n network structure improved in steps 2 and 3. DyHead is a dynamic detection head that can simultaneously fuse scale attention, spatial attention within feature maps, and task-aware attention for the detection task. It can dynamically adjust feature maps and integrate contextual information; the specific formula is shown below:

[0043] W(F) = π C (π S (π L ·F)·F)·F

[0044] F∈R L×S×C For a three-dimensional feature tensor, S = H × W is the size of the feature map, and π L π S π CThese represent scale-aware attention, spatial location-aware attention, and task-aware attention, respectively, and W(F) is a feature map that is dynamically adjusted according to F.

[0045] 4.1π L Enhanced scale perception

[0046] Using the triple attention feature tensor y output by the improved feature fusion network in step 3 as the input feature, firstly, average pooling is performed to capture global features, and then the scale is transformed by Conv 1×1 to obtain reweighted features to capture the correlation between channels; the ReLU activation function is used to enhance the expression of non-linear scale features; and the scale feature values ​​are compressed to [0,1] by Hard sigmoid to generate scale weights.

[0047] 4.2π S Enhance spatial awareness

[0048] Using the triple attention feature tensor y output by the improved feature fusion network in step 3 as the input feature, the offset index is first generated by 1×1 convolution, and then the offset index is refined by 3×3 convolution to capture local spatial features. The offset index is compressed to the [0,1] interval by the Sigmoid function to generate the dynamic offset of the sampling position of the convolution kernel. Finally, the dynamic convolution DConv dynamically adjusts the sampling position according to the offset, focuses on the key region and generates the corresponding spatial weights.

[0049] 4.3π C Enhance task awareness

[0050] Using the triple attention feature tensor y output by the improved feature fusion network in step 3 as the input feature, global features are captured through average pooling (Avg Pool). A fully connected layer (fc) is used for linear transformation to learn channel features and generate feature maps and bias terms. The ReLU activation function is used to set negative values ​​to zero, enhancing the non-linear expressive power of the features. Then, the channel features are refined through a second fully connected layer (fc) to capture more channel details. The Normalize function is used to normalize the features to make them conform to a normal distribution, thereby reducing covariate bias. Finally, the feature map is concatenated with the bias term of the second fully connected layer through the Concat operation to generate task weights.

[0051] 4.4 Integrating Scale, Space, and Task Weights

[0052] The weights generated in 4.1, 4.2, and 4.3 are fused into the original feature map to output a feature map with enhanced scale, spatial, and task awareness.

[0053] The specific process of optimizing the network in step 5 is as follows:

[0054] This invention introduces a shallower detection branch into the improved YOLOv8n network after steps 2, 3, and 4, and upsamples the 80×80 feature map to 160×160. The original YOLOv8n backbone network is downsampled through convolution and pooling to gradually reduce the size of the feature map while continuously learning the feature information of the target. Subsequently, the feature maps with output dimensions of 20×20, 40×40, and 80×80 from the backbone network are fed into the Neck part for feature fusion. The backbone network structure of the improved YOLOv8n network after steps 2, 3, and 4 is optimized by adjusting the feature map scale used for feature fusion in the Neck part of the backbone network to 20×20, 40×40, 80×80, and 160×160, and adding a 160×160 small target detection head.

[0055] The specific process of training the improved model using the training set in step 6 is as follows:

[0056] The improved object detection model is trained using a labeled training set. The model parameters are iteratively adjusted based on the optimization algorithm, with the goal of minimizing the preset loss function.

[0057] Once training converges, the best-performing weight file on the validation set is used to build an object detection model. This optimal weight file is then deployed to the UAV inference environment. When the UAV performs its mission, it collects environmental data in real time and calls the integrated object detection model to complete small object detection, thus realizing end-to-end intelligent perception applications.

[0058] The beneficial effects of this invention are:

[0059] 1. This invention designs CRConv, specifically by using RFAConv to optimize C2f in the feature extraction network. RFAConv obtains the receptive field attention map and the receptive field spatial feature map through two branches, improving the global perception capability and feature selectivity of the convolutional operation, allowing the model to better handle complex structures and key regions. By improving C2f, the expressive and selective capabilities of Bottleneck are enhanced, making the features output by C2f more accurate and globally perceptive, reducing the loss for small targets, and aiding in the detection of small targets.

[0060] 2. This invention introduces a three-branch attention module. This multi-scale attention mechanism improves feature representation capabilities by crossing channel, height, and width dimensions, thereby enhancing context awareness and region contrast capabilities for small target detection.

[0061] 3. This invention uses a Dyhead to replace the original detection head and integrates multi-scale features to compensate for the shortcoming of single-scale detection, which is prone to missing small targets. This allows the model to adaptively fuse features from different levels, thereby further improving the network's representation ability and generalization ability to unknown scenes. The network has been optimized by adding a small target detection head, which is more conducive to the detection of small targets. Attached Figure Description

[0062] Figure 1 This is a diagram of the overall structure of the network CTD-YOLO-P2 in an embodiment of the present invention.

[0063] Figure 2 This is a diagram of the CRConv convolutional structure in an embodiment of the present invention.

[0064] Figure 3 This is a structural diagram of the Triplet Attention mechanism in an embodiment of the present invention.

[0065] Figure 4 This is a structural diagram of the improved Dyhead detection head in an embodiment of the present invention.

[0066] Figure 5 The figures show the detection results in different scenarios in the embodiments of the present invention.

[0067] in Figure 5 (a) is a scene with dense detection. Figure 5 (d) The scene to be detected is occluded. Figure 5 (g) is the scene to be detected at night. Detailed Implementation

[0068] The present invention will now be described in further detail with reference to the accompanying drawings.

[0069] Reference Figure 1 A method for small target detection based on an improved YOLOv8n aerial view includes the following steps:

[0070] Step 1, Data Preprocessing: The image dataset collected by the drone aerial photography is preprocessed and divided into training set, validation set and test set;

[0071] Step 2, introduce CRConv convolution: introduce the improved C2f-based CRConv convolution into the YOLOv8n backbone network;

[0072] Step 3, Introduce an attention mechanism: In the feature fusion network, Triplet Attention is introduced in front of the target detection head;

[0073] Step 4, introduce the Dyhead detection head: replace the original detection head with the Dyhead detection head;

[0074] Step 5, optimize the network: add new branches to the improved network structure in the above steps and add small target detection heads;

[0075] Step 6: Use the training set divided in Step 1 to train the improved network model in Step 5, complete the model optimization and parameter adjustment, and finally obtain a high-performance detection model suitable for small target detection from an aerial perspective.

[0076] Step 1, Data Preprocessing:

[0077] The dataset of images obtained from drone aerial photography is acquired and preprocessed, including image size normalization, noise suppression, and data augmentation, to improve the stability and robustness of model training. The dataset is then divided into training, validation, and test sets in YOLO format. Images are uniformly resized to 640×640 pixels and converted to tensor format, with bounding box coordinates adjusted.

[0078] The dataset used in this case study is the VisDrone dataset. The VisDrone2019 dataset consists of still images captured by drones at different geographical locations and altitudes at low altitudes. It contains a total of 10,203 images across 10 categories, of which 6,471 were used for training, 548 for validation, and 3,184 for testing.

[0079] Step 2, introduce CRConv convolution:

[0080] Reference Figure 2 Improvements were made to the C2f module in the YOLOv8n network;

[0081] Specifically, the second Conv convolution in Bottleneck is replaced by the receptive field attention convolution RFAConv, and the C2f module is improved to form the CRConv module. This module performs adaptive learning through the interaction between receptive field features and convolution, thereby improving the model's ability to learn global contextual information features of the image. This addresses the problem of weakened local features, strengthens key regions, and enhances the network's feature extraction capabilities, enabling the network to extract features more accurately and reducing feature loss for small objects. RFAConv is divided into two branches: the input features are extracted through a 1×1 branch and a k×k branch, forming the attention map and receptive field spatial features, respectively.

[0082] The input features are subjected to average pooling to obtain global information; the average pooled features are subjected to 1×1 grouped convolution to linearly combine the features; the 1×1 grouped convolution features are subjected to softmax to generate attention maps for each receptive field.

[0083] The input features are subjected to k×k grouped convolution operations, which divide the feature channels into three groups. Each group is convolved separately to obtain a receptive field spatial feature map with an increased number of channels.

[0084] The obtained attention map and receptive field feature map are weighted to suppress unimportant features. The weighted feature map is then reshaped for the next convolution operation.

[0085] The CRConv module was obtained by replacing the second Conv convolution in Bottleneck with RFAConv, thereby improving C2f in the feature extraction network.

[0086] Step 3, Introduce an attention mechanism:

[0087] Introducing Triplet Attention, refer to Figure 3 This attention mechanism is a novel method for calculating attention weights by capturing cross-dimensional interactions using a three-branch structure. The attention module introduces three branches to capture the dependencies between the (C, H), (C, W), and (H, W) dimensions of the input tensor, respectively, thus capturing the interaction between the spatial dimension and the channel dimension of the input tensor.

[0088] In each branch, the input tensor is processed. The input tensor is rotated, Z-pooled to merge features, batch normalized, and activated by the Sigmoid function to generate attention weights, thereby obtaining the interaction results between different dimensions. Finally, the processing results of the three branches are summed and averaged to form a comprehensive attention map.

[0089] In the first branch, the Triplet Attention module establishes the interaction between the channel dimension C and the spatial dimension H. The input tensor x is obtained by rotating it 90° counterclockwise along the H-axis. It then becomes through Z-pool The Z-pool layer reduces the tensor dimension from 0 to 2 to obtain the average and maximum merge features through tensors. The specific calculation formula is as follows:

[0090] Z-pool(x) = [MaxPool 0d (x),AvgPool 0d (x)]

[0091] In the formula 0 dMaxpool0 represents a dimension of 0. d Avgpool0 d These represent the maximum pooling layer and the average pooling layer, respectively.

[0092] The output (1×H×C) is passed through a standard convolutional layer and a normalized layer; then the tensor is passed through a sigmoid activation function to generate the final attention weights applied to x1. Finally, the tensor is rotated 90 degrees clockwise along the H-axis, preserving the original input shape of the feature tensor.

[0093] The second branch process is similar to the first branch. The Triplet Attention module establishes the interaction between the channel dimension C and the spatial dimension width W; the input tensor x is rotated 90° counterclockwise along the W axis to obtain... It then becomes through Z-pool The Z-pool layer reduces the tensor dimension H to 2 to obtain average and maximum merged features from the tensor; the output is then passed through a standard convolutional layer and a normalization layer (1×C×W); the tensor is then passed through a sigmoid activation function to generate the final attention weights applied to x2. Finally, it is rotated 90 degrees clockwise along the W axis to preserve the original input shape of the feature tensor.

[0094] In the third branch, the Triplet Attention module establishes the interaction between the spatial dimension height H and the spatial dimension width W; the input tensor x is transformed through Z-pooling. The Z-pool layer reduces the tensor dimension C to 2 to obtain average and maximum merged features through the tensor; the output is (1×H×W) through standard convolutional layers and normalization layers; then the tensor is passed through a sigmoid activation function to generate the final attention weights applied to x3;

[0095] The final triple attention feature tensor y is obtained, and the specific calculation formula is as follows:

[0096]

[0097] In the formula Let ψi and ψ2 represent the rotation operations of the first and second branches, respectively; let ψ1, ψ2, and ψ3 represent the convolutional layers of the three branches, respectively; and let σ() represent the sigmoid activation function. The tensor obtained from the first branch via Z-pooling. The tensor obtained from the second branch via Z-pooling. Let x be the tensor obtained from the third branch via Z-pooling, and let x be the input tensor.

[0098] Step 4, introduce the Dyhead detection head:

[0099] Introduce the dynamic detection head DyHead into the YOLOv8n detection head. (See reference...) Figure 4 As can be seen, DyHead is mainly divided into three branches: scale-aware module, spatial-aware module, and task-aware module. It integrates scale attention of multi-scale features, spatial attention within feature maps, and task-aware attention for detection tasks, dynamically adjusts feature mapping, and integrates contextual information.

[0100] The specific formula is shown below:

[0101]

[0102] F∈R L×S×C For a three-dimensional feature tensor, S = H × W is the size of the feature map, and π L π S π C These represent scale-aware attention, spatial location-aware attention, and task-aware attention, respectively, and W(F) is a feature map that is dynamically adjusted according to F.

[0103] 4.1π L Enhanced scale perception

[0104] The input features are first subjected to average pooling to capture global features. Then, a Conv 1×1 linear transformation is used to scale the features to obtain reweighted features and capture the correlation between channels. The ReLU activation function is used to enhance the expression of non-linear scale features. The scale feature values ​​are compressed to [0,1] using Hard sigmoid to generate scale weights.

[0105] 4.2π S Enhance spatial awareness

[0106] An offset index is generated using a 1×1 convolution, and then refined using a 3×3 convolution to capture local spatial features. The offset index is compressed to the [0,1] interval using a Sigmoid function, generating the offset between the original sampling point and the new sampling point. Finally, the dynamic convolution DConv dynamically adjusts the sampling position based on the offset, focusing on key regions and generating spatial weights.

[0107] 4.3π C Enhance task awareness

[0108] First, global features are captured using average pooling (Avg Pool). A fully connected layer (fc) is then used for linear transformation to learn channel features and generate feature maps and bias terms. The ReLU activation function is applied to zero out negative values, enhancing the non-linear expressiveness of the features. Next, a second fully connected layer (fc) refines the channel features, capturing more channel details. The Normalize function is used to normalize the features, ensuring they conform to a normal distribution and reducing covariate bias. Finally, a Concat operation is used to concatenate the feature maps with the bias terms of the second fully connected layer to generate task weights.

[0109] 4.4 Integrating Scale, Space, and Task Weights

[0110] The weights generated in 4.1, 4.2, and 4.3 are fused into the original feature map to output a feature map with enhanced scale, spatial, and task awareness.

[0111] Step 5, optimize the network:

[0112] This invention introduces a shallower detection branch and upsamples the 80×80 feature map to 160×160. The backbone network downsamples through convolution and pooling, gradually reducing the size of the feature map while continuously learning the target's feature information. Subsequently, the feature maps with input dimensions of 20×20, 40×40, and 80×80 from the backbone network are fed into the Neck section for feature fusion. The network structure is optimized by adjusting the feature map scales used for feature fusion in the Neck section of the backbone network to 20×20, 40×40, 80×80, and 160×160, and adding a 160×160 small target detection head.

[0113] Step 6: Train the improved model:

[0114] The improved object detection model is trained using a labeled training set. Model parameters are iteratively adjusted based on an optimization algorithm, aiming to minimize the preset loss function. Once training converges, the best-performing weight file from the validation set is used to construct the object detection model. This optimal weight file is then deployed to the UAV inference environment. During mission execution, the UAV collects environmental data in real time and calls the integrated object detection model to detect small objects, achieving end-to-end intelligent perception applications.

[0115] The effects of this invention will be further illustrated below with simulation experiments:

[0116] 1. Experimental conditions

[0117] A comparative experiment was conducted using the Ubuntu operating system and VS Code software. The specific experimental conditions are shown in Tables 1 and 2.

[0118] Table 1 Server Configuration Environment

[0119]

[0120] Table 2 Experimental Parameter Design

[0121]

[0122] 2. Comparative analysis of experimental results

[0123] To verify the effectiveness of the improved algorithm, ablation experiments were conducted on the VisDrone2019 dataset. The experimental results are shown in Table 3. "√" indicates an improved method added to the YOLOv8n network model. Improvement 1 introduces CRConv, improvement 2 introduces a multi-scale attention module, and algorithm 3 introduces the dynamic detection head Dyhead.

[0124] Table 3 Comparison of ablation test results on Visdrone 2019

[0125]

[0126] As shown in Table 3, the ablation experiment results demonstrate that each of the proposed improvement modules improves performance. Compared to the baseline model YOLOv8n, the CTD-YOLO model, which incorporates the three improvements, shows improvements in mAP@0.5, mAP@0.5:0.95, P, and R by 4.0%, 2.7%, 4.9%, and 2.8%, respectively, indicating that CTD-YOLO effectively enhances the detection accuracy of small targets.

[0127] To more clearly demonstrate the effectiveness of the model improvements, the detection performance of the YOLOv8n model and the CTD-YOLO model is compared. Representative images from the VisDrone2019 dataset, including densely packed, occluded, and nighttime images, are selected for visualization and detection. The comparison of detection performance before and after the algorithm improvement is shown below. Figure 5 As shown in the figure, the improved YOLOv8n effectively reduces problems such as missed detections and false detections, and can better detect small targets.

[0128] Furthermore, the addition of a shallower detection branch enhances the model's focus on small target features, thereby improving the detection accuracy of small targets. CTD-YOLO-P2, constructed by adding a P2 detection head to CTD-YOLO, is compared to the baseline model YOLOv8n.

[0129] Table 4 Comparison of experimental results after adding the new detection head.

[0130]

[0131] As shown in Table 4, mAP@0.5 and mAP@0.5:0.95 improved by 9.4% and 6.2%, respectively.

Claims

1. A small target detection method based on an improved YOLOv8n aerial photography perspective, characterized in that, Includes the following steps; Step 1: Use the image dataset collected by drone aerial photography to perform image preprocessing, and divide the processed dataset into training set, validation set and test set; Step 2: Introduce the improved C2f convolution into the YOLOv8n backbone network to form the improved YOLOv8n backbone network and output tensors; Step 3: Introduce Triplet Attention into the feature fusion network; process the tensor to form a comprehensive attention map; Step 4: Introduce the Dyhead detector into the YOLOv8n backbone network to dynamically adjust the feature mapping of the comprehensive attention map and integrate contextual information; Step 5: Optimize the improved YOLOv8n network by adding a small target detection head with higher resolution. Step 6: Use the training set divided in Step 1 to train the improved network model in Step 5, complete the model optimization and parameter adjustment, and finally obtain a high-performance detection model suitable for small target detection from an aerial perspective, thus realizing small target detection.

2. The method for small target detection based on an improved YOLOv8n aerial perspective as described in claim 1, characterized in that, The specific process of data preprocessing in step 1 is as follows: Acquire the image dataset obtained from drone aerial photography. The dataset is in YOLO format. Adjust the images to a set size and convert them to tensor format. Adjust the bounding box coordinates.

3. The method for small target detection based on an improved YOLOv8n aerial perspective as described in claim 2, characterized in that, The specific process of introducing CRConv convolution in step 2 is as follows: The receptive field attention convolution RFAConv is used to replace the second Conv convolution in Bottleneck. The C2f module is improved to form the CRConv module. RFAConv is divided into two branches. The input features are extracted through the 1×1 branch and the k×k branch to form the attention map and the receptive field space features, respectively. The input features converted to tensor format in step 1 are subjected to average pooling to obtain global information; the average pooled features are subjected to 1×1 grouped convolution, and the features after 1×1 grouped convolution are linearly combined; the features after 1×1 grouped convolution are subjected to softmax to generate attention maps for each receptive field. Perform a k×k grouped convolution operation on the input features converted to tensor format in step 1, dividing the feature channels into three groups, and convolving each group separately to obtain a receptive field spatial feature map with an increased number of channels. The obtained attention map and receptive field space feature map are weighted to suppress unimportant features. The weighted feature map is then shaped to form a tensor x.

4. The method for small target detection based on an improved YOLOv8n aerial perspective as described in claim 3, characterized in that, The specific process of introducing the attention mechanism in step 3 is as follows: The Triplet Attention module is introduced, which captures the dependencies between the dimensions (C, H), (C, W), and (H, W) of the input tensor by introducing three branches, thereby capturing the interaction between the spatial dimension and the channel dimension of the input tensor. In each branch, the tensor x output by the improved backbone network in step 2 is used as the input tensor of the feature fusion network. The input tensor is rotated, Z-pooled convolution is used to merge features, batch normalization is applied, and a sigmoid activation function is applied to generate attention weights, thereby obtaining the interaction results between different dimensions. Finally, the processing results of the three branches are summed and averaged to form a comprehensive attention map.

5. The method for small target detection based on an improved YOLOv8n aerial perspective as described in claim 4, characterized in that, In the first branch, the Triplet Attention module establishes the interaction between the channel dimension C and the spatial dimension H. The input tensor x is rotated 90° counterclockwise along the H-axis to obtain... It then becomes through Z-pool The Z-pool layer reduces the tensor dimension W to 2 to obtain the average and maximum merged features through the tensors; the specific calculation formula is as follows: Z-pool(x)=[MaxPool 0d (x),AvgPool 0d (x)] In the formula 0 d Maxpool0 represents a dimension of 0. d Avgpool0 d These represent the max pooling layer and the average pooling layer, respectively. The output is (1×H×C) through a standard convolutional layer and a normalized layer; then the tensor is passed through a sigmoid activation function to generate the final attention weights applied to x1; finally, it is rotated 90 degrees clockwise along the H axis to maintain the original input shape of the feature tensor.

6. The method for small target detection based on an improved YOLOv8n aerial perspective as described in claim 5, characterized in that, In the second branch, the Triplet Attention module establishes the interaction between the channel dimension C and the spatial dimension width W; the input tensor x is rotated 90° counterclockwise along the W axis to obtain... It then becomes through Z-pool The Z-pool layer reduces the tensor dimension H to 2 to obtain average and maximum merged features through tensors; The output is (1×C×W) through a standard convolutional layer and a normalized layer; then the tensor is passed through a sigmoid activation function to generate the final attention weights applied to x2. Finally, it is rotated 90 degrees clockwise along the W axis to maintain the original input shape of the feature tensor.

7. A small target detection method based on an improved YOLOv8n aerial viewpoint as described in claim 6, characterized in that, In the third branch, the Triplet Attention module establishes the interaction between the spatial dimension height H and the spatial dimension width W; the input tensor x is transformed through Z-pooling. The Z-pool layer reduces the tensor dimension C to 2 to obtain the average and maximum merge features through the tensor. The output is (1×H×W) through standard convolutional layers and normalized layers; then the tensor is used to generate the final attention weights applied to x3 through the sigmoid activation function; after three branches, the triple attention feature tensor y is finally obtained, and the specific calculation formula is as follows: In the formula Let ψi and ψ2 represent the rotation operations of the first and second branches, respectively; let ψ1, ψ2, and ψ3 represent the convolutional layers of the three branches, respectively; and let σ() represent the sigmoid activation function. The tensor obtained from the first branch via Z-pooling. The tensor obtained from the second branch via Z-pooling. Let x be the tensor obtained from the third branch via Z-pooling, and let x be the input tensor.

8. A small target detection method based on an improved YOLOv8n aerial perspective as described in claim 7, characterized in that, The specific process of introducing the Dyhead detection head in step 4 is as follows: The dynamic detection head DyHead is introduced into the detection head of the YOLOv8n network structure after the improvements in steps 2 and 3, as shown in the following formula: W(F)=π C (p S (p L ·F)·F)·F F∈R L×S×C For a three-dimensional feature tensor, S = H × W is the size of the feature map, and π L π S π C These represent scale-aware attention, spatial location-aware attention, and task-aware attention, respectively, and W(F) is a feature map that is dynamically adjusted according to F. 4.1π L To enhance scale awareness, the triple attention feature tensor y output by the improved feature fusion network in step 3 is used as the input feature. First, average pooling is performed to capture global features. Then, the scale is transformed by Conv 1×1 to obtain reweighted features and capture the correlation between channels. The ReLU activation function is used to enhance the expression of non-linear scale features. The scale feature values ​​are compressed to [0,1] by Hardsigmoid to generate scale weights. 4.2π S To enhance spatial awareness, the triple attention feature tensor y output by the improved feature fusion network in step 3 is used as the input feature. First, an offset index is generated through 1×1 convolution, and then the offset index is refined and local spatial features are captured through 3×3 convolution. The offset index is compressed to the [0,1] interval by the Sigmoid function to generate the dynamic offset of the convolution kernel sampling position. Finally, the dynamic convolution DConv dynamically adjusts the sampling position according to the offset, focuses on key regions and generates corresponding spatial weights. 4.3π C To enhance task awareness, the improved feature fusion network outputting the triple attention feature tensor y in step 3 is used as the input feature. Global features are captured through average pooling (Avg Pool). A fully connected layer (fc) is used for linear transformation to learn channel features and generate feature maps and bias terms. The ReLU activation function is used to set negative values ​​to zero. Then, the channel features are refined through a second fully connected layer (fc) to capture more channel details. The features are normalized using the Normalize function to make them conform to a normal distribution; finally, the feature map is concatenated with the bias term of the second fully connected layer through the Concat operation to generate the task weights. 4.4 The weights generated in 4.1, 4.2 and 4.3 are fused into the original feature map to output a feature map with enhanced scale, spatial and task awareness.

9. A small target detection method based on an improved YOLOv8n aerial perspective as described in claim 8, characterized in that, The specific process of optimizing the network in step 5 is as follows: A shallower detection branch is introduced into the improved YOLOv8n after steps 2, 3 and 4, and the feature map is upsampled; the original YOLOv8n backbone network is downsampled through convolution and pooling to gradually reduce the size of the feature map, and then the feature map of the output dimension in the backbone network is fed into the Neck part for feature fusion. The backbone network structure of YOLOv8n, which has been improved through steps 2, 3, and 4, is optimized by adjusting the scale of the feature maps used for feature fusion in the Neck part of the backbone network and adding a small target detection head.

10. A small target detection method based on an improved YOLOv8n aerial viewpoint as described in claim 9, characterized in that, The specific process of training the improved model using the training set in step 6 is as follows: The improved object detection model is trained using a labeled training set. The model parameters are iteratively adjusted based on the optimization algorithm, with the goal of minimizing the preset loss function. Once training converges, the best-performing weight file on the validation set is used to build an object detection model. This optimal weight file is then deployed to the UAV inference environment. When the UAV performs its mission, it collects environmental data in real time and calls the integrated object detection model to complete small object detection, thus realizing end-to-end intelligent perception applications.