Hot spot detection on solar panels is a critical task for ensuring the operational safety and efficiency of photovoltaic power stations. Infrared thermal imaging combined with deep learning has become the mainstream approach, yet existing models often suffer from poor detection of small hot spots and interference from complex backgrounds. In this work, we propose an improved YOLOv8n model specifically tailored for hot spot detection on solar panels. Our enhancements include a dedicated small object detection layer, a bidirectional feature pyramid network (BiFPN), a convolutional block attention module (CBAM), and the Wise‑IoU (WIoU) loss function. Extensive experiments on a real‑world dataset of thermal infrared images demonstrate that our method achieves a 5.1% increase in mean average precision (mAP@0.5) compared to the baseline YOLOv8n, while slightly reducing both parameter count and computational complexity. The proposed model effectively addresses the challenges of small target detection and background noise, providing a robust solution for automated inspection of solar panels.

Introduction
Photovoltaic (PV) energy is rapidly growing as a renewable power source. However, during long‑term operation, solar panels often develop hot spots due to partial shading, manufacturing defects, or environmental factors. These hot spots cause local overheating and can lead to fires if not detected early. Therefore, accurate and fast detection of hot spots on solar panels is vital for efficient PV plant maintenance.
Infrared thermal imaging is widely adopted for hot spot detection. Traditional methods rely on image processing and machine learning, but they suffer from low robustness under varying environmental conditions. In recent years, deep learning‑based object detectors, especially the YOLO series, have shown great potential due to their end‑to‑end architecture and real‑time performance. Nevertheless, standard YOLO models still face difficulties when applied to hot spot detection on solar panels: (1) hot spots are typically small objects occupying only a few pixels, and their features are easily lost during down‑sampling; (2) the background of solar panels contains complex textures, reflections, and temperature variations that act as noise.
To address these issues, we propose an improved YOLOv8n model. Our contributions are fourfold:
- We introduce a small object detection layer (P2) that operates on high‑resolution feature maps to preserve fine details of hot spots.
- We replace the original neck with BiFPN, enabling bidirectional multi‑scale feature fusion with learnable weights for better information flow.
- We insert CBAM attention modules at the end of each backbone feature layer to emphasize salient regions and suppress background interference.
- We adopt the WIoU loss function, which dynamically adjusts the penalty for anchor boxes based on their outlier degree, improving bounding‑box regression accuracy and convergence speed.
All experiments are conducted on a dataset of 1 000 infrared images captured by drones over real PV plants. The results show that our enhanced model outperforms not only the baseline YOLOv8n but also other lightweight detectors such as YOLOv4‑tiny and YOLOv7‑tiny, achieving a mAP@0.5 of 80.8%.
Related Work
Object Detection for Solar Panels
Several works have applied YOLO variants to hot spot detection on solar panels. Cao et al. integrated a Biformer attention mechanism into the C2f module to capture inter‑sequence relationships and suppress background noise. Ren et al. replaced the YOLOv8 backbone with MobileNet to improve robustness. Sun et al. proposed a feature pyramid fusion network for high‑resolution hot spot detection, but at the cost of increased computation. Wang et al. embedded attention mechanisms in the backbone to enhance sensitivity to channel and spatial information. Liu et al. added a small‑scale detection layer to improve the detection of tiny hot spots. Hao et al. designed an adaptive feature fusion head to boost small‑target perception. While these methods have achieved some success, many introduce heavy computational overhead, making them unsuitable for large‑scale deployment.
Multi‑Scale Feature Fusion
Feature Pyramid Network (FPN) and Path Aggregation Network (PANet) are widely used for multi‑scale feature fusion. FPN propagates semantic information top‑down, while PANet adds a bottom‑up path for better localization. BiFPN improves upon PANet by introducing bidirectional repeated feature fusion and learnable weighted aggregation, allowing the model to adaptively balance contributions from different scales. This is especially beneficial for detecting small hot spots on solar panels, where both fine details and contextual semantics are important.
Attention Mechanisms
Channel attention (e.g., SE block) and spatial attention (e.g., spatial transformer) have been employed to focus on informative features. CBAM combines both sequentially: first channel attention to highlight important feature types, then spatial attention to locate relevant regions. Applying CBAM at the end of each backbone layer helps the detector concentrate on hot spot areas while ignoring irrelevant background patterns on solar panels.
Loss Functions
Standard IoU loss only considers overlap area. CIoU adds penalties for center distance and aspect ratio, but it has limitations when the aspect ratio is identical but scales differ. WIoU introduces a dynamic non‑monotonic focusing mechanism based on the “outlier degree” of anchor boxes. This allows the loss to pay more attention to moderate‑quality anchors and less to extremely high‑ or low‑quality ones, which is crucial for precise regression of small hot spots.
Proposed Method
Overall Architecture
We start from YOLOv8n and make the following modifications: (1) add a small object detection layer (P2) at the 160×160 resolution; (2) replace the original neck with BiFPN; (3) insert CBAM modules after each backbone feature layer; (4) replace CIoU with WIoU. The resulting architecture is illustrated conceptually in our description (no figure referenced). The backbone uses CSPNet for efficient feature extraction. The neck applies BiFPN for multi‑scale fusion. The head uses an anchor‑free design to output detection results.
Small Object Detection Layer
Hot spots on solar panels are often only 2–5 pixels wide in infrared images. Standard YOLOv8n down‑samples the input to 20×20 resolution at the deepest level, causing small hot‑spot features to disappear. To retain fine details, we add a detection branch on the P2 feature map (160×160). This high‑resolution feature map contains rich spatial information. To compensate for the increased computation, we replace some standard convolutions in the backbone with depth‑wise separable convolutions. As shown in Table 1, this layer alone improves mAP by 2.8% while reducing parameters and FLOPs.
Table 1: Effect of adding the small object detection layer.
| Model | Small‑Object Layer | mAP@0.5 (%) | Params (×10⁶) | FLOPs (×10⁹) |
|---|---|---|---|---|
| YOLOv8n | No | 75.7 | 3.01 | 4.10 |
| + Small Layer | Yes | 78.5 | 2.41 | 3.66 |
BiFPN
After adding the P2 branch, we need to fuse features from multiple scales effectively. BiFPN employs bidirectional paths with skip connections and learnable weights. The fusion process can be expressed as:
$$
P_i^{out} = \text{Conv}\!\left( \frac{\sum_{j} w_{ij} \cdot \text{Resize}(P_j^{in})}{\epsilon + \sum_{j} w_{ij}} \right)
$$
where \(w_{ij}\) are learnable weights normalized by a softmax function. Compared to PANet, BiFPN allows more interaction between high‑ and low‑level features. Table 2 shows that adding BiFPN on top of the small‑object layer yields an additional 1.0% mAP gain, with only a marginal increase in parameters and FLOPs.
Table 2: Effect of BiFPN.
| Model | BiFPN | mAP@0.5 (%) | Params (×10⁶) | FLOPs (×10⁹) |
|---|---|---|---|---|
| + Small Layer | No | 78.5 | 2.41 | 3.66 |
| + Small Layer + BiFPN | Yes | 79.5 | 2.43 | 3.71 |
CBAM
To further combat background interference (e.g., dust, reflections, temperature gradients) on solar panels, we embed CBAM modules after each backbone stage. CBAM sequentially computes a channel attention map and a spatial attention map:
$$
\begin{aligned}
M_c(F) &= \sigma\big(\text{MLP}(\text{AvgPool}(F)) + \text{MLP}(\text{MaxPool}(F))\big) \\
M_s(F) &= \sigma\Big(f^{7\times7}\big([\text{AvgPool}(F);\text{MaxPool}(F)]\big)\Big)
\end{aligned}
$$
where \(f^{7\times7}\) is a 7×7 convolution. The refined feature is obtained by:
$$
F’ = M_c(F) \otimes F, \quad F” = M_s(F’) \otimes F’
$$
Table 3 demonstrates that CBAM further boosts mAP by 0.6%.
Table 3: Effect of CBAM.
| Model | CBAM | mAP@0.5 (%) | Params (×10⁶) | FLOPs (×10⁹) |
|---|---|---|---|---|
| + Small Layer + BiFPN | No | 79.5 | 2.43 | 3.71 |
| + Small Layer + BiFPN + CBAM | Yes | 80.1 | 2.43 | 3.73 |
WIoU Loss
Finally, we replace the CIoU loss with WIoU v3. The original CIoU loss is:
$$
\mathcal{L}_{CIoU} = 1 – IoU + \frac{\rho^2(b, b^{gt})}{c^2} + \alpha v
$$
$$
v = \frac{4}{\pi^2}\left( \arctan\frac{w^{gt}}{h^{gt}} – \arctan\frac{w}{h} \right)^2, \quad \alpha = \frac{v}{(1-IoU)+v}
$$
WIoU v3 introduces an outlier degree \(\beta = \frac{L_{IoU}^*}{\overline{L_{IoU}}}\) and a non‑monotonic focusing coefficient \(r = \frac{\beta}{\delta \alpha^{\beta-\delta}}\). The final loss is:
$$
\mathcal{L}_{WIoUv3} = r \cdot \mathcal{L}_{WIoUv1}, \quad \mathcal{L}_{WIoUv1} = R_{WIoU} \cdot L_{IoU}
$$
$$
R_{WIoU} = \exp\left( \frac{(x-x^{gt})^2 + (y-y^{gt})^2}{(W_g^2 + H_g^2)^*} \right)
$$
This dynamic mechanism helps the model focus on moderate‑quality bounding boxes, improving regression for small hot spots. Table 4 shows the final improvement of 0.7% mAP (total 80.8%).
Table 4: Effect of WIoU.
| Model | WIoU | mAP@0.5 (%) | Params (×10⁶) | FLOPs (×10⁹) |
|---|---|---|---|---|
| + All previous | No (CIoU) | 80.1 | 2.43 | 3.73 |
| + All previous + WIoU | Yes | 80.8 | 2.43 | 3.73 |
Experiments
Dataset
We collected 1 000 infrared images of solar panels containing hot spots using a drone‑mounted thermal camera. Images were annotated with bounding boxes using LabelImg. The dataset was split into training (810), validation (90), and test (100) sets. To enhance diversity and reduce overfitting, we applied random data augmentation including horizontal flip, rotation, brightness adjustment, and mosaic.
Experimental Setup
All experiments were conducted on a workstation with an Intel Core i5‑12490F CPU, 32 GB RAM, and an NVIDIA RTX 3060 (12 GB) GPU. The training hyperparameters were fixed: batch size = 8, initial learning rate = 0.01, optimizer = SGD, input size = 640×640, epochs = 300. We used mAP@0.5 as the primary metric, along with parameter count and FLOPs.
Ablation Study
We performed a series of ablation experiments to validate each component. Table 5 summarises the results for all combinations. Model A is the baseline YOLOv8n. Model B adds the small object detection layer. Model C adds BiFPN. Model D adds CBAM. Model E (ours) adds WIoU. The synergistic benefits are evident: the gain from combining modules is larger than the sum of individual gains.
Table 5: Full ablation results.
| Model | Small Layer | BiFPN | CBAM | WIoU | mAP@0.5 (%) | Params (×10⁶) | FLOPs (×10⁹) |
|---|---|---|---|---|---|---|---|
| A | × | × | × | × | 75.7 | 3.01 | 4.10 |
| B | ✓ | × | × | × | 78.5 | 2.41 | 3.66 |
| C | ✓ | ✓ | × | × | 79.5 | 2.43 | 3.71 |
| D | ✓ | ✓ | ✓ | × | 80.1 | 2.43 | 3.73 |
| E (Ours) | ✓ | ✓ | ✓ | ✓ | 80.8 | 2.43 | 3.73 |
Comparison with State‑of‑the‑Art
We compared our model with several lightweight detectors: YOLOv4‑tiny, YOLOv5s, YOLOv7‑tiny, and the baseline YOLOv8n. As shown in Table 6, our model achieves the highest mAP (80.8%) while also having the fewest parameters and FLOPs. This demonstrates the effectiveness of our improvements for hot spot detection on solar panels.
Table 6: Comparison with other lightweight detectors.
| Model | mAP@0.5 (%) | Params (×10⁶) | FLOPs (×10⁹) |
|---|---|---|---|
| YOLOv4‑tiny | 71.0 | 5.9 | 8.0 |
| YOLOv5s | 75.7 | 7.1 | 8.2 |
| YOLOv7‑tiny | 75.9 | 6.0 | 6.6 |
| YOLOv8n | 75.7 | 3.0 | 4.1 |
| Proposed | 80.8 | 2.4 | 3.7 |
Qualitative Analysis
Comparing detection outputs, our model produces more bounding boxes that correctly cover hot spots, especially those that are tiny or located near panel edges. False positives are also reduced because CBAM suppresses background noise. The WIoU loss leads to tighter and more accurate boxes.
Discussion
The ablation study reveals that each component contributes positively to the final performance. Notably, the combination of BiFPN and CBAM yields a larger gain than the sum of their individual gains (1.8% vs. 0.8%+0.5%), indicating a strong synergy. BiFPN provides rich multi‑scale features, and CBAM guides the model to focus on the most discriminative parts. Similarly, the small object layer and WIoU loss together improve small‑target regression beyond the sum of individual contributions (+0.4% extra).
The proposed model maintains a low computational cost (3.73×10⁹ FLOPs) and a small number of parameters (2.43×10⁶), making it suitable for deployment on embedded devices carried by drones. The detection speed is well above the real‑time threshold.
One limitation of our work is that the dataset only includes sunny‑day images. Future work could extend to cloudy or rainy conditions. Additionally, we have not explored transformer‑based backbones, which might further improve accuracy.
Conclusion
We have presented an improved YOLOv8n model for hot spot detection on solar panels. By incorporating a small object detection layer, BiFPN, CBAM attention, and WIoU loss, our model addresses the key challenges of small target size and complex background interference. Experimental results show a 5.1% improvement in mAP over the baseline, with reduced parameters and FLOPs. The proposed method offers a practical and efficient solution for automated solar panel inspection, contributing to safer and more reliable photovoltaic power generation.
