In the context of achieving the “dual carbon” goals, technologies related to solar energy have entered a new development period. Solar panels are prone to various defects during daily use, such as mechanical damage, scratches, and hot spots. Traditional manual inspection methods suffer from low efficiency and high cost, making it difficult to meet the maintenance needs of large-scale photovoltaic power stations. Therefore, developing a high-precision, lightweight defect detection model not only improves operational efficiency but also adapts to edge computing devices, holding significant academic and engineering value. To address the limitations of existing RT-DETR models in solar panel defect detection under complex backgrounds, this study proposes Solar-Net, a lightweight yet high-precision algorithm designed to overcome challenges such as insufficient accuracy, large parameter counts, and high computational complexity.
Our work focuses on three key innovations. First, we introduce EfficientViT as the backbone network, which significantly reduces the number of parameters while maintaining robust multi-scale feature extraction capabilities for solar panel defect features. Second, we design a novel RetBlockC3 module to enhance the model’s ability to capture defect-specific features and model spatial context information, particularly important for small-scale defects such as micro-cracks or tiny hot spots on solar panels. Third, we incorporate an improved Inner-CIoU loss function to optimize bounding box regression accuracy for small defects and accelerate training convergence. Experimental results demonstrate that Solar-Net achieves a 6.8% improvement in mAP50 and a 3.6% improvement in mAP50-95 on the solar panel defect dataset, while reducing the number of parameters by 52.95% and computational cost by 63.26%.

