Photovoltaic cell defect detection method

By adding the SPDConv convolution module and introducing the BoTNet attention mechanism to the YOLOv8 model, the problems of low detection accuracy and insufficient generalization ability of small targets in photovoltaic cell defect detection are solved, achieving higher detection accuracy and stronger generalization ability. .

CN119359632APending Publication Date: 2025-01-24QINGHAI UNIV OF SCI & TECH (UNDER PREPARATION)

Patent Information

Application Number
CN202411343068.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

The YOLOv8 model faces the problems of small target detection accuracy and insufficient generalization ability in photovoltaic cell defect detection, especially in resource-constrained environments.

Method used

The SPDConv convolution module is added to the backbone network Backbone of the YOLOv8 model, and the BoTNet attention mechanism is introduced after the SPPF layer to form an improved photovoltaic cell defect detection model.

Benefits of technology

Through data enhancement and improvement model structure, the detection accuracy and generalization capacity of the model can be improved. It can more effectively deal with subtle defects distributed on the surface of solar cells, reduce interference of unrelated background, and significantly improve the detection accuracy of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119359632A_ABST
    Figure CN119359632A_ABST
Patent Text Reader

Abstract

The invention discloses a photovoltaic cell defect detection method, and the method comprises the steps: 1) adding an SPDConv convolution module in a backbone network Backbone of a YOLOv8 model, adding a BoTNet attention mechanism behind an SPPF layer of the backbone network Backbone, and obtaining a photovoltaic cell defect detection and recognition model; 2) training the photovoltaic cell defect detection and identification model by using a photovoltaic cell defect data set; and 3) inputting a photovoltaic cell defect image to be identified into the trained photovoltaic cell defect detection model to obtain a detection result. According to the method, fine defects distributed on the surface of the solar cell can be effectively processed, the receptive field of small target defects is expanded, the problem of key feature information loss is relieved, network attention is focused on the to-be-detected target, interference of irrelevant backgrounds is reduced, the parameter quantity is reduced, and the detection precision of the model is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of deep learning technology and relates to a photovoltaic cell defect detection method, and in particular to a photovoltaic cell defect detection method based on an improved YOLOv8 model. Background Art

[0002] Solar Photovoltaic (PV) power generation is widely used for its advantages of low production cost, no pollution, and renewable energy, which alleviates the energy crisis of human society. PV cells will inevitably produce various types of defects such as scratches, damage, stains, grid breaks, etc. during production, use and maintenance. These defects affect the life and performance of photovoltaic power generation systems. Therefore, defect detection is a key step to ensure the performance and quality of solar cells. In order to ensure the stable operation of photovoltaic power stations, photovoltaic cell defect detection based on deep learning plays an important role.

[0003] Solar cell defect detection methods based on deep learning can generally be divided into two categories: two-stage methods represented by Faster R-CNN, and single-stage methods represented by SSD and YOLO. The two-stage method predicts the defect location and category based on the generated defect candidate area, but the real-time deployment efficiency is relatively low in resource-constrained scenarios. The single-stage method uses the extracted features to directly classify and locate defects, reducing the overall computing requirements, making it easier to deploy in edge devices and embedded systems, and showing better adaptability in resource-constrained environments. The YOLO series of models has superior comprehensive performance in single-stage models, and is particularly suitable for application scenarios that require real-time, high efficiency, and accuracy, making the YOLO series of models a widely used framework in the field of target detection.

[0004] Solar cell defects have linear characteristics and spatial continuity, and the defect areas are unevenly distributed throughout the electroluminescent EL image. This uneven distribution leads to different scales of defect targets, and some defects account for relatively small proportions. The YOLOv8 model still faces challenges in achieving high-precision multi-scale small target detection. Summary of the invention

[0005] In order to solve the above technical problems, the present invention provides a photovoltaic cell defect detection method, the steps of which include:

[0006] (1) Obtain and preprocess the photovoltaic cell defect dataset PVEL-AD to obtain the photovoltaic cell defect dataset, divide it into a training set and a test set in proportion, and perform data enhancement on the training set;

[0007] (2) Improve the YOLOv8 model by adding the (SpacetoDepth) SPDConv convolution module to the backbone network Backbone of the YOLOv8 model and adding the BoTNet attention mechanism after the SPPF layer of the backbone network Backbone to obtain a photovoltaic cell defect detection and recognition model;

[0008] (3) Use the training set to iteratively train the photovoltaic cell defect detection model, verify the model performance through the test set, and obtain the model with the best performance;

