Intelligent Inspection of Foreign Bodies on Solar Panels

With the continuous expansion of global photovoltaic installed capacity, the operational health of solar panel arrays has become a critical concern for sustainable energy production. Foreign objects such as dust, leaves, bird droppings, and other debris on the surface of solar panels can significantly reduce the power generation efficiency and even cause hot-spot effects that permanently damage the modules. Traditional manual inspection methods are labor-intensive, inefficient, and incapable of covering large-scale photovoltaic plants. To address these challenges, this research proposes an intelligent inspection framework that integrates unmanned aerial vehicle (UAV) imaging, deep learning-based data augmentation, and high-performance object detection algorithms for the accurate and real-time detection of foreign bodies on solar panel surfaces. This article presents a comprehensive study covering the design of a UAV inspection system, the construction and augmentation of a solar panel foreign object dataset, the development of a high-precision detection model named BiFB-YOLO, and its lightweight variant MoBiFB-YOLO, followed by the implementation of a practical inspection software system.

The rapid growth of renewable energy has placed solar panels at the forefront of clean power generation. However, the outdoor deployment of solar panels exposes them to various environmental contaminants. Accumulated foreign bodies not only block incident sunlight but also create uneven temperature distributions, leading to hot spots that degrade the photovoltaic cells. Therefore, reliable detection of foreign objects on solar panels is essential for timely maintenance and optimal energy yield. In this study, I focus on three common types of foreign bodies: leaves, dust, and bird droppings. The proposed method leverages UAV-acquired high-resolution images and deep learning models to identify these objects with high precision and efficiency.

1. UAV Inspection System Design

The first step toward intelligent inspection is the design of a UAV-based data acquisition platform. The system requirements include long flight endurance, high-resolution imaging, stable data transmission, and autonomous path planning. The overall architecture consists of a UAV platform, a gimbal camera, a ground control station, and a communication module. The UAV used in this research is the DJI Matrice 350 RTK, equipped with a Zenmuse P1 camera. The key parameters of the UAV and camera are summarized in the following tables.

Parameter Value
UAV weight 6.47 kg (with batteries)
Motor wheelbase 895 mm
Flight endurance 45 min
Maximum takeoff weight 9.2 kg
Maximum flight speed 23 m/s
GPS hover accuracy ±0.1 m (horizontal), ±0.1 m (vertical)
Operating temperature -20 °C to 50 °C
Camera parameter Value
Sensor 45 MP effective pixels
Aperture range f/2.8 – f/16
Dimensions 198 × 166 × 129 mm
Power consumption 20 W
Flight accuracy 3 cm (planar), 5 cm (elevation)

The global path planning for the UAV inspection adopts an “S” shaped route, which minimizes redundant coverage and ensures full scanning of the solar panel array. The flight route is designed according to the layout of the photovoltaic modules, allowing the UAV to capture images with the camera lens perpendicular to the panel surface. The acquired images are transmitted in real time to the ground station for further processing. This UAV-based inspection system greatly improves the automation level and reduces the workload of manual patrols.

2. Construction and Augmentation of the Solar Panel Foreign Body Dataset

2.1 Dataset Construction

The original dataset was built from images captured by the UAV at a rooftop photovoltaic platform and an industrial solar power station. After filtering out blurred and overly exposed frames, 900 high-quality images containing foreign bodies on solar panels were selected. The three target categories are leaves, dust, and bird droppings. All images were annotated using the LabelImg tool in the VOC format, and the dataset was split into training, validation, and test sets with a ratio of 8:1:1.

2.2 Traditional Data Augmentation

To enlarge the dataset and improve the robustness of the detection model, traditional geometric and photometric augmentation methods were first applied. Geometric transformations include translation, rotation, and flipping. Photometric transformations include brightness adjustment and noise addition. These operations generate additional samples that help the model generalize better. However, traditional augmentation only produces variations of existing images and cannot introduce fundamentally new features. Therefore, a deep generative model is needed to synthesize more diverse foreign body samples.

2.3 Improved DCGAN for Data Augmentation

Generative Adversarial Networks (GANs) have shown great potential in generating realistic images. The standard GAN consists of a generator and a discriminator that play a minimax game. The objective function of the original GAN is given by:

