In the inspection of solar panel systems, infrared thermography has become a mainstream technique for identifying defects such as hot spots, cracks, and microcracks. However, existing deep learning-based detectors often suffer from missed detection, false positives, and insufficient accuracy, especially for small defects in complex backgrounds. To address these challenges, I propose an improved YOLOv11n model, named DMDI-YOLOv11n, specifically designed for defect detection in solar panel infrared images. This model integrates four key enhancements: (1) fusion of the C3k2 module with the DRBconv module in the backbone, (2) parallel insertion of MLCAttention mechanism after feature fusion, (3) reconstruction of the detection head using multi‑branch and reparameterization strategies, and (4) replacement of the CIoU loss function with the Inner‑DIoU loss. Extensive experiments on benchmark datasets demonstrate that DMDI‑YOLOv11n achieves superior detection accuracy with significantly reduced model parameters and computational complexity, making it well‑suited for edge deployment in solar panel inspection tasks.
1. Introduction
Solar energy is a cornerstone of renewable energy infrastructure. Solar panels, as the core components of photovoltaic systems, are exposed to harsh outdoor conditions and are prone to various defects such as cracks, broken grid lines, and hot spots. These defects degrade power generation efficiency and can lead to safety hazards if not detected in time. Traditional manual inspection is labor‑intensive and inefficient; therefore, automated defect detection using unmanned aerial vehicles (UAVs) equipped with infrared cameras has become essential. Deep learning‑based object detectors, particularly the YOLO series, have shown great promise for real‑time solar panel inspection. However, existing models like YOLOv11n still face challenges: small defect targets are easily missed, the model size is relatively large for edge devices, and the bounding box regression is not optimal for irregular defects. In this paper, I present an improved YOLOv11n model that addresses these issues through lightweight architectural innovations and loss function optimization.
My contributions are four‑fold:
- I propose the C3k2‑DRB module, which combines the efficient C3k2 block with dilated reparameterization (DRB) to enhance multi‑scale feature extraction while reducing parameters.
- I introduce the Mixed Local Channel Attention (MLCA) mechanism in the backbone to capture both channel and spatial information, improving small‑target representation.
- I redesign the detection head as Detect‑Efficient, which integrates multi‑branch and multi‑scale ideas with reparameterization, boosting single‑convolution feature extraction capability and lowering inference cost.
- I replace the traditional CIoU loss with Inner‑DIoU loss to accelerate convergence and improve localization accuracy for solar panel defects.
2. Related Work
Traditional image processing methods for solar panel defect detection rely on thresholding, morphological operations, and histogram fitting. While they can detect hot spots under controlled conditions, they are sensitive to illumination variations and lack generalization. Deep learning approaches, including Mask R‑CNN, SSD, and YOLO variants, have achieved higher accuracy. Among them, YOLOv11n is a state‑of‑the‑art lightweight detector featuring the C3k2 block and C2PSA module. However, when applied to infrared solar panel images, the model still exhibits insufficient sensitivity to small cracks and microcracks, and its detection head is not optimized for multi‑scale defect appearances. Recent works have attempted to incorporate attention mechanisms or replace loss functions, but few have simultaneously addressed both accuracy and model compactness for solar panel inspection. My work fills this gap by proposing an integrated lightweight framework.
3. Proposed Method: DMDI‑YOLOv11n
3.1 Overall Architecture
The overall structure of DMDI‑YOLOv11n is illustrated below. (Note: The network diagram is omitted here; refer to the original paper for visualization.) The model consists of a backbone, a neck, and a detection head. The backbone adopts the C3k2‑DRB module to extract multi‑scale features. After the neck (which includes SPPF and C2PSA), the MLCA attention mechanism is inserted in parallel to refine feature maps. The detection head is replaced by Detect‑Efficient, which uses reparameterized multi‑branch convolutions. Finally, the Inner‑DIoU loss is employed during training.
| Component | Original YOLOv11n | DMDI‑YOLOv11n |
|---|---|---|
| Backbone block | C3k2 | C3k2‑DRB |
| Attention | C2PSA (Spatial) | C2PSA + MLCA |
| Detection head | Standard Conv | Detect‑Efficient |
| Loss function | CIoU | Inner‑DIoU |
3.2 C3k2‑DRB Module
The C3k2 block in YOLOv11n uses two small 3×3 kernels to replace larger kernels, improving efficiency. However, for solar panel defects that often appear as thin lines or small spots, a larger receptive field is beneficial. The Dilated Reparam Block (DRB) from UniRepLKNet introduces parallel dilated convolutional layers that can be reparameterized into a single large kernel during inference. I integrate DRB into the C3k2 bottleneck: the original k2 convolution is retained as a base, and three parallel 3×3 dilated convolutions with different dilation rates are appended. After training, all branches are fused into one equivalent convolution. The resulting C3k2‑DRB module achieves:
- Enhanced receptive field without adding parameters during inference.
- Better feature representation for irregular defect shapes.
- Reduced computational cost compared to using large kernels directly.
Formally, let the input feature be $X$. The output $Y$ of C3k2‑DRB can be expressed as:
$$Y = \text{Conv}_{1\times1}\left( \text{Concat}\left( X_1, X_2, \dots, X_m \right) \right)$$
where each $X_i$ is from a branch consisting of a 1×1 conv followed by a 3×3 dilated conv (dilation rate $d_i$) and batch normalization. During inference, these branches are merged into a single convolution via reparameterization.
3.3 MLCA Attention
Most channel attention mechanisms ignore spatial information, while spatial attention methods are computationally heavy. The Mixed Local Channel Attention (MLCA) balances these by simultaneously incorporating local spatial information into channel attention. It first applies global average pooling (GAP) and global max pooling (GMP) along the channel dimension, then processes them with a local convolution to capture local cross‑channel interactions. The attention map is then element‑wise multiplied with the input feature. The operation can be described as:
$$A = \sigma\left( \text{Conv}_{1\times1}\left( \text{Concat}\left( \text{GAP}(X), \text{GMP}(X) \right) \right) \right)$$
$$X_{\text{out}} = X \odot A$$
where $\sigma$ is the sigmoid function. MLCA boosts the representation of small defect areas (e.g., microcracks) in solar panel infrared images, reducing missed detection.
3.4 Detect‑Efficient Head
The original YOLOv11n detection head uses a simple convolutional layer for classification and regression. I propose Detect‑Efficient, which adopts the design philosophy of EfficientDet’s BiFPN head but with reparameterization. The head consists of two 3×3 grouped convolutions followed by separate prediction branches for class and box. Each branch uses a reparameterized multi‑branch convolution: during training, three parallel paths (1×1, 3×3, and a skip connection) are used; during inference, they are fused into a single 3×3 convolution. This increases the model’s representational capacity without extra inference cost. The structure is shown in Table below.
| Layer | Operation | Output Channels |
|---|---|---|
| 1 | Grouped Conv 3×3 (groups=4) | 128 |
| 2 | Grouped Conv 3×3 (groups=4) + BN + SiLU | 128 |
| 3 | Classification: RepConv 3×3 → Conv 1×1 → num_classes | – |
| 4 | Regression: RepConv 3×3 → Conv 1×1 → 4×num_anchors | – |
3.5 Inner‑DIoU Loss
The CIoU loss used in YOLOv11n adds a complex aspect ratio penalty $\alpha v$ that slows convergence. I replace it with Inner‑DIoU, which combines the advantages of DIoU (directly minimizing normalized distance) and the Inner mechanism using an auxiliary bounding box controlled by a ratio $r$. The loss is defined as:
$$L_{\text{Inner-DIoU}} = 1 – \text{IoU}_{\text{Inner}} + \frac{\rho^2(b, b^{gt})}{c^2}$$
where $b$ and $b^{gt}$ are the center points of the predicted and ground truth boxes, $c$ is the diagonal length of the smallest enclosing box, and $\text{IoU}_{\text{Inner}}$ is computed using scaled auxiliary boxes:
$$b_l^{gt} = x_c^{gt} – \frac{w^{gt} \cdot r}{2}, \quad b_r^{gt} = x_c^{gt} + \frac{w^{gt} \cdot r}{2}$$
$$b_t^{gt} = y_c^{gt} – \frac{h^{gt} \cdot r}{2}, \quad b_b^{gt} = y_c^{gt} + \frac{h^{gt} \cdot r}{2}$$
and similarly for the predicted box. The ratio $r$ is chosen in (0.5, 1) to use smaller auxiliary boxes for high‑IoU samples, or in (1, 1.5] for larger auxiliary boxes to help low‑IoU regression. I set $r=0.7$ in experiments, which accelerates convergence by focusing on high‑overlap cases.
4. Experiments
4.1 Dataset and Settings
I use the public dataset PV_Train_Val_28_12, which contains 2,781 infrared images of solar panels with five defect categories: Examined, ShortCircuitString, ShortCircuitCell‑LowPowerCell, Crack, and MicroCrack. The dataset is split into training and validation sets at an 8:2 ratio. All images are resized to 640×640. Experiments run on an Intel i5‑12490F CPU with an NVIDIA RTX 4060 Ti (16 GB). Training uses SGD optimizer with batch size 16 for 200 epochs. The experimental environment is listed in the table below.
| Parameter | Setting |
|---|---|
| Framework | PyTorch 2.3.0 |
| Image Size | 640×640 |
| Batch Size | 16 |
| Epochs | 200 |
| Optimizer | SGD (momentum=0.937, weight_decay=5e-4) |
| Learning Rate | 0.01 (cosine decay) |
4.2 Evaluation Metrics
I use Precision ($P$), Recall ($R$), mean Average Precision at IoU=0.5 (mAP50), and mAP50‑95 (average over IoU thresholds from 0.5 to 0.95). Model complexity is measured by the number of parameters (Params) and GFLOPs.
$$P = \frac{TP}{TP+FP}, \quad R = \frac{TP}{TP+FN}$$
$$\text{mAP} = \frac{1}{N}\sum_{i=1}^{N} AP_i$$
4.3 Ablation Study
To verify the contribution of each component, I conduct ablation experiments on the PV dataset. The baseline is original YOLOv11n. I sequentially add: (a) C3k2‑DRB, (b) MLCA, (c) Detect‑Efficient, and (d) Inner‑DIoU. Results are summarized in the table below.
| Baseline | C3k2‑DRB | MLCA | Detect‑Efficient | Inner‑DIoU | mAP50 (%) | mAP50‑95 (%) | Params (M) | P (%) | GFLOPs |
|---|---|---|---|---|---|---|---|---|---|
| ✓ | – | – | – | – | 85.2 | 57.9 | 2.58 | 82.7 | 6.3 |
| ✓ | ✓ | – | – | – | 86.2 | 59.3 | 2.44 | 84.2 | 6.3 |
| ✓ | ✓ | ✓ | – | – | 86.9 | 59.8 | 2.44 | 83.7 | 6.3 |
| ✓ | ✓ | ✓ | ✓ | – | 86.6 | 60.4 | 2.17 | 85.8 | 5.1 |
| ✓ | ✓ | ✓ | ✓ | ✓ | 87.0 | 60.5 | 2.17 | 87.1 | 5.1 |
The ablation results show that each module contributes positively. C3k2‑DRB improves mAP50 by 1.0% while reducing parameters by 5.4%. Adding MLCA further raises mAP50 to 86.9% and mAP50‑95 to 59.8%. The Detect‑Efficient head reduces GFLOPs from 6.3 to 5.1 (19.1% reduction) and slightly improves mAP50‑95. Finally, Inner‑DIoU boosts mAP50 to 87.0% and precision to 87.1%, confirming its effectiveness in refining bounding box regression for solar panel defects.
4.4 Comparison with State‑of‑the‑Art Detectors
I compare DMDI‑YOLOv11n with several mainstream detectors: RT‑DETR‑l, YOLOv6n, YOLOv8n, YOLOv9, YOLOv10n, and YOLOv11n. Results on the same dataset are shown below.
| Model | mAP50 (%) | mAP50‑95 (%) | Params (M) | P (%) | GFLOPs |
|---|---|---|---|---|---|
| RT‑DETR‑l | 60.0 | 39.1 | 29.28 | 56.1 | 105.2 |
| YOLOv6n | 87.0 | 59.5 | 4.16 | 84.7 | 11.5 |
| YOLOv8n | 87.0 | 60.1 | 2.69 | 84.9 | 6.8 |
| YOLOv9 | 86.1 | 59.6 | 7.32 | 84.1 | 27.6 |
| YOLOv10n | 84.5 | 58.5 | 2.70 | 78.2 | 8.2 |
| YOLOv11n | 85.2 | 57.9 | 2.58 | 82.7 | 6.3 |
| DMDI‑YOLOv11n | 87.0 | 60.5 | 2.17 | 87.1 | 5.1 |
My proposed model achieves the highest mAP50‑95 (60.5%) and precision (87.1%) among all lightweight models, while having the fewest parameters (2.17 M) and lowest GFLOPs (5.1). Compared to YOLOv11n, mAP50 improves by 1.8% and mAP50‑95 by 2.6%, proving that the integrated improvements effectively boost detection performance for solar panel infrared images.
4.5 Generalization Test
To evaluate generalization, I test on another dataset GB_HSP_modified, which contains 1,468 infrared images with three defect types: cracks (CRP), glass breakage (GB), and hot spots (HSP). Results are shown below.
| Model | mAP50 (%) | mAP50‑95 (%) | Params (M) | R (%) | GFLOPs |
|---|---|---|---|---|---|
| YOLOv9 | 69.0 | 31.0 | 7.32 | 70.4 | 27.6 |
| YOLOv10n | 68.3 | 29.6 | 2.70 | 62.8 | 8.2 |
| YOLOv11n | 72.9 | 27.8 | 2.58 | 72.8 | 6.3 |
| DMDI‑YOLOv11n | 73.3 | 30.1 | 2.17 | 74.1 | 5.1 |
DMDI‑YOLOv11n achieves the best mAP50 (73.3%) and recall (74.1%) on this unseen dataset, demonstrating strong generalization across different solar panel defect categories.
4.6 Computational Efficiency
My model reduces parameters from 2.58 M to 2.17 M (15.89% reduction) and GFLOPs from 6.3 to 5.1 (19.05% reduction) compared to YOLOv11n. This makes it highly suitable for deployment on edge devices such as UAVs or embedded systems used in solar panel inspection.
4.7 Visual Comparison
Visual results on sample infrared images show that DMDI‑YOLOv11n detects microcracks with higher confidence (e.g., 0.52 vs 0.27) and covers defect areas more completely. The model also reduces false positives on “OtherError” categories. The improved detection head and attention mechanism contribute to better localization of fine‑grained defects.

5. Conclusion
In this work, I presented an improved YOLOv11n model, DMDI‑YOLOv11n, for defect detection in solar panel infrared images. By fusing C3k2 with DRBconv, adding MLCA attention, redesigning the detection head with reparameterization, and adopting Inner‑DIoU loss, the model achieves a 1.8% improvement in mAP50 and a 2.6% improvement in mAP50‑95 while reducing parameters by 15.89% and GFLOPs by 19.05%. Ablation experiments confirm the effectiveness of each component, and comparisons with state‑of‑the‑art detectors demonstrate superior accuracy and compactness. The proposed method meets the dual requirements of high detection accuracy and lightweight edge deployment for solar panel inspection, contributing to the intelligent operation and maintenance of photovoltaic power plants. The model’s strong generalization on an additional dataset further validates its robustness. Future work will explore its adaptation to multi‑modal fusion (visible + infrared) and more complex defect types.
