In the photovoltaic industry, the quality inspection of solar panels is critical for ensuring long-term reliability and energy output. Electroluminescence (EL) imaging is widely used to capture infrared images of solar panels, where dark regions indicate defects such as cracks, micro-cracks, or breaks. Traditional manual inspection of these infrared images is time-consuming and error-prone. With the advancement of computer vision, deep learning-based object detection algorithms have become a promising solution for automating defect detection in solar panels. However, common object detection models face challenges in extracting subtle features from infrared images, especially for small defects on solar panels, and they often suffer from slow inference speeds. To address these issues, we propose an improved YOLOv8 algorithm that integrates a BiFormer mechanism with bi-level routing attention as the backbone network and incorporates a Squeeze-and-Excitation (SE) attention module in the feature pyramid. Furthermore, we introduce a novel semi-supervised learning method called Better Student Learning Method (BSLM) to enhance detection accuracy without increasing the amount of labeled data. Extensive experiments on the PVEL-AD dataset demonstrate that our method achieves superior performance for detecting defects in solar panels, achieving an mAP@0.5 of 83.9%, a 3.1% improvement over the original YOLOv8n, while maintaining a real-time inference speed of 101.01 FPS. After applying BSLM, the mAP@0.5 further increases to 90.7%, confirming the effectiveness of our approach in practical solar panel inspection.
1. Introduction
Solar panels are critical components in renewable energy systems. Defects such as cracks, hot spots, and hidden damages can significantly reduce the efficiency and lifespan of solar panels. Infrared imaging, particularly electroluminescence (EL) imaging, provides a non-destructive method to visualize these defects. However, manual analysis of EL images is labor-intensive and prone to subjective errors. Therefore, automated defect detection using deep learning has attracted considerable attention.
Among deep learning object detectors, YOLO (You Only Look Once) series algorithms are widely used for real-time applications due to their high speed and reasonable accuracy. YOLOv8, the latest version, introduces a C2f module and anchor-free detection to improve efficiency. Nevertheless, YOLOv8 still faces limitations when applied to solar panel infrared images: (1) the C2f module is prone to overfitting due to large fully connected layers; (2) the fixed input size restricts adaptability to varying defect shapes and sizes; (3) the network lacks focus on important features, wasting computational resources; (4) training requires large amounts of manually annotated data, which is costly and error-prone.
To overcome these challenges, we propose an improved YOLOv8 model specifically designed for defect detection in solar panels. Our contributions are as follows:
- We replace the first two C2f modules in the backbone with BiFormer modules, which employ a bi-level routing attention mechanism to dynamically adjust the attention range. This reduces overfitting and enhances adaptability to different defect scales.
- We insert an SE (Squeeze-and-Excitation) attention module at the deepest layer of the feature pyramid network to suppress irrelevant channels and amplify important features, thereby improving feature representation.
- We propose a semi-supervised learning method called BSLM (Better Student Learning Method), which iteratively trains a student model using pseudo-labels from a teacher model, significantly boosting accuracy without extra manual labeling.
We evaluate our method on the PVEL-AD dataset, which contains infrared images of solar panels with crack defects. Comprehensive experiments show that our improved YOLOv8 achieves an mAP@0.5 of 83.9%, outperforming the baseline YOLOv8n (80.8%) and other one-stage detectors, while maintaining a real-time inference speed of 101.01 FPS. Moreover, with BSLM, the mAP@0.5 reaches 90.7%, demonstrating the practical value for industrial solar panel inspection.
2. Related Work
2.1 Object Detection for Solar Panel Defects
Defect detection in solar panels using computer vision has been studied extensively. Traditional methods rely on handcrafted features and classifiers, but they often fail to capture complex defect patterns. Deep learning-based detectors, especially YOLO variants, have shown great potential. For instance, YOLOv3, YOLOv4, and YOLOv5 have been applied to detect cracks and other anomalies in solar panels. However, these models either have large computational footprints or insufficient accuracy for small defects. YOLOv8 improves upon them with a more efficient architecture, but still struggles with feature extraction for infrared images of solar panels due to low contrast and noise.
2.2 Attention Mechanisms
Attention mechanisms help neural networks focus on important parts of the input. The Squeeze-and-Excitation (SE) block adaptively recalibrates channel-wise feature responses. The BiFormer architecture introduces a bi-level routing attention that dynamically selects a sparse set of key regions, reducing computational cost while maintaining performance. Combining these attention mechanisms can enhance the detection of subtle defects in solar panels.
2.3 Semi-Supervised Learning
Semi-supervised learning leverages unlabeled data to improve model performance. The Noisy Student approach, proposed by Xie et al., uses a teacher model to generate pseudo-labels on unlabeled data and then trains a student model with noise injection. Our BSLM extends this idea by repeating the process three times, gradually incorporating more unlabeled data, which is particularly beneficial when labeled solar panel infrared images are scarce.
3. Proposed Method
3.1 Overall Architecture
Our improved YOLOv8 architecture is shown in the following description. The backbone consists of convolution layers and BiFormer blocks instead of C2f modules in the early stages. The neck integrates an SE attention module at the final layer before detection heads. The input image size is 640×640 pixels. The network outputs three feature maps at different scales for multi-scale detection.
The input feature map X with height H, width W, and channels C is first processed by patch embedding. In the bi-level routing attention, the feature is reshaped into regions of size S×S, resulting in \(\frac{HW}{S^2}\) regions. Three linear projections produce Q, K, V:
$$Q = X_r W_q,\quad K = X_r W_k,\quad V = X_r W_v$$
where \(W_q, W_k, W_v\) are learnable weights. The BiFormer block also includes a 3×3 depthwise convolution for position encoding and a multi-layer perceptron (MLP) for non-linear transformation.
The SE module performs channel-wise recalibration:
$$U = F_{tr}(X),\quad z = F_{sq}(U) = \frac{1}{H\times W}\sum_{i=1}^{H}\sum_{j=1}^{W} U(i,j)$$
$$s = F_{ex}(z) = \sigma(W_2 \delta(W_1 z)),\quad \tilde{X} = F_{scale}(U,s)$$
where \(\sigma\) is the sigmoid function, \(\delta\) is ReLU, and \(W_1, W_2\) are fully connected layers.
3.2 BiFormer Backbone
We replace the first two C2f modules in YOLOv8 backbone with BiFormer blocks. The BiFormer block uses a bi-level routing attention mechanism that first selects relevant regions at a coarse level and then computes fine-grained attention within those regions. This dynamic sparsity reduces the number of parameters and computations while capturing long-range dependencies, which is crucial for detecting elongated cracks in solar panels. The pyramid structure in BiFormer allows multi-scale feature extraction, improving the model’s ability to handle defects of different sizes.
3.3 SE Attention in Feature Pyramid
To further refine feature representation, we insert an SE attention module at the deepest layer of the feature pyramid network (layer 23 in our architecture). The SE block learns to assign higher weights to important channels and suppress irrelevant ones, effectively filtering out noise common in infrared images of solar panels. This leads to better localization and classification of defects.
3.4 Better Student Learning Method (BSLM)
We propose the Better Student Learning Method (BSLM) to leverage unlabeled data. The process is illustrated as follows:
- Train a Teacher model using the labeled dataset A (723 images).
- Use the Teacher to generate pseudo-labels for unlabeled dataset B (1728 images), selecting the class with maximum confidence as the hard label.
- Combine labeled dataset A and pseudo-labeled dataset B to train a Student model.
- After training, the Student becomes the new Teacher, generating pseudo-labels for another unlabeled dataset C (1728 images).
- Repeat the process for a third round with dataset D (1729 images).
This iterative self-training significantly enhances accuracy without additional manual annotation. The pseudo-labels are filtered by a confidence threshold to reduce noise.
4. Experiments
4.1 Dataset and Preprocessing
We evaluate our method on the PVEL-AD industrial dataset, focusing on images containing crack defects in solar panels. The dataset contains 6218 infrared images of solar panels. We randomly selected 1033 images and split them into training (723), validation (206), and test (104) sets. The remaining 5185 images were divided into three unlabeled subsets A, B, and C (1728, 1728, 1729 images respectively) for BSLM experiments. All labeled images were annotated using labelimg.
4.2 Implementation Details
We use an NVIDIA A30 GPU with 24GB memory. Python 3.10, PyTorch 1.13.1, CUDA 11.4. Input size is 640×640. We use stochastic gradient descent (SGD) with momentum 0.9, weight decay 0.0005, and initial learning rate 0.01 with cosine annealing. Training epochs: 300 for baseline and improved models. For BSLM, each round uses 300 epochs. Data augmentation includes mosaic, random affine, and HSV jitter.
4.3 Evaluation Metrics
We use mAP@0.5, mAP@0.5:0.95, FPS (frames per second), number of parameters (M), and FLOPs (G) to evaluate performance.
4.4 Ablation Studies
4.4.1 Effect of BiFormer
We compare YOLOv8n (baseline) and YOLOv8n with BiFormer (v8n_B). Results are shown in Table 1.
| Model | Input Size | mAP@0.5 | mAP@0.5:0.95 | FPS | Params (M) | FLOPs (G) |
|---|---|---|---|---|---|---|
| YOLOv8n | 640×640 | 0.808 | 0.490 | 128.21 | 3.16 | 8.9 |
| v8n_B | 640×640 | 0.815 | 0.506 | 96.15 | 3.23 | 10.9 |
Table 1 shows that BiFormer improves mAP@0.5 by 0.7% and mAP@0.5:0.95 by 1.6%, with a slight increase in parameters and FLOPs. FPS drops to 96.15 but still meets real-time requirements for solar panel inspection.
4.4.2 Effect of Different Attention Mechanisms
We add various attention modules (CA, SA, CoTA, CBAM, SE) to the last layer of v8n_B. Results are in Table 2.
| Model | mAP@0.5 | mAP@0.5:0.95 | Precision | Recall |
|---|---|---|---|---|
| v8n_B | 0.815 | 0.506 | 0.752 | 0.759 |
| v8n_B_CA | 0.820 | 0.503 | 0.750 | 0.791 |
| v8n_B_SA | 0.825 | 0.533 | 0.788 | 0.738 |
| v8n_B_CoTA | 0.818 | 0.508 | 0.794 | 0.777 |
| v8n_B_CBAM | 0.824 | 0.519 | 0.778 | 0.777 |
| v8n_B_SE | 0.839 | 0.531 | 0.755 | 0.798 |
SE attention yields the highest mAP@0.5 (0.839) and recall (0.798), demonstrating its effectiveness in channel recalibration for solar panel defect detection.
4.4.3 Position of SE Module
We insert SE at different layers of v8n_B. Results in Table 3 show that inserting at layer 23 (the deepest) achieves the best performance.
| SE Position | mAP@0.5 | mAP@0.5:0.95 | Precision | Recall |
|---|---|---|---|---|
| v8n_B (no SE) | 0.815 | 0.506 | 0.752 | 0.759 |
| +layer 1 | 0.813 | 0.507 | 0.735 | 0.767 |
| +layer 4 | 0.808 | 0.507 | 0.817 | 0.698 |
| +layer 6 | 0.814 | 0.492 | 0.778 | 0.775 |
| +layer 10 | 0.824 | 0.505 | 0.765 | 0.780 |
| +layer 17 | 0.508 | 0.513 | 0.784 | 0.748 |
| +layer 20 | 0.813 | 0.491 | 0.727 | 0.773 |
| +layer 23 | 0.839 | 0.531 | 0.755 | 0.798 |
4.5 Comparison with State-of-the-Art Detectors
We compare our proposed model (v8n_B_SE) with various YOLOv3–v8 variants on the same validation set. Results are shown in Table 4.
| Model | 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 |
| YOLOv6n | 640×640 | 0.586 | 0.295 | 35.36 | 11.4 | 4.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 |
| YOLOv8s | 640×640 | 0.787 | 0.468 | 123.46 | 11.1 | 28.6 |
| YOLOv8m | 640×640 | 0.765 | 0.467 | 104.17 | 25.9 | 79.1 |
| YOLOv8l | 640×640 | 0.806 | 0.514 | 80.65 | 43.6 | 165.7 |
| YOLOv8x | 640×640 | 0.803 | 0.508 | 65.79 | 68.2 | 258.1 |
| v8n_B_SE (Ours) | 640×640 | 0.839 | 0.531 | 101.01 | 3.1 | 10.3 |
Our model achieves the highest mAP@0.5 (83.9%) among all one-stage detectors, with only 3.1M parameters and 10.3G FLOPs, demonstrating an excellent trade-off between accuracy and efficiency for real-time solar panel defect detection. Although YOLOv3 has higher FPS (104.17), our model has far fewer parameters and better accuracy, making it more suitable for deployment on edge devices.
4.6 Results of BSLM Semi-Supervised Learning
We apply BSLM to our improved model (v8n_B_SE). Table 5 shows the mAP@0.5 and FPS after each round of self-training.
| Methodology | Input Size | mAP@0.5 | FPS |
|---|---|---|---|
| v8n_B_SE (supervised) | 640×640 | 0.839 | 101.01 |
| BS_Round_1 | 640×640 | 0.901 | 83.33 |
| BS_Round_2 | 640×640 | 0.906 | 84.03 |
| BS_Round_3 | 640×640 | 0.907 | 94.34 |
BSLM significantly boosts mAP from 83.9% to 90.7% after three rounds, with only a slight decrease in FPS (still above 94 FPS). This demonstrates that our semi-supervised method effectively leverages unlabeled solar panel infrared images to improve detection accuracy without extra manual annotation.
5. Discussion
The experimental results confirm that integrating BiFormer and SE attention mechanisms into YOLOv8 yields substantial improvements in detecting defects in solar panels. The BiFormer module reduces overfitting and enhances multi-scale feature extraction, while SE attention refines channel importance, leading to better detection of small cracks. Our BSLM method further pushes the performance envelope by exploiting unlabeled data, which is abundant in industrial settings.
One limitation is that FPS drops slightly compared to the baseline YOLOv8n, but it remains well above the real-time threshold (30 FPS). For practical deployment on solar panel production lines, our model can be further optimized with quantization and pruning to improve speed.
6. Conclusion
In this paper, we propose an improved YOLOv8 algorithm for infrared image defect detection of solar panels. By incorporating BiFormer blocks and SE attention, our model achieves higher accuracy (mAP@0.5 = 83.9%) with a lightweight architecture (3.1M parameters) and real-time speed (101.01 FPS). Additionally, the Better Student Learning Method (BSLM) boosts the mAP to 90.7% using unlabeled data, significantly reducing manual annotation effort. The comprehensive experiments demonstrate that our approach is highly effective and practical for industrial inspection of solar panels. Future work will focus on deploying the model on embedded systems and extending to multi-class defect detection for solar panels.