[0009] (4) Obtaining a photovoltaic cell defect image to be identified, inputting the photovoltaic cell defect image to be identified into a trained photovoltaic cell defect detection model to obtain a detection result.

[0010] As a further optimization scheme of the photovoltaic cell defect detection algorithm based on the improved YOLOv8 model of the present invention, the photovoltaic defect PVEL-AD image dataset is preprocessed in step (1). The original dataset contains 12 types of photovoltaic cell defects. The dataset categories are unbalanced, and the number of some categories is very small. The present invention removes the four categories of printing_error, corner, fragment, and scratch, and retains the first 8 categories. And it is divided into training set and test set according to the ratio of 8:2.

[0011] The technical solution of the present invention is:

[0012] A photovoltaic cell defect detection method, the steps comprising:

[0013] 1) Adding the SPDConv convolution module to the backbone network Backbone of the YOLOv8 model, and adding the BoTNet attention mechanism after the SPPF layer of the backbone network Backbone to obtain a photovoltaic cell defect detection and recognition model;

[0014] 2) using the photovoltaic cell defect data set to train the photovoltaic cell defect detection and recognition model;

[0015] 3) Inputting the photovoltaic cell defect image to be identified into the trained photovoltaic cell defect detection model to obtain a detection result.

[0016] Furthermore, the method for constructing the photovoltaic cell defect detection and recognition model is:

[0017] 11) Add a SPDConv convolution module before each C2f layer in the backbone network Backbone of the YOLOv8 model; the SPDConv convolution module includes a space-to-depth layer SPDlayer and a non-strided convolution layer, the depth layer SPDlayer is used to downsample the feature map X output by the C2f layer and retain the information on the channel dimension to obtain an intermediate feature map X′, and the non-strided convolution layer is used to filter the intermediate feature map X′ to obtain a final feature map X″;

[0018] 12) Add the BoTNet attention mechanism after the SPPF layer of the backbone network Backbone.

[0019] Furthermore, the intermediate feature map X ′ The channel dimension of the feature map X is four times the channel dimension of the intermediate feature map X. ′ The spatial dimension of is half of the spatial dimension of the feature map X.

[0020] Furthermore, the non-strided convolutional layer convolutions the intermediate feature map X through a convolutional layer with a stride of 1. ′ Filtering is performed to obtain the final feature map X″.

[0021] Furthermore, the photovoltaic cell defect dataset PVEL-AD is obtained and the printing_error, corner, fragment, and scratch images are removed, and then the retained images are divided into a training set and a test set, and the images in the training set are enhanced to obtain the photovoltaic cell defect dataset.

[0022] Furthermore, methods for enhancing the retained images include horizontal flipping, vertical flipping, and random cropping.

[0023] A server, characterized in that it comprises a memory and a processor, wherein the memory stores a computer program, the computer program is configured to be executed by the processor, and the computer program comprises instructions for executing the above method.

[0024] A computer-readable storage medium stores a computer program, wherein the computer program implements the above method when executed by a processor.

[0025] Compared with the prior art, the present invention adopts the above technical solution and has the following technical effects:

[0026] (1) The training set is horizontally flipped, vertically flipped, and randomly cropped for data enhancement, while the test set remains unchanged to achieve data enhancement. The generated photovoltaic cell defect image samples are of high quality and strong diversity, which solves the problem of low detection accuracy caused by small number of training samples and poor quality;

[0027] (2) The YOLOv8 model is improved for photovoltaic cell defect detection, including adding four SPDConv convolutions in Backbone and introducing the BoTNet attention mechanism. The improved YOLOv8 model has strong generalization ability, effectively handles subtle defects distributed on the surface of solar cells, expands the receptive field of small target defects, alleviates the problem of loss of key feature information, focuses the network attention on the target to be detected, reduces the interference of irrelevant background, reduces the number of parameters, and significantly improves the detection accuracy of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 It is a flow chart of the photovoltaic cell defect detection method of the present invention.

[0029] Figure 2 This is the effect diagram after data enhancement of the present invention;

[0030] (a) star_crack class, (b) short_circuit class, (c) crack class, (d) thick_line class, (e) finger class, (f) vertical_dislocation class, (g) black_core class, (h) horizontal_dislocation class.

[0031] Figure 3 This is a diagram of the SPDConv convolution module when scale=2 used in the present invention.

