Solar-Net: A Lightweight and High-Precision Algorithm for Efficient Solar Panels Defect Detection

In the context of achieving carbon peak and carbon neutrality goals, solar energy related technologies and application scenarios have entered a new period of rapid development. Solar panels, as the core component of photovoltaic power generation, are prone to various defects during daily operation, such as mechanical breakage, scratches, and hot spots. Traditional manual detection methods suffer from low efficiency and high cost, making it challenging to meet the maintenance requirements of large-scale photovoltaic plants. Therefore, developing a high-precision and lightweight defect detection model that can be deployed on edge devices is of significant academic and engineering value.

Existing deep learning methods have made breakthroughs in detection accuracy and real-time performance, but they still face several limitations. Many models have large parameter counts and high computational complexity, making them unsuitable for resource-constrained edge devices. Moreover, small defect detection, especially for tiny hot spots or cracks in solar panels, remains problematic due to low resolution, poor contrast, and complex backgrounds in aerial infrared images. To address these issues, we propose a novel lightweight detection algorithm named Solar-Net, built upon the RT-DETR framework. Our approach integrates three key innovations: (1) adopting EfficientViT as the backbone network to significantly reduce model parameters while maintaining strong multi-scale feature extraction; (2) designing a novel RetBlockC3 module to enhance spatial context modeling and feature capture for defect targets; and (3) introducing an improved Inner-CIoU loss function to optimize bounding box regression for small defects and accelerate training convergence.

Extensive experiments demonstrate that Solar-Net achieves substantial improvements in detection accuracy and efficiency. Compared to the baseline RT-DETR, our model improves mAP50 by 6.8% and mAP50-95 by 3.6%, while reducing the number of parameters by 52.95% and computational cost by 63.26%. This paper presents the complete methodology, including network architecture, module design, loss function optimization, and comprehensive experimental validation. The proposed model provides a practical and reliable solution for intelligent inspection of solar panels, with strong potential for deployment on edge devices in real-world photovoltaic plants.

1. Introduction

The rapid expansion of photovoltaic power generation has created an urgent need for automated defect detection systems for solar panels. Traditional manual inspection methods are time-consuming, labor-intensive, and prone to errors, especially when dealing with large-scale solar farms. Infrared thermography combined with unmanned aerial vehicles (UAVs) has emerged as a promising solution for capturing thermal images of solar panels. However, these images often suffer from low resolution, poor contrast, and complex backgrounds, making defect detection a challenging task.

Recent advances in deep learning, particularly convolutional neural networks (CNNs) and vision transformers, have achieved remarkable success in object detection. Models such as YOLO series and DETR-based architectures have been widely applied to defect detection in solar panels. Nevertheless, most high-accuracy models are computationally intensive and require large amounts of memory, which limits their deployment on edge devices with limited resources. Furthermore, small defects (e.g., micro-cracks, tiny hot spots) are often missed due to insufficient feature representation and localization accuracy.

To overcome these challenges, we propose Solar-Net, a lightweight yet high-precision detection algorithm specifically designed for solar panels defect detection. Our contributions are threefold:

  • We replace the original backbone of RT-DETR (HGNetV2) with EfficientViT, a memory-efficient hybrid architecture that combines CNN inductive biases with transformer long-range dependencies. This significantly reduces parameters and computational cost while preserving strong multi-scale feature extraction capabilities.
  • We design a novel RetBlockC3 module that integrates a Retentive Network (RMT) block into the RepBlockC3 structure. The Manhattan Self-Attention mechanism in RetBlockC3 enhances spatial modeling and improves the detection of small defect targets.
  • We adopt an Inner-CIoU loss function, which replaces the standard CIoU loss to accelerate training convergence and improve bounding box regression accuracy, especially for small-scale defects.

Extensive experiments on a public solar panels infrared dataset demonstrate that Solar-Net achieves state-of-the-art performance in terms of both accuracy and efficiency. The model also shows strong generalization capabilities, making it suitable for real-world industrial applications.

2. Method

2.1 Overall Architecture

