CRC-RetinaNet: A Multiscale Fusion Approach for Robust Shadow Detection in Solar Panel Arrays

The efficient operation of photovoltaic (PV) systems is paramount for sustainable energy generation. A critical challenge in real-world deployments is partial shading of solar panel arrays. Shadows cast by nearby structures, vegetation, or debris can lead to a non-uniform irradiance distribution across the array. This not only significantly reduces the power output but can also induce severe localized heating known as the hot-spot effect, potentially causing permanent damage to solar panel cells and accelerating system degradation. Traditional methods for solar panel shadow detection, such as manual inspection or electrical characteristic analysis, are often labor-intensive, lack real-time capability, and are not scalable for large-scale solar farms. Therefore, developing an automated, accurate, and fast visual inspection system is of great practical importance.

Recent advances in deep learning, particularly convolutional neural networks (CNNs), have revolutionized object detection. Two-stage detectors (e.g., Faster R-CNN) offer high accuracy but are computationally heavy. One-stage detectors (e.g., YOLO, SSD, RetinaNet) provide a better speed-accuracy trade-off, making them suitable for real-time applications. The RetinaNet framework, with its innovative Focal Loss addressing extreme foreground-background class imbalance, has demonstrated robust performance on dense objects. However, applying standard RetinaNet directly to solar panel shadow detection presents specific challenges. Solar panel arrays exhibit high target density and significant overlap between adjacent panels. Furthermore, shadows can vary dramatically in size and shape. The original RetinaNet’s backbone network and feature fusion mechanism may not sufficiently capture the nuanced features and spatial relationships needed for this task, leading to missed detections, especially for smaller or heavily occluded shadows, and sub-optimal inference speed.

To overcome these limitations, we propose the CRC-RetinaNet, a novel architecture designed specifically for dense solar panel and shadow detection. Our contributions are fourfold, each represented by a letter in ‘CRC’: 1) A Cross Stage Partial (CSP) based backbone network for efficient and rich feature extraction; 2) A Recursive Feature Fusion structure to enhance multi-scale feature representation; 3) A composite CIoU loss function for precise bounding box regression; and 4) The integration of these components into a unified, high-performance detector. We evaluate our method on a custom dataset of solar panel arrays, demonstrating significant improvements in both accuracy and inference speed over the baseline RetinaNet and other state-of-the-art detectors.

Architecture of the CRC-RetinaNet Framework

The overall architecture of CRC-RetinaNet is built upon the one-stage detection paradigm but introduces critical modifications across the feature extraction, fusion, and optimization components. The pipeline consists of three core modules: a CSP-Enhanced Backbone, a Recursive Feature Pyramid Network (RFPN), and the detection subnets for classification and bounding box regression.

The original RetinaNet commonly employs ResNet as its backbone, which can be computationally expensive. We redesign the feature extractor based on the CSPNet philosophy. The CSP structure splits the feature map at a stage’s base into two parts. One part undergoes a dense block operation (a sequence of convolutional layers with concatenated inputs), while the other bypasses it. The outputs are then concatenated and passed through a transition layer. This design mitigates the problem of repeated gradient information in heavily optimized networks, reduces computational cost by nearly 50%, and strengthens feature integration. Our specific backbone integrates a Focus module (for lossless down-sampling) at the input and a Spatial Pyramid Pooling (SPP) module at the deepest layer to aggregate multi-scale contextual features. The forward pass and weight update in a CSP Dense Block can be formally described. Let $*$ denote the convolution operation, $x_i$ be the output of the $i$-th layer, and $w_i$ be the corresponding weights. The forward pass for the $k$-th dense layer and the transition is:

$$
\begin{align*}
x_k &= w_k * [x_0”, x_1, …, x_{k-1}] \\
x_T &= w_T * [x_0”, x_1, …, x_k] \\
x_U &= w_U * [x_0′, x_T]
\end{align*}
$$

where $[.]$ denotes concatenation, $x_0”$ is the split portion processed through the dense block, and $x_0’$ is the bypassed portion. The weight update function $f$ for each part uses gradients $g_i$:

