Fan blade defect detection method based on improved YOLOv7 algorithm
By improving the YOLOv7 algorithm, the CARAFE module, SimAM attention mechanism and WIoU-v1 loss function are introduced, which solves the problems of low accuracy, slow speed and high complexity in fan blade detection, and achieves more efficient and accurate defect detection.
Patent Information
- Application Number
- CN202510524750.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-08-01
AI Technical Summary
The existing YOLO series algorithms have problems such as low detection accuracy, slow speed, high model complexity, insufficient recognition ability of small target defects and large complex background interference in fan blade defect detection.
By introducing the CARAFE module to replace YOLOv7's backbone feature network upsampling module, the SimAM attention mechanism and WIoU-v1 loss function are used to improve, and the YOLOv7 algorithm is optimized to improve feature expression capabilities and detection accuracy.
It significantly improves the accuracy and speed of fan blade defect detection, reduces the parameter quantity and calculation complexity of the model, achieves more efficient and lower cost detection, and enhances the ability to identify small targets and complex backgrounds.
Smart Images

Figure CN120411040A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image recognition and detection, and particularly to a method for detecting defects in wind turbine blades based on an improved YOLOv7 algorithm. Background Art
[0002] With the continuous growth of the global demand for clean energy, wind power generation, as a clean and renewable energy form, has received extensive attention and application. As a core component of the wind power generation system, the performance and health status of wind turbine blades directly affect the efficiency and safety of the entire wind power generation system. However, wind turbine blades are long-term exposed to complex and changing environments, such as wind loads, rain erosion, ice and snow, alternating high and low temperatures, etc. These factors can cause defects such as cracks, peeling, and corrosion on the surface and inside of the blades. These defects not only reduce the power generation efficiency of the wind turbines, but may also trigger serious safety accidents such as blade fractures, resulting in huge economic losses.
[0003] Currently, the methods for detecting defects in wind turbine blades mainly include manual inspection, drone inspection, and non-destructive testing technologies based on ultrasonic waves, infrared thermal imaging, etc. Although manual inspection is intuitive, it has limitations such as low efficiency, high cost, and susceptibility to environmental impacts, and it is difficult to meet the detection requirements of large-scale wind farms. Although drone inspection has increased the detection range, it still requires manual analysis of image data, and there are difficulties in identifying small target defects and defects in complex backgrounds. Although non-destructive testing technologies based on ultrasonic waves, infrared thermal imaging, etc. can detect internal defects of the blades, the equipment is expensive, the operation is complex, and it is difficult to comprehensively detect surface defects of the blades.
[0004] In the technical field of image recognition and detection, object detection algorithms based on computer vision and deep learning provide new solutions for the detection of wind turbine blade defects. Especially the YOLO (You Only Look Once) series of algorithms, with their efficient end-to-end characteristics, perform excellently in real-time detection tasks. However, different versions of the YOLO algorithm all have their own deficiencies when dealing with the task of detecting wind turbine blade defects.
[0005] Application and deficiencies of the YOLOv3 algorithm: Application: As an earlier version of the YOLO series of algorithms, YOLOv3 has achieved remarkable results in the field of object detection and has been applied to various scenarios. In the field of wind turbine blade defect recognition, some researchers have proposed a method for recognizing wind turbine blade defects based on improved YOLOv3 (as described in CN112907565A), and the YOLOv3 model is lightweight processed by means of pruning, channel adjustment, etc., improving the detection efficiency.
[0006] Disadvantages: Despite the improvements, the YOLOv3 model still faces some problems in the task of wind turbine blade defect recognition. For example, the model has a relatively high complexity, a large number of parameters, and high requirements for hardware resources; when dealing with small target defects and complex backgrounds, the recognition accuracy and robustness need to be improved.
[0007] Application and disadvantages of the YOLOv7 algorithm: Application: As one of the latest versions of the YOLO series of algorithms, YOLOv7 achieves a good balance between detection speed and accuracy, and is suitable for detection tasks with high real-time requirements.
[0008] Disadvantages: However, when the YOLOv7 algorithm is used to process the wind turbine blade defect detection task, it still faces problems such as insufficient ability to recognize small target defects and strong interference from complex backgrounds. These problems limit the performance of the YOLOv7 algorithm in the wind turbine blade defect detection task.
[0009] Application of the YOLOv8 algorithm and defects of the existing technical solutions: Application and improvement: As the latest member of the YOLO series, YOLOv8 has further improved performance, especially in terms of lightweight and detection accuracy. Some researchers have proposed a method for detecting surface defects of offshore wind turbine blades based on improved YOLOV8 (as described in CN119107533A). By introducing lightweight modules, attention mechanisms, and feature fusion networks and other means, the YOLOv8 model is improved to improve its performance in the task of detecting surface defects of offshore wind turbine blades.
[0010] Defects of the existing technical solutions: Although the method based on improved YOLOV8 has achieved certain results in the wind turbine blade defect detection task, there are still some deficiencies. For example, there is still room for improvement in the recognition of small target defects and complex backgrounds; at the same time, the number of parameters and computational complexity of the model still need to be further optimized to reduce the requirements for hardware resources and improve the detection efficiency.
[0011] In view of the above problems, those skilled in the art have been exploring how to improve the YOLO series of algorithms to improve their performance in the wind turbine blade defect detection task. The present invention is proposed under this background, aiming to improve the YOLOv7 algorithm by introducing new upsampling methods, attention mechanisms, loss functions and other means to overcome the deficiencies of the existing technology and improve the accuracy and speed of wind turbine blade defect detection. Summary of the Invention
[0012] The technical problem to be solved by the present invention is to provide a method for detecting defects in wind turbine blades based on an improved YOLOv7 algorithm, so as to solve the problems of low detection accuracy, slow detection speed and high model complexity in the field of wind turbine blade defect detection. Specifically, traditional detection methods such as manual inspection and drone inspection have deficiencies such as low efficiency, high cost and susceptibility to environmental influence. Existing technologies such as YOLOv3 and YOLOv8 algorithms still face problems such as insufficient ability to identify small target defects, large interference from complex backgrounds, large model parameter quantities and high computational complexity when dealing with the task of wind turbine blade defect detection.
[0013] To solve the above technical problems, the technical solution adopted by the present invention is a method for detecting defects in wind turbine blades based on an improved YOLOv7 algorithm, including the following steps: Step1: Construct an image dataset containing surface defects of offshore wind turbine blades, and label and preprocess the dataset; Step2: Improve the YOLOv7 algorithm by introducing the CARAFE module to replace the upsampling module in the original backbone feature network of YOLOv7; Step3: Use the SimAM attention mechanism at the front end of the head of the improved YOLOv7 algorithm; Step4: Use the WIoU-v1 loss function to replace the CIoU (Complete Intersection over Union Loss) loss function in the original YOLOv7 algorithm; Step5: Use the improved YOLOv7 algorithm model to train the defects of wind turbine blades to obtain a trained improved YOLOv7 algorithm model; Step6: Use the trained improved YOLOv7 algorithm model to detect the defects of wind turbine blades.
[0014] In a preferred solution, the defect types in the dataset in Step1 include combustion, cracks, holes, deformities, dirt, oil, peeling and rust. The dataset is expanded by means of rotation, scaling, cropping, etc., and divided into a training set and a test set according to a predetermined ratio.
[0015] In a preferred solution, the CARAFE module in Step2 improves the feature expression ability and detection accuracy of wind turbine blade defect detection through content-aware feature aggregation.
[0016] In a preferred solution, the steps of the CARAFE module replacing the upsampling module in the original backbone feature network of YOLOv7 in Step2 include: Step2.1: Channel compression and local feature extraction, perform convolution on the input feature map to reduce the number of channels and extract local features, reducing the computational amount; Step 2.2: Set the upsampling kernel size. Larger kernels provide a wider receptive field but increase the computational cost. If an adaptive upsampling kernel is required, predict an upsampling kernel with a specific shape value. Step 2.3: Predict the upsampling weights. For the feature map after channel compression, use a specific convolutional layer to predict the upsampling weights. After setting the number of output channels to a specific value, rearrange the channel dimensions to obtain the upsampling kernel. Step 2.4: Softmax normalization. Apply Softmax normalization to the upsampling kernel to make the sum of the convolutional kernel weights equal to 1, ensure the stability of the numerical range of feature weighted summation, and achieve high-quality feature recovery, detail enhancement, and information reconstruction.
[0017] In the preferred solution, in Step 3, the SimAM attention mechanism evaluates the importance of neurons in the feature map by calculating the neuron energy function, and enhances the attention through sigmoid activation, improving the ability of the neural network to extract key features. The specific steps are as follows: Step 3.1: Importance evaluation. The SimAM module calculates the neuron energy to measure its importance, in order to enhance key features and suppress redundant information. Step 3.2: Energy function construction. Calculate the mean and variance within each channel of the input feature map, and construct the energy function based on this. Step 3.3: Spatial-unconstrained calculation. The energy calculation adopts a spatial-unconstrained method, and only relies on local channel information to allocate attention, avoiding the introduction of additional parameters. Step 3.4: Normalization. Normalize the energy distribution through the Sigmoid function, and apply it to the original input features, making the model pay more attention to the target area more precisely. Step 3.5: Application. Add SimAM to the YOLOv7 head to enhance the feature expression ability near the detection box, improve the perception ability of small targets and edge regions, maintain a low computational cost, and finally improve the detection accuracy and stability of wind turbine blade defects.
[0018] In the preferred solution, the WIoU-v1 loss function in Step 4 makes the bounding box regression more stable by introducing an aspect ratio weighting mechanism, improves the localization accuracy of wind turbine blade defect detection, and optimizes the gradient propagation in the target box regression process.
[0019] In the preferred solution, the specific steps to replace the CIoU loss function in the original YOLOv7 algorithm with the WIoU-v1 loss function in Step 4 are as follows: Step 4.1: The WIoU-v1 loss function improves the accuracy of the detection box by optimizing the calculation method of the regression loss, and at the same time enhances the adaptability to target shape and scale changes. Step4.2: Calculate the loss function IoU (Intersection over Union) between the predicted bounding box and the ground truth bounding box, and calculate it as the basic loss; Step4.3: Introduce a dynamic weight mechanism, and adaptively adjust the influence weight of the regression loss according to information such as the position deviation and shape distribution of the target bounding box, making the loss more stable under different target scales and position distributions; Step4.4: Combine the smoothing adjustment strategy of WIoU-v1, and use exponential weighting to correct the loss, further alleviating the problem of unstable gradients during the optimization process; Step4.5: Guide the model to learn through the optimized WIoU-v1 loss function, significantly improving the regression accuracy of the target bounding box and enhancing the overall performance of the wind turbine blade defect detection task.
[0020] In the preferred solution, the training steps for improving the YOLOv7 algorithm model in Step5 include: Step5.1: Initialize the network weights, learning rate, batch size, and number of training iterations of the improved YOLOv7 algorithm model; Step5.2: Input the samples in the training set into the improved YOLOv7 algorithm model for pre-training, calculate the loss value between the predicted bounding box and the target GT bounding box, and backpropagate the loss value to optimize the network weights; Step5.3: Evaluate the improved YOLOv7 algorithm model using the validation set, and calculate the average precision value of the surface defect category to measure the detection performance; Step5.4: Repeat Step5.2 and Step5.3 until the average precision value mAP converges to a stable state, obtaining the finally trained improved YOLOv7 algorithm model; Step5.5: Use the test set to test the trained improved YOLOv7 algorithm model and evaluate the comprehensive detection performance of the model.
[0021] In the preferred solution, the comprehensive detection performance is measured by detection accuracy, detection speed, floating-point computational volume, number of parameters, and number of image detections per unit time.
[0022] In the preferred solution, the steps for analyzing the detection accuracy and detection speed include: Step5.5.1: Evaluate the trained YOLOv7 algorithm model, including calculating the detection accuracy and detection speed of the model before and after improvement, and analyzing its optimization effect; Step5.5.2: Evaluate to measure the detection accuracy of the model. The evaluation metrics include the mean Average Precision (mAP) of all categories, the Recall (R) of object detection, and the Intersection over Union (IoU) of the average loss function for bounding box regression; calculate the Floating-point operations per second (FLOPs), the number of parameters (Params), and the Frames Per Second (FPS) of image detection per unit time of the model to evaluate the computational complexity and detection speed of the model. Step5.5.3: By comparing the detection results of the improved YOLOv7 algorithm with the original YOLOv7 algorithm on the same dataset, analyze the improvement effect of the Content-Aware ReAssembly of Features (CARAFE) upsampling, the Simple Attention Module (SimAM) attention mechanism, and the Weighted Intersection over Union-v1 (Wiou-v1) loss function on the detection performance, and verify the effectiveness of the improvement scheme. Step5.5.4: Use other algorithms to compare the detection results on the same dataset, computer configuration, and various parameter settings to prove the superiority of the improved algorithm of the present invention.
[0023] The fan blade defect detection method based on the improved YOLOv7 algorithm provided by the present invention has the following beneficial effects: 1. Through algorithm customization and optimization, the present invention significantly improves the detection accuracy and speed of fan blade defects; compared with traditional detection methods such as manual inspection and drone inspection, the method of the present invention is more efficient, lower in cost, and not easily affected by the environment; at the same time, compared with existing technologies such as YOLOv3 and YOLOv8 algorithms, the present invention better solves the problems of insufficient small target defect recognition ability and large complex background interference when dealing with fan blade defect detection tasks.
[0024] 2. The present invention introduces the CARAFE module to replace the upsampling module in the original backbone feature network, significantly improving the feature expression ability and detection accuracy of fan blade defects; the CARAFE module uses a content-aware feature aggregation method to more accurately reconstruct high-resolution information, making defect features such as cracks and micro-damage clearer.
[0025] 3. The present invention introduces the SimAM attention mechanism at the front end of the YOLOv7 detection head. By calculating the neuron energy function, it evaluates the importance of neurons in the feature map and enhances the attention through sigmoid activation. This mechanism can adaptively improve the response of important features and suppress redundant information while maintaining a low computational complexity, thereby enhancing the robustness and detection accuracy of the model.
[0026] 4. The present invention uses the WIoU-v1 loss function to replace the CIoU loss function in the original YOLOv7 algorithm. By introducing the aspect ratio weighting mechanism, the bounding box regression becomes more stable, effectively improving the localization accuracy of wind turbine blade defect detection and optimizing the gradient propagation in the target box regression process. The WIoU-v1 loss function can better adapt to the complex defect morphology on the surface of wind turbine blades and improve the localization accuracy and regression stability of the target box.
[0027] 5. The dataset construction and preprocessing technology adopted by the present invention improves the generalization ability of the model and ensures the data quality by constructing a diverse dataset and conducting detailed data annotation and preprocessing, providing a solid foundation for subsequent model training.
[0028] 6. The model training and evaluation method adopted by the present invention significantly improves the model performance through a multi-stage training strategy; at the same time, the model performance is comprehensively evaluated through multiple indicators such as detection accuracy, detection speed, floating-point computational volume, number of parameters, and number of images detected per unit time.
[0029] 7. Through algorithm improvement and module optimization, the present invention reduces the number of parameters and computational complexity of the model, improves the practicality and deployment efficiency of the model; under the same dataset and configuration, compared with the original YOLOv7 algorithm, the improved algorithm improves the detection accuracy by about 1.9%, reduces the number of parameters by about 13.5%, and also improves the detection speed.
[0030] 8. By introducing the CARAFE upsampling module, SimAM attention mechanism, and WIoU-v1 loss function, the present invention comprehensively improves the YOLOv7 algorithm, significantly improving the accuracy and speed of wind turbine blade defect detection, while reducing the number of parameters and computational complexity of the model, achieving an overall improvement in algorithm performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The present invention will be further described below in conjunction with the drawings and embodiments: Figure 1 is the technical flow chart of the present invention; Figure 2 is the module structure diagram of the CARAFE upsampling operator of the present invention; Figure 3It is the module structure diagram of SimAM of the present invention; Figure 4 It is the structure diagram of the improved YOLOv7 of the present invention; Figure 5 It is the partial defect detection diagram before the improvement of the present invention; Figure 6 It is the partial defect detection diagram after the improvement of the present invention. Specific implementation manners
[0032] The technical solutions in the present invention will be further described below in conjunction with embodiments and the accompanying drawings: Embodiment 1 As Figure 1 shown, this embodiment provides a method for detecting defects in wind turbine blades based on the improved YOLOv7 algorithm, and details the whole process from data preparation to model training and evaluation.
[0033] Step1: Construct an image dataset containing surface defects of offshore wind turbine blades, and label and preprocess the dataset Step1.1 Data collection: Collect images of defects in offshore wind turbine blades through on-site shooting and publicly available network resources, ensuring that the dataset contains various defect types, such as combustion, cracks, holes, deformities, dirt, oil, peeling, and rust, etc.
[0034] Step1.2 Data annotation: Use professional image annotation tools to annotate the collected images, mark the positions, sizes, and types of defects, and generate annotation files containing defect categories and predicted box coordinate information.
[0035] Step1.3 Data augmentation and division: Perform data augmentation on the original dataset, and use rotation, scaling, cropping, flipping, etc. to expand the dataset and improve the generalization ability of the model; Divide the augmented dataset into a training set and a test set according to a predetermined ratio (such as 7:3) for model training and performance evaluation respectively.
[0036] Step2: Improve the YOLOv7 algorithm by introducing the CARAFE module to replace the upsampling module in the original backbone feature network of YOLOv7 Step2.1 Channel compression and local feature extraction: Perform a 1×1 convolution operation on the input feature map to reduce the number of channels and extract local features to reduce the subsequent calculation amount.
[0037] Step2.2 Set the upsampling kernel size: Set the size of the upsampling kernel according to actual needs. A larger kernel size can provide a wider receptive field but will increase the computational cost. If an adaptive upsampling kernel is required, then predict an upsampling kernel with a specific shape value.
[0038] Step2.3 Predict the upsampling weights: For the feature map after channel compression, use a specific convolutional layer to predict the upsampling weights. After setting the number of output channels to a specific value, rearrange the channel dimension to obtain the upsampling kernel.
[0039] Step2.4 softmax normalization: Apply the softmax normalization operation to the upsampling kernel to ensure the stability of the numerical range of the feature weighted summation, and achieve high-quality restoration and detail enhancement of the features.
[0040] Step3: Use the SimAM attention mechanism at the front end of the head of the improved YOLOv7 algorithm Step3.1 Importance evaluation: The SimAM module calculates the neuron energy function to measure the importance of each neuron in the feature map, so as to enhance the key features and suppress the redundant information.
[0041] Step3.2 Energy function construction: Calculate the mean and variance of the input feature map within each channel, and construct the energy function accordingly.
[0042] Step3.3 Spatial-unconstrained calculation: The energy calculation adopts a spatial-unconstrained method, which only relies on local channel information to allocate attention, avoiding the introduction of additional parameters.
[0043] Step3.4 Normalization: Normalize the energy distribution through the Sigmoid function, which acts on the original input feature map.
[0044] Add the SimAM module to the YOLOv7 head to enhance the feature expression ability near the detection box and improve the perception ability of small targets and edge regions.
[0045] Step4: Replace the CIoU loss function in the original YOLOv7 algorithm with the WIoU-v1 loss function Step4.1 Loss function optimization: The WIoU-v1 loss function improves the accuracy of the detection box and enhances the adaptability to the shape and scale changes of the target by optimizing the calculation method of the regression loss; Step4.2 Basic loss calculation: Calculate the IoU loss between the predicted box and the ground truth box, and use it as the basic loss.
[0046] Step4.3 Dynamic weight mechanism: According to information such as the position deviation and shape distribution of the target box, adaptively adjust the influence weight of the regression loss to make the loss more stable under different target scales and position distributions.
[0047] Step4.4 Smoothing adjustment strategy: Combined with the smoothing adjustment strategy of WIoU-v1, use exponential weighting to correct the loss and alleviate the problem of unstable gradients during the optimization process.
[0048] Step4.5 Model learning guidance: Guide the model to learn through the optimized WIoU-v1 loss function, significantly improving the regression accuracy of the target box.
[0049] Step5: Use the improved YOLOv7 algorithm model to train the defects of the wind turbine blade to obtain the trained improved YOLOv7 algorithm model Step5.1 Model initialization: Initialize the network weights, learning rate, batch size, and number of training iterations of the improved YOLOv7 algorithm model.
[0050] Step5.2 Model pre-training: Input the training set samples into the improved YOLOv7 algorithm model for pre-training, calculate the loss value between the predicted box and the target GT box, and backpropagate to optimize the network weights.
[0051] Step5.3 Model evaluation: Use the validation set to evaluate the model performance and calculate the mean average precision value (mAP) of the surface defect category.
[0052] Step5.4 Model iterative training: Repeat steps Step5.2 and Step5.3 until the mAP value converges to a stable state to obtain the finally trained improved YOLOv7 algorithm model.
[0053] Step5.5 Model testing: Use the test set to test the trained model and evaluate its comprehensive detection performance, including detection accuracy, detection speed, floating-point computational volume, number of parameters, and number of pictures detected per unit time.
[0054] Step6: Use the trained improved YOLOv7 algorithm model to detect the defects of the wind turbine blade Apply the trained improved YOLOv7 algorithm model to the actual wind turbine blade defect detection task to achieve efficient and accurate defect recognition and positioning.
[0055] Through the detailed description of the above embodiments, the method for detecting defects in wind turbine blades based on the improved YOLOv7 algorithm proposed by the present invention is fully demonstrated, including key links such as data preparation, model improvement, training, and evaluation. By introducing the CARAFE module, SimAM attention mechanism, and WIoU-v1 loss function, this method significantly improves the accuracy and speed of wind turbine blade defect detection, providing strong support for the operation and maintenance of wind farms.
[0056] Example 2 In another preferred embodiment, on the basis of Embodiment 1, the present invention is further described in detail, and a specific embodiment is provided to fully demonstrate the technical solution of the present invention and its actual application effect.
[0057] Step 1: Construct a wind turbine blade defect dataset Data collection: By taking pictures of wind turbine blades in wind farms on-site and collecting wind turbine blade defect images from publicly available network resources. The covered defect types include various types such as combustion, cracks, holes, deformities, dirt, oil, peeling, and rust.
[0058] Data annotation: Use professional annotation tools to annotate the collected images, mark the positions, sizes, and types of defects, and generate annotation files. The annotation files contain key information such as defect categories and predicted box coordinate information.
[0059] Data augmentation: To improve the generalization ability and robustness of the model, perform data augmentation on the original dataset. Adopt various image transformation methods such as rotation, scaling, cropping, and flipping to generate more training samples.
[0060] Dataset division: Divide the augmented dataset into a training set and a test set according to a ratio of 7:3. The training set is used for model training, and the test set is used for evaluating the performance of the model.
[0061] Step 2: Construct an improved YOLOv7 algorithm model Step 2.1: Introduce the CARAFE upsampling module Channel compression and local feature extraction: Perform a 1×1 convolution operation on the input feature map to reduce the number of channels and extract local features, so as to reduce the computational amount; Upsampling kernel size setting: Set the size of the upsampling kernel according to actual needs. A larger upsampling kernel can provide a wider receptive field, but the computational amount will also increase accordingly; Predict upsampling weights: Use a specific convolutional layer to perform a convolution operation on the feature map after channel compression, predict the upsampling weights, set the number of output channels to a specific value, and then rearrange the channel dimension to obtain the upsampling kernel; Softmax normalization: Apply the softmax normalization operation to the upsampling kernel to ensure the stability of the numerical range of the feature weighted sum and achieve high-quality feature recovery.
[0062] Step 2.2: Introduce the SimAM attention mechanism Calculate the channel mean and variance: Calculate the mean and variance for each channel of the input feature map for constructing the energy function; Construct the energy function: Use the mean and variance to construct the energy function to measure the importance of neurons within each channel; Calculate the attention weights: Normalize the energy function through the sigmoid function to obtain the attention weights; Attention enhancement: Apply the attention weights to the original input feature map to enhance key features and suppress redundant information.
[0063] Step 2.3: Replace the loss function Replace the CIoU loss function in the original YOLOv7 algorithm with the WIoU-v1 loss function; WIoU-v1 makes the bounding box regression more stable and improves the localization accuracy by introducing the aspect ratio weighting mechanism.
[0064] Step 3: Model training and evaluation Experimental environment configuration: Under the Windows 11 system, use the PyTorch deep learning framework and the Python development language for model training, and configure the relevant environment versions, such as Python 3.8, PyTorch 2.3.0, CUDA 12.1, etc.; Model initialization: Initialize the network weights, learning rate, batch size, and training iteration times of the improved YOLOv7 algorithm model, set the initial learning rate to 0.01, the batch size to 4, and the iteration times to 150; Model training: Input the samples in the training set into the improved YOLOv7 algorithm model for pre-training, calculate the loss value between the predicted bounding box and the target GT bounding box, and backpropagate the loss value to optimize the network weights; Model evaluation: Use the validation set to evaluate the performance of the improved YOLOv7 algorithm model, and calculate the mean average precision value (mAP) of the surface defect categories to measure the detection performance; Model testing: Use the test set to test the trained improved YOLOv7 algorithm model, evaluate its comprehensive detection performance, and the evaluation metrics include mAP, recall rate (Recall), the average IoU of the bounding box regression, as well as the floating-point operation count (FLOPs), the number of parameters (Params), and the number of frames of image detection per unit time (FPS) of the model; Ablation experiment: To further verify the feasibility and effectiveness of simultaneously applying the CARAFE upsampling, SimAM attention mechanism, and WIoU-v1 loss function, an ablation experiment was conducted. By comparing the detection performance when each module was applied alone, the improvement effect of each module on the overall detection performance was analyzed.
[0065] Through the above detailed steps, the specific application and actual effect of the present invention in the field of wind turbine blade defect detection are fully demonstrated.
[0066] Example 3 In another preferred embodiment, based on Example 2, this embodiment provides a method for detecting wind turbine blade defects based on the improved YOLOv7 algorithm. The specific implementation steps are as follows.
[0067] Step 1: Dataset construction and optimization is similar to that in Example 2. Wind turbine blade defect images are collected through on-site shooting and network public resources, and data augmentation processing is performed. The difference is that in Example 3, a more complex data augmentation strategy is adopted, such as random flipping, adding noise, etc., to further improve the generalization ability of the model. Finally, a dataset containing 5000 images is obtained and divided into a training set, a validation set, and a test set according to the ratio of 8:1:1.
[0068] Step 2: Algorithm model optimization Step 2.1: Optimization of the CARAFE module In Example 3, the CARAFE module was further optimized. Specifically, by adjusting the size of the upsampling kernel and the convolutional layer parameters of the prediction weights, the CARAFE module can better adapt to the requirements of the wind turbine blade defect detection task. In addition, an adaptive learning rate strategy was introduced to accelerate the convergence process of the model.
[0069] Step 2.2: Joint optimization of the SimAM attention mechanism and the loss function In Example 3, the SimAM attention mechanism and the WIoU-v1 loss function were jointly optimized. Specifically, during the training process, the parameters of the SimAM module and the weights of the WIoU-v1 loss function were dynamically adjusted so that the model can better identify the tiny defects of wind turbine blades and improve the positioning accuracy.
[0070] Step 3: Multi-stage training strategy Different from Example 2, in Example 3, a multi-stage training strategy was adopted. Specifically, in the initial stage, only the CIoU loss function was used for training to quickly converge the model. In the subsequent stage, the WIoU-v1 loss function and the SimAM attention mechanism were gradually introduced, and their weights and parameters were gradually adjusted to optimize the performance of the model.
[0071] Through the joint optimization of complex data augmentation, CARAFE module optimization, SimAM attention mechanism and WIoU-v1 loss function, and a multi-stage training strategy, Example 3 significantly improves the accuracy and robustness of wind turbine blade defect detection, providing an efficient solution for industrial applications.
[0072] Example 4 In another preferred embodiment, based on Embodiments 1 and 2, this embodiment provides a method for detecting wind turbine blade defects based on an improved YOLOv7 algorithm. The specific implementation steps are as follows.
[0073] Step 1: Construct a dataset containing wind turbine blade defects, annotate the image defects, and amplify and divide the dataset into a training set and a validation set; The dataset used in Step 1 is the images captured by the wind turbine blade image acquisition device in the wind farm and the publicly available dataset on the network. After the preliminary collection of the dataset, in order to improve the generalization ability and robustness of the model, it is necessary to perform data augmentation on the data. The methods of data augmentation include randomly rotating, scaling, cropping, flipping, etc. on the images to expand the diversity of the dataset and reduce the risk of overfitting. Finally, the dataset obtained includes 4019 images of 8 types of defects, namely combustion, crack, hole, deformity, dirt, oil, exfoliation and rust, and the augmented dataset is divided into a training set and a test set according to a ratio of 7:3.
[0074] Step 2: Construct an improved YOLOv7 algorithm model and obtain the improved YOLOv7 algorithm model; Step 2.1: YOLOv7 mainly consists of four parts: the input layer (Input), feature extraction (Backbone), feature fusion (Neck) and detection head (Head). The input layer fixes the input image size (such as 640×640). The feature extraction uses an improved CSPDarknet53 backbone network, which shares some feature maps through the cross-stage partial network module (CSP) to reduce the computational load and improve the representation ability. The feature fusion uses a feature pyramid network to fuse multi-scale features to enhance the detection ability for targets of different sizes. The detection head contains convolutional layers and prediction layers for classification and bounding box regression. The detection process is as follows: the input image is preprocessed and then sent into CSPDarknet53 to extract multi-scale feature maps; the feature fusion module uses high-resolution features for small target detection and low-resolution features for large target detection; the detection head generates candidate boxes (Anchor Boxes) and predicts the category and coordinates of each box, and finally outputs the detection results; Step 2.2: In the task of wind turbine blade defect detection, using the lightweight general upsampling operator CARAFE can bring many advantages, especially in aspects such as detail restoration, edge feature extraction, and small target detection. The defects of wind turbine blades usually manifest as tiny structural features such as cracks, wear, and delamination. These details are easily overlooked or blurred in traditional upsampling methods (such as nearest neighbor interpolation, bilinear interpolation, or deconvolution). After adopting CARAFE, the feature upsampling process can more accurately reconstruct high-resolution information, making defect features such as cracks and tiny damages clearer and improving the accuracy of defect recognition. In contrast, traditional upsampling methods use interpolation calculations with fixed weights and cannot dynamically adjust the feature map according to context information, which may lead to the loss of some key details and make it difficult to accurately identify minor cracks. Although deconvolution can improve the resolution, it is prone to the checkerboard effect, making the edges of defects unstable or misjudged as normal structures, affecting the reliability of detection. In the complex background environment of wind turbine blades (such as changes in wind and light, blade stain occlusion, etc.), CARAFE can make the feature expression in the defect area more discriminative through content-aware feature aggregation, improving the adaptability to various different environmental conditions.
[0075] The specific upsampling operation process of the lightweight general upsampling operator CARAFE is as follows: For the input feature map perform a 1×1 convolution to reduce the number of channels and extract local features for the purpose of reducing the computational amount; Set the size of the upsampling kernel to A larger upsampling kernel can provide a wider receptive field, but the computational amount will also increase. If it is desired that each pixel position can adaptively use different upsampling kernels, then an upsampling kernel with a shape of needs to be predicted; For the feature map after the first-step channel compression, use a convolutional layer to predict the upsampling weights. Assume that the number of channels of the input feature map is , and after passing through this convolutional layer, the number of output channels is set to (where S is the upsampling multiple). Subsequently, rearrange the channel dimension to obtain an upsampling kernel with a shape of ; Apply softmax normalization to the upsampling kernel obtained in the second step to make the sum of the convolutional kernel weights equal to 1, ensuring that the weighted sum of features maintains a stable numerical range. Finally, the upsampling kernel can be used for high-quality recovery of features, realizing detail enhancement and information reconstruction.
[0076] Step 2.3: Use the SimAM attention mechanism in the YOLOv7 head. In the SimAM attention mechanism, the responses of each neuron are different, which is manifested in the change of its activation pattern. SimAM evaluates the importance of neurons in the feature map by calculating the neuron energy function and enhances the attention through sigmoid activation. Its core idea is to use the energy function in neuroscience to distinguish important information from redundant information in order to optimize the feature representation; First, calculate the mean value of each channel for the input feature map: (1) Among them, is the number of pixels within the channel, is the value at the th spatial position in the input feature map. Then, calculate the variance of this channel: (2) The variance is used to measure the feature distribution within the channel; SimAM calculates the neuron energy of each channel using the energy equation: (3) In the formula, is the energy value of the pixel on channel i ; is the learnable balance factor; is the position of the specific target neuron; and are the mean and variance of this channel respectively. The core idea is to distinguish important and unimportant features by calculating the neuron energy, thereby enhancing the expression ability of the network; Transform the energy function into an attention weight through sigmoid: (4) In the formula, acts as an attention factor to weight the input features; is the original input feature map; is the enhanced feature map. In this way, neurons with higher energy will be assigned higher attention weights, while the contribution of low-energy neurons will be suppressed.
[0077] Step 2.4: Replace the CIoU loss function in the original YOLOv7 with the WIoU-v1 loss function; In the task of fan blade defect detection, replacing the original CIoU loss function of YOLOv7 with the WIoU-v1 loss function can better adapt to the complex defect morphologies on the surface of fan blades, improve the positioning accuracy of the target box and the regression stability. Since the defects of fan blades often appear as slender cracks, abrasions, spalling or other irregular shapes, and CIoU mainly focuses on IoU, the distance between the center points and the aspect ratio during the optimization process, its weight allocation may not provide the best gradient guidance in the case of long-strip targets or irregular targets, resulting in a decrease in the regression accuracy of the target box. Especially in the case of small defect detection or dense target distribution, unstable convergence problems may occur; by introducing a more reasonable weighting method, WIoU-v1 makes the adjustment of the target box more in line with the geometric characteristics of the defect, and has stronger adaptability to targets of different shapes. It can dynamically adjust the gradient optimization strategy for different targets, making the target boxes of long-strip cracks or non-uniform defect regions more fitting, and improving the robustness of regression; The WIoU-v1 loss function mentioned above is defined as follows: (5) (6) (7) In the formula, As a weighting factor for the IoU error, it can dynamically adjust the sensitivity of the loss to different target morphologies; and respectively represent the center point coordinates of the predicted box and the ground truth box, and the coefficient As a weight parameter, it is used to balance the influence of the scale error in the loss optimization; through the weighting mechanism of WIoU-v1, the target box regression can more stably optimize the target detection task. Especially in the detection scenarios of long-strip targets or targets with large scale changes, it can improve the detection accuracy and accelerate the convergence speed; The IoU loss is expressed as the ratio of the intersection of the predicted box and the ground truth box to the union of the predicted box and the ground truth box, significantly amplifies the of ordinary quality anchor boxes; , significantly reduces the of high-quality anchor boxes; To prevent from generating gradients that hinder convergence, , is separated from the computational graph (the superscript represents this operation), because it effectively eliminates the factors that hinder convergence, so no new metrics are introduced, such as the aspect ratio, represents the width of the predicted box, represents the height of the predicted box; is the abscissa of the center point of the ground truth box, is the abscissa of the center point of the prediction box, is the ordinate of the center point of the prediction box, is the ordinate of the center point of the ground truth box, is the weight factor of the weighted intersection over union, used to adjust the IoU loss; is the IoU loss, representing the degree of mismatch between the predicted bounding box and the ground truth bounding box.
[0078] Figure 4 is the improved YOLOv7 network structure. Among them, the CBS module is essentially a convolutional layer for basic feature extraction; the ELAN structure is exquisitely designed. By regulating the length of the gradient path, it not only ensures the learning efficiency but also enhances the model's learning ability and robustness to diverse features. The MP module contains two branches, mainly used to perform downsampling operations; the purpose of the SPPCSPC component is to expand the receptive field so that it can adapt to image inputs of different resolutions, specifically achieving this goal by means of the max pooling technique; the REP module is divided into two parts: one part is for the training stage, and the other part is for the inference process; the main function of the CAT module is to fuse feature maps from different levels, enhancing the model's perception ability of the target by concatenating these feature maps; while the main purpose of the H-ELEN module is to optimize the model's training process, improving the convergence speed and stability; DMPConv is a dynamic multi-scale convolutional module, which enhances the model's detection ability for targets of different scales by introducing multi-scale convolutional kernels; the SimAM module is added as an attention mechanism to further improve the performance; the Detect module is the core output module of YOLOv7, responsible for generating the final object detection output based on the processing results of the foregoing modules; the joint action of such a series of carefully designed modules enables YOLOv7 to significantly improve the accuracy and adaptability of object detection while maintaining high efficiency.
[0079] Step 3: Based on the improved YOLOv7 algorithm model, use the fan blade defect dataset for training to obtain the trained improved YOLOv7 algorithm model Step 3.1 This experiment platform is carried out under the Windows 11 system, with the PyTorch deep learning framework and the Python development language. The relevant environment versions are configured as Python 3.8, PyTorch 2.3.0, and CUDA 12.1. The CPU of the host is the 13th Gen Intel(R) Core(TM) i5-13400F 2.50 GHz, and the GPU is the NVIDIA GeForce RTX 4060. The image size parameter of this experiment is set to 640×640, which can maintain image details to a certain extent, help the model detect small targets, and at the same time will not significantly increase the computational amount. The batch size is 4 to ensure stable training and reduce video memory occupancy. The initial learning rate is 0.01 to enable the model to converge quickly in the initial stage of training without significant fluctuations. The number of iterations is 150 times; Step 3.2 The evaluation metrics of this experiment include floating-point operation count (FLOPs), recall rate (R, Rall), average precision (AP, Average Precision), precision rate (P, Precision), mean average precision (mAP), number of parameters, etc.; mAP includes mAP@0.5 and mAP@0.5:0.95, which represent the average precision when the IoU threshold is 0.5 and the average precision when the IoU threshold ranges from 0.5 to 0.95, respectively; the precision rate P measures the ratio of the number of positive class samples correctly identified by the model to the number of samples detected as positive class samples; the recall rate R measures the proportion of positive class samples correctly identified by the model among all actual positive class samples; the average precision AP reflects the detection performance of the model at different thresholds by integrating the area under the precision-recall curve; the mean average precision mAP is the average AP of all classes, reflecting the comprehensive performance of the model in multi-class detection tasks; the floating-point operation count refers to the computational amount, which is used to measure the complexity of the algorithm and as an indicator of the model's operation efficiency; the number of parameters is used to evaluate the structural complexity and scale of the model, referring to the total number of parameters that need to be trained in the model. The calculation formula is as follows: (8) (9) (10) (11) In the formula, TP (True Positives) represents the number of samples correctly classified as positive class; FP (False Positives) represents the number of samples misclassified as positive class; FN (False Negatives) represents the number of samples that fail to be correctly classified as positive class. P(R) represents the precision value at a given recall rate R, C is the total number of classes, and APi is the average precision of the ith class.
[0080] In order to further verify the feasibility and effectiveness of adding the attention mechanism, changing the activation function, and changing the loss function at the same time, an ablation experiment was conducted, as shown in Table 1.
[0081] Table 1
[0082] As shown in the table, after ablation experiments, compared to the original YOLOv7 algorithm, applying CARAFE alone increased mAP@0.5 from 85% to 86.6%, precision (P) from 83.6% to 85.2%, and recall (R) from 80.3% to 81.2%. This demonstrates that CARAFE, as a lightweight upsampling operator, can more effectively restore target features and improve the model's perception of defect areas. It also reduces the number of parameters to 59.3M, further optimizing the model's lightweight nature. Introducing SimAM alone increased P (precision) to 87.1% and mAP@0.5 to 85.8%, demonstrating that SimAM enhances feature expression through a spatially independent energy mechanism, making the model more accurate in identifying defective targets without incurring additional parameter overhead. After replacing CIoU with WIoU-v1, although mAP@0.5 decreased slightly, recall significantly increased to 82.5%. This demonstrates that WIoU-v1 optimizes the regression loss, making the predicted box more closely aligned with the defect target, thereby improving detection robustness. When CARAFE, SimAM, and WIoU-v1 were applied simultaneously, the model achieved optimal performance across all metrics, with P and R reaching 87.4% and 83.2%, respectively, and mAP@0.5 increasing to 86.9%, a 1.9% improvement over the original YOLOv7. Meanwhile, with only 64.8M parameters, computational overhead remained low. This demonstrates that CARAFE improves feature expression, SimAM enhances feature selectivity, and WIoU-v1 optimizes target box regression, making wind turbine blade defect detection more accurate and stable, ultimately improving overall detection performance.
[0083] Step 4: Evaluate the trained YOLOv7 algorithm.
[0084] To fully verify the superiority of the proposed method in detecting wind turbine blade defects, comparative experiments were conducted with the current mainstream target detection algorithms. The algorithms involved in the comparative experiments include YOLOv4, YOLOv5, YOLOv7-tiny, YOLOv7, and YOLOv8. The comparative experiments were conducted under the same configuration, the same dataset, and the same parameters. The experimental results are shown in Table 2.
[0085] Table 2
[0086] The detection results of various defects of the fan blade by different algorithms are shown in Table 2. It can be seen from the table that compared with other object detection models, the improved YOLOv7 in this paper shows more excellent performance in the fan blade defect detection task, mainly reflected in the good balance between detection accuracy and model lightweight. In terms of the mAP@0.5 index, the algorithm in this paper reaches 86.9%, which is 1.9% higher than the original YOLOv7 (85%), and is better than YOLOv4 (72.4%), YOLOv5 (82.4%), YOLOv7-tiny (79.3%) and YOLOv8 (84.1%). This indicates that through the introduction of CARAFE upsampling, SimAM attention mechanism and WIoU-v1 loss function optimization, the algorithm in this paper enables the model to more accurately identify defect targets in the fan blade defect detection task, enhances the perception ability of the target boundary, and improves the robustness of detection. In terms of the number of parameters, the number of parameters of the algorithm in this paper is only 64.8M, significantly lower than YOLOv5 (73.6M) and YOLOv7 (74.9M), slightly lower than YOLOv8 (68.4M), the same as YOLOv4, but far ahead of YOLOv4 (72.4%) in terms of accuracy. Compared with YOLOv7-tiny and YOLOv4, although the number of parameters of the algorithm in this paper is slightly higher, its mAP has increased by 7.6% and 14.5% respectively, indicating that while maintaining a relatively low computational complexity, it still has excellent detection performance. The improved YOLOv7 algorithm has higher accuracy and lower computational overhead in the fan blade defect detection task, further optimizes the performance compared with YOLOv7 and YOLOv8, and at the same time avoids the limitations of YOLOv4 in terms of accuracy and the deficiency of YOLOv7-tiny in terms of feature expression ability.
[0087] Figure 5 For the comparison of the model detection results between the improved YOLOv7 algorithm and the original YOLOv7 algorithm, the detection results are shown by selecting some pictures, where peeling is peeling, Hole is hole, dirt is dirt, deformity is deformity, and burning is burning. The comparison results are as Figure 5 and Figure 6 shown. It can be seen from the experimental results that the accuracy of the improved algorithm in detecting defects is higher than that of the YOLOv7 algorithm, which also proves that the improvement of the algorithm has a good effect.
[0088] The method for detecting defects in wind turbine blades based on the improved YOLOv7 algorithm provided by the present invention proposes an innovative solution to the problems of low detection accuracy, slow detection speed, and high model complexity in the field of wind turbine blade defect detection. Compared with traditional detection methods such as manual inspection and drone inspection, the method of the present invention has higher efficiency, lower cost, and stronger environmental adaptability. At the same time, in view of the problems faced by existing technologies such as YOLOv3 and YOLOv8 algorithms in processing wind turbine blade defect detection tasks, such as insufficient ability to identify small target defects, large interference from complex backgrounds, large number of model parameters, and high computational complexity, the present invention has carried out in-depth algorithm customization and optimization.
[0089] Specifically, the present invention deeply customizes the YOLOv7 algorithm. By introducing the CARAFE module to replace the upsampling module in the original backbone feature network, the detection accuracy of wind turbine blade defects and the feature expression ability are significantly improved. The CARAFE module enables the model to better capture the subtle features of the defect area through content-aware feature aggregation, thereby improving the detection accuracy.
[0090] In addition, the present invention uses the SimAM attention mechanism at the front end of the YOLOv7 algorithm's head to enhance the neural network's ability to extract key features by calculating the neuron energy function. The SimAM attention mechanism can significantly improve the model's ability to identify wind turbine blade defects without increasing excessive computational complexity, especially for the detection effect of tiny defects is more significant.
[0091] To further optimize the detection performance of the model, the present invention also uses the WIoU-v1 (Weighted Intersection over Union-v1) loss function to replace the CIoU (Complete Intersection over Union) loss function in the original YOLOv7 algorithm. The WIoU-v1 loss function makes the bounding box regression more stable by introducing an aspect ratio weighting mechanism, thereby effectively improving the positioning accuracy of wind turbine blade defect detection.
[0092] In terms of dataset construction, the present invention constructs an image dataset containing various surface defects of wind turbine blades (such as combustion, cracks, holes, deformities, etc.), and expands the dataset by means of rotation, scaling, cropping, etc., improving the generalization ability of the model. At the same time, the obtained data is carefully labeled and preprocessed to ensure the data quality, providing a solid foundation for subsequent model training.
[0093] Through efforts in aspects such as algorithm improvement, module optimization, and dataset construction, the present invention has achieved a significant improvement in detection speed and accuracy, while reducing the number of parameters and enhancing the practicality and deployment efficiency of the model. In practical applications, the method of the present invention has been verified through data collection, model training, and testing in the actual wind farm environment, demonstrating its effectiveness and reliability.
[0094] In summary, the method for detecting defects in wind turbine blades based on the improved YOLOv7 algorithm provided by the present invention has achieved a substantial improvement in detection performance through innovative practices in aspects such as algorithm improvement, module optimization, dataset construction, and model training. It has high academic value and engineering application potential, providing an efficient and intelligent defect detection solution for wind farm operation and maintenance.
Claims
1. A method for detecting defects in fan blades based on an improved YOLOv7 algorithm, characterized in that, It includes the following steps: Step1: Construct an image dataset containing surface defects of offshore wind turbine blades, and annotate and preprocess the dataset; Step2: Improve the YOLOv7 algorithm by introducing the CARAFE module to replace the upsampling module in the original backbone feature network of YOLOv7; Step3: Use the SimAM attention mechanism at the front end of the head of the improved YOLOv7 algorithm; Step4: Use the WIoU-v1 loss function to replace the CIoU loss function in the original YOLOv7 algorithm; Step5: Use the improved YOLOv7 algorithm model to train the defects of the wind turbine blades to obtain a trained improved YOLOv7 algorithm model; Step6: Use the trained improved YOLOv7 algorithm model to detect the defects of the wind turbine blades.
2. The method for detecting defects of fan blades based on the improved YOLOv7 algorithm according to claim 1, wherein: The defect types in the dataset described in Step1 include combustion, cracks, holes, deformities, dirt, oil, peeling, and rust. The dataset is augmented by rotation, scaling, and cropping, and is divided into a training set and a test set according to a predetermined ratio.
3. The method for detecting defects in fan blades based on the improved YOLOv7 algorithm according to claim 1, characterized in that: In Step2, the CARAFE module improves the feature expression ability and detection accuracy of wind turbine blade defect detection through content-aware feature aggregation.
4. The method for detecting defects of fan blades based on the improved YOLOv7 algorithm according to claim 3, characterized in that, The steps for the CARAFE module to replace the upsampling module in the original backbone feature network of YOLOv7 in Step2 include: Step2.1: Channel compression and local feature extraction, convolve the input feature map to reduce the number of channels and extract local features, reducing the computational amount; Step2.2: Set the upsampling kernel size. A larger kernel provides a wider receptive field but increases the computational amount. If an adaptive upsampling kernel is required, predict an upsampling kernel with a specific shape value; Step2.3: Predict the upsampling weights. For the feature map after channel compression, use a specific convolutional layer to predict the upsampling weights. After setting the number of output channels to a specific value, rearrange the channel dimension to obtain the upsampling kernel; Step2.4: Softmax normalization. Apply softmax normalization to the upsampling kernel to make the sum of the convolutional kernel weights equal to 1, ensure the stability of the numerical range of feature weighted summation, and achieve high-quality feature recovery, detail enhancement, and information reconstruction.
5. The method for detecting defects of a wind turbine blade based on the improved YOLOv7 algorithm according to claim 1, wherein In Step3, the SimAM attention mechanism evaluates the importance of neurons in the feature map by calculating the neuron energy function, and enhances the attention through sigmoid activation, improving the ability of the neural network to extract key features. The specific steps are as follows: Step3.1: Importance evaluation. The SimAM module calculates the neuron energy to measure its importance, in order to enhance key features and suppress redundant information; Step3.2: Energy function construction. Calculate the mean and variance within each channel of the input feature map, and construct the energy function based on this; Step3.3: Spatial-unconstrained calculation. The energy calculation adopts a spatial-unconstrained method, and only relies on local channel information to allocate attention, avoiding introducing additional parameters; Step3.4: Normalization. Normalize the energy distribution through the Sigmoid function and apply it to the original input features to make the model focus more precisely on the target area; Step3.5: Application. Add SimAM to the YOLOv7 head to enhance the feature expression ability near the detection box, improve the perception ability of small targets and edge regions, maintain low computational overhead, and finally improve the detection accuracy and stability of wind turbine blade defects.
6. The method for detecting defects of fan blades based on the improved YOLOv7 algorithm according to claim 1, wherein: The WIoU-v1 loss function in Step4 makes the bounding box regression more stable by introducing an aspect ratio weighting mechanism, improves the localization accuracy of wind turbine blade defect detection, and optimizes the gradient propagation in the target box regression process.
7. The method for detecting defects of fan blades based on the improved YOLOv7 algorithm according to claim 1, wherein The specific steps to replace the CIoU loss function in the original YOLOv7 algorithm with the WIoU-v1 loss function in Step4 are as follows: Step4.1: The WIoU-v1 loss function improves the accuracy of the detection box by optimizing the regression loss calculation method, and at the same time enhances the adaptability to target shape and scale changes; Step4.2: Calculate the IoU between the predicted bounding box and the ground truth bounding box, and calculate as the basic loss; Step4.3: Introduce a dynamic weight mechanism. According to information such as the position deviation and shape distribution of the target box, adaptively adjust the influence weight of the regression loss to make the loss more stable under different target scales and position distributions; Step4.4: Combine the smoothing adjustment strategy of WIoU-v1 and use exponential weighting to correct the loss to further alleviate the problem of unstable gradients in the optimization process; Step4.5: Guide the model to learn through the optimized WIoU-v1 loss function, so that the regression accuracy of the target box is significantly improved, and the overall performance of the wind turbine blade defect detection task is improved.
8. The method for detecting defects of fan blades based on the improved YOLOv7 algorithm according to claim 1, characterized in that, The training steps of the improved YOLOv7 algorithm model in Step5 include: Step5.1: Initialize the network weights, learning rate, batch size, and number of training iterations of the improved YOLOv7 algorithm model; Step5.2: Input the samples in the training set into the improved YOLOv7 algorithm model for pre-training, calculate the loss value between the predicted box and the target GT box, and backpropagate the loss value to optimize the network weights; Step5.3: Evaluate the improved YOLOv7 algorithm model using the validation set, and calculate the average precision value of the surface defect category to measure the detection performance; Step5.4: Repeat Step5.2 and Step5.3 until the average precision value mAP converges to a stable state to obtain the finally trained improved YOLOv7 algorithm model; Step5.5: Use the test set to test the trained improved YOLOv7 algorithm model and evaluate the comprehensive detection performance of the model.
9. The method for detecting defects of fan blades based on the improved YOLOv7 algorithm according to claim 8, characterized in that: The comprehensive detection performance is measured by detection accuracy, detection speed, floating-point computational volume, number of parameters, and number of image detections per unit time.
10. The method for detecting defects of a fan blade based on an improved YOLOv7 algorithm according to claim 9, wherein, The steps for analyzing the detection accuracy and detection speed include: Step5.5.1: Evaluate the trained YOLOv7 algorithm model, including calculating the detection accuracy and detection speed of the model before and after improvement, and analyzing its optimization effect; Step5.5.2: Evaluate to measure the detection accuracy of the model. The evaluation metrics include the mean average precision (mAP) of all classes, the recall rate (R) of object detection, and the average Intersection over Union (IoU) of bounding box regression; calculate the floating-point operation count (FLOPs), the number of parameters (Params), and the number of frames of image detection per unit time (FPS) of the model to evaluate the computational complexity and detection speed of the model; Step5.5.3: By comparing the detection results of the improved YOLOv7 algorithm with the original YOLOv7 algorithm on the same dataset, analyze the improvement effect of the CARAFE upsampling, SimAM attention mechanism, and Wiou-v1 loss function on the detection performance, and verify the effectiveness of the improvement scheme; Step5.5.4: Use other algorithms to compare the detection results on the same dataset, computer configuration, and various parameter settings to prove the superiority of the improved algorithm.
Citation Information
Patent Citations
Fan blade defect recognition method based on improved YOLOv3
CN112907565A
Improved YOLOV8-based offshore wind turbine blade surface defect detection method
CN119107533A