Photovoltaic module defect lightweight detection method for unmanned aerial vehicle

By using ShuffleNetV2 network and ECA attention module in the UAV photovoltaic module defect detection model, the problem of detection model complexity and high computing resource consumption in the UAV system is solved, and the UAV with limited computing resources is realized High-precision, real-time photovoltaic module defect detection is carried out on the platform.

CN119399656APending Publication Date: 2025-02-07SOUTHEAST UNIV

Patent Information

Application Number
CN202411511275.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

In the prior art, the complexity and computing resource consumption of the defect detection model of the photovoltaic module in the photovoltaic system patrols by UAV in order to deploy on embedded GPU UAV systems with limited computing resources, and it is difficult to meet the needs of real-time detection.

Method used

A lightweight detection method is proposed. By using ShuffleNetV2 network to replace the CSP structure backbone network of the YOLOv5s model, and introducing the ECA attention module to reduce the parameter quantity and calculation requirements of the model. It is suitable for embedded GPU drone platform to realize Real-time detection of photovoltaic module defects.

Benefits of technology

While maintaining high detection accuracy, the complexity and computing requirements of the model are reduced, and are suitable for deployment on drones with limited computing resources, meeting the needs of real-time detection, and maintaining high detection accuracy in complex environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119399656A_ABST
    Figure CN119399656A_ABST
Patent Text Reader

Abstract

The invention discloses a photovoltaic module defect lightweight detection method for an unmanned aerial vehicle, which performs lightweight improvement based on a YOLOv5s model, so that the method can be deployed on an embedded GPU unmanned aerial vehicle with limited computing resources to perform real-time detection on photovoltaic module defects. Comprising the following steps: establishing a photovoltaic module surface defect data set, and preprocessing an image; a YOLOv5s model is improved, a ShuffleNetV2 network is adopted to replace an original backbone network CSP structure, the parameter quantity and the calculation quantity of the model are greatly reduced to realize light weight, an effective channel attention module ECA is introduced, and the recognition capability of the model on defect characteristics of a photovoltaic module is enhanced; training parameters are set, and the improved model is trained; and inputting the defect image of the photovoltaic module to be detected into the trained model, and outputting the position and category information of the surface defect of the photovoltaic module to be detected. According to the method, the size and complexity of the model are effectively reduced, and the method is particularly suitable for efficient photovoltaic module defect detection on an unmanned aerial vehicle system with limited resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a lightweight detection method for defects of photovoltaic components used in unmanned aerial vehicles, belonging to the technical field of photovoltaic inspection and operation and maintenance. Background Art

[0002] In the context of global energy transformation, the photovoltaic industry, as an important component of clean energy, has seen rapid growth in installed capacity in recent years and has occupied a core position in the energy structure. However, photovoltaic modules are prone to defects such as cracks and dust during use. These defects will not only reduce the power generation efficiency of photovoltaic modules, but also shorten their service life, seriously affecting the long-term stability of large-scale photovoltaic power generation systems. Therefore, how to efficiently and accurately detect photovoltaic module defects is a key issue to ensure the efficient and stable operation of photovoltaic systems.

[0003] At present, traditional photovoltaic module defect detection relies on manual visual inspection, but this method often has difficulty in detecting tiny defects, which can easily lead to missed detections and low accuracy of detection results. In addition, manual inspection is also susceptible to visual fatigue, especially when facing large-scale photovoltaic power stations, which requires a lot of manpower and is costly. With the development of machine learning and deep learning technologies, algorithms such as support vector machines and YOLO have been applied to the detection of photovoltaic module defects, improving the accuracy of detection. However, these methods still face many challenges in practical applications, such as limited ability to identify tiny defects in complex backgrounds, insufficient generalization of models, and high computational costs during large-scale data set training.

[0004] With the advancement of drone technology, researchers have tried to embed detection models into drone systems to achieve automatic inspection and defect detection of photovoltaic modules. However, drones are limited by hardware conditions and computing resources and cannot carry complex image detection models. Therefore, lightweight deep learning models have become the best choice for drone systems, using embedded GPUs for model training and data processing. However, due to the limited flight time of drones, there are high requirements for the speed of the detection model.

