Solar energy has emerged as a pivotal renewable energy source to mitigate global warming and reduce carbon emissions. Solar panel, the core components of photovoltaic systems, require rigorous quality control during manufacturing. Traditional manual inspection methods are labor-intensive, error-prone, and inefficient. To address these challenges, we propose LPV-YOLO, a lightweight network for real-time solar panel defect detection. Our approach optimizes the YOLOv5s architecture to balance accuracy, computational efficiency, and deployability on resource-constrained devices.

1. Introduction
Solar panel is susceptible to surface defects such as cracks, hotspots, scratches, black edges, and electrical failures during production. These defects significantly degrade energy conversion efficiency and operational lifespan. Existing deep learning-based defect detection models often prioritize accuracy at the expense of computational complexity, limiting their applicability in real-time industrial scenarios. Our work introduces a lightweight network that achieves high precision while minimizing parameters and inference time.
2. Methodology
2.1 Network Architecture
LPV-YOLO integrates four components:
- Input: Resizes solar panel images to 640×640 pixels.
- Backbone: Replaces standard convolutions with GhostMConv and C3MGhost modules for parameter reduction.
- Neck: Embeds SE channel attention and MSSPPF (Multi-Scale SimAM Spatial Pyramid Pooling) for enhanced feature fusion.
- Detection Head: Retains YOLOv5s’ original structure for bounding box regression and classification.
2.2 Lightweight Module Design
To reduce model complexity, we redesign the backbone using Ghost modules and Mish activation.
Ghost Module:
Ghost modules decompose standard convolutions into two steps:
- Generate intrinsic features using regular convolutions.
- Apply cheap linear operations (e.g., depthwise convolutions) to produce redundant features.
For an input feature map with dimensions c×h×w, the computational cost of Ghost modules is:FLOPsGhost=sn⋅h′⋅w′⋅c⋅k2+(s−1)⋅sn⋅h′⋅w′⋅d2,
where n is the output channels, s is the redundancy factor, and d is the kernel size. Compared to standard convolutions, Ghost modules reduce computations by approximately s×.
Mish Activation:
Mish enhances gradient flow and generalization:fMish(x)=x⋅tanh(ln(1+ex)).
2.3 Attention Mechanisms
SimAM Attention:
Integrated into the MSSPPF module, SimAM evaluates neuron importance using an energy function:et=(t−μ^)2+2σ^2+2λ4(σ^2+λ),
where t is a target neuron, μ^ and σ^2 are mean and variance, and λ is a regularization term. Lower et indicates higher importance.
SE Attention:
The SE module recalibrates channel-wise features:X~=σ(W2⋅δ(W1⋅GAP(X)))⊗X,
where W1 and W2 are fully connected layers, δ is ReLU, and σ is sigmoid.
3. Dataset Preparation
We utilize the PV-Multi-Defect dataset containing 1,107 solar panel images (600×600 pixels) with five defect types. To address data limitations:
- Relabeling: Corrected 396 mislabeled or missing annotations.
- Augmentation: Expanded the dataset to 4,463 images using CycleGAN.
Defect Distribution:
| Defect Type | Original Count | Augmented Count |
|---|---|---|
| Cracks | 1,024 | 3,612 |
| Hotspots | 987 | 3,295 |
| Black Edges | 856 | 2,987 |
| Scratches | 743 | 2,548 |
| Electrical Failures | 485 | 1,902 |
4. Experiments
4.1 Implementation Details
Training parameters:
| Parameter | Value |
|---|---|
| Optimizer | SGD |
| Initial LR | 0.001 |
| Batch Size | 16 |
| Epochs | 300 |
| Input Resolution | 640×640 |
| IoU Threshold | 0.6 |
4.2 Performance Metrics
LPV-YOLO achieves a 93.8% mAP on solar panel defects while reducing parameters by 49% compared to YOLOv5s:
| Model | mAP (%) | Params (M) | FLOPs (G) | FPS |
|---|---|---|---|---|
| YOLOv5s | 94.4 | 7.23 | 16.5 | 91.7 |
| LPV-YOLO (Ours) | 93.8 | 3.71 | 8.3 | 70.4 |
| YOLOv7 | 92.1 | 36.9 | 104.7 | 48.2 |
| SSD300 | 89.6 | 23.8 | 62.4 | 56.3 |
| RetinaNet | 88.9 | 34.5 | 89.1 | 39.8 |
4.3 Ablation Study
| Configuration | mAP (%) | Params (M) | FLOPs (G) |
|---|---|---|---|
| Baseline (YOLOv5s) | 94.4 | 7.23 | 16.5 |
| + GhostMConv/C3MGhost | 92.1 | 3.70 | 8.2 |
| + MSSPPF | 93.5 | 3.71 | 8.3 |
| + SE Attention (LPV-YOLO) | 93.8 | 3.71 | 8.3 |
4.4 Defect-Specific Results
| Defect Type | Precision (%) | Recall (%) | AP@0.5 (%) |
|---|---|---|---|
| Cracks | 88.7 | 89.7 | 93.2 |
| Hotspots | 87.6 | 87.8 | 92.5 |
| Black Edges | 91.1 | 85.5 | 97.1 |
| Scratches | 80.1 | 85.7 | 87.0 |
| Electrical Failures | 96.0 | 96.9 | 99.1 |
5. Conclusion
LPV-YOLO addresses the trade-off between accuracy and efficiency in solar panel defect detection. By integrating Ghost modules, SimAM attention, and SE blocks, our model achieves 93.8% mAP with 3.71M parameters and 8.3 GFLOPs, making it suitable for deployment on edge devices. Future work will explore quantization and pruning for further optimization.
