In my research on solar panel defect recognition, I have focused on developing an automated and efficient method to identify various types of defects in photovoltaic modules. Solar panels are exposed to harsh environmental conditions for decades, and their long-term reliability depends on the early detection of micro-cracks, finger interruptions, and other structural anomalies. Traditional manual inspection methods are time-consuming and error-prone, and they cannot meet the real-time requirements of large-scale solar power plants. To address these challenges, I have explored deep learning approaches, particularly convolutional neural networks (CNNs), which have shown outstanding performance in visual defect recognition tasks. In this article, I present my improved YOLOv8-based network architecture, named YOLOv8-BiFSE, and a novel semi-supervised training method called BSLM, which collectively enhance the accuracy and robustness of solar panel defect recognition.
1. Background and Research Motivation
The global demand for renewable energy has increased dramatically, and solar energy has become one of the most promising sources due to its cleanliness and wide availability. However, the efficiency of photovoltaic systems depends heavily on the health of solar panels. Defects such as cracks, broken grids, black cores, and scratches can significantly reduce the power output and may even lead to complete module failure. Since solar panels are installed outdoors and exposed to sunlight, wind, hail, and temperature fluctuations, their surface and internal structures degrade over time. Therefore, a reliable monitoring system is necessary to detect defects early and schedule maintenance accordingly.
In the past, defect recognition in solar panels relied on manual inspection of electroluminescence (EL) images or thermal images. This process is not only labor-intensive but also subjective, leading to inconsistent results. With the advent of deep learning, many researchers have adopted CNN-based object detection algorithms to automate this task. Among these algorithms, the YOLO family has become extremely popular due to its balance between speed and accuracy. However, standard YOLO models often struggle with small defects, complex backgrounds, and varying target shapes. In my work, I address these limitations by integrating advanced attention mechanisms and a self-training strategy to improve the performance of solar panel defect recognition.
2. Overview of Convolutional Neural Networks and Attention Mechanisms
Convolutional neural networks are the backbone of modern computer vision systems. A typical CNN consists of convolutional layers, pooling layers, and fully connected layers. The convolutional layer applies learnable filters to the input feature map to extract local patterns. The operation can be expressed 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, $K$ is the convolution kernel of size $m \times n$, and $C(x,y)$ is the output pixel value at position $(x,y)$. The pooling layer reduces the spatial dimension, which helps to decrease computational cost and control overfitting. The fully connected layer at the end of the network maps the extracted features to class probabilities. However, the large number of parameters in fully connected layers often leads to overfitting and limits the model’s ability to generalize to new data.
To overcome these issues, attention mechanisms have been introduced. Attention allows the network to focus on important regions of the image while suppressing irrelevant information. In my research, I have utilized two types of attention mechanisms: the BiFormer bi-level routing attention and the SE (Squeeze-and-Excitation) channel attention. The BiFormer mechanism dynamically adjusts the attention range for objects of different shapes and sizes, while the SE mechanism adaptively recalibrates channel-wise feature responses. These mechanisms greatly improve the feature representation capability of the network.
3. Analysis of YOLO Series Algorithms for Solar Panel Defect Recognition
Before designing my improved model, I conducted a comprehensive comparison of different YOLO versions on a solar panel defect dataset. The experiments were performed on an NVIDIA A30 GPU with 24 GB of memory, using PyTorch 1.13.1 and CUDA 11.4. The dataset used in this study is the PVEL-AD dataset, which contains 36,543 near-infrared images of photovoltaic cells with 12 different types of defects. For my experiments, I used 6,218 defective images, of which 1,033 were manually annotated. The annotated images were split into training (723 images), validation (206 images), and test (104 images) sets.
I evaluated YOLOv3, YOLOv4 (excluded due to computational constraints), YOLOv5, YOLOv6, YOLOv7, and YOLOv8 under identical settings. The input size was fixed at 640×640 pixels, and the training was conducted for 300 epochs with a batch size of 32. The key evaluation metrics included mean Average Precision (mAP@0.5 and mAP@0.5:0.95), frames per second (FPS), the number of parameters, and floating point operations (FLOPs). The detailed results are shown in the following table.
| Network | Input size | mAP@0.5 | mAP@0.5:0.95 | FPS | Params (M) | FLOPs (G) |
|---|---|---|---|---|---|---|
| YOLOv3-tiny | 640×640 | 0.806 | 0.442 | 256.41 | 8.7 | 13.0 |
| YOLOv3 | 640×640 | 0.818 | 0.486 | 104.17 | 61.5 | 155.3 |
| YOLOv5n | 640×640 | 0.797 | 0.464 | 163.93 | 1.8 | 4.2 |
| YOLOv5s | 640×640 | 0.792 | 0.474 | 175.44 | 7.0 | 15.9 |
| YOLOv6l | 640×640 | 0.767 | 0.456 | 29.28 | 59.6 | 150.7 |
| YOLOv7 | 640×640 | 0.795 | 0.482 | 36.29 | 37.2 | 105.1 |
| YOLOv8n | 640×640 | 0.808 | 0.490 | 128.21 | 3.2 | 8.9 |
| YOLOv8l | 640×640 | 0.806 | 0.514 | 80.65 | 43.6 | 165.7 |
| Faster-RCNN | 640×640 | 0.596 | 0.317 | 105.38 | 3.3 | 1.1 |
From the table, it is clear that YOLOv8 provides the best trade-off between accuracy and efficiency. Particularly, YOLOv8n (the nano version) achieves a high mAP@0.5 of 0.808 while maintaining a fast inference speed of 128 FPS and a compact model size of only 3.2 million parameters. I therefore selected YOLOv8n as the baseline architecture for my research.
4. Proposed YOLOv8-BiFSE Network Architecture
Although YOLOv8n performs well, it still has certain drawbacks. The C2f module in the backbone contains many fully connected layers, which increase the risk of overfitting and limit the model’s flexibility when handling inputs of various shapes and sizes. Moreover, the network does not effectively focus on the most important regions, leading to wasted computational resources. To solve these problems, I introduce two attention mechanisms into the YOLOv8n architecture.
4.1 BiFormer Attention for Enhanced Feature Extraction
The BiFormer attention mechanism is a novel approach that uses bi-level routing to achieve dynamic and sparse attention. Unlike traditional self-attention, which operates on the entire feature map, BiFormer first filters out irrelevant regions at a coarse level and then applies fine-grained attention within the selected regions. This reduces computational cost and allows the model to adapt to objects of diverse shapes and scales. The structure of BiFormer is based on a four-level pyramid, using overlapping patch embeddings and patch merging to capture multi-scale features.
The core of BiFormer is the BiFormer Block, which consists of the following components:
1. Layer normalization to stabilize training.
2. A 3×3 depthwise convolution to encode relative positional information.
3. A bi-level routing attention module.
4. A multi-layer perceptron (MLP) to model cross-position relationships.
I replaced the first two C2f modules in the YOLOv8n backbone with BiFormer blocks. This modification reduces the number of fully connected layers, thereby suppressing overfitting. Moreover, the dynamic attention mechanism enables the model to better handle defects of different sizes, such as thin line cracks and star-shaped cracks. The resulting network is referred to as YOLOv8n-BiFormer.
4.2 SE Attention for Channel Recalibration
To further improve the focus on important channels while filtering out redundant information, I introduced the Squeeze-and-Excitation (SE) attention mechanism. The SE module performs three operations: squeeze, excitation, and rescale. Given a feature map $X \in \mathbb{R}^{C \times H \times W}$, the squeeze operation uses global average pooling to aggregate spatial information into a channel descriptor:
$$z_c = \frac{1}{H \times W} \sum_{i=1}^{H}\sum_{j=1}^{W} x_{cij}$$
The excitation operation processes this descriptor through two fully connected layers to compute channel weights:
$$s = \sigma(W_2 \cdot \text{ReLU}(W_1 \cdot z))$$
where $W_1$ and $W_2$ are the weights of the two fully connected layers, and $\sigma$ represents the sigmoid function. Finally, the channel-wise multiplication is applied to the original feature map:
$$y_{cij} = s_c \cdot x_{cij}$$
I inserted the SE module at the last layer of the multi-scale feature fusion network (Neck), where the feature representations are mature and benefit most from channel recalibration. The final architecture, named YOLOv8n-BiFSE, combines the strengths of BiFormer and SE attention.

