Improved YOLOv11 for Solar Panel Surface Defect Detection

In this paper, we present an enhanced deep learning framework based on YOLOv11 for detecting surface defects on solar panels. Our work addresses two critical challenges in photovoltaic inspection: the high parameter count and computational cost of existing models, and the limited detection accuracy for diverse defect types under varying environmental conditions. We propose a lightweight and high-precision dual-driven architecture by replacing the backbone with StarNet-s4, integrating a novel C2PSA-SCSA attention module, introducing the CBAM block, and replacing the CIoU loss with Focaler-IoU. Extensive experiments on a self-constructed solar panel dataset demonstrate that our improved model reduces parameters by 29.55%, FLOPs by 31.25%, while improving mAP@50 from 76.4% to 79.3%. The model achieves 82.2% precision and is well-suited for edge deployment in real-world solar panel inspection systems.

The growing demand for renewable energy has accelerated the deployment of solar panel installations worldwide. However, solar panels are exposed to harsh outdoor environments, leading to various defects such as cracks, dirt accumulation, electrical damage, and snow cover. These defects can cause up to 30% loss in power generation efficiency and even pose fire risks. Traditional manual inspection is inefficient and subjective, prompting the adoption of deep learning-based automated detection. Despite progress, current models often suffer from a trade-off between accuracy and computational efficiency, especially when deployed on resource-constrained edge devices. In this work, we aim to achieve both high accuracy and low computational overhead for solar panel surface defect detection.

1. Introduction

Solar energy has become a cornerstone of the global energy transition. With the rapid expansion of photovoltaic capacity, ensuring the reliability and efficiency of solar panels is critical. Defects on solar panel surfaces, such as cracks, contamination, and electrical damage, significantly degrade performance. Automated visual inspection using deep learning has emerged as a promising solution. Among object detection algorithms, the YOLO family offers a good balance between speed and accuracy. However, the latest YOLOv11 model still exhibits excessive parameter counts and computational demands when applied to high-resolution solar panel images. Moreover, the diversity of defect scales — from tiny cracks to large snow-covered areas — poses challenges for accurate detection.

To overcome these limitations, we propose an improved YOLOv11 model tailored for solar panel defect detection. Our contributions are as follows:

  • We replace the original backbone with StarNet-s4, a lightweight feature extraction network that reduces parameters and FLOPs while maintaining representational power.
  • We design a C2PSA-SCSA module by fusing the C2PSA layer with the spatial-channel synergistic attention (SCSA) mechanism, enhancing multi-scale feature extraction without significant overhead.
  • We incorporate a convolutional block attention module (CBAM) to further refine feature maps by emphasizing defect-relevant channels and spatial regions.
  • We replace the standard CIoU loss with Focaler-IoU to better handle sample imbalance and improve bounding box regression for small and difficult defects.

We collect a dataset of solar panel images containing four defect categories: broken, normal, electrical damage, and snow-covered. Through comprehensive ablation studies and comparisons with state-of-the-art models, we demonstrate the effectiveness of our approach.

2. Related Work

Object detection methods can be broadly categorized into two-stage and one-stage detectors. Two-stage detectors like Faster R-CNN first generate region proposals and then classify them, achieving high accuracy but at the cost of speed. One-stage detectors such as SSD and YOLO directly predict bounding boxes and class probabilities, offering faster inference. In recent years, YOLO variants have dominated real-time applications due to their excellent trade-off. YOLOv11 introduces C3k2 blocks and depthwise separable convolutions in the detection head to reduce computation. However, for solar panel defect detection, the model still struggles with parameter efficiency and accuracy on visually similar defects.

Several studies have attempted to improve solar panel defect detection. For instance, Zhang et al. proposed MLCA-YOLO based on YOLOv8, achieving 92.3% mAP@50 on the PVEL-AD dataset. Hu et al. introduced CA attention into YOLOv8 to enhance localization of small defects. Guo et al. used an improved YOLOv5 to reduce false positives in photovoltaic cell inspection. Zhao et al. constructed a C3-ECA module to highlight defect features. Zhou et al. proposed YOLOv8-EL with regularization to suppress overfitting. Phan et al. used particle swarm optimization to tune hyperparameters. Masita et al. designed a Res-CNN3 framework for thermal image analysis of photovoltaic modules.

Despite these advances, most existing works do not simultaneously address model lightweighting and accuracy improvement. The star operation, introduced in StarNet, has shown that element-wise multiplication (instead of addition) can implicitly increase feature dimension without extra parameters. Inspired by this, we adopt StarNet-s4 as our backbone. Additionally, we fuse the SCSA attention into the C2PSA layer to capture both spatial and channel dependencies efficiently. Our work is the first to combine these techniques with Focaler-IoU and CBAM for solar panel defect detection.

3. Methodology

3.1 Lightweight Backbone: StarNet-s4