[0005] However, reducing the complexity and number of parameters of the model usually leads to a decrease in detection accuracy, especially when facing tiny defects on the surface of photovoltaic modules and complex backgrounds, which is prone to false detection and missed detection. Therefore, how to ensure high detection accuracy while making the model lightweight, especially when detecting tiny and fuzzy defects, has become an urgent problem to be solved.

[0006] In practical applications, it is difficult for current technologies to balance detection speed and computing resource consumption while ensuring detection accuracy. Although some technologies can improve detection accuracy, they are difficult to meet the requirements of real-time detection. The complexity and number of parameters of the detection model are large, making it unsuitable for deployment in embedded GPU drone systems with limited computing resources. Summary of the invention

[0007] Technical problem: The present invention aims to solve the problems of complexity and excessive consumption of computing resources in the defect detection model of photovoltaic modules inspected by drones in the prior art. The existing detection model is not suitable for deployment on embedded GPU drone systems with limited computing resources due to the large number of parameters and complex calculations, and it is difficult to meet the needs of real-time detection. Therefore, the present invention proposes a lightweight detection method that can reduce the complexity and computing requirements of the model while maintaining high detection accuracy. It is suitable for drone platforms with embedded GPUs to achieve real-time detection of photovoltaic module defects.

[0008] Technical solution: To achieve the above purpose, the present invention provides the following technical solution:

[0009] A lightweight detection method for photovoltaic module defects for unmanned aerial vehicles of the present invention comprises the following steps in sequence:

[0010] S1: According to the installation angle of the photovoltaic module, the flight altitude and path of the drone are adjusted, and the pitch angle of the mounted camera is adjusted to shoot the surface of the photovoltaic module to obtain a large number of photovoltaic module surface images.

[0011] S2: Annotate the surface images of photovoltaic modules taken by drones, generate label files in YOLO format, and integrate them with the Roboflow open source dataset to build a photovoltaic module defect image dataset.

[0012] S3: Preprocessing operations are performed on the photovoltaic module defect image dataset, including data enhancement and image size adjustment, and the preprocessed dataset is divided into a training set, a validation set, and a test set.

[0013] S4: The network architecture of the YOLOv5s model is improved to be lightweight. The ShuffleNetV2 network is used to replace the original CSP (Cross Stage Partial) backbone network, which greatly reduces the number of model parameters and the amount of calculation to achieve lightweight. The effective channel attention module (ECA) is introduced to enhance the model's ability to recognize the defect characteristics of photovoltaic modules, and define the loss function for the photovoltaic module defect detection task.

[0014] S5: Set the training parameters, including the optimization algorithm, learning rate, and batch size, train the improved model using the enhanced dataset, and perform performance analysis and evaluation on the training results.

[0015] S6: Input the defect image of the photovoltaic module to be detected into the trained model, and output the detection results, including the location, category information and detection confidence of the surface defects of the photovoltaic module.

[0016] Furthermore, in step S2, integrating a large number of photovoltaic module surface images obtained by drone photography and Roboflow open source data into a new data set includes the following steps:

[0017] First, use annotation tools (such as LabelImg) to annotate the surface images of photovoltaic modules taken by drones. The annotation content includes various types of defects in photovoltaic modules, such as cracks, dust, and defect-free areas, and generates a .txt label file in YOLO format corresponding to the image. Next, organize and filter the Roboflow open source dataset to extract images and label data related to photovoltaic module defects. The filtered Roboflow dataset is merged with the annotated image dataset taken by drones to construct a comprehensive image dataset containing multiple types of photovoltaic module defects for model training and verification.

[0018] Furthermore, the image is preprocessed in step S3, specifically comprising the following steps:

[0019] Data enhancement operations are performed on the image dataset, including image translation, rotation, scaling, flipping, mosaic stitching, etc., in order to enhance the diversity of the data, simulate the actual situation of photovoltaic modules in different working scenarios, and improve the robustness and generalization ability of the model.

[0020] Resize the image to ensure that the input image has the same size.

[0021] At the input of the model, adaptive anchor box calculation is performed, and the anchor box parameters are continuously adjusted by comparing the difference between the predicted box and the actual annotation box (the size and proportion of the object in the dataset) to improve the accuracy of object detection. The integrated dataset is divided into training set, validation set and test set in a ratio of 7:2:1.

[0022] Furthermore, in step S4, the YOLOv5s model network architecture is improved, and defining the loss function includes the following steps:

