Improved YOLOv11n for Solar Panel Defect Detection

In the context of global energy transition, solar energy plays an increasingly important role. The quality of a photovoltaic module directly determines the power generation efficiency and safety of the entire system. In our experiments, we found that defects such as scratches and broken grids can reduce local efficiency by 5–8%, accelerate annual power degradation to 2.8%, and shorten the service life of a solar panel by 3–5 years. Therefore, accurate and efficient detection of solar panel defects is of great practical significance.

Traditional object detection algorithms, such as Faster R-CNN and YOLO series, have been widely studied. However, for small defect targets on solar panels, the detection accuracy and speed are often contradictory. In this work, we propose an improved algorithm based on YOLOv11n to address the problems of missed detection and low accuracy when applied to solar panel defect images. Three major improvements are introduced: (1) a novel SPPF-LDESKA module in the backbone, (2) an efficient shared convolutional module (ESCM) in the neck, and (3) a lightweight shared convolutional detection head (LSCD).

We conduct all experiments on a public solar panel defect dataset containing 2400 images of 640×640 pixels. The dataset covers three defect categories: scratch, grid break, and dirt spot. The hardware environment includes NVIDIA GeForce RTX 4060 (8 GB), CUDA 12.4, PyTorch 1.7.1, and Python 3.9. Training uses SGD with an initial learning rate of 0.001, batch size 8, and 200 epochs. We employ metrics such as precision (P), recall (R), parameters, GFLOPs, and mAP50 to evaluate the models.

Proposed Method

1. SPPF-LDESKA Module

The original SPPF module in YOLOv11n can handle multi-scale inputs, but its pooling operation may cause the loss of fine details for small defects on a solar panel. To enhance feature extraction, we combine a lightweight detail-enhanced convolution (LDEConv) with the large separable kernel attention (LSKA). The LSKA mechanism uses depthwise separable convolution and dilated convolution to expand the receptive field while keeping low computational cost. The LDEConv introduces a differential detail enhancement branch that strengthens local texture and edge responses. The overall operation can be expressed as:

$$
\mathbf{D} = \mathbf{X} – \text{avgpool}(\mathbf{X})
$$

$$
\mathbf{Y} = \text{Conv}_{1\times1}\left( \text{Concat}(\mathbf{X}, \mathbf{D}) \right)
$$

where $\mathbf{X}$ is the input feature, $\mathbf{D}$ is the differential feature, and $\mathbf{Y}$ is the output after lightweight convolution and LSKA reweighting. We then integrate this module into the SPPF structure, resulting in the SPPF-LDESKA module. The configuration is compared in Table 1.

Table 1: Comparison of backbone modules
Module P (%) R (%) Parameters GFLOPs mAP50 (%)
YOLOv11n (baseline) 85.0 83.8 2,590,425 6.4 87.5
Ⅰ (depthwise separable LSKA) 81.6 75.8 2,343,537 5.7 80.1
Ⅱ (only depthwise) 85.2 83.0 3,411,809 8.6 87.2
Ⅲ (only pointwise) 86.4 81.4 3,161,045 6.3 86.0
SPPF-LSKA 86.5 83.5 2,855,633 6.5 88.0
SPPF-LDESKA (ours) 86.8 83.2 2,485,854 6.3 88.5

The SPPF-LDESKA achieves the highest precision (86.8%) and mAP50 (88.5%) while keeping a moderate parameter count. This demonstrates that the combination of detail enhancement and large separable kernel attention effectively captures small defect features from solar panel images.

2. ESCM Module (Efficient Shared Convolution Module)

In the feature pyramid network (FPN) stage of YOLOv11n, the multi-scale fusion often lacks adaptive context modulation. We design the ESCM module based on the context-guided feature modulation (CGFM) idea, but replace its channel attention part with ECA (Efficient Channel Attention) and adopt shared-weight convolution to reduce redundant computation. The ECA mechanism uses a 1D convolution along the channel dimension to enable local cross-channel interaction without dimensionality reduction, thus being lightweight. The shared convolution layer avoids repeated learning of similar features. The architecture is shown in the following equations:

$$
\mathbf{F}_{1} = \text{Conv}_{3\times3}(\mathbf{F})
$$

$$
\mathbf{F}_{2} = \text{Concat}\left( \text{Conv}_{3\times3}(\mathbf{F}_{1}), \; \text{Conv}_{3\times3,\;dilation}(\mathbf{F}_{1}) \right)
$$

$$
\mathbf{w} = \sigma\left( \text{Conv1D}_{k}(\text{GAP}(\mathbf{F}_{2})) \right)
$$

$$
\mathbf{F}_{\text{out}} = \mathbf{F}_{2} \otimes \mathbf{w}
$$

Table 2 reports the performance of different fusion modules.

Table 2: Comparison of neck modules
Module P (%) R (%) Parameters GFLOPs mAP50 (%)
YOLOv11n 85.0 83.8 2,590,425 6.4 87.5
Ⅳ (ECA only) 87.3 80.2 2,322,802 6.5 87.3
Ⅴ (shared conv only) 83.5 84.0 2,668,881 6.8 87.5
CGFM (original) 87.0 81.8 2,238,897 6.3 88.8
ESCM (ours) 88.0 82.4 2,488,546 6.3 89.7

