YOLO-RMFP: An Enhanced Model for Solar Panel Defect Detection

Advancing efficient and precise methodologies for inspecting solar panel integrity represents a critical challenge within the renewable energy domain. As global reliance on photovoltaic technology escalates, ensuring the operational longevity and optimal energy conversion efficiency of these systems is paramount. Common internal defects such as micro-cracks, breakages, black cores, and thick lines, often imperceptible to the naked eye, can severely degrade performance and lead to premature system failure. While traditional inspection methods, including manual visual checks and some non-destructive techniques like electroluminescence imaging, provide a foundation, they are frequently hampered by low efficiency, subjectivity, and vulnerability to complex background noise in real-world deployment scenarios.

Contemporary deep learning-based object detection frameworks offer a promising avenue to surmount these limitations. Among them, single-stage detectors like the YOLO series balance speed and accuracy effectively. However, applying these general-purpose models directly to the specific task of solar panel electroluminescence defect detection reveals several inherent difficulties. The primary challenges stem from the significant variation in defect scales and the characteristically small size of many critical flaws, such as fine cracks, against often cluttered and noisy electroluminescence backgrounds. These factors conspire to cause feature confusion, information loss during multi-scale fusion, and imprecise bounding box localization, ultimately resulting in missed detections and reduced reliability.

To address these specific challenges in solar panel inspection, this work introduces YOLO-RMFP, a novel architecture built upon the efficient YOLOv8n framework. Our contributions are meticulously designed to enhance feature representation, fusion, and localization specifically for solar panel defects:

  • Receptive Field Mixed Attention (RFMA): We propose a new attention mechanism that synergistically combines multi-scale channel emphasis with spatial receptive field adaptation. This allows the model to dynamically focus on discriminative features across scales, crucial for identifying both large and minute flaws on a solar panel.
  • SPPRFMA Module: We integrate the RFMA module with the Spatial Pyramid Pooling (SPP) structure via residual connections, creating the SPPRFMA module. This enhances the backbone network’s ability to capture rich, multi-scale contextual information while filtering out irrelevant background noise common in solar panel EL images.
  • Multi-Scale Feature Fusion Pyramid Network (MSF-FPN): We redesign the neck architecture with a focus on auxiliary feature guidance. The MSF-FPN facilitates more comprehensive interaction between deep semantic features and shallow high-resolution details, mitigating the information loss typically encountered for small solar panel defects like micro-cracks during the feature pyramid fusion process.
  • Focaler-PIoU Loss: We develop a new bounding box regression loss by incorporating a linear interval mapping strategy into the Pixel-IoU framework. This Focaler-PIoU loss refines localization accuracy and directs more optimization focus towards hard-to-detect solar panel defect samples, effectively addressing sample imbalance.

Comprehensive experiments on a dedicated solar panel electroluminescence defect dataset validate the efficacy of YOLO-RMFP. The model achieves superior performance compared to several state-of-the-art detectors, demonstrating significant improvements in detection precision, recall, and robustness against various image perturbations, marking a substantial step forward in automated solar panel quality inspection.

1. The YOLO-RMFP Network Architecture

The overall architecture of the proposed YOLO-RMFP model is engineered to tackle the unique demands of solar panel defect detection. Based on the YOLOv8n framework, which provides an excellent balance of speed and accuracy, we introduce targeted enhancements across its core components. The schematic flow of information through the network is designed to progressively extract, refine, and combine features relevant to defects of varying sizes and appearances on a solar panel.

The input electroluminescence image of a solar panel is first processed by the modified backbone network. Here, a pivotal modification is the replacement of the standard SPPF module with our proposed SPPRFMA module. This substitution empowers the backbone to generate feature maps that are not only multi-scale but also attentively weighted, suppressing background noise and highlighting potential defect regions. These enhanced features are then passed to the neck network.

In the neck, we employ our novel MSF-FPN structure to replace the original Path Aggregation Network (PAN). The MSF-FPN is specifically designed to overcome the limitations of linear feature fusion. It establishes richer connections between feature maps from different depths and resolutions, ensuring that fine-grained details crucial for spotting small cracks on a solar panel are preserved and effectively merged with high-level semantic understanding. This results in a set of fused feature pyramids that provide a more coherent and informative representation for the detection heads.

Finally, the detection heads predict bounding boxes, objectness scores, and class probabilities for defects. During training, the model’s localization capability is refined using the Focaler-PIoU loss function. This loss function provides more precise guidance for bounding box regression than standard IoU variants, which is essential for accurately delineating the often irregular shapes of solar panel defects like black cores or breakages. The collective effect of these innovations—SPPRFMA, MSF-FPN, and Focaler-PIoU—ensures that YOLO-RMFP delivers high-precision detection performance tailored for the challenging task of solar panel inspection.

