Military aircraft detection method and model based on YOLOv8n, electronic equipment and storage medium
Through adaptive lightweight downsampling and content-guided attention mechanism, the feature extraction and fusion of the YOLOv8n model is optimized, which solves the problem of loss of detailed information in small object detection of lightweight models, improves detection accuracy and accuracy, and is applicable in the drone environment.
Patent Information
- Application Number
- CN202411476561.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-01-10
AI Technical Summary
The lightweight target detection model YOLOv8n is prone to loss of detailed information in small target detection, resulting in missed detection and reduced accuracy, and cannot meet the needs of drones for high-precision small target detection in military reconnaissance.
Adaptive lightweight downsampling and content-guided attention mechanism are adopted, adaptive lightweight downsampling and feature extraction are performed alternately, combined with spatial feature pyramids for pooling, dynamically screening key features, and feature features through content-guided attention Capture, optimize feature fusion and recognition.
It significantly reduces feature loss, improves detection accuracy and accuracy of small targets, reduces the amount of model parameters, and is suitable for resource-constrained drone environments.
Smart Images

Figure CN119295766A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of target detection, and in particular to a military aircraft detection method, model, electronic equipment and computer storage medium based on YOLOv8n. Background Art
[0002] With the continuous development of intelligent manufacturing technology, UAV cooperative operations have shown efficient combat potential and strong decision-making capabilities. In particular, UAVs can not only play a role in battlefield reconnaissance and surveillance, but also perform target search and positioning tasks, providing key information support for combat operations. Accordingly, in the field of military reconnaissance, the deployment of UAVs helps to accurately grasp the intelligence information of both the enemy and us: for our military aircraft, UAV target detection can effectively assist ground crews in statistics and monitoring, and provide sufficient information to support strategic deployment, military management and combat readiness decisions; for enemy military aircraft, especially models with stealth capabilities, it is necessary to rely on the optical monitoring information of UAVs for effective detection.
[0003] Based on this, by deploying the YOLOv8 (You Only Look Once Version 8) target detection model in the prior art to drones, the deployed drones can efficiently detect military aircraft by cruising. However, military aircraft are often small targets in aerial images. When using the lightweight target detection model YOLOv8n, the detection effect is poor and it is easy to miss detections; while using the large target detection model YOLOv8l can improve accuracy, it will significantly increase the requirements for real-time performance and computing power, especially on drones, which can easily lead to problems such as reduced drone endurance and poor heat dissipation.
[0004] In order to reduce the computational burden, the lightweight target detection model YOLOv8n in the prior art usually needs to reduce the number of channels of the convolutional layer. Therefore, when the feature map with such a low number of channels is excessively downsampled, the originally limited features will be further compressed, and it is impossible to effectively retain the key information in the input detection image. In particular, in the detection of small targets, detail information (such as edges and textures) is easily lost, resulting in missed detections and decreased accuracy, which cannot meet the needs of drones for lightweight and high-precision small target detection in military reconnaissance. Summary of the invention
[0005] Based on this, the purpose of the present invention is to provide a military aircraft detection method based on YOLOv8n.
[0006] A military aircraft detection method based on YOLOv8n, comprising the following steps:
[0007] S1: Adaptively perform lightweight downsampling and feature extraction alternately on the preprocessed image to be detected, and perform pooling through a spatial feature pyramid to obtain middle-layer, deep-layer and aggregated feature maps respectively; wherein the specific expression of alternately performing adaptive lightweight downsampling and feature extraction is as follows:
[0008]
[0009] F n =C2f(F n-1 )
[0010] In the formula, F n is the feature map after the current feature extraction, F n-1 is the feature map after downsampling; C2f(·) is the feature extraction operation; GroupConv2d(·) is the group convolution operation; AvgPool(·) is the average pooling operation; Conv2d is the two-dimensional convolution operation on the pooled features; ⊙ is the element-by-element multiplication operation; ∑ dim=-1 (·) is used to sum the last dimension of the weighted features;
[0011] S2: Continuously perform upsampling feature fusion on the aggregated, deep and middle-layer feature maps to obtain preliminary fusion feature maps and shallow fusion feature maps; Adaptive lightweight downsampling is used to continuously fuse the shallow fusion feature maps with the preliminary fusion feature maps and the aggregated feature maps to obtain middle-layer and deep fusion feature maps;
[0012] S3: Use content-guided attention to capture the features of the shallow fusion feature map and the middle-layer feature map, the middle-layer fusion feature map and the deep feature map, and the deep fusion feature map and the aggregated feature map, and identify the military aircraft in the image to be detected.
[0013] The military aircraft detection method based on YOLOv8n described in the present invention dynamically considers the importance of different areas in the feature map during the downsampling process through adaptive lightweight downsampling, thereby extracting important key information and significantly reducing the feature loss problem caused by traditional downsampling; at the same time, introducing adaptive lightweight downsampling in the feature pyramid can actively screen key features, optimize the efficiency and accuracy of feature fusion, and enhance the model's ability to capture small targets.
[0014] Furthermore, the specific representation of using content to guide attention for feature capture and recognition is:
[0015]
[0016] In the formula, T represents the target obtained by identifying the features; F FPN It can be selected as shallow, medium or deep fusion feature map, F BackboneIt is expressed as FPN The mid-level, deep-level, or aggregated feature maps of the corresponding scales; is element-wise addition, is element-by-element multiplication; Conv 1×1 is the convolution operation of 1×1 convolution kernel; Detect is the recognition operation; W T is the key feature weight of the target, which is obtained by content-guided attention calculation. The specific calculation is as follows:
[0017] W T =σ(GroupConv 7×7 (CShuffle(Concat(W CA , X))))
[0018] In the formula, CShuffle is the channel shuffle operation; GroupConv 7×7 is a grouped convolution operation with a convolution kernel size of 7×7; σ is the Sigmoid activation function; X is the FPN The fusion feature map of the corresponding scale is calculated as follows:
[0019]
[0020] W CA is the fusion weight, which is calculated as follows:
[0021] W CA =W C +W A
[0022] Where W C is the channel feature weight, and its specific calculation is as follows:
[0023]
[0024] Among them, max(0,·) is the ReLU activation function, which is used to generate positive features; Represented as fusion features Figure X Perform a global average pooling operation across channel dimensions; and W S is the spatial feature weight, and its specific calculation is as follows:
[0025]
[0026] in, Respectively represent the fusion features Figure X Perform cross-space global average pooling operations and cross-space global maximum pooling operations.
[0027] The present invention adopts the content-guided attention mechanism to capture the features of the fused feature maps and the unfused feature maps in the feature pyramid, so that the model can more accurately find key information in feature maps of different scales, thereby reducing the feature loss and comprehensively improving the feature capture capability of small targets.
[0028] Furthermore, the step S1 includes the following sub-steps:
[0029] S11: Use convolution to preprocess and extract features of the image to be detected to obtain a shallow feature map;
[0030] S12: Adaptively perform lightweight downsampling and feature extraction on the shallow feature map to obtain the middle feature map;
[0031] S13: Perform adaptive lightweight downsampling and feature extraction on the middle-layer feature map to obtain a deep-layer feature map;
[0032] S14: Adaptively perform lightweight downsampling and feature extraction on the deep feature map, and perform pooling through the spatial feature pyramid to obtain an aggregated feature map;
[0033] The step S2 comprises the following sub-steps:
[0034] S21: upsampling the aggregated feature map, and fusing it with the deep feature map to obtain a preliminary fused feature map;
[0035] S22: upsampling the preliminary fusion feature map, and performing feature fusion on it and the middle-layer feature map to obtain a shallow-layer fusion feature map;
[0036] S23: Adaptively and lightly downsample the shallow fusion feature map, and fuse it with the preliminary fusion feature map to obtain a middle-layer fusion feature map;
[0037] S24: Adaptively perform lightweight downsampling on the middle-layer fusion feature map, and perform feature fusion on it and the aggregated feature map to obtain a deep-layer fusion feature map.
[0038] The present invention adopts adaptive lightweight downsampling in multiple scales to significantly improve the detection accuracy of small targets.
[0039] Furthermore, the step S3 includes the following sub-steps:
[0040] S31: Use content-guided attention to capture the deep fusion feature map and the aggregated feature map, and perform feature recognition to obtain small-scale targets;
[0041] S32: Use content-guided attention to capture the features of the middle-layer fusion feature map and the deep-layer feature map, and perform feature recognition to obtain the mesoscale target;
[0042] S33: Use content-guided attention to capture the features of the shallow fusion feature map and the middle-level feature map, and perform feature recognition to obtain large-scale targets;
[0043] S34: Integrate the small, medium and large-scale targets to identify the military aircraft in the image to be detected; wherein the target integration is specifically represented as follows:
[0044] T fin =NMS(T small , T medium , T Large )
[0045] Where, T fin is the target integration result; NMS is non-maximum suppression.
[0046] A military aircraft detection model based on YOLOv8n, including a backbone network, a neck network, and a detection head network;
[0047] The backbone network is used to alternately perform adaptive lightweight downsampling and feature extraction on the preprocessed image to be detected, and perform pooling through a spatial feature pyramid to obtain middle-layer, deep-layer and aggregated feature maps respectively; wherein the specific expression of alternately performing adaptive lightweight downsampling and feature extraction is as follows:
[0048]
[0049] F n =C2f(F n-1 )
[0050] In the formula, F n is the feature map after the current feature extraction, F n-1 is the feature map after downsampling; C2f(·) is the feature extraction operation; GroupConv2d(·) is the group convolution operation; AvgPool(·) is the average pooling operation; Conv2d is the two-dimensional convolution operation on the pooled features; ⊙ is the element-by-element multiplication operation; ∑ dim=-1 (·) is used to sum the last dimension of the weighted features;
[0051] The neck network is used to continuously perform upsampling feature fusion on the aggregate, deep and middle layer feature maps to obtain a preliminary fusion feature map and a shallow fusion feature map; and to continuously perform feature fusion on the shallow fusion feature map with the preliminary fusion feature map and the aggregate feature map using adaptive lightweight downsampling to obtain middle and deep fusion feature maps;
[0052] The detection head network is used to use content-guided attention to capture features of shallow-layer fusion feature maps and middle-layer feature maps, middle-layer fusion feature maps and deep-layer feature maps, and deep-layer fusion feature maps and aggregated feature maps, and identify military aircraft in the image to be detected.
[0053] Furthermore, the specific representation of using content to guide attention for feature capture and recognition is:
[0054]
[0055] In the formula, T represents the target obtained by identifying the features; F FPN It can be selected as shallow, medium or deep fusion feature map, F Backbone It is expressed as FPN The mid-level, deep-level, or aggregated feature maps of the corresponding scales; is element-wise addition, is element-by-element multiplication; Conv 1×1 is the convolution operation of 1×1 convolution kernel; Detect is the recognition operation; W T is the key feature weight of the target, which is obtained by content-guided attention calculation. The specific calculation is as follows:
[0056] W T =σ(GroupConv 7×7 (CShuffle(Concat(W CA , X))))
[0057] In the formula, CShuffle is the channel shuffle operation; GroupConv 7×7 is a grouped convolution operation with a convolution kernel size of 7×7; σ is the Sigmoid activation function; X is the FPN The fusion feature map of the corresponding scale is calculated as follows:
[0058]
[0059] W CA is the fusion weight, which is calculated as follows:
[0060] W CA =W C +W A
[0061] Where W C is the channel feature weight, and its specific calculation is as follows:
[0062]
[0063] Among them, max(0, ) is the ReLU activation function, which is used to generate positive features; Represented as fusion features Figure X Perform a global average pooling operation across channel dimensions; and W S is the spatial feature weight, and its specific calculation is as follows:
[0064]
[0065] in, Respectively represent the fusion features Figure X Perform cross-space global average pooling operations and cross-space global maximum pooling operations.
[0066] Furthermore, the backbone network includes a shallow feature extraction module, an adaptive middle feature extraction module, an adaptive deep feature extraction module and an adaptive feature aggregation module;
[0067] The shallow feature extraction module is used to perform preprocessing and feature extraction on the image to be detected by using convolution to obtain a shallow feature map;
[0068] The adaptive middle-layer feature extraction module is used to perform adaptive lightweight downsampling and feature extraction on the shallow feature map to obtain the middle-layer feature map;
[0069] The adaptive deep feature extraction module is used to perform adaptive lightweight downsampling and feature extraction on the middle-layer feature map to obtain a deep feature map;
[0070] The adaptive feature aggregation module is used to perform adaptive lightweight downsampling and feature extraction on the deep feature map, and to obtain an aggregated feature map by pooling through a spatial feature pyramid;
[0071] The neck network includes a preliminary feature fusion module, a shallow feature fusion module, an adaptive middle feature fusion module and an adaptive deep feature fusion module;
[0072] The preliminary feature fusion module is used to upsample the aggregated feature map and perform feature fusion on it with the deep feature map to obtain a preliminary fused feature map;
[0073] The shallow feature fusion module is used to upsample the preliminary fusion feature map and perform feature fusion on it with the middle-layer feature map to obtain a shallow fusion feature map;
[0074] The adaptive middle-layer feature fusion module is used to adaptively and lightweight downsample the shallow-layer fusion feature map, and fuse it with the preliminary fusion feature map to obtain a middle-layer fusion feature map;
[0075] The adaptive deep feature fusion module is used to perform adaptive lightweight downsampling on the middle-layer fusion feature map, and perform feature fusion on the middle-layer fusion feature map with the aggregated feature map to obtain a deep fusion feature map;
[0076] The detection head network includes a small-scale feature capture and recognition module, a medium-scale feature capture and recognition module, a large-scale feature capture and recognition module and a target integration module;
[0077] The small-scale feature capture and recognition module is used to capture features of the deep fusion feature map and the aggregated feature map by using content-guided attention, and perform feature recognition to obtain a small-scale target;
[0078] The mesoscale feature capture and recognition module is used to capture the features of the middle-layer fusion feature map and the deep-layer feature map by using content-guided attention, and perform feature recognition to obtain the mesoscale target;
[0079] The large-scale feature capture and recognition module is used to capture the shallow fusion feature map and the middle-layer feature map by using content-guided attention, and perform feature recognition to obtain a large-scale target;
[0080] The target integration module is used to integrate small, medium and large-scale targets and identify military aircraft in the image to be detected; wherein the target integration is specifically expressed as follows:
[0081] T fin =NMS(T small , T medium , T Large )
[0082] Where, T fin is the target integration result; NMS is non-maximum suppression.
[0083] Furthermore, the trainable parameters in the backbone network, the neck network and the detection head network are trained by the following steps:
[0084] T1: collects a dataset containing military aircraft images;
[0085] T2: Label the images in the dataset and divide them into training set, validation set and test set according to the ratio of 7:2:1;
[0086] T3: training the images in the training set by using the YOLOv8n-based military aircraft detection model to obtain training detection results;
[0087] T4: Use stochastic gradient descent to calculate the loss of the training test results and the corresponding labels in the training set to obtain the loss value;
[0088] T5: Update the weights of the trainable parameters of the YOLOv8n-based military aircraft detection model according to the loss value, and determine whether the current YOLOv8n-based military aircraft detection model has reached a training threshold: if so, complete the training to obtain a high-accuracy YOLOv8n-based military aircraft detection model; if not, execute step T3.
[0089] For better understanding and implementation, the present invention is described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0090] Figure 1 A simplified flowchart of the military aircraft detection method based on YOLOv8n described in the present invention;
[0091] Figure 2 It is a specific structural schematic diagram of the military aircraft detection model based on YOLOv8n described in the present invention;
[0092] Figure 3 It is a specific flow chart of the military aircraft detection method based on YOLOv8n described in the present invention;
[0093] Figure 4 This is a schematic diagram of an overall structure example of the military aircraft detection model based on YOLOv8n according to the present invention;
[0094] Figure 5 This is a schematic diagram of an example structure of the adaptive lightweight downsampling according to the present invention;
[0095] Figure 6 A schematic diagram of an example structure of feature capture according to the present invention;
[0096] Figure 7 A schematic diagram of an example structure for guiding attention to content captured by features according to the present invention;
[0097] Figures 8 to 11 Schematic diagram of an example of the detection result of the present invention. DETAILED DESCRIPTION
[0098] In order to solve the problems of easy loss of detail information, missed detection and decreased accuracy of the lightweight target detection model YOLOv8n in small target detection, the present invention adopts adaptive lightweight downsampling to replace the downsampling layer in the target detection model YOLOv8n, so that the backbone network (Backbone) in the model alternately performs feature extraction and adaptive lightweight downsampling on the preprocessed image to be detected, as well as spatial feature pyramid (Spatial Pyramid Pooling, SPP) processing to obtain middle, deep and aggregated feature maps respectively; and the neck network (Neck) in the model performs feature fusion on the middle, deep and aggregated feature maps through a feature pyramid based on adaptive lightweight downsampling to obtain shallow, middle and deep fused feature maps; finally, the detection head network (Head) of the model performs feature capture through content-guided attention (Content-GuidedAttention, CGA) and identifies the military aircraft in the image to be detected. Based on this, the present invention uses adaptive lightweight downsampling to effectively retain the detail information of the feature map while reducing the amount of parameters, and combines the content to guide attention to accurately capture effective features, thereby improving the detection accuracy of small targets.
[0099] Please also see Figure 1 , 2 , 3 and 4, Figure 1 It is a simplified flow chart of the military aircraft detection method based on YOLOv8n described in the present invention. Figure 2 : is a schematic diagram of the specific structure of the military aircraft detection model based on YOLOv8n according to the present invention, Figure 3 : is a specific flow chart of the military aircraft detection method based on YOLOv8n described in the present invention, Figure 4 This is a schematic diagram of an overall structural example of the military aircraft detection model based on YOLOv8n described in the present invention.
[0100] Based on the above design, the present invention proposes a military aircraft detection method based on YOLOv8n, and based on this method proposes a military aircraft detection model based on YOLOv8n.
[0101] The military aircraft detection model based on YOLOv8n includes a backbone network 1, a neck network 2 and a detection head network 3.
[0102] The backbone network 1 is used to execute step S1: alternately perform adaptive lightweight downsampling and feature extraction on the preprocessed image to be detected, and perform pooling through a spatial feature pyramid to obtain middle-layer, deep-layer and aggregated feature maps respectively.
[0103] Specifically, the specific expression of alternating adaptive lightweight downsampling and feature extraction is as follows:
[0104]
[0105] F n =C2f(F n-1 )
[0106] In the formula, F n is the feature map after the current feature extraction, F n-1 is the feature map after downsampling; C2f(·) is the feature extraction operation; GroupConv2d(·) is the group convolution operation; AvgPool(·) is the average pooling operation; Conv2d is the two-dimensional convolution operation on the pooled features; ⊙ is the element-by-element multiplication operation; ∑ dim=-1 (·) is used to sum the last dimension of the weighted features.
[0107] The backbone network 1 includes a shallow feature extraction module 11 , an adaptive middle feature extraction module 12 , an adaptive deep feature extraction module 13 and an adaptive feature aggregation module 14 .
[0108] The shallow feature extraction module 11 is used to execute step S11: preprocessing and feature extraction of the image to be detected by using convolution to obtain a shallow feature map.
[0109] Specifically, a 3×3 convolution kernel is used to preprocess the color image to be detected to increase the number of channels, thereby obtaining a preprocessing feature map. The specific calculation expression of the preprocessing feature map F1 is as follows:
[0110] F0=SiLU(BN(Conv2d(Picture)))
[0111] F1 = SiLU(BN(Conv2d(F0)))
[0112] Wherein, Picture is the image to be detected, with 3 channels and a size of H×W; F0 is the preprocessed intermediate feature map, with 64 channels and a size of H / 2×W / 2; F1 is the preprocessed feature map, with 128 channels and a size of H / 4×W / 4; Conv2d(·) is a two-dimensional convolution operation with a convolution kernel of 3×3; BN is a two-dimensional normalization operation; SiLU(·) is the activation function (Sigmoid Linear Unit).
[0113] Next, the C2f module is used to extract the features of the preprocessed feature map F1 to obtain a shallow feature map. The specific calculation expression of the shallow feature map F2 is as follows:
[0114] F2=C2f(F1)
[0115] Where F2 is a shallow feature map with 128 channels and a size of H / 4×W / 4. The C2f module extracts features from the preprocessed feature map F1 through convolution, segmentation, several Bottleneck structures, splicing, and convolution operations.
[0116] Since the C2f module is common knowledge in the art and is not the main improvement of the present invention, the present invention does not specifically expand the content of the C2f module here.
[0117] See also Figure 5 , Figure 5 A schematic diagram of an example structure of the adaptive lightweight downsampling described in the present invention.
[0118] The adaptive middle-layer feature extraction module 12 is used to execute step S12: adaptively perform lightweight downsampling and feature extraction on the shallow feature map to obtain a middle-layer feature map.
[0119] Specifically, the specific calculation expression of the middle-level feature map F4 is as follows:
[0120]
[0121] F4=C2f(F3)
[0122] Where F3 is a shallow downsampling feature map with 256 channels and a size of H / 8×W / 8; F4 is a mid-level feature map with 256 channels and a size of H / 8×W / 8, and the stride of C2f(·) is 8; GroupConv2d(·) is a grouped convolution operation with a convolution kernel of 3×3 and a stride of 2, which is used to achieve spatial dimensionality reduction; AvgPool(·) is an average pooling operation with a pooling window size of 3×3 and a stride of 1, and Conv2d 1×1 To perform two-dimensional convolution on the pooled features, the convolution kernel is 1×1. The importance of different parts of the input features is evaluated through the combined effect of average pooling and convolution operations; ⊙ is an element-by-element multiplication operation, which is used to accurately weight the features extracted by group convolution using the weight matrix obtained by feature selection; ∑ dim=-1 (·) is used to sum the last dimension of the weighted features to achieve aggregation of different weighted features.
[0123] Based on this, the present invention combines average pooling and convolution operations to perform feature selection, and generates a weight matrix by evaluating the features to dynamically evaluate the importance of different regions in the input feature map. At the same time, the weight matrix can adaptively adjust the weights according to the content of the features, thereby improving the adaptability of the model in diverse scenarios and ensuring that the computational efficiency is optimized while maintaining the detection accuracy.
[0124] At the same time, the present invention uses grouped convolution to decompose the convolution operation into several independent groups for calculation, reducing the number of channels processed in each group, thereby greatly reducing the number of parameters, and through grouped convolution, spatial dimension reduction of features is achieved, and the feature map is converted into a feature map with smaller dimension and more concentrated information, and its feature map is combined with the weight matrix to achieve precise weighting, so that the features can still retain key detail information in the state of dimensionality reduction;
[0125] In particular, the present invention further optimizes the effectiveness of feature representation by performing feature aggregation in the last dimension of weighted features, so that the model can retain key information to the greatest extent while compressing feature maps, thereby significantly improving the detection effect of the model; at the same time, adaptive weighting continuously learns and optimizes feature selection strategies during the training process, ensuring that the model can perform detection tasks with high precision when facing different input scenarios.
[0126] The adaptive deep feature extraction module 13 is used to execute step S13: adaptively perform lightweight downsampling and feature extraction on the middle-layer feature map to obtain a deep feature map.
[0127] Specifically, the specific calculation expression of the deep feature map F6 is as follows:
[0128]
[0129] F6=C2f(F5)
[0130] Where F5 is the middle-layer downsampled feature map with 512 channels and a size of H / 16×W / 16; F6 is the deep-layer feature map with 512 channels and a size of H / 16×W / 16, and the step size of the C2f(·) operation is 16.
[0131] Since the calculation contents of adaptive lightweight downsampling and feature extraction are consistent with the above contents, the present invention will not be described in detail here.
[0132] The adaptive feature aggregation module 14 is used to execute step S14: adaptively perform lightweight downsampling and feature extraction on the deep feature map, and perform pooling through a spatial feature pyramid to obtain an aggregated feature map.
[0133] Specifically, the specific calculation expression of the aggregate feature graph F9 is as follows:
[0134]
[0135] F8=C2f(F7)
[0136] F9=SPPF(F8)
[0137] In the formula, F7 is a deep downsampling feature map with 512 channels and a size of H / 32×W / 32; F6 is a deep intermediate feature map with 512 channels and a size of H / 32×W / 32; F9 is an aggregated feature map with 512 channels and a size of H / 32×W / 32, and the step size of the spatial feature pyramid pooling SPPF operation is 32. The SPPF operation is used for multi-scale feature aggregation to enhance the perception of the target.
[0138] Since the calculation contents of adaptive lightweight downsampling and feature extraction are consistent with the above contents, the present invention will not be described in detail here.
[0139] Accordingly, the present invention replaces the downsampling of the YOLOv8n backbone network with adaptive lightweight downsampling to achieve lightweightness while retaining a large number of key features, thereby significantly improving the adaptability, accuracy and robustness of the model for small target detection.
[0140] The neck network 2 is used to execute step S2: continuously upsampling the aggregated, deep and middle layer feature maps to fuse the features, and obtain a preliminary fused feature map and a shallow fused feature map; and using adaptive lightweight downsampling to fuse the shallow fused feature map with the preliminary fused feature map and the aggregated feature map to obtain middle and deep fused feature maps.
[0141] Specifically, the neck network 2 includes a preliminary feature fusion module 21 , a shallow feature fusion module 22 , an adaptive middle feature fusion module 23 and an adaptive deep feature fusion module 24 .
[0142] The preliminary feature fusion module 21 is used to execute step S21: up-sample the aggregated feature map, and perform feature fusion on the aggregated feature map with the deep feature map to obtain a preliminary fused feature map.
[0143] Specifically, the preliminary fusion feature map F 10 The specific calculation expression is as follows:
[0144] F 10 =C2f(Concat(Upsample(F9),F6))
[0145] In the formula, F 10 It is a preliminary fusion feature map with 512 channels and a size of H / 16×W / 16. Upsample is an upsampling operation used to expand the current feature map. Concat is a feature concatenation operation used to concatenate two different feature maps. C2f is used to perform feature fusion on the concatenated feature map.
[0146] The shallow feature fusion module 22 is used to execute step S22: upsampling the preliminary fusion feature map, and performing feature fusion on it and the middle-layer feature map to obtain a shallow fusion feature map.
[0147] Specifically, the shallow fusion feature map F 11 The specific calculation expression is as follows:
[0148] F 11 =C2f(Concat(Upsample(F 10 ), F4))
[0149] In the formula, F 11 It is a shallow fusion feature map with 256 channels and a size of H / 8×W / 8.
[0150] The adaptive middle-layer feature fusion module 23 is used to execute step S23: adaptively and lightweight down-sampling the shallow fusion feature map, and performing feature fusion on the shallow fusion feature map with the preliminary fusion feature map to obtain a middle-layer fusion feature map.
[0151] Specifically, the middle-layer fusion feature map F 13 The specific calculation expression is as follows:
[0152]
[0153] F 13 =C2f(Concat(F 12 , F 10 ))
[0154] In the formula, F 12 is the initial fusion feature map of downsampling, with 256 channels and a size of H / 16×W / 16; F 13 It is the middle-layer fusion feature map with 512 channels and a size of H / 16×W / 16.
[0155] The adaptive deep feature fusion module 24 is used to execute step S24: adaptively and lightly downsample the middle-layer fusion feature map, and perform feature fusion on the middle-layer fusion feature map with the aggregated feature map to obtain a deep-layer fusion feature map.
[0156] Specifically, the deep fusion feature map F 15 The specific calculation expression is as follows:
[0157]
[0158] F 15 =C2f(Concat(F 14 , F9))
[0159] In the formula, F 14is the downsampled middle-layer fusion feature map, with 512 channels and a size of H / 32×W / 32; F 15 It is a deep fusion feature map with 512 channels and a size of H / 32×W / 32.
[0160] Based on this, the present invention replaces the downsampling operation in the feature pyramid (FPN) with adaptive lightweight downsampling, which not only effectively reduces the loss of key features in the feature fusion process, but also can actively screen out important features and improve the efficiency and accuracy of feature fusion, thereby significantly improving the fusion quality of the feature pyramid and the accuracy of the model for small target detection.
[0161] The detection head network 3 is used to execute step S3: using content-guided attention to capture features of the shallow fusion feature map and the middle feature map, the middle fusion feature map and the deep feature map, and the deep fusion feature map and the aggregated feature map, and identify the military aircraft in the image to be detected.
[0162] Specifically, the specific representation of using content to guide attention for feature capture and recognition is:
[0163]
[0164] In the formula, T represents the target obtained by identifying the features; F FPN It can be selected as shallow, medium or deep fusion feature map, F Backbone It is expressed as FPN The mid-level, deep-level, or aggregated feature maps of the corresponding scales; is element-wise addition, is element-by-element multiplication; Conv 1×1 is the convolution operation of 1×1 convolution kernel; Detect is the recognition operation; W T is the key feature weight of the target, which is obtained by content-guided attention calculation. The specific calculation is as follows:
[0165] W T =σ(GroupConv 7×7 (CShuffle(Concat(W CA , X))))
[0166] In the formula, CShuffle is the channel shuffle operation; GroupConv 7×7 is a grouped convolution operation with a convolution kernel size of 7×7; σ is the Sigmoid activation function; X is the FPN The fusion feature map of the corresponding scale is calculated as follows: W CAis the fusion weight, which is calculated as follows:
[0167] W CA =W C +W A
[0168] Where W C is the channel feature weight, and its specific calculation is as follows:
[0169]
[0170] Among them, max(0, ) is the ReLU activation function, which is used to generate positive features; Represented as fusion features Figure X Perform a global average pooling operation across channel dimensions; and W S is the spatial feature weight, and its specific calculation is as follows:
[0171]
[0172] in, Respectively represent the fusion features Figure X Perform cross-space global average pooling operations and cross-space global maximum pooling operations.
[0173] The detection head network 3 includes a small-scale feature capture and recognition module 31 , a medium-scale feature capture and recognition module 32 , a large-scale feature capture and recognition module 33 and a target integration module 34 .
[0174] Please also refer to 6 and Figure 7 , Figure 6 is a schematic diagram of an example structure of feature capture according to the present invention, Figure 7 Schematic diagram of an example structure for guiding attention to content captured by features according to the present invention.
[0175] The small-scale feature capture and recognition module 31 is used to execute step S31: using content-guided attention to capture features of the deep fusion feature map and the aggregated feature map, and perform feature recognition to obtain a small-scale target.
[0176] Specifically, the small-scale target T small The specific calculation expression is as follows:
[0177]
[0178] In the formula, F 14 is a deep fusion feature map; F9 is an aggregated feature map; is element-wise addition, It is element-by-element multiplication, which is used to enhance feature representation; Conv 1×1is a convolution operation with a 1×1 convolution kernel, which is used to integrate the captured features, thereby effectively utilizing the complementarity between high-level and low-level features and enhancing the model's ability to process information of different scales; Detect is a recognition operation, which uses the Sigmoid function and Anchor-Free to classify and regress the current features, outputs the target category probability and the regression result of the target box at the corresponding position, and obtains the small-scale target; W Small is the key feature weight of the small-scale target, which is calculated by content-guided attention (CGA). The specific calculation is as follows:
[0179] W Small =σ(GroupConv 7×7 (CShuffle(Concat(W CA , X S ))))
[0180] In the formula, CShuffle is a channel shuffle operation, which is used to disrupt the order of the original feature map channels to enhance feature interaction; GroupConv 7×7 is a grouped convolution operation with a convolution kernel size of 7×7, which is used to capture large-scale local features while reducing the amount of calculation; σ is the Sigmoid activation function, which is used to normalize the weights to the interval [0,1]; X S is a small-scale fusion feature map, and its specific calculation is W CA In order to fuse the weights, by combining the spatial and channel attention weights, the model's responsiveness to different features is optimized, thereby improving the accuracy and efficiency of feature extraction. The specific calculation of the fusion weights is as follows:
[0181] W CA =W C +W A
[0182] Where W C is the channel feature weight, and its specific calculation is as follows:
[0183]
[0184] Among them, max(0, ) is the ReLU activation function, which is used to generate positive features; Represented as small-scale fusion features Figure X S A global average pooling operation across the channel dimension is performed to extract global channel features. The specific calculation of the global average pooling GAP is as follows:
[0185]
[0186] In the formula, H and W are the fusion features Figure X The height and width of X ij To fuse features Figure X The eigenvalue corresponding to the i-th row and j-th column of ;
[0187] And W S is the spatial feature weight, and its specific calculation is as follows:
[0188]
[0189] in, Respectively represent the small-scale fusion features Figure X S A cross-space global average pooling operation and a cross-space global maximum pooling operation are performed to capture global features at different spatial positions. The specific representation of the global maximum pooling operation GMP is as follows:
[0190] GMP=max{X ij |(i, j)∈k×k}
[0191] In the formula, k represents the size of the pooling window, X ij is the eigenvalue of row i and column j in the pooling window.
[0192] The mesoscale feature capture and recognition module 32 is used to execute step S32: using content-guided attention to capture features of the middle-layer fusion feature map and the deep-layer feature map, and perform feature recognition to obtain a mesoscale target.
[0193] Specifically, the mesoscale target T medium The specific calculation expression is as follows:
[0194]
[0195] In the formula, F 13 is the middle-layer fusion feature map; F6 is the deep-layer feature map; W medium is the key feature weight of the mesoscale target, which is obtained through CGA calculation. The specific calculation is as follows:
[0196] W medium =σ(GroupConv 7×7 (CShuffle(Concat(W CA , X M ))))
[0197] Where, X M is the mesoscale fusion feature map, and its specific calculation is And W CA The specific calculation is as follows:
[0198]
[0199] The large-scale feature capture and recognition module 33 is used to execute step S33: using content-guided attention to capture features of the shallow fusion feature map and the middle-layer feature map, and perform feature recognition to obtain a large-scale target.
[0200] Specifically, the large-scale target T Large The specific calculation expression is as follows:
[0201]
[0202] In the formula, F 11 is a shallow fusion feature map; F4 is a middle-level feature map; W Large is the key feature weight of the large-scale target, which is obtained through CGA calculation. The specific calculation is as follows:
[0203] W medium =σ(GroupConv 7×7 (CShuffle(Concat(W CA , X L ))))
[0204] Where, X L is a large-scale fusion feature map, and its specific calculation is And W CA The specific calculation is as follows:
[0205]
[0206] The target integration module 34 is used to execute step S34: integrate small, medium and large scale targets to identify the military aircraft in the image to be detected.
[0207] Specifically, the specific expression of its target integration is as follows:
[0208] T fin =NMS(T small , T medium , T Large )
[0209] Where, T fin The result is integrated for the target; NMS stands for non-maximum suppression, which is used to select the best result from the overlapping parts of small, medium and large scales and mark them, so as to avoid the problem of target overlap between different scales;
[0210] Next, the target integration result is displayed in the image to be detected, thereby identifying the military aircraft in the image to be detected.
[0211] Based on this, the present invention adopts the content-guided attention mechanism to capture the features of the fused feature map in the feature pyramid and the feature map in the backbone network, so that the model can more accurately find key information in feature maps of different scales, further reduce the feature loss, and suppress irrelevant or redundant information, thereby comprehensively improving the feature capture ability of small targets.
[0212] In order to improve the detection accuracy of the military aircraft detection model based on YOLOv8n for military aircraft, the present invention further trains the trainable parameters in the backbone network 1, the neck network 2 and the detection head network 3, and the specific steps are as follows:
[0213] T1: Collects a dataset containing images of military aircraft.
[0214] The data set includes images of 20 types of aircraft, including fighter jets, transport aircraft, early warning aircraft and bombers; at the same time, the scenes of the images include various environments such as military airports, mountains and snow.
[0215] T2: Label the images in the dataset and divide them into training set, validation set and test set according to the ratio of 7:2:1.
[0216] The labeling tool labelImg is used to mark the location of the military aircraft, record the category label and the width and height of the box. At the same time, the labeling process is adjusted according to the specific environment and special circumstances, especially the targets with camouflage factors, to ensure that all targets are correctly labeled.
[0217] T3: Train the images in the training set using the YOLOv8n-based military aircraft detection model described above to obtain training detection results.
[0218] T4: Use Stochastic Gradient Descent (SGD) to calculate the loss of the training test results and the corresponding labels in the training set to obtain the loss value.
[0219] T5: Update the weights of the trainable parameters in the YOLOv8n-based military aircraft detection model according to the loss value, and determine whether the current YOLOv8n-based military aircraft detection model has reached a training threshold: if so, complete the training and obtain the trained YOLOv8n-based military aircraft detection model; if not, execute step T3.
[0220] Among them, the training threshold can be set according to needs. The default threshold parameters are: training rounds (Epochs) is 300, the early termination condition (Early Stopping) of training is 100, and the verification set is used to verify the current detection accuracy of the military aircraft model based on YOLOv8n every 20 Epochs. When the accuracy is not significantly improved, stop training.
[0221] Furthermore, the trained YOLOv8n-based military aircraft detection model is used to perform military aircraft detection on the test set, and it is verified whether the accuracy meets an accuracy threshold: if not, an untrained YOLOv8-based military aircraft detection model is used, and step T3 is re-executed; if so, the currently trained YOLOv8n-based military aircraft detection model is deployed to the corresponding equipment.
[0222] Among them, the accuracy threshold is a custom parameter, which is used to ensure that the trained YOLOv8n-based military aircraft detection model has a higher accuracy than the preset one.
[0223] Compared with the prior art, the present invention replaces the downsampling operation in the backbone network, so that the model can dynamically consider the importance of information in different regions of the feature map during the downsampling process, effectively retain key information, thereby reducing the problem of feature loss caused by traditional downsampling, significantly improving the detection performance of the model, and keeping the model lightweight. In addition, the present invention introduces adaptive lightweight downsampling in the feature pyramid, which can actively screen out key features, improve the efficiency and accuracy of feature fusion, and thus enhance the model's ability to capture small targets.
[0224] The parameter amount of the military aircraft detection model based on YOLOv8n after training of the present invention is 6.1M, which is lighter than YOLOv8n's 7.1M, significantly reducing the demand for computing resources, and can be easily deployed in resource-constrained environments such as mobile devices, embedded systems and drones. At the same time, in the mAP@50% indicator, the present invention reaches 87.8%, which is 2.7% higher than YOLOv8n, and has a higher detection accuracy. In summary, the adaptive lightweight downsampling and content-guided attention designed by the present invention can reduce the feature loss of traditional YOLOv8n in the downsampling process, effectively reduce the model parameters, and improve the detection accuracy.
[0225] Based on the same inventive concept, the present application also provides an electronic device, which may be a terminal device such as a server, a desktop computing device or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.). The device includes one or more processors and a memory, wherein the processor is used to execute a program to implement the military aircraft detection method based on YOLOv8n of an embodiment of the present invention; and the memory is used to store a computer program executable by the processor.
[0226] Based on the same inventive concept, the present application also provides a computer-readable storage medium, corresponding to the aforementioned embodiment of the YOLOv8n-based military aircraft detection method, and the computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the YOLOv8n-based military aircraft detection method recorded in any of the above embodiments.
[0227] The present application may take the form of a computer program product implemented on one or more storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing program code. Computer-usable storage media include permanent and non-permanent, removable and non-removable media, and information storage can be achieved by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
[0228] The above-mentioned embodiments only express several implementation methods of the present invention, and the description is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention patent. It should be pointed out that for ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of the present invention, and the present invention is also intended to include these modifications and modifications.
Claims
1. A military aircraft detection method based on YOLOv8n, characterized in that: The following steps are involved: S1: Adaptively perform lightweight downsampling and feature extraction alternately on the preprocessed image to be detected, and perform pooling through a spatial feature pyramid to obtain middle-layer, deep-layer and aggregated feature maps respectively; wherein the specific expression of alternately performing adaptive lightweight downsampling and feature extraction is as follows: F n =C2f(F n-1 ) In the formula, F n is the feature map after the current feature extraction, F n-1 is the feature map after downsampling; C2f(·) is the feature extraction operation; GroupConv2d(·) is the group convolution operation; AvgPool(·) is the average pooling operation; Conv2d is the two-dimensional convolution operation on the pooled features; ⊙ is the element-by-element multiplication operation; ∑ dim=-1 (·) is used to sum the last dimension of the weighted features; S2: Continuously perform upsampling feature fusion on the aggregated, deep and middle-layer feature maps to obtain preliminary fusion feature maps and shallow fusion feature maps; Adaptive lightweight downsampling is used to continuously fuse the shallow fusion feature maps with the preliminary fusion feature maps and the aggregated feature maps to obtain middle-layer and deep fusion feature maps; S3: Use content-guided attention to capture the features of the shallow fusion feature map and the middle-layer feature map, the middle-layer fusion feature map and the deep feature map, and the deep fusion feature map and the aggregated feature map, and identify the military aircraft in the image to be detected.
2. The military aircraft detection method according to claim 1, characterized in that: The specific expression of using content to guide attention to capture and identify features is: In the formula, T represents the target obtained by identifying the features; F FPN It can be selected as shallow, medium or deep fusion feature map, F Backbone It is expressed as FPN The mid-level, deep-level, or aggregated feature maps of the corresponding scales; is element-wise addition, is element-by-element multiplication; Conv 1×1 is the convolution operation of 1×1 convolution kernel; Detect is the recognition operation; W T is the key feature weight of the target, which is obtained by content-guided attention calculation. The specific calculation is as follows: In the formula, CShuffle is the channel shuffle operation; GroupConv 7×7 is a grouped convolution operation with a convolution kernel size of 7×7; σ is the Sigmoid activation function; X is the FPN The fusion feature map of the corresponding scale is calculated as follows: W CA is the fusion weight, which is calculated as follows: IN CA =In C +W A Where W C is the channel feature weight, and its specific calculation is as follows: Among them, max(0,·) is the ReLU activation function, which is used to generate positive features; It is represented as a global average pooling operation across the channel dimension of the fused feature map X; and W S is the spatial feature weight, and its specific calculation is as follows: in, They are respectively represented as a global average pooling operation across space and a global maximum pooling operation across space on the fused feature map X.
3. The military aircraft detection method according to claim 2, characterized in that: The step S1 comprises the following sub-steps: S11: Use convolution to preprocess and extract features of the image to be detected to obtain a shallow feature map; S12: Adaptively perform lightweight downsampling and feature extraction on the shallow feature map to obtain the middle feature map; S13: Perform adaptive lightweight downsampling and feature extraction on the middle-layer feature map to obtain a deep-layer feature map; S14: Adaptively perform lightweight downsampling and feature extraction on the deep feature map, and perform pooling through the spatial feature pyramid to obtain an aggregated feature map; The step S2 comprises the following sub-steps: S21: upsampling the aggregated feature map, and fusing it with the deep feature map to obtain a preliminary fused feature map; S22: upsampling the preliminary fusion feature map, and performing feature fusion on it and the middle-layer feature map to obtain a shallow-layer fusion feature map; S23: Adaptively and lightly downsample the shallow fusion feature map, and fuse it with the preliminary fusion feature map to obtain a middle-layer fusion feature map; S24: Adaptively perform lightweight downsampling on the middle-layer fusion feature map, and perform feature fusion on it and the aggregated feature map to obtain a deep-layer fusion feature map.
4. The military aircraft detection method according to claim 3, characterized in that: The step S3 comprises the following sub-steps: S31: Use content-guided attention to capture the deep fusion feature map and the aggregated feature map, and perform feature recognition to obtain the small-scale target T small ; S32: Use content-guided attention to capture the features of the middle-layer fusion feature map and the deep-layer feature map, and perform feature recognition to obtain the medium-scale target T medium ; S33: Use content-guided attention to capture the features of the shallow fusion feature map and the middle feature map, and perform feature recognition to obtain the large-scale target T Large ; S34: Integrate the small, medium and large-scale targets to identify the military aircraft in the image to be detected; wherein the target integration is specifically represented as follows: T fin =NMS(T small ,T medium ,T Large ) Where, T fin is the target integration result; NMS is non-maximum suppression.
5. A military aircraft detection model based on YOLOv8n, characterized in that: Including backbone network, neck network and detection head network; The backbone network is used to alternately perform adaptive lightweight downsampling and feature extraction on the preprocessed image to be detected, and perform pooling through a spatial feature pyramid to obtain middle-layer, deep-layer and aggregated feature maps respectively; wherein the specific expression of alternately performing adaptive lightweight downsampling and feature extraction is as follows: F n =C2f(F n-1 ) In the formula, F n is the feature map after the current feature extraction, F n-1 is the feature map after downsampling; C2f(·) is the feature extraction operation; GroupConv2d(·) is the group convolution operation; AvgPool(·) is the average pooling operation; Conv2d is the two-dimensional convolution operation on the pooled features; ⊙ is the element-by-element multiplication operation; ∑ dim=-1 (·) is used to sum the last dimension of the weighted features; The neck network is used to continuously perform upsampling feature fusion on the aggregate, deep and middle layer feature maps to obtain a preliminary fusion feature map and a shallow fusion feature map; and to continuously perform feature fusion on the shallow fusion feature map with the preliminary fusion feature map and the aggregate feature map using adaptive lightweight downsampling to obtain middle and deep fusion feature maps; The detection head network is used to use content-guided attention to capture features of shallow-layer fusion feature maps and middle-layer feature maps, middle-layer fusion feature maps and deep-layer feature maps, and deep-layer fusion feature maps and aggregated feature maps, and identify military aircraft in the image to be detected.
6. The military aircraft detection model according to claim 5, characterized in that: The specific expression of using content to guide attention to capture and identify features is: In the formula, T represents the target obtained by identifying the features; F FPN It can be selected as shallow, medium or deep fusion feature map, F Backbone It is expressed as FPN The mid-level, deep-level, or aggregated feature maps of the corresponding scales; is element-wise addition, is element-by-element multiplication; Conv 1×1 is the convolution operation of 1×1 convolution kernel; Detect is the recognition operation; W T is the key feature weight of the target, which is obtained by content-guided attention calculation. The specific calculation is as follows: IN T =σ(GroupConv 7×7 (CShuffle(Concat(W CA ,X)))) In the formula, CShuffle is the channel shuffle operation; GroupConv 7×7 is a grouped convolution operation with a convolution kernel size of 7×7; σ is the Sigmoid activation function; X is the FPN The fusion feature map of the corresponding scale is calculated as follows: W CA is the fusion weight, which is calculated as follows: IN CA =In C +W A Where W C is the channel feature weight, and its specific calculation is as follows: Among them, max(0,·) is the ReLU activation function, which is used to generate positive features; It is represented as a global average pooling operation across the channel dimension of the fused feature map X; and W S is the spatial feature weight, and its specific calculation is as follows: in, They are respectively represented as a global average pooling operation across space and a global maximum pooling operation across space on the fused feature map X.
7. The military aircraft detection model according to claim 6, characterized in that: The backbone network includes a shallow feature extraction module, an adaptive middle feature extraction module, an adaptive deep feature extraction module and an adaptive feature aggregation module; The shallow feature extraction module is used to perform preprocessing and feature extraction on the image to be detected by using convolution to obtain a shallow feature map; The adaptive middle-layer feature extraction module is used to perform adaptive lightweight downsampling and feature extraction on the shallow feature map to obtain the middle-layer feature map; The adaptive deep feature extraction module is used to perform adaptive lightweight downsampling and feature extraction on the middle-layer feature map to obtain a deep feature map; The adaptive feature aggregation module is used to perform adaptive lightweight downsampling and feature extraction on the deep feature map, and to obtain an aggregated feature map by pooling through a spatial feature pyramid; The neck network includes a preliminary feature fusion module, a shallow feature fusion module, an adaptive middle feature fusion module and an adaptive deep feature fusion module; The preliminary feature fusion module is used to upsample the aggregated feature map and perform feature fusion on it with the deep feature map to obtain a preliminary fused feature map; The shallow feature fusion module is used to upsample the preliminary fusion feature map and perform feature fusion on it with the middle-layer feature map to obtain a shallow fusion feature map; The adaptive middle-layer feature fusion module is used to adaptively and lightweight downsample the shallow-layer fusion feature map, and fuse it with the preliminary fusion feature map to obtain a middle-layer fusion feature map; The adaptive deep feature fusion module is used to perform adaptive lightweight downsampling on the middle-layer fusion feature map, and perform feature fusion on the middle-layer fusion feature map with the aggregated feature map to obtain a deep fusion feature map; The detection head network includes a small-scale feature capture and recognition module, a medium-scale feature capture and recognition module, a large-scale feature capture and recognition module and a target integration module; The small-scale feature capture and recognition module is used to capture the deep fusion feature map and the aggregated feature map by using content-guided attention, and perform feature recognition to obtain the small-scale target T small ; The mesoscale feature capture and recognition module is used to capture the features of the middle-layer fusion feature map and the deep-layer feature map by using content-guided attention, and perform feature recognition to obtain the mesoscale target T medium ; The large-scale feature capture and recognition module is used to capture the shallow fusion feature map and the middle-level feature map by using content-guided attention, and perform feature recognition to obtain the large-scale target T Large ; The target integration module is used to integrate small, medium and large-scale targets and identify military aircraft in the image to be detected; wherein the target integration is specifically expressed as follows: T fin =NMS(T small ,T medium ,T Large ) Where, T fin Integrate results for goals; NMS stands for non-maximum suppression.
8. The military aircraft detection model according to claim 7, characterized in that: The trainable parameters in the backbone network, neck network and probe head network are trained by the following steps: T1: collects a dataset containing military aircraft images; T2: Label the images in the dataset and divide them into training set, validation set and test set according to the ratio of 7:2:1; T3: training the images in the training set by using the YOLOv8n-based military aircraft detection model to obtain training detection results; T4: Use stochastic gradient descent to calculate the loss of the training test results and the corresponding labels in the training set to obtain the loss value; T5: Update the weights of the trainable parameters of the YOLOv8n-based military aircraft detection model according to the loss value, and determine whether the current YOLOv8n-based military aircraft detection model has reached a training threshold: if so, complete the training to obtain a high-accuracy YOLOv8n-based military aircraft detection model; if not, execute step T3.
9. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the military aircraft detection method based on YOLOv8n as described in any one of claims 1 to 4 is implemented.
10. A computer-readable storage medium storing computer-executable instructions, characterized in that: The computer executable instructions are used for the military aircraft detection method based on YOLOv8n as described in any one of claims 1 to 4.