Method for minor defect detection in electroluminescent solar cells based on CSR-YOLOv5s

The increasing production of solar cells, resulting from the rapid development of new energy sources, necessitates their inspection during both solar cell production and photovoltaic power plant inspection. Target detection algorithms are widely utilized for defect detection in solar cells. To achieve more accurate detection of minor defects in electroluminescent solar cells, an improved algorithm called CSR-YOLOv5s is proposed in this paper. The CSR-YOLOv5s combines Decoupled Head and CSRBlock with the YOLOv5s baseline model. The CSR-Y OLOv5s demonstrates a 1.1% increase in accuracy and a 2.1% increase in F1-score compared to the YOLOv5s baseline model, resulting in improved accuracy and recall. The algorithm effectively identifies minor defects in electroluminescent solar cells.


Introduction
With the development of artificial intelligence, image technology has been widely used [1]- [3].Image recognition algorithms are widely used in the defect detection task of photovoltaic panels.Image recog nition algorithms have been classified into four categories: image classification, target detection and lo calization, semantic segmentation, and instance segmentation.It is proposed by Dao-Ri Wang et al. [4] to incorporate a SpotFPN multi-scale feature learning module into the backbone of ResNet in Faster R -CNN for the detection and recognition of hot spots on photovoltaic panels, achieving good results.In image classification, a convolutional neural network-based approach for automatic identification of ph ysical faults in solar power systems, achieving semantic segmentation and classification of RGB imag es, is proposed by Alejandro Rico Espinosa et al. [5].An image processing method consisting of imag e correction, second-order nonlinear interpolation, and an updated center-of-mass region clustering me thod was used by Siyuan Fan et al. [6] to obtain desirable segmentation results.Additionally, a free ide ntity mapping network structure connected by jump was proposed.This method demonstrates good pe rformance in detecting the dust concentration of PV panels.A semantic segmentation model based on t he u-net architecture was used by Lawrence Pratt et al. [7] for EL image analysis of PV modules made from solar cells.A hybrid feature-based support vector machine (SVM) model was proposed by Muha mmad Umair Ali et al. [8] for hotspot detection and classification of photovoltaic (PV) panels using in frared thermography.In the dataset of this study, when compared with other machine learning algorith ms, the SVM hybrid features achieved a training accuracy of 96.8% and a testing accuracy of 92%, wit h reduced computational complexity and storage space requirements.Deep learning methods use deep models and perform better on complex tasks than traditional machine learning methods.
Minor defects in electroluminescent solar cells are not easily recognized by the human eye.In addition, each person's visual inspection has variability, so the inspection results are not objective, and prolonge d eye fatigue can lead to incorrect inspection.The deep learning target detection algorithm can realize the automation of solar cell defect detection, and the effect of replacing human eye detection can be re alized by improving the detection accuracy.In the field of deep learning target detection, several classi cal models have emerged, including R-CNN [9], Fast R-CNN [10], and Faster R-CNN [11].These mo dels have revolutionized target detection by employing candidate region generation, feature extraction, and the integration of region suggestion networks (RPNs) and region classification networks.Further more, SSD [12] have achieved remarkable advancements in target detection.These models enable real -time target detection and localization by simultaneously conducting target classification and bounding box regression within a single network.In the COCO dataset used by YOLOv5s, objects with sizes s maller than 32×32 pixels are considered as minor targets, objects with sizes ranging from 32×32 to 9 6×96 pixels are considered as medium targets, and objects larger than 96×96 pixels are considered a s large targets [13].This paper proposes an improved YOLOv5s electroluminescent solar panel minor defect recognition a lgorithm.In conclusion, our contributions are as follows: 1. CSR-YOLOv5s demonstrates the ability to identify defects in solar cells and automatically detect de fects that are difficult to distinguish by human eyes during the inspection and production process of sol ar panel manufacturing factories.This is of significant importance for ensuring the quality of solar pan els produced by factories.2. CSR-YOLOv5s introduces a novel approach to solar cell inspection, improving performance and re ducing the number of missed detections compared to the baseline model.This offers a new perspective and enhances the effectiveness of the inspection process.