2. Design and Implementation of Enhanced Modules

2.1 Receptive Field Mixed Attention (RFMA) Module

The detection of defects in a solar panel, particularly subtle ones like micro-cracks, requires the model to discern small, low-contrast patterns against a variable background. Standard convolutional operations treat all spatial locations equally, which is suboptimal. Attention mechanisms address this by allowing the network to focus computational resources on more informative regions. While the Efficient Multi-scale Attention (EMA) mechanism provides a good foundation by performing multi-scale encoding, it suffers from parameter sharing across its parallel branches, which can limit its adaptability to diverse feature patterns present in a solar panel image.

To create a more powerful and flexible attention mechanism for solar panel defect detection, we propose the Receptive Field Mixed Attention (RFMA). RFMA innovatively fuses the multi-scale channel weighting principles of EMA with the spatial adaptability of Receptive Field Attention (RFA). The core idea is to enable dynamic adjustment of both “what” (channel-wise importance) and “where/how” (spatial context via receptive field) to focus on.

The operation of the RFMA module begins by dividing the input feature map \(X \in \mathbb{R}^{C \times H \times W}\) into \(G\) groups along the channel dimension: \(X = [X_0, X_1, …, X_{G-1}]\), where \(X_i \in \mathbb{R}^{(C/G) \times H \times W}\). This grouping strategy facilitates efficient parallel processing and specialized feature modulation.

Each group is then processed through two distinct pathways:

  1. 1×1 Convolution Pathway (Multi-scale Channel Emphasis): This path is responsible for capturing cross-channel relationships and global context. For a feature group \(X_i\), we first apply separate 1D global max pooling along the height and width dimensions to generate compact spatial descriptors. For example, the pooled vector for the height dimension, \(z^h\), is computed as:
    $$ z^h_c(h) = \underset{0 \leq i < W}{\max} X_{i, c}(h, i) $$
    The pooled vectors from both dimensions are concatenated and processed through shared 1×1 convolutions and Sigmoid activation functions to generate channel attention weights, which are then multiplied back onto the original group features.
  2. 3×3 Convolution Pathway (Spatial Receptive Field Adaptation): This path processes each group \(X_i\) with a 3×3 convolution. This operation explicitly expands the receptive field, allowing the module to integrate contextual information from a larger spatial neighborhood, which is vital for understanding the structure of larger solar panel defects or defect clusters.

The outputs from these two pathways are then engaged in a cross-spatial learning stage. Their spatial structures are reshaped and subjected to 2D max pooling to extract the most salient spatial responses:
$$ z_c = \underset{0 \leq j < H}{\max} \, \underset{0 \leq i < W}{\max} X_c(i, j) $$
A matrix multiplication between the transformed outputs generates a refined spatial attention map. After normalization with a Sigmoid function, this map is element-wise multiplied with the initially group-convolved features. A final convolution layer integrates the processed groups to produce the RFMA output.

By blending multi-scale channel attention with adaptive spatial context gathering, the RFMA module enables the model to selectively amplify features corresponding to potential defect signatures on a solar panel, whether they are localized fine details or broader contextual patterns, thereby significantly boosting discriminative power.

2.2 SPPRFMA Module

The Spatial Pyramid Pooling (SPP) module is a cornerstone for multi-scale feature extraction in modern detectors. The SPPF variant in YOLOv8 efficiently pools features at multiple kernel sizes (e.g., 5×5, 9×9, 13×13) and concatenates them, providing a fixed-length representation rich in multi-scale context. This is highly beneficial for objects of varying sizes. However, for solar panel defects, where the target features are subtle and the background can be complex, indiscriminate pooling may also amplify noise.

To create a more intelligent pooling mechanism, we embed the RFMA module into the SPPF structure, resulting in the SPPRFMA module. The integration is achieved through a residual connection. The input feature map is first processed by the RFMA module, which produces an attentively weighted feature map emphasizing regions likely to contain solar panel defects. This attended feature map is then added to the original input (via a residual connection) before being fed into the standard multi-max-pooling branch of SPPF.

The operation can be summarized as follows: Let \(F_{in}\) be the input feature map. First, the RFMA module computes an attention mask \(A\) and applies it:
$$ F_{att} = \text{RFMA}(F_{in}) $$
The attentively refined features are then combined with the original input:
$$ F_{res} = F_{in} + F_{att} $$
Finally, \(F_{res}\) passes through the parallel max-pooling layers with different kernel sizes and is concatenated:
$$ F_{out} = \text{Concat}\left[\text{MaxPool}_{k \times k}(F_{res})\right] \quad \text{for } k \in K $$
where \(K\) is the set of pooling kernel sizes.

