Improved YOLOv11 for Solar Panels Surface Defect Detection

In the context of the global “carbon neutrality” target, the photovoltaic industry has experienced rapid growth, and solar panels have become a core component of renewable energy systems. However, solar panels are constantly exposed to harsh environmental conditions, including dust, bird droppings, wind, rain, snow, and strong ultraviolet radiation. These factors lead to various surface defects such as cracks, stains, electrical damage, and snow coverage. These defects can cause up to 30% loss in power generation efficiency and may even induce short circuits or fire hazards. Therefore, accurate and efficient defect detection for solar panels is crucial for maintaining the reliability and safety of photovoltaic power plants.

Current defect detection faces two major challenges: (1) the diverse shapes and varying scales of defects on solar panels make it difficult for a single model to achieve high precision; (2) deep learning models often have millions of parameters, conflicting with the limited computational resources of edge devices. To address these issues, I propose an improved lightweight YOLOv11 model for surface defect detection of solar panels. The proposed model introduces a “lightweight–high‑precision dual‑drive architecture” by replacing the backbone with StarNet‑s4 and fusing the C2PSA module with the SCSA attention module to form C2PSA‑SCSA. Additionally, I adopt the Focaler‑IoU loss function to improve bounding box regression and incorporate the Convolutional Block Attention Module (CBAM) to enhance the feature extraction capability for large‑scale defects. Experiments demonstrate that the improved model significantly reduces parameters and computational cost while improving mean Average Precision (mAP).

This paper is organized as follows. Section 1 reviews related work on solar panel defect detection. Section 2 details the proposed improvements, including the network architecture and loss function. Section 3 presents experimental results, ablation studies, and comparisons. Section 4 concludes the paper.


1. Related Work

In the field of object detection, algorithms can be broadly divided into single‑stage detectors, such as the YOLO family, SSD, and DETR, and two‑stage detectors, such as Faster R‑CNN and its variants. For solar panel defect detection, many researchers have improved YOLO‑based models. Zhang et al. proposed MLCA‑YOLO based on YOLOv8, achieving a mAP@50 of 92.3% on the PVEL‑AD dataset. Hu et al. introduced an Improved‑YOLOv8 with a CA attention mechanism to enhance defect localization. Guo et al. used an improved YOLOv5 to reduce false and missed detections for photovoltaic cell defects. Zhao et al. constructed a C3‑ECA module in YOLOv5 to highlight defect features. Zhou et al. developed YOLOv8‑EL to suppress overfitting and alleviate multi‑scale coupling interference. Phan et al. applied particle swarm optimization to dynamically tune YOLOv8 hyperparameters. Masita et al. proposed a Res‑CNN3 framework for defect region detection in thermal images of photovoltaic modules.

Despite these advances, many existing models struggle to balance detection precision with model size and computational efficiency. Early YOLO versions, such as YOLOv8, have complex structures that are not ideal for lightweight deployment. To overcome these limitations, I propose a new architecture that leverages the efficiency of StarNet‑s4 and the synergistic attention of SCSA, together with improved loss and attention mechanisms, to create a model that is both lightweight and accurate for solar panel surface defect detection.


2. Proposed Method

2.1 Overview of the Improved Network

The baseline YOLOv11n model consists of a backbone, a neck, and a detection head. In YOLOv11, the C3k2 module replaces the C2f module of YOLOv8, and the detection head uses two depthwise convolutions with 1×1 kernels to reduce redundancy. However, the model still has a considerable number of parameters. My improved network uses StarNet‑s4 as the backbone to reduce parameters and FLOPs. I design a C2PSA‑SCSA module by integrating the SCSA attention into the C2PSA layer, which enhances multi‑scale feature extraction without adding much computational burden. I also add CBAM at the bottom of the neck to focus on large‑scale defect regions. Finally, the CIoU loss is replaced by Focaler‑IoU to improve bounding box regression for imbalanced samples.

2.2 StarNet‑s4 Backbone

StarNet‑s4 is a lightweight feature extraction network designed to reduce computational cost while maintaining representational power. It uses a stacked architecture with four stages. Each stage employs a convolution layer for spatial downsampling followed by several improved “demo” blocks that perform feature extraction. The demo block is based on the “star operation”, defined as:

$$
(W_1^T X + B_1) \times (W_2^T X + B_2) \rightarrow (W_1^T X) \times (W_2^T X)
$$

Expanding the star operation for a single layer with input dimension d gives:

$$
\omega_1^T x \cdot \omega_2^T x = \sum_{i=1}^{d+1} \omega_1^i x^i \cdot \sum_{j=1}^{d+1} \omega_2^j x^j = \sum_{i=1}^{d+1} \sum_{j=1}^{d+1} \omega_1^i \omega_2^j x^i x^j
$$

This can be written as a quadratic form. Through recursive stacking, the network can produce high‑dimensional feature interactions with fewer parameters. In each demo block, ReLU6 activation is used instead of GELU to simplify computation. Depthwise separable convolutions are applied at the end of each block to further reduce parameters. The StarNet‑s4 variant uses an embedding dimension of 32, a depth configuration of [3,3,12,5], and achieves only 1.05 GFLOPs with 7.5M parameters. When used as the backbone in YOLOv11, it significantly reduces the overall model size while preserving strong feature extraction capability for solar panel defects.

