Solar panels play a vital role in the global transition to renewable energy, especially under the “dual carbon” targets. However, during manufacturing, installation, and operation, solar panels are prone to defects such as cracks, grid breaks, and stains. These defects directly reduce power generation efficiency and may cause safety hazards. Traditional manual inspection or simple image processing methods suffer from low efficiency and high false detection rates, failing to meet the intelligent operation and maintenance needs of large-scale photovoltaic plants. Deep learning-based object detection has shown great promise, but existing algorithms often struggle with small-target defects in complex backgrounds and have high model complexity, making deployment on edge devices difficult. In this work, we propose an improved YOLO11n algorithm, named FEM-YOLO, which achieves higher detection accuracy for solar panel defects while significantly reducing model size and computational cost.
The challenge of detecting solar panel defects lies in the fact that the defects are often tiny (e.g., thin cracks or broken grid lines) and easily confused with noise or background textures. Moreover, images captured by drones may suffer from motion blur. Convolutional neural networks tend to lose fine-grained features as the network deepens, and the original YOLO11n model, while lightweight, still has redundant parameters. To address these issues, we introduce four key improvements: (1) a modified C3k2 module that integrates FasterBlock and efficient multi-scale attention (EMA) to enhance feature extraction while reducing computation; (2) a new C2PSA module augmented with a multi-cognitive visual adapter (Mona) to better process visual signals; (3) a mixed local channel attention (MLCA) mechanism placed in the backbone to improve robustness of feature representation; and (4) an additional P2 small-object detection layer combined with an efficient detection head (EfficientHead) to boost small-target detection and further reduce model complexity. The following figure shows an example of a solar panel with typical defects, illustrating the detection scenario we target.