Solar-Net is built upon the RT-DETR framework, which comprises a backbone network, an efficient hybrid encoder (including AIFI and CCFF modules), and a decoder with uncertainty-minimal query selection. The overall architecture is illustrated conceptually. The input infrared image of solar panels is first processed by the backbone network (EfficientViT) to extract multi-scale feature maps at three scales (S3, S4, S5). These features are then passed through RetBlockC3 modules to enhance spatial context information. Subsequently, the encoder with intra-scale feature interaction (AIFI) and cross-scale feature fusion (CCFF) further refines the features. Finally, the decoder generates detection results via a set of object queries.

2.2 EfficientViT Backbone

EfficientViT is a lightweight hybrid architecture that integrates CNN inductive biases (e.g., locality and translation equivariance) with transformer modeling capabilities. Its hierarchical structure consists of an input stem (Conv + DSConv), followed by multiple stages. Stages 1 and 2 use MBConv (Mobile Inverted Bottleneck Convolution) blocks, while stages 3 and 4 combine MBConv with EfficientViT modules. A Spatial Pyramid Pooling Fast (SPPF) block is used at the end to aggregate multi-scale features. The design effectively reduces parameters and computation while maintaining strong representational power.

The MBConv block can be expressed mathematically. Given an input feature tensor \(X \in \mathbb{R}^{H \times W \times C_i}\), the operations are:

$$ X_e = \text{SiLU}(\text{Conv}_{1\times1}(X)) $$
$$ X_{\text{depth}} = \text{SiLU}(\text{DWConv}_{3\times3}(X_e)) $$
$$ X_{\text{SE}} = \text{SE}(X_{\text{depth}}) $$
$$ Y = \text{Conv}_{1\times1}(X_{\text{SE}}) $$
$$ Z = Y + X $$

where \(\text{DWConv}\) denotes depthwise convolution, and \(\text{SE}\) is the Squeeze-and-Excitation module that performs global average pooling followed by two fully connected layers to generate channel-wise attention weights.

The EfficientViT module itself comprises a lightweight multi-scale self-attention (Lightweight MSA) and an MBConv block. The Lightweight MSA uses ReLU activation instead of Softmax to reduce computational complexity. The attention output is computed as:

$$ O_i = \frac{\sum_{j=1}^{N} \text{ReLU}(Q_i) \cdot \text{ReLU}(K_j^\top) \cdot V_j}{\sum_{j=1}^{N} \text{ReLU}(Q_i) \cdot \text{ReLU}(K_j^\top)} $$

where \(Q = XW_Q\), \(K = XW_K\), \(V = XW_V\) are linear projections, and \(i,j\) index spatial positions.

2.3 RetBlockC3 Module

The original RT-DETR uses RepBlockC3 in the encoder. However, RepBlockC3 lacks effective attention mechanisms, limiting its ability to capture critical features for defect detection. We propose RetBlockC3 by embedding the RMTBlock (Retentive Network Meets Vision Transformers) into the RepBlockC3 structure. The RetBlockC3 module takes input from the backbone features and consists of a convolutional layer, an RMTBlock, another convolutional layer, and a residual connection.

The RMTBlock integrates depthwise convolution as a local context enhancer, Manhattan Self-Attention (MaSA) for global modeling, layer normalization (LN), and a feed-forward network (FFN). The MaSA mechanism decomposes attention into horizontal and vertical directions with a spatial decay matrix based on Manhattan distance. The attention computation is:

$$ \text{Attn}_H = \text{Softmax}\left( \frac{Q_H K_H^\top}{\sqrt{d}} + D_H \right) $$
$$ \text{Attn}_W = \text{Softmax}\left( \frac{Q_W K_W^\top}{\sqrt{d}} + D_W \right) $$
$$ \text{MaSA}(X) = \text{Concat}(\text{Attn}_H, \text{Attn}_W) V $$

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|}\), and \(\gamma \in (0,1)\) is the decay factor. This design reduces quadratic complexity to quasi-linear while preserving spatial relationships.

2.4 Inner-CIoU Loss Function

To improve convergence speed and localization accuracy for small defects in solar panels, we replace the standard CIoU loss with an Inner-CIoU loss. The standard CIoU loss is defined as:

$$ \text{IoU} = \frac{|B \cap B^{gt}|}{|B \cup B^{gt}|} $$
$$ \nu = \frac{4}{\pi^2} \left( \arctan\frac{w^{gt}}{h^{gt}} – \arctan\frac{w}{h} \right)^2 $$
$$ \alpha = \frac{\nu}{(1 – \text{IoU}) + \nu} $$
$$ L_{\text{CIoU}} = 1 – \text{IoU} + \frac{\rho^2(b,b^{gt})}{c^2} + \alpha \nu $$

where \(b\) and \(b^{gt}\) are centers, \(\rho\) is Euclidean distance, and \(c\) is the diagonal length of the smallest enclosing box.

Inner-CIoU introduces an auxiliary inner bounding box for both the prediction and ground truth to handle scale mismatch. Let a scale factor \(ratio\) be defined (typically in [0.5, 1.5]). The inner bounding box coordinates are computed by:

$$ b_l = x_c – \frac{w \cdot ratio}{2}, \quad b_r = x_c + \frac{w \cdot ratio}{2} $$
$$ b_t = y_c – \frac{h \cdot ratio}{2}, \quad b_b = y_c + \frac{h \cdot ratio}{2} $$

Similarly for the ground truth with \(ratio\) and its own width/height. The inner IoU is then computed as:

$$ \text{Inter} = \min(b_r, b_r^{gt}) – \max(b_l, b_l^{gt}) \cdot \min(b_b, b_b^{gt}) – \max(b_t, b_t^{gt}) $$
$$ \text{Union} = (w \cdot ratio) \cdot (h \cdot ratio) + (w^{gt} \cdot ratio) \cdot (h^{gt} \cdot ratio) – \text{Inter} $$
$$ \text{IoU}_{\text{inner}} = \frac{\text{Inter}}{\text{Union}} $$

Finally, the Inner-CIoU loss is:

$$ L_{\text{Inner-CIoU}} = 1 – \text{IoU} + \text{IoU} – \text{IoU}_{\text{inner}} $$

This formulation encourages the model to focus on the inner regions, improving regression accuracy for small objects like solar panel defects.

3. Experiments

3.1 Dataset and Experimental Setup

We used a publicly available infrared dataset of solar panels from Roboflow, containing 1468 images with a resolution of 640×640 pixels. Three types of defects were annotated: glass breakage, hot spots, and occlusion. The dataset was split into training, validation, and test sets. All experiments were conducted on a server with a 12 vCPU Intel Xeon Platinum 8352V CPU @ 2.10GHz, 16 cores, 24 threads, 90GB RAM, and a GeForce RTX 4090 GPU with 24GB VRAM. The deep learning framework was PyTorch 2.0.0 with CUDA 11.8 on Ubuntu 22.04. To ensure fairness, no pre-trained weights were used in any ablation or comparison experiments. The main hyperparameters are summarized in Table 1.

Table 1: Experimental Environment Parameters
Parameter Value
Epochs 150
Batch size 16
Image size 640
Workers 8
Optimizer Adam
Learning rate 0.0001
Momentum 0.9
Weight decay 0.0001

3.2 Backbone Comparison

We compared several backbone networks by replacing the original HGNetV2 backbone of RT-DETR with SwinTransformer_tiny, VanillaNet, ResNet50, ResNet18, and EfficientViT. The models were trained from scratch under the same settings. Table 2 reports the results.

Table 2: Backbone Network Comparison (Validation Set)
Backbone Parameters FLOPs (G) mAP50 mAP50-95 Model Size (MB)
HGNetV2 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

EfficientViT achieved comparable mAP50 (0.729) to HGNetV2 (0.736) while reducing parameters by 66.5% and FLOPs by 73.7%. This demonstrates its excellent trade-off between efficiency and accuracy, making it an ideal backbone for lightweight solar panels defect detection.

3.3 Ablation Study

We conducted systematic ablation experiments to evaluate the contribution of each proposed component. The baseline model A is RT-DETR with ResNet18 backbone (the lightest original variant). Model B replaces the backbone with EfficientViT. Model C adds RetBlockC3 modules. Model D uses Inner-CIoU loss. Finally, model A+B+C+D is the full Solar-Net. Results are shown in Table 3.