[0032] Figure 4 It is the multi-head self-attention MHSA layer in the BoT block used by the present invention.

[0033] Figure 5 This is a simplified diagram of the network structure of the improved YOLOv8 model of the present invention.

[0034] Figure 6 It is the PR curve obtained by training the photovoltaic cell defect detection and recognition model.

[0035] Figure 7 It is a graph of various indicators obtained by training the photovoltaic cell defect detection and recognition model.

[0036] (a) Precision, (b) Recall, (c) mAP@0.5, (d) mAP@0.5-0.95.

[0037] Figure 8 This is a comparison chart of the test results.

[0038] (a) YOLOv8 model test results, (b) improved YOLOv8 photovoltaic cell defect detection model test results. DETAILED DESCRIPTION

[0039] The following is combined with Figure 5 , the technical solution of the present invention is further described in detail:

[0040] In order to solve the problems of low accuracy and poor small target defect detection in photovoltaic cell defect detection, the present invention proposes a photovoltaic cell defect detection method based on the YOLOv8 model by adding SPDConv convolution and fusion attention mechanism. This method can effectively capture subtle defects on the surface of solar cells, expand the receptive field of small target defects, focus the network attention on the target to be detected, reduce the interference of irrelevant background, and improve the detection accuracy. The present invention provides a photovoltaic cell defect detection method based on an improved YOLOv8 model, such as Figure 1 As shown, this is achieved through the following steps:

[0041] (1) Obtain the photovoltaic cell defect dataset PVEL-AD and perform preprocessing to obtain the photovoltaic cell defect dataset, divide it into a training set and a test set in proportion, and perform data enhancement on the training set: The PVEL-AD dataset is a photovoltaic cell industrial anomaly detection dataset released by Hebei University of Technology and Beijing University of Aeronautics and Astronautics, containing 36,543 near-infrared images with various internal defects and heterogeneous backgrounds, including 1 category of non-abnormal images and abnormal defect images with 12 different categories. Due to the imbalance of the dataset categories and the small number of some categories, the present invention removes the four categories of printing_error, corner, fragment, and scratch, retains the first 8 categories, and divides them into training set and test set in a ratio of 8:2. The training set is enhanced by Flip and Crop datasets, and the test set remains unchanged. After data enhancement, the training set contains 8,724 images and the test set contains 719 images. Figure 2 This is the effect diagram after data enhancement.

[0042] (2) The YOLOv8 model is improved by adding the (Space to Depth) SPDConv convolution module to the backbone network Backbone of the YOLOv8 model and adding the BoTNet attention mechanism after the SPPF layer of the backbone network Backbone to obtain the photovoltaic cell defect detection and recognition model:

[0043] 1) Add four SPDConv convolution modules to the backbone network Backbone of the YOLOv8 model. These four SPDConv convolution modules are added before the four C2f layers in Backbone respectively. The target detection model generally has high detection accuracy when identifying large targets, but the effect drops rapidly when identifying subtle defects on the surface of solar cells. This decline can be attributed to the strided convolution module in the YOLOv8 backbone network. Although this module expands the receptive field and reduces parameter calculation through downsampling, it also leads to the loss of fine-grained information and inefficient feature representation. In comparison, SPDConv does not use strided convolution layers and pooling layers, but uses space-to-depth (SPD) layers and non-strided convolution layers. The SPD layer downsamples the feature map while retaining all information in the channel dimension, effectively reducing information loss. As Figure 3 , the SPDConv module consists of a space-to-depth layer (Space-to-depth layer, SPDlayer) and a non-strided convolution layer (Non-strided convolution layer). After feature extraction, the original input image obtains a feature map X, which is converted into an intermediate feature map X′ by the SPDlayer, and finally filtered by the Non-strided convolution layer to obtain the final feature map X″. Specifically, when scale=2, Figures (b)-(d) show that the SPD layer divides the original feature map (S, S, C) along the x and y directions according to the rules to obtain four sub-feature maps of size (S / 2, S / 2, C) in Figure (c), which is equivalent to a downsampling operation; then the sub-feature maps are spliced ​​along the channel dimension to obtain the intermediate feature map X ′ , at this time X ′ Compared with the original feature map X, the channel dimension becomes 4C and the spatial dimension becomes S / 2, that is, the SPD layer obtains Figures (d)-(e) show the non-strided convolutional layer operation, which is to convert X into ′ Convert to the final feature map Although ordinary convolution with a step size of 2 or 3 can also obtain the transformation from feature map X to X″, this transformation does not generate an intermediate feature map X ′ , which results in the loss of feature information.