2.3 C2PSA‑SCSA Module

The C2PSA module in YOLOv11 performs multi‑branch convolutions to extract multi‑scale features. To improve the quality of attention, I fuse it with the SCSA (Synergistic Channel‑Spatial Attention) module, creating the C2PSA‑SCSA module. SCSA consists of two components: Multi‑Semantic Spatial Attention (SMSA) and Progressive Channel Self‑Attention (PCSA). SMSA splits the input feature map into K sub‑features along the channel dimension (K=4). Each sub‑feature is processed by a depthwise separable convolution with a different kernel size (3, 5, 7, 9) to capture multi‑scale spatial information. The outputs are concatenated, normalized by Group Normalization (GN), and passed through a Sigmoid function to produce spatial attention weights. The spatial modulation is given by:

$$
\text{SMSA}(X) = \text{attn}_H \times \text{attn}_W \times X
$$

where attn_H and attn_W are obtained from convolutions along the height and width dimensions respectively. Then, the PCSA module applies progressive compression via pooling, followed by a single‑head self‑attention mechanism to capture channel similarities. The final SCSA output is:

$$
\text{SCSA}(X) = \text{PCSA}(\text{SMSA}(X))
$$

By integrating SCSA into C2PSA, the module can dynamically emphasize defect‑related regions (e.g., crack edges) while suppressing background noise (e.g., reflections), all while maintaining a low parameter count due to the use of depthwise separable convolutions and channel reduction. This design contributes to the “lightweight–high‑precision dual‑drive architecture”.

2.4 Convolutional Block Attention Module (CBAM)

To further enhance detection of large‑area defects on solar panels, I insert a CBAM module at the bottom of the neck. CBAM sequentially applies channel attention and spatial attention. The channel attention module (CAM) computes two descriptors via global average pooling (GAP) and global max pooling (GMP), feeds them into a shared MLP, and generates channel weights:

$$
M_c(X) = \sigma(\text{MLP}(\text{GAP}(X)) + \text{MLP}(\text{GMP}(X)))
$$

The spatial attention module (SAM) concatenates the average‑pooled and max‑pooled features along the channel axis, applies a 7×7 convolution, and generates spatial weights:

$$
M_s(X’) = \sigma(\text{Conv}_{7\times7}(\text{Concat}(\text{AvgPool}(X’), \text{MaxPool}(X’))))
$$

The final CBAM output is:

$$
X” = M_s(M_c(X) \otimes X) \otimes (M_c(X) \otimes X)
$$

CBAM helps the model focus on defect‑related channels (e.g., crack textures) and spatial locations (e.g., damaged edges), which is particularly beneficial for large‑scale defects such as electrical damage and snow coverage on solar panels.

2.5 Focaler‑IoU Loss

In solar panel defect detection, there is often an imbalance between easy and hard samples. The original YOLOv11 uses CIoU loss, which treats all samples equally. To improve bounding box regression, I replace CIoU with Focaler‑IoU. Focaler‑IoU adjusts the focus by re‑scaling IoU values within a specified range [d, u]. The definition is:

$$
IoU^{\text{focaler}} = \begin{cases}
0, & \text{if } IoU < d \\
\frac{IoU – d}{u – d}, & \text{if } d \le IoU \le u \\
1, & \text{if } IoU > u
\end{cases}
$$

The Focaler‑IoU loss is simply:

$$
L_{\text{Focaler-IoU}} = 1 – IoU^{\text{focaler}}
$$

By focusing the loss on a specific IoU interval (e.g., d=0.2, u=0.8), the model pays more attention to moderately difficult samples (e.g., defects with ambiguous boundaries or partial occlusion), thereby improving the localization accuracy for challenging cases on solar panels.


3. Experiments and Analysis

3.1 Dataset and Experimental Setup

The dataset used in this study consists of images collected from a photovoltaic power plant. Four categories of solar panel conditions are included: broken, normal, electrical damage, and snow coverage. Approximately 500 images per category were initially captured in July and December. To enrich the dataset, data augmentation techniques such as random rotation, mirroring, and blurring were applied, resulting in over 5000 images. The input image size is 640×640 pixels. The dataset is split into training, validation, and test sets with a ratio of 7:2:1.

All experiments were conducted on a consistent hardware and software setup, as summarized in Table 1.

Table 1: Experimental environment and configuration
Parameter Value
System Windows 11 64‑bit
CPU 12 vCPU Intel Xeon Silver 4214R @ 2.40 GHz
GPU NVIDIA GeForce RTX 3080 Ti (12 GB)
Memory 90 GB
Framework PyTorch 1.7.0 + CUDA 11.0
Table 2: Training hyperparameters
Parameter Value
Batch size 16
Initial learning rate 0.01
Learning rate schedule cosine
Epochs 300
Image size 640×640
Workers 0
Optimizer SGD
Momentum 0.937
Weight decay 0.0005

3.2 Evaluation Metrics