[0023] The YOLOv5s model is lightweight and improved, and the ShuffleNetV2 network is used to replace the original CSP structure backbone network.

[0024] The ECA attention module is introduced into the model to enhance the model's ability to identify the defect characteristics of photovoltaic modules. The ECA module helps the model better capture and utilize key information through an efficient channel attention mechanism, improves the accuracy of detection and the model's ability to identify small or fuzzy defects.

[0025] The loss function of the YOLOv5s model is optimized to better meet the task requirements of photovoltaic module defect detection.

[0026] The model network architecture is adjusted by replacing all C3 modules and convolutional layers with the ShuffleNetv2 structure, and adding convolutional layers and ECA modules to the first two layers of the SPPF module.

[0027] Furthermore, setting training parameters in step S5, training the improved model, performing performance evaluation on the trained model, and saving the trained model include the following steps:

[0028] Set training parameters, including choosing appropriate optimization algorithms, learning rates, batch sizes, number of training rounds, and learning strategies to ensure that the model can converge stably in the later stages of training.

[0029] Import the pre-trained model and weights yolov5s.weights and start iterative training.

[0030] Calculate the loss value, including bounding box loss, confidence loss and category loss, and then perform back propagation and parameter optimization.

[0031] Post-processing, that is, in the model inference stage, uses the non-maximum suppression method to resolve conflicts between prediction boxes, remove boxes with large overlaps and low confidence, and ensure that only one high-confidence prediction box is retained for each target. After each training is completed for a specified number of iterations, the trained model is saved.

[0032] Visualize the training process and determine whether the model is overfitting by observing the changing trend of the loss function value. Evaluate the learning effect of the model at different training stages through the changes in the accuracy curve to ensure that the model converges steadily.

[0033] The model is comprehensively evaluated using five evaluation indicators: recall rate, precision rate, mAP50 value, training time, and inference time.

[0034] Beneficial effects: Compared with the prior art, the lightweight detection method for photovoltaic module defects for unmanned aerial vehicles proposed by the present invention has the following beneficial effects:

[0035] (1) By introducing the data enhancement strategy, the robustness of the model is significantly enhanced under different lighting conditions, so that the photovoltaic module defect detection model carried by the drone can maintain a high detection accuracy even in complex environments.

[0036] (2) The ShuffleNetV2 network is used to replace the CSP structure backbone network of the YOLOv5s model, which greatly reduces the number of model parameters and makes the model lightweight, making it suitable for deployment on drones with limited computing resources to meet the needs of real-time detection.

[0037] (3) After integrating the ECA attention module, the feature extraction capability of the model is effectively improved, especially when dealing with tiny or blurred defects, the detection accuracy and overall performance are significantly improved.

[0038] (4) By optimizing and adjusting the improved YOLOv5s network architecture and adding convolutional layers and ECA modules to the first two layers of the SPPF module, not only the operating efficiency and inference speed of the model are improved, but also the high detection accuracy of the model is guaranteed.

[0039] (5) This method enables UAVs to perform localized data processing in remote or bandwidth-constrained areas (such as mountains, deserts, islands, etc.) by transmitting only the detection results, thereby greatly reducing the amount of data transmission and reducing dependence on network bandwidth.

[0040] (6) The method of the present invention also enables drones to quickly conduct inspections after sudden severe weather (such as sandstorms and rainstorms), detect damaged photovoltaic modules and identify defects in real time, provide decision support for emergency maintenance, avoid aggravation of faults, and ensure that the power generation efficiency of photovoltaic modules is not damaged again. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 This is a flow chart of a lightweight detection method for defects of photovoltaic modules for unmanned aerial vehicles proposed by the present invention;

[0042] Figure 2 An image display of the data set used in the present invention;

[0043] Figure 3 YOLOv5s benchmark model architecture on which the method of the present invention is based;

[0044] Figure 4 This is a structural diagram of the CSP module in the YOLOv5s model replaced in the present invention;

[0045] Figure 5 This is a structural diagram of the ECA module integrated in the present invention;

[0046] Figure 6 The structure diagram of the SPPF module used to optimize the network architecture of the YOLOv5s model;

[0047] Figure 7 The lightweight network ShuffleNetV2 model architecture used in the present invention;