This design ensures that the subsequent pyramid pooling operates on a feature map where defect-related signals have been preliminarily enhanced and irrelevant background has been suppressed. Consequently, the SPPRFMA module generates a context-rich output that is particularly attuned to the multi-scale and often faint indicators of solar panel malfunction, leading to more robust feature representations for the downstream network.

2.3 Multi-Scale Feature Fusion Pyramid Network (MSF-FPN)

Effective fusion of features from different levels of the backbone is critical for detecting solar panel defects across a wide size spectrum. Shallow features offer high spatial resolution, ideal for locating small cracks, but lack semantic clarity. Deep features provide strong semantic understanding, crucial for identifying defect types, but suffer from low spatial resolution. Traditional FPN and PAN structures use a sequential top-down and bottom-up flow, which can lead to semantic dilution of shallow features and insufficient integration of fine details into deep features.

Our Multi-Scale Feature Fusion Pyramid Network (MSF-FPN) is designed to foster deeper and more direct interaction between non-adjacent layers. Let \(P_{n-2}, P_{n-1}, P_n, P_{n+1}\) represent feature maps from the backbone with progressively lower resolution (increasing \(n\) denotes deeper layers). The MSF-FPN operates in two synergistic phases: Shallow Auxiliary Fusion and Deep Auxiliary Fusion.

Phase 1: Shallow Auxiliary Fusion. This phase aims to inject high-resolution spatial details into deeper layers early on. It works from deeper to shallower layers:
$$ \begin{aligned}
P’_{n+1} &= \text{Concat}(P_{n+1}, C(P_n)) \\
P’_n &= \text{Concat}(P_n, C(P_{n-1}), U(\text{C2F}(P’_{n+1}))) \\
P’_{n-1} &= \text{Concat}(P_{n-1}, C(P_{n-2}), U(\text{C2F}(P’_n)))
\end{aligned} $$
Here, \(C(\cdot)\) denotes a convolutional layer for channel adjustment and potential downsampling, \(U(\cdot)\) denotes upsampling, and \(\text{C2F}(\cdot)\) represents the C2F module for feature refinement. This process creates preliminary fused maps \(P’\) that already contain cross-level information.

Phase 2: Deep Auxiliary Fusion. This phase takes the outputs from Phase 1 and establishes a dense web of connections to thoroughly blend semantics and details. It incorporates features from multiple sources, including the original backbone features and the fused features from other levels:
$$ \begin{aligned}
P”_{n-1} &= \text{Concat}(P_{n-1}, \text{C2F}(P’_{n-1}), U(\text{C2F}(P’_n))) \\
P”_n &= \text{Concat}(C(\text{C2F}(P’_{n-1})), C(\text{C2F}(P”_{n-1})), P_n, \text{C2F}(P’_n), U(\text{C2F}(P’_{n+1}))) \\
P”_{n+1} &= \text{Concat}(C(\text{C2F}(P’_n)), C(\text{C2F}(P”_n)), P_{n+1}, \text{C2F}(P’_{n+1}))
\end{aligned} $$
The final outputs \(P”_{n-1}, P”_n, P”_{n+1}\) are the enhanced feature pyramids fed to the detection heads. This architecture ensures that every level’s feature map is informed by a rich combination of local details from shallow layers and global context from deep layers, dramatically improving the model’s capability to detect both minute and large-scale defects on a solar panel with high accuracy.

3. Refinement of the Loss Function: Focaler-PIoU

Accurate bounding box regression is essential for precisely locating solar panel defects. The common Complete IoU (CIoU) loss considers overlap area, center-point distance, and aspect ratio. However, for irregularly shaped defects and small targets, its performance can be suboptimal. Pixel-IoU (PIoU) loss offers a more granular approach by introducing a pixel-level penalty term based on the distances between corresponding edges of the predicted and ground-truth boxes.

The PIoU penalty factor \(P\) is defined as:
$$ P = \frac{1}{4} \left( \frac{|dw_1|}{w_{gt}} + \frac{|dw_2|}{w_{gt}} + \frac{|dh_1|}{h_{gt}} + \frac{|dh_2|}{h_{gt}} \right) $$
where \(dw_1, dw_2\) are the horizontal edge distance discrepancies, \(dh_1, dh_2\) are the vertical edge distance discrepancies, and \(w_{gt}, h_{gt}\) are the width and height of the ground-truth box. This penalty is independent of the minimum enclosing box, leading to more stable gradients.