1. Methodology
1.1 Overall Architecture of Solar-Net
Solar-Net is built upon the RT-DETR framework and consists of three major components: an EfficientViT backbone, a neck with RetBlockC3 modules for enhanced feature interaction, and a decoder with an optimized loss function. The backbone extracts multi-scale feature maps from input solar panel images. Two RetBlockC3 modules are inserted into the neck to improve spatial feature modeling. The decoder employs uncertainty-minimal query selection and the Inner-CIoU loss for precise defect localization.
1.2 EfficientViT Backbone
To achieve lightweight design without sacrificing detection capability for solar panel defects, we adopt EfficientViT as the backbone. It is a hybrid architecture that combines the inductive bias of CNNs with the long-range dependency modeling of Transformers. The network is structured as follows: the input solar panel image first passes through a stem consisting of standard convolution and depthwise separable convolution (DSConv). Then, it goes through Stage 1 and Stage 2 using Mobile Inverted Bottleneck Convolution (MBConv), and Stage 3 and Stage 4 using a combination of MBConv and EfficientViT modules. Finally, a spatial pyramid pooling fast (SPPF) layer produces the output feature maps.
The key components of EfficientViT are described below:
- MBConv: It starts with a 1×1 convolution to expand the channel dimension, followed by a depthwise convolution (DWConv) for spatial feature extraction, an SE (Squeeze-and-Excitation) module for channel-wise attention, and finally a 1×1 convolution to reduce channels. Residual connection is applied.
- Lightweight MSA (Multi-Scale Self-Attention): This module replaces the softmax operation in standard self-attention with ReLU activation, reducing computational complexity. The output is computed as:
$$
O = \sum_{j=1}^{N} \frac{ \text{ReLU}(Q_i \cdot K_j^T) }{ \sum_{k=1}^{N} \text{ReLU}(Q_i \cdot K_k^T) } V_j
$$
where \(Q = XW_Q\), \(K = XW_K\), \(V = XW_V\), and \(X\) is the input feature.
Table 1 shows the configurations of the backbone variants considered in our ablation study. The chosen EfficientViT backbone has only 10.7M parameters and 27.2 GFLOPs, making it ideal for edge deployment on solar panel inspection drones.
| Backbone | Parameters | FLOPs (G) | mAP50 | mAP50-95 | Model Size (MB) |
|---|---|---|---|---|---|
| HGNetV2 (Original) | 31,990,161 | 103.4 | 0.736 | 0.285 | 66.2 |
| SwinTransformer_tiny | 36,315,958 | 97.0 | 0.699 | 0.272 | 73.6 |
| VanillaNet | 21,712,508 | 110.1 | 0.746 | 0.281 | 55.8 |
| ResNet50 | 41,960,273 | 129.6 | 0.737 | 0.293 | 86.1 |
| ResNet18 | 19,875,612 | 56.9 | 0.682 | 0.273 | 40.5 |
| EfficientViT (Ours) | 10,705,180 | 27.2 | 0.729 | 0.283 | 22.7 |
1.3 RetBlockC3 Module for Spatial Context Enhancement
The original RT-DETR uses RepC3 modules in the neck, which lack effective attention mechanisms and are insufficient for capturing key features of small solar panel defects (e.g., hairline cracks, hot spots). We replace it with RetBlockC3, which incorporates a Retentive Network block (RMTBlock) to improve feature representation. The RMTBlock consists of:
- Depthwise convolution for local context enhancement.
- Manhattan Self-Attention (MaSA) that models global dependencies with a 2D spatial decay matrix based on Manhattan distance, reducing computational complexity.
- Layer normalization (LN) and feed-forward network (FFN) layers.
The MaSA operation is defined as:
$$
\begin{aligned}
\text{Attn}_H &= \text{Soft}\left( \frac{Q_H K_H^T}{\sqrt{d}} + D_H \right), \\
\text{Attn}_W &= \text{Soft}\left( \frac{Q_W K_W^T}{\sqrt{d}} + D_W \right), \\
\text{MaSA}(X) &= \text{Attn}_H \cdot \text{Attn}_W \cdot V
\end{aligned}
$$
where \(D_H\) and \(D_W\) are decay matrices with elements \(D_{nm} = \gamma^{|y_n – y_m|}\) and \(D_{nm} = \gamma^{|x_n – x_m|}\), respectively, and \(\gamma \in (0,1)\) controls the decay rate based on Manhattan distance along rows and columns.
The RetBlockC3 module effectively enlarges the receptive field while being lightweight, which we validate through visualization experiments (see results section).
1.4 Inner-CIoU Loss Function
The standard CIoU loss used in RT-DETR often suffers from slow convergence and poor generalization for small solar panel defects. We employ Inner-CIoU, which introduces an auxiliary inner bounding box with a scaling factor ratio to accelerate regression. The loss is defined as:
$$
L_{\text{Inner-CIoU}} = 1 – \text{IoU}_\text{inner} + \frac{\rho^2(b, b^{gt})}{c^2} + \alpha \nu
$$
where \(\text{IoU}_\text{inner}\) is the IoU between inner boxes:
$$
\text{IoU}_\text{inner} = \frac{\text{inter}}{\text{union}}
$$
The inner boxes are derived from the original predicted and ground-truth boxes by shrinking them with a ratio factor. For example, an inner anchor box has width \(w_\text{inner} = w \cdot \text{ratio}\) and height \(h_\text{inner} = h \cdot \text{ratio}\), centered at the same coordinates. The inter and union are computed on these inner boxes. Using a smaller auxiliary box (ratio < 1) for small defects speeds up convergence and improves localization accuracy. In our experiments, we set ratio = 0.7 for the solar panel dataset, which contains many small defects.
2. Experiments
2.1 Dataset and Environment
We use a publicly available infrared solar panel defect dataset from Roboflow, consisting of 1,468 images with a resolution of 640×640 pixels. The dataset contains three defect types: glass breakage (GB), hot spot (HSP), and occlusion (CRP). Defect bounding boxes are manually annotated using Labelling. The experimental environment is an Ubuntu 22.04 system with Intel Xeon Platinum 8352V CPU, NVIDIA GeForce RTX 4090 GPU (24GB), and PyTorch 2.0.0 with CUDA 11.8. To ensure fair evaluation, all models are trained from scratch without pre-trained weights. Hyperparameters are listed in Table 2.
| Parameter | Value |
|---|---|
| Epochs | 150 |
| Batch size | 16 |
| Image size | 640 |
| Workers | 8 |
| Optimizer | Adam |
| Initial learning rate | 0.0001 |
| Momentum | 0.9 |
| Weight decay | 0.0001 |
2.2 Ablation Study
To evaluate the contribution of each improvement, we conduct ablation experiments. The baseline model (A) is RT-DETR with ResNet18 backbone, original loss, and standard neck. We then add (B) EfficientViT backbone, (C) RetBlockC3 module, and (D) Inner-CIoU loss. Results are shown in Table 3. The final model (A+B+C+D) achieves the best balance between accuracy and efficiency, with precision P=0.811, recall R=0.737, mAP50=0.750, mAP50-95=0.309, and only 9.35M parameters (19.6 GFLOPs). Compared to baseline, mAP50 improves by 6.8% while parameter count is reduced by 52.95%.
| Model | P | R | mAP50 | mAP50-95 | Param (M) | Parameters | FLOPs (G) |
|---|---|---|---|---|---|---|---|
| A (Baseline) | 0.706 | 0.737 | 0.682 | 0.273 | 40.5 | 19,875,612 | 56.9 |
| B (Backbone) | 0.749 | 0.689 | 0.729 | 0.283 | 22.7 | 10,705,180 | 27.2 |
| C (RetBlockC3) | 0.787 | 0.722 | 0.742 | 0.304 | 37.3 | 18,521,372 | 50.2 |
| D (Inner-CIoU) | 0.726 | 0.766 | 0.722 | 0.295 | 40.5 | 19,875,612 | 56.9 |
| A+B | 0.749 | 0.689 | 0.729 | 0.283 | 22.7 | 10,705,180 | 27.2 |
| A+B+C | 0.707 | 0.770 | 0.739 | 0.295 | 19.6 | 9,350,940 | 20.9 |
| A+B+C+D (Solar-Net) | 0.811 | 0.737 | 0.750 | 0.309 | 19.6 | 9,350,940 | 20.9 |
2.3 Comparison with State-of-the-Art Methods
We compare Solar-Net with popular lightweight detectors: YOLOv5, YOLOv6, YOLOv8n, YOLOv8s, YOLOv9, YOLOv10, and the original RT-DETR. Results in Table 4 show that Solar-Net achieves the highest mAP50 (0.750) and mAP50-95 (0.309) among all methods, with a reasonable parameter count (9.35M). Although YOLOv5 and YOLOv8n have fewer parameters, their mAP50 values are significantly lower (0.697 and 0.692, respectively). Solar-Net outperforms the original RT-DETR by 7.9% in mAP50 and 4.2% in mAP50-95, while reducing computational cost by 63.26%. This demonstrates the effectiveness of our lightweight design specifically tailored for solar panel defect detection.
| Model | mAP50 | mAP50-95 | Parameters | FLOPs (G) |
|---|---|---|---|---|
| YOLOv5 | 0.697 | 0.306 | 2,503,529 | 7.1 |
| YOLOv6 | 0.687 | 0.292 | 4,234,041 | 11.8 |
| YOLOv8n | 0.692 | 0.296 | 3,006,233 | 8.1 |
| YOLOv8s | 0.689 | 0.304 | 11,267,45 | 28.4 |
| YOLOv9 | 0.686 | 0.285 | 7,168,249 | 26.7 |
| YOLOv10 | 0.480 | 0.234 | 2,265,753 | 6.5 |
| RT-DETR (Original) | 0.671 | 0.267 | 19,875,612 | 56.9 |
| Solar-Net (Ours) | 0.750 | 0.309 | 9,350,940 | 19.6 |
2.4 Visualization Analysis
To further understand the feature extraction capability of Solar-Net, we perform receptive field visualization and Grad-CAM analysis. The receptive field visualization indicates that Solar-Net’s low-level layers capture finer local details of solar panel defects compared to the original model. Grad-CAM heatmaps confirm that our model focuses more accurately on defect regions (e.g., hot spots and cracks) even under complex backgrounds, while the baseline model sometimes misses small defects or mislocates them. This qualitative evidence supports the design choices of RetBlockC3 and EfficientViT for robust feature learning.
3. Conclusion
In this work, we proposed Solar-Net, a lightweight and high-precision algorithm for detecting defects on solar panels. The model integrates an EfficientViT backbone to reduce parameters by 52.95% and computational cost by 63.26%, a RetBlockC3 module to enhance spatial context for small defects, and an Inner-CIoU loss to improve bounding box regression. Extensive experiments on an infrared solar panel dataset demonstrate that Solar-Net achieves superior mAP50 (0.750) and mAP50-95 (0.309) compared to existing detectors, while maintaining a compact model size suitable for edge deployment. The improvement in both accuracy and efficiency makes Solar-Net a practical solution for intelligent inspection of photovoltaic power stations. Future work will explore multi-modal fusion (e.g., combining infrared and visible images) and hardware acceleration for real-time drone-based solar panel monitoring. We believe Solar-Net offers a valuable contribution to the development of automated defect detection in the solar energy industry, supporting the global transition to renewable energy.