The ESCM achieves the highest mAP50 of 89.7% with only 6.3 GFLOPs. The combination of ECA and shared convolution effectively improves multi-scale feature fusion for solar panel defects.

3. Lightweight Detection Head (LSCD)

The original detection head in YOLOv11n uses multiple 3×3 convolutions, which increases the number of parameters. We propose a lightweight shared convolutional detection head (LSCD) that adopts group normalization and shares convolutions across detection levels. The structure uses only two 3×3 convolutions with shared weights and one 1×1 convolution per branch, reducing redundant computation. Table 3 compares different detection heads.

Table 3: Comparison of detection heads
Head P (%) R (%) Parameters GFLOPs mAP50 (%)
DyHead 86.9 84.5 2,587,588 6.0 86.5
Detect-Efficient 87.7 84.2 2,599,675 6.0 87.8
Detect-LADH 88.0 85.8 2,558,776 5.9 88.0
Detect-LSCD (ours) 88.6 85.3 2,420,622 5.9 88.5

The LSCD reduces parameters to 2.42M while improving mAP50 to 88.5%. This demonstrates that sharing convolution among detection levels is beneficial for solar panel defect detection without sacrificing accuracy.

4. Ablation Study on the Full Model

We perform an ablation study to evaluate the contribution of each proposed component. The baseline is YOLOv11n. We then add SPPF-LDESKA, ESCM, and LSCD step by step. Results are shown in Table 4.

Table 4: Ablation study (√ indicates the component is used)
Model SPPF-LDESKA ESCM LSCD P (%) R (%) Params GFLOPs mAP50 (%)
YOLOv11n 85.0 83.8 2,590,425 6.4 87.5
+SPPF-LDESKA 86.8 83.2 2,485,854 6.3 88.5
+ESCM 88.0 82.4 2,488,546 6.3 89.7
+LSCD 88.6 85.3 2,420,622 5.9 88.5
+SPPF-LDESKA+ESCM 85.5 82.8 2,600,520 6.3 88.3
Full (all three) 88.8 84.1 2,461,764 6.0 89.5

The full model achieves the best precision (88.8%), mAP50 (89.5%), and reduces GFLOPs to 6.0, which is 6.25% lower than the baseline. Although the recall is slightly lower than using LSCD alone, the overall trade-off is favorable for solar panel defect detection tasks.

5. Comparison with State-of-the-Art Models

We compare our full model with several mainstream detectors on the same solar panel dataset. Results are presented in Table 5.

Table 5: Performance comparison with different models
Model P (%) R (%) Parameters GFLOPs mAP50 (%) FPS
Faster R-CNN 75.8 80.1 135,952,652 356.2 68.5 28
YOLOv5s 84.5 84.5 21,357,524 25.2 85.8 58
YOLOv7 84.6 85.8 37,889,766 145.2 85.6 93
YOLOv8n 85.5 83.3 3,006,233 8.1 87.4 94
YOLOv10n 85.6 82.0 2,708,210 8.4 87.5 98
YOLOv11n 85.0 83.8 2,590,425 6.4 87.5 102
YOLOv12s 86.5 83.2 2,601,567 6.4 86.8 101
DT-DETR 86.6 83.5 2,750,664 6.5 87.4 107
Ours 88.8 84.1 2,461,764 6.0 89.5 118

Our method achieves the highest mAP50 (89.5%) and fastest inference speed (118 FPS), while maintaining the smallest computational cost among all compared models. This demonstrates its suitability for real-time solar panel defect detection.

6. Generalization Verification on PCB Dataset

To verify the generalization ability of the proposed algorithm, we also test it on a public PCB defect dataset. Table 6 summarizes the results.

Table 6: Performance on PCB defect dataset
Model mAP50 (%) Parameters FPS
Faster R-CNN 90.8 125,952,666 25
YOLOv5s 85.3 2,237,524 56
YOLOv7 88.1 37,789,756 99
YOLOv8n 91.1 3,185,233 92
YOLOv10n 92.8 2,691,209 97
YOLOv11n 93.5 2,590,425 101
YOLOv12s 94.8 2,601,567 103
DT-DETR 94.3 2,550,664 105
Ours 95.4 2,361,764 117

The proposed model also outperforms all compared methods on the PCB dataset, achieving the highest mAP50 (95.4%) and FPS (117). This indicates that our improvements are not limited to solar panel images but can be generalized to other defect detection scenarios.

Conclusion

In this work, we have developed an improved YOLOv11n algorithm specifically designed for detecting defects on solar panels. Three key components—SPPF-LDESKA, ESCM, and LSCD—are introduced to enhance small target feature extraction, multi-scale context fusion, and detection efficiency, respectively. Extensive experiments on a solar panel defect dataset demonstrate that the proposed method improves precision by 4.5% and mAP50 by 2.3% compared to the baseline YOLOv11n, while reducing computational cost by 6.25% and achieving an inference speed of 118 FPS. Furthermore, tests on a PCB defect dataset confirm the generalization ability of the model. We believe this approach can effectively support real-time quality inspection of photovoltaic modules and contribute to the sustainable development of the solar energy industry.

Scroll to Top