In this thesis, I present my research on a convolutional neural network (CNN)-based approach for defect recognition of solar panels. The rapid expansion of photovoltaic power generation has made the reliable and efficient inspection of solar panels a critical task, since even minor defects can significantly reduce energy yield and lead to system failures. Traditional manual inspection methods are slow, subjective, and economically impractical for large-scale solar farms. Therefore, I focus on developing an automated deep learning framework that can accurately detect and localize various defects in electroluminescence (EL) images of solar panels. My work addresses three major challenges: the limited generalization of standard YOLOv8 models, the inefficient use of computational resources, and the high cost of manually annotating large datasets. To overcome these issues, I propose a modified YOLOv8 architecture named YOLOv8-BiFSE, which integrates a BiFormer dual-level attention mechanism and a squeeze-and-excitation (SE) channel attention module. Additionally, I introduce a novel semi-supervised training strategy called BSLM (Better Student Learning Method) that leverages both labeled and unlabeled data, significantly improving recognition accuracy while reducing annotation efforts.
1. Introduction and Background
Solar photovoltaic (PV) systems are among the most promising renewable energy technologies for reducing carbon emissions. The performance of a PV plant heavily depends on the health of its solar panels. Cracks, finger interruptions, black cores, misalignments, and other defects can appear during manufacturing or operation, leading to hot spots and accelerated degradation. Regular inspection of solar panels is thus indispensable. Electroluminescence imaging is a widely used technique for detecting internal defects because it reveals the radiative recombination of charge carriers, showing dark patterns where defects occur. However, the interpretation of EL images is challenging due to low contrast, high noise, and the tiny size of many defects.
Recent advances in convolutional neural networks have enabled automated defect detection with high accuracy. Among various detectors, the YOLO family offers a good trade-off between speed and precision. In my preliminary experiments, I compared YOLOv3, YOLOv5, YOLOv6, YOLOv7, and YOLOv8 on a benchmark dataset of EL images from solar panels. The results showed that YOLOv8n achieved the highest mAP while maintaining real-time performance. Nevertheless, YOLOv8 still has several limitations. The C2f module, though efficient, employs fully connected layers that may cause overfitting when the training set is small. Moreover, fixed convolutional kernels struggle to capture features with extreme aspect ratios, such as linear cracks, and are not sufficiently adaptive to variations in object shape and scale. Additionally, the network often disperses its attention over irrelevant background regions, wasting computational resources and lowering inference efficiency.
To overcome these drawbacks, I introduce two attention mechanisms. The first is the BiFormer attention mechanism, which uses bi-level routing to dynamically focus on the most relevant tokens. This design reduces the number of fully connected operations, mitigates overfitting, and allows the model to adapt to objects of different shapes and sizes. The second is the SE channel attention mechanism, which recalibrates channel-wise features by emphasizing important channels and suppressing redundant ones. This helps the model concentrate on critical information, reduce computational cost, and improve processing speed. By embedding these mechanisms into YOLOv8n, I construct a new network called YOLOv8n-BiFSE.
Aside from architectural improvements, the training of a defect detector normally requires a large amount of labeled data. Acquiring precise bounding-box annotations for solar panels is expensive and error-prone. To mitigate this, I propose a semi-supervised learning framework named BSLM. It follows a self-training paradigm with a teacher-student mutual learning strategy. The teacher model generates pseudo-labels for unlabeled images, which are then combined with the original labeled set to train a student model. This iterative process progressively enlarges the effective training data and substantially improves the model’s generalization capability. My experiments demonstrate that BSLM boosts the mAP from 83.9% to 90.7% without any additional manual annotation.
2. Convolutional Neural Network Fundamentals
Convolutional neural networks have become the cornerstone of modern image analysis. A typical CNN consists of input layers, convolutional layers, pooling layers, and fully connected layers. The convolution operation is defined as:
$$C(x,y) = \sum_{i=0}^{m-1}\sum_{j=0}^{n-1} I(x+i, y+j) \cdot K(i,j)$$
where \(I\) is the input image matrix, \(K\) is the convolution kernel of size \(m \times n\), and \(C(x,y)\) denotes the output feature value at position \((x,y)\). The kernel slides across the image with a specified stride, producing activation maps that highlight local patterns. Pooling layers downsample the feature maps to reduce dimensionality and control overfitting. Common pooling operations include max pooling and average pooling. Fully connected layers then combine the extracted features to produce the final classification or regression output.
In the context of solar panel defect recognition, the input images are EL photographs of photovoltaic cells. These images often contain complex backgrounds and tiny cracks that are only a few pixels wide. Therefore, a robust feature extractor is essential. The YOLO family employs a deep backbone called DarkNet or CSPDarkNet to capture hierarchical features. The multi-scale feature fusion network (Neck) and detection head (Head) then predict bounding boxes and class probabilities. The architecture of YOLOv8 is illustrated in my conceptual model, where the backbone extracts features at three scales, the neck fuses them, and the head produces the final detections.
3. Analysis of YOLO Variants for Solar Panels
Before designing my improved architecture, I performed a systematic comparison of YOLO versions from YOLOv3 to YOLOv8, using the same dataset and hyperparameters. The dataset contains 6,218 EL images of solar panels, of which 1,033 have manual annotations. I split the labeled images into training (723), validation (206), and test (104) sets. All models were trained for 300 epochs with an input size of 640×640 pixels. The results are summarized in the table below.
| Network | mAP@0.5 | mAP@0.5:0.95 | FPS | Params (M) | FLOPs (G) |
|---|---|---|---|---|---|
| YOLOv3-tiny | 0.806 | 0.442 | 256.41 | 8.7 | 13.0 |
| YOLOv3 | 0.818 | 0.486 | 104.17 | 61.5 | 155.3 |
| YOLOv3-spp | 0.817 | 0.492 | 102.04 | 62.6 | 156.1 |
| YOLOv5n | 0.797 | 0.464 | 163.93 | 1.8 | 4.2 |
| YOLOv5s | 0.792 | 0.474 | 175.44 | 7.0 | 15.9 |
| YOLOv5m | 0.756 | 0.434 | 140.85 | 20.9 | 48.2 |
| YOLOv5l | 0.777 | 0.467 | 116.28 | 46.1 | 108.2 |
| YOLOv5x | 0.782 | 0.471 | 82.64 | 86.2 | 204.6 |
| YOLOv6n | 0.586 | 0.295 | 35.36 | 11.4 | 4.7 |
| YOLOv6s | 0.670 | 0.353 | 34.93 | 18.5 | 45.3 |
| YOLOv6m | 0.613 | 0.352 | 32.66 | 34.9 | 85.8 |
| YOLOv6l | 0.767 | 0.456 | 29.28 | 59.6 | 150.7 |
| YOLOv7 | 0.795 | 0.482 | 36.29 | 37.2 | 105.1 |
| YOLOv7d | 0.713 | 0.415 | 30.33 | 152.9 | 198.3 |
| YOLOv7e | 0.712 | 0.434 | 30.72 | 110.4 | 144.3 |
| YOLOv8n | 0.808 | 0.490 | 128.21 | 3.2 | 8.9 |
| YOLOv8s | 0.787 | 0.468 | 123.46 | 11.1 | 28.6 |
| YOLOv8m | 0.765 | 0.467 | 104.17 | 25.9 | 79.1 |
| YOLOv8l | 0.806 | 0.514 | 80.65 | 43.6 | 165.7 |
| YOLOv8x | 0.803 | 0.508 | 65.79 | 68.2 | 258.1 |
From this table, I observed that YOLOv8n achieves a high mAP@0.5 of 0.808 with only 3.2 million parameters and 8.9 GFLOPs. Although its FPS is lower than YOLOv3-tiny, it still meets real-time requirements. Therefore, I selected YOLOv8n as the baseline for further improvements.
4. Proposed YOLOv8-BiFSE Architecture
4.1 BiFormer Attention Mechanism
To mitigate the overfitting problem caused by fully connected layers in the C2f modules and to improve the model’s adaptability to diverse input shapes, I replace the first two C2f modules in the YOLOv8n backbone with BiFormer blocks. The BiFormer mechanism uses a bi-level routing attention that dynamically selects a small subset of key tokens. The input feature map is reshaped into a sequence of regions:
$$X_r \in \mathbb{R}^{\frac{HW}{S^2} \times C \times S^2}$$
where \(S^2\) is the region area and \(HW/S^2\) is the number of regions. The query, key, and value matrices are computed via linear projections:
$$Q = X_r W_q, \quad K = X_r W_k, \quad V = X_r W_v$$
BiFormer then constructs a region adjacency graph and performs attention only on the most relevant regions. This sparsity reduces computational cost and avoids overfitting by eliminating the need for dense global connections. Moreover, the attention range adapts to the content, enabling the model to handle thin cracks and objects of varied sizes.
4.2 SE Channel Attention Module
Although BiFormer improves sparsity and adaptability, it still lacks a channel-wise focus mechanism. The SE block addresses this by explicitly modeling channel dependencies. For an input feature map \(U \in \mathbb{R}^{C \times H \times W}\), the squeeze operation applies global average pooling to produce a channel descriptor \(z\):
$$z_c = \frac{1}{H \times W}\sum_{i=1}^{H}\sum_{j=1}^{W} U_c(i,j)$$
The excitation operation uses two fully connected layers to generate a weight vector \(s\):
$$s = \sigma(W_2 \cdot \delta(W_1 z))$$
where \(\delta\) is the ReLU function, \(\sigma\) is the sigmoid function, and \(W_1\), \(W_2\) are learnable weights. The final output is obtained by rescaling the original feature map:
$$\tilde{U}_c = s_c \cdot U_c$$
I place the SE module after the last layer of the multi-scale feature fusion network (Neck). This location is optimal because the feature maps at the deepest level already contain rich semantic information, and SE can emphasize the important channels before the detection head. In my ablation study, adding SE at layer 23 produced the highest mAP@0.5 of 0.839.
4.3 Complete Network Structure
The complete YOLOv8n-BiFSE network consists of a backbone with two BiFormer blocks, the original C2f modules, an SPPF module, a Neck with a final SE block, and a decoupled detection head. The input image is resized to 640×640 pixels, and the network outputs bounding boxes and class probabilities for each defect. A visual representation of the whole framework is shown below, which also illustrates the role of each component in the detection pipeline.

