In this paper, I propose a lightweight network named LPV-YOLO for detecting surface defects on solar panels. The base model is YOLOv5s. To reduce the number of parameters, I design two modules: GhostMConv and C3MGhost, which integrate the Ghost module and the Mish activation function. These modules replace the original Conv and C3 blocks in the backbone, achieving a lightweight backbone. To compensate for the accuracy loss caused by lightweighting, I propose an attention pyramid pooling module (MSSPPF) that combines SimAM attention with spatial pyramid pooling. This module does not increase parameters or computational cost. Furthermore, I embed SE channel attention in the neck network to enhance the model’s ability to capture key defect information. Experiments show that compared with the original YOLOv5s, the improved LPV-YOLO reduces parameters by 49%, model size by 46%, and computational cost by 50%, while the mAP only drops by 0.6% to 93.8%. The frame rate reaches 70.42 FPS, meeting real-time requirements. Compared with YOLOv7, SSD300, and RetinaNet, LPV-YOLO achieves the best detection accuracy with the smallest parameter count. This model significantly reduces complexity while maintaining high accuracy, providing an effective solution for solar panel defect detection on resource-limited mobile devices.
Solar energy is one of the most important renewable energy sources. Solar panels are the core components of photovoltaic power generation systems. The quality of solar panels directly affects the efficiency and lifespan of the entire system. During the manufacturing process, various defects such as cracks, scratches, hot spots, black edges, and dead cells may appear. Detecting these defects in a timely manner is crucial for improving production quality and efficiency. Traditional manual inspection methods are inefficient, costly, and prone to missed detections. With the rapid development of deep learning, many researchers have applied convolutional neural networks to defect detection tasks. However, most existing methods for solar panel defect detection suffer from large model sizes, high computational complexity, and difficulty in balancing speed and accuracy. Therefore, I aim to develop a lightweight yet accurate detection network suitable for deployment on edge devices.
Many studies have focused on improving defect detection accuracy. For example, some researchers used attention mechanisms or feature fusion to enhance feature extraction. However, these methods often increase model complexity. In contrast, lightweight networks like MobileNet and GhostNet have been proposed for mobile vision tasks. GhostNet uses cheap linear operations to generate redundant feature maps, significantly reducing computational cost. Inspired by this, I adopt Ghost modules to redesign the backbone of YOLOv5s. Additionally, I replace the traditional ReLU or Leaky ReLU with Mish activation, which is smoother and helps avoid overfitting. To further compensate for the loss of accuracy, I introduce a modified spatial pyramid pooling module with SimAM attention, which does not add extra parameters. Finally, I add SE attention in the neck to emphasize informative channels.
Figure (a) shows the overall architecture of LPV-YOLO. The network consists of an input layer, a lightweight backbone, a neck with attention, and a detection head. In the backbone, I use GhostMConv and C3MGhost to replace the original Conv and C3 modules. GhostMConv is built by combining a Ghost Bottleneck with Mish-activated convolutions. C3MGhost is a CSP-like structure using Ghost modules. These modules reduce parameters and FLOPs while maintaining representational power. At the end of the backbone, I insert the MSSPPF module, which performs serial max-pooling and then applies SimAM attention to weight the pooled features. This module enhances multi-scale feature fusion without additional parameters. In the neck, I embed SE blocks after each C3MGhost module to recalibrate channel-wise feature responses. The detection head remains the same as YOLOv5s, predicting bounding boxes and class probabilities at three scales.
The Ghost module is a key component. Given an input feature map with channels c, height h, and width w, a standard convolution with kernel size k produces n output channels with computational cost:
$$ \text{Cost}_{\text{standard}} = n \cdot h’ \cdot w’ \cdot c \cdot k \cdot k $$
The Ghost module splits this process into two steps: first, a small number of intrinsic feature maps are generated using standard convolution (with n/s channels), then a series of cheap linear operations (each with kernel size d) produce the remaining (s-1)n/s ghost feature maps. The total cost is:
$$ \text{Cost}_{\text{Ghost}} = \frac{n}{s} \cdot h’ \cdot w’ \cdot c \cdot k \cdot k + (s-1) \cdot \frac{n}{s} \cdot h’ \cdot w’ \cdot d \cdot d $$
The compression ratio rs is approximately s, since c is usually large. This drastically reduces computations.
Mish activation is defined as:
$$ f_{\text{Mish}}(x) = x \cdot \tanh(\ln(1 + e^x)) $$
It outperforms ReLU in many tasks due to its smoothness and self-regularization properties.
SimAM attention is a parameter-free attention module. It evaluates the importance of each neuron by computing an energy function:
$$ e_t = \frac{4(\hat{\sigma}^2 + \lambda)}{(t – \hat{\mu})^2 + 2\hat{\sigma}^2 + 2\lambda} $$
where t is the target neuron, \hat{\mu} and \hat{\sigma}^2 are the mean and variance of all neurons on the same channel. A lower energy means the neuron is more distinct and thus more important. The output feature is obtained by:
$$ \tilde{X} = \text{sigmoid}\left(\frac{1}{E}\right) \odot X $$
where E is the matrix of all et across spatial and channel dimensions. SimAM does not introduce any learnable parameters.
SE attention is a classic channel attention mechanism. It applies global average pooling to squeeze spatial information, then uses two fully connected layers to generate channel weights, and finally multiplies the original feature map by these weights. This helps the model focus on informative channels.
I conducted experiments on the PV-Multi-Defect dataset. This dataset originally contained 1,107 images with 4,235 annotations. After re-annotating with labelimg, the annotation count increased to 4,631. To address class imbalance, I used Cycle-GAN to generate additional defective images, expanding the dataset to 4,463 images with 14,444 annotations. The augmentations significantly improved model generalization. The dataset includes five defect types: crack, scratch, hot spot, black edge, and dead cell. Each type has different shapes and scales.
I trained all models using the following hyperparameters:
| Parameter | Value |
|---|---|
| Optimizer | SGD |
| Epochs | 300 |
| Batch Size | 16 |
| Momentum | 0.937 |
| Initial Learning Rate | 0.001 |
| Weight Decay | 0.0005 |
| IoU Threshold | 0.6 |
Input images were resized to 640×640 pixels.
I use mean average precision (mAP@0.5), parameters, model size (MB), FLOPs, and FPS as evaluation metrics. Precision and recall are defined as:
$$ P = \frac{TP}{TP + FP}, \quad R = \frac{TP}{TP + FN} $$
AP is the area under the precision-recall curve, and mAP is the mean AP over all classes.
Table 1 shows the detection results for each defect type on LPV-YOLO.
| Defect | Precision | Recall | mAP@0.5 |
|---|---|---|---|
| Crack | 88.7 | 89.7 | 93.2 |
| Hot Spot | 87.6 | 87.8 | 92.5 |
| Black Edge | 91.1 | 85.5 | 97.1 |
| Scratch | 80.1 | 85.7 | 87.0 |
| Dead Cell | 96.0 | 96.9 | 99.1 |
| All | 88.7 | 91.1 | 93.8 |
As shown, LPV-YOLO achieves high accuracy on all defect types, especially for dead cell (99.1%) and black edge (97.1%). Even scratch, the most challenging defect, reaches 87.0% mAP.
I performed a series of ablation studies to verify each component’s effectiveness. The baseline is YOLOv5s (BL). I successively added MGhost (GhostMConv + C3MGhost), MSSPPF, and SE. Results are summarized in Table 2.
| Model | mAP (%) | Params (×106) | Size (MB) | FLOPs (G) | FPS |
|---|---|---|---|---|---|
| BL | 94.4 | 7.23 | 13.7 | 16.5 | 91.74 |
| BL+MGhost | 92.1 | 3.70 | 7.42 | 8.2 | 67.11 |
| BL+MGhost+MSSPPF | 93.3 | 3.70 | 7.36 | 8.2 | 65.52 |
| LPV-YOLO (full) | 93.8 | 3.71 | 7.40 | 8.3 | 70.42 |
From Table 2, we can see that MGhost significantly reduces parameters and FLOPs (by about 49% and 50% respectively) while causing only a 2.3% drop in mAP. Adding MSSPPF improves mAP by 1.2% without any parameter increase. Finally, adding SE attention boosts mAP by another 0.5%, while the parameter count only marginally increases. The final LPV-YOLO achieves a good balance between efficiency and accuracy.
I also compared LPV-YOLO with other popular detection networks using the same dataset. Table 3 shows the comparison results.
| Model | mAP (%) | Params (×106) | Size (MB) | FLOPs (G) | FPS |
|---|---|---|---|---|---|
| YOLOv5s | 94.4 | 7.23 | 13.7 | 16.5 | 91.74 |
| YOLOv7 | 88.0 | 9.33 | 19.0 | 26.7 | 107.53 |
| SSD300 | 77.7 | 34.30 | 90.0 | 51.6 | 71.00 |
| RetinaNet | 72.2 | 41.90 | 139.0 | 212.0 | 42.90 |
| LPV-YOLO | 93.8 | 3.71 | 7.4 | 8.3 | 70.42 |
LPV-YOLO achieves the second highest mAP (93.8%) only slightly lower than YOLOv5s (94.4%) but with far fewer parameters and FLOPs. It outperforms YOLOv7, SSD300, and RetinaNet by significant margins. The model size is only 7.4 MB, making it suitable for edge deployment. The frame rate is 70.42 FPS, which satisfies real-time requirements for most industrial applications.
Below is an example of a solar panel defect detection scenario.

The loss curves during training (not displayed here) show that the model converges smoothly. The localization loss is around 0.03, classification loss is near zero, and confidence loss is below 0.015, indicating high-quality predictions.
In conclusion, I proposed LPV-YOLO, a lightweight network for solar panel defect detection. By integrating Ghost modules, Mish activation, an enhanced pyramid pooling with SimAM attention, and SE channel attention, the model achieves a parameter reduction of 49% and FLOPs reduction of 50% compared to YOLOv5s, while maintaining high mAP of 93.8%. The model runs at 70 FPS, meeting real-time requirements. This makes LPV-YOLO an ideal candidate for deployment on mobile devices or embedded systems in solar panel production lines. Future work could explore further quantization or pruning to enable deployment on even more resource-constrained hardware.