$$
\min_{G} \max_{D} V(D,G) = \mathbb{E}_{x \sim p_{\text{data}}(x)}[\log D(x)] + \mathbb{E}_{z \sim p_z(z)}[\log(1 – D(G(z)))]
$$

Deep Convolutional GAN (DCGAN) improves the stability of GAN by replacing fully connected layers with convolutional layers, removing pooling layers, and applying batch normalization. In this research, the original DCGAN is enhanced in three major ways. First, a self-attention mechanism is introduced into the generator to capture global feature dependencies. The self-attention feature map is computed as:

$$
\beta_{j,i} = \frac{\exp(f(x_i)^T g(x_j))}{\sum_{i=1}^N \exp(f(x_i)^T g(x_j))}
$$

$$
o_j = \sum_{i=1}^N \beta_{j,i} h(x_i)
$$

where \(f(x)\), \(g(x)\), and \(h(x)\) are learned linear embeddings. The output of the self-attention layer is then combined with the input feature map through a learnable scale parameter \(\gamma\):

$$
y_i = \gamma o_i + x_i
$$

Second, the Squeeze-and-Excitation (SE) attention mechanism is added to both the generator and the discriminator. SE blocks adaptively recalibrate channel-wise feature responses by modeling the importance of each channel. The SE operation can be expressed as:

$$
\tilde{X} = F_{\text{scale}}(U, \sigma(W_2 \delta(W_1 z)))
$$

where \(z\) is the global average pooled feature vector, \(W_1\) and \(W_2\) are fully connected layers, \(\delta\) denotes ReLU, and \(\sigma\) denotes sigmoid activation.

Third, the activation function in the discriminator is replaced with Scaled Exponential Linear Units (SELU). The SELU function is defined as:

$$
\text{SELU}(x) = \lambda \begin{cases}
x & \text{if } x > 0 \\
\alpha e^x – \alpha & \text{if } x \leq 0
\end{cases}
$$

with \(\lambda \approx 1.0507\) and \(\alpha \approx 1.6732\). SELU enables self-normalizing properties, reducing the risk of exploding or vanishing gradients and improving training stability. The improved DCGAN model is trained on the collected solar panel foreign body images for 8000 epochs. The generator produces 64×64 synthetic images that closely resemble real samples.

2.4 Experimental Results of Data Augmentation

The quality of generated images is evaluated using four metrics: Inception Score (IS), Fréchet Inception Distance (FID), Structural Similarity Index (SSIM), and Peak Signal-to-Noise Ratio (PSNR). Table 1 compares the original GAN, DCGAN, and the improved DCGAN.

Table 1: Quality evaluation of generated images
Model IS ↑ FID ↓ SSIM ↑ PSNR (dB) ↑
GAN 1.12 405.54 0.181 15.6
DCGAN 1.30 322.05 0.204 25.4
Improved DCGAN 1.76 276.10 0.384 36.4

The improved DCGAN significantly outperforms the baseline in all metrics. The FID value is reduced by 14.3% compared to vanilla DCGAN, while SSIM improves by 87.7%. Visual inspection also confirms that the generated images contain distinct leaf shapes, bird droppings of varying sizes, and recognizable dust patterns. The synthetic images are then added to the original dataset. After combining traditional augmentation and improved DCGAN generation, the total dataset grows from 900 images to 6546 images. The expanded dataset is used to train a YOLOv8s model to validate the benefit of the generated data. The detection performance is shown in Table 2.

Table 2: Detection performance before and after data augmentation
Training data mAP@0.5 (%) Recall (%) Params (M)
Original dataset 83.3 82.3 11.0
Expanded dataset 89.6 87.4 11.3

The results demonstrate that the improved DCGAN-based augmentation effectively enriches the solar panel foreign object dataset and substantially boosts the performance of downstream detection models.

3. High-Precision Detection Algorithm: BiFB-YOLO

3.1 YOLOv8 Baseline