My architecture is named YOLOv8n-BiFSE, where “Bi” stands for BiFormer and “FSE” stands for fusion of SE attention. The detailed ablation experiments in the following section validate the contribution of each module.
5. Experimental Setup and Ablation Studies
All experiments were conducted on an NVIDIA A30 GPU with 24 GB memory, using Python 3.10, PyTorch 1.13.1, and CUDA 11.4. The training configuration included 300 epochs, a batch size of 32 (reduced for larger models), and the AdamW optimizer with a cosine learning rate schedule. Data augmentation followed the standard YOLOv8 pipeline, including mosaic, random affine, and color space shifts.
The dataset consists of EL images from the PVEL-AD benchmark. I selected 6,218 images that contain at least one defect. Among them, 1,033 images have manual annotations (bounding boxes). These labeled images are split into training (723), validation (206), and test (104) sets. The remaining 5,185 unlabeled images are used in the semi-supervised experiments.
I first performed a positional ablation for the BiFormer module. The results are shown in the table below.
| Network Structure | mAP@0.5 | mAP@0.5:0.95 | Precision | Recall |
|---|---|---|---|---|
| YOLOv8n | 0.806 | 0.509 | 0.777 | 0.759 |
| + BiFormer at layer 3 | 0.803 | 0.510 | 0.792 | 0.731 |
| + BiFormer at layer 5 | 0.805 | 0.508 | 0.781 | 0.745 |
| + BiFormer at layers 3 and 5 | 0.815 | 0.506 | 0.752 | 0.759 |
The optimal configuration is to replace the first two C2f modules with BiFormer blocks. This improves mAP@0.5 from 0.806 to 0.815, confirming that the dynamic attention mechanism enhances the extraction of fine-grained features.
Next, I performed a positional ablation for the SE module on top of YOLOv8n-BiFormer. The results are presented below.
| Network Structure | mAP@0.5 | mAP@0.5:0.95 | Precision | Recall |
|---|---|---|---|---|
| YOLOv8n-BiFormer | 0.815 | 0.506 | 0.752 | 0.759 |
| + SE at layer 1 | 0.813 | 0.507 | 0.735 | 0.767 |
| + SE at layer 4 | 0.808 | 0.507 | 0.817 | 0.698 |
| + SE at layer 6 | 0.814 | 0.492 | 0.778 | 0.775 |
| + SE at layer 10 | 0.824 | 0.505 | 0.765 | 0.780 |
| + SE at layer 17 | 0.508 | 0.513 | 0.784 | 0.748 |
| + SE at layer 20 | 0.813 | 0.491 | 0.727 | 0.773 |
| + SE at layer 23 | 0.839 | 0.531 | 0.755 | 0.798 |
Layer 23 corresponds to the last layer of the Neck. Adding SE at this layer increases mAP@0.5 by 2.4 percentage points over the BiFormer-only model, demonstrating the effectiveness of channel recalibration for multi-scale feature fusion.
I also compared the SE module with other popular attention mechanisms, including CA, SA, CoTA, and CBAM, under the same placement (layer 23). The comparison results are listed below.
| Attention Mechanism | mAP@0.5 | mAP@0.5:0.95 | Precision | Recall |
|---|---|---|---|---|
| None (BiFormer only) | 0.815 | 0.506 | 0.752 | 0.759 |
| CA | 0.820 | 0.503 | 0.750 | 0.791 |
| SA | 0.825 | 0.533 | 0.788 | 0.738 |
| CoTA | 0.818 | 0.508 | 0.794 | 0.777 |
| CBAM | 0.824 | 0.519 | 0.778 | 0.777 |
| SE (proposed) | 0.839 | 0.531 | 0.755 | 0.798 |
The SE module achieves the highest mAP and recall, confirming its superiority for dense small-object detection on solar panels.
6. Visualization and Comparison
To better understand how the attention modules affect the model, I generated class activation maps (CAM) for several layers. Comparing the heatmaps of YOLOv8n, YOLOv8n-BiFormer, and YOLOv8n-BiFSE, I found that the proposed model consistently focuses on the crack regions, while the baseline occasionally attends to irrelevant background. The BiFormer component strengthens attention in early layers, and the SE module further stabilizes and concentrates the attention in the later layers. Ultimately, the heatmap at layer 11 of YOLOv8n-BiFSE precisely covers the crack area, including its endpoints, which is crucial for detecting long and thin defects.
I also plotted the mean average precision (mAP) curves during training. During the first 70 epochs, the attention-based model slightly underperformed because the attention weights are being learned. After epoch 70, YOLOv8n-BiFSE overtook the baseline and remained superior until the end. The precision-recall (PR) curve of the proposed model encloses a significantly larger area than that of YOLOv8n, further confirming its advantage.
A qualitative comparison on representative EL images shows that YOLOv8n-BiFSE correctly identifies cracks that the baseline misses, and it provides more complete bounding boxes for partially visible defects. This improvement is particularly noticeable for tiny cracks and defects with low contrast.
7. Multi-Model Comparative Study
To validate the overall performance of my YOLOv8n-BiFSE, I compared it with a wide range of YOLO detectors using the same training and evaluation protocol. The detailed results are shown in the following table.
| Network | mAP@0.5 | mAP@0.5:0.95 | FPS | Params (M) | FLOPs (G) |
|---|---|---|---|---|---|
| YOLOv3-tiny | 0.806 | 0.442 | 256.41 | 8.7 | 13.0 |
| YOLOv3 | 0.818 | 0.486 | 104.17 | 61.5 | 155.3 |
| YOLOv5n | 0.797 | 0.464 | 163.93 | 1.8 | 4.2 |
| YOLOv5s | 0.792 | 0.474 | 175.44 | 7.0 | 15.9 |
| YOLOv6n | 0.586 | 0.295 | 35.36 | 11.4 | 4.7 |
| YOLOv7 | 0.795 | 0.482 | 36.29 | 37.2 | 105.1 |
| YOLOv8n | 0.808 | 0.490 | 128.21 | 3.2 | 8.9 |
| YOLOv8s | 0.787 | 0.468 | 123.46 | 11.1 | 28.6 |
| YOLOv8m | 0.765 | 0.467 | 104.17 | 25.9 | 79.1 |
| YOLOv8l | 0.806 | 0.514 | 80.65 | 43.6 | 165.7 |
| YOLOv8x | 0.803 | 0.508 | 65.79 | 68.2 | 258.1 |
| Faster-RCNN | 0.596 | 0.317 | 105.38 | 3.3 | 1.1 |
| YOLOv8n-BiFSE (ours) | 0.839 | 0.531 | 101.01 | 3.1 | 10.3 |
My proposed model achieves the highest mAP@0.5 (0.839) and mAP@0.5:0.95 (0.531) among all compared methods, while maintaining a competitive inference speed of 101 FPS. The parameter count is slightly lower than that of YOLOv8n because BiFormer introduces fewer redundant connections. Although the FLOPs increase from 8.9 to 10.3 G, the improvement in accuracy justifies the extra computation.
8. BSLM: A Semi-Supervised Training Method
8.1 Motivation
Manual annotation of defect bounding boxes in EL images of solar panels is time-consuming and highly subjective. The limited number of labeled samples (1,033) restricts the performance of the supervised model. However, more than five thousand unlabeled images are readily available. I aim to exploit these unlabeled data through a self-training paradigm. My proposed method, BSLM, iteratively generates pseudo-labels from a teacher model and uses them to train a student model, thereby enlarging the effective training distribution.
8.2 Method Description
The BSLM pipeline consists of two phases. In the first phase, a pre-trained teacher model is obtained by training YOLOv8n-BiFSE on the labeled dataset A. In the second phase, the teacher model generates pseudo-labels for an unlabeled set B. Only predictions with confidence above a threshold are retained. The filtered pseudo-labeled images are then merged with the original labeled set to train a student model. This student model replaces the teacher for the next round. The process repeats for a fixed number of iterations.
The overall flow is depicted in the figure. Let \(A\) denote the manually labeled dataset, and \(B\), \(C\), \(D\) denote three equal partitions of the unlabeled dataset. After the first round, the student model is trained on \(A \cup \tilde{B}\), where \(\tilde{B}\) is the pseudo-labeled version of B. In the second round, a new student is trained on \(A \cup \tilde{B} \cup \tilde{C}\), and finally on \(A \cup \tilde{B} \cup \tilde{C} \cup \tilde{D}\). The total number of training images increases from 1,033 to 5,218 after three rounds.
8.3 Pseudo-Label Threshold and Robustness
To ensure the quality of pseudo-labels, I used a confidence threshold of 0.7. Additionally, I applied non-maximum suppression (NMS) with an IoU threshold of 0.5 to remove duplicate boxes. To further enhance robustness, the teacher and student models are trained with different data augmentations, preventing the two models from converging to identical weights. This mutual-learning strategy, similar to co-training, reduces the risk of error accumulation.
9. Experimental Results of BSLM
9.1 Ablation Study on Training Rounds
I evaluated the effect of each round of BSLM training. The results are summarized in the following table.
| Learning Round | mAP@0.5 | FPS |
|---|---|---|
| Pre-training only (supervised) | 0.839 | 101.01 |
| Round 1 | 0.901 | 83.33 |
| Round 2 | 0.906 | 84.03 |
| Round 3 | 0.907 | 94.34 |
The mAP improves dramatically after the first round, from 0.839 to 0.901, which is a 6.2 percentage point gain. Subsequent rounds provide smaller but consistent improvements. After three rounds, the model reaches 0.907 mAP, while the inference speed recovers to 94.34 FPS. This demonstrates that BSLM efficiently leverages unlabeled data without sacrificing real-time performance.
I also plotted the normalized confusion matrices after each round. The classification accuracy on the test set increased from 87% to 93%, confirming the positive impact of iterative pseudo-labeling on class discrimination.
9.2 Comparison with Other Semi-Supervised Methods
To verify the superiority of BSLM, I compared it against three existing semi-supervised object detection methods: STAC, Instant Teaching, and ISMT. All methods were evaluated on the same labeled and unlabeled data split. The comparison is shown below.
| Method | mAP@0.5 | FPS |
|---|---|---|
| STAC | 0.813 | 78.74 |
| Instant Teaching | 0.824 | 82.64 |
| ISMT | 0.814 | 91.74 |
| BSLM (proposed) | 0.907 | 94.34 |
BSLM outperforms the state-of-the-art methods by a large margin, achieving 9.4% higher mAP than Instant Teaching while maintaining the highest inference speed. The superiority of BSLM lies in its iterative teacher-student mutual learning, which progressively refines pseudo-labels and avoids error amplification.
9.3 Overall Performance After BSLM
After applying BSLM to the proposed YOLOv8n-BiFSE, I obtained a final model with an mAP@0.5 of 0.907 and mAP@0.5:0.95 of 0.574. This represents a 9.9 percentage point improvement over the original YOLOv8n supervised baseline. The final model also outperforms all other YOLO variants trained with full supervision, demonstrating the combined power of architectural improvement and semi-supervised learning.
| Network | mAP@0.5 | mAP@0.5:0.95 | FPS | Params (M) | FLOPs (G) |
|---|---|---|---|---|---|
| YOLOv3 | 0.818 | 0.486 | 104.17 | 61.5 | 155.3 |
| YOLOv5s | 0.792 | 0.474 | 175.44 | 7.0 | 15.9 |
| YOLOv7 | 0.795 | 0.482 | 36.29 | 37.2 | 105.1 |
| YOLOv8l | 0.806 | 0.514 | 80.65 | 43.6 | 165.7 |
| YOLOv8n | 0.808 | 0.490 | 128.21 | 3.2 | 8.9 |
| YOLOv8x | 0.803 | 0.508 | 65.79 | 68.2 | 258.1 |
| YOLOv8n-BiFSE + BSLM | 0.907 | 0.574 | 94.34 | 3.1 | 10.3 |
10. Discussion
The results consistently show that both architectural modifications and the semi-supervised training strategy contribute to the final performance. The BiFormer mechanism effectively reduces overfitting by employing sparse attention, while the SE channel attention enhances the feature representation at the fusion stage. The BSLM framework allows the model to learn from a much larger pool of unlabeled solar panel images, which is particularly valuable in real-world applications where annotation resources are limited.
One limitation is that the BSLM performance gains diminish after the second round, indicating that the pseudo-labels become increasingly confident and may not add much new information. Future work could explore more sophisticated uncertainty-based selection criteria or incorporate data augmentation techniques that generate harder examples.
11. Conclusion
In this thesis, I presented a comprehensive study on the recognition of defects in solar panels using an improved convolutional neural network. I proposed the YOLOv8-BiFSE architecture, which integrates the BiFormer attention mechanism and the SE channel attention mechanism. The BiFormer module improves the model’s perception of objects with varying shapes and sizes, while the SE module recalibrates feature channels to emphasize the most informative response. My experiments on the PVEL-AD dataset demonstrate that the proposed architecture achieves an mAP@0.5 of 83.9%, surpassing the baseline YOLOv8n by 3.1 percentage points and outperforming a wide range of YOLO variants. I further introduced the BSLM semi-supervised training method, which iteratively expands the training set using pseudo-labels generated by a teacher-student mutual learning scheme. After three rounds of BSLM, the mAP improves dramatically to 90.7%, a 6.8 percentage point increase over the supervised-only baseline. The final model maintains a real-time inference speed of 94 FPS, confirming its practical applicability.
I believe that the proposed methods offer a valuable contribution to the automatic inspection of solar panels. The combined use of adaptive attention mechanisms and semi-supervised learning addresses both the accuracy and data efficiency challenges that limit current detection systems. Future work will focus on extending the framework to multi-modal data, lightweight deployment on edge devices, and field tests under diverse environmental conditions.
The outcome of this research provides a promising pathway towards fully automated, cost-effective, and reliable quality assurance for solar panel installations, supporting the sustainable expansion of photovoltaic energy worldwide.