I use mean Average Precision (mAP@0.5), precision (P), recall (R), number of parameters (Params), and computational complexity (GFLOPs) as evaluation metrics. mAP is the average of AP over all classes, where AP is computed as the area under the precision‑recall curve. Precision and recall are defined as:

$$
P = \frac{TP}{TP+FP}, \quad R = \frac{TP}{TP+FN}
$$

AP for a single class is:

$$
AP = \int_0^1 P(R) \, dR
$$

and mAP is the mean of AP across all C classes:

$$
\text{mAP} = \frac{1}{C} \sum_{j=1}^C AP_j
$$

3.3 Ablation Study

To verify the effectiveness of each improvement, I conducted an ablation study. The baseline is YOLOv11n. I incrementally add StarNet‑s4, C2PSA‑SCSA, Focaler‑IoU, and CBAM. The results are shown in Table 3.

Table 3: Ablation study results
Model StarNet‑s4 C2PSA‑SCSA Focaler‑IoU CBAM mAP@0.5 (%) Params (M) GFLOPs
1 (baseline) 76.4 2.47 6.40
2 77.2 1.74 4.40
3 77.5 1.87 4.50
4 78.5 1.89 4.50
5 77.3 1.89 4.60
6 77.4 2.48 6.35
7 77.8 1.95 4.50
8 78.0 2.40 6.32
9 (full) 79.3 1.93 4.60

From Table 3, we can see that replacing the backbone with StarNet‑s4 (Model 2) reduces parameters by 29.55% and GFLOPs by 31.25% while slightly improving mAP from 76.4% to 77.2%. Adding C2PSA‑SCSA (Model 3) further increases mAP to 77.5% with only a minor increase in parameters. Introducing Focaler‑IoU (Model 4) boosts mAP to 78.5%. The full model (Model 9) achieves the highest mAP of 79.3%, which is a 2.9% improvement over the baseline, with only 1.93M parameters and 4.6 GFLOPs. These results confirm that the “lightweight–high‑precision dual‑drive architecture” effectively balances model size and detection accuracy for solar panel defects.

3.4 Comparison with Other Detection Methods

I compared the proposed model with several popular detection algorithms on the same solar panel dataset. The results are presented in Table 4.

Table 4: Comparison of different detection methods
Method P (%) mAP@0.5 (%) Params (M) GFLOPs
Faster R‑CNN 58.3 63.5 105.43 298.5
SSD 63.6 65.9 87.32 147.9
EfficientDet 73.5 68.6 65.92 82.7
YOLOv5n 77.0 73.8 2.39 7.2
YOLOv8n 77.3 75.8 2.87 8.2
YOLOv10n 75.6 72.5 2.57 8.4
YOLOv11n 79.0 76.4 2.47 6.4
Ours 82.2 79.3 1.93 4.6

Table 4 shows that the proposed model achieves the highest precision (82.2%) and mAP@0.5 (79.3%) among all methods, while having the smallest number of parameters (1.93M) and the lowest computational cost (4.6 GFLOPs). In particular, compared to the baseline YOLOv11n, my model improves mAP by 2.9% while reducing parameters by 21.9% and GFLOPs by 28.1%. The model also outperforms YOLOv8n and YOLOv10n by significant margins. These results demonstrate that the proposed improvements are effective for solar panel surface defect detection.

3.5 Visualization of C2PSA‑SCSA

To further validate the benefit of the C2PSA‑SCSA module, I used Grad‑CAM to generate heatmaps for the original C2PSA and the proposed C2PSA‑SCSA. The heatmaps clearly show that the improved module activates defect regions more precisely and with higher contrast, especially for small defects such as cracks and for large defects such as electrical damage. The attention map becomes more focused on the defect areas and less on background, confirming the effectiveness of the synergistic spatial‑channel attention.

3.6 Detection Results

The detection results on sample images demonstrate that the baseline YOLOv11n sometimes misses small defects or produces overlapping bounding boxes. In contrast, my improved model successfully detects all defects in the test images without false positives or missed detections. The model shows robust performance under various lighting conditions and defect scales. The following figure shows a representative comparison of detection results.


4. Conclusion

In this paper, I proposed an improved YOLOv11 model for surface defect detection of solar panels. The model introduces a “lightweight–high‑precision dual‑drive architecture” by replacing the backbone with StarNet‑s4 and fusing C2PSA with SCSA attention. Additionally, I incorporated the CBAM module to enhance large‑scale defect detection and replaced the CIoU loss with Focaler‑IoU to improve bounding box regression for imbalanced samples. Experimental results show that the improved model reduces parameters by 29.55% and GFLOPs by 31.25% compared to the baseline, while increasing mAP@0.5 from 76.4% to 79.3%. The model achieves a precision of 82.2% and outperforms several state‑of‑the‑art detection methods on the solar panel dataset. The combination of lightweight design and high precision makes the proposed model well suited for deployment on edge devices in real‑world photovoltaic monitoring systems.

Future work will focus on addressing sample imbalance among different defect categories and further improving the detection of rare defect types. Expanding the dataset with more diverse defect samples under various environmental conditions will also be considered.

Scroll to Top