YOLOv8 is a state-of-the-art one-stage object detection algorithm that balances speed and accuracy. Its backbone uses the C2f module, which enhances gradient flow through multiple skip connections. The neck adopts a PANet structure for multi-scale feature fusion, and the head is an anchor-free decoupled head that separately predicts classification and regression outputs. The loss function in YOLOv8 combines binary cross-entropy for classification, CIoU for bounding box regression, and distribution focal loss (DFL). The CIoU loss is defined as:

$$
L_{\text{CIoU}} = 1 – \text{IoU} + \frac{\rho^2(\mathbf{b}, \mathbf{b}^{gt})}{D^2} + \alpha \nu
$$

where \(\rho\) is the Euclidean distance between center points, \(D\) is the diagonal length of the smallest enclosing box, and \(\nu\) measures the aspect ratio consistency.

3.2 Improvements for High Precision

Although YOLOv8s performs well on several benchmarks, the complex background of UAV images and the small size of foreign bodies on solar panels require further improvements. Therefore, a new model named BiFB-YOLO is proposed with three main modifications: BiFPN-Concat, GAM attention, and SIoU loss.

3.2.1 BiFPN-Concat Module

The BiFPN (Bidirectional Feature Pyramid Network) enhances the conventional PANet by adding cross-scale connections and learnable weights for feature fusion. In this work, the original Concat modules in the YOLOv8 neck are replaced with BiFPN-Concat modules, which perform weighted summation of multi-scale features. The weighted fusion at a node is expressed as:

$$
O = \sum_i \frac{w_i}{\epsilon + \sum_j w_j} I_i
$$

where \(w_i\) are learnable weights and \(\epsilon\) is a small constant to avoid division by zero. This module allows the network to emphasize the most informative feature maps and improves the detection of small foreign objects on solar panels.

3.2.2 GAM Attention Mechanism

The Global Attention Mechanism (GAM) is integrated into the backbone to strengthen the model’s attention on important features. GAM contains a channel attention sub-module and a spatial attention sub-module. The channel attention is computed after a 3D permutation and a multi-layer perceptron, followed by a sigmoid activation. The spatial attention uses two 7×7 convolutions to encode spatial information. The overall attention process is given by:

$$
F_2 = M_c(F_1) \otimes F_1
$$

$$
F_3 = M_s(F_2) \otimes F_2
$$

where \(M_c\) and \(M_s\) are the channel and spatial attention maps, respectively. GAM helps the model focus on the foreign body regions while suppressing irrelevant background information, which is particularly useful for aerial images of solar panels.

3.2.3 SIoU Loss

The CIoU loss in YOLOv8 is replaced by SIoU (Smooth IoU) loss, which introduces angle, distance, and shape penalties to accelerate convergence and improve regression accuracy. The angle loss is defined as:

$$
\Lambda = 1 – 2\sin^2\left(\arcsin\left(\frac{C_w}{\sqrt{C_w^2 + C_h^2}}\right) – \frac{\pi}{4}\right)
$$

The distance loss is given by:

$$
\Delta = \sum_{t \in \{x,y\}} (1 – e^{-\gamma \rho_t})
$$

with \(\gamma = 2 – \Lambda\), and the shape loss is:

$$
\Omega = \sum_{t \in \{w,h\}} (1 – e^{-\omega_t})^{\theta}
$$

Finally, the SIoU loss is computed as:

$$
L_{\text{SIoU}} = 1 – \text{IoU} + \frac{\Delta + \Omega}{2}
$$

This loss function provides a more precise regression signal, leading to better localization of foreign bodies on solar panels.

3.3 Experimental Evaluation

All experiments are conducted on the expanded dataset. The training parameters are listed in Table 3.

Table 3: Training parameters for BiFB-YOLO
Parameter Value
Image size 640 × 640
Epochs 200
Batch size 32
Optimizer SGD
Initial learning rate 0.01
Final learning rate 0.001
Momentum 0.937
Weight decay 0.0005

To verify the effectiveness of the attention mechanism, a comparison is made among CA, CBAM, and GAM, as shown in Table 4.

Table 4: Attention mechanism comparison
Attention Precision (%) Recall (%) mAP@0.5 (%)
None 89.2 87.4 89.6
CA 89.4 86.7 88.6
CBAM 91.2 87.2 91.5
GAM 93.5 89.4 95.7

