In the global shift toward low-carbon energy systems, solar photovoltaic power generation has emerged as a pivotal technology for renewable energy utilization. As the core component of solar power systems, solar panels are susceptible to various surface defects such as scratches, broken grid lines, and dirt, caused by prolonged exposure to harsh outdoor environments. These defects significantly degrade the photoelectric conversion efficiency of solar panels and may induce hot‑spot effects, accelerating aging and even leading to fire hazards. Accurate and efficient detection of defects on solar panels is therefore critical for ensuring the stable operation of photovoltaic plants. However, due to the complex texture of solar panels and the low contrast between tiny defects and the background, manual inspection is often inadequate. Deep learning‑based object detection methods, especially the YOLO series, have demonstrated considerable potential in this domain. Nevertheless, existing models still struggle with identifying small defects and suppressing background interference. In this study, we propose an improved detection model, SCA‑YOLOv8n, which integrates three key innovations: a spatial‑channel reconstruction convolution (SCConv) module, a coordinate attention (CoordAtt) mechanism, and a lightweight adaptive downsampling (ADown) module. These components work synergistically to enhance multi‑scale defect feature extraction while reducing computational complexity. Experimental results show that our model achieves a mAP@0.5 of 94.4% on a solar panels defect dataset, outperforming the baseline YOLOv8n by 2.0%, while reducing parameters by 5.0% and GFLOPs by 4.9%. Furthermore, generalization tests on the PVEL‑AD dataset confirm the model’s robust cross‑scene adaptability.
1. Introduction
Solar panels are the fundamental units of photovoltaic systems, converting sunlight into electricity. Their long‑term exposure to thermal cycling, mechanical stress, and atmospheric corrosion often leads to defects such as scratches, broken fingers, and soiling. These defects not only reduce the power output of solar panels but also create local hot spots that can cause irreversible damage. Traditional manual inspection is time‑consuming and subjective, motivating the development of automated defect detection techniques. Recent advances in convolutional neural networks have enabled object detection models to identify defects with high accuracy. Two‑stage detectors like Faster R‑CNN offer strong localization, while single‑stage detectors like YOLO provide real‑time inference. Among YOLO variants, YOLOv8n is a lightweight and efficient architecture, making it suitable for deployment on resource‑constrained devices. However, its performance on solar panels defect detection is limited by insufficient sensitivity to small defects and poor discrimination between defects and background textures. To address these challenges, we propose SCA‑YOLOv8n, which enhances the backbone, neck, and downsampling stages of YOLOv8n through the following contributions:
- SCConv Module: Integrates spatial and channel reconstruction into the backbone to suppress feature redundancy and amplify defect‑related information.
- CoordAtt Mechanism: Embeds positional information into channel attention, focusing on defect regions while suppressing background noise.
- ADown Module: Replaces traditional strided convolutions with a multi‑branch lightweight downsampling block that preserves fine spatial details during resolution reduction.

