Solar photovoltaic module defect detection method

Through the improved YOLOv8n defect detection model and slice-assisted hyperinferential SAHI, the problem of efficient and high-precision in defect detection of solar photovoltaic modules is solved, especially the insufficient detection accuracy of small target defects, and the defect detection of high-resolution photovoltaic module EL images is achieved.

CN120298750APending Publication Date: 2025-07-11JIANGSU PIHE ADVANCED MFG TECH CO LTD +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510287151.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-12
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

In the prior art, the defect detection method of solar photovoltaic modules is time-consuming and labor-intensive, subjective, and cannot meet the requirements of high accuracy and high efficiency, especially the detection accuracy of small target defects is insufficient.

Method used

The improved YOLOv8n defect detection model is adopted, and the photovoltaic module defect detection is detected by inserting the parameterless attention module SimAM and small object detection head, and the CIoU loss function is replaced with the NWD loss function, and the slice assisted hyperinference SAHI is combined with slice-assisted hyperinference SAHI.

Benefits of technology

The detection accuracy of small target defects is improved, defect detection of high-resolution photovoltaic module EL images is realized, and detection efficiency and accuracy are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120298750A_ABST
    Figure CN120298750A_ABST
Patent Text Reader

Abstract

The invention relates to a solar photovoltaic module defect detection method, and belongs to the technical field of photovoltaic module defect detection. The method comprises the steps of 1, collecting a solar photovoltaic module defect image; 2, preprocessing the obtained image, and marking the defect category and position information to complete the construction of a defect data set of the solar cell panel; step 3, constructing an improved YOLOv8n defect detection model, including inserting a parameter-free attention module SimAM and a newly added small target detection head into a backbone network, and replacing an original loss function CIoU with a loss function NWD; step 4, performing training and performance evaluation on the improved YOLOv8n defect detection model by using the constructed data set; and step 5, aiming at a complete photovoltaic module image, slice-assisted super inference SAHI and the trained improved YOLOv8n defect detection model are matched to automatically carry out defect detection on the photovoltaic module. According to the invention, the defect detection of the EL image of the high-resolution photovoltaic module is realized, and the detection precision of small target defects is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method for detecting defects in solar photovoltaic modules, belonging to the technical field of photovoltaic module defect detection. Background Art

[0002] Solar energy is a renewable energy source, which has the characteristics of low development difficulty, low usage cost and high safety compared with other renewable energy sources such as geothermal energy and tidal energy. In addition, solar photovoltaic modules are one of the important components of photovoltaic power plants, and their effective utilization of solar energy through the photovoltaic effect alleviates the energy demand problem accompanied by the development of technology and the growth of population. Therefore, solar photovoltaic modules are widely used in various countries around the world. However, due to the complexity of the production process and the particularity of the production materials of solar photovoltaic modules, various types of defects will inevitably occur during the production process, which will lead to a decrease in power generation efficiency and even cause safety problems such as fires in severe cases.

[0003] Electroluminescence (EL) imaging technology has become the mainstream method for photovoltaic module imaging because it can reveal defects invisible to the naked eye in photovoltaic modules and provide high-resolution photovoltaic module images. For the EL images of photovoltaic modules, visual inspection is usually relied on by experienced professionals, but this method is time-consuming and laborious, highly subjective and the results cannot be quantified, and it cannot meet the requirements of high-precision and high-efficiency production. In addition, in the obtained high-resolution EL images of photovoltaic modules, their defects can often be classified as small target defects, which makes the defect detection of photovoltaic modules a challenge. Therefore, designing a method for detecting defects in solar photovoltaic modules has important industrial application significance for improving the production and quality inspection efficiency of solar photovoltaic modules. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to provide a method for detecting defects in solar photovoltaic modules according to the above-mentioned prior art, which can detect the defects in the EL images of photovoltaic modules and improve the detection accuracy of small target defects.

[0005] The technical solution adopted by the present invention to solve the above problems is as follows: A method for detecting defects in solar photovoltaic modules, the detection method includes the following steps:

[0006] Step 1: Collect defect images of solar photovoltaic modules;

[0007] Step 2: After preprocessing the obtained images, label the defect categories and position information to complete the construction of the solar panel defect dataset;

