Lightweight Solar Panel Defect Detection Network Based on Improved YOLOv5s

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:

  1. Input: Resizes solar panel images to 640×640 pixels.
  2. Backbone: Replaces standard convolutions with GhostMConv and C3MGhost modules for parameter reduction.
  3. Neck: Embeds SE channel attention and MSSPPF (Multi-Scale SimAM Spatial Pyramid Pooling) for enhanced feature fusion.
  4. 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:

  1. Generate intrinsic features using regular convolutions.
  2. 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′⋅ck2+(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:

  1. Relabeling: Corrected 396 mislabeled or missing annotations.
  2. Augmentation: Expanded the dataset to 4,463 images using CycleGAN.

Defect Distribution:

Defect TypeOriginal CountAugmented Count
Cracks1,0243,612
Hotspots9873,295
Black Edges8562,987
Scratches7432,548
Electrical Failures4851,902

4. Experiments

4.1 Implementation Details

Training parameters:

ParameterValue
OptimizerSGD
Initial LR0.001
Batch Size16
Epochs300
Input Resolution640×640
IoU Threshold0.6

4.2 Performance Metrics

LPV-YOLO achieves a ​93.8% mAP on solar panel defects while reducing parameters by 49% compared to YOLOv5s:

ModelmAP (%)Params (M)FLOPs (G)FPS
YOLOv5s94.47.2316.591.7
LPV-YOLO (Ours)93.83.718.370.4
YOLOv792.136.9104.748.2
SSD30089.623.862.456.3
RetinaNet88.934.589.139.8

4.3 Ablation Study

ConfigurationmAP (%)Params (M)FLOPs (G)
Baseline (YOLOv5s)94.47.2316.5
+ GhostMConv/C3MGhost92.13.708.2
+ MSSPPF93.53.718.3
+ SE Attention (LPV-YOLO)93.83.718.3

4.4 Defect-Specific Results

Defect TypePrecision (%)Recall (%)AP@0.5 (%)
Cracks88.789.793.2
Hotspots87.687.892.5
Black Edges91.185.597.1
Scratches80.185.787.0
Electrical Failures96.096.999.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.

Scroll to Top