2. Methodology
2.1 Overview of the SCA‑YOLOv8n Architecture
The overall architecture of SCA‑YOLOv8n retains the three‑stage design of YOLOv8n: backbone, neck, and detection head. The backbone extracts multi‑scale features using a series of convolutional blocks and C2f modules. The neck integrates a Feature Pyramid Network (FPN) with a Path Aggregation Network (PAN) to fuse features from different scales. The detection head uses decoupled classification and regression branches. Our modifications are as follows: (1) within the backbone, we insert the SCConv module after certain convolutional layers to refine spatial and channel representations; (2) in the neck, we add CoordAtt to enhance defect‑related feature responses; (3) we replace the standard stride‑2 convolutions in the backbone and neck with ADown modules to reduce computational cost while preserving defect details.
2.2 Spatial and Channel Reconstruction Convolution (SCConv)
The SCConv module is designed to reduce feature redundancy in both the spatial and channel dimensions. It consists of two sub‑modules: the Spatial Reconstruction Unit (SRU) and the Channel Reconstruction Unit (CRU). The SRU separates input features into information‑rich and information‑poor components based on learnable scaling factors from group normalization (GN). For an input feature map \( X \in \mathbb{R}^{N \times C \times H \times W} \), the SRU computes normalized features as:
$$
X_{\text{out}} = \text{GN}(X) = \gamma \frac{X – \mu}{\sqrt{\sigma^2 + \epsilon}} + \beta,
$$
where \(\mu\) and \(\sigma\) are the mean and standard deviation, \(\epsilon\) is a small constant for stability, and \(\gamma,\beta\) are trainable parameters. The scaling factor \(\gamma\) reflects the information richness of each channel. After normalization, we derive channel weights \(w_\gamma\) by softmax over \(\gamma\):
$$
w_\gamma = \{w_i\} = \frac{\gamma_i}{\sum_{j=1}^{C} \gamma_j},\quad i,j=1,\dots,C.
$$
The product \(w_\gamma \otimes \text{GN}(X)\) is then passed through a sigmoid function and a threshold to generate high‑ and low‑information masks \(W_{\text{more}}\) and \(W_{\text{less}}\):
$$
W = \text{Threshold}\big(\text{Sigmoid}(w_\gamma \otimes \text{GN}(X))\big).
$$
Finally, the feature \(X\) is multiplied by \(W_{\text{more}}\) and \(W_{\text{less}}\) to obtain weighted representations \(X^{W_{\text{more}}}\) and \(X^{W_{\text{less}}}\). A cross‑summation reconstructs these into a spatially refined feature \(X_w\). The CRU then processes \(X_w\) by splitting it into two parts at a ratio \(\alpha\): \(X_{\text{up}}\) with \(\alpha C\) channels and \(X_{\text{low}}\) with \((1-\alpha)C\) channels. \(X_{\text{up}}\) goes through grouped convolution (GWC) and pointwise convolution (PWC) to yield \(Y_1\), while \(X_{\text{low}}\) is processed by PWC and concatenated with its original to give \(Y_2\):
$$
Y_1 = \text{GWC}(X_{\text{up}}) + \text{PWC}(X_{\text{up}}), \quad Y_2 = \text{Cat}\big(\text{PWC}(X_{\text{low}}), X_{\text{low}}\big).
$$
A lightweight SK‑like fusion aggregates \(Y_1\) and \(Y_2\) via global average pooling and softmax weighting:
$$
\beta_1 = \frac{e^{S_1}}{e^{S_1}+e^{S_2}},\quad \beta_2 = \frac{e^{S_2}}{e^{S_1}+e^{S_2}},\quad Y = \beta_1 Y_1 + \beta_2 Y_2,
$$
where \(S_1,S_2\) are pooled vectors. This structure reduces channel redundancy while enhancing multi‑scale defect feature extraction, which is particularly beneficial for detecting small defects on solar panels.
2.3 Coordinate Attention (CoordAtt)
To better locate defects amidst complex background textures on solar panels, we incorporate the CoordAtt mechanism. Unlike standard channel attention, CoordAtt embeds positional information by encoding features along both horizontal and vertical directions. For an input feature \(x\), the output for the \(c\)-th channel at height \(h\) is obtained via average pooling with kernel size \((H,1)\):
$$
z_c^h(h) = \frac{1}{W}\sum_{0\le i<w} $$=""
Similarly, for width \(w\):
$$
z_c^w(w) = \frac{1}{H}\sum_{0\le j<h} $$=""
The two aggregations are concatenated and passed through a shared 1×1 convolution \(F_1\) followed by a non‑linear activation \(\delta\):
$$
f = \delta\big(F_1([z^h, z^w])\big),
$$
where \(f \in \mathbb{R}^{C/r \times (H+W)}\) is the intermediate feature. It is then split into \(f^h \in \mathbb{R}^{C/r \times H}\) and \(f^w \in \mathbb{R}^{C/r \times W}\). Two separate 1×1 convolutions \(F_h\) and \(F_w\) transform the channel dimension back to \(C\), with sigmoid activations:
$$
g^h = \sigma(F_h(f^h)), \quad g^w = \sigma(F_w(f^w)).
$$
Finally, the output is computed by element‑wise multiplication:
$$
y_c(i,j) = x_c(i,j) \cdot g_c^h(i) \cdot g_c^w(j).
$$
This mechanism enhances the response of defect‑like regions while suppressing background interference, thereby improving the model’s ability to detect subtle defects on solar panels.
2.4 Adaptive Downsampling (ADown)
Standard strided convolutions discard spatial details, which is detrimental for detecting small defects. We replace them with the ADown module, which uses a multi‑branch design to preserve information during downsampling. The ADown module first applies average pooling to smooth feature maps and aggregate receptive field information. Then it splits the channels into two branches. One branch uses a 3×3 convolution to capture local spatial features, while the other applies max pooling followed by a 1×1 convolution to focus on salient defect regions. The two branches are concatenated along the channel dimension and then passed through a 1×1 convolution to produce the downsampled output. This design reduces the spatial resolution by a factor of 2 while retaining high‑frequency details. Moreover, the use of small kernels and channel splitting keeps the computational cost low. The mathematical description of ADown is as follows:
Let the input \(X \in \mathbb{R}^{C \times H \times W}\). After average pooling with stride 2, we obtain \(X_{\text{avg}} \in \mathbb{R}^{C \times H/2 \times W/2}\). This is split into two groups: \(X_1\) and \(X_2\) each with \(C/2\) channels. Branch 1:
$$
Y_1 = \text{Conv}_{3\times3}(X_1),
$$
Branch 2:
$$
Y_2 = \text{Conv}_{1\times1}\big(\text{MaxPool}_{2\times2}(X_2)\big),
$$
Then:
$$
Y = \text{Conv}_{1\times1}\big([Y_1, Y_2]\big),
$$
where \([\cdot,\cdot]\) denotes concatenation. The final output \(Y\) has dimensions \(C \times H/2 \times W/2\). This module reduces the number of parameters and GFLOPs compared to standard convolutions, while maintaining strong feature representation for solar panels defect detection.
3. Experimental Setup
3.1 Dataset and Evaluation Metrics
We used a publicly available solar panels defect dataset sourced from Baidu PaddlePaddle, containing 2,400 images with three defect types: scratches, broken grid lines, and dirt. All defects were annotated in YOLO format. The dataset was divided into training (80%), validation (10%), and test (10%) sets. To evaluate model robustness, we also tested on the PVEL‑AD dataset, which includes 2,589 images of five defect types (linear cracks, broken fingers, black cores, thick lines, star cracks) from solar panels. Common metrics were adopted: mean Average Precision at IoU=0.5 (mAP@0.5), Precision (P), Recall (R), number of parameters, and GFLOPs.
3.2 Implementation Details
All experiments were conducted on a Windows 10 machine with an Intel Xeon Gold 6152 CPU, 30 GB RAM, and an NVIDIA GeForce RTX 3090 GPU (24 GB). The framework used was PyTorch 2.2 with CUDA 12.1. Training images were resized to 640×640, batch size 16, optimizer SGD, and total epochs 100. The input‑output configurations followed the default settings of YOLOv8n.
4. Results and Discussion
4.1 Ablation Studies
We performed six ablation experiments to evaluate the contribution of each module. The results are summarized in Table 1. The baseline YOLOv8n achieved mAP@0.5 of 92.4%. Adding SCConv (S‑YOLOv8n) raised mAP to 92.8% (+0.4%) and recall to 89.5% (+1.1%), demonstrating improved defect capture. Inserting CoordAtt (C‑YOLOv8n) increased mAP to 93.1% and precision to 88.1%. The ADown module alone (A‑YOLOv8n) improved mAP to 93.2% while reducing parameters by 9.6% and GFLOPs by 6.2%. Combining SCConv and CoordAtt (SC‑YOLOv8n) yielded mAP 93.4%. Finally, the full SCA‑YOLOv8n achieved mAP 94.4%, precision 90.7%, and recall 90.0%, with 2.86 M parameters (−5.0%) and 7.7 GFLOPs (−4.9%). These results confirm that each component contributes synergistically to accuracy and efficiency.
| Model | mAP@0.5 (%) | Precision (%) | Recall (%) | Parameters (M) | GFLOPs |
|---|---|---|---|---|---|
| YOLOv8n | 92.4 | 87.5 | 88.4 | 3.01 | 8.1 |
| S‑YOLOv8n | 92.8 | 87.7 | 89.5 | 3.12 | 8.2 |
| C‑YOLOv8n | 93.1 | 88.1 | 89.0 | 3.02 | 8.1 |
| A‑YOLOv8n | 93.2 | 89.9 | 89.5 | 2.72 | 7.6 |
| SC‑YOLOv8n | 93.4 | 88.8 | 89.2 | 3.14 | 8.2 |
| SCA‑YOLOv8n | 94.4 | 90.7 | 90.0 | 2.86 | 7.7 |
4.2 Comparison with State‑of‑the‑Art Models
We compared SCA‑YOLOv8n with several recent detectors: YOLOv8n, YOLOv9s, YOLOv11n, YOLOv12n, YOLOv13n, RT‑DETR, Hyper‑YOLO, and Mamba‑YOLO. Table 2 shows that our model achieves the highest mAP@0.5 (94.4%), precision (90.7%), and recall (90.0%). YOLOv8n and YOLOv13n perform moderately but are inferior. YOLOv12n and Mamba‑YOLO lag significantly, likely due to insufficient adaptation to the small‑defect characteristics of solar panels. Hyper‑YOLO has high precision but low recall (84.3%), indicating missed detections. These results highlight the advantage of our integrated enhancements for solar panels defect detection.
| Model | mAP@0.5 (%) | Precision (%) | Recall (%) |
|---|---|---|---|
| YOLOv8n | 92.4 | 87.5 | 88.4 |
| YOLOv9s | 91.3 | 88.7 | 87.2 |
| YOLOv11n | 91.6 | 88.2 | 87.8 |
| YOLOv12n | 88.9 | 85.1 | 85.5 |
| YOLOv13n | 92.7 | 86.6 | 88.6 |
| RT‑DETR | 92.0 | 88.9 | 89.4 |
| Hyper‑YOLO | 90.1 | 89.2 | 84.3 |
| Mamba‑YOLO | 87.3 | 84.4 | 85.1 |
| SCA‑YOLOv8n | 94.4 | 90.7 | 90.0 |
4.3 Generalization on PVEL‑AD Dataset
To verify cross‑dataset robustness, we evaluated our model on the PVEL‑AD dataset containing five defect types. Table 3 shows that SCA‑YOLOv8n achieves the best performance: mAP@0.5 86.8%, precision 82.8%, and recall 82.6%. It surpasses YOLOv8n by 1.6% in mAP, and outperforms all other models. Notably, YOLOv12n and Mamba‑YOLO fall below 84% mAP, while our model maintains a balanced precision‑recall tradeoff. This demonstrates that our improvements generalize well to different defect patterns on solar panels.
| Model | mAP@0.5 (%) | Precision (%) | Recall (%) |
|---|---|---|---|
| YOLOv8n | 85.2 | 82.0 | 81.6 |
| YOLOv9s | 84.4 | 82.7 | 79.0 |
| YOLOv11n | 84.7 | 82.5 | 80.4 |
| YOLOv12n | 83.6 | 81.9 | 80.1 |
| YOLOv13n | 85.7 | 82.3 | 80.6 |
| RT‑DETR | 85.4 | 82.4 | 81.1 |
| Mamba‑YOLO | 82.4 | 81.3 | 75.8 |
| Hyper‑YOLO | 84.9 | 82.1 | 81.9 |
| SCA‑YOLOv8n | 86.8 | 82.8 | 82.6 |
4.4 Qualitative Analysis
To further illustrate the effectiveness of our model, we compared heatmaps generated by YOLOv8n and SCA‑YOLOv8n on representative images of scratches, broken grid lines, and dirt defects. For scratch defects, the baseline model’s heatmap often spreads sparsely and fails to cover the entire defect region, whereas our model produces a more concentrated and complete activation map. In broken grid line samples, the original model shows weak responses, while SCA‑YOLOv8n yields strong alignment with the defect shape. For dirt defects, our model effectively suppresses background interference, reducing false positive activations. These qualitative observations confirm that the improvements from SCConv, CoordAtt, and ADown enhance the spatial attention and fine‑grained feature capture necessary for detecting subtle defects on solar panels.
5. Conclusion
In this work, we proposed SCA‑YOLOv8n, a lightweight and accurate defect detection model for solar panels. By integrating the SCConv module for joint spatial‑channel feature reconstruction, the CoordAtt mechanism for position‑aware attention, and the ADown module for efficient and detail‑preserving downsampling, we achieved significant performance gains. On the solar panels defect dataset, our model reached a mAP@0.5 of 94.4%, a 2.0% improvement over the baseline YOLOv8n, while reducing parameters by 5.0% and GFLOPs by 4.9%. The model also exhibited strong generalization on the PVEL‑AD dataset with mAP 86.8%. These results demonstrate that SCA‑YOLOv8n is a promising solution for practical defect inspection of solar panels, balancing high accuracy with computational efficiency. Future work will explore deployment on edge devices and extension to other types of solar panels defects.