Evaluation indicators
The evaluation methods usually used for target detection and recognition algorithm models are Precisi on, Recall, and mAP@0.5 (mean Average Precision), which are denoted by P, R, and mAP, respective ly.However, it is difficult to evaluate the performance of the model by looking at P and R. Therefore, in this paper, F1-score with mAP is introduced as the evaluation index of the model.Where TP denote s the samples correctly detected by the detector, FP denotes the actual negative samples but detected a s positive samples (false positive cases), and FN denotes the actual positive samples but detected as ne gative samples by the detector (false negative cases).The evaluation equations for the main evaluation indicators are shown below:

Improving YOLOv5s model
YOLOv5s is a type of object detection model.It was developed by Alexey Bochkovskiy and others, b uilding upon the improvements and optimizations made in YOLOv4 [14].YOLOv5s employs a single -stage object detection approach, dividing the image into non-overlapping grids and predicting multipl e bounding boxes and corresponding class probabilities within each grid.The backbone network of Y OLOv5s utilizes CSPDarknet53.The detection head of YOLOv5s consists of a series of convolutional and fully connected layers, responsible for generating position and class probability predictions for ea ch bounding box.The model also employs a loss function called Focal Loss to address class imbalance issues and improve the detection performance for small objects.The model replaces the part the Head of YOLOv5s with Decoupled Head.The Head module of YO LOv5s uses a multi-level feature fusion approach, where the feature maps output from the backbone n etwork are dimensionally reduced and scaled by a Conv module, and finally, the feature maps at each l evel are fused.Decoupled Head [15] is a technique that separates the classification and regression branches into two s eparate parallel sub-networks.The classification sub-network is used to predict the category markers o f the objects and the regression sub-network is used to predict the edge box coordinates of the objects as well as the object attribute scores.So a better trade off between model efficiency and inference accu racy can be achieved by adding Decoupled Head, which makes the model faster and more accurate.De coupled Head uses one 1x1 convolutional layer to reduce the number of channels to 256, followed by t wo parallel branches (each branch contains two 3x3 convolutional layers) to perform compression and classification, and an IoU is added to the compression.The outputs of the 3 branches (Cls, Reg, IoU) a re [H, W, C], [H, W, 4], [H, W, 1], respectively.The improved CSRBlock module replaces the C3 module.This module adjusts on the channels by usi ng 1x1 convolutional layers on the channels.The design ensures that the input feature maps can be equ ally partitioned into Group1 and Group2.This approach helps to increase the flexibility of the network to adapt to different numbers of input channels.The Group1 feature map retains the original informati on, while the Group2 feature map goes through the RepBlock module [16] for feature extraction and tr ansformation.This strategy helps to capture the multi-scale information in the input feature maps, thus improving the performance of the network.In the final stage of the network, the Group1 and Group2 f eature maps are fused through the Concat layer.This approach helps to integrate the original informati on and the high-level features processed by the RepBlock module, thus improving the expressiveness and generalization performance of the network.The CSRBlock module is shown in Figure 3.In the improved algorithm based on YOLOv5s, the algorithm combining Decoupled Head and CSRBl ock is named CSR-YOLOv5s.The overall structure of the algorithm of CSR-YOLOv5s is shown in Fi gure 4.

