FEM-YOLO: A Lightweight and High-Precision Defect Detection Framework for Solar Panels

The global energy transition, driven by ambitious decarbonization goals, has positioned solar power as a cornerstone of future energy systems. With projections indicating annual global photovoltaic (PV) capacity additions will surpass 500 GW, the operational integrity of vast solar farms becomes paramount. A critical challenge in maintaining peak performance is the timely and accurate identification of defects on solar panels, such as cracks, grid-line failures, and dirt contamination. These imperfections, often subtle and small-scale, can significantly reduce power generation efficiency and lead to long-term reliability issues. Traditional inspection methods, reliant on manual visual checks or basic image processing, are inefficient, subjective, and ill-suited for the massive scale of modern installations. Consequently, automated, intelligent defect detection systems are essential for sustainable and cost-effective solar energy asset management.

Deep learning, particularly convolutional neural networks (CNNs), has revolutionized visual inspection. Object detection models are generally categorized into two-stage (e.g., Faster R-CNN, Mask R-CNN) and one-stage (e.g., SSD, YOLO series) architectures. While both have been applied to solar panel inspection with improved results, they often face a dual challenge in this domain: effectively detecting distant, small-target defects against complex backgrounds, and achieving a model complexity low enough for practical deployment on edge devices like drones or mobile inspection units. Many existing approaches focus on accuracy but result in models with high parameter counts and large memory footprints, increasing deployment costs and limiting real-time performance.

To address these intertwined issues, we propose FEM-YOLO, a novel, lightweight detection framework built upon an enhanced YOLO11n backbone. Our method introduces targeted architectural improvements to boost feature representation for small defects while aggressively optimizing computational efficiency. The core innovations include a redesigned feature extraction module, an enhanced spatial attention pathway, a novel hybrid attention mechanism, and an efficient multi-scale detection head. We demonstrate that FEM-YOLO achieves superior detection accuracy compared to state-of-the-art lightweight models while significantly reducing parameters and model size, making it an ideal solution for on-device solar panel defect inspection.

1. Related Work and Challenges

Research in automated solar panel defect detection has increasingly leveraged deep learning. Earlier works adapted two-stage detectors; for instance, some researchers improved Faster R-CNN by integrating Feature Pyramid Networks (FPN) and guided anchoring for better performance on cell surface defects. Others have explored one-stage detectors, such as enhancing SSD with novel operators like Involution and employing Focal Loss to handle class imbalance. The YOLO family, known for its speed-accuracy trade-off, is a popular choice. Recent studies have integrated various attention mechanisms (e.g., SimAM) into YOLOv5 or modified non-maximum suppression strategies in YOLOv8 to improve results. Some approaches focus on fusing global and local features to enhance the model’s focus on defective regions.

Despite these advances, a significant gap remains. First, the problem of small-target defect detection in complex, often noisy backgrounds—typical in aerial imagery from UAVs—is not sufficiently addressed. Features of tiny cracks or spots can be easily weakened or lost during deep network propagation. Second, many high-performing models are computationally heavy. Deploying such models for real-time, large-area inspection of solar panels requires substantial computational resources, increasing the cost and complexity of the inspection system. Our work specifically targets these two challenges: enhancing the network’s sensitivity to multi-scale, small defects and constructing a highly efficient architecture suitable for edge deployment.

2. The Proposed FEM-YOLO Framework

The overall architecture of FEM-YOLO is illustrated below. It retains the efficient baseline of YOLO11n but introduces critical modifications across the backbone, neck, and head components to achieve a better balance between discriminative power and model lightness.

2.1 C3k2-Faster-EMA: Efficient and Attentive Feature Learning

The standard bottleneck modules in CNNs can be computationally redundant, especially for processing features of widespread solar panel arrays. We propose a new fundamental building block, C3k2-Faster-EMA, to replace the original C3k2 module. This block synergistically combines the lightweight FasterBlock with the multi-scale Efficient Multi-scale Attention (EMA) mechanism.

The FasterBlock employs Partial Convolution (PConv), which applies spatial convolution only to a subset of input channels (e.g., the first quarter). The remaining channels are kept unchanged. This drastically reduces computational cost and memory access. The Floating-Point Operations (FLOPs) for PConv are given by:

