A drone target detection method based on improved attention mechanism
By improving the attention module and integrating attention information in the space and channel, the problems of low detection accuracy and high model complexity of drone targets in the prior art are solved, and higher detection accuracy and lower computing resource requirements are achieved.
Patent Information
- Application Number
- CN202510032327.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-09
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2045-01-09
AI Technical Summary
The existing attention mechanism fails to effectively integrate attention information from space and channels, resulting in a reduction in the accuracy of drone target detection and difficulty in balancing the accuracy and complexity of the model.
By improving the attention module, global mean pooling and one-dimensional convolution operations are performed on the input feature map, cross-channel interaction features are gradually extracted, and attention information is fused through the element product method to generate attention feature maps of channel dimension, height dimension, and width dimension.
This method effectively enhances the generalization capability of the model, improves the accuracy of drone target detection, reduces the computing resource requirements, and achieves a good balance between accuracy and complexity.
Smart Images

Figure CN119478747B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image detection, and in particular to a drone target detection method based on an improved attention mechanism. Background Art
[0002] With the rapid development of artificial intelligence and machine learning technologies, drones have been widely used in many fields such as military reconnaissance, environmental monitoring, disaster relief, agricultural management, smart cities, etc. In these applications, drone target detection has become a crucial technology, which directly affects the efficiency and accuracy of drone missions. Drone target detection aims to automatically identify and locate targets of interest, such as vehicles, pedestrians, buildings, or other specific objects, from high-definition or low-resolution images and videos taken by drones.
[0003] Traditional UAV target detection methods mostly rely on image processing technology and hand-designed feature extraction algorithms, such as background difference method, optical flow method, SIFT feature matching, etc. However, these methods often show great limitations when facing complex and changeable natural environments and dynamically changing scenes. In particular, when the target is small, severely occluded or the background is complex, the detection effect of traditional methods is often unsatisfactory. In recent years, with the rapid development of deep learning technology, target detection methods based on convolutional neural networks (CNNs) have made significant progress in the field of UAV target detection. Deep learning methods can effectively improve the accuracy and robustness of target detection by automatically learning hierarchical feature representations in images. Although deep learning methods are superior to traditional methods in overall performance, UAVs often need to process a large number of image features when performing target detection. Directly using traditional convolutional neural networks (CNNs) may not be able to fully capture the meaningful parts of the image, because many background information or irrelevant objects will also affect the judgment of the model. By introducing the attention mechanism, UAV target detection can better capture important features in the image, enhance the model's adaptability to environmental changes, improve detection accuracy and robustness, improve computational efficiency, and reduce the consumption of memory and computing resources.
[0004] However, the existing attention mechanism fails to effectively integrate the spatial and channel attention information in the extraction of channel attention, which reduces the accuracy of drone target detection. For example, although the SE method can capture the interaction between channels, it only considers the channel dimension and ignores the information of the spatial dimension, resulting in imperfect performance. The convolutional block attention module (CBAM) promotes cross-dimensional information transfer by introducing semantic dependencies in the spatial and channel dimensions, but its maximum pooling operation may have a negative impact on the generalization ability of the model, and the extraction method of spatial attention is not efficient. The CA attention mechanism optimizes the channel dimensionality reduction ratio for the extraction of spatial attention, but its method still does not fully tap the potential of spatial and channel attention. In addition, although the ECA method replaces the dimensionality reduction operation with one-dimensional convolution, it reduces the model complexity and improves the inference speed, but it also fails to fully consider the comprehensive utilization of channel attention. In addition, drones usually need to detect targets in dynamic and complex environments, which requires the system to quickly process sensor inputs and make real-time decisions. However, when adding the attention mechanism, the number of model parameters and computational complexity are often increased, making it difficult for existing methods to achieve a good balance between accuracy and complexity, thereby affecting the detection effect of the target. Summary of the invention
[0005] To this end, the technical problem to be solved by the present invention is to overcome the defects that the existing attention mechanism fails to effectively integrate the attention information of space and channel, and it is difficult to balance the accuracy and complexity of the model, resulting in reduced accuracy of drone target detection.
[0006] In order to solve the above technical problems, the present invention provides a drone target detection method based on an improved attention mechanism, comprising the following steps:
[0007] Obtain an image to be detected collected by a drone, input the image to be detected into a backbone model of a target detection model to extract image features, and obtain a target detection result of the image to be detected based on the image features;
[0008] The backbone model extracts the fusion of three-dimensional spatial attention information and channel attention information of the input feature map by improving the attention module to obtain a weighted feature map of the input feature map, including:
[0009] After performing global mean pooling on the input feature map in the height and width dimensions, the first one-dimensional convolution is used to extract the local cross-channel interaction feature map in the channel dimension.
[0010] After normalizing the local cross-channel interaction feature map in the channel dimension, the channel information of the input feature map is activated by the element product method through the normalized local cross-channel interaction feature map in the channel dimension to obtain the attention feature map in the channel dimension;
[0011] After performing global mean pooling on the channel dimension and width dimension of the channel dimension attention feature map, the second one-dimensional convolution is performed to extract the height dimension local cross-channel interaction feature map;
[0012] After normalizing the high-dimensional local cross-channel interaction feature map, the channel information of the channel-dimensional attention feature map is activated by the element-wise product method through the normalized high-dimensional local cross-channel interaction feature map to obtain the high-dimensional attention feature map;
[0013] After performing global mean pooling on the channel dimension and the height dimension of the height-dimensional attention feature map, the third one-dimensional convolution is used to extract the local cross-channel interaction features of the width dimension.
[0014] After normalizing the local cross-channel interaction feature map in the width dimension, the channel information of the attention feature map in the height dimension is activated by the element product method through the normalized local cross-channel interaction feature map in the width dimension to obtain the attention feature map in the width dimension;
[0015] After performing global mean pooling of the height and width dimensions on the width dimension attention feature map, the target local cross-channel interaction feature map is extracted through the first one-dimensional convolution;
[0016] After normalizing the target local cross-channel interaction feature map, the element-wise product method is used to activate the channel information of the width dimension attention feature map through the normalized target local cross-channel interaction feature map to obtain a weighted feature map.
[0017] Preferably, global mean pooling is performed on the input feature map in the height dimension and the width dimension, and the calculation formula is:
[0018] ,
[0019] Among them, y is the input feature map after global mean pooling, H is the height of the input feature map, and W is the width of the input feature map. The input feature map The value of the pixel in the i-th row and j-th column in the channel dimension, where i represents the index in the height direction and j represents the index in the width direction.
[0020] Preferably, after performing global mean pooling on the input feature map in the height dimension and the width dimension, a local cross-channel interaction feature map in the channel dimension is extracted through a first one-dimensional convolution, and the calculation formula is:
[0021] , ,
[0022] ,
[0023] in, is the local cross-channel interaction feature map in the channel dimension, is the first one-dimensional convolution, y is the input feature map after global mean pooling, is the first value of the input feature map y after global mean pooling The element value of the column, Represents the first band matrix Middle Line The element value of the column, is the size of the first one-dimensional convolution, It means rounding to the odd number with the smallest difference from this number, C is the number of channels of the input feature map, is the first band matrix;
[0024] After normalizing the local cross-channel interaction feature map of the channel dimension, the channel information of the input feature map is activated by the element product method through the normalized local cross-channel interaction feature map of the channel dimension to obtain the attention feature map of the channel dimension. The calculation formula is:
[0025] ,
[0026] in, is the channel dimension attention feature map, is the element-wise product, is the Sigmoid activation function, is the input feature map.
[0027] Preferably, the channel dimension attention feature map is subjected to global mean pooling in the channel dimension and the width dimension, and the calculation formula is:
[0028] ,
[0029] in, is the channel dimension attention feature map after global mean pooling, C is the number of channels of the input feature map, W is the width of the input feature map, is the channel dimension attention feature map The value of the pixel in the qth row and jth column in the height dimension, where q represents the index in the channel direction and j represents the index in the width direction.
[0030] Preferably, after the channel dimension attention feature map is globally mean pooled in the channel dimension and the width dimension, a second one-dimensional convolution is performed to extract the height dimension local cross-channel interaction feature map, and the calculation formula is:
[0031] , ,
[0032] ,
[0033] in, is the local cross-channel interaction feature map in the height dimension, is the second one-dimensional convolution, is the channel dimension attention feature map after global mean pooling, This is the channel dimension attention feature map after global mean pooling No. The element value of the column, Represents the second band matrix Middle Line The element value of the column, is the size of the second one-dimensional convolution, It means rounding to the odd number with the smallest difference from this number. H is the height of the input feature map. is the second band matrix;
[0034] After normalizing the height-dimensional local cross-channel interaction feature map, the channel information of the channel-dimensional attention feature map is activated by the element-wise product method through the normalized height-dimensional local cross-channel interaction feature map to obtain the height-dimensional attention feature map. The calculation formula is:
[0035] ,
[0036] in, is a high-dimensional attention feature map, is the element-wise product, is the Sigmoid activation function, is the channel dimension attention feature map.
[0037] Preferably, the global mean pooling of the channel dimension and the height dimension is performed on the high-dimensional attention feature map, and the calculation formula is:
[0038] ,
[0039] in, is the height dimension attention feature map after global mean pooling, C is the number of channels of the input feature map, H is the height of the input feature map, is a high-dimensional attention feature map The value of the pixel in the qth row and the ith column in the width dimension, where q represents the index in the channel direction and i represents the index in the height direction.
[0040] Preferably, after the global mean pooling of the channel dimension and the height dimension is performed on the height dimension attention feature map, the local cross-channel interaction feature of the width dimension is extracted through the third one-dimensional convolution, and the calculation formula is:
[0041] , ,
[0042] ,
[0043] in, is the local cross-channel interaction feature map in the width dimension, is the third one-dimensional convolution, is the high-dimensional attention feature map after global mean pooling, This is the high-dimensional attention feature map after global mean pooling. No. The element value of the column, Represents the third band matrix Middle Line The element value of the column, is the size of the third one-dimensional convolution, It means rounding to the odd number with the smallest difference from this number, W is the width of the input feature map, is the third band matrix;
[0044] After normalizing the width dimension local cross-channel interaction feature map, the element product method is used to activate the channel information of the height dimension attention feature map through the normalized width dimension local cross-channel interaction feature map to obtain the width dimension attention feature map. The calculation formula is:
[0045] ,
[0046] in, is the width dimension attention feature map, is the element-wise product, is the Sigmoid activation function, is a high-dimensional attention feature map.
[0047] Preferably, the global mean pooling of the height dimension and the width dimension is performed on the width dimension attention feature map, and the calculation formula is:
[0048] ,
[0049] in, is the width dimension attention feature map after global mean pooling, H is the height of the input feature map, W is the width of the input feature map, is the width dimension attention feature map The value of the pixel in the i-th row and j-th column in the channel dimension, where i represents the index in the height direction and j represents the index in the width direction.
[0050] Preferably, after the global mean pooling of the height dimension and the width dimension is performed on the width dimension attention feature map, the target local cross-channel interaction feature map is extracted through the first one-dimensional convolution, and the calculation formula is:
[0051] , ,
[0052] ,
[0053] in, is the target local cross-channel interaction feature map, is the first one-dimensional convolution, is the width dimension attention feature map after global mean pooling, This is the width dimension attention feature map after global mean pooling No. The element value of the column, Represents the first band matrix Middle Line The element value of the column, is the size of the first one-dimensional convolution, It means rounding to the odd number with the smallest difference from this number, C is the number of channels of the input feature map, is the first band matrix;
[0054] After the target local cross-channel interaction feature map is normalized, the channel information of the width dimension attention feature map is activated by the element product method through the normalized target local cross-channel interaction feature map to obtain a weighted feature map. The calculation formula is:
[0055] ,
[0056] in, is the weighted feature map, is the element-wise product, is the Sigmoid activation function, is the width dimension attention feature map.
[0057] Preferably, the backbone model is any one of ResNet-50, ResNet-101, MobileNetv3 and Yolov8-cls.
[0058] The above technical solution of the present invention has the following beneficial effects compared with the prior art:
[0059] The invention discloses a method for detecting a target of a drone based on an improved attention mechanism, wherein the detection result of the image to be detected collected by the drone is obtained by inputting the image to be detected into the target detection model; wherein the target detection model extracts features through a backbone model including an improved attention module; the improved attention module proposed in the invention extracts cross-channel interaction features layer by layer and combines global mean pooling and convolution operations to gradually generate a fine attention feature map. The input feature map is subjected to global mean pooling, and a local cross-channel interaction feature map is extracted through one-dimensional convolution. Then, after normalization, the element product activation method is used to fuse the feature map with the original input feature map, thereby generating an attention feature map of channel dimension, height dimension, and width dimension. Through multi-level feature extraction and step-by-step normalization, the mechanism effectively strengthens important features and suppresses redundant information, and realizes the fine capture of multi-scale and cross-channel information. By performing three-dimensional spatial attention and channel attention fusion extraction on the input feature map in channel dimension, height dimension, and width dimension, the generalization ability of the model is effectively enhanced. In order to address the problem that existing technologies are unable to balance model complexity and performance, global maximum pooling is excluded. Instead, global mean pooling operations are performed on different dimensions separately, and local cross-channel information interaction is performed through one-dimensional convolution in a single dimension. This reduces the complexity of the model and can more finely extract the feature interaction information between dimensions, effectively improving the accuracy of drone target detection and reducing the demand for computing resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to make the content of the present invention more clearly understood, the present invention is further described in detail below according to specific embodiments of the present invention in conjunction with the accompanying drawings, wherein:
[0061] Figure 1 It is a structural diagram of the improved attention module.
[0062] Figure 2 It is a schematic diagram of the process of acquiring the channel dimension attention feature map.
[0063] Figure 3 This is a schematic diagram of the target detection results of different models on the drone collection verification set.
[0064] Figure 4 It is a schematic diagram of embedding the improved attention module into different classification model networks.
[0065] Figure 5 This is a schematic diagram of the image classification results of different models on the drone collection verification set. DETAILED DESCRIPTION
[0066] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0067] Embodiment 1 of the present invention provides a method for detecting drone targets based on an improved attention mechanism, comprising the following steps:
[0068] Obtain an image to be detected collected by a drone, input the image to be detected into a backbone model of a target detection model to extract image features, and obtain a target detection result of the image to be detected based on the image features;
[0069] In this embodiment, specifically, the backbone model is any one of ResNet-50, ResNet-101, MobileNetv3 and Yolov8-cls.
[0070] like Figure 1 As shown, Figure 1 Structural diagram for the improved attention module.
[0071] The backbone model improves the attention module to input feature maps Perform fusion extraction of three-dimensional spatial attention information and channel attention information to obtain the weighted feature map of the input feature map ,include:
[0072] like Figure 2 As shown, Figure 2 Schematic diagram of the process of obtaining the channel dimension attention feature map. After global mean pooling of the height and width dimensions, the first one-dimensional convolution is used to extract the local cross-channel interaction feature map of the channel dimension. , the calculation formula is:
[0073] ,
[0074] Among them, y is the input feature map after global mean pooling, H is the height of the input feature map, and W is the width of the input feature map. The input feature map The value of the pixel in the i-th row and j-th column in the channel dimension, where i represents the index in the height direction and j represents the index in the width direction.
[0075] , ,
[0076] ,
[0077] in, is the local cross-channel interaction feature map in the channel dimension, is the first one-dimensional convolution, y is the input feature map after global mean pooling, is the first value of the input feature map y after global mean pooling The element value of the column, Represents the first band matrix Middle Line The element value of the column, is the size of the first one-dimensional convolution, It means rounding to the odd number with the smallest difference from this number, C is the number of channels of the input feature map, is the first band matrix;
[0078] After normalizing the local cross-channel interaction feature map in the channel dimension, the channel information of the input feature map is activated by the element product method through the normalized local cross-channel interaction feature map in the channel dimension to obtain the attention feature map in the channel dimension. The calculation formula is:
[0079] ,
[0080] in, is the channel dimension attention feature map, is the element-wise product, is the Sigmoid activation function, is the input feature map.
[0081] In order to learn the importance weights of the channel dimension, Using Sigmoid activation function Normalize the weight values to (0, 1).
[0082] Attention feature map for channel dimension After global mean pooling of the channel dimension and the width dimension, the second one-dimensional convolution is used to extract the local cross-channel interaction feature map of the height dimension. , the calculation formula is:
[0083] ,
[0084] in, is the channel dimension attention feature map after global mean pooling, C is the number of channels of the input feature map, W is the width of the input feature map, is the channel dimension attention feature map The value of the pixel in the qth row and jth column in the height dimension, where q represents the index in the channel direction and j represents the index in the width direction.
[0085] , ,
[0086] ,
[0087] in, is the local cross-channel interaction feature map in the height dimension, is the second one-dimensional convolution, is the channel dimension attention feature map after global mean pooling, This is the channel dimension attention feature map after global mean pooling No. The element value of the column, Represents the second band matrix Middle Line The element value of the column, is the size of the second one-dimensional convolution, It means rounding to the odd number with the smallest difference from this number. H is the height of the input feature map. is the second band matrix;
[0088] The height dimension is localized across channels to interact with the feature map After normalization, the normalized height-dimensional local cross-channel interaction feature map is used to obtain the channel-dimensional attention feature map using the element-wise product method. Activate the channel information to obtain a high-dimensional attention feature map , the calculation formula is:
[0089] ,
[0090] in, is a high-dimensional attention feature map, is the element-wise product, is the Sigmoid activation function, is the channel dimension attention feature map.
[0091] Attention feature map for high dimension After global mean pooling in the channel and height dimensions, the third one-dimensional convolution is used to extract the local cross-channel interaction features in the width dimension. , the calculation formula is:
[0092] ,
[0093] in, is the height dimension attention feature map after global mean pooling, C is the number of channels of the input feature map, H is the height of the input feature map, is a high-dimensional attention feature map The value of the pixel in the qth row and the ith column in the width dimension, where q represents the index in the channel direction and i represents the index in the height direction.
[0094] , ,
[0095] ,
[0096] in, is the local cross-channel interaction feature map in the width dimension, is the third one-dimensional convolution, is the high-dimensional attention feature map after global mean pooling, This is the high-dimensional attention feature map after global mean pooling. No. The element value of the column, Represents the third band matrix Middle Line The element value of the column, is the size of the third one-dimensional convolution, It means rounding to the odd number with the smallest difference from this number, W is the width of the input feature map, is the third band matrix;
[0097] The width dimension is locally transferred across the channel interaction feature map After normalization, the normalized width-dimension local cross-channel interaction feature map is used, and the element-wise product method is used to obtain the height-dimension attention feature map. The channel information is activated to obtain the width dimension attention feature map , the calculation formula is:
[0098] ,
[0099] in, is the width dimension attention feature map, is the element-wise product, is the Sigmoid activation function, is a high-dimensional attention feature map.
[0100] Attention feature map for width dimension After global mean pooling of the height and width dimensions, the first one-dimensional convolution is used to extract the target local cross-channel interaction feature map. , the calculation formula is:
[0101] ,
[0102] in, is the width dimension attention feature map after global mean pooling, H is the height of the input feature map, W is the width of the input feature map, is the width dimension attention feature map The value of the pixel in the i-th row and j-th column in the channel dimension, where i represents the index in the height direction and j represents the index in the width direction.
[0103] , ,
[0104] ,
[0105] in, is the target local cross-channel interaction feature map, is the first one-dimensional convolution, is the width dimension attention feature map after global mean pooling, This is the width dimension attention feature map after global mean pooling No. The element value of the column, Represents the first band matrix Middle Line The element value of the column, is the size of the first one-dimensional convolution, It means rounding to the odd number with the smallest difference from this number, C is the number of channels of the input feature map, is the first band matrix;
[0106] The target local cross-channel interaction feature map After normalization, the element-wise product method is used to obtain the width dimension attention feature map through the normalized target local cross-channel interaction feature map. The channel information is activated to obtain the weighted feature map , the calculation formula is:
[0107] ,
[0108] in, is the weighted feature map, is the element-wise product, is the Sigmoid activation function, is the width dimension attention feature map.
[0109] In this embodiment, the first band matrix For example, the first band matrix Specifically:
[0110] ,
[0111] in, The first band matrix The learnable parameters in row 1 and column 1 are The first band matrix The learnable parameters in row 2 and column 2 are The first band matrix No. 1 in line The learnable parameters of the column, The first band matrix No. 2 in line The learnable parameters of the column, The first band matrix In row C The learnable parameters of the column, The first band matrix The learnable parameters at row C and column C in .
[0112] In this embodiment, the training process of the target detection network is:
[0113] Real scene images containing several targets are collected by drones, and the real scene images are annotated to generate a training set, a verification set and a test set; the targets contained in the images in the training set are detected based on a target detection network, and image features are extracted by a convolutional neural network backbone model based on the improved attention module proposed in the present invention to complete the training of the target detection network; the images in the test set are detected using the trained target detection network to detect several targets contained in the real scene images, and a trained target detection network is obtained.
[0114] The present invention effectively enhances the generalization ability of the model by performing three-dimensional spatial attention and channel attention fusion extraction on the input feature map in the channel dimension, height dimension, and width dimension. In addition, in view of the problem that the existing technology cannot balance the model complexity and performance, the global maximum pooling is excluded. Instead, the global mean pooling operation is performed on different dimensions respectively, and local cross-channel information interaction is performed through a single-dimensional one-dimensional convolution, which reduces the model complexity and can more finely extract the feature interaction information between the dimensions, effectively improving the accuracy of drone target detection and reducing the demand for computing resources.
[0115] Embodiment 2 of the present invention is an application scenario example of the above-mentioned drone target detection method based on the improved attention mechanism. This embodiment 2 takes the Yolov8 detector with RestNet-50 and Yolov8n models as the backbone model as an example, and uses the drone collection data set to illustrate the target detection process. Target detection is a task in the field of computer vision, and its goal is to locate and identify multiple objects in an image or video, and determine the category of each object. Target detection plays a key role in many applications, such as autonomous driving, video surveillance, cell detection, face recognition, etc.
[0116] The short side of the input image is resized to a maximum size of 640, and random flip is used to perform data augmentation on the resized input image. The stochastic gradient descent method is selected as the optimizer, with a weight decay of 1e-4 and a momentum of 0.9. All models are trained 200 times in total. The initial learning rate is set to 0.01 and the final learning rate is 0.001.
[0117] In the target detection task of the drone dataset, the training set is used to train the backbone model embedded with the improved attention module. The input is image data, and the label contains the category of the object in the image and its corresponding bounding box information. The loss function of target detection consists of two parts: classification loss and positioning loss. The classification loss uses cross entropy loss to measure the difference between the predicted category and the true category, and the positioning loss uses smooth L1 loss to measure the deviation between the predicted bounding box and the true bounding box.
[0118] Through the back-propagation algorithm and gradient descent method, the parameters (i.e., weights) of the model are continuously adjusted and optimized until the value of the target loss function drops to the set threshold or reaches the predetermined training round, thus completing the training process of the backbone model embedded with the spatial and channel attention mechanism. In this process, the improved attention module helps the model find a balance between performance and complexity, thereby improving the detection effect.
[0119] After training is completed, the model is used to perform object detection on the images in the test set. The model will output the category label of each detected target and its corresponding bounding box coordinates, ultimately achieving the goal of the object detection task.
[0120] In this example, the same type of attention method is embedded in the same position under the same hyperparameter settings, and multiple parameters are compared based on the above backbone model. The results are as follows: Figure 3 As shown, Figure 3 Schematic diagram of target detection results of different models on the drone collection validation set.
[0121] according to Figure 3It can be seen that for the ResNet-50 backbone model, adding the improved attention module proposed in the present invention improves the mAP (0.5) accuracy by 1.96% and the mAP (0.5:0.95) accuracy by 1.21% compared with the original ResNet-50, while the FLOPs only increases by 0.01G. For the YOLOv8n backbone model, adding the improved attention module proposed in the present invention improves the mAP (0.5) accuracy by 1.67% and the mAP (0.5:0.95) accuracy by 0.72% compared with the original YOLOv8-cls. The best representation ability has been achieved among similar attention methods. From the above analysis, it can be seen that the model with the improved attention mechanism embedded in the target detection task has achieved a better balance between accuracy and operating efficiency.
[0122] The improved attention module provided by the embodiment of the present invention can also be used for image classification. Image classification is an important task in computer vision, and its goal is to assign images to predefined categories. This task has a wide range of applications in many fields, including medical image analysis, security monitoring, autonomous driving, etc.
[0123] In this second embodiment, the backbone models RestNet-50, RestNet-101, MobileNetv3 and Yolov8-cls models are taken as examples, and the drone collection data set is used to illustrate the image classification process.
[0124] The image size was resized to 224×224, and the random flip method was used for data enhancement in the horizontal direction. The stochastic gradient descent method was selected as the optimizer, the weight decay was 1E-4, the momentum was 0.9, and all models were trained for 24 rounds. The initial learning rate was 0.01 and the final learning rate was 0.001. The spatial and channel attention methods that weighed performance and complexity were embedded in the 11th, 23rd, and 41st layers of the ResNet-50 model, thus obtaining the backbone model with the spatial and channel attention methods, and the classifier was the fully connected layer.
[0125] like Figure 4 As shown, Figure 4 The diagram is a schematic diagram of embedding the improved attention module into different classification model networks. The training set in the drone acquisition dataset is used to train the backbone model embedded with the improved attention module. The input is the image in the training set, and the label is the category of each image. The cross entropy loss between the model output value and the label is used as the objective function. The weights in the model are continuously calculated and updated through the back propagation algorithm and the gradient descent method until the loss value of the objective function is lower than the set threshold or the predetermined training round is reached, thereby completing the training of the backbone model embedded with the spatial and channel attention method that balances performance and complexity.
[0126] After the model training is completed, the trained model is used to infer the images in the test set. The model will output the category label of each image, thus completing the image classification task.
[0127] In order to more directly demonstrate the advantages of the method proposed in the present invention in terms of model lightweight and model generalization ability, this embodiment embeds the same type of attention method in the same position under the same hyperparameter settings, and compares multiple parameters based on the above backbone model. The results are as follows: Figure 5 As shown, Figure 5 Schematic diagram of image classification results of different models on the drone collection validation set.
[0128] Depend on Figure 5 It can be seen that the method proposed in this paper only increases FLOPs by 0.14% and inference time by 0.55ms, but improves TOP-1 accuracy by 6.33% and TOP-5 accuracy by 3.25%, achieving the best representation capability among similar attention methods.
[0129] The second embodiment of the present invention applies the improved attention module proposed in the UAV target detection task and the image classification task, and embeds the same attention method in the same position under the same hyperparameter settings, and compares it with the improved attention module proposed in the present invention. It fully demonstrates that the present invention has significantly improved the accuracy and minimally affected the operating efficiency among the same attention methods, effectively optimizes the model performance, and achieves a good balance between accuracy and operating efficiency.
[0130] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0131] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1A device that provides the functions specified in a block or multiple blocks.
[0132] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0133] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0134] Obviously, the above embodiments are merely examples for the purpose of clear explanation and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the present invention.
Claims
1. A drone target detection method based on an improved attention mechanism, characterized in that: The following steps are involved: Obtain an image to be detected collected by a drone, input the image to be detected into a backbone model of a target detection model to extract image features, and obtain a target detection result of the image to be detected based on the image features; The backbone model extracts the fusion of three-dimensional spatial attention information and channel attention information of the input feature map by improving the attention module to obtain a weighted feature map of the input feature map, including: After performing global mean pooling on the input feature map in the height and width dimensions, the first one-dimensional convolution is used to extract the local cross-channel interaction feature map in the channel dimension. After normalizing the local cross-channel interaction feature map in the channel dimension, the channel information of the input feature map is activated by the element product method through the normalized local cross-channel interaction feature map in the channel dimension to obtain the attention feature map in the channel dimension; After performing global mean pooling on the channel dimension and width dimension of the channel dimension attention feature map, the second one-dimensional convolution is performed to extract the height dimension local cross-channel interaction feature map; After normalizing the high-dimensional local cross-channel interaction feature map, the channel information of the channel-dimensional attention feature map is activated by the element-wise product method through the normalized high-dimensional local cross-channel interaction feature map to obtain the high-dimensional attention feature map; After performing global mean pooling on the channel dimension and the height dimension for the attention feature map in the height dimension, the local cross-channel interaction feature map in the width dimension is extracted through the third one-dimensional convolution; After normalizing the local cross-channel interaction feature map in the width dimension, the channel information of the attention feature map in the height dimension is activated by the element product method through the normalized local cross-channel interaction feature map in the width dimension to obtain the attention feature map in the width dimension; After performing global mean pooling of the height and width dimensions on the width dimension attention feature map, the target local cross-channel interaction feature map is extracted through the first one-dimensional convolution; After normalizing the target local cross-channel interaction feature map, the element-wise product method is used to activate the channel information of the width dimension attention feature map through the normalized target local cross-channel interaction feature map to obtain a weighted feature map.
2. The method for detecting drone targets based on an improved attention mechanism according to claim 1, characterized in that: Perform global mean pooling on the input feature map in the height and width dimensions, and the calculation formula is: , Among them, y is the input feature map after global mean pooling, H is the height of the input feature map, and W is the width of the input feature map. The input feature map The value of the pixel in the i-th row and j-th column in the channel dimension, where i represents the index in the height direction and j represents the index in the width direction.
3. The method for detecting drone targets based on an improved attention mechanism according to claim 1, characterized in that: After performing global mean pooling on the input feature map in the height dimension and the width dimension, the local cross-channel interaction feature map in the channel dimension is extracted through the first one-dimensional convolution. The calculation formula is: , , , in, is the local cross-channel interaction feature map in the channel dimension, is the first one-dimensional convolution, y is the input feature map after global mean pooling, is the first value of the input feature map y after global mean pooling The element value of the column, Represents the first band matrix Middle Line The element value of the column, is the size of the first one-dimensional convolution, It means rounding to the odd number with the smallest difference from this number, C is the number of channels of the input feature map, is the first band matrix; After normalizing the local cross-channel interaction feature map of the channel dimension, the channel information of the input feature map is activated by the element product method through the normalized local cross-channel interaction feature map of the channel dimension to obtain the attention feature map of the channel dimension. The calculation formula is: , in, is the channel dimension attention feature map, is the element-wise product, is the Sigmoid activation function, is the input feature map.
4. The method for detecting drone targets based on an improved attention mechanism according to claim 1, characterized in that: The channel dimension attention feature map is globally averaged pooled in the channel dimension and width dimension. The calculation formula is: , in, is the channel dimension attention feature map after global mean pooling, C is the number of channels of the input feature map, W is the width of the input feature map, is the channel dimension attention feature map The value of the pixel in the qth row and jth column in the height dimension, where q represents the index in the channel direction and j represents the index in the width direction.
5. The method for detecting drone targets based on an improved attention mechanism according to claim 1, characterized in that: After the channel dimension attention feature map is globally mean pooled in the channel dimension and the width dimension, the local cross-channel interaction feature map in the height dimension is extracted through the second one-dimensional convolution. The calculation formula is: , , , in, is the local cross-channel interaction feature map in the height dimension, is the second one-dimensional convolution, is the channel dimension attention feature map after global mean pooling, This is the channel dimension attention feature map after global mean pooling No. The element value of the column, Represents the second band matrix Middle Line The element value of the column, is the size of the second one-dimensional convolution, It means rounding to the odd number with the smallest difference from this number. H is the height of the input feature map. is the second band matrix; After normalizing the height-dimensional local cross-channel interaction feature map, the channel information of the channel-dimensional attention feature map is activated by the element-wise product method through the normalized height-dimensional local cross-channel interaction feature map to obtain the height-dimensional attention feature map. The calculation formula is: , in, is a high-dimensional attention feature map, is the element-wise product, is the Sigmoid activation function, is the channel dimension attention feature map.
6. The method for detecting drone targets based on an improved attention mechanism according to claim 1, characterized in that: The global mean pooling of the channel dimension and the height dimension is performed on the high-dimensional attention feature map. The calculation formula is: , in, is the height dimension attention feature map after global mean pooling, C is the number of channels of the input feature map, H is the height of the input feature map, is a high-dimensional attention feature map The value of the pixel in the qth row and the ith column in the width dimension, where q represents the index in the channel direction and i represents the index in the height direction.
7. The method for detecting drone targets based on an improved attention mechanism according to claim 1, characterized in that: After the global mean pooling of the channel dimension and the height dimension is performed on the height dimension attention feature map, the local cross-channel interaction feature map of the width dimension is extracted through the third one-dimensional convolution. The calculation formula is: , , , in, is the local cross-channel interaction feature map in the width dimension, is the third one-dimensional convolution, is the high-dimensional attention feature map after global mean pooling, This is the high-dimensional attention feature map after global mean pooling. No. The element value of the column, Represents the third band matrix Middle Line The element value of the column, is the size of the third one-dimensional convolution, It means rounding to the odd number with the smallest difference from this number, W is the width of the input feature map, is the third band matrix; After normalizing the width dimension local cross-channel interaction feature map, the element product method is used to activate the channel information of the height dimension attention feature map through the normalized width dimension local cross-channel interaction feature map to obtain the width dimension attention feature map. The calculation formula is: , in, is the width dimension attention feature map, is the element-wise product, is the Sigmoid activation function, is a high-dimensional attention feature map.
8. The method for detecting drone targets based on an improved attention mechanism according to claim 1, characterized in that: The global mean pooling of the height dimension and the width dimension is performed on the width dimension attention feature map. The calculation formula is: , in, is the width dimension attention feature map after global mean pooling, H is the height of the input feature map, W is the width of the input feature map, is the width dimension attention feature map The value of the pixel in the i-th row and j-th column in the channel dimension, where i represents the index in the height direction and j represents the index in the width direction.
9. The method for detecting drone targets based on an improved attention mechanism according to claim 1, characterized in that: After performing global mean pooling of the height dimension and the width dimension on the width dimension attention feature map, the target local cross-channel interaction feature map is extracted through the first one-dimensional convolution. The calculation formula is: , , , in, is the target local cross-channel interaction feature map, is the first one-dimensional convolution, is the width dimension attention feature map after global mean pooling, This is the width dimension attention feature map after global mean pooling No. The element value of the column, Represents the first band matrix Middle Line The element value of the column, is the size of the first one-dimensional convolution, It means rounding to the odd number with the smallest difference from this number, C is the number of channels of the input feature map, is the first band matrix; After the target local cross-channel interaction feature map is normalized, the channel information of the width dimension attention feature map is activated by the element product method through the normalized target local cross-channel interaction feature map to obtain a weighted feature map. The calculation formula is: , in, is the weighted feature map, is the element-wise product, is the Sigmoid activation function, is the width dimension attention feature map.
10. The method for detecting drone targets based on an improved attention mechanism according to claim 1, characterized in that: The backbone model is any one of ResNet-50, ResNet-101, MobileNetv3 and Yolov8-cls.
Citation Information
Patent Citations
Pavement obstacle detection method based on YoloV4 improvement
CN116363627A
Small moving unmanned aerial vehicle optical detection method and system based on deep neural network
CN117095313A