[0048] Figure 8 A lightweight detection model for photovoltaic module defects for drones proposed by the present invention;

[0049] Fig. 9A flow chart of the training ideas used to train the lightweight detection model for photovoltaic module defects for unmanned aerial vehicles proposed in the present invention;

[0050] Fig.10 This is the result of the surface defect detection of photovoltaic modules. DETAILED DESCRIPTION

[0051] The specific implementation methods of the present invention are further described in detail below in conjunction with the embodiments of the present invention and the accompanying drawings. However, the described embodiments are only part of the embodiments of the present invention, and the protection scope of the present invention is not limited to the embodiments.

[0052] The present invention provides a lightweight detection method for photovoltaic module defects for unmanned aerial vehicles. By effectively reducing the size and complexity of the detection model, a balance is made between the speed and accuracy of the detection, so that it can be deployed on the embedded GPU of a drone with limited computing resources to complete the real-time detection task of photovoltaic module defects. The model not only has a fast detection speed, but also has a detection accuracy that can meet the actual application requirements of photovoltaic module defect detection. Figure 1-Figure 10 , this embodiment is described in detail.

[0053] S1: According to the installation angle of the photovoltaic module and the pitch angle of the camera carried by the drone, the surface of the photovoltaic module is photographed to obtain a large number of photovoltaic module surface images.

[0054] Specifically, it includes the following sub-steps:

[0055] S11: Adjust the flight altitude and position of the drone to ensure that the fixed field of view of the camera matches the installation angle of the PV module to fully cover the surface of the PV module.

[0056] S12: Adjust the camera's pitch angle according to the PV module's pitch angle and sunlight angle to optimize the shooting effect. This adjustment helps reduce the impact caused by reflected light and shadows, ensuring high-quality images of the PV module surface.

[0057] S13: Take multiple shots along the preset flight path to collect a sufficient number of PV panel surface images to provide a basis for subsequent dataset construction and analysis.

[0058] S2: Integrate the surface images of photovoltaic modules obtained by drone photography with the Roboflow open source dataset to build a new photovoltaic module defect dataset.

[0059] Specifically, the following steps are included:

[0060] Use labeling tools (such as LabelImg) to label the surface images of photovoltaic modules taken by drones and generate .txt label files in YOLO format. The labeling content includes categories such as cracks, dust, and no defects.

[0061] Filter images related to PV module defects from the Roboflow open source dataset. Ensure that the format of the filtered images and label files is consistent, especially the format of the .txt label file. Then, integrate the filtered Roboflow data with the image dataset taken by the drone to generate a comprehensive PV module defect dataset.

[0062] S3: Perform preprocessing operations on the images and divide the samples into training set, validation set and test set.

[0063] Specifically, the preprocessing operation includes the following steps:

[0064] S31: Perform data enhancement operations on the image dataset, including translation, scaling, flipping, mosaic and other operations to enhance data diversity, simulate the actual situation of photovoltaic modules in different working scenarios, and improve the robustness and generalization ability of the model.

[0065] By configuring the 'translate', 'scale', flipud, fliplr, and mosaic parameters in the default hyperparameter file 'hyp.scratch.yaml' of YOLOv5, operations such as translation, scaling, flipping, and mosaicing of the image dataset can be achieved. The dataset includes 10,445 images of the surface of three types of photovoltaic modules: cracks, dust, and no defects. Some of the images are shown below. Figure 2 shown.

[0066] S32: Standardize the image size to ensure that the input image size is consistent for easy model processing and training.

[0067] The image size is uniformly resized to 640×640 via the command line parameter --'img-size'.

[0068] S33: Adaptive anchor box calculation is performed at the model input. By comparing the difference between the predicted box and the actual labeled box, the anchor box parameters are automatically adjusted to improve the accuracy of object detection. The dataset is divided into training set, validation set and test set in a ratio of 7:2:1.

[0069] By running the autoanchor.py script of YOLOv5, the k-means clustering algorithm is used to generate suitable anchor box parameters based on the annotation boxes in the dataset. The calculation results are replaced in the anchors field in the model configuration file to complete the setting of the adaptive anchor box.

[0070] The script randomly divides the dataset into training set, validation set, and test set in a ratio of 7:2:1. The training set is used for model training, the validation set is used to adjust hyperparameters, and the test set is used to evaluate the performance of the model.