[0008] Step 3: Construct an improved YOLOv8n defect detection model, including inserting a parameter-free attention module SimAM, a small target detection head in the backbone network, and replacing the original loss function CIoU with a loss function NWD;

[0009] Step 4: Use the constructed dataset to train and evaluate the performance of the improved YOLOv8n defect detection model;

[0010] Step 5: For the complete photovoltaic module image, the sliced - assisted hyper - inference SAHI and the trained improved YOLOv8n defect detection model cooperate to automatically detect defects in the photovoltaic module.

[0011] The defects of the solar photovoltaic module in Step 1 include black spots, material defects, cracks, and broken grids.

[0012] In Step 2, data augmentation is performed on the obtained images by random flipping, random rotation, and brightness change.

[0013] In Step 2, the defect dataset is divided into a training set, a validation set, and a test set according to a ratio.

[0014] The parameter - free attention module SimAM is inserted into the connection between the sixth - layer C2f module in the backbone network and the corresponding connection of the neck network. The parameter - free attention module SimAM finds the importance of each neuron through an energy function;

[0015] The calculation formula of the minimum energy function is:

[0016] where \(t\) is the target neuron of the input feature of the current channel;

[0017] is the mean of all neurons in the channel;

[0018] is the variance of all neurons in the channel;

[0019] \(\lambda\) is the weight constant.

[0020] The detection head of the improved YOLOv8n defect detection model contains two parallel branches. Each of the two branches includes two CBS modules, a convolutional layer, and a loss layer connected in sequence. The loss layer of one branch is the regression loss Bboxloss, and the loss layer of the other branch is the classification loss Cls loss.

[0021] The small - target detection head includes the sixteenth - layer Upsample module, the seventeenth - layer Concat module, the eighteenth - layer C2f module, the nineteenth - layer CBS module, the twentieth - layer Concat module, and the twenty - first - layer C2f module.