[0044] 2) Add the BoTNet attention mechanism after the SPPF layer of the backbone network. The BoTNet attention network only replaces the 3×3 spatial convolution with the multi-head self-attention mechanism MHSA in the last three bottleneck blocks of the ResNet network without making other modifications, which significantly improves the detection accuracy while keeping the number of parameters low. The ResNet bottleneck block with the MHSA layer is called the Bottleneck Transformer (BoT) block, as shown in Figure 4 is the multi-head self-attention MHSA layer in the BoT block, head=4 in the present invention. X and Z i , i = 1, 2, ..., n are the input and output feature spaces of the self-attention layer respectively. The input of the self-attention module is transformed into 5 matrices through linear transformation, which are queries W Q 、Keys W K 、values ​​W V , height R h , Width R w The module output Z i Z is the weighted sum of similarity and value based on query, key, height, width, and formula: i =Softmax(W K ×W Q +W Q ×

[0045] (R h +R w ))W V , where the Softmax function is a normalized exponential function, which is used to present the similarity of query, key, height and width in the form of probability. In order to ensure that the value is non-negative, Softmax converts the similarity value to an exponential function; in order to ensure that the sum of all similarity values ​​is 1, the Softmax output result is the proportion of its index in the total number, and the formula is: The MHSA layer assigns weights to each feature according to feature relevance, focuses the network's attention on the target to be detected, reduces interference from irrelevant backgrounds, improves the model's feature extraction capabilities, and reduces the model's overall parameters. The BoTNet attention mechanism structure used in the present invention is shown below, a BoTNet module with an MHSA layer. It can be seen that the BoTNet attention module simply replaces the 3×3 spatial convolution in the fourth group of residual blocks (i.e., the c5 stage) in the ResNet network with multi-head self-attention MHSA.

[0046]

[0047] (3) Use the training set to iteratively train the photovoltaic cell defect detection model, verify the model performance through the test set, and obtain the model with the best performance;

[0048] The specific method of using the training set to iteratively train the photovoltaic cell defect detection model is as follows:

[0049] 1) Input the training set images into Backbone after adding the SPDConv convolution module and introducing the BoTNet attention mechanism to extract features and convert the input images into multi-level feature maps;

[0050] 2) The obtained feature map is passed to Neck for multi-scale feature fusion and then passed to the Head layer;

[0051] 3) The Head layer predicts the solar cell defect category, center offset, and four bounding box parameters of the photovoltaic cell defect based on each pixel point on each feature map, wherein the parameters include width, height, angle, and confidence;

[0052] 4) Use the non-maximum suppression algorithm to filter out the final detection results based on the confidence level and intersection-over-union ratio, and calculate the loss value between the predicted value and the true value through the loss function, and perform back propagation until the set number of iterations is reached.

[0053] The model has completed training.

[0054] The model hyperparameters are as follows: learning rate = 0.01, input image size = 640 × 640, batch size = 16, Epoch = 300, learning rate momentum = 0.937, optimizer = SGD, and patience = 5000. The experimental environment used: Ubuntu 20.04 operating system, PyTorch 2.0.0, Python 3.8, CUDA 11.8, Intel (R) Xeon (R) Gold 6430 CPU @ 2.10GHz CPU, RTX 4090 (24GB) GPU, 90GB memory.

[0055] like Figure 6 This is the PR curve obtained after model training. From the test results, the photovoltaic cell defect detection and recognition model has achieved good results. The accuracy of all defect types can reach 91.80%, and the corresponding regression rate is also very high, indicating that the photovoltaic cell defect detection model obtained by the training of the present invention has a relatively ideal recall rate, indicating that in actual situations, there are relatively few missed detections. After the defect is detected, the type of defect can be identified relatively accurately and with a relatively high accuracy, which has a relatively ideal effect. Figure 7It is a comparison of training indicators. It can be seen that the photovoltaic panel battery defect detection results of the improved YOLOv8 model in the present invention in the indicators of Precision, Recall, mAP@0.5, and mAP@0.5-0.95 are far better than those of the YOLOv8 model.

