A wind power blade defect detection method based on improved YOLOv8
By improving the YOLOv8 algorithm, embedding the DA-SPDConv and DA-SPPCSPC modules, and combining the PIOU loss function, the problems of accuracy and speed in wind turbine blade defect detection were solved, achieving efficient and accurate detection results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUBEI ENERGY GROUP HUANGSHI WIND POWER CO LTD
- Filing Date
- 2025-08-26
- Publication Date
- 2026-07-07
Smart Images

Figure CN121010588B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of blade defect detection technology, and in particular to a wind turbine blade defect detection method based on an improved YOLOv8. Background Technology
[0002] With my country's growing demand for clean energy, wind power has received widespread attention as an important renewable energy source. Wind turbine blades, as key components in wind turbine generators for collecting and utilizing wind energy, directly affect the efficiency of the entire wind power system. However, wind turbines operate in complex and harsh natural environments (such as strong winds, dust storms, and humidity fluctuations), inevitably leading to various defects in the blades, such as surface cracks, damage, and coating peeling.
[0003] Traditional methods for detecting defects in wind turbine blades primarily rely on manual inspection. Inspectors check each blade individually using visual methods. This approach is not only inefficient and labor-intensive, but also prone to missed or false detections. Furthermore, while some contact-sensor-based methods, such as ultrasonic testing and eddy current testing, can improve accuracy to some extent, they require direct contact with the blade surface, making the process cumbersome and potentially causing secondary damage. They also struggle to achieve rapid and comprehensive inspection of large areas of the blade.
[0004] In recent years, computer vision technology has made significant progress in the field of industrial inspection. Deep learning-based object detection algorithms have attracted much attention due to their powerful feature extraction and automatic classification capabilities. The YOLO (You Only Look Once) series of algorithms, as a typical representative, has demonstrated its advantages in speed and efficiency in object detection tasks. YOLOv8 further optimizes the network structure and training strategy based on previous versions, improving detection accuracy and speed. However, directly applying YOLOv8 to wind turbine blade defect detection still faces some challenges. For example, wind turbine blade defects are diverse in type and shape, and some defect features are quite subtle. Conventional YOLOv8 networks may struggle to fully learn these complex defect features, leading to less than ideal detection accuracy. Simultaneously, wind turbine blade images have complex backgrounds, with factors such as lighting variations and shadow interference, which can easily cause misjudgments by the model. Therefore, it is necessary to make targeted improvements to the YOLOv8 algorithm to enhance its accuracy and reliability in wind turbine blade defect detection, meeting the urgent needs of the wind power industry for efficient and accurate blade defect detection technology.
[0005] Chinese invention patent application number CN202011470894.2 discloses a lightweight identification method for surface damage of wind turbine blades. It proposes to use the MobileNet algorithm as the feature extraction algorithm and the YOLOv3 algorithm as the target detection algorithm to detect defects in wind turbine blades. However, the detection speed of this method is relatively slow in practical applications.
[0006] Chinese invention patent application number CN2021100559945.7 discloses a method, device and storage medium for detecting defects in wind turbine blades by drone inspection. It selects CSPDarknet53 as the feature extraction module in the YOLOv4 network and selects ASPP and PAN as the feature fusion layer. However, this method has low accuracy in detecting defects in wind turbine blades.
[0007] In summary, existing methods for detecting defects in wind turbine blades struggle to achieve both high accuracy and rapid detection. Therefore, it is necessary to develop a method that combines real-time performance with good detection capabilities to promptly identify defects in wind turbine blades in practical applications, effectively ensuring the operational quality and safety of wind turbine blades. Summary of the Invention
[0008] In view of this, the present invention provides a wind turbine blade defect detection method based on improved YOLOv8, which can effectively improve the detection accuracy and speed of wind turbine blade defects.
[0009] The technical solution of this invention is implemented as follows:
[0010] This invention provides a method for detecting defects in wind turbine blades based on an improved YOLOv8, comprising:
[0011] S1. Acquire and process wind turbine blade image data, construct a dataset and divide it into training and test sets;
[0012] S2. Construct a wind turbine blade defect detection model. This model is based on the YOLOv8 architecture, and its backbone network integrates the DA-SPDConv module and the DA-SPPCSPC module. The DA-SPDConv module adaptively selects the spatial segmentation strategy based on the gradient direction information of the input feature map. The DA-SPPCSPC module adopts a multi-shape pooling kernel design and combines it with an adaptive weight adjustment mechanism. The training of the wind turbine blade defect detection model is optimized using the PIOU loss function.
[0013] S3. Use the training set to iteratively train the wind turbine blade defect detection model until the PIOU loss function converges. Then use the test set to verify the performance of the trained model until the verification results meet the preset performance indicators, and obtain the wind turbine blade defect detection model after training.
[0014] S4. Input the image of the wind turbine blade to be detected into the trained defect detection model and output the defect detection results.
[0015] Preferably, step S1 includes:
[0016] S11. Use a drone to photograph the wind turbine blades to obtain raw images;
[0017] S12. Filter out defect images containing cracks, holes and detachment from the original images;
[0018] S13. Use YOLO format to annotate the selected defect images and generate corresponding TXT tag files. The TXT tag files store the category of wind turbine blade defects and the coordinates of the marked boxes.
[0019] S14. Use the Mosaic method to perform data augmentation on the labeled defect images, and use the augmented images to form a dataset, which is then divided into a training set and a test set according to a preset ratio.
[0020] Preferably, the DA-SPDConv module performs the following operations on the input feature map:
[0021] For the input feature map The Sobel operator is used to calculate the gradient responses in the horizontal and vertical directions respectively:
[0022]
[0023] The Sobel convolution kernel is defined as follows:
[0024]
[0025] Spatial average pooling is performed on the gradient responses in the horizontal and vertical directions to obtain global orientation information:
[0026]
[0027] The directional weight α reflects the relative strength of the gradient in the vertical direction:
[0028]
[0029] Where H is the feature map height, W is the feature map width, C is the number of feature map channels, and G is the feature map height. x (i,j) and G y (i,j) represent the horizontal and vertical gradient values at position (i,j), respectively. and The average gradient intensities in the horizontal and vertical directions are respectively, ∈=1×10 ―8 To avoid dividing by zero for small constants;
[0030] The spatial segmentation strategy is adaptively selected based on the value of the directional weight α to reorganize the feature map, resulting in a feature map with rearranged spatial dimensions.
[0031] The channel dimension of the recombined feature map is adjusted to the original number of channels C by using a non-stepping convolutional layer, and the processed feature map is output.
[0032] Preferably, the spatial segmentation strategy is adaptively selected based on the value of the direction weight α, including:
[0033] When α > 0.6, a 1×4 segmentation mode is used, and the output Y is... 1×4 (i,j,:)=Concat[X(i,4j),X(i,4j+1),X(i,4j+2),X(i,4j+3)];
[0034] When α < 0.4, a 4×1 partitioning mode is used, and the output Y is... 4×1 (i,j,:)=Concat[X(4i,j),X(4i+1,j),X(4i+2,j),X(4i+3,j)];
[0035] In other cases, a 2×2 partitioning mode is used, and the output Y is... 2×2 (i,j,:)=Concat[X(2i,2j),X(2i,2j+1),X(2i+1,2j),X(2i+1,2j+1)];
[0036] Where Y is the output reconstructed feature map, i and J are the spatial coordinate indices of the feature map, and Concat(·) is the channel dimension concatenation operation.
[0037] Preferably, the DA-SPPCSPC module adopts a multi-shape pooling design, which includes 5×5, 9×9, and 13×13 square pooling cores, as well as 3×1 vertical strip pooling cores and 1×3 horizontal strip pooling cores.
[0038] Preferably, the DA-SPPCSPC module also performs orientation-adaptive weight adjustment on the strip pooling features generated by the strip pooling kernel:
[0039] Receive the direction weight α from the DA-SPDConv module as the direction prior weight α spd And based on α spd Calculate the vertical bar pooling weights w v and horizontal bar pooling weights w h :
[0040] Vertical bar pooling weights: w v =clip(1+k·(α) spd —0.5), 0.5, 1.5);
[0041] Horizontal bar pooling weights: w h =clip(1+k·(0.5―α) spd ),0.5,1.5);
[0042] Where k is the weight adjustment factor, and the clip function is used to limit the weight values within a preset range.
[0043] Preferably, the DA-SPPCSPC module adopts a cross-stage partially connected CSPC structure, which divides the input features into two parts, part1 and part2. Part1 directly performs convolution operations, while part2 performs convolution operations and multi-shape pooling operations in sequence, and then concatenates and fuses the output of part1.
[0044] Preferably, the PIOU loss function is calculated as follows:
[0045] PIoU=IoU―f(P),―1≤PIoU≤1
[0046] L PIoU =1―PIoU=L IoU +f(P),0≤L PIoU ≤2
[0047]
[0048]
[0049] Where IoU is the intersection-union ratio of the predicted bounding box and the target bounding box, P is the penalty factor for adaptive target size, and f(P) is the penalty function for adaptive predicted bounding box quality; dw1, dw2, dh1, and dh2 are the absolute values of the distances between corresponding edges of the predicted bounding box and the target bounding box, w gt and h gt This indicates the width and height of the target bounding box.
[0050] Preferably, in step S3, the model training uses the SGD optimizer; the preset performance metrics used for performance verification are precision, recall, and mean average precision (mAP).
[0051] Preferably, in step S3, the model training process disables Mosaic data augmentation in the last ten rounds of training and switches to training using the original images.
[0052] The present invention has the following advantages over the prior art:
[0053] (1) This invention uses the Mosaic data augmentation method to stitch the original images together by random scaling and random cropping, which effectively alleviates the problem of sample imbalance and enhances the robustness of the model. In the last ten training rounds, the Mosaic data augmentation is turned off, allowing the model to focus more on the details of the real image, effectively improving the model's generalization ability and performance in wind turbine blade defect detection.
[0054] (2) This invention proposes to embed the direction-aware SPDConv convolutional module (DA-SPDConv) into the backbone network of the YOLOv8 network model. Through the direction detection mechanism and adaptive spatial segmentation strategy, it can better capture the feature information of irregular shapes, especially the directional features of slender cracks, and improve the model's recognition rate of slender and micro cracks.
[0055] (3) This invention proposes to replace the original Spatial Pyramid SPPF module with the Defect-Aware SPPCSPC module (DA-SPPCSPC) in the backbone network of the YOLOv8 network model. By adding a strip pooling kernel and an orientation-adaptive weight adjustment mechanism, the features of different levels and receptive fields can be fully integrated. In particular, the feature extraction capability for linear defects is significantly enhanced, enriching the diversity of features and improving the expressive power of network features.
[0056] (4) This invention proposes to replace the original loss function CIoU of the YOLOv8 model with the PIoU loss function, so that the anchor box can more accurately regress to the vicinity of the target box, improve the target detection accuracy and convergence speed, and reduce the training time of the model.
[0057] (5) This invention establishes an information transmission and coordination mechanism between DA-SPDConv and DA-SPPCSPC. Through the transmission of directional weight information, the two modules achieve effective coordination, which further improves the detection accuracy of wind turbine blade defects, especially linear defects. Attached Figure Description
[0058] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0059] Figure 1 This is a flowchart of the method of the present invention;
[0060] Figure 2 The image is the result of Mosaic data enhancement processing according to the present invention;
[0061] Figure 3 This is a structural diagram of the model of the present invention;
[0062] Figure 4 This is a structural diagram of the DA-SPDConv module of the present invention;
[0063] Figure 5 This is a structural diagram of the DA-SPPCSPC module of the present invention;
[0064] Figure 6 This is a diagram of the PIoU loss function structure of the present invention;
[0065] Figure 7 This is a comparison chart of the detection results of the present invention. Detailed Implementation
[0066] The technical solutions of the present invention will be clearly and completely described below with reference to the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0067] like Figure 1 As shown, this invention provides a method for detecting defects in wind turbine blades based on an improved YOLOv8, comprising:
[0068] S1. Acquire and process wind turbine blade image data, construct a dataset and divide it into training and test sets;
[0069] S2. Construct a wind turbine blade defect detection model. This model is based on the YOLOv8 architecture, and its backbone network integrates the DA-SPDConv module and the DA-SPPCSPC module. The DA-SPDConv module adaptively selects the spatial segmentation strategy based on the gradient direction information of the input feature map. The DA-SPPCSPC module adopts a multi-shape pooling kernel design and combines it with an adaptive weight adjustment mechanism. The training of the wind turbine blade defect detection model is optimized using the PIOU loss function.
[0070] S3. Use the training set to iteratively train the wind turbine blade defect detection model until the PIOU loss function converges. Then use the test set to verify the performance of the trained model until the verification results meet the preset performance indicators, and obtain the wind turbine blade defect detection model after training.
[0071] S4. Input the image of the wind turbine blade to be detected into the trained defect detection model and output the defect detection results.
[0072] Specifically, in one embodiment of the present invention, step S1 includes:
[0073] S11. Use a drone to photograph the wind turbine blades to obtain raw images.
[0074] In this embodiment, a drone was used to photograph wind turbine blades in a certain area of Central China, obtaining a total of 2,362 original images. Drone photography enables non-contact inspection of wind turbine blades, avoiding the limitations of traditional manual inspections and contact sensor detection methods. This reduces labor costs and safety risks, while enabling rapid and comprehensive inspection of large areas of blades.
[0075] S12. Filter out defect images containing cracks, holes and detachment from the original images.
[0076] In this embodiment, 2305 images containing three common defects—cracks, holes, and detachment—were selected from the 2362 original images obtained. These three defect types are the most common forms of damage to wind turbine blades during long-term operation. Cracks typically exhibit a slender linear feature, holes present as irregular pore-like defects, and detachment manifests as localized loss of surface coating or material.
[0077] S13. Use YOLO format to annotate the selected defect images and generate corresponding TXT tag files. The TXT tag files store the category of wind turbine blade defects and the coordinates of the marked boxes.
[0078] In this embodiment, the labeling software LabelImg is used to label the wind turbine blade defects in the sample image in YOLO format, and a TXT label file is automatically generated. The TXT label file stores the category of the wind turbine blade defect and the coordinate information of the bounding box. Each line of the record contains the defect category ID and the normalized bounding box coordinate parameters (center point coordinates, width, and height).
[0079] S14. Use the Mosaic method to perform data augmentation on the labeled defect images, and use the augmented images to form a dataset, which is then divided into a training set and a test set according to a preset ratio.
[0080] In this embodiment, Mosaic data augmentation technology is selected to expand images of common defects. Mosaic data augmentation combines four images into one image according to a certain ratio, enabling the model to identify targets within a smaller range, enhancing data diversity and model robustness, and thus improving the model's detection performance for wind turbine blade defects. The Mosaic-augmented image is shown below. Figure 2 As shown, after data augmentation, the number of images was expanded from 2305 to 4272. From the expanded wind turbine blade defect dataset, 4000 images were selected and divided into training and testing sets in a 9:1 ratio. The training set was used for model training, and the testing set was used to evaluate model performance.
[0081] Specifically, in one embodiment of the present invention, the wind turbine blade defect detection model constructed in step S2 is based on the YOLOv8 architecture, and its structure is as follows: Figure 3 As shown, this invention embeds DA-SPDConv convolutional modules at three different scale locations in the YOLOv8 model backbone and replaces the SPPF module in the neck network with a DA-SPPCSPC module. This improved design better adapts to the characteristics of wind turbine blade defect detection tasks, especially its ability to detect linear defects such as slender cracks. Simultaneously, a PIOU loss function is used for training optimization.
[0082] In this embodiment, three DA-SPDConv modules are deployed in the backbone network, located as follows: the first DA-SPDConv: located before the first C2f module, processing high-resolution feature maps; the second DA-SPDConv: located before the second C2f module, processing medium-resolution feature maps; and the third DA-SPDConv: located before the third C2f module, processing low-resolution feature maps.
[0083] The DA-SPDConv module consists of a direction detection module, an adaptive SPD layer, and a non-staggered convolutional layer. The structure of this module is as follows: Figure 4 As shown, the DA-SPDConv module adds orientation detection to the combination of space-to-depth (SPD) layers and non-staggered convolution (Conv) layers.
[0084] The orientation detection module quickly identifies the main edge orientations in the input feature map through gradient analysis. (The text then repeats the process for the input feature map.) The Sobel operator is used to calculate the gradient responses in the horizontal and vertical directions respectively:
[0085]
[0086] The Sobel convolution kernel is defined as follows:
[0087]
[0088] Spatial average pooling is performed on the gradient responses in the horizontal and vertical directions to obtain global orientation information:
[0089]
[0090] The directional weight α reflects the relative strength of the gradient in the vertical direction:
[0091]
[0092] Where H is the feature map height, W is the feature map width, C is the number of feature map channels, and G is the feature map height. x (i,j) and G y (i,j) represent the horizontal and vertical gradient values at position (i,j), respectively. and The average gradient intensities in the horizontal and vertical directions are respectively, ∈=1×10 ―8 To avoid dividing by zero for small constants.
[0093] The adaptive SPD layer determines the spatial segmentation strategy based on the orientation weight α:
[0094]
[0095] For a 1×4 segmentation (vertical dominance), each 1×4 feature block is recombined into a single pixel, with an output size of [size missing].
[0096] Y 1×4 (i,j,:)=Concat[X(i,4j),X(i,4j+1),X(i,4j+2),X(i,4j+3)].
[0097] For a 4×1 partition (lateral dominance), the output size is
[0098] Y 4×1 (i,j,:)=Concat[X(4i,j),X(4i+1,j),X(4i+2,j),X(4i+3,j)].
[0099] For 2×2 partitioning (standard mode), the output size is
[0100] Y 2×2 (i,j,:)=Concat[X(2i,2j),X(2i,2j+1),X(2i+1,2j),X(2i+1,2j+1)].
[0101] Where Y is the output reconstructed feature map, i and j are the spatial coordinate indices of the feature map, and Concat(·) is the channel dimension concatenation operation.
[0102] DA-SPDConv employs an adaptive segmentation strategy to better preserve the structural integrity of slender cracks, reducing spatial dimensionality without information loss while retaining information within the channels, thus improving the recognition rate of slender and minute cracks. This module also passes the directional weight α to the subsequent DA-SPPCSPC module, establishing an information collaboration mechanism between modules.
[0103] Non-staggered convolutional layer: The channel dimension of the recombined feature map is adjusted to the original number of channels C through a 1×1 non-staggered convolutional layer, and the processed feature map is output.
[0104] In this embodiment, the DA-SPPCSPC module borrows the idea of Cross-Stage Partial Connection (CSPC) and combines the CSPC module with the extended SPP module. CSPC introduces local connection operations to partially connect low-level features with high-level features, realizing cross-stage information transfer, improving the expressive power of network features, enhancing feature representation and receptive field, and improving network performance and robustness.
[0105] Specifically, the DA-SPPCSPC module is located at the end of the backbone network, replacing the SPPF module in the original YOLOv8, and serves as a key connection module between the backbone network and the neck network.
[0106] The DA-SPPCSPC module structure is as follows: Figure 5 As shown, the input features are first divided into two parts, part1 and part2, and a CSP structure is adopted. Then, regular convolution operations are performed on part1, and convolution operations of size 1×1, 3×3 and 1×1 are performed on part2 in sequence, followed by extended SPP spatial pyramid pooling operations.
[0107] The DA-SPPCSPC employs a multi-shape pooling design, including 5×5, 9×9, and 13×13 square pooling cores, as well as 3×1 vertical strip pooling cores and 1×3 horizontal strip pooling cores. The newly added strip pooling cores are specifically designed to capture linear defect characteristics of wind turbine blades, effectively identifying linear defects such as slender cracks. The specific pooling core configurations are as follows:
[0108] Square pooling kernels: 5×5, 9×9, and 13×13 max pooling kernels are used to capture square or near-square features of different scales;
[0109] New strip pooling kernels: 3×1 vertical strip pooling kernel and 1×3 horizontal strip pooling kernel, specifically designed to capture linear features in the vertical and horizontal directions, effectively identifying linear defects such as slender cracks.
[0110] For the input feature map The mathematical expressions for each pooling operation are:
[0111] Square pooling:
[0112] Vertical bar pooling:
[0113] Horizontal bar pooling:
[0114] Where i, j, and c are the height, width, and channel index of the feature map, respectively, and k is the pooling kernel size.
[0115] Direction Adaptive Weight Adjustment Mechanism: DA-SPPCSPC receives the direction weight α passed from DA-SPDConv as the direction prior weight α. spd And based on α spd Calculate the vertical bar pooling weights w v and horizontal bar pooling weights w h :
[0116] Vertical bar pooling weights: w v =clip(1+k·(α) spd ―0.5), 0.5, 1.5);
[0117] Horizontal bar pooling weights: w h =clip(1+k·(0.5―α) spd ),0.5,1.5);
[0118] Where k is the weight adjustment factor, and clip(x,a,b) means restricting x to the range [a,b].
[0119] Weighted adjustments are made to the bar pooling output before feature concatenation:
[0120] P′ 3×1 =w v ·P 3×1 , P′ 1×3 =w h ·P 1×3
[0121] Then perform feature concatenation:
[0122] F concat =Concat(P 5×5 ,p 9×9 ,p 13×13 ,p′ 3×1 ,P′ 1×3 )
[0123] The concatenated feature map has 5 channels, and feature fusion is performed using a 1×1 convolution:
[0124] F fused =Conv 1×1 (F concat W fusion )
[0125] Among them, W fusion These are the weight parameters for the fusion convolution.
[0126] Module collaboration mechanism: An information transmission mechanism is established between DA-SPDConv and DA-SPPCSPC, with directional weight α. spd As prior information about the global direction remains unchanged during forward propagation, the two modules work together. This design enables DA-SPPCSPC to dynamically adjust feature weights based on the direction information detected by DA-SPDConv, enhancing pooling features consistent with the main direction and suppressing inconsistent features, thereby improving the accuracy of identifying linear defects in wind turbine blades.
[0127] Specifically, this embodiment adopts a hierarchical weight selection strategy, the specific mechanism of which is as follows:
[0128] Each layer's weights are calculated independently: The three DA-SPDConv modules in the backbone network calculate their respective directional weights, denoted as α1, α2, and α3, which correspond to the directional information of the high, medium, and low resolution feature maps, respectively.
[0129] Weight usage hierarchy: α1 and α2: used only for adaptive segmentation decisions within their respective DA-SPDConv modules, and not passed across modules; α3: in addition to being used for adaptive segmentation in the third DA-SPDConv module, it is also passed as global direction prior information to the DA-SPPCSPC module.
[0130] Weight propagation path: such as Figure 3 As shown by the dashed line, the direction weight α3 calculated by the third DA-SPDConv module is passed to the DA-SPPCSPC module through the forward propagation process, and is denoted as α. spd =α3.
[0131] Combination Figure 3 The complete process of module collaboration in the network structure shown is as follows:
[0132] Input processing: The input image is processed through the initial convolutional layer and then enters the backbone network.
[0133] Multi-scale orientation detection: The first DA-SPDConv calculates α1 for adaptive segmentation of high-resolution features; the second DA-SPDConv calculates α2 for adaptive segmentation of medium-resolution features; the third DA-SPDConv calculates α3 for adaptive segmentation of low-resolution features.
[0134] Weight propagation: The third DA-SPDConv uses its calculated directional weight α3 as α. spd Pass it to the DA-SPPCSPC module.
[0135] Adaptive Feature Enhancement: The DA-SPPCSPC module enhances features based on the received α. spdAdjust the weights of bar pooling features to enhance features that align with the main direction.
[0136] Feature fusion and output: The processed features pass through the feature pyramid structure of the neck network, and finally output multi-scale detection results.
[0137] In this embodiment, the original loss function CIoU of the YOLOv8 model is replaced with the PioU loss function. In wind turbine blade defect detection tasks, the complexity of the background and the difficulty of image acquisition conditions often result in low dataset sample quality. Furthermore, the defect patterns of wind turbine blades are not uniform, leading to large variations in the shape of the target detection box and unstable aspect ratios.
[0138] The PIoU loss function proposes an adaptive penalty factor P for target size, which is only related to the size of the target box and is independent of the size of the smallest outer box of the predicted box and the target box. Even if the predicted box expands, it will not affect the size of P, thus improving the adaptability to target size. Its definition formula is as follows:
[0139]
[0140] In the formula, dw1, dw2, dh1, and dh2 are the absolute values of the distances between the corresponding edges of the predicted bounding box and the target bounding box, and w gt and h gt The width and height of the target bounding box are represented by the PIOU loss function structure diagram as shown below. Figure 6 As shown.
[0141] To further improve the loss function, PIOU proposed an adaptive penalty function f(P) for the quality of the predicted bounding box, as follows:
[0142]
[0143] A larger P-value indicates a more significant difference between the predicted and target boxes, resulting in a smaller function f(P), which suppresses harmful gradients from low-quality predicted boxes. When P is near 1, it indicates that the predicted box is near the target box, and a larger f(P) value accelerates the regression of the loss function. When P approaches 0, the function f(P) decreases as the quality of the predicted box increases, continuously optimizing the predicted box to overlap with the target box. The penalty function f(P) ensures that medium-quality predicted boxes have the largest gradient, allowing them to quickly regress to the vicinity of the target box, thus transforming these average-quality predicted boxes into high-quality ones. This allows the object detection network to focus more on medium-quality anchor boxes. The PIOU loss function is calculated as follows:
[0144] PIoU=IoU―f(P),―1≤PIoU≤1
[0145] L PIoU =1―PIoU=L IoU +f(P),0≤L PIoU ≤2
[0146] Where IoU is the intersection-union ratio of the predicted bounding box and the target bounding box, P is the penalty factor for adaptive target size, and f(P) is the penalty function for adaptive predicted bounding box quality.
[0147] This loss function design guides the anchor boxes to regress more accurately to the vicinity of the target box, improving target detection accuracy and convergence speed while reducing model training time. Compared to the traditional CIoU loss function, the PioU loss function demonstrates better convergence performance and detection accuracy in wind turbine blade defect detection tasks.
[0148] Specifically, in one embodiment of the present invention, step S3 uses the training set to iteratively train the wind turbine blade defect detection model until the PIOU loss function converges, and then uses the test set to verify the performance of the trained model until the verification result meets the preset performance index, thus obtaining the trained wind turbine blade defect detection model.
[0149] In this embodiment, the SGD optimizer is used during the training of the improved YOLOv8 model to adjust the model parameters to minimize the loss function. In the SGD optimizer, the model parameters are updated in the direction of the negative gradient, causing the value of the loss function to gradually decrease. The partial derivative of the error of each training sample with respect to each parameter is calculated and applied to the current value of the parameter to update it. During iteration, after each update, the error of the next sample is calculated, and the parameters are updated again. This process is repeated multiple times until a certain convergence condition is met or the pre-set maximum number of iterations is reached.
[0150] The specific training parameters are configured as follows:
[0151] Batch size: 16. Number of epochs: 200. Initial learning rate: 0.01. Weight decay: 0.0005. Optimizer: SGD.
[0152] The parameter update rules for the SGD optimizer are as follows:
[0153]
[0154] Where, θ t Here are the model parameters at the t-th iteration, and η is the learning rate. Let L be the gradient of the loss function L with respect to the parameter θ.
[0155] In actual training, momentum SGD is used to accelerate convergence:
[0156]
[0157] θ t+1 =θ t ―v t+1
[0158] Where v t β is the momentum term, and β is the momentum coefficient, set to 0.9.
[0159] In this embodiment, the Mosaic data augmentation method is employed. By randomly scaling and cropping the original images, the imbalanced sample problem is effectively alleviated, enhancing the model's robustness. Mosaic data augmentation combines four images into one in a certain proportion, enabling the model to identify targets within a smaller area. This enhances data diversity and model robustness, thus improving the model's performance in detecting defects in wind turbine blades.
[0160] To further improve the model's generalization ability, Mosaic data augmentation was disabled in the last ten training epochs, and training was conducted using the original images instead. This strategy allows the model to focus more on the details of real images, effectively improving its generalization ability and performance in wind turbine blade defect detection.
[0161] During training, the convergence of the model is evaluated by monitoring changes in the PioU loss function. The formula for calculating the PioU loss function is as described above. The model is considered to have converged when the PioU loss function remains stable or decreases by less than a preset threshold over multiple consecutive epochs.
[0162] In this embodiment, precision, recall, and mean average precision (mAP) are used as preset performance metrics to evaluate the model performance. These three common object detection evaluation metrics can comprehensively evaluate the detection effect of the model of this invention.
[0163] Precision reflects the proportion of samples that the model predicts to be positive but are actually positive.
[0164]
[0165] Recall reflects the proportion of samples that were actually positive but were correctly predicted as positive by the model.
[0166]
[0167] The mean average precision (mAP) is the average of the average precision (AP) across all categories.
[0168]
[0169] In the formula, P is the average precision, N is the number of categories to be identified, TP indicates that the model predicts a positive example as a positive example, FN indicates that the model predicts a positive example as a negative example, and FP indicates that the model predicts a negative example as a positive example.
[0170] This embodiment verifies the effectiveness of the improved method through comparative experiments. The present invention and the original YOLOv8 were tested on the same test set, and the comparison results of various performance indicators are shown in Table 1 below:
[0171] Table 1 Comparison of various performance indicators of the test set
[0172]
[0173]
[0174] As shown in the table, compared with the original YOLOv8, the present invention has a better recognition effect in wind turbine blade defect detection, with an mAP value of 94.9%. Based on the original YOLOv8, the precision (P) is improved by 11.4% and the recall (R) is improved by 2.1%, which shows that the present invention can detect wind turbine blade defects better.
[0175] When the verification results meet the preset performance indicators (accuracy ≥ 90%, recall ≥ 85%, mAP ≥ 90%), the training is considered complete, and the trained wind turbine blade defect detection model is obtained.
[0176] Specifically, in one embodiment of the present invention, step S4 inputs the image of the wind turbine blade to be detected into the trained defect detection model and outputs the defect detection result.
[0177] In this embodiment, necessary preprocessing operations are performed on the wind turbine blade image to be detected, including:
[0178] The input image is adjusted to the standard size used during model training, the pixel values are normalized to the range of [0,1], and a batch dimension is added to a single image to form a tensor with the shape (1,3,640,640).
[0179] In this embodiment, the image to be detected is used for forward inference through the trained improved YOLOv8 model. The specific process is as follows:
[0180] Feature extraction stage: The image first passes through the convolutional layer of the backbone network and the DA-SPDConv module for feature extraction. The DA-SPDConv module adaptively selects the spatial segmentation strategy based on the gradient direction information to better capture the features of the slender cracks.
[0181] Feature enhancement stage: The extracted features are pooled in multiple scales and shapes using the DA-SPPCSPC module. This module enhances the feature representation ability of linear defects through the addition of a strip pooling kernel and an orientation adaptive weight adjustment mechanism.
[0182] Feature fusion stage: Multi-scale features enhanced by feature fusion are fused through the neck network to generate feature maps of different scales;
[0183] Detection and prediction stage: The fused feature map is used by the detection head to perform the final target detection prediction, and the output includes the bounding box coordinates, confidence score and class probability.
[0184] In this embodiment, the original detection results output by the model are post-processed, including:
[0185] Confidence filtering: Set a confidence threshold (usually 0.5) to filter out detection results with a confidence level below the threshold;
[0186] Non-maximum suppression (NMS): The NMS algorithm is used to remove duplicate detections and retain the best detection result. The specific steps of NMS are as follows: sort the detection boxes in descending order of confidence; select the detection box with the highest confidence as the reference box; calculate the IoU value between the reference box and other detection boxes; delete the detection boxes with an IoU value greater than the NMS threshold (usually 0.5); repeat the above steps until all detection boxes have been processed.
[0187] Coordinate transformation: Convert the normalized detection box coordinates to absolute coordinates in the original image coordinate system.
[0188] In this embodiment, the output defect detection results include the following information:
[0189] Defect category identification: The identified wind turbine blade defect types include three types: crack, hole, and peeling;
[0190] Detection bounding boxes: the bounding box coordinates of each defect, in (x... min ,y min ,x max ,y max The form is represented as (x) min ,y min (x) represents the coordinates of the top-left corner. max ,y max () represents the coordinates of the bottom right corner;
[0191] Detection confidence score: The confidence score of each defect detection result, ranging from [0,1]. The higher the value, the more reliable the detection result.
[0192] Defect location information: Calculate the geometric features of the defect, such as its center position and area, based on the bounding box coordinates;
[0193] Detection statistics: Outputs statistics on the number of various defects detected, providing a basis for subsequent maintenance decisions.
[0194] Through the complete detection process described above, this invention enables accurate and efficient detection of defects in wind turbine blades, providing reliable technical support for the operation and maintenance of wind power equipment. Experimental results show that, based on the original YOLOv8 method, this invention optimizes the backbone network, feature pyramid, and loss function, effectively improving the detection accuracy of the YOLOv8 network model for wind turbine blade defects. The improved method shows a significant improvement in detection performance compared to the original YOLOv8 method, meeting real-time requirements while improving detection accuracy. Detection results are as follows: Figure 7 As shown, where Figure 7 Part (a) in the table represents the original YOLOv8 detection results. Figure 7 Part (b) of the diagram represents the detection results of this invention. (From...) Figure 7 It can be seen that the method of the present invention has higher accuracy in identifying defects in wind turbine blades and has good practicality in real-world application scenarios, effectively ensuring the operational quality and safety of wind turbine blades.
[0195] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for detecting defects in wind turbine blades based on an improved YOLOv8, characterized in that, include: S1. Acquire and process wind turbine blade image data, construct a dataset and divide it into training and test sets; S2. Construct a wind turbine blade defect detection model. This model is based on the YOLOv8 architecture, and its backbone network integrates the DA-SPDConv module and the DA-SPPCSPC module. The DA-SPDConv module adaptively selects the spatial segmentation strategy based on the gradient direction information of the input feature map. The DA-SPPCSPC module adopts a multi-shape pooling kernel design and combines it with an adaptive weight adjustment mechanism. The training of the wind turbine blade defect detection model is optimized using the PIOU loss function. The DA-SPDConv module performs the following operations on the input feature map: For the input feature map The Sobel operator is used to calculate the gradient responses in the horizontal and vertical directions respectively: ; The Sobel convolution kernel is defined as follows: ; Spatial average pooling of the gradient responses in the horizontal and vertical directions yields global orientation information: ; Calculate directional weights Reflecting the relative intensity of the gradient in the vertical direction: ; in, For feature map height, The width of the feature map. The number of feature map channels. and Positions The horizontal and vertical gradient values at that location, and These represent the average gradient intensities in the horizontal and vertical directions, respectively. To avoid dividing by zero for small constants; The spatial segmentation strategy is adaptively selected based on the value of the directional weight α to reorganize the feature map, resulting in a feature map with rearranged spatial dimensions. The channel dimension of the recombined feature map is adjusted to the original number of channels C by using a non-stepping convolutional layer, and the processed feature map is output. The spatial segmentation strategy is adaptively selected based on the value of the direction weight α, including: when At that time, adopt Split mode, output ; when At that time, adopt Split mode, output ; Other situations shall be adopted Split mode, output ; in, The output is the recombined feature map. and This is the spatial coordinate index of the feature map. This is a channel-level splicing operation; The DA-SPPCSPC module adopts a multi-shape pooling design, which includes 5×5, 9×9, and 13×13 square pooling kernels, as well as 3×1 vertical bar pooling kernels and 1×3 horizontal bar pooling kernels. The DA-SPPCSPC module also performs orientation-adaptive weight adjustment on the strip pooling features generated by the strip pooling kernel: Receive the direction weight α from the DA-SPDConv module as the direction prior weight. and based on Calculate vertical bar pooling weights and horizontal bar pooling weights : Vertical bar pooling weights: ; Horizontal bar pooling weights: ; Where k is the weight adjustment factor, and the clip function is used to limit the weight value to a preset range; The DA-SPPCSPC module adopts a cross-stage partially connected CSPC structure, which divides the input features into two parts, part1 and part2. Part1 directly performs convolution operations, while part2 performs convolution operations and multi-shape pooling operations in sequence, and then concatenates and fuses the output of part1. S3. Use the training set to iteratively train the wind turbine blade defect detection model until the PIOU loss function converges. Then use the test set to verify the performance of the trained model until the verification results meet the preset performance indicators, and obtain the wind turbine blade defect detection model after training. S4. Input the image of the wind turbine blade to be detected into the trained defect detection model and output the defect detection results.
2. The wind turbine blade defect detection method based on improved YOLOv8 according to claim 1, characterized in that, Step S1 includes: S11. Use a drone to photograph the wind turbine blades to obtain raw images; S12. Filter out defect images containing cracks, holes and detachment from the original images; S13. Use YOLO format to annotate the selected defect images and generate corresponding TXT tag files. The TXT tag files store the category of wind turbine blade defects and the coordinates of the marked boxes. S14. Use the Mosaic method to perform data augmentation on the labeled defect images, and use the augmented images to form a dataset, which is then divided into a training set and a test set according to a preset ratio.
3. The wind turbine blade defect detection method based on improved YOLOv8 according to claim 1, characterized in that, The PIoU loss function is calculated as follows: ; ; ; ; in, The intersection-union ratio (IU) of the predicted bounding box and the target bounding box. The penalty factor is an adaptive target size. This is a penalty function for the quality of the adaptive prediction box; , , and This is the absolute value of the distance between the corresponding edges of the predicted bounding box and the target bounding box. and This indicates the width and height of the target bounding box.
4. The wind turbine blade defect detection method based on improved YOLOv8 according to claim 1, characterized in that, In step S3, the model training uses the SGD optimizer; the preset performance metrics used for performance verification are precision, recall, and mean average precision (mAP).
5. The wind turbine blade defect detection method based on improved YOLOv8 according to claim 2, characterized in that, In step S3, the model training process disables Mosaic data augmentation in the last ten rounds of training and switches to training using the original images.
Citation Information
Patent Citations
Wind driven generator blade surface damage lightweight identification method
CN112581443A
Visual detection method for surface defects of bearing ring
CN116664941A
Metal surface defect detection method
CN119251168A