GAM provides the largest improvement, increasing mAP@0.5 by 6.8% over the baseline. The loss function comparison is shown in Table 5.

Table 5: Loss function comparison
Loss Precision (%) Recall (%) mAP@0.5 (%)
CIoU 89.2 87.4 89.6
DIoU 86.7 85.8 86.4
GIoU 87.0 85.5 87.3
WIoU 90.5 86.5 89.3
SIoU 90.3 89.1 90.1

SIoU achieves the best overall balance. The ablation study presented in Table 6 reveals the contribution of each component.

Table 6: Ablation study of BiFB-YOLO components
BiFPN-Concat GAM SIoU Precision (%) Recall (%) mAP@0.5 (%) mAP@0.5:0.95 (%)
✗ ✗ ✗ 89.2 87.4 89.6 59.3
✓ ✗ ✗ 89.7 87.8 90.2 61.2
✗ ✓ ✗ 93.5 89.4 95.7 66.7
✓ ✓ ✗ 94.3 90.6 96.5 67.4
✓ ✓ ✓ 95.0 92.9 96.2 67.1

The complete BiFB-YOLO model achieves 95.0% precision, 92.9% recall, and 96.2% mAP@0.5, demonstrating excellent detection capabilities for foreign bodies on solar panels. A comparison with other mainstream detectors is given in Table 7.

Table 7: Comparison with mainstream detection algorithms
Model Precision (%) Recall (%) mAP@0.5 (%) mAP@0.5:0.95 (%)
SSD 83.2 81.6 84.5 46.8
Faster R-CNN 81.6 82.3 82.9 47.3
YOLOv3 81.9 80.3 84.1 47.2
YOLOv5 89.2 86.3 87.4 52.0
YOLOv7 88.7 87.2 88.9 51.8
YOLOv11 90.3 86.3 90.1 59.8
YOLOv8s 89.2 87.4 89.6 59.3
BiFB-YOLO 95.0 92.9 96.2 67.1

The improved algorithm significantly outperforms the baseline and other popular detectors, confirming its suitability for high-precision foreign body detection on solar panels.

4. Lightweight Detection Algorithm: MoBiFB-YOLO

4.1 Motivation

Although BiFB-YOLO achieves excellent accuracy, its large model size and high computational cost limit its deployment on resource-constrained platforms such as onboard UAV computing units. To address this issue, a lightweight variant named MoBiFB-YOLO is proposed. The goal is to reduce parameters and floating-point operations while maintaining a minimal loss in accuracy.

4.2 Lightweight Convolution: MoECA

Several lightweight convolutional networks were considered, including MobileNetV3, ShuffleNetV2, and GhostNet. MobileNetV3 was selected as the base because of its favorable trade-off between speed and accuracy. To further improve its feature extraction ability, the SE module in MobileNetV3 is replaced with the Efficient Channel Attention (ECA) module, forming a new lightweight unit called MoECA. The ECA module uses a one-dimensional convolution with an adaptive kernel size \(k\) to capture local cross-channel interactions:

$$
\omega = \sigma(\text{Conv1D}_k(\text{GAP}(X)))
$$

The kernel size \(k\) is adaptively determined by the channel dimension \(C\):

$$
k = \left| \frac{\log_2(C)}{\gamma} + \frac{b}{\gamma} \right|_{\text{odd}}
$$

where \(\gamma\) and \(b\) are hyperparameters. The MoECA unit combines depthwise separable convolution with the ECA attention mechanism, effectively reducing computational cost while preserving representational power.

4.3 Lightweight Detection Head: PConv-Head

The original decoupled detection head in BiFB-YOLO contains a large number of 3×3 convolutions. To reduce the complexity, a shared convolutional strategy is adopted. The detection head first uses two 3×3 partial convolution (PConv) layers to extract features before splitting into classification and regression branches. PConv performs convolution on only a subset of channels and leaves the remaining channels unchanged, reducing both FLOPs and memory access. The number of FLOPs for PConv is given by:

$$
\text{FLOPs}_{\text{PConv}} = h \times w \times c_p \times k^2
$$