To reduce the model complexity, we replace the original YOLOv11 backbone with StarNet-s4. StarNet is a family of networks that leverage the “star operation” — an element-wise multiplication of two linear transforms — to implicitly expand feature dimensions without adding parameters. The core operation can be expressed as:

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

Expanding the product gives:

$$
\sum_{i=1}^{d+1}\sum_{j=1}^{d+1} \omega_i^1 \omega_j^2 x_i x_j
$$

which is equivalent to a quadratic kernel mapping. Recursively applying this operation in multiple layers yields a high-dimensional feature space. The StarNet-s4 variant uses 32 input embedding channels and a depth configuration of [3,3,12,5]. The overall architecture consists of four stages with increasing feature map width. We replace batch normalization after each depthwise convolution and use ReLU6 activations for simplicity. Table 1 summarizes the StarNet variants.

Table 1: StarNet network variants
Variant Embedding Depth FLOPs (G) Params (M)
StarNet-s1 24 [2,2,8,3] 0.42 2.9
StarNet-s2 32 [1,2,6,2] 0.53 3.7
StarNet-s3 32 [2,2,8,4] 0.74 5.8
StarNet-s4 32 [3,3,12,5] 1.05 7.5

In our model, we use the StarNet-s4 backbone, which provides a good balance between feature extraction capability and efficiency. The resulting parameter reduction compared to the original YOLOv11 backbone is significant. In our experiments, using StarNet-s4 alone reduces parameters by 29.55% and FLOPs by 31.25% while slightly improving mAP from 76.4% to 77.2%.

3.2 C2PSA-SCSA Attention Module

To enhance multi-scale feature extraction, we modify the C2PSA module by integrating the spatial-channel synergistic attention (SCSA). The SCSA module consists of two components: multi-semantic spatial attention (SMSA) and progressive channel self-attention (PCSA). The SMSA decomposes the input feature map along the spatial dimensions into K sub-features (K=4 by default) and applies depthwise separable convolutions of kernel sizes 3,5,7,9 to capture multi-scale spatial information. Then, group normalization and sigmoid activation generate spatial attention weights. The PCSA uses a single-head self-attention mechanism on the compressed channel features, guided by the spatial priors from SMSA. The complete SCSA operation can be described as:

$$
X_s = \text{SMSA}(X) = \sigma(\text{GN}(\text{Concat}(\tilde{X}^1_H,\dots,\tilde{X}^K_H))) \odot \sigma(\text{GN}(\text{Concat}(\tilde{X}^1_W,\dots,\tilde{X}^K_W))) \odot X
$$

$$
X_c = \text{PCSA}(X_s) = X_s \odot \sigma(\text{Pool}(\text{Softmax}(QK^T/\sqrt{C}) V))
$$

where \(\tilde{X}^i_H\) and \(\tilde{X}^i_W\) are processed sub-features along height and width, respectively. The final output is:

$$
\text{SCSA}(X) = X_c
$$

We insert the SCSA module after the C2PSA layer, forming the C2PSA-SCSA block. This block first extracts multi-scale features using the C2PSA structure (multiple parallel convolutions followed by concatenation), then applies SCSA to refine the feature map by focusing on defect-relevant spatial regions and channel inter-dependencies. The integration adds only a marginal overhead (0.13 M parameters and 0.1 G FLOPs) but improves the mAP by 1.3% cumulatively when combined with other improvements.

3.3 Convolutional Block Attention Module (CBAM)

To further emphasize defect features in lower layers where large-area defects (e.g., snow cover) are prominent, we introduce the CBAM. CBAM sequentially applies channel attention and spatial attention. The channel attention module computes global average pooling and max pooling, passes them through a shared MLP, and outputs channel weights:

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

The spatial attention module concatenates average and max pooled features along the channel axis, applies a 7×7 convolution, and produces spatial weights:

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

The overall CBAM operation is:

$$
X” = \text{CBAM}(X) = M_s(X’) \odot (M_c(X) \odot X)
$$

We place CBAM after the StarNet-s4 backbone to process the initial feature maps. This design helps the model focus on large defects while maintaining computational efficiency.

3.4 Focaler-IoU Loss

Bounding box regression is crucial for accurate defect localization. The original YOLOv11 uses CIoU loss, which considers overlap, center distance, and aspect ratio. However, for solar panel defects, there is significant sample imbalance: small cracks and electrical damage are harder to detect than large snow areas. To address this, we adopt the Focaler-IoU loss, which re-weights the IoU loss to focus on difficult samples. The Focaler-IoU is defined as:

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

and the loss is:

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

We set d=0.1 and u=0.9 in our experiments. This loss function focuses the regression on samples with IoU in the intermediate range, reducing the influence of easy negatives and improving the localization of challenging defects. Our ablation study shows that Focaler-IoU increases mAP by 1.0% over the baseline with StarNet-s4 and C2PSA-SCSA.

4. Experiments

4.1 Dataset Collection and Preprocessing