A penalty function \(f(x) = 1 – e^{-x^2}\) is applied to \(P\), and the PIoU metric and loss are derived:
$$ \text{PIoU} = \text{IoU} – f(P) $$
$$ L_{\text{PIoU}} = 1 – \text{PIoU} = L_{\text{IoU}} + f(P) $$
While PIoU improves localization, it does not explicitly address the problem of imbalanced difficulty among solar panel defect samples. Easy samples (e.g., large, high-contrast defects) can dominate the gradient, causing the model to under-optimize for hard samples (e.g., small, faint cracks).

To tackle this, we incorporate the focal modulation idea from Focaler-IoU into PIoU, creating the Focaler-PIoU loss. We define a linear interval mapping function \(\text{IoU}_{\text{focaler}}\):
$$ \text{IoU}_{\text{focaler}} =
\begin{cases}
0, & \text{IoU} < d \\
\frac{\text{IoU} – d}{u – d}, & d \leq \text{IoU} \leq u \\
1, & \text{IoU} > u
\end{cases} $$
where \([d, u]\) is a predefined interval (e.g., \([0.1, 0.5]\)). This function down-weights the loss contribution of very easy samples (\(\text{IoU} > u\)) and very hard, likely outlier samples (\(\text{IoU} < d\)), focusing the optimization effort on medium-difficulty samples which are most valuable for improving model performance.

The final Focaler-PIoU loss is formulated as:
$$ L_{\text{Focaler-PIoU}} = L_{\text{PIoU}} + \text{IoU} – \text{IoU}_{\text{focaler}} $$
This composite loss simultaneously ensures precise geometric alignment through the PIoU component and dynamically adjusts learning focus through the focal term. It guides the model to allocate more resources to regressing challenging solar panel defect bounding boxes, thereby enhancing overall detection robustness and accuracy.

4. Experimental Results and Analysis

4.1 Experimental Configuration and Dataset

All experiments were conducted on a system with an NVIDIA GeForce RTX 3070 Ti GPU. The model was implemented using PyTorch 2.1.0 and trained for 150 epochs with a batch size of 2, an initial learning rate of 0.01, and an image size of 640×640 pixels.

The dataset comprises electroluminescence images of solar panels, containing four types of internal defects: Crack, Black Core, Breakage, and Thick Line. The original 782 images were expanded to 3,150 via data augmentation techniques (rotation, noise addition, etc.). The dataset was split into training, validation, and test sets in an 8:1:1 ratio.

4.2 Evaluation Metrics

We employ standard object detection metrics to evaluate performance: Precision, Recall, mean Average Precision at IoU threshold 0.5 (mAP@0.5), and mAP over IoU thresholds from 0.5 to 0.95 with a step of 0.05 (mAP@0.5:0.95). The primary metric for overall performance is mAP@0.5.

$$ \text{Precision} = \frac{TP}{TP + FP}, \quad \text{Recall} = \frac{TP}{TP + FN} $$
$$ \text{AP} = \int_0^1 \text{Precision}(\text{Recall}) \, d\text{Recall}, \quad \text{mAP} = \frac{1}{N_{\text{class}}} \sum_{i=1}^{N_{\text{class}}} \text{AP}_i $$

where \(TP\), \(FP\), \(FN\) denote true positives, false positives, and false negatives, respectively.

4.3 Comparative Experiments

To validate the effectiveness of YOLO-RMFP, we compared it against several prominent object detection models on the solar panel defect test set. The results are summarized in the table below.

Model mAP@0.5 (%) mAP@0.5:0.95 (%) FPS GFLOPs
Faster R-CNN 86.0 52.3 134.0
Mask R-CNN 86.6 48.1 187.0
YOLOv5s 88.8 208.1 8.7
YOLOv7-tiny 84.7 103.8 13.2
YOLOv8n (Baseline) 91.1 62.8 211.1 8.1
YOLOv10n 85.7 205.7 8.4
YOLO-RMFP (Ours) 94.2 69.3 201.4 9.9

The results clearly demonstrate the superiority of YOLO-RMFP. It achieves the highest mAP@0.5 of 94.2%, surpassing the baseline YOLOv8n by 3.1 percentage points and outperforming all other compared models by a significant margin (e.g., +5.4% over YOLOv5s, +9.5% over YOLOv7-tiny). While its inference speed (201.4 FPS) is slightly lower than the baseline’s 211.1 FPS, it remains highly real-time capable. The moderate increase in computational cost (9.9 GFLOPs vs. 8.1 GFLOPs) is a worthwhile trade-off for the substantial gain in detection accuracy for solar panel defects.

4.4 Ablation Studies