[0071] S4: Improve the network architecture of the YOLOv5s model.

[0072] Specifically, the following steps are included:

[0073] S41: Improve the YOLOv5s model with lightweight structure and use the ShuffleNetV2 network to replace the original CSP structure backbone network.

[0074] In the backbone network of the model, the original CSP module is replaced by the ShuffleNetV2 module ( Figure 8 ), the ShuffleNetV2 group convolution and channel shuffling mechanism effectively reduces the amount of calculation and parameters of the model, thus achieving lightweight Figure 7 shown.

[0075] In ShuffleNetV2, the input feature map is processed through the Shuffle channel shuffle operation and after different convolution kernel operations, the calculation formula of the feature map is as follows:

[0076] Y=Shuffle(X)×W

[0077] Among them, X is the input feature map, W is the weight matrix, and Shuffle is the channel shuffle operation. In this way, each set of feature maps is processed by different convolution kernels, which improves the computational efficiency.

[0078] The key steps to replace the YOLOv5 CSP backbone network with ShuffleNetV2 are as follows

[0079] Replacement of backbone network: Replace the CSP ( Figure 4 ) structure is replaced with the backbone network of ShuffleNetV2. By redesigning the network structure and adjusting the parameters, the dimensions of the network input and output are ensured to match, while ensuring that the deep feature information can be effectively transmitted.

[0080] Channel number adaptation: In order to ensure the compatibility between the various layers of the network, the output channel number of ShuffleNetV2 is adjusted to match the input requirements of subsequent modules of YOLOv5 (such as the detection head and classification layer). Through channel number adaptation, the overall efficiency of the model for photovoltaic module defect detection is improved.

[0081] Feature scale adjustment: The downsampling module of ShuffleNetV2 is adjusted to ensure that the output feature map size is compatible with the multi-scale detection strategy of YOLOv5. This ensures that the model can maintain detection accuracy and consistency when dealing with objects of different scales.

[0082] Channel shuffling and segmentation: ShuffleNetV2 uses channel shuffling and segmentation mechanisms to optimize the information flow path. Through the self-designed feature fusion strategy, the loss of effective feature information in the process of information transmission is avoided, and the representation ability of the YOLOv5 architecture in multi-scale feature detection is enhanced.

[0083] S42: An ECA attention module is introduced into the model to enhance the model's ability to recognize defect features of PV modules, especially for small or blurred features.

[0084] Specifically, the ECA module is inserted in the previous layer of the SPPF module. Figure 8 As shown in the figure, the ECA module dynamically adjusts the model's attention to important features by assigning different weight values ​​to each channel, thereby improving the model's ability to capture key information. This effectively improves the accuracy of the model in detecting surface defects of photovoltaic modules, especially under complex backgrounds and multi-scale targets.

[0085] ECA Module( Figure 5 ) First, the feature vector z is obtained by global average pooling, and then the weight w of each channel is generated by performing a one-dimensional convolution with a convolution kernel size of f on the feature vector z. Where f is determined adaptively by the number of channels A, and the calculation formula is as follows:

[0086]

[0087] Where:| . | 奇数 It means taking the result up to the nearest odd number, A is the number of channels of the input feature map, r is the hyperparameter that controls the scaling ratio of the convolution kernel size, and b is the offset parameter.

[0088] The final weight w is calculated by one-dimensional convolution, and the calculation formula is as follows:

[0089] w=Conv1D(z,f)

[0090] Where: Conv1D refers to one-dimensional convolution, z is the feature vector obtained by global average pooling (dimension is A×1), and f is the adaptive convolution kernel size. Among them, w has a dimension of A×1, and each value corresponds to the weight of a channel.

[0091] The ECA module is integrated through the following steps:

[0092] Add the ECA module to the network structure and embed it into the backbone network structure of the model to enhance the model's ability to assign weights to feature channels. When setting the network structure, pass in the ECA class name and dynamically adjust the number of output channels of the convolutional layer and ECA module in the model through the qw parameter to ensure consistency with the output of other modules of the model. According to the newly added ECA modules and layers, modify the model's structure configuration file and update the network architecture description to ensure that the forward propagation and backpropagation calculations of the model are executed correctly.

[0093] S43: The loss function of the YOLOv5s model is optimized to better meet the task requirements of photovoltaic module defect detection.