Table 3: Ablation Study Results
Model P R mAP50 mAP50-95 Model Size (MB) 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 (Loss) 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

The full model A+B+C+D achieves the best performance across all metrics: precision 0.811, mAP50 0.750, and mAP50-95 0.309, while maintaining a very compact model size of 19.6 MB and only 9.35 million parameters. Compared to the baseline, mAP50 improves by 6.8% and mAP50-95 by 3.6%, while parameters are reduced by 52.95% and FLOPs by 63.26%. This confirms the effectiveness of each improvement and their synergy.

3.4 Comparison with State-of-the-Art Methods

We compared Solar-Net with several popular detection models, including YOLOv5, YOLOv6, YOLOv8n, YOLOv8s, YOLOv9, YOLOv10, and the original RT-DETR. All models were trained from scratch on the same dataset without pre-trained weights. Table 4 shows the results.

Table 4: Comparison with State-of-the-Art Models
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,455 28.4
YOLOv9 0.686 0.285 7,168,249 26.7
YOLOv10 0.480 0.234 2,265,753 6.5
RT-DETR (Baseline) 0.671 0.267 19,875,612 56.9
Solar-Net (Ours) 0.750 0.309 9,350,940 19.6

Solar-Net achieves the highest mAP50 (0.750) and mAP50-95 (0.309) among all compared methods. It outperforms YOLOv8s (0.689/0.304) with fewer parameters (9.35M vs 11.27M) and lower FLOPs (19.6 vs 28.4). Compared to the original RT-DETR, Solar-Net improves mAP50 by 7.9% while reducing parameters by 53% and FLOPs by 66%. Notably, YOLOv10 shows poor performance (0.480 mAP50) on this dataset, possibly due to its design not being optimized for small solar panel defects. These results demonstrate that Solar-Net provides an excellent balance between accuracy and efficiency for solar panels defect detection.

3.5 Visualization Analysis

To further understand the feature extraction capability of Solar-Net, we performed receptive field visualization and Grad-CAM analysis. The receptive field maps show that the improved model captures more fine-grained local features in early layers and integrates broader contextual information in deeper layers, compared to the baseline. The Grad-CAM heatmaps indicate that Solar-Net focuses more accurately on defect regions (glass breakage, hot spots, occlusion) while suppressing background noise.

Qualitative detection results comparing the baseline RT-DETR and Solar-Net are shown in conceptual figures. In challenging cases such as small hot spots or occluded defects, Solar-Net produces higher confidence scores and fewer false negatives. The improved detection performance validates the effectiveness of the RetBlockC3 module and the Inner-CIoU loss in enhancing small target localization.

4. Conclusion

In this work, we proposed Solar-Net, a lightweight and high-precision detection algorithm specifically designed for defect detection in solar panels. By integrating EfficientViT as the backbone, the RetBlockC3 module, and the Inner-CIoU loss function, we achieved significant improvements in both accuracy and efficiency. The model reduces the number of parameters by 52.95% and computational cost by 63.26% compared to the baseline RT-DETR, while improving mAP50 by 6.8% and mAP50-95 by 3.6%. Extensive experiments on a public infrared solar panels dataset demonstrate that Solar-Net outperforms state-of-the-art models such as YOLOv5-v10 and RT-DETR, making it an ideal solution for real-time defect detection on edge devices in photovoltaic plants.

The RetBlockC3 module effectively enhances spatial context modeling, and the Inner-CIoU loss accelerates convergence for small defects. Visualization analyses confirm that Solar-Net focuses on defect regions with higher precision. The proposed algorithm provides a practical and reliable approach for intelligent maintenance of solar panels, contributing to the goal of carbon neutrality through efficient renewable energy operations.

Future work will focus on further optimizing the feature fusion mechanism to improve adaptation to more complex backgrounds. Exploring multi-modal data fusion (e.g., visible light + infrared) could further boost detection accuracy. Additionally, hardware acceleration techniques such as quantization and pruning will be investigated to facilitate large-scale deployment of Solar-Net in real-world photovoltaic stations.

In summary, Solar-Net presents a significant advancement in the field of solar panels defect detection, offering a lightweight, accurate, and efficient solution that can be readily adopted for industrial applications.

Scroll to Top