We collected 2000+ original images of solar panels from a photovoltaic station, covering four categories: broken, normal, electrical damage, and snow-covered. To increase diversity and avoid overfitting, we applied data augmentation including random rotation, mirror flipping, and Gaussian blur, expanding the dataset to over 5000 images. All images were resized to 640×640 pixels. The dataset was split into training (70%), validation (20%), and test (10%) sets. Table 2 shows the category distribution after augmentation.

Table 2: Dataset category distribution
Category Number of images
Broken 1250
Normal 1250
Electrical damage 1250
Snow-covered 1250

Figure above shows an example of a solar panel image without defects. The dataset includes challenging conditions such as varying lighting, shadows, and partial occlusions.

4.2 Implementation Details

We implemented our model using PyTorch 1.7.0 and CUDA 11.0. The hardware environment includes an Intel Xeon Silver 4214R CPU, 90 GB RAM, and an NVIDIA RTX 3080 Ti GPU (12 GB). Training parameters are listed in Table 3.

Table 3: Training hyperparameters
Parameter Value
Batch size 16
Initial learning rate 0.01
Learning rate schedule Cosine
Epochs 300
Input size 640×640
Optimizer SGD
Momentum 0.937
Weight decay 0.0005

4.3 Evaluation Metrics

We report the following metrics: precision (P), recall (R), mean average precision at IoU threshold 0.5 (mAP@50), model parameters (Params), and GFLOPs. Precision and recall are defined as:

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

AP per class is the area under the precision-recall curve, and mAP is the average over all classes.

$$
AP = \int_0^1 P(R) dR, \quad mAP = \frac{1}{C}\sum_{j=1}^C AP_j
$$

4.4 Ablation Studies

We conducted a series of ablation experiments to evaluate the contribution of each component. Starting from the baseline YOLOv11n, we incrementally added StarNet-s4, C2PSA-SCSA, Focaler-IoU, and CBAM. Table 4 summarizes the results.

Table 4: Ablation results on solar panel defect detection
Exp. StarNet-s4 C2PSA-SCSA Focaler-IoU CBAM mAP@50 (%) Params (M) GFLOPs
1 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 79.3 1.93 4.60

As shown, replacing the backbone with StarNet-s4 (Exp. 2) reduces parameters and FLOPs significantly while improving mAP by 0.8%. Adding C2PSA-SCSA (Exp. 3) further boosts mAP by 0.3%. Incorporating Focaler-IoU (Exp. 4) yields a 1.0% gain. Finally, adding CBAM (Exp. 9) brings the total mAP to 79.3%, an overall improvement of 2.9% over the baseline. The final model has 1.93 M parameters and 4.6 GFLOPs, making it suitable for edge deployment.

4.5 Comparison with State-of-the-Art Models

We compared our improved model with several widely used detectors: Faster R-CNN, SSD, EfficientDet, YOLOv5n, YOLOv8n, YOLOv10n, and YOLOv11n. All models were trained and evaluated on the same dataset under identical conditions. Results are listed in Table 5.

Table 5: Performance comparison with state-of-the-art models
Model P (%) mAP@50 (%) 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

Our model achieves the highest precision (82.2%) and mAP@50 (79.3%) among all lightweight models (Params < 3M). It also surpasses YOLOv11n by 2.9% in mAP while requiring 22% fewer parameters and 28% fewer FLOPs. The improvement over YOLOv8n is even more significant: +3.5% mAP with 33% fewer parameters.

4.6 Visualization and Qualitative Analysis

To validate the effectiveness of the C2PSA-SCSA module, we visualized the feature maps using Grad-CAM. Comparing the original C2PSA with C2PSA-SCSA, we observed that the attention module focuses more precisely on defect regions, such as crack edges and electrical damage hotspots, while suppressing background noise like reflections and shadows.

We also compared detection results on test images. The original YOLOv5n and YOLOv8n models exhibited missed detections and overlapping bounding boxes. YOLOv11n reduced false alarms but still struggled with small electrical damage. In contrast, our improved model correctly detected all defects in the test set without false positives or missed detections. This demonstrates the robustness of our lightweight and high-precision architecture.

5. Conclusion

In this paper, we proposed an improved YOLOv11 model for solar panel surface defect detection. By replacing the backbone with StarNet-s4, designing the C2PSA-SCSA attention block, introducing CBAM, and adopting Focaler-IoU loss, we achieved a lightweight yet accurate detector. The model reduces parameters by 29.55% and FLOPs by 31.25% compared to baseline YOLOv11n, while improving mAP@50 from 76.4% to 79.3%. Precision reaches 82.2%. Extensive experiments on our solar panel dataset confirm the effectiveness of each component and the superiority over existing methods.

The proposed method is particularly suitable for real-time inspection on edge devices, enabling efficient monitoring of large-scale photovoltaic installations. Future work will focus on expanding the dataset to include more defect types and extreme weather conditions, and exploring knowledge distillation for further model compression. Additionally, integrating temporal information from video streams could improve detection robustness against transient defects like bird droppings.

Scroll to Top