We conducted systematic ablation experiments to isolate the contribution of each proposed component in YOLO-RMFP. Starting from the YOLOv8n baseline, we incrementally added the SPPRFMA module, the MSF-FPN, and the Focaler-PIoU loss. The results are presented in the following table.

SPPRFMA MSF-FPN Focaler-PIoU mAP@0.5 (%) mAP@0.5:0.95 (%) Recall (%) Precision (%) FPS
91.1 62.8 87.3 88.4 211.1
91.9 (+0.8) 64.9 (+2.1) 88.4 88.9 203.4
92.3 (+1.2) 63.4 (+0.6) 88.5 89.0 198.3
91.4 (+0.3) 63.1 (+0.3) 91.6 83.9 223.3
93.5 (+2.4) 65.1 (+2.3) 90.7 89.1 194.6
92.2 (+1.1) 64.6 (+1.8) 87.5 89.0 205.7
92.7 (+1.6) 65.3 (+2.5) 88.5 87.9 203.5
94.2 (+3.1) 69.3 (+6.5) 90.8 92.6 201.4

The ablation study reveals several key insights:
1. Each individual component contributes positively to the model’s performance. SPPRFMA and MSF-FPN provide consistent boosts in mAP@0.5 and mAP@0.5:0.95.
2. The Focaler-PIoU loss alone dramatically increases Recall (from 87.3% to 91.6%), indicating its exceptional ability to reduce missed detections of hard solar panel defect samples, though it may slightly hurt precision on easy samples.
3. The combination of any two modules yields better results than any single one, demonstrating their complementary nature.
4. The full YOLO-RMFP model, integrating all three innovations, achieves the best overall performance: a 3.1% increase in mAP@0.5, a remarkable 6.5% increase in the stricter mAP@0.5:0.95 metric, and the highest Precision of 92.6%, while maintaining a high recall of 90.8%. This confirms that the synergistic design effectively addresses the multifaceted challenges of solar panel defect detection.

4.5 Robustness Testing

Practical solar panel inspection environments are rarely ideal. Images may suffer from noise, uneven illumination, or geometric transformations. To evaluate the robustness of YOLO-RMFP, we tested both our model and the baseline YOLOv8n under various image perturbations: Gaussian noise addition, contrast enhancement, and image rotation (90° and flip). The performance, particularly on challenging defect types like Cracks and Breakages, was recorded.

Perturbation Defect Type YOLOv8n Precision (%) YOLO-RMFP Precision (%) Improvement
Contrast Enhancement Crack ~80 ~94 +14 pp
Breakage ~82 ~92 +10 pp
Added Noise Crack ~65 ~95 +30 pp
Breakage ~70 ~100 +30 pp
Image Flip Crack ~78 ~95 +17 pp
Breakage ~85 ~95 +10 pp
Rotation (90°) Crack ~93 ~95 +2 pp
Breakage ~85 ~95 +10 pp

The results are compelling. Under all simulated adverse conditions, YOLO-RMFP maintains significantly higher and more stable detection precision compared to the baseline. For instance, under heavy noise, its precision for cracks remains around 95%, while YOLOv8n’s drops to approximately 65%. This demonstrates that the attention mechanisms and enhanced feature fusion in YOLO-RMFP confer a strong degree of invariance to noise and geometric changes, making it far more reliable for real-world solar panel inspection tasks where image quality cannot be guaranteed.

5. Conclusion

This work presents YOLO-RMFP, a high-precision object detection model specifically designed for identifying internal defects in solar panels from electroluminescence images. To overcome the challenges of small target size, multi-scale variation, and complex backgrounds inherent to this task, we introduced three core innovations: the Receptive Field Mixed Attention (RFMA) mechanism for intelligent feature emphasis, the SPPRFMA module for context-aware multi-scale pooling, the MSF-FPN architecture for deep and shallow feature synergy, and the Focaler-PIoU loss for refined localization and hard sample focus.

Extensive experimental validation on a dedicated solar panel defect dataset confirms the effectiveness of our approach. YOLO-RMFP achieves state-of-the-art performance, with a mAP@0.5 of 94.2%, significantly outperforming existing models including the strong YOLOv8n baseline. It also exhibits superior robustness against common image corruptions, a critical attribute for practical deployment. The model successfully balances accuracy and speed, making it a viable solution for automated, real-time solar panel quality inspection systems, which can enhance maintenance efficiency and ensure the reliable operation of photovoltaic power stations.

Future work will focus on further optimizing the model’s computational efficiency to enable deployment on edge devices with limited resources, and exploring the integration of temporal information from video sequences for dynamic solar panel inspection.

Scroll to Top