$$
\begin{align*}
w_k’ &= f(w_k, g_0”, g_1, …, g_{k-1}) \\
w_T’ &= f(w_T, g_0”, g_1, …, g_k) \\
w_U’ &= f(w_U, g_0′, g_T)
\end{align*}
$$

This structure drastically reduces the parameter count (to about 14.6% of ResNet-50) while maintaining a strong feature representation capability, crucial for detecting the small and textured features of solar panel cells and their shadows.

The standard Feature Pyramid Network (FPN) in RetinaNet performs a top-down pathway with lateral connections, effectively enriching the semantic information of low-level features. However, the high-level features, though semantically rich, suffer from coarse spatial localization. For dense solar panel arrays, precise localization is as critical as correct semantic classification. Our proposed Recursive FPN augments the standard FPN with an additional bottom-up pathway. After obtaining the feature pyramid levels ${P_3, P_4, P_5, P_6, P_7}$ from the backbone and the top-down FPN, we initiate a second fusion process. Starting from $P_3$, we generate a new level $N_3$. $N_3$ is then downsampled and fused with a transformed $P_4$ to produce $N_4$. This process continues recursively:

$$
N_{l} = \text{Conv}( \text{Concat}( \text{Downsample}(N_{l-1}), \text{Conv}(P_l) ) )
$$

where $l$ ranges from 4 to 7. This recursive fusion creates a second, complementary pyramid ${N_3, N_4, N_5, N_6, N_7}$ where each level incorporates both strong semantics from the top-down path and precise localization signals from lower levels via the new bottom-up path. This dual-pathway system ensures that every anchor, regardless of its assigned feature level, benefits from a more comprehensive set of features, significantly boosting detection performance for densely packed and overlapping solar panel targets.

The choice of activation functions and loss functions directly impacts learning dynamics and robustness. We employ a dual activation strategy: the Mish activation function ($f(x) = x \cdot \tanh(\ln(1+e^x))$) in the backbone for its smooth, non-monotonic properties which aid in better gradient flow and generalization, and the Leaky ReLU ($y_i = x_i$ if $x_i \ge 0$, else $a_i x_i$ with $a_i=0.3$) in the neck and head subnets for its computational efficiency and mitigation of the “dying ReLU” problem.

For bounding box regression, the original smooth L1 loss treats the four box coordinates independently, which does not align well with the evaluation metric, Intersection over Union (IoU). We adopt the Complete IoU (CIoU) Loss, which considers overlap area, central point distance, and aspect ratio consistency. For a predicted box $b$ and ground truth box $b^{gt}$, the CIoU loss is defined as:

$$
\mathcal{L}_{CIoU} = 1 – IoU + \frac{\rho^2(b, b^{gt})}{c^2} + \alpha v
$$

where $\rho(\cdot)$ is the Euclidean distance, $c$ is the diagonal length of the smallest enclosing box covering both $b$ and $b^{gt}$. The aspect ratio term $v$ and its weight $\alpha$ are given by:

$$
v = \frac{4}{\pi^2} (\arctan\frac{w^{gt}}{h^{gt}} – \arctan\frac{w}{h})^2, \quad \alpha = \frac{v}{(1 – IoU) + v}
$$

This loss function accelerates convergence and leads to more accurate bounding box predictions, which is vital for precisely locating individual solar panel modules and their shadowed regions within a crowded array.

Experimental Evaluation and Comparative Analysis

We curated a dataset comprising 8,402 images from various sources, including surveillance footage and aerial imagery of operational solar panel farms. The dataset was annotated with two classes: ‘PVP’ (unshaded solar panel) and ‘PVP_shielding’ (shaded solar panel), resulting in over 100,000 bounding box instances. The dataset exhibits high density, with significant occlusion and scale variation. We applied online data augmentation (random scaling, flipping, and color jittering) to improve generalization. Anchor boxes were reclustered on our dataset using K-means to better match the aspect ratios and sizes of solar panel components.

The model was trained using the Adam optimizer with an initial learning rate of $1 \times 10^{-4}$ and a batch size of 4. The learning rate was reduced by a factor of 0.5 upon plateau of the validation loss. The total loss is a combination of the classification loss (Focal Loss) and the regression loss (CIoU Loss): $\mathcal{L}_{total} = \mathcal{L}_{Focal} + 0.25 \cdot \mathcal{L}_{CIoU}$. Training converged stably, as shown by the consistent decrease in loss.