[0094] The loss function used is defined as follows:

[0095]

[0096] Where L total is the loss function used by the model, K represents the number of multi-scale output feature maps, balance k represents the balance weight of each scale, which is used to adjust the contribution of the feature map of this scale to the total loss, λ CIoU , obj , cls are the weight parameters of each loss term, L CIoU It is a loss function that comprehensively measures the difference between the predicted box and the true target box. obj is the target confidence loss function, L cls is the classification loss function.

[0097] L CIoU As shown below:

[0098]

[0099] Among them, IoU is the intersection over union ratio between the prediction box and the target box, d c Represents the diagonal distance of the target box, d u represents the Euclidean distance between the center points of the predicted box and the target box, α is an adjustment term used to balance the impact of length ratio consistency on the loss. v is a parameter that measures the consistency of the aspect ratio between the predicted box and the target box, and is defined as:

[0100]

[0101] Among them, w gt and h gt are the width and height of the target box, w p and h p are the width and height of the prediction box.

[0102] L obj As shown below:

[0103]

[0104] Among them, P o is the confidence label of the true target box, is the confidence score of the model's prediction.

[0105] L cls As shown below:

[0106]

[0107] Among them, C is the number of categories, p c is the label of the real category (one-hot encoding), The class probabilities predicted by the model.

[0108] The category loss is similar to the confidence loss, and is calculated by the binary cross entropy representation of the category score of the predicted box and the target box category. By introducing the CIoU loss, the aspect ratio consistency measurement between the predicted box and the true box is added to improve the positioning accuracy. Compared with the traditional IoU loss, CIoU can provide more accurate gradient information when the target box is close to the true box. The loss function of the model is better tuned, thereby improving the accuracy and robustness of photovoltaic module defect detection.

[0109] S44: Adjust the model network architecture ( Figure 8 ), replace all C3 modules and convolutional layers with ShuffleNetv2 structure, and replace the SPPF module ( Figure 6 ) by adding convolutional layers and ECA modules to the first two layers.

[0110] After replacing the C3 module and convolutional layer with the ShuffleNetv2 structure, the spatial information and detail features in the feature map are further enriched by adding an additional convolutional layer before entering the SPPF module. Subsequently, the ECA module assigns weights to each feature channel, enabling the model to capture more valuable feature information at different scales, thereby enhancing the robustness and generalization ability of the model, especially when dealing with complex scenes and photovoltaic module defects, improving the accuracy of detection.

[0111] S5: Set training parameters, train the improved model, analyze the training results, and save the trained model.

[0112] Specifically, the following steps are included:

[0113] S51: Set training parameters. First, set the key parameters of training, including selecting an appropriate optimization algorithm, learning rate, batch size, and number of training rounds. The SGD optimization algorithm is preferably selected to accelerate convergence, and the IoU threshold is set to 0.4. The initial learning rate is set to 0.01, and a learning rate decay strategy is adopted to ensure stability in the later stages of training. The batch size is set to 16 to strike a balance between training speed and video memory usage. The number of training rounds is set to 499 to ensure that the model fully learns the characteristics of PV module defects.

[0114] S52: Import the pre-trained model and weights (YOLOv5s+ECA+ShuffleNetV2.weights) for iterative training.

[0115] Use the torch library to load the pre-trained weights of the model, apply the pre-trained weights to the YOLOv5s+ECA+ShuffleNetV2 model architecture, and update the weights according to the specific task of photovoltaic module defect detection.

[0116] S53: Calculate the loss value, including the total loss, bounding box loss, confidence loss and category loss, and then perform back propagation and parameter optimization.

[0117] The input image is forward propagated through the model to generate three prediction results: bounding box position, confidence, and category probability. The total loss function is then calculated and the model parameters are updated through backpropagation. The SGD optimization algorithm is used for gradient descent to adjust the model weights to minimize the loss.

[0118] S54: Post-processing, that is, in the model inference stage, the non-maximum suppression method is used to resolve conflicts between prediction boxes, remove boxes with large overlaps and low confidence, and ensure that only one high-confidence prediction box is retained for each target. After each training is completed for a specified number of iterations, the trained model is saved.

[0119] The non-maximum suppression algorithm is applied to multiple candidate boxes output by the model, the predicted box with the highest confidence is retained, and those boxes with large overlap (IoU exceeds the threshold) are removed.

