Optimization method, evaluation method and application of YOLOv8n model for aircraft skin defect detection
By optimizing the C2fGhost module, attention occlusion mechanism AOM and regression loss function of the YOLOv8n model, the detection accuracy and efficiency of aircraft skin defect detection are improved, especially the detection effect of small targets and occlusion defects is significantly improved in complex environments.
Patent Information
- Application Number
- CN202510325658.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-19
- Publication Date
- 2025-07-22
AI Technical Summary
In the detection of aircraft skin defects, the accuracy, recall and average accuracy of small target detection need to be improved, and the detection is difficult in complex environments, especially the detection effect of occlusion and small targets is not good.
The YOLOv8n model is used for optimization, and the Bottleneck module is replaced by building a new C2fGhost module, adding attention occlusion mechanism AOM, and optimizing the regression loss function as a distributed focus DFL loss function and Wise-IoU intersecting and comparing fusion, improving bounding box prediction accuracy and convergence.
The model's detection ability of small targets and bounding box regression performance is improved, the calculation cost is reduced, the detection accuracy and efficiency in complex environments are enhanced, and the missed detection rate is reduced.
Smart Images

Figure CN120355973A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to an aircraft skin defect detection technology, and particularly to an optimization method, an evaluation method and a use of a YOLOv8n model for aircraft skin defect detection. Background Art
[0002] As an important part of the external structure of an aircraft, the integrity of the aircraft skin is directly related to flight safety. However, during use, the aircraft skin is easily affected by various complex environmental factors, such as meteorological conditions and light changes, resulting in the generation of defects. Moreover, the aircraft skin mostly has a curved surface structure, and the coating and reflective characteristics on the skin surface will increase the difficulty of detection. In addition, as Figures 1 - 3 shown, pollutants will adhere to the aircraft skin surface, and corrosion will occur after long-term exposure to harsh environments. The influence of complex environments increases the difficulty of detecting the aircraft skin.
[0003] In response to the above complex environments, researchers have proposed various detection methods and technologies, such as visual detection technology, ultrasonic detection technology, infrared thermal imaging technology, laser scanning technology and multi-sensor fusion technology. In particular, the introduction of deep learning technology has effectively improved the detection accuracy and detection efficiency. In the prior art, there is already an aircraft skin surface defect detection method based on improved YOLOv5, but the accuracy, recall rate and mean average precision still need to be improved; there is also a method for detecting aircraft skin defects by fusing neural networks based on the YOLOv5 network, but the training model has not been optimized; in addition, there is also a method that enhances the feature extraction ability in YOLOv7 by introducing the efficient layer aggregation network E-ELAN and an innovative transition module, but the detection speed and accuracy of small targets at close distances are not good. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide an optimization method, an evaluation method and a use of a YOLOv8n model for aircraft skin defect detection that can improve the detection performance of the model, the detection ability of small targets and the model bounding box regression performance.
[0005] To solve the above technical problem, the optimization method of the YOLOv8n model for aircraft skin defect detection of the present invention includes the following steps:
[0006] A. Construct a new C2fGhost module: Replace the Bottleneck in the C2f module of the YOLOv8n model with a GhostBottleneck module;
[0007] B. Add the Attention Occlusion Mechanism AOM: The backbone network in the YOLOv8n model consists of two feature extraction stages, which are responsible for initial feature extraction and high-level feature extraction and generate feature maps. The Attention Occlusion Mechanism AOM is added between the two feature fusions of the backbone network to assign different weight values to different channels;
[0008] C. Optimize the regression loss function: Adopt a regression loss function that combines the Distributed Focusing DFL loss function and the Wise-IoU intersection over union to improve the bounding box prediction accuracy and convergence.
[0009] The GhostBottleneck module in step A consists of two layers of Ghost modules. The first layer of Ghost module expands features by increasing the number of channels, and the second layer of Ghost module reduces the number of channels to match the number of channels of the output feature map with that of the input feature map, and fuses the output feature map with the residual side feature map.
[0010] The operation of generating n feature maps in any convolutional layer in step A is represented by the input feature map, output feature map, and convolutional filter as:
[0011] Y = X × f + b (1)
[0012] Among them, X(c×h×w) is the input feature map with c channels, h and w represent the height and width of the input feature map respectively, f(c×k×k×n) is the convolutional filter in this layer, the convolutional kernel size is k×k, Y(h′×w′×n) is the corresponding output feature map with n channels, h′ and w′ represent the height and width of the output feature map respectively, and b represents the bias term;
[0013] The flops required for the convolution process is represented as:
[0014] flops = h × w × n × c × k × k
[0015] In the linear transformation, assume the operation kernel size is g×g, the original method obtains m feature maps, and the change quantity is s. According to the identity of the Ghost module, the effective transformation can be obtained:
[0016] n = m × s
[0017] The computational cost gr of the Ghost module can be expressed as:
[0018]
[0019] In summary, the convolutional computational cost r improved using the Ghost module is expressed as:
[0020]
[0021] Therefore, using the Ghost module calculates approximately 1 / s of the standard convolution.
[0022] In step B, the attention occlusion mechanism AOM in the attention mechanism dynamically adjusts the feature weight values of each channel by learning global context information, improving the detection accuracy of the network for occlusion defects and small target defects.
[0023] The evaluation method of the optimized YOLOv8n model includes the following steps:
[0024] A. Preprocess the aircraft skin defect image dataset, establish an aircraft skin defect database including a training set, a validation set, and a test set, and perform bounding box annotation on defect instances.
[0025] B. Train the optimized YOLOv8n model based on the preprocessed defect image dataset in step A, verify and test the model performance through the validation set and the test set, and generate a confusion matrix to evaluate the model classification performance.
[0026] C. Evaluate the optimized YOLOv8n model using precision, frames per second, model size, and mean average precision.
[0027] The aircraft skin defect image dataset in step A contains 15,000 training set images, 4,370 validation set images, and 5,000 test set images. Each defect instance is pixel-level annotated through a bounding box.
[0028] In step C, the IoU thresholds of the confusion matrix in step B are taken as 0.5 and 0.5 - 0.95 respectively, that is, mAP@0.5 and mAP@.5:.95. The calculation formula of IoU is:
[0029]
[0030] Among them, TP refers to the number of samples correctly predicted as positive by the model, FP refers to the number of samples wrongly predicted as positive by the model, and FN refers to the number of samples wrongly predicted as negative by the model.
[0031] The use of the optimized YOLOv8n model for aircraft skin defect detection includes using the optimized YOLOv8n model to detect aircraft skin defects.
[0032] Advantages of the present invention:
[0033] (1) Feature extraction in deep neural networks involves a large amount of redundant mapping and information. Therefore, a new module C2fGhost is designed, introducing GhostBottleneck. The Ghost module is improved in a low-cost and high-benefit way. The Ghost module generates intrinsic feature maps and increases channels to reduce computational costs and improve overall efficiency, making the network lightweight, reducing network parameters, decreasing model size, and enhancing the model's detection performance.
[0034] (2) In aircraft skin defect detection under complex environmental changes, to improve the model's ability to express small-scale defect features, a more lightweight Attention Occlusion Mechanism (AOM) is added between two feature fusions in the YOLOv8n backbone network. Different weight values are assigned to different channels. The weight value represents the degree of attention the model pays to different parts when processing the input. A high weight means the model pays more attention to that part, and a low weight means less attention. This enhances the extraction and fusion ability of relevant features and also improves the network's detection ability for small targets.
[0035] (3) The common YOLOv8n model uses DFL Loss + CIoU Loss as the regression loss. However, CIoU Loss is relatively fuzzy in the aspect ratio of intersection over union and does not comprehensively consider the sample balance problem. In this invention, an improved regression loss function that combines distributed focus DFL and Wise-IoU is adopted. By optimizing the loss function, the model's bounding box regression performance is effectively improved. Especially, the detection accuracy of small target defects in complex defects is significantly improved, reducing the missed detection rate of special defects on aircraft skins in complex environments and further enhancing the detection accuracy, which has certain research and application value. Description of the Drawings
[0036] Figure 1 is a surface impact diagram of the corrosion phenomenon on the aircraft skin;
[0037] Figure 2 is a surface crack diagram of the corrosion phenomenon on the aircraft skin;
[0038] Figure 3 is a surface corrosion diagram of the corrosion phenomenon on the aircraft skin;
[0039] Figure 4 is the network structure diagram of the optimized YOLOv8n model of the present invention;
[0040] Figure 5 is the C2fGhost module diagram in the optimized YOLOv8n model of the present invention;
[0041] Figure 6It is the network structure diagram of the AOM mechanism in the optimized YOLOv8n model of the present invention. Detailed implementation manners
[0042] Next, in combination with the accompanying drawings and specific implementation manners, the optimization method, evaluation method and uses of the YOLOv8n model for aircraft skin defect detection in the present invention will be further described in detail.
[0043] Example 1:
[0044] The optimization method of the YOLOv8n model for aircraft skin defect detection in the present invention includes the following steps:
[0045] A. Construct a new C2fGhost module
[0046] As Figure 4 shown, replace the Bottleneck in the C2f module in the YOLOv8n model with the GhostBottleneck module; as Figure 5 shown, the GhostBottleneck module consists of two layers of Ghost modules. The first layer of Ghost module expands features by increasing the number of channels, and the second layer of Ghost module reduces the number of channels to make the number of channels of the output feature map match that of the input feature map, and fuses the output feature map with the residual side feature map.
[0047] Generating n feature maps in any convolutional layer is represented by the input feature map, output feature map and convolutional filter as:
[0048] Y = X × f + b (1)
[0049] where X(c×h×w) is the input feature map with c channels, h and w respectively represent the height and width of the input feature map, f(c×k×k×n) is the convolutional filter in this layer, the convolutional kernel size is k×k, Y(h′×w′×n) is the corresponding n-channel output feature map, h′ and w′ respectively represent the height and width of the output feature map, and b represents the bias term;
[0050] The flops required for the convolutional process is represented as:
[0051] flops = h × w × n × c × k × k
[0052] In linear transformation, assuming the operation kernel size is g×g, the original method obtains m feature maps, and the change quantity is s. According to the identity of the Ghost module, the effective transformation can be obtained:
[0053] n = m × s
[0054] The computational cost gr of the Ghost module can be represented as:
[0055]
[0056] In summary, the convolution computation amount r improved using the Ghost module is expressed as:
[0057]
[0058] Therefore, the calculation using the Ghost module is about 1 / s of the standard convolution.
[0059] B. Adding the Attention Occlusion Mechanism AOM
[0060] The backbone network specifically includes two feature extraction stages, which are responsible for initial feature extraction and high-level semantic feature extraction respectively. As Figure 6 shown, the Attention Occlusion Mechanism AOM is added between the two feature fusions of the backbone network to assign channel weight values. The Attention Occlusion Mechanism AOM dynamically adjusts the feature weight values of each channel by learning global context information, assigns different weight values to different channels, and the weight value represents the degree of attention of the model to different parts when processing the input. Among them, a high weight means that the model pays more attention to this part, and a low weight means less attention, improving the detection accuracy of the network for occlusion defects and small target defects. Compared with mechanisms such as SE (Squeezeand-Excitation), CBAM, GAM (Global Attention Mechanism), and Biformer under the same conditions, it has a better balance in detection accuracy and processing speed.
[0061] C. Optimizing the regression loss function
[0062] Adopt a regression loss function that fuses the distributed focal DFL loss function and the Wise-IoU intersection over union to improve the prediction accuracy and convergence of the bounding box.
[0063] Example 2:
[0064] The evaluation method of the optimized YOLOv8n model of the present invention includes the following steps:
[0065] A. Preprocess the aircraft skin defect image dataset, establish an aircraft skin defect database including a training set, a validation set, and a test set, and perform bounding box annotation on defect instances;
[0066] The aircraft skin defect image dataset contains 15,000 training set images, 4,370 validation set images, and 5,000 test set images, and each defect instance is pixel-level annotated through a bounding box.
[0067] B. Train the optimized YOLOv8n model based on the preprocessed defect image dataset in step A, verify and test the model performance through the validation set and the test set, and generate a confusion matrix to evaluate the model classification performance;
[0068] The IoU thresholds of the confusion matrix are taken as 0.5 and 0.5 - 0.95 respectively, that is, mAP@0.5 and mAP@0.5:.95. The calculation formula of IoU is:
[0069]
[0070] Among them, TP refers to the number of samples correctly predicted as positive by the model, FP refers to the number of samples wrongly predicted as positive by the model, and FN refers to the number of samples wrongly predicted as negative by the model.
[0071] C. Evaluate the optimized YOLOv8n model using precision, frames per second, model size, and mean average precision.
[0072] This experiment was conducted under the operating system Ubuntu20.04, with the GPU being NVIDIA GeForce RTX 3090Ti, the host memory being 32GB, the programming language being Python3.8, the runtime library version being CUDA11.7, and the software environment being PyTorch1.13.0 for training. The following is the training parameters of the optimized YOLOv8n model and the comparison table with other models:
[0073] Table 1 Training parameter settings
[0074] Parameter name Parameter value Parameter name Parameter value optimizer SGD epochs 100 weight_decay 0.0005 <![CDATA imgs > 640 lr0 0.01 momentum 0.937 workers 8 <![CDATA lrf > 0.01 <![CDATA warmup _epochs]]> 3 <![CDATA wamup _bias_lr]]> 0.1 faction 1 close_mosaic 10
[0075] Table 2 Comparison of detection results of each model on the aircraft skin defect detection database
[0076] Model Precision FPS mAP@0.5 mAP@.5:.95 Model size / M <![CDATA RetinaNet
[23] > 82.6 112 81.9 49.8 80 <![CDATA[Faster R - CNN > 86.3 82 85.8 55.2 108.62 YOLOv3 - tiny 74.3 102 72.2 43.2 17.62 YOLOv4 76.7 98 74.3 46.5 22.82 YOLOv5n 77.6 158 75.2 47.5 14.32 YOLOv8n 82.8 272 81.7 51.2 6.25 Improved YOLOv8n (This invention) 85.4 235 83.6 54.4 6.02
[0077] The experimental results are shown in Table 2. The improved algorithm is competitive compared with the traditional algorithm. Compared with the original model, Precision, mAP@0.5, and mAP@.5:.95 are increased by 2.6%, 1.9%, and 3.2% respectively, indicating that the detection accuracy of the model has been improved to a certain extent. It can be seen from the results that FPS has decreased compared with the original model, but the model is smaller and has better performance.
[0078] Example 3
[0079] The use of the improved YOLOv8n model of the present invention for aircraft skin defect detection is to use it for detection such as Figures 1 - 3For the shown aircraft skin defects, the optimized YOLOv8n model effectively improves the problems of inaccurate personnel positioning and insufficient feature expression in complex environments, reduces the false detection rate and missed detection rate to a certain extent, and can more accurately detect the tiny defects on the skin surface. Especially in complex environments, it provides a new research direction for the detection of complex defects on the aircraft skin surface.
Claims
1. An optimization method for the YOLOv8n model used in aircraft skin defect detection, characterized in that, It includes the following steps: A. Construct a new C2fGhost module: Replace the Bottleneck in the C2f module of the YOLOv8n model with a GhostBottleneck module; B. Add the attention occlusion mechanism AOM: The backbone network in the YOLOv8n model includes two feature extraction stages, which are responsible for initial feature extraction and high-level feature extraction and generate feature maps respectively. The attention occlusion mechanism AOM is added between the two feature fusions of the backbone network to assign different weight values to different channels; C. Optimize the regression loss function: Adopt a regression loss function that fuses the distributed focal DFL loss function and the Wise-IoU intersection over union to improve the prediction accuracy and convergence of the bounding box.
2. The optimization method for the YOLOv8n model used for aircraft skin defect detection according to claim 1, wherein: The GhostBottleneck module in step A consists of two layers of Ghost modules. The first layer of Ghost module expands the features by increasing the number of channels, and the second layer of Ghost module reduces the number of channels to match the number of channels of the output feature map with that of the input feature map, and fuses the output feature map with the residual side feature map.
3. The optimization method for the YOLOv8n model used in aircraft skin defect detection according to claim 1, characterized in that: The operation of generating n feature maps in any convolutional layer in step A is represented by the input feature map, the output feature map, and the convolutional filter as: Among them, is an input feature map with c channels, h and w respectively represent the height and width of the input feature map, f(c×k×k×n) is the convolutional filter in this layer, the convolutional kernel size is k×k, Y(h′xw′×n) is the output feature map of the corresponding n channels, h′ and w′ respectively represent the height and width of the output feature map, and b represents the bias term; The flops required for the convolution process are represented as: flops = h × w × n × c × k × k In the linear transformation, let the operation kernel size be g × g, the original method obtains m feature maps, and the change quantity is s. According to the identity of the Ghost module, an effective transformation can be obtained: n = m × s The computational cost gr of the Ghost module can be expressed as: In summary, the convolutional computational cost r improved using the Ghost module is expressed as: Therefore, using the Ghost module, the calculation is about 1 / s of the standard convolution.
4. The optimization method for the YOLOv8n model used for aircraft skin defect detection according to claim 1, wherein: The attention occlusion mechanism AOM in step B dynamically adjusts the feature weight values of each channel by learning global context information, and improves the detection accuracy of the network for occlusion defects and small target defects.
5. An evaluation method for the optimized YOLOv8n model as described in claims 1-4, characterized in that, It includes the following steps: A. Preprocess the aircraft skin defect image dataset, establish an aircraft skin defect database containing a training set, a validation set, and a test set, and perform bounding box annotation on the defect instances; B. Train the optimized YOLOv8n model based on the preprocessed defect image dataset in step A, verify and test the model performance through the validation set and the test set, and generate a confusion matrix to evaluate the model classification performance; C. Evaluate the optimized YOLOv8n model using precision, frames per second, model size, and mean average precision.
6. The evaluation method of the optimized YOLOv8n model according to claim 5, characterized in that: The aircraft skin defect image dataset in step A contains 15,000 training set images, 4,370 validation set images, and 5,000 test set images. Each defect instance is pixel-level annotated with a bounding box.
7. The evaluation method of the optimized YOLOv8n model according to claim 5, wherein: In step C, the IoU thresholds of the confusion matrix in step B are taken as 0.5 and 0.5 - 0.95 respectively, that is, mAP@0.5 and mAP@.5:.
95. The calculation formula of the IoU is: Among them, TP refers to the number of samples that the model correctly predicts as positive classes, FP refers to the number of samples that the model wrongly predicts as positive classes, and FN refers to the number of samples that the model wrongly predicts as negative classes.
8. Use of the YOLOv8n model for detecting aircraft skin defects as described in any one of claims 1-7, characterized in that: It includes the optimized YOLOv8n model for detecting aircraft skin defects.