5. Experimental Results for YOLOv8-BiFSE
5.1 Ablation Study on BiFormer Position
I conducted an ablation study to determine the best position for the BiFormer module in the backbone. The results are presented below.
| Network structure | mAP@0.5 | mAP@0.5:0.95 | Precision | Recall |
|---|---|---|---|---|
| YOLOv8n (baseline) | 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,5 | 0.815 | 0.506 | 0.752 | 0.759 |
Replacing the first two C2f modules with BiFormer modules yielded the highest improvement in mAP@0.5, reaching 0.815. This confirms that the dynamic attention mechanism enhances the feature representation for solar panel defects.
5.2 Ablation Study on SE Position
Next, I evaluated the impact of inserting the SE module at different positions in the YOLOv8n-BiFormer network. The results are summarized in the following table.
| 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 |
The best result was achieved when the SE module was added at Layer 23, which is the final layer of the neck. This configuration produced a mAP@0.5 of 0.839, an improvement of 2.4% over the YOLOv8n-BiFormer model and 3.1% over the original YOLOv8n.
5.3 Comparison with Other Attention Mechanisms
I compared the SE attention mechanism with other popular attention modules, including CA, SA, CoTA, and CBAM, when integrated into the YOLOv8n-BiFormer network. The results are shown below.
| Attention mechanism | mAP@0.5 | mAP@0.5:0.95 | Precision | Recall |
|---|---|---|---|---|
| None (YOLOv8n-BiFormer) | 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 (ours) | 0.839 | 0.531 | 0.755 | 0.798 |
SE attention achieved the highest mAP and recall, demonstrating its effectiveness in channel-wise recalibration for solar panel defect recognition.
5.4 Multi-model Comparison
I compared the proposed YOLOv8n-BiFSE with several YOLO variants. The table below summarizes the performance of the best models.
| Network | Input size | mAP@0.5 | mAP@0.5:0.95 | FPS | Params (M) | FLOPs (G) |
|---|---|---|---|---|---|---|
| YOLOv3 | 640×640 | 0.818 | 0.486 | 104.17 | 61.5 | 155.3 |
| YOLOv5s | 640×640 | 0.792 | 0.474 | 175.44 | 7.0 | 15.9 |
| YOLOv7 | 640×640 | 0.795 | 0.482 | 36.29 | 37.2 | 105.1 |
| YOLOv8n | 640×640 | 0.808 | 0.490 | 128.21 | 3.2 | 8.9 |
| YOLOv8s | 640×640 | 0.787 | 0.468 | 123.46 | 11.1 | 28.6 |
| YOLOv8x | 640×640 | 0.803 | 0.508 | 65.79 | 68.2 | 258.1 |
| YOLOv8n-BiFSE (ours) | 640×640 | 0.839 | 0.531 | 101.01 | 3.1 | 10.3 |
Our proposed model achieved the highest mAP@0.5 of 0.839 with only 3.1 million parameters. Although the FPS is slightly lower than YOLOv8n, it still meets real-time requirements.
6. BSLM: A Semi-Supervised Learning Method
In many practical scenarios, obtaining a large number of annotated solar panel images is expensive and time-consuming. To leverage unlabeled data, I proposed a semi-supervised learning method named BSLM (Better Student Learning Method). This approach is based on iterative self-training with a Teacher-Student framework.
6.1 Pre-training Phase
The first step is to train an initial model (Teacher) using the available annotated dataset. In my experiments, I used 1,033 annotated solar panel images as the initial labeled set. The Teacher model is trained with the YOLOv8n-BiFSE architecture until convergence. The accuracy of this pre-trained model on the test set was 0.839 mAP@0.5.
6.2 Teacher-Student Mutual Learning
After pre-training, the Teacher model predicts pseudo-labels for a separate unlabeled dataset. In my study, I partitioned the remaining 5,185 images into three sets: A (1,728 images), B (1,728 images), and C (1,729 images). The Teacher model generates pseudo-labels for dataset A, and the samples with high confidence scores are selected. The original labeled dataset is then combined with the pseudo-labeled dataset A to form a new training set. A Student model is trained on this expanded dataset. After the first round, the Student model becomes the new Teacher, and it generates pseudo-labels for dataset B. The process is repeated for dataset C.
The overall flow of BSLM can be summarized as follows:
1. Train Teacher on labeled data.
2. Generate pseudo-labels for unlabeled data.
3. Combine labeled and pseudo-labeled data.
4. Train Student on the combined data.
5. Replace Teacher with Student and repeat.
In my implementation, I performed three iterations of this process. The learning process is illustrated in the diagram below.
7. Experimental Results of BSLM
7.1 Ablation Study on Learning Rounds
I evaluated the model performance after each round of BSLM training. The results are shown in the following table.
| Learning round | Input size | mAP@0.5 | FPS |
|---|---|---|---|
| Pre-training (Teacher) | 640×640 | 0.839 | 101.01 |
| Round 1 | 640×640 | 0.901 | 83.33 |
| Round 2 | 640×640 | 0.906 | 84.03 |
| Round 3 | 640×640 | 0.907 | 94.34 |
The mAP@0.5 improved significantly from 0.839 to 0.901 after the first round, and then gradually increased to 0.907 after the third round. The FPS initially decreased but later recovered to 94.34, which is still fast enough for real-time applications. The confusion matrices also confirmed that the classification accuracy improved from 0.87 to 0.93 after three rounds.
7.2 Comparison with Other Semi-Supervised Methods
I compared BSLM with three other semi-supervised learning approaches: STAC, Instant Teaching, and ISMT. The experiments were conducted on the same dataset and with the same YOLOv8n-BiFSE backbone. The results are listed below.
| Method | Input size | mAP@0.5 | FPS |
|---|---|---|---|
| STAC | 640×640 | 0.813 | 78.74 |
| Instant Teaching | 640×640 | 0.824 | 82.64 |
| ISMT | 640×640 | 0.814 | 91.74 |
| BSLM (ours) | 640×640 | 0.907 | 94.34 |
BSLM significantly outperformed the other methods in terms of mAP, while also achieving the highest inference speed. This demonstrates that the iterative Teacher-Student self-training strategy effectively utilizes unlabeled data to improve model performance.
7.3 Final Multi-model Comparison with BSLM
After training with BSLM, I compared the final YOLOv8n-BiFSE model with other YOLO architectures trained conventionally. The results are presented in the table below.
| Network | Input size | mAP@0.5 | mAP@0.5:0.95 | FPS | Params (M) | FLOPs (G) |
|---|---|---|---|---|---|---|
| YOLOv3 | 640×640 | 0.818 | 0.486 | 104.17 | 61.5 | 155.3 |
| YOLOv5s | 640×640 | 0.792 | 0.474 | 175.44 | 7.0 | 15.9 |
| YOLOv7 | 640×640 | 0.795 | 0.482 | 36.29 | 37.2 | 105.1 |
| YOLOv8n | 640×640 | 0.808 | 0.490 | 128.21 | 3.2 | 8.9 |
| YOLOv8n-BiFSE + BSLM (ours) | 640×640 | 0.907 | 0.574 | 94.34 | 3.1 | 10.3 |
With the BSLM training method, my proposed model achieved a remarkable mAP@0.5 of 0.907, which is 9.9% higher than the original YOLOv8n and 6.8% higher than the YOLOv8n-BiFSE trained with only supervised learning. This clearly validates the effectiveness of the BSLM approach in improving solar panel defect recognition.
8. Visual Analysis of Attention Maps
To visually understand the improvements brought by the attention mechanisms, I compared the heatmaps of the original YOLOv8n, YOLOv8n-BiFormer, and YOLOv8n-BiFSE models at different layers. In the original YOLOv8n, the network tends to focus on a broad region that includes the crack but also covers many irrelevant areas. After incorporating BiFormer, the model shows a higher concentration on the crack region, although some attention is dispersed in the middle layers. With the addition of SE attention, the heatmaps become more concentrated on the crack area, especially at the endpoints of the crack. This indicates that the SE module helps to filter out redundant information and focus on the most discriminative features.
9. Conclusion and Future Work
In my research, I have developed an improved solar panel defect recognition method based on convolutional neural networks. The key contributions of my work are as follows.
First, I introduced the BiFormer bi-level routing attention mechanism into the YOLOv8 backbone. This mechanism reduces the number of fully connected layers, thereby mitigating the overfitting problem and enabling the model to better handle defects of varying shapes and sizes. The BiFormer module dynamically adjusts the attention range, which is crucial for detecting thin cracks, broken grids, and other small anomalies in solar panels.
Second, I integrated the SE channel attention mechanism into the multi-scale feature fusion network. SE attention adaptively recalibrates channel-wise features, allowing the model to emphasize important channels and suppress redundant ones. This not only improves the recognition accuracy but also reduces unnecessary computation, leading to more efficient processing.
Third, I proposed a novel semi-supervised learning method called BSLM, which leverages an iterative Teacher-Student framework to utilize unlabeled data effectively. By generating pseudo-labels and progressively expanding the training set, BSLM significantly boosts the model’s performance without requiring additional manual annotation. This is especially valuable in solar panel defect recognition, where labeled data are limited.
The experimental results demonstrate that the proposed YOLOv8n-BiFSE model achieves a mAP@0.5 of 0.907 after training with BSLM, which is a substantial improvement over the baseline YOLOv8n (0.808) and other YOLO variants. The model also maintains a high inference speed of 94 FPS, satisfying real-time requirements.
For future work, I plan to explore more advanced attention mechanisms and lightweight network compression techniques to further improve the efficiency of the model. In addition, I intend to test my method on different solar panel defect datasets and real-world deployment scenarios, including drone-based inspections. The integration of multi-modal data, such as visible light and infrared images, may also provide complementary information for more robust defect recognition. Finally, I would like to extend the BSLM method to other object detection tasks in the renewable energy domain.
In summary, my research provides an effective and efficient solution for solar panel defect recognition, combining advanced convolutional neural network architectures with intelligent attention mechanisms and a powerful semi-supervised training strategy. This work contributes to the reliable operation and maintenance of solar power plants, ultimately supporting the global transition to clean energy.
