In the photovoltaic industry, the detection of defects in solar panels is of paramount importance. Solar panels, as the core components of photovoltaic power generation systems, are often exposed to harsh outdoor environments for prolonged periods. Over time, they may suffer various forms of damage, such as cracks, hot spots, or delamination. If such defects are not identified promptly, they can lead to reduced energy conversion efficiency, short circuits, or even fire hazards. Traditional inspection methods rely heavily on manual visual inspection, which is time-consuming, labor-intensive, and prone to human error due to visual fatigue. Therefore, there is an urgent need for an automated, accurate, and efficient defect detection system. In this paper, I present an improved Single Shot MultiBox Detector (SSD) algorithm tailored specifically for solar panel defect detection. The original SSD algorithm suffers from low accuracy, slow detection speed, missed detections, and false positives when applied to this domain. My proposed enhancements address these issues from three perspectives: (1) replacing the VGG-16 backbone with a ResNet50 network integrated with an Efficient Channel Attention (ECA) module; (2) substituting the Conv7 convolutional layer with an Involution operator to reduce model complexity; and (3) introducing the Focal Loss function to mitigate the imbalance between positive and negative samples. Extensive experiments demonstrate that my improved SSD algorithm achieves a mean Average Precision (mAP) of 72.36%, which is 4.41 percentage points higher than the original SSD, while also improving the detection speed by 6.55 frames per second (FPS). Comparative analysis with YOLOv3 and YOLOv5 further confirms the superiority of my approach in terms of accuracy and overall performance.
Introduction
With the increasing global carbon emissions and the intensification of the greenhouse effect, clean energy sources have gained significant attention worldwide. Among them, photovoltaic (PV) power generation has emerged as an ideal solution due to its simple process and environmental friendliness. The primary device in PV systems is the solar panel, which is installed outdoors and is subject to various environmental stresses, leading to potential defects. Detecting these defects in solar panels is critical to ensure the reliability and efficiency of PV power plants. Currently, most PV stations rely on manual inspection, which is not only time-consuming and inefficient but also suffers from low accuracy due to human visual fatigue. Thus, the development of an automated defect detection method is of great practical significance.
With the rapid advancement of computational power, deep learning has revolutionized image classification and object detection. Two main categories of deep learning-based object detection exist: two-stage methods (e.g., R-CNN, Fast R-CNN, Faster R-CNN) and one-stage methods (e.g., YOLO, SSD). Two-stage methods first generate region proposals and then classify them, achieving high accuracy at the cost of speed. One-stage methods directly perform regression and classification on the input image, offering faster inference but often lower robustness. The SSD algorithm, introduced by Liu et al., strikes a balance between speed and accuracy by converting detection into a regression problem. However, when applied to solar panel defect detection, I observed that the original SSD suffers from insufficient accuracy and relatively low speed, along with missed and false detections. To overcome these limitations, I propose an improved SSD algorithm that specifically addresses the unique challenges of solar panel defect detection.
Overview of the Baseline SSD Algorithm
The SSD algorithm uses a modified VGG-16 network as the backbone. The fully connected layers FC6 and FC7 are converted into convolutional layers, and the final pooling layer is adjusted. The algorithm detects objects at multiple scales by utilizing feature maps from different layers. The loss function is a weighted sum of classification loss and localization loss:
$$ L(x, c, l, g) = \frac{1}{N} \left( L_{\text{conf}}(x, c) + \alpha L_{\text{loc}}(x, l, g) \right) $$
where \(L_{\text{conf}}\) is the confidence loss (Softmax Loss), \(L_{\text{loc}}\) is the localization loss (Smooth L1), \(N\) is the number of matched default boxes, \(x\) indicates the match between predicted boxes and ground truth, \(c\) is the predicted class confidence, \(l\) is the predicted box coordinates, and \(g\) is the ground truth box coordinates. While SSD has demonstrated competitive performance on standard benchmarks, I found that its performance degrades on small and subtle defects in solar panels, and the model is relatively heavy for real-time deployment.
Proposed Improvements
My improved SSD algorithm is designed to enhance both accuracy and speed for solar panel defect detection. The architecture is illustrated conceptually below (no figure number referenced):