where \(c_p\) is the number of channels processed by the convolution. In this work, \(c_p = c/4\) for a ratio of 1:4, leading to a theoretical computation reduction of 16× compared to standard convolution. The resulting PConv-Head structure significantly lowers the model size and improves inference speed.

4.4 Experimental Results

First, different lightweight backbones were compared when integrated into the BiFB-YOLO framework. The results are shown in Table 8.

Table 8: Comparison of lightweight convolution backbones
Backbone Params (M) FLOPs (G) FPS (Hz) mAP@0.5 (%)
BiFB-YOLO (original) 11.8 28.3 76.2 96.2
GhostNetV3 8.2 20.6 89.3 93.1
ShuffleNetV2 9.7 23.2 82.4 90.6
MobileNetV3 6.3 13.0 93.6 92.9

MobileNetV3 provides the best trade-off. The proposed MoECA further improves the adaptability of MobileNetV3. The ablation study for the lightweight components is presented in Table 9.

Table 9: Ablation study for MoBiFB-YOLO
MoECA PConv-Head mAP@0.5 (%) Params (M) FLOPs (G) FPS (Hz)
✗ ✗ 96.2 11.8 28.3 76.2
✓ ✗ 93.2 6.2 12.5 93.2
✗ ✓ 94.0 8.8 16.2 105.1
✓ ✓ 95.1 3.8 7.0 103.1

When both MoECA and PConv-Head are employed, the model size is reduced to 3.8 M parameters and 7.0 G FLOPs, while the mAP@0.5 only drops to 95.1%, which is only a 1% decrease from the high-precision model. The final comparison with several lightweight detectors is shown in Table 10.

Table 10: Comparison of lightweight detection models
Model mAP@0.5 (%) Params (M) FLOPs (G) FPS (Hz)
SSD 80.5 26.3 67.2 43
YOLOv4-tiny 83.2 6.3 7.9 30
YOLOv5s 86.9 7.2 16.5 56
YOLOv7-tiny 86.2 6.2 13.8 74
YOLOv8s 89.2 11.3 28.3 76.2
YOLOv11s 90.3 9.4 21.5 85.6
BiFB-YOLO 96.2 11.8 28.3 76.2
MoBiFB-YOLO 95.1 3.9 7.0 103.1

The MoBiFB-YOLO model achieves an excellent balance between accuracy and efficiency, making it highly suitable for real-time foreign body detection on solar panels in UAV-based inspection tasks.

5. Detection Software System Design

To facilitate practical deployment, a desktop application for solar panel foreign body detection was developed using PyQt5. The system comprises four modules: user login/registration, data input, parameter configuration, and result display. The workflow begins with user authentication. After logging in, the user can upload an image, a video, or a live camera stream. The user can adjust the confidence threshold and IoU threshold, and select the trained weight file. The system then runs the MoBiFB-YOLO model to detect foreign bodies and displays the bounding boxes, class labels, and count statistics in the result panel. The interface also provides a function to save detection results for later analysis. This software tool integrates the entire detection pipeline into a single platform, greatly simplifying the operation process and enhancing the practicality of the proposed method.

6. Conclusion

This research presented a comprehensive framework for intelligent inspection of foreign bodies on solar panel surfaces. A UAV-based acquisition system was designed to collect high-resolution images of photovoltaic panels. The dataset was augmented using both traditional methods and an improved DCGAN incorporating self-attention, SE attention, and SELU activation. The augmentation significantly improved the detection performance. A high-precision detection algorithm, BiFB-YOLO, was developed based on YOLOv8s with BiFPN-Concat, GAM attention, and SIoU loss, achieving 96.2% mAP@0.5. To enable real-time deployment, a lightweight variant, MoBiFB-YOLO, was proposed using the MoECA lightweight convolution and PConv-Head detection head. This model reduced parameters to 3.9M and increased FPS to 103.1 while only losing 1% in accuracy. Finally, a user-friendly software system was built to perform end-to-end detection of foreign bodies on solar panels. The proposed methods offer a reliable and efficient solution for photovoltaic maintenance, contributing to the sustainable operation of solar power plants.

Scroll to Top