$$ FLOPs = h \times w \times k^2 \times c_p $$

where \(h\) and \(w\) are spatial dimensions, \(k\) is the kernel size, and \(c_p = c / 4\) is the number of channels processed by convolution.

The EMA attention module processes features in parallel branches: one branch applies 1D horizontal and vertical global pooling to capture long-range dependencies, another uses a standard 3×3 convolution for local context. The outputs are fused and processed to generate spatial and channel attention weights, which adaptively highlight important features across scales. Integrating EMA after PConv allows the network to efficiently focus computational resources on the most salient defect features across different scales, which is crucial for detecting both large stains and fine cracks on solar panels.

2.2 C2PSA-Mona: Enhanced Spatial Feature Adaptation

To further refine feature representation in the neck of the network, we augment the C2PSA module with a Multi-cognitive Visual Adapter (Mona). The original C2PSA uses a Positioning-Sensitive Attention (PSA) block. The Mona module enhances this by employing a parallel set of depthwise separable convolutions with different kernel sizes (3×3, 5×5, 7×7) to capture multi-granularity local visual patterns—highly suitable for the textured surfaces of solar panels. Multiple skip connections are added to preserve original features and facilitate gradient flow. The forward process can be summarized as:

$$ \text{Mona}(X) = X + W_{up} \cdot H_{\text{MCF}}(\text{Norm}(X)) $$

$$ \text{Norm}(X) = \text{ScaledLN}(X) $$

$$ H_{\text{MCF}}(X) = \text{Aggregation}(\text{DepthwiseConv}_k(\text{GeLU}(W_{down} X))) $$

This structure adds minimal parameters but significantly boosts the model’s ability to discern subtle defect patterns from background texture.

2.3 MLCA: Mixed Local Channel Attention for Robust Feature Enhancement

Attention mechanisms are vital for focusing on defect regions. We introduce a Mixed Local Channel Attention (MLCA) module at the end of the backbone. Unlike conventional attention that may dilute features, MLCA jointly models channel-wise and spatial-wise relationships in a computationally efficient manner. It uses a dual-path design: one path extracts local spatial features via local pooling, and another captures global channel statistics via global average pooling. Both are processed through efficient 1D convolutions, where the kernel size \(k\) is adaptively determined based on the channel dimension \(C\):

$$ k = \frac{\log_2(C)}{\gamma} + \frac{b}{\gamma} $$

Here, \(\gamma\) and \(b\) are scaling and offset constants. The outputs are then combined to produce a refined feature map. This hybrid attention mechanism increases the network’s robustness in diverse inspection conditions (e.g., varying lighting, angles) for solar panels, ensuring consistent feature extraction.

2.4 P2-EfficientHead: High-Resolution Detection with Shared Computation

Small defects on solar panels, such as early-stage micro-cracks, are often lost in the deeper, low-resolution feature maps. To tackle this, we add a dedicated P2 detection layer operating on a high-resolution (160×160) feature map from the earlier stages of the network. This provides finer spatial details crucial for small object localization.

Furthermore, we redesign the detection head for efficiency. The original YOLO head uses separate branches for classification and regression. Our proposed EfficientHead consolidates initial processing with shared convolutional layers before branching into task-specific 1×1 convolutions. This parameter-sharing strategy reduces redundancy. The new head, coupled with the P2 layer, is termed P2-EfficientHead. It enhances small-defect detection capability while keeping computational overhead in check, which is vital for processing high-throughput imagery from solar panel farms.

3. Experiments and Results

We evaluate FEM-YOLO on a publicly available dataset from Baidu AI Studio, containing images of solar panels with three defect types: Crack, Grid, and Spot. The dataset was augmented to 2400 images and split into training, validation, and test sets.

3.1 Ablation Studies

Ablation studies confirm the contribution of each proposed component. The baseline is the standard YOLO11n. We sequentially add the improvements: A (C3k2-Faster-EMA), B (C2PSA-Mona), C (MLCA), and D (P2-EfficientHead). The results are summarized below.

