# Yolo Based Defects Detection Algorithm for EL in PV Modules with Focal and Efficient IoU Loss
## 2 Materials and Methods
### EL Images  
The image data pertaining to PV modules examined in this study are sourced from Jiangsu Rituo Photovoltaic Company. The PV module products manufactured by the company are constructed by organizing PV cells in a 6-row by 21-column cell matrix configuration. Subsequently, these modules are subjected to EL detection for image capturing. Consequently, each EL image of a PV module comprises 126 cells, with each image size measuring 5328 \(\times\) 3134 pixels. The dataset encompasses 12 prevalent types of PV module EL defects. These defects are categorized into two main groups based on their size. The first category comprises large-sized defects (L-type), where the PV module serves as the backdrop, and the PV cells are identified as the targets. This group includes instances of current non-uniformity and dark areas. The second category encompasses small-sized defects (S-type), where the PV cells act as the background and specific regions within the cells are marked as the targets. This group includes various anomalies such as dark spots, black spots, broken grids, SE offset, false marks, branch occlusions, linear occlusions, fragments, flurry filaments, and cleaning traces. The characteristics and classifications of the complete set of 12 defects are visually depicted in Figure 5 and detailed in Table 3.  
The utilization of deep learning algorithms for extracting defect features from PV module EL images presents notable challenges. Primarily, these images encompass a vast area and include substantial redundant information, rendering the detection of small-sized targets like dark spots and broken grids arduous using deep learning techniques. Moreover, there exists a substantial disparity in size among various defect types. For instance, the area contrast between broken grids and black cells exceeds a hundredfold. Furthermore, the distribution of samples across each defect class is uneven. To standardize the input for processing, images are typically rescaled and resiz  
Figure 4: Structure of CSP2_X. Figure 3: Structure of CSP1_X. Figure 2: Structure of Focus. often 640 \(\times\) 640 pixels. However, in practical scenarios, the dimensions of PV module EL images (5325 \(\times\) 3134 pixels) are considerably large, and this rescaling procedure can result in a notable loss of features, particularly for defects like dark spots and broken grids. This loss of detail can impede the accurate identification and characterization of such defects using deep learning methodologies. Hence, a novel image segmentation strategy is introduced, employing a sliding window technique to accomplish the region segmentation of PV module EL images. This approach enables the extraction and learning of small-sized defect features from the segmented samples. By segmenting the images into smaller, more manageable sections, the system can focus on analyzing and understanding the intricate details of defects like dark spots and broken grids, enhancing the overall accuracy and effectiveness of the defect detection process. The minimum input size of the models is 640 \(\times\) 640 pixels. In order not to lose information during image preprocessing, we want the sample size to be smaller than the input size of the model. Therefore, samples with the size of 248 \(\times\) 504 pixels (single cell) were used to allow the model to learn the details of the defects. In order to learn the background features, we also take six adjacent cells as a sample, which contains the edge features of the battery; therefore, the model will not misjudge the edge of the battery as a defect. The segmentation process involves utilizing two different sizes of sliding windows: 248 \(\times\) 504 pixels and 756 \(\times\) 1010 pixels, as illustrated in Figure 6, to partition the images into segments. Following this segmentation, image segments devoid of defects are discarded, resulting in augmented image samples.