Unmanned aerial vehicle aerial image target detection method based on selective attention and adaptive feature fusion
By using selective attention and adaptive feature fusion methods in UAV aerial image target detection, the problem of difficulty in feature extraction by traditional algorithms in complex scenes is solved, and the detection accuracy and classification effect of small-scale targets are improved, achieving for more efficient feature expression and information fusion.
Patent Information
- Application Number
- CN202410685442.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-05-30
AI Technical Summary
The traditional UAV aerial image target detection algorithm is difficult to extract key features in complex scenes, resulting in poor detection results for small-scale traffic targets. Moreover, the existing feature fusion network lacks full utilization of feature map information, and there is redundant information expression. problem.
A UAV aerial image target detection method based on selective attention and adaptive feature fusion is adopted. Through the backbone network, feature fusion network and decoupled target detection head, the selective attention mechanism and skip connection are used to design an adaptive feature fusion structure to enhance Feature expression and information fusion reduce computational costs.
It improves the detection accuracy and classification effect of small-scale traffic targets, enhances the feature extraction capability of the model in complex scenes, reduces redundant information, and improves detection accuracy and real-time performance.
Smart Images

Figure CN118570676A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent aerial image target detection, and in particular to an improved target detection network method based on selective attention and adaptive feature fusion. Background Art
[0002] In recent years, drones have been widely used in transportation, agriculture, rescue and other fields due to their high maneuverability, easy operation and strong equipment plasticity, providing people with real-time monitoring data of large areas. At the same time, breakthroughs in hardware performance such as GPUs, the emergence of large-scale labeled data sets and advances in deep learning have promoted the development of object detection technology. Applying object detection technology to drones is a trend, which plays an important role in promoting human production and development.
[0003] Object detection is an important direction in the field of computer vision. Its purpose is to locate and classify objects, that is, to find the required target objects in a given image or video, mark their positions with bounding boxes, and determine their categories. Due to the differences and uncertainties of target objects, object detection has always been one of the core issues in this field. In recent years, the field of computer vision has made great progress. The traditional method of manually identifying targets in images has become less and less applicable and has been gradually replaced by intelligent analysis methods. Object detection is the basis and prerequisite for completing more refined tasks. Traditional object detection algorithms mainly use manually designed features to achieve feature extraction, combining artificially designed target features with machine learning classifiers. Common traditional object detection algorithms include Haar features and directional histogram (HOG) features. This artificially designed target feature extractor has low efficiency, poor robustness, strong targeting and poor generalization. At the same time, it does not have good performance for target occlusion and small target detection. With the development of artificial intelligence, deep learning has shined in the field of image classification, and has made great progress in improving accuracy and reducing computational complexity.
[0004] Drones can take pictures from different heights and angles, providing rich background information and object features for object detection. However, the change in height when taking pictures by drones causes huge differences in the scale and background of objects in the image, resulting in less pixel information for small objects and difficulty in distinguishing themselves from the environment. At the same time, aerial images often contain high-density objects, and the occlusion between objects increases the difficulty of detector positioning and recognition. Traditional feature fusion networks lack full utilization of feature map information, do not enhance the expression of effective messages and suppress redundant information; existing target detection heads directly use fully connected layers for classification and regression, ignoring the conflict between classification and regression tasks. Therefore, when using drones for object detection, it is a challenging task to maintain real-time detection while improving detection performance. Summary of the invention
[0005] The present invention aims to address the deficiencies of the above-mentioned prior art and proposes a target detection method for drone aerial images based on selective attention and adaptive feature fusion, in order to improve the model's ability to extract key features in complex scenes and enhance the detection effect of smaller traffic targets, thereby improving the model's accuracy in locating traffic targets and the classification effect, which is of great significance to the construction of smart cities.
[0006] In order to achieve the above-mentioned purpose, the present invention adopts the following technical scheme:
[0007] The invention discloses a method for detecting a target in an unmanned aerial image based on selective attention and adaptive feature fusion, which comprises the following steps:
[0008] Step 1: Obtain a drone aerial image dataset with label information and preprocess it to obtain a preprocessed aerial image dataset P = {P n |n=1,2,…,N}, where P n represents the nth aerial image, N represents the total number of aerial images in the aerial image dataset; let P n The label information is recorded as H n , and includes: the location information of the real detection frame and the category of its target detection;
[0009] Step 2: Build an aerial image target detection network, including: backbone network, feature fusion network, and decoupled target detection head;
[0010] The backbone network comprises: k feature extraction layers of different levels connected in series in sequence;
[0011] The feature fusion network includes: a k-1 level image super-resolution path, a k-1 level path enhancement network embedded with SKSM selection attention mechanism, and an adaptive feature fusion structure;
[0012] The decoupled target detection head includes: a regression branch and a classification branch;
[0013] Step 2.1: When j=1, the nth image P n Input into the backbone network, and after downsampling feature extraction at the j-th level feature extraction layer, the n-th aerial image P is obtained. n The j-th initial multi-scale feature map B n,j ;
[0014] When j = 2, 3, ..., k, the j-1th initial multi-scale feature map B n,j-1 After inputting into the j-th level feature extraction layer for downsampling extraction, the n-th aerial image P is obtained.n The j-th initial multi-scale feature map B n,j ; Thus, the initial multi-scale feature map {B n,1 ,B n,2 ,...,B n,j ,...,B n,k}, where B n,k Represents the nth aerial image P n The initial minimum scale feature map of; j∈[1,k];
[0015] Step 2.2: When K = 1, the K-th level image super-resolution path is used to calculate the initial minimum scale feature map B n,k After the upsampling operation, the upsampling result is obtained Then the upsampling result and the k-1th initial multi-scale feature map B n,k-1 Splicing is performed in the channel dimension to obtain the intermediate fusion result of the K-th level image super-resolution path After being processed by the C2f module, the nth aerial image P is obtained. n The K-th intermediate multi-scale feature map Q n,K ;
[0016] When K = 2, 3…k-1, the K-1th level intermediate multi-scale feature map Q n,K-1 Input the K-th level image super-resolution path for processing to obtain the n-th aerial image P n The K-th intermediate feature map Q n,K ; Thus, we get k-1 intermediate multi-scale feature maps {Q n,1 ,Q n,2 ,...,Q n,K ,...,Q n,k-1};
[0017] The k-1th level intermediate multi-scale feature map Q n,k-1 Set as the nth aerial image P n Initial target feature map D of the first scale to be detected n,1 ;
[0018] The first scale initial target feature map D to be detected n,1 After being processed by the path enhancement network of k-1 levels of embedded SKSM selection attention mechanism, the initial multi-scale target feature map to be detected is obtained. n,1 ,D n,2 ,...,D n,j ,...,D n,k}; where D n,j Represents the initial j-th scale target feature map to be detected;
[0019] The adaptive feature fusion structure uses formula (1) to obtain the jth new multi-scale target feature map to be detected
[0020]
[0021] In formula (1), and Respectively represent B n,j and D n,j The weights to be learned, ε represents the parameters, and Conv represents the convolution operation; thus, the multi-scale target feature map to be detected is obtained.
[0022] Step 2.3: The regression branch in the decoupled target detection head performs a multi-scale target feature map on the target to be detected. Processing is performed to obtain the predicted detection frame position information, thereby constructing the predicted detection frame position information and H n The position offset between the real detection box position information in , and used as the CIOUloss loss function of the regression branch;
[0023] The classification branch in the decoupled target detection head performs classification on the multi-scale target feature map to be detected. Processing is performed to obtain the nth aerial image P n The probability of belonging to each category, and the final target prediction category is selected from the probability by maximum value suppression;
[0024] Based on the target prediction category and H n The target detection category in constructs the BCE loss function of the classification branch;
[0025] Step 3: Use the stochastic gradient descent method to train the target detection network, and calculate the CIOU loss function and the BCE loss function to update the network parameters until the loss converges or the maximum number of iterations is reached, then stop the training to generate the optimal aerial image target detection network corresponding to the optimal network parameters for target detection in aerial images.
[0026] The method for detecting targets in drone aerial images based on selective attention and adaptive feature fusion described in the present invention is characterized in that each feature extraction layer at different levels in the backbone network includes a convolutional layer and a C2f-STDP module;
[0027] When j=1, the nth aerial image P n Input the convolutional layer of the j-th level feature extraction layer, so that P n The width and height are converted to the original Pn The number of channels is doubled, and the j-th feature map B′ after convolution is obtained. n,j ;
[0028] B′ n,j Then input into the C2f-STDP module of the j-th level feature extraction layer, and B′ n,j The spatial dimension is converted to the channel dimension to obtain W×W sub-feature maps in, Represents B′ n,j The x-th row and y-th column of the sub-feature map, W represents the downsampling ratio;
[0029] After concatenating the W×W sub-feature maps in the channel dimension, we get the jth initial multi-scale feature map B output by the jth level feature extraction layer. n,j .
[0030] In the feature fusion network of step 2.2, each level of image super-resolution path is composed of an upsampling layer, a splicing module, and a first C2f module in sequence; the first C2f module is composed of a split module, a plurality of serial bottleneck blocks, and a bottom convolutional layer in sequence;
[0031] When K = 2, 3…k-1, the K-1th level intermediate multi-scale feature map Q n,K-1 After being processed by the upsampling layer in the K-th level image super-resolution path, the upsampling result is obtained Reuse splicing module With the initial multi-scale feature map B n,k-K Splicing is performed in the channel dimension to obtain the intermediate fusion result of the K-th level image super-resolution path
[0032] The split module in the first C2f module of the K-th level image super-resolution path combines the K-th level intermediate fusion results The channel dimension is evenly divided into two parts, one of which is input into several serial bottleneck blocks for processing to obtain the K-1 level bottleneck feature map Another with After channel splicing, the input is sent to the bottom convolutional layer to restore the number of channels and obtain the K-th level intermediate feature map Q n,K .
[0033] Each level of the path enhancement network in the feature fusion network of step 2.2 is composed of a convolutional downsampling layer, a second C2f module and an SKSM selection attention mechanism module in sequence; wherein the SKSM selection attention mechanism module is composed of a spatial kernel selection module and a channel attention module in sequence;
[0034] When j = 2, 3, ..., k, the nth aerial image Pn Initial feature map D of the j-1th scale target to be detected n,j-1 After being processed by the convolutional downsampling layer and the second C2f module in the j-1th level path enhancement network, D n,j-1 The width and height are converted to the original D n,j-1 The number of channels is doubled, thus obtaining the target feature map D′ to be detected in the j-1th level n,j-1 ;
[0035] The spatial kernel selection module in the j-1th level path enhancement network generates the intermediate target feature map D′ using formula (2) n,j-1 Spatially selective masks corresponding to convolution kernels with different receptive fields;
[0036]
[0037] In formula (2), represents the parameters of the first and second convolution kernels with different receptive fields in the spatial kernel selection module of the j-1th level path enhancement network, represents the parameters of the 3rd, 4th, and 5th convolutional kernels used for feature vector channel fusion in the spatial kernel selection module of the j-1th level path enhancement network, represents the intermediate feature map of two convolution kernels with different receptive fields in the spatial kernel selection module of the j-1th level path enhancement network, σ represents the sigmoid activation function, Maxpool and Avgpool represent the maximum pooling operation and the average pooling operation respectively, and Concat represents the concatenation operation in the channel dimension. represents the spatial selection mask corresponding to the t-th receptive field convolution kernel in the spatial kernel selection module of the j-1-th path enhancement network;
[0038] The spatial kernel selection module in the j-1th level path enhancement network uses formula (3) to generate the j-1th level spatial kernel selection feature U n,j-1 ;
[0039]
[0040] In formula (3), the + symbol represents matrix addition, The symbol represents matrix multiplication;
[0041] The channel attention module in the j-1th level path enhancement network uses formula (4) to obtain the j-1th scale initial target feature map D n,j ;
[0042]
[0043] In formula (4), W q and Wk Represents the parameters of the two fully connected layers in the channel attention module.
[0044] An electronic device of the present invention includes a memory and a processor, wherein the memory is used to store a program that supports the processor to execute the method for detecting targets in unmanned aerial images, and the processor is configured to execute the program stored in the memory.
[0045] The present invention provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program, which is characterized in that when the computer program is run by a processor, the steps of the unmanned aerial vehicle aerial image target detection method are executed.
[0046] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0047] 1. Before extracting features at each level of the backbone network, the present invention performs a space-to-depth conversion on the features, converting the spatial dimension into the channel dimension. Specifically, any intermediate feature map is sliced into several sub-feature maps, and these sub-feature maps are spliced along the channel dimension; the conversion operation reduces the spatial resolution, and the fine-grained feature information that is often lost by CNN is retained as much as possible by increasing the number of channels, thereby improving the detection accuracy; in addition, since the size of the feature map is reduced after the conversion, the required amount of calculation is reduced.
[0048] 2. The present invention constructs an SKSM selective attention module in the feature fusion network, and embeds the selective attention module after each level of the path enhancement network to obtain the target feature map to be detected, thereby enhancing the feature information expression of the target in the drone image from two dimensions: space and channel. The spatial kernel selection module of SKSM can dynamically adjust the receptive field, so that the model can adaptively select the background range to focus on the key area of the target, reducing the interference of the complex background. By adding the channel attention module, the ability to capture key channel information is further enhanced, redundant information is suppressed, and more accurate target feature information is provided for the model.
[0049] 3. The present invention uses skip connections and weighted input features to design an adaptive feature fusion structure, and uses skip connections to connect input nodes and output nodes at the same level, so as to fuse more feature information without increasing too much computational cost. By setting a learnable weight for each input feature of the feature fusion sequence, the network can adaptively fuse according to the weights of different input features, thereby suppressing the expression of useless features and improving the detection accuracy of multi-scale targets. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 is a model structure diagram of the target detection model for drone aerial images according to the present invention;
[0051] Figure 2 is a schematic diagram of converting the spatial dimension into the channel dimension according to the present invention;
[0052] Figure 3 It is a schematic diagram of the structure of the SKSM selection attention mechanism module according to the present invention;
[0053] Figure 4 Schematic diagram of the adaptive feature fusion structure according to the present invention. DETAILED DESCRIPTION
[0054] In this embodiment, a method for detecting targets in drone aerial images based on selective attention and adaptive feature fusion includes the following steps:
[0055] Step 1: Obtain a dataset of N drone aerial images with label information and perform preprocessing. The preprocessing process includes Mosaic data enhancement, CopyPaste data enhancement, and image scaling and filling. The preprocessed dataset P = {P n |n=1,2,…,N}, where P n represents the nth aerial image, N represents the total number of aerial images in the dataset; let P n The label information is recorded as H n , and includes: the location information of the target detection box and its target detection category; in this embodiment, the 2019 drone aerial photography dataset VisDrone is used, which contains 10 categories: pedestrians, people, bicycles, sunshade tricycles, tricycles, vans, buses, trucks, motorcycles and cars, and a single image can have up to about 900 target objects.
[0056] Step 2: Build an aerial image target detection network, such as Figure 1 As shown, it includes: backbone network, feature fusion network, and decoupled target detection head;
[0057] The backbone network includes: k feature extraction layers of different levels connected in series;
[0058] The feature fusion network includes: k-1 level image super-resolution path, k-1 level embedded SKSM (Spatial Kernel Selection Module) path enhancement network with attention mechanism, and adaptive feature fusion structure;
[0059] The decoupled target detection head (DecoupledHead) includes: regression branch and classification branch;
[0060] Input any m drone aerial images with label information into the target detection network as the current batch training data; m≤N; in this embodiment, m=4;
[0061] Step 2.1, when j = 1, the nth image P n Input into the backbone network, and after downsampling feature extraction in the jth feature extraction layer, the nth aerial image P is obtained. n The j-th initial multi-scale feature map B n,j ;
[0062] When j = 2, 3, ..., k, the j-1th initial multi-scale feature map B n,j-1 After inputting into the j-th level feature extraction layer for downsampling extraction, the n-th aerial image P is obtained. n The j-th initial multi-scale feature map B n,j ; Thus, the initial multi-scale feature map {B n,1 ,B n,2 ,...,B n,j ,...,B n,k}, where B n,k Represents the nth aerial image P n The initial minimum scale feature map; j∈[1,k].
[0063] Each different level of feature extraction layer in the backbone network includes a convolutional layer and a C2f-STDP module;
[0064] When j=1, the nth aerial image P n Input the convolutional layer of the j-th level feature extraction layer, so that P n The width and height are converted to the original P n The number of channels is doubled, and the j-th feature map B′ after convolution is obtained. n,j ;
[0065] B′ n,j Then input into the C2f-STDP module of the j-th level feature extraction layer, and B′ n,j The spatial dimension is converted to the channel dimension to obtain W×W sub-feature maps in, Represents B′ n,j The x-th row and y-th column of the sub-feature map, W represents the downsampling ratio;
[0066] After concatenating the W×W sub-feature maps in the channel dimension, we get the jth initial multi-scale feature map B output by the jth level feature extraction layer. n,j .
[0067] In this embodiment, the downsampling ratio W=2, the feature map B′ n,jThe number of channels is C, the width and height are S, and the specific conversion process is as follows Figure 2 As shown, using formula (1), the feature map B′ n,j Slice into 4 sub-feature maps And concatenate in the channel dimension to get B n,j ;
[0068]
[0069] In order to further reduce the consumption of memory resources and the amount of calculation, a simpler convolution method PConv is used to replace the conventional convolution in C2f. PConv only extracts features from a part of the channels of the feature map, and the rest of the channels remain unchanged. The input and output channels of PConv are both V, the convolution kernel size is k, and the height and width of the input feature map are h and w respectively. It selects continuous V P The memory access and FLOPs of conventional convolution are h×w×2V and h×w×k respectively. 2 ×V 2 , and PConv is h×w×2V p , Since the number of channels V is greater than V P ,PConv effectively reduces the memory access and FLOPs.
[0070] Step 2.2: When K = 1, the K-th level image super-resolution path is used to calculate the initial minimum scale feature map B n,k After the upsampling operation, the upsampling result is obtained Then the upsampling result and the k-1th initial multi-scale feature map B n,k-1 Splicing is performed in the channel dimension to obtain the intermediate fusion result of the K-th level image super-resolution path After being processed by the C2f module, the nth aerial image P is obtained. n The K-th intermediate multi-scale feature map Q n,K ;
[0071] When K = 2, 3…k-1, the K-1th level intermediate multi-scale feature map Q n,K-1 Input the K-th level image super-resolution path for processing to obtain the n-th aerial image P n The K-th intermediate feature map Q n,K ; Thus, we get k-1 intermediate multi-scale feature maps {Q n,1 ,Q n,2 ,...,Q n,K ,...,Q n,k-1};
[0072] The k-1th level intermediate multi-scale feature map Q n,k-1Set as the nth aerial image P n Initial target feature map D of the first scale to be detected n,1 .
[0073] The first scale initial target feature map D to be detected n,1 After being processed by the path enhancement network of k-1 levels of embedded SKSM selection attention mechanism, the initial multi-scale target feature map to be detected is obtained. n,1 ,D n,2 ,...,D n,j ,...,D n,k}; where D n,j represents the j-th scale target feature map to be detected; in this embodiment, k=4;
[0074] Initial minimum scale feature map B extracted by the backbone network n,4 The input is sent to the feature fusion network and passes through the three-level image super-resolution path in sequence. The PAN (Path Aggregation Network) structure is used in the feature fusion network. In the top-down image super-resolution path, the high-level semantic features are transmitted through the upsampling module, and in the bottom-up path enhancement network, the convolutional downsampling layer is used to transmit the low-level positioning features. n,4 After the three-level image super-resolution path processing, it enters the first SKSM attention mechanism module to obtain the initial first-scale target feature map D to be detected n,1 , D n,1 Enter the path enhancement network of the three-level embedded SKSM attention mechanism in series, and obtain the initial multi-scale target feature map to be detected {D n,1 , D n,2 , D n,3 , D n,4};
[0075] Each level of image super-resolution path consists of an upsampling layer, a splicing module, and the first C2f module in sequence; the first C2f module contains a split module, several serial bottleneck blocks, and a bottom convolutional layer in sequence;
[0076] When K = 2, 3…k-1, the K-1th level intermediate multi-scale feature map Q n,K-1 After being processed by the upsampling layer in the K-th level image super-resolution path, the upsampling result is obtained Reuse splicing module With the initial multi-scale feature map B n,k-K Splicing is performed in the channel dimension to obtain the intermediate fusion result of the K-th level image super-resolution path
[0077] The split module in the first C2f module of the K-th level image super-resolution path combines the K-th level intermediate fusion results The channel dimension is evenly divided into two parts, one of which is input into several serial bottleneck blocks for processing to obtain the K-1 level bottleneck feature map Another with After channel splicing, the input is sent to the bottom convolutional layer to restore the number of channels and obtain the K-th level intermediate feature map Q n,K .
[0078] Each level of the path enhancement network is composed of a convolutional downsampling layer, a second C2f module and an SKSM selection attention mechanism module in sequence; the convolutional downsampling layer has a convolution kernel size of 3 and a stride of 2; the SKSM selection attention mechanism module is composed of a spatial kernel selection module and a channel attention module in sequence, and its structure is as follows: Figure 3 shown.
[0079] When j = 2, 3, ..., k, the nth aerial image P n Initial feature map D of the j-1th scale target to be detected n,j-1 After being processed by the convolutional downsampling layer of the j-1th level path enhancement network and the second C2f module, D n,j-1 The width and height are converted to the original D n,j-1 The number of channels is doubled, thus obtaining the j-1th level intermediate target feature map D′ n,j-1 .
[0080] The spatial kernel selection module of the SKSM module of the j-1th level path enhancement network generates D′ using formula (2) n,j-1 Spatially selective masks corresponding to convolution kernels with different receptive fields;
[0081]
[0082] In formula (2), represents the parameters of the first and second convolution kernels with different receptive fields in the j-1th level spatial kernel selection module, represents the parameters of the 3rd, 4th, and 5th convolution kernels used for feature vector channel fusion in the j-1th level spatial kernel selection module, represents the intermediate feature map corresponding to the convolution kernels with different receptive fields in the j-1th level spatial kernel selection module, σ represents the sigmoid activation function, Maxpool and Avgpool represent the maximum pooling operation and the average pooling operation respectively, and Concat represents the concatenation of feature maps in the channel dimension. Represents the spatial selection mask corresponding to the t-th receptive field convolution kernel in the j-1-th spatial kernel selection module.
[0083] In the j-1th level path enhancement network, the spatial kernel selection module of the SKSM selection attention mechanism module uses formula (3) to generate the j-1th level spatial kernel selection feature U n,j-1 ;
[0084]
[0085] In formula (3), the + symbol represents matrix addition, The symbol represents matrix multiplication.
[0086] In the j-1th level path enhancement network, the channel attention module of the SKSM selection attention mechanism module uses formula (4) to obtain the j-1th scale initial target feature map D to be detected n,j ;
[0087]
[0088] In formula (4), W q and W k Represents the parameters of the two fully connected layers in the channel attention module.
[0089] The adaptive feature fusion structure uses formula (5) to transform the j-th initial multi-scale feature map B except the 1st and kth layers n,j In addition, the j-th initial multi-scale feature map B of the remaining k-2 levels n,j and the jth initial target feature map D to be detected n,j Perform jump fusion to make D n,j Fusion of more feature information to obtain the jth new multi-scale target feature map to be detected
[0090]
[0091] In formula (5), and Respectively represent B n,j and D n,j The learnable weights, ε represents the minimum value to ensure numerical stability, and Conv represents the convolution operation used to adjust the number of channels. In the above formula, all weights are normalized so that each standardized weight ranges from 0 to 1 to indicate the importance of each input. Finally, the multi-scale target feature map to be detected is obtained
[0092]
[0093] In this embodiment, D n,3 Take the adaptive feature fusion of the layer as an example, the process is as follows Figure 4 As shown, using formula (6) to perform adaptive feature fusion, the target feature map to be detected in this layer is obtained
[0094]
[0095] Step 2.3: Decouple the regression branch in the target detection head from the multi-scale target feature map to be detected Processing is performed to obtain the predicted detection frame position information, thereby constructing the predicted detection frame position information and H n The position offset between the real detection box position information and the CIOUloss loss function of the regression branch;
[0096] Decouple the classification branch in the object detection head from the multi-scale object feature map to be detected Processing is performed to obtain the nth aerial image P n The probability of belonging to each category, and the final target prediction category is selected from the probability by maximum value suppression;
[0097] Based on the target prediction category and H n The target detection category in constructs the BCE loss function of the classification branch;
[0098] Step 3: Use the stochastic gradient descent method to train the target detection network, and calculate the CIOU loss function and the BCE loss function to update the network parameters until the loss converges or the maximum number of iterations is reached, then stop the training to generate the optimal aerial image target detection network corresponding to the optimal network parameters for target detection in aerial images.
[0099] In this embodiment, an electronic device includes a memory and a processor, wherein the memory is used to store a program that supports the processor to execute the above method, and the processor is configured to execute the program stored in the memory.
[0100] In this embodiment, a computer-readable storage medium stores a computer program on the computer-readable storage medium, and the computer program executes the steps of the above method when executed by a processor.
[0101] The experiment was conducted on an Ubuntu 20.04 system, with deep learning frameworks of Pytorch 2.0.2 and Cuda 11.8, and a 24GB NVIDIA RTX 3090 GPU. The optimizer used in training was SGD, with an initial learning rate of 0.01, a momentum factor of 0.937, and a weight decay of 5e-4. The model was trained for a total of 300 epochs, with a batch size of 8. The model turned off the Mosiac data augmentation operation in the last 10 epochs to achieve better results.
[0102] The evaluation indicators of the COCO dataset are used in the experiment. AP (Average Precision) is the area under the precision-recall curve, and map (meanAverage Precision) is the average of APs of multiple categories. The main indicators are map@0.5 and map@0.5:0.95. Among them, mAP@0.5 represents the average AP of all categories when the IoU threshold is 0.5, and mAP@0.5:0.95 represents the average mAP when the IoU threshold ranges from 0.5 to 0.95 and the step size is 0.05. FPS (Frames Per Second) is used as the evaluation indicator of the model detection speed; GFLOPs (Giga Floating Point Operations Per Second) is used to measure the computational complexity of the model.
[0103] The trained network is tested on the Visdrone dataset. The improved network AP reaches 48.1%, which is 8.8% higher than the original YOLOv8s network. Compared with other mainstream algorithms, it has the characteristics of fast detection speed and high detection accuracy, as shown in Table 1.
[0104] Table 1 Comparison of experimental results on the Visdrone dataset
[0105]
[0106] In order to verify the effectiveness of the method, ablation experiments are performed to evaluate the impact of various improvement strategies on the performance of the network model. The results are shown in Table 2. Among them, “√” represents the introduction of the proposed structure, and “ / ” represents that PConv is not used to replace conventional convolution in C2f-STDP.
[0107] Table 2 Comparison of ablation experiment results
[0108]
[0109] From the results in Table 2, it can be seen that the present invention has achieved significant performance at a relatively low computational cost. In terms of the detection accuracy index, the present invention has achieved the best results; the detection speed has reached 65.3FPS, second only to the benchmark model and 3.6 times faster than the suboptimal one. It takes into account the computational complexity of the model while maintaining high real-time performance. Combining various indicators, the present invention has higher robustness in drone object detection tasks, providing support for the construction of future smart cities.
Claims
1. A method for target detection in drone aerial images based on selective attention and adaptive feature fusion, characterized in that: The following steps are involved: Step 1: Obtain a drone aerial image dataset with label information and preprocess it to obtain a preprocessed aerial image dataset P = {P n |n=1,2,…,N}, where P n represents the nth aerial image, N represents the total number of aerial images in the aerial image dataset; let P n The label information is recorded as H n , and includes: the location information of the real detection frame and the category of its target detection; Step 2: Build an aerial image target detection network, including: backbone network, feature fusion network, and decoupled target detection head; The backbone network comprises: k feature extraction layers of different levels connected in series in sequence; The feature fusion network includes: a k-1 level image super-resolution path, a k-1 level path enhancement network embedded with SKSM selection attention mechanism, and an adaptive feature fusion structure; The decoupled target detection head includes: a regression branch and a classification branch; Step 2.1: When j=1, the nth image P n Input into the backbone network, and after downsampling feature extraction at the j-th level feature extraction layer, the n-th aerial image P is obtained. n The j-th initial multi-scale feature map B n,j ; When j = 2, 3, ..., k, the j-1th initial multi-scale feature map B n,j-1 After inputting into the j-th level feature extraction layer for downsampling extraction, the n-th aerial image P is obtained. n The j-th initial multi-scale feature map B n,j ; Thus, the initial multi-scale feature map {B n,1 ,B n,2 ,...,B n,j ,...,B n,k }, where B n,k Represents the nth aerial image P n The initial minimum scale feature map of; j∈[1,k]; Step 2.2: When K = 1, the K-th level image super-resolution path is used to calculate the initial minimum scale feature map B n,k After the upsampling operation, the upsampling result is obtained Then the upsampling result and the k-1th initial multi-scale feature map B n,k-1 Splicing is performed in the channel dimension to obtain the intermediate fusion result of the K-th level image super-resolution path After being processed by the C2f module, the nth aerial image P is obtained. n The K-th intermediate multi-scale feature map Q n,K ; When K = 2, 3…k-1, the K-1th level intermediate multi-scale feature map Q n,K-1 Input the K-th level image super-resolution path for processing to obtain the n-th aerial image P n The K-th intermediate feature map Q n,K ; Thus, we get k-1 intermediate multi-scale feature maps {Q n,1 ,Q n,2 ,...,Q n,K ,...,Q n,k-1 }; The k-1th level intermediate multi-scale feature map Q n,k-1 Set as the nth aerial image P n Initial target feature map D of the first scale to be detected n,1 ; The first scale initial target feature map D to be detected n,1 After being processed by the path enhancement network of k-1 levels of embedded SKSM selection attention mechanism, the initial multi-scale target feature map to be detected is obtained. n,1 ,D n,2 ,...,D n,j ,...,D n,k }; where D n,j Represents the initial j-th scale target feature map to be detected; The adaptive feature fusion structure uses formula (1) to obtain the jth new multi-scale target feature map to be detected In formula (1), and Respectively represent B n,j and D n,j The weights to be learned, ε represents the parameters, and Conv represents the convolution operation; thus, the multi-scale target feature map to be detected is obtained. Step 2.3: The regression branch in the decoupled target detection head performs a multi-scale target feature map on the target to be detected. Processing is performed to obtain the predicted detection frame position information, thereby constructing the predicted detection frame position information and H n The position offset between the real detection box position information in , and used as the CIOUloss loss function of the regression branch; The classification branch in the decoupled target detection head performs classification on the multi-scale target feature map to be detected. Processing is performed to obtain the nth aerial image P n The probability of belonging to each category, and the final target prediction category is selected from the probability by maximum value suppression; Based on the target prediction category and H n The target detection category in constructs the BCE loss function of the classification branch; Step 3: Use the stochastic gradient descent method to train the target detection network, and calculate the CIOU loss loss function and the BCEloss loss function to update the network parameters until the loss converges or the maximum number of iterations is reached, then stop the training to generate the optimal aerial image target detection network corresponding to the optimal network parameters for target detection in aerial images.
2. The method for detecting targets in drone aerial images based on selective attention and adaptive feature fusion according to claim 1, characterized in that: Each feature extraction layer of different levels in the backbone network includes a convolutional layer and a C2f-STDP module; When j=1, the nth aerial image P n Input the convolutional layer of the j-th level feature extraction layer, so that P n The width and height are converted to the original P n The number of channels is doubled, and the j-th feature map B′ after convolution is obtained. n,j ; B′ n,j Then input into the C2f-STDP module of the j-th level feature extraction layer, and B′ n,j The spatial dimension is converted to the channel dimension to obtain W×W sub-feature maps in, Represents B′ n,j The x-th row and y-th column of the sub-feature map, W represents the downsampling ratio; After concatenating the W×W sub-feature maps in the channel dimension, we get the jth initial multi-scale feature map B output by the jth level feature extraction layer. n,j .
3. The method for detecting targets in drone aerial images based on selective attention and adaptive feature fusion according to claim 1, characterized in that: In the feature fusion network of step 2.2, each level of image super-resolution path is composed of an upsampling layer, a splicing module, and a first C2f module in sequence; the first C2f module is composed of a split module, a plurality of serial bottleneck blocks, and a bottom convolutional layer in sequence; When K = 2, 3…k-1, the K-1th level intermediate multi-scale feature map Q n,K-1 After being processed by the upsampling layer in the K-th level image super-resolution path, the upsampling result is obtained Reuse splicing module With the initial multi-scale feature map B n,k-K Splicing is performed in the channel dimension to obtain the intermediate fusion result of the K-th level image super-resolution path The split module in the first C2f module of the K-th level image super-resolution path combines the K-th level intermediate fusion results The channel dimension is evenly divided into two parts, one of which is input into several serial bottleneck blocks for processing to obtain the K-1 level bottleneck feature map Another with After channel splicing, the input is sent to the bottom convolutional layer to restore the number of channels and obtain the K-th level intermediate feature map Q n,K .
4. The method for detecting targets in drone aerial images based on selective attention and adaptive feature fusion according to claim 1, characterized in that: Each level of the path enhancement network in the feature fusion network of step 2.2 is composed of a convolutional downsampling layer, a second C2f module and an SKSM selection attention mechanism module in sequence; wherein the SKSM selection attention mechanism module is composed of a spatial kernel selection module and a channel attention module in sequence; When j = 2, 3, ..., k, the nth aerial image P n Initial feature map D of the j-1th scale target to be detected n,j-1 After being processed by the convolutional downsampling layer and the second C2f module in the j-1th level path enhancement network, D n,j-1 The width and height are converted to the original D n,j-1 The number of channels is doubled, thus obtaining the target feature map D′ to be detected in the j-1th level n,j-1 ; The spatial kernel selection module in the j-1th level path enhancement network generates the intermediate target feature map D′ using formula (2) n,j-1 Spatially selective masks corresponding to convolution kernels with different receptive fields; In formula (2), represents the parameters of the first and second convolution kernels with different receptive fields in the spatial kernel selection module of the j-1th level path enhancement network, represents the parameters of the 3rd, 4th, and 5th convolutional kernels used for feature vector channel fusion in the spatial kernel selection module of the j-1th level path enhancement network, represents the intermediate feature map of two convolution kernels with different receptive fields in the spatial kernel selection module of the j-1th level path enhancement network, σ represents the sigmoid activation function, Maxpool and Avgpool represent the maximum pooling operation and the average pooling operation respectively, and Concat represents the concatenation operation in the channel dimension. represents the spatial selection mask corresponding to the t-th receptive field convolution kernel in the spatial kernel selection module of the j-1-th path enhancement network; The spatial kernel selection module in the j-1th level path enhancement network uses formula (3) to generate the j-1th level spatial kernel selection feature U n,j-1 ; In formula (3), the + symbol represents matrix addition, The symbol represents matrix multiplication; The channel attention module in the j-1th level path enhancement network uses formula (4) to obtain the j-1th scale initial target feature map D n,j ; In formula (4), W q and W k Represents the parameters of the two fully connected layers in the channel attention module.
5. An electronic device, comprising a memory and a processor, characterized in that: The memory is used to store a program that supports the processor to execute the unmanned aerial vehicle aerial image target detection method described in any one of claims 1-4, and the processor is configured to execute the program stored in the memory.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for detecting targets in drone aerial images described in any one of claims 1 to 4 are executed.
Citation Information
Patent Citations
Unmanned aerial vehicle aerial photography target detection and identification method and system
CN114842365A
Fine-grained secure sharing method for data of Internet of Things based on alliance chain
CN114979211A
Unmanned aerial vehicle image traffic target detection method based on attention mechanism and re-parameterization
CN116363532A
Unmanned aerial vehicle aerial photography target detection method based on improved YOLOv5
CN116469021A
Aerial image small target detection method based on improved YOLOX-S
CN117079163A
Cited By
Adaptive sparse convolution guided cross-space unmanned aerial vehicle target detection method and system
CN119992062A
Method and system for identifying elevated strawberries and accurately judging maturity of elevated strawberries
CN120032361A