Datasets and experimental platforms
The experiments were conducted on a Windows 10 operating system, using an Intel(R) Core(TM) i7-1 1800H CPU running at 2.30GHz, with 16GB of RAM.The GPU used was an NVIDIA GeForce RTX 3070 Laptop with 8GB of video memory.The experiments were implemented in Python 3.9, using the PyTorch 1.9 deep learning framework.The experimental dataset [17] was obtained from the filtered e lectroluminescent (EL) images of the PVEL-AD-2021 dataset.The dataset consists of a total of 4500 i mages.The dataset is randomly partitioned into an 8:2 ratio using the method of random splitting.The dataset was filtered to include only four main defect types related to solar cells, as shown in Figure 5.The resolution of the images in this dataset is 1024×1024.These defect types include linear crack, thic k line, finger, and star crack.The distribution of labels in the dataset is as follows: there are 123 instan ces labeled as "star crack," 931 instances labeled as "crack," 775 instances labeled as "thick line," and 1507 instances labeled as "finger."This information provides a quantitative representation of the numb er of occurrences for each label category in the dataset.

Analysis of results
To verify the effectiveness of the algorithm, the data set was trained for 200 rounds using YOLOv5s a s the baseline model and compared with YOLOv5s in the improved Decouple Head and CSRBlock.T he results of the ablation experiments are shown in In the electroluminescent photovoltaic panel data set, because the detection target is small and categor y, more prone to errors, compare the detection effect of CSR-YOLOv5s and YOLOv5s model, as sho wn in Figure 6, CSR-YOLOv5s detected YOLOv5s cannot detect defects, and CSR-YOLOv5s detecti on category more comprehensive, accuracy is higher.

Conclusion
To address the challenge of identifying minor defects in electroluminescent solar cells, an algorithm n amed CSR-YOLOv5s is proposed in this paper.The CSR-YOLOv5s algorithm combines Decoupled Head and CSRBlock with the YOLOv5s baseline model.This model effectively detects four types of d efects in solar cells, namely thick lines, fingers, linear cracks, and star cracks.
1) The introduction of CSRBlock involves using a 1x1 convolution to adjust the channel, ensuring equ al division into Group1 and Group2.The features of Group1 are directly outputted to the Concat layer, while Group2 undergoes a RepBlock module.The calculation results of Group2 are outputted to the C oncat layer and serve as input for the subsequent RepBlock.This logic is repeated twice with two Rep Block modules, and a 1x1 convolution layer is used to maintain consistent output and input dimension s.This design enhances network flexibility and facilitates the capture of multiscale information in the i nput feature graph, thereby improving network performance.
2) By combining Decoupled Head and CSRBlock, CSR-YOLOv5s demonstrates improved ability to d etect photovoltaic panel defects, with an increase of 1.1% in mAP compared to the baseline model YO LOv5s, and increased accuracy and recall rates.
Overall, the proposed CSR-YOLOv5s algorithm is effective in identifying minor defects in electrolum inescent photovoltaic panels, and it has the potential to contribute to the energy industry.

Figure 1 .
Figure 1.Structure of the head section of YOLOv5s

Figure 2 .
Figure 2. Structure of the Decoupled headThe improved CSRBlock module replaces the C3 module.This module adjusts on the channels by usi ng 1x1 convolutional layers on the channels.The design ensures that the input feature maps can be equ ally partitioned into Group1 and Group2.This approach helps to increase the flexibility of the network to adapt to different numbers of input channels.The Group1 feature map retains the original informati on, while the Group2 feature map goes through the RepBlock module[16] for feature extraction and tr ansformation.This strategy helps to capture the multi-scale information in the input feature maps, thus improving the performance of the network.In the final stage of the network, the Group1 and Group2 f eature maps are fused through the Concat layer.This approach helps to integrate the original informati

Figure 6 .
Figure 6.Schematic of partial defect identification of CSR-YOLOv5s and YOLOv5s on the validation set Table 1below.The value of F1-score when replaci ng the C3 module with CSRBlock on top of the YOLOv5s baseline model rose by 1.1% over the YOL Ov5s baseline model.The value of mAP for CSR-YOLOv5s rose by 1.1% over the original YOLOv5s baseline model, and both accuracy and recall rose.The value of mAP for CSR-YOLOv5s The mAP o f YOLOv5s reached 84.6%.