[0056] (4) Obtain a photovoltaic cell defect image to be identified, input the photovoltaic cell defect image to be identified into the trained photovoltaic cell defect detection model, and obtain the detection result. Figure 8 As shown in the figure, it can be seen from the test results that the improved YOLOv8 model can detect more battery defects, greatly alleviate the problem of missed detection, and effectively target subtle photovoltaic cell defects. At the same time, for the same photovoltaic cell defect target detection, the improved YOLOv8 model can make full use of the extracted rich features, so that the model can learn more sufficient semantic information and effectively alleviate the problem of false detection. The test results fully illustrate the superiority of the method designed by the present invention, which can perfectly complete the detection and identification of photovoltaic cell defect targets of different sizes, including significant defects and subtle defects, and improve the detection accuracy of the model.

[0057] In summary, the photovoltaic cell defect detection method based on the improved YOLOv8 model provided by the embodiment of the present invention first obtains a photovoltaic cell defect data set, and then adds four SPDConv convolutions in the backbone network Backbone to effectively capture small defects distributed on the surface of the solar cell, expand the receptive field of small target defects, and alleviate the problem of loss of key feature information; further, the BoTNet attention mechanism is introduced, and the residual structure is conducive to improving the feature learning ability of the method, focusing the network attention on the detection target, reducing the number of parameters, and improving the detection accuracy of the model.

[0058] Although the specific embodiments of the present invention are disclosed for the purpose of illustration, the purpose is to help understand the content of the present invention and implement it accordingly, those skilled in the art will understand that various substitutions, changes and modifications are possible without departing from the spirit and scope of the present invention and the appended claims. Therefore, the present invention should not be limited to the content disclosed in the best embodiment, and the scope of the present invention is subject to the scope defined in the claims.

Claims

1. A photovoltaic cell defect detection method, comprising the steps of: 1) Adding the SPDConv convolution module to the backbone network Backbone of the YOLOv8 model, and adding the BoTNet attention mechanism after the SPPF layer of the backbone network Backbone to obtain a photovoltaic cell defect detection and recognition model; 2) using the photovoltaic cell defect data set to train the photovoltaic cell defect detection and recognition model; 3) Inputting the photovoltaic cell defect image to be identified into the trained photovoltaic cell defect detection model to obtain a detection result.

2. The method according to claim 1, characterized in that The method for constructing the photovoltaic cell defect detection and recognition model is: 11) Add a SPDConv convolution module before each C2f layer in the backbone network Backbone of the YOLOv8 model; the SPDConv convolution module includes a space-to-depth layer SPDlayer and a non-strided convolution layer, the depth layer SPDlayer is used to downsample the feature map X output by the C2f layer and retain the information on the channel dimension to obtain an intermediate feature map X′, and the non-strided convolution layer is used to filter the intermediate feature map X′ to obtain a final feature map X″; 12) Add the BoTNet attention mechanism after the SPPF layer of the backbone network Backbone.

3. The method according to claim 2, characterized in that The intermediate feature map X ′ The channel dimension of the feature map X is four times the channel dimension of the intermediate feature map X. ′ The spatial dimension of is half of the spatial dimension of the feature map X.

4. The method according to claim 2, characterized in that: The non-strided convolution layer passes through a convolution layer with a stride of 1 to the intermediate feature map X ′ Filtering is performed to obtain the final feature map X″.

5. The method according to claim 1, characterized in that The photovoltaic cell defect dataset PVEL-AD is obtained and the printing_error, corner, fragment, and scratch images are removed. Then, the retained images are divided into a training set and a test set, and the images in the training set are enhanced to obtain the photovoltaic cell defect dataset.

6. The method according to claim 5, characterized in that The methods used to augment the retained images include horizontal flipping, vertical flipping, and random cropping.

7. A server, characterized in that: The invention comprises a memory and a processor, wherein the memory stores a computer program, the computer program is configured to be executed by the processor, and the computer program comprises instructions for executing the method according to any one of claims 1 to 6.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Improved defect PCB detection method based on YOLOv8

    CN117422970A

  • Photovoltaic cell module defect detection method and system

    CN117764959A

  • Solar cell panel defect detection method and device based on improved YOLOv5

    CN118196045A

Cited By

  • Rapid detection method for multi-scale tiny defects, computer equipment and storage medium

    CN119810430A

  • Method for rapid detection of multi-scale micro-defects, computer device and storage medium

    CN119810430B

  • Method for detecting maturity of greenhouse tomatoes based on improved YOLOv8n

    CN120047938A

  • Photovoltaic cell panel defect detection method based on improved YOLOv8s model

    CN120235818A

  • Improved YOLOv8-based insulator defect detection method in severe weather

    CN120747630A