[0120] The model weights are saved every certain number of epochs. This is used to prevent data loss caused by training interruptions and to trace back the training status of the model at different stages. After training is completed, the final YOLOv5s+ECA+ShuffleNetV2 training model is saved as a separate file for inference or further fine-tuning.

[0121] S55: Visualize the training process: During the model training process, the loss function curve and accuracy curve of the training set and the validation set are recorded and visualized in real time. By observing the changing trend of the loss function value, it is possible to determine whether the model is overfitting. By observing the changes in the accuracy curve, the learning effect of the model at different training stages is evaluated to ensure that the model converges steadily.

[0122] Use TensorBoard to draw the loss function and accuracy curves in real time. By observing these curves, you can identify whether the model is overfitting or underfitting. According to the changing trend of the curves, adjust the training parameters such as learning rate and batch size to ensure that the model can steadily converge to the optimal state.

[0123] S56: The model is comprehensively evaluated using five evaluation indicators: recall rate, precision rate, mAP50 value, training time, and inference time.

[0124] After training 10,445 high-resolution images of three types of photovoltaic modules, namely crack, dust and no faulty, the YOLOv5s+ECA+ShuffleNetV2 model achieved an accuracy of 0.886, a recall of 0.874, and an mAP of 0.892. The training time (499 generations) was 7.734 hours, and the inference time was only 0.01 seconds. The model has excellent performance and can be effectively deployed on the embedded GPU of drones with limited computing resources to complete real-time monitoring of surface defects of photovoltaic modules.

[0125] S6: Input the defect image set of the photovoltaic module to be detected into the trained model, and output the location and category information of the surface defects of the photovoltaic module to be detected.

[0126] The defective images of photovoltaic modules to be detected are input into the trained model. The detection results of the model are as follows: Fig.10 shown.

Claims

1. A lightweight detection method for photovoltaic module defects for unmanned aerial vehicles, characterized in that: The following steps are involved: S1: According to the installation angle of the photovoltaic module, the flight altitude and path of the drone are adjusted, and the pitch angle of the camera is adjusted to shoot the surface of the photovoltaic module to obtain a large number of photovoltaic module surface images; S2: Integrate a large number of PV module surface images obtained by drone photography and Roboflow open source data into a new PV module defect image dataset; S3: preprocessing the photovoltaic module defect image dataset, and dividing the preprocessed dataset into a training set, a validation set, and a test set; S4: Improve the network architecture of the YOLOv5s model and define the loss function; S5: Set training parameters, train the improved model, analyze the training results, and save the trained model; S6: Input the defect image set of the photovoltaic module to be detected into the trained model, and output the location and category information of the surface defects of the photovoltaic module to be detected.

2. A method for lightweight detection of photovoltaic module defects for unmanned aerial vehicles according to claim 1, characterized in that: The step S2 comprises: S2.1: Use annotation tools to annotate the acquired PV module surface images and generate label files in YOLO format. The label content includes the types of cracks, dust, and no defects. At the same time, the image data related to PV module defects in the Roboflow open source dataset are screened and sorted. S2.2: Integrate the image data captured by the drone with the sorted Roboflow dataset to generate a PV module defect image dataset with a unified label format.

3. A method for lightweight detection of photovoltaic module defects for unmanned aerial vehicles according to claim 1, characterized in that: The step S3 comprises: S3.1: Perform various data enhancement operations on the photovoltaic module defect image dataset, including image translation, rotation, scaling, flipping, and mosaic stitching, to improve sample diversity and model robustness; S3.2: During the model training process, an adaptive anchor box calculation method is used to automatically adjust the anchor box size according to the size and proportion of the target in the dataset to improve the accuracy of target detection.