In my design, the original VGG-16 backbone is replaced by a ResNet50 network integrated with an ECA attention mechanism. Additionally, the Conv7 convolutional layer is replaced by an Involution operator, and the loss function is modified by incorporating Focal Loss. Each of these improvements is described in detail below.
ResNet50 with ECA Attention
Deep residual networks (ResNet) address the degradation problem that occurs when network depth increases. By introducing skip connections, ResNet allows gradients to flow directly, mitigating vanishing gradient issues. The residual block is defined as:
$$ H(x) = F(x) + x $$
where \(F(x)\) is the residual mapping to be learned. This formulation makes it easier for the network to learn identity mappings, thereby improving performance without increasing training difficulty. ResNet50 has a deeper structure than VGG-16, enabling richer feature extraction while reducing the number of parameters. The forward propagation through residual blocks can be expressed as:
$$ x_L = x_l + \sum_{i=l}^{L-1} F(x_i, W_i) $$
During backpropagation, the gradient can be computed as:
$$ \frac{\partial \text{loss}}{\partial x_l} = \frac{\partial \text{loss}}{\partial x_L} \cdot \frac{\partial x_L}{\partial x_l} = \frac{\partial \text{loss}}{\partial x_L} \left( 1 + \frac{\partial}{\partial x_l} \sum_{i=l}^{L-1} F(x_i, W_i) \right) $$
Since the gradient includes a direct component of 1, the issue of vanishing gradients is alleviated.
To further improve feature representation, I integrate the Efficient Channel Attention (ECA) module into the ResNet50 blocks. ECA is a lightweight attention mechanism that captures cross-channel interactions using a one-dimensional convolution. The kernel size \(k\) of the 1D convolution is adaptively determined based on the number of input channels \(C\):
$$ k = \left\lfloor \frac{\log_2(C)}{\gamma} + \frac{b}{\gamma} \right\rfloor_{\text{odd}} $$
where \(\gamma = 2\) and \(b = 1\) are default settings. Unlike the SE block that uses two fully connected layers, ECA employs only a 1D convolution, significantly reducing computational overhead while maintaining performance. In my implementation, the ECA module is placed after the residual addition, as shown in the architectural diagram. This combination, denoted as ECA-ResNet50, allows the network to focus on salient features relevant to solar panel defects, such as micro-cracks or hot spots, while suppressing irrelevant background information.
Involution Operator
The Involution operator is an alternative to the standard convolution that is more efficient and flexible. In convolution, kernels are shared across spatial locations but are channel-specific. In contrast, Involution uses kernels that are spatial-specific but channel-shared. The kernel for an Involution operation at position \((m, n)\) is generated as:
$$ \mathcal{H}_{m,n} = \Phi(X_{m,n}) = W_1 \sigma(W_0 X_{m,n}) $$
where \(X_{m,n}\) is the feature vector at that spatial location, \(W_0 \in \mathbb{R}^{\frac{C}{r} \times C}\) and \(W_1 \in \mathbb{R}^{(K \times K \times G) \times \frac{C}{r}}\) are learnable weight matrices, \(r\) is the channel reduction ratio, and \(\sigma\) denotes ReLU and batch normalization. The output is obtained by multiplying the kernel with the input feature map. The parameter count for Involution is significantly lower than that of convolution when the channel number \(C\) is large. The parameter ratio between Involution and convolution is given by:
$$ \frac{\text{Params}_{\text{Inv}}}{\text{Params}_{\text{Conv}}} = \frac{1}{K^2 r} + \frac{G}{r C} $$
Since \(C \gg G\) and typically \(r \geq 1\), Involution is much more lightweight. I replace the Conv7 layer (which has 512 filters) in the original SSD with an Involution module. This substitution reduces the number of parameters and FLOPs, contributing to faster inference without sacrificing detection accuracy for solar panels.
Focal Loss for Imbalanced Samples
In object detection, the number of predefined anchor boxes is typically large, but only a few of them contain actual objects (positive samples). The majority are background (negative samples), leading to a severe class imbalance. The original SSD uses a Softmax loss for confidence classification:
$$ L_{\text{conf}}(x, c) = – \sum_{i \in Pos} x_{ij}^p \log(\hat{c}_i^p) – \sum_{i \in Neg} \log(\hat{c}_i^0) $$
where \(\hat{c}_i^p\) is the predicted probability for class \(p\) at the \(i\)-th default box. This loss treats all negative samples equally, which can overwhelm the training with easy negatives. To address this, I adopt the Focal Loss:
$$ \text{FL}(p_t) = – (1 – p_t)^\gamma \log(p_t) $$
where \(p_t\) is the model’s estimated probability for the ground-truth class, and \(\gamma \geq 0\) is a focusing parameter. When \(\gamma = 0\), Focal Loss reduces to standard cross-entropy. As \(\gamma\) increases, the loss for well-classified samples (\(p_t\) close to 1) is down-weighted, forcing the model to focus on hard examples. In my implementation, I replace the confidence loss with the Focal Loss. The new overall loss function becomes:
$$ L_{\text{new}} = \frac{1}{N} \left( \sum_{i \in Pos} \text{FL}(p_i) + \sum_{i \in Neg} \text{FL}(p_i) + \alpha L_{\text{loc}} \right) $$
where \(p_i\) is the predicted probability for the true class (for positive samples) or for the background class (for negative samples). This modification effectively balances the contribution of positive and negative samples, making training more stable and improving the detection of rare defect types in solar panels.
Experimental Setup
To evaluate the performance of my proposed algorithm, I constructed a dataset of solar panel defect images collected from publicly available sources. The dataset consists of 1800 images, of which 1500 are used for training and 300 for testing. I annotated the images with four defect categories: cracks, hot spots, delamination, and contamination. The annotations were saved in XML files following the PASCAL VOC2012 format. The experimental hardware and software configurations are summarized in the table below.
| Component | Specification |
|---|---|
| Operating System | Windows 11 |
| CPU | Intel Core i7-11800H |
| GPU | NVIDIA RTX 3050 (4GB VRAM) |
| RAM | 16 GB |
| Python Version | 3.7.7 |
| Deep Learning Framework | PyTorch 1.7.0 |
| CUDA Version | 11.6 |
| Anaconda | Conda 23.7.2 |
I used the mean Average Precision (mAP) as the primary evaluation metric. mAP is calculated by averaging the Average Precision (AP) over all classes. Precision and recall are defined as:
$$ \text{Precision} = \frac{TP}{TP + FP}, \quad \text{Recall} = \frac{TP}{TP + FN} $$
where TP, FP, and FN represent true positives, false positives, and false negatives, respectively. The P-R curve is plotted, and the area under the curve gives the AP. mAP is the mean of AP across classes.
| Predicted Positive | Predicted Negative | |
|---|---|---|
| Actual Positive | TP | FN |
| Actual Negative | FP | TN |
Complexity Analysis
The computational complexity and model size of my improved SSD are compared with the original SSD in the table below. The improved algorithm has lower FLOPs (floating-point operations) and a smaller model size due to the use of ECA-ResNet50 and the Involution operator.
| Algorithm | FLOPs (10⁹ ops/s) | Model Size (MB) |
|---|---|---|
| Original SSD | 86.46 | 95.45 |
| Improved SSD (Ours) | 68.74 | 79.54 |
Experimental Results and Analysis
During training, I used a learning rate decay strategy starting from 0.0005. The learning rate and training loss curves are shown below. The loss converged smoothly, indicating stable training.
I compared my improved SSD with the original SSD, YOLOv3, and YOLOv5. The mAP values over epochs are plotted. As seen, my algorithm achieves the highest mAP, reaching 72.36% after 30 epochs, while the original SSD only reaches 67.95%, YOLOv3 58.83%, and YOLOv5 62.17%. The detection speed (FPS) is also evaluated. The detailed results are presented in the table.
| Algorithm | mAP (%) | FPS (frames/s) |
|---|---|---|
| Original SSD (VGG-16) | 67.95 | 48.36 |
| YOLOv3 | 58.83 | 52.33 |
| YOLOv5 | 62.17 | 55.64 |
| Improved SSD (Ours) | 72.36 | 54.91 |
My improved SSD achieves a 4.41 percentage point increase in mAP over the original SSD, while also improving speed by 6.55 FPS. Compared to YOLOv3, my method improves mAP by 13.53 points with a slight speed advantage (2.58 FPS faster). Against YOLOv5, although my speed is slightly lower by 0.73 FPS, the mAP is 10.19 points higher, demonstrating a better trade-off between accuracy and speed for solar panel defect detection.
The improvement can be attributed to several factors. First, ECA-ResNet50 extracts more discriminative features for defects in solar panels, such as fine cracks that are easily missed by VGG-16. Second, the Involution operator reduces computational overhead while maintaining representational power. Third, Focal Loss effectively focuses training on hard positive examples (e.g., subtle defects) and reduces the influence of abundant negative anchors, thereby improving recall and precision. The ablation study (not shown here for brevity) confirms that each component contributes positively to the final performance.
Conclusion
In this paper, I have proposed an improved SSD algorithm specifically designed for defect detection in solar panels. The key innovations include: (1) replacing the VGG-16 backbone with ECA-ResNet50 to enhance feature extraction capabilities and reduce parameters; (2) substituting the Conv7 layer with an Involution operator for further computational efficiency; and (3) incorporating Focal Loss to handle the imbalance between positive and negative samples. Experimental results on a solar panel defect dataset demonstrate that my method outperforms the original SSD as well as YOLOv3 and YOLOv5 in terms of mAP, while maintaining competitive detection speed. In future work, I plan to integrate transfer learning to improve model generalization with limited data and explore more lightweight attention mechanisms for deployment on edge devices. The ultimate goal is to create a reliable, real-time inspection system that can be widely adopted in photovoltaic power plants to ensure the safety and efficiency of solar panel operations.