Methodology
Improved C3k2 Module with Faster-EMA
The original C3k2 module in YOLO11n uses either a C3k or a Bottleneck submodule. We replace the Bottleneck with a new Faster-EMA block, which combines the FasterBlock from FasterNet with the efficient multi-scale attention (EMA) mechanism. The FasterBlock employs partial convolution (PConv) that performs convolution only on a subset of input channels, drastically reducing floating-point operations (FLOPs). Specifically, PConv only processes the first quarter of the channels with a regular convolution, while the remaining channels are directly passed through. The FLOPs for PConv are given by:
$$FLOPS = h \times w \times k^2 \times (c/4)^2$$
where h and w are the height and width of the feature map, k is the kernel size, and c is the number of input channels. This design reduces computation by a factor of about 16 compared to standard convolution on all channels. Following PConv, a pointwise convolution is applied to mix channel information, forming the FasterBlock. We then append the EMA attention module after the FasterBlock to capture cross-scale feature interactions. The EMA module splits the input into three parallel branches: horizontal global pooling, vertical global pooling, and a 3×3 convolution. The pooled outputs are concatenated and fused via a 1×1 convolution, followed by Sigmoid activation. A 2D global average pooling and Softmax are used to generate channel-spatial attention maps. The final output is a weighted combination of the branches, enhancing the representation of defect-related details. The combined Faster-EMA block is inserted into the C3k2 module when C3k=False; when C3k=True, the inner Bottleneck of the C3k submodule is also replaced. This modification reduces the parameter count of the backbone by approximately 30% while improving the ability to detect small defects like cracks and grid breaks.
Improved C2PSA Module with Mona Adapter
The C2PSA module in YOLO11n consists of a CSP (cross stage partial) structure with PSA (positioning system architecture) blocks. However, the standard attention in PSA does not fully exploit multi-scale features. We introduce the Mona (multi-cognitive visual adapter) module into the C2PSA to enhance feature extraction and representation. Mona uses three parallel depthwise separable convolutions with kernel sizes 3×3, 5×5, and 7×7, capturing multi-scale visual local features with extremely low parameters. Four skip connections are added before and after the convolution group and the 1×1 aggregation layer to preserve original features and fuse multi-scale information, preventing gradient vanishing. The forward propagation of Mona is defined as:
$$ \text{Mona}(\mathbf{X}) = \mathbf{X} + \mathbf{W}_{\text{up}} \times \text{HMCF}(\mathbf{X}_{\text{norm}})$$
$$ \mathbf{X}_{\text{norm}} = \text{ScaledLN}(\mathbf{X})$$
$$ \text{HMCF}(\mathbf{X}_{\text{norm}}) = \text{Aggregation}(\text{DepthwiseConv}_k(\text{GeLU}(\mathbf{W}_{\text{down}} \mathbf{X}_{\text{norm}})))$$
where ScaledLN is a layer normalization with scaling, and HMCF denotes the hierarchical multi-scale convolutional fusion. The Mona module adds only about 5% additional parameters to the backbone but significantly improves the model’s ability to handle varying defect sizes and textures. By integrating Mona into C2PSA, the updated module (C2PSA-Mona) provides richer feature representations for downstream detection heads.
MLCA Attention in Backbone
To further improve feature discrimination, we incorporate the Mixed Local Channel Attention (MLCA) module into the backbone network. MLCA jointly models spatial and channel feature correlations using a dual-branch architecture: a local spatial branch and a global channel branch. The local branch applies local pooling to extract fine-grained spatial information with a kernel size ks, producing a feature vector of dimension 1×C×ks×ks. The global branch uses global average pooling to capture channel-wise statistics. Both branches are processed by 1D convolution (Conv1d) to generate channel weights. The kernel size k for Conv1d is adaptively determined by:
$$ k = \frac{\log_2 C}{\gamma} + \frac{b}{\gamma} \ \ \text{odd}$$
where γ is a scaling factor and b is an offset. After the 1D convolution, the local and global features are unpooled back to the original spatial resolution and fused through a weighted combination. The final attention map is produced by Sigmoid activation. MLCA effectively enhances the response of defect regions while suppressing background noise, and its lightweight design (using 1D convolutions and parameter sharing) keeps the additional parameter count very small. In our model, we place the MLCA module after the last convolutional stage of the backbone, just before the SPPF layer, to refine the highest-level features.
P2 Detection Layer and EfficientHead
The original YOLO11n uses three detection scales: 20×20, 40×40, and 80×80. For tiny defects on solar panels (e.g., thin cracks only a few pixels wide), even the 80×80 scale may not be sufficient. We add a fourth detection layer at a 1/4 downsampling ratio (P2) with a resolution of 160×160, using high-resolution shallow features from the second convolutional stage. This P2 layer is integrated into the neck via a top-down feature fusion path: we up-sample the 80×80 feature map and concatenate it with the 160×160 shallow features, followed by a Conv-BN-SiLU block. This provides richer spatial detail for small-object detection.
Simultaneously, we replace the original decoupled detection head with an EfficientHead. The original head has two parallel branches: a classification branch with two depthwise separable convolutions and a regression branch with two standard convolutions, leading to redundant computation. EfficientHead simplifies this by first applying two consecutive 3×3 convolutions (shared for both tasks) to enhance and reduce feature dimensionality, then splitting into two independent 1×1 convolution layers: one for classification (with Softmax) and one for bounding box regression (with 4×reg_max outputs for CIoU loss). The structure is:
$$ \text{Input} \rightarrow \text{Conv}3\times3 \rightarrow \text{Conv}3\times3 \rightarrow \left\{ \begin{array}{l} \text{Conv}1\times1 \ (\text{Cls}) \\ \text{Conv}1\times1 \ (\text{Reg}) \end{array} \right. $$
This eliminates one depthwise separable convolution branch, reducing the number of convolutional operations by about 30% in the head. Combined with the P2 layer, the model achieves a 1.9% increase in mAP50 for small targets while reducing total parameters to 2.1×10⁶ and model size to 4.4 MiB.
Experiments
Dataset and Experimental Setup
We use a solar panel defect dataset from Baidu PaddlePaddle AI Studio, originally containing 600 images. To improve generalization, we apply horizontal flipping and random rotation augmentation, expanding the dataset to 2,400 images. The images are split into training (1,680), validation (480), and test (240) sets with a ratio of 7:2:1. The dataset covers three defect categories: Crack, Grid, and Spot, with balanced sample sizes. All defects are annotated with oriented bounding boxes. Experimental parameters are listed in Table 1.
| Parameter | Value |
|---|---|
| Input image size | 640 × 640 |
| Epochs | 300 |
| Batch size | 32 |
| Number of workers | 4 |
| Optimizer | SGD |
| Initial learning rate | 0.01 |
| Momentum | 0.937 |
| Weight decay | 0.0005 |
All experiments are conducted on a Windows 10 machine with an NVIDIA RTX 4060Ti GPU (8GB VRAM) and an Intel i5-12600KF CPU. We use PyTorch 2.5.1 with CUDA 11.3. No pre-trained weights are used to ensure fair evaluation of improvements.
Evaluation Metrics
We evaluate models using precision, recall, average precision (AP), mean average precision (mAP), and model complexity (parameters and size). Precision and recall are defined as:
$$ P = \frac{TP}{TP + FP}, \quad R = \frac{TP}{TP + FN} $$
where TP, FP, and FN denote true positives, false positives, and false negatives. The average precision for a class is the area under the precision-recall curve:
$$ AP = \int_{0}^{1} P(R) dR $$
mAP50 is the mean of AP at IoU threshold 0.5, and mAP50-95 is the mean of AP over IoU thresholds from 0.5 to 0.95 with a step of 0.05.
Ablation Study
We conduct an ablation study to validate each proposed improvement. The baseline is YOLO11n. We denote the four improvements as A (C3k2-Faster-EMA), B (C2PSA-Mona), C (MLCA), and D (P2-EfficientHead). Results are shown in Table 2.
| Base | A | B | C | D | P (%) | mAP50 (%) | mAP50-95 (%) | Params (×10⁶) | Size (MiB) |
|---|---|---|---|---|---|---|---|---|---|
| ✓ | 87.7 | 93.7 | 51.1 | 2.6 | 5.2 | ||||
| ✓ | ✓ | 90.8 | 94.4 | 51.7 | 2.3 | 4.7 | |||
| ✓ | ✓ | 91.4 | 94.0 | 50.4 | 2.6 | 5.2 | |||
| ✓ | ✓ | 91.8 | 93.7 | 49.2 | 2.6 | 5.2 | |||
| ✓ | ✓ | 88.8 | 95.1 | 52.4 | 2.3 | 4.9 | |||
| ✓ | ✓ | ✓ | 90.6 | 94.7 | 51.6 | 2.3 | 4.7 | ||
| ✓ | ✓ | ✓ | 89.7 | 94.1 | 52.4 | 2.3 | 4.7 | ||
| ✓ | ✓ | ✓ | 92.3 | 94.6 | 50.9 | 2.1 | 4.4 | ||
| ✓ | ✓ | ✓ | ✓ | 89.5 | 94.7 | 52.1 | 2.3 | 4.7 | |
| ✓ | ✓ | ✓ | ✓ | ✓ | 88.2 | 95.6 | 53.0 | 2.1 | 4.4 |
From Table 2, each individual improvement contributes positively to mAP50 at least, and the combination of all four yields the best performance: mAP50 increases from 93.7% to 95.6%, mAP50-95 from 51.1% to 53.0%, while parameters drop from 2.6×10⁶ to 2.1×10⁶. Notably, improvement A (C3k2-Faster-EMA) alone reduces parameters by 0.3×10⁶ while increasing mAP50 by 0.7%. The complete FEM-YOLO model achieves the highest accuracy with the smallest model size.
Effectiveness of C3k2-Faster-EMA Module
We further compare variants of the C3k2 module under the full FEM-YOLO framework (excluding the module under test). Results are shown in Table 3. The proposed C3k2-Faster-EMA outperforms C3k2, C3k2-Faster, and C3k2-EMA in both mAP50 and mAP50-95 while maintaining the smallest parameter count (2.1×10⁶) and size (4.4 MiB). This confirms that the fusion of FasterBlock and EMA synergistically improves both efficiency and accuracy.
| Module | mAP50 (%) | mAP50-95 (%) | Params (×10⁶) | Size (MiB) |
|---|---|---|---|---|
| C3k2 | 94.3 | 48.2 | 2.3 | 4.9 |
| C3k2-Faster | 95.3 | 49.8 | 2.1 | 4.4 |
| C3k2-EMA | 95.2 | 51.2 | 2.3 | 5.0 |
| C3k2-Faster-EMA (ours) | 95.6 | 53.0 | 2.1 | 4.4 |
Comparison of Attention Mechanisms
We replace the MLCA module in our full model with other popular attention mechanisms (DAttention, MPCA, CPCA, CAFM, SimAM) and evaluate performance. The results in Table 4 show that MLCA achieves the best mAP50 (95.6%) and mAP50-95 (53.0%) while maintaining the smallest parameter count (2.1×10⁶) and highest inference speed (145.2 FPS). Other attention mechanisms either degrade accuracy or increase model size. MLCA’s lightweight design (using 1D convolutions) provides a favorable trade-off.
| Attention | mAP50 (%) | mAP50-95 (%) | Params (×10⁶) | Size (MiB) | FPS (frame/s) |
|---|---|---|---|---|---|
| None | 94.5 | 49.6 | 2.1 | 4.4 | 124.5 |
| DAttention | 95.2 | 52.9 | 2.3 | 5.0 | 127.4 |
| MPCA | 94.2 | 50.8 | 2.4 | 5.1 | 119.1 |
| CPCA | 92.4 | 49.0 | 2.2 | 4.7 | 114.0 |
| CAFM | 94.0 | 49.6 | 2.4 | 5.1 | 102.1 |
| SimAM | 94.0 | 49.3 | 2.1 | 4.4 | 121.0 |
| MLCA (ours) | 95.6 | 53.0 | 2.1 | 4.4 | 145.2 |
Per-Category Performance
We compare the AP50 for each defect category between our model and other state-of-the-art models. Table 5 shows that our method achieves the highest AP for Crack (96.6%) and Grid (95.7%), and slightly lower than YOLO12n for Spot (94.5% vs. 95.3%). The overall mAP50 is still the highest, demonstrating balanced detection across all defect types.
| Model | Crack | Grid | Spot |
|---|---|---|---|
| YOLOv3-tiny | 95.2 | 92.7 | 90.8 |
| YOLOv5n | 92.7 | 94.7 | 88.0 |
| YOLOv6s | 90.4 | 91.2 | 89.9 |
| YOLOv10n | 93.1 | 93.7 | 91.2 |
| YOLO11n | 92.9 | 94.2 | 94.2 |
| YOLO12n | 88.2 | 93.0 | 95.3 |
| FEM-YOLO (ours) | 96.6 | 95.7 | 94.5 |
Comparison with State-of-the-Art Models
We compare our FEM-YOLO with several lightweight and standard object detectors under the same conditions. Table 6 reports the results. Our model achieves the highest mAP50 (95.6%) and mAP50-95 (53.0%) with the smallest parameter count (2.1×10⁶) and model size (4.4 MiB). Although YOLO11s achieves a similar mAP50 (95.6%), it requires 9.4×10⁶ parameters (4.5× larger) and 18.3 MiB (4.2× larger). Our FPS (145.2) is competitive, surpassing most models except RTDETR-R18 (200.1 FPS) but with far fewer parameters. The proposed method strikes an excellent balance between accuracy and efficiency, making it suitable for real-world deployment on edge devices.
| Model | mAP50 (%) | mAP50-95 (%) | Params (×10⁶) | Size (MiB) | FPS (frame/s) |
|---|---|---|---|---|---|
| SSD | 89.2 | 48.6 | 26.5 | 95.3 | 45.0 |
| RTDETR-L | 92.6 | 51.4 | 31.4 | 120.0 | 123.9 |
| RTDETR-R18 | 92.1 | 48.0 | 19.8 | 81.2 | 200.1 |
| YOLOv3-tiny | 92.9 | 49.1 | 9.5 | 18.3 | 170.1 |
| YOLOv5n | 91.8 | 48.1 | 2.2 | 4.5 | 191.6 |
| YOLOv6s | 90.5 | 45.5 | 16.0 | 30.8 | 131.9 |
| YOLOv10n | 92.7 | 47.8 | 2.3 | 5.5 | 198.4 |
| YOLO11n | 93.7 | 51.1 | 2.6 | 5.2 | 175.5 |
| YOLO11s | 95.6 | 51.7 | 9.4 | 18.3 | 127.1 |
| YOLO12n | 92.1 | 46.1 | 2.5 | 5.2 | 134.1 |
| FEM-YOLO (ours) | 95.6 | 53.0 | 2.1 | 4.4 | 145.2 |
Visualization and Heatmap Analysis
We use GradCAM++ to generate heatmaps visualising the regions the model focuses on. The heatmaps confirm that our FEM-YOLO model concentrates more precisely on defect areas (cracks, grid breaks, and stains) compared to the baseline YOLO11n. For small, distant defects, the P2 detection layer provides stronger activation signals. The MLCA attention also helps suppress background noise. These qualitative results corroborate the quantitative improvements in precision and recall. The model demonstrates robust attention distribution across various defect scales and complex backgrounds, validating the effectiveness of our design choices.
Conclusion
We have proposed FEM-YOLO, a lightweight and accurate defect detection algorithm for solar panels, built upon the YOLO11n framework. By incorporating the Faster-EMA module into the C3k2 block, adding the Mona adapter to C2PSA, placing the MLCA attention in the backbone, and introducing a P2 small-object detection layer with an EfficientHead, our model achieves a mAP50 of 95.6% and mAP50-95 of 53.0% on a challenging solar panel defect dataset. These gains come with a reduced parameter count of 2.1×10⁶ and a model size of only 4.4 MiB, which is 19.2% fewer parameters and 15.4% smaller than the original YOLO11n. The inference speed of 145.2 FPS makes it suitable for real-time deployment on edge devices such as drone-mounted cameras. Extensive ablation and comparison experiments demonstrate the superiority of our method over existing lightweight detectors. Future work will focus on further optimizing the model for specific hardware acceleration and expanding the defect categories to include more types of solar panel anomalies.