4. The method for lightweight detection of photovoltaic module defects for unmanned aerial vehicles according to claim 1, characterized in that: The step S4 comprises: S4.1: Perform feature map calculation in the ShuffleNetV2 network. The specific steps are: process the input feature map through the Shuffle channel shuffle operation and perform different convolution kernel operations. The formula is as follows: Y=Shuffle(X)×W In the formula, X is the input feature map, W is the weight matrix, and Shuffle is the channel shuffle operation. This ensures that each set of feature maps is processed by different convolution kernels, thereby improving computational efficiency. S4.2: Replace the CSP backbone network structure in the YOLOv5 model with the ShuffleNetV2 structure, redesign the network structure and adjust the parameters to ensure that the network input and output dimensions match and the deep feature information is effectively transmitted; S4.3: Adapt the number of channels and adjust the number of output channels of ShuffleNetV2 to ensure that it is consistent with the input requirements of subsequent modules; S4.4: Adjust the downsampling module of ShuffleNetV2 to make the scale of the output feature map compatible with the model's multi-scale detection strategy to support the model's detection tasks at different scales; S4.5: Integrate the channel shuffling and segmentation mechanism of ShuffleNetV2, optimize the information flow path, and design feature fusion strategies to further improve the detection performance and computational efficiency of the model.

5. The method for lightweight detection of photovoltaic module defects for unmanned aerial vehicles according to claim 1, characterized in that: In step S4, the model integrates the ECA module and is completed by defining the following steps: S4.6: The ECA module first obtains the feature vector z through global average pooling, and then generates the weight w of each channel by performing a one-dimensional convolution with a convolution kernel size of f on the feature vector z, where f is adaptively determined by the number of channels A. The calculation formula is as follows: In the formula, |.| 奇数 It means taking the result up to the nearest odd number, A is the number of channels of the input feature map, r is the hyperparameter that controls the scaling ratio of the convolution kernel size, and b is the offset parameter; The final weight w is calculated by one-dimensional convolution, and the calculation formula is as follows: w=Conv1D(z,f) In the formula, Conv1D refers to one-dimensional convolution, z is the feature vector obtained by global average pooling, the dimension is A×1, and f is the adaptive convolution kernel size; among them, the dimension of w is A×1, and each value corresponds to the weight of a channel.

6. A method for lightweight detection of photovoltaic module defects for unmanned aerial vehicles according to claim 5, characterized in that: In step S4, the ECA module completes the integration through the following steps: S4.7: Add the ECA module to the network structure and embed it into the backbone network structure of the model to enhance the model's ability to allocate weights to feature channels; S4.8: When setting the network structure, pass in the ECA class name and dynamically adjust the number of output channels of the convolutional layer and ECA module in the model through the qw parameter to ensure consistency with the output of other modules of the model; S4.9: Modify the model's structural configuration file according to the newly added ECA modules and layers, update the network architecture description, and ensure that the forward propagation and back propagation calculations of the model are executed correctly.

7. A lightweight detection method for photovoltaic module defects for unmanned aerial vehicles according to claim 1, characterized in that: In step S4, the loss function L total The formula is as follows: Where K represents the number of multi-scale output feature maps, balance k represents the balance weight of each scale, which is used to adjust the contribution of the feature map of this scale to the total loss, λ CIoU , obj , cls are the weight parameters of each loss term, L total is the total loss function of the model, L CIoU It is a loss function that comprehensively measures the difference between the predicted box and the true target box. obj is the target confidence loss function, L cls is the classification loss function; L CIoU As shown below: Where IoU is the intersection over union ratio between the prediction box and the target box, d c Represents the diagonal distance of the target box, d u represents the Euclidean distance between the center points of the predicted box and the target box, α is an adjustment term used to balance the impact of length ratio consistency on the loss, and v is a parameter that measures the consistency of the aspect ratio between the predicted box and the target box, which is defined as: In the formula, w gt and h gt are the width and height of the target box, w p and h p is the width and height of the prediction box; L obj As shown below: Where P o is the confidence label of the true target box, is the confidence score of the model prediction; L cls As shown below: In the formula, C is the number of categories, p c is the label of the true category, The class probabilities predicted by the model.

Citation Information

Patent Citations

  • Two-stage photovoltaic panel defect detection method based on deep learning

    CN114972225A

  • High-performance lightweight YOLOv5-3S-4PH insulator defect real-time detection method

    CN115222672A

  • PCB surface defect detection method based on improved YOLOv5

    CN115719338A

  • Distributed roof photovoltaic module defect diagnosis method and device based on unmanned aerial vehicle automatic inspection

    CN116223511A

  • Lightweight multi-target detection method based on improved YOLOv4

    CN117409355A

Cited By

  • Photovoltaic module identification model training method, identification method and related equipment

    CN121095820A