We evaluated CRC-RetinaNet against several prominent one-stage and two-stage detectors under identical conditions. The standard metrics of Average Precision (AP) for each class, mean Average Precision (mAP), Frames Per Second (FPS), and model size were used for comparison. The results are summarized in the table below.

Algorithm AP (PVP) (%) AP (Shielding) (%) mAP (%) FPS Model Size (MB)
Faster R-CNN 40.66 20.44 30.55 16.0 301.05
SSD 55.07 30.55 42.81 41.4 100.40
YOLOv3 95.81 98.33 97.07 34.9 246.30
YOLOv4 96.12 98.09 97.10 30.2 266.30
M2Det 96.89 90.21 93.55 24.8 226.66
EfficientDet 86.29 39.09 62.69 30.7 16.16
RetinaNet (Baseline) 96.92 93.52 95.22 15.6 139.30
CRC-RetinaNet (Ours) 99.33 99.15 99.24 32.4 66.26

The results clearly demonstrate the superiority of our proposed method. CRC-RetinaNet achieves the highest mAP of 99.24%, outperforming the baseline RetinaNet by a significant margin of 4.02 percentage points. Notably, it shows a remarkable 5.63-point improvement on the more challenging ‘PVP_shielding’ class. While YOLOv3 and YOLOv4 are strong competitors in accuracy, our model is considerably more lightweight (66.26 MB vs. ~250 MB) and offers a better balance with a high FPS of 32.4, comfortably meeting real-time processing requirements for solar panel inspection via drones or fixed cameras.

To validate the contribution of each proposed component, we conducted an ablation study. Starting from the baseline RetinaNet, we incrementally added the CSP backbone (C-RetinaNet), the Recursive FPN (CR-RetinaNet), the M-L activations, and finally the CIoU loss (full CRC-RetinaNet). The progression of performance is shown below.

Configuration CSP RFPN M-L Act. CIoU mAP (%) FPS Size (MB)
RetinaNet × × × × 95.22 15.6 139.30
C-RetinaNet × × × 97.71 33.5 45.98
CR-RetinaNet × × 98.55 32.1 66.26
CR-RetinaNet + M-L × 98.97 31.6 66.26
CRC-RetinaNet 99.24 32.4 66.26

The ablation study reveals that the CSP backbone provides the most substantial boost in both speed (more than doubling FPS) and accuracy, while also drastically reducing model size. The addition of the Recursive FPN further improves mAP, confirming its role in enhancing feature representation for dense scenes. The M-L activations and CIoU loss yield incremental but consistent gains, pushing the final mAP over 99%. Qualitative results on test images show that CRC-RetinaNet effectively eliminates the false negatives and false positives observed in the baseline model, especially in scenes with extremely dense, overlapping, or very small solar panel shadows. The prediction boxes are more precise and have higher confidence scores.

Conclusion and Future Work

In this work, we introduced CRC-RetinaNet, a deeply optimized one-stage detector tailored for the automatic detection of solar panel arrays and their shadowed regions. By integrating a Cross Stage Partial backbone for efficient feature extraction, a Recursive Feature Pyramid Network for robust multi-scale fusion, and a CIoU loss for precise localization, our model addresses the key challenges of high density, occlusion, and scale variation inherent to aerial and ground-based solar panel imagery. Extensive experiments on a dedicated dataset demonstrate that CRC-RetinaNet sets a new state-of-the-art, achieving a mAP of 99.24% while maintaining a compact model size (66.26 MB) and real-time inference speed (32.4 FPS). This performance balance makes it a highly suitable solution for integration into automated inspection systems using drones or stationary cameras, enabling proactive maintenance and efficiency optimization of large-scale photovoltaic power plants.

Future research directions include extending the detection framework to classify different types of solar panel faults beyond shading, such as cracks, soiling, or delamination. Furthermore, exploring temporal analysis across video sequences could help in distinguishing persistent structural shadows from transient ones caused by moving clouds, leading to even more intelligent monitoring systems for the global solar panel infrastructure.

Scroll to Top