Baseline A B C D Precision (%) mAP50 (%) mAP50-95 (%) Params (M) Size (MiB)
87.7 93.7 51.1 2.6 5.2
90.8 94.4 51.7 2.3 4.7
90.6 94.7 51.6 2.3 4.7
89.5 94.7 52.1 2.3 4.7
88.2 95.6 53.0 2.1 4.4

The complete FEM-YOLO model (A+B+C+D) achieves the highest mAP50 and mAP50-95 (95.6% and 53.0%, a 1.9% improvement over baseline) while simultaneously reducing parameters by 19.2% and model size to 4.4 MiB.

3.2 Module-Specific and Attention Mechanism Comparisons

We further dissect the contribution of the C3k2-Faster-EMA module by comparing it against its sub-components and other attention mechanisms integrated into our framework.

Module Variant mAP50 (%) mAP50-95 (%) Params (M)
Original C3k2 94.3 48.2 2.3
C3k2-Faster 95.3 49.8 2.1
C3k2-EMA 95.2 51.2 2.3
C3k2-Faster-EMA (Ours) 95.6 53.0 2.1

Comparing different attention mechanisms placed in the backbone shows MLCA’s superiority:

Attention Mechanism mAP50 (%) mAP50-95 (%) FPS
None (Baseline) 94.5 49.6 124.5
SimAM 94.0 49.3 121.0
CAFM 94.0 49.6 102.1
MLCA (Ours) 95.6 53.0 145.2

3.3 Comparison with State-of-the-Art Models

We compare FEM-YOLO against other lightweight and recent detection models on the solar panel defect test set. The metrics include mean Average Precision (mAP), parameter count, model size, and inference speed (FPS).

Model mAP50 (%) mAP50-95 (%) Params (M) Size (MiB) FPS
YOLOv5n 91.8 48.1 2.2 4.5 191.6
YOLOv8n (Reported in Lit.) 89.5 49.8 2.7
YOLOv10n 92.7 47.8 2.3 5.5 198.4
YOLO11n (Baseline) 93.7 51.1 2.6 5.2 175.5
YOLO12n 92.1 46.1 2.5 5.2 134.1
RT-DETR-R18 92.1 48.0 19.8 81.2 200.1
FEM-YOLO (Ours) 95.6 53.0 2.1 4.4 145.2

FEM-YOLO achieves the highest accuracy metrics among comparable lightweight models. While RT-DETR-R18 has a higher FPS, it carries nearly 10x the parameters. Our model provides an excellent balance, offering superior precision for solar panel defect detection with minimal resource footprint.

3.4 Per-Defect Performance and Visualization

The improved detection capability is consistent across defect types, especially for challenging small targets like cracks.

Model AP50 Crack (%) AP50 Grid (%) AP50 Spot (%)
YOLO11n 92.9 94.2 94.2
YOLO12n 88.2 93.0 95.3
FEM-YOLO 96.6 95.7 94.5

Visual comparisons and GradCAM++ heatmaps confirm that FEM-YOLO focuses more precisely on actual defect regions, reducing false positives on complex backgrounds and improving localization of small cracks on the solar panels.

4. Conclusion

In this work, we presented FEM-YOLO, a highly efficient and accurate deep learning framework for automated defect inspection in solar panels. The model addresses the critical challenges of small-target detection and operational deployment by introducing a suite of synergistic improvements: the C3k2-Faster-EMA module for efficient multi-scale feature learning, the C2PSA-Mona block for enhanced spatial adaptation, the MLCA mechanism for robust feature refinement, and the P2-EfficientHead for high-resolution small-defect detection. Comprehensive experiments demonstrate that FEM-YOLO outperforms state-of-the-art lightweight models in detection accuracy (achieving 95.6% mAP50) while simultaneously reducing model parameters to 2.1M and size to 4.4 MiB. This combination of high precision and compact form factor makes FEM-YOLO particularly suitable for integration into drone-based or portable edge-computing systems for large-scale, real-time health monitoring of solar photovoltaic installations, contributing to more efficient and sustainable solar energy operations.

Scroll to Top