[0022] The loss function NWD is obtained by taking the bounding box \(B=(c x ,c y, (w, h) is modeled as a two-dimensional Gaussian distribution, and the Wasserstein distance is used to evaluate the difference between the predicted bounding box and the ground truth bounding box.

[0023] The bounding box is modeled as a two-dimensional Gaussian distribution, and the probability density function formula is:

[0024]

[0025] where x is the coordinate (x, y); μ represents the mean vector of the Gaussian distribution Σ represents the covariance matrix c x and c y respectively represent the abscissa and ordinate of the center of the box; ω and h are the length and width of the box respectively;

[0026] The predicted bounding box B p =(c xp , c yp , w p , h p ) and the ground truth bounding box B g =(c xg , c yg , w g , h g ) after modeling, the difference between the two-dimensional Gaussian distributions N p and N g is evaluated using the Wasserstein distance. The calculation formula of the Wasserstein distance is:

[0027]

[0028] Normalization is used to get rid of the dependence on the overlap degree of the bounding box. The normalization calculation formula is:

[0029]

[0030] Furthermore, the calculation formula of the loss function NWD is obtained as:

[0031] L NWD =1 - NWD(N p , N g ).

[0032] In the fourth step described above, the hyperparameters of the training are set, and the training set and the validation set are input into the improved YOLOv8n defect detection model for training and GPU parallel acceleration is adopted. During the training process, the weights with the highest detection accuracy will be saved and named best.pt; then, Precision, Recall, and the mean average precision mAP are used for performance evaluation to verify the defect detection performance of the improved YOLOv8n defect detection model described in the third step. The mathematical expressions are as follows:

[0033] Precision = TP / (TP + FP) × 100%

[0034] Recall = TP / (TP + FN) × 100%

[0035]

[0036] Where N is the total number of categories;

[0037] TP is the number of correctly predicted positive samples;

[0038] FP is the number of negative samples predicted as positive samples;

[0039] FN represents the number of positive samples predicted as negative samples.

[0040] The slice-assisted hyper-inference SAHI divides the complete EL image of the photovoltaic module into multiple sliced images of the same size that completely cover the original image and allow overlap; imports the best.pt weight file into the improved YOLOv8n defect detection model, performs inference on multiple sliced images respectively, and merges the inference results to generate the complete EL image of the photovoltaic module, and finally obtains the photovoltaic module defect detection result.

[0041] Compared with the prior art, the advantages of the present invention are as follows: A method for detecting defects in solar photovoltaic modules directly estimates the three-dimensional weights of defect features by inserting the parameter-free attention mechanism SimAM, thereby promoting information selection in the defect detection process and improving the accuracy without affecting the detection speed. By adding a small target detection head and replacing the original CIoU loss function with NWD, the detection performance of the improved YOLOv8n defect detection model for small target defects is effectively improved. In the inference stage, the combination of SAHI and the improved YOLOv8n defect detection model can perform sliced inference on the complete EL image of the photovoltaic module and merge the inference results to generate the complete EL image of the photovoltaic module, and finally obtain the photovoltaic module defect detection result; realizing the defect detection of high-resolution EL images of photovoltaic modules and improving the detection accuracy of small target defects. Description of the Drawings

[0042] Figure 1 It is the overall flow block diagram of a method for detecting defects in solar photovoltaic modules according to an embodiment of the present invention;

[0043] Figure 2 It is the structural schematic diagram of the improved YOLOv8n defect detection model;

[0044] Figure 3 It is the three-dimensional weight estimation schematic diagram of the parameter-free attention mechanism SimAM;

[0045] Figure 4 It is a schematic structural diagram of the detection head in the improved YOLOv8n;

[0046] Figure 5 It is an analysis diagram of the sensitivity of the IoU loss function to small-size defects;

[0047] Figure 6 It is an analysis diagram of the sensitivity of the IoU loss function to normal-size defects. Specific implementation manners

[0048] The present invention will be further described in detail below in conjunction with the embodiments in the accompanying drawings.

[0049] As Figure 1 shown, a method for detecting defects in a solar photovoltaic module includes the following steps:

[0050] Step 1: Collect defect images of the solar photovoltaic module; the object of defect detection is a solar photovoltaic module with a specification of 6*24, that is, composed of 6 rows and 24 columns of solar photovoltaic cells, a total of 144 pieces.

[0051] The detected defects of the solar photovoltaic module include: black spots, material defects, cracks, and broken grids.

[0052] The defect image acquisition of the solar photovoltaic module adopts a four-camera three-displacement EL imaging method, that is, the image collected by each camera in a single displacement is a local photovoltaic module EL image.

[0053] Step 2: After preprocessing the obtained images such as cropping, label the defect category and location information to complete the construction of the solar cell panel defect data set. Use the professional data annotation tool Labelimg to complete the defect annotation of the defect category and location information through a rectangular box; and divide the data set into a training set, a validation set, and a test set according to a ratio of 7:2:1.

[0054] Since the occurrence probabilities of different defects are different, the collected defect samples will have the problem of inter-class imbalance of samples. Therefore, when performing Step 2 to complete the data set construction by labeling the defect category and location information of the obtained images, image transformation methods such as random flipping, random rotation of 180°, and brightness change (between 0.8 times and 1.2 times the original image brightness) can be used to transform the image and the corresponding txt label file simultaneously to complete data augmentation and improve the detection performance of the subsequent defect detection model. To avoid data contamination, data augmentation is only performed on the training set.

[0055] Step 3: Construct an improved YOLOv8n defect detection model, including inserting a parameter-free attention module SimAM into the backbone network, adding a small target detection head, and replacing the original loss function CIoU with the loss function NWD.

[0056] As Figure 2 shown, insert the parameter-free attention module SimAM (as Figure 3 shown) into the corresponding connection from the sixth-layer C2f module in the backbone network to the neck network. It uses an energy function to find the importance of each neuron.

[0057] The calculation formula for the minimum energy function is:

[0058] where t is the target neuron of the input feature of the current channel;

[0059] is the mean of all neurons in the channel;

[0060] is the variance of all neurons in the channel;

[0061] λ is the weight constant.

[0062] By directly calculating the mean and variance of all neurons in the channel, a large number of repeated calculations are avoided, reducing the computational cost. When the minimum energy is smaller, the difference between the target neuron t and its surrounding neurons is greater, and the corresponding target neuron t is more important. The importance of each neuron can be obtained through , so it uses scaling to optimize the features rather than add. The refined definition of SimAM is:

[0063] where E groups all across space and channels; Sigmoid is used to limit the size of E to prevent E from being too large. Sigmoid belongs to a monotonic function, so it does not affect the relative importance between neurons.

[0064] SimAM considers both spatial and channel information to directly estimate the three-dimensional weights of the defect features of solar photovoltaic modules, enhancing the perception of defect features by the improved YOLOv8n defect detection model. Further, since SimAM directly calculates the attention weights from the feature output of the sixth-layer C2f module in the backbone network, it does not require additional learning of other parameters, thus improving the detection accuracy without affecting the detection speed.

[0065] As Figure 2 shown, the detection head structure in the improved YOLOv8n defect detection model includes a small target detection head P2 and the other three detection heads P3, P4, and P5. AsFigure 4 As shown in the figure, the detection head structure in the improved YOLOv8n defect detection model contains two parallel branches. Both branches are composed of two consecutive CBS modules, a convolutional layer, and a loss layer. The main difference between the two branches lies in the final loss layer, one of which is the regression loss (Bbox loss) and the other is the classification loss (Cls loss). Figure 2 The small target detection head is shown by the dashed box in the figure. After the 15th C2f module in the neck network, a 16th Upsample module, a 17th Concat module, and an 18th C2f module are added in sequence. The output of the 18th C2f module is used to form the input of the newly added small target detection head; then a 19th CBS module and a 20th Concat module are added in sequence. Further, the output of the 15th C2f module and the output of the 19th CBS module in the neck network are connected through the newly added 20th Concat module and then transmitted to the 21st C2f module.

[0066] Small target defects usually only occupy a very small pixel area in the image. As the downsampling factor increases continuously, the feature map shrinks continuously, and the relevant information of small target defects is easily lost during the feature extraction process, resulting in the defect detection model being unable to effectively detect the feature information of small target defects. The newly added small target detection head detects on the low-level feature map (the feature map with higher resolution), effectively improving the focus of the defect detection model on small target defects.

[0067] Combined Figure 5 and Figure 6 As shown in the figure, IoU represents the ratio of the intersection area to the union area between the ground truth box and the predicted box predicted by the neural network. IoU is very sensitive to objects of different sizes, and a small change in the position of a small object can cause a significant change in IoU. In this regard, the loss function NWD first models the bounding box B=(c x ,c y ,w,h) as a two-dimensional Gaussian distribution N(μ,∑) (that is, the weight from the central pixel point to the edge of the bounding box gradually decreases, and the weight of the central pixel point is the maximum value), and its probability density function formula is:

[0068]

[0069] where x is the coordinate (x,y); μ and Σ represent the mean vector and covariance matrix c x and c y are the abscissa and ordinate of the center of the box respectively; w and h are the length and width of the box respectively.

[0070] Secondly, for the prediction box B p =(c xp , c yp , w p , h p ) and the ground truth box B g =(c xg , c yg , w g , h g ), the difference between the modeled Gaussian distributions N p and N g is evaluated using the Wasserstein distance. This makes the model training process pay more attention to the change in the center point position of small objects, and can effectively guide the gradient update during model training even when the prediction box and the ground truth box do not overlap, avoiding the problem of gradient disappearance that may occur in the original IoU loss function during target regression. The calculation formula of the Wasserstein distance is:

[0071]

[0072] Then, the loss calculation after normalization gets rid of the dependence on the overlap degree of the bounding boxes. Therefore, the loss function NWD has scale invariance. The normalization calculation formula is:

[0073]

[0074] Finally, the calculation formula of the loss function NWD is obtained as L NWD = 1 - NWD(N p , N g ), which effectively enhances the localization accuracy of the improved YOLOv8n defect detection model for small target defects.

[0075] Step 4: Use the constructed dataset to complete the training and performance evaluation of the improved YOLOv8n defect detection model.

[0076] Set the hyperparameters for training, specifically including the number of iterations, batch size, optimizer, and learning rate. Among them, the number of iterations is determined through experiments, and the other hyperparameters are selected based on experience. Input the training set and validation set constructed in Step 2 into the improved YOLOv8n defect detection model for training and use GPU parallel acceleration. During the training process of the improved YOLOv8n defect detection model, the weights with the highest detection accuracy will be saved and named best.pt. The specific settings of the hyperparameters are shown in Table 1:

[0077] Table 1 Hyperparameter Table

[0078] Parameter Value Number of iterations 150 Batch size 32 Optimizer SGD Learning rate 0.001

[0079] The performance of the YOLOv8n defect detection model is evaluated using Precision, Recall, and mean Average Precision (mAP) to verify the effectiveness and defect detection performance of the improved YOLOv8n defect detection model in Step 3. The mathematical expressions are as follows:

[0080] Precision = TP / (TP + FP) × 100%

[0081] Recall = TP / (TP + FN) × 100%

[0082]

[0083] Where N is the total number of categories; TP is the number of correctly predicted positive samples; FP is the number of negative samples predicted as positive samples; FN is the number of positive samples predicted as negative samples.

[0084] The comparison results are shown in Table 2, where mAP50 is the mean Average Precision when the IoU threshold is 50%.

[0085] Table 2 Comparison Results

[0086] Model Precision Recall mAP50 Yolov3-tiny 0.856 0.708 0.864 YOLOv5s 0.867 0.763 0.877 YOLOv6n 0.879 0.692 0.857 YOLOv8n 0.822 0.862 0.882 Improved YOLOv8n 0.844 0.890 0.912

[0087] As can be seen from Table 2, the Recall and mAP50 of the improved YOLOv8n defect detection model have achieved the best values. Although the Precision has not achieved the best value, it has also reached an acceptable 0.844. In addition, the Precision, Recall, and mAP50 of the improved YOLOv8n defect detection model are 2.2%, 2.8%, and 3% higher than those of YOLOv8n, respectively. Therefore, the improved YOLOv8n defect detection model has more excellent detection performance compared to other models.

[0088] Step 5: Combine the sliced - assisted hyper - inference (SAHI) and the trained improved YOLOv8n defect detection model for the complete solar photovoltaic module image to achieve solar photovoltaic module defect detection.

[0089] Use SAHI to divide the complete photovoltaic module EL image into 12 sliced images of the same size that completely cover the original image with overlap allowed. Further, import the best.pt weight file into the improved YOLOv8n defect detection model, and use it to perform inference on the 12 obtained sliced images respectively. Then SAHI combines the inference results of the 12 sliced images to generate the complete photovoltaic module EL image, and finally obtains the photovoltaic module defect detection result. It should be noted that SAHI can merge overlapping prediction boxes during the stitching process, thus maintaining the defect detection accuracy.

[0090] In this application, a parameter-free attention mechanism SimAM is inserted to directly estimate the three-dimensional weights of defect features, thereby promoting information selection in the defect detection process and improving the accuracy without affecting the detection speed. By adding a small target detection head and replacing the original CIoU loss function with NWD, the detection performance of the improved YOLOv8n defect detection model for small target defects is effectively improved. In the inference stage, the combination of SAHI and the improved YOLOv8n defect detection model can perform sliced inference on the complete photovoltaic module EL image and merge the inference results to generate the complete photovoltaic module EL image, and finally obtain the photovoltaic module defect detection result; realizing the defect detection of high-resolution photovoltaic module EL images and improving the detection accuracy of small target defects.

[0091] In addition to the above embodiments, the present invention also includes other implementation manners. Any technical solutions formed by equivalent transformation or equivalent replacement shall fall within the protection scope of the claims of the present invention.

Claims

1. A method for detecting defects in a solar photovoltaic module, characterized in that: The detection method includes the following steps: Step 1: Collect defect images of solar photovoltaic modules; Step 2: After preprocessing the obtained images, label the defect categories and location information to complete the construction of the solar panel defect dataset; Step 3: Build an improved YOLOv8n defect detection model, including inserting a parameter-free attention module SimAM into the backbone network, a newly added small target detection head, and replacing the original loss function CIoU with the loss function NWD; Step 4: Use the constructed dataset to train and evaluate the performance of the improved YOLOv8n defect detection model; Step 5: For the complete photovoltaic module image, slice-assisted hyper-inference SAHI and the trained improved YOLOv8n defect detection model cooperate to automatically detect defects in the photovoltaic module.

2. The method for detecting defects of a solar photovoltaic module according to claim 1, wherein: The defects of the solar photovoltaic module in Step 1 include black spots, material defects, cracks, and broken grids.

3. A method for detecting defects in a solar photovoltaic module according to claim 1, characterized in that: In Step 2, data augmentation is performed on the obtained images through random flipping, random rotation, and brightness change.

4. A method for detecting defects of a solar photovoltaic module according to claim 1, characterized in that: In Step 2, the defect dataset is divided into a training set, a validation set, and a test set according to a ratio.

5. A method for detecting defects in a solar photovoltaic module according to claim 1, characterized in that: The parameter-free attention module SimAM is inserted into the connection between the sixth-layer C2f module in the backbone network and the corresponding neck network. The parameter-free attention module SimAM finds the importance of each neuron through an energy function; The calculation formula of the minimum energy function is as follows: where t is the target neuron of the input feature of the current channel; is the mean value of all neurons in the channel; is the variance of all neurons in the channel; λ is a weight constant.

6. A method for detecting defects in a solar photovoltaic module according to claim 1, characterized in that: The detection head of the improved YOLOv8n defect detection model includes two parallel branches. Each of the two branches includes two CBS modules, a convolutional layer, and a loss layer connected in sequence; the loss layer of one branch is the regression loss Bboxloss, and the loss layer of the other branch is the classification loss Cls loss.

7. A method for detecting defects of a solar photovoltaic module according to claim 1, characterized in that: The small target detection head includes the sixteenth-layer Upsample module, the seventeenth-layer Concat module, the eighteenth-layer C2f module, the nineteenth-layer CBS module, the twentieth-layer Concat module, and the twenty-first-layer C2f module.

8. A method for detecting defects in a solar photovoltaic module according to claim 1, characterized in that: The loss function NWD models the bounding box B=(c x ,c y ,w,h) as a two-dimensional Gaussian distribution and uses the Wasserstein distance to evaluate the difference between the predicted box and the ground truth box, The bounding box is modeled as a two-dimensional Gaussian distribution, and the probability density function formula is: where x is the coordinate (x, y); μ represents the mean vector of the Gaussian distribution Σ represents the covariance matrix c x and c y respectively represent the abscissa and ordinate of the center of the box; w and h are the length and width of the box respectively; Prediction box B p =(c xp , c yp , w p , h p ) and the ground truth box B g =(c xg , c yg , w g , h g ) The difference between the modeled two-dimensional Gaussian distributions N p and N g is evaluated using the Wasserstein distance. The calculation formula for the Wasserstein distance is: Normalization is used to get rid of the dependence on the overlap degree of the bounding box. The normalization calculation formula is: Furthermore, the calculation formula for the loss function NWD is obtained as: L NWD = 1 - NWD(N p , N g ).

9. A method for detecting defects in a solar photovoltaic module according to claim 4, characterized in that: In Step 4, set the hyperparameters of the training, input the training set and the validation set into the improved YOLOv8n defect detection model for training and use GPU parallel acceleration. During the training process, the weights with the highest detection accuracy will be saved and named best.pt; then, Precision, Recall, and mean average precision mAP are used for performance evaluation to verify the defect detection performance of the improved YOLOv8n defect detection model described in Step 3. The mathematical expressions are as follows: Precision = TP / (TP + FP) × 100% Recall = TP / (TP + FN) × 100% where N is the total number of categories; TP is the number of correctly predicted positive samples; FP is the number of negative samples predicted as positive samples; FN represents the number of positive samples predicted as negative samples.

10. A method for detecting defects in a solar photovoltaic module according to claim 9, characterized in that: The slicing-assisted super inference SAHI divides the complete EL image of the photovoltaic module into multiple sliced images of the same size that completely cover the original image and allow overlap; imports the best.pt weight file into the improved YOLOv8n defect detection model, performs inference on multiple sliced images respectively, and merges the inference results to generate the complete EL image of the photovoltaic module, and finally obtains the photovoltaic module defect detection result.

Citation Information

Cited By

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

    CN121095820A

  • A photovoltaic module identification model training method, an identification method, and related equipment

    CN121095820B