Improved Semantic Segmentation Model for Solar Panels

In my research on photovoltaic systems, I have found that the precise segmentation and extraction of solar panel regions from infrared images is a critical prerequisite for reliable fault diagnosis. The traditional semantic segmentation algorithms often struggle with boundary artifacts such as wavy edges, mutual adhesion between adjacent panels, and background misclassification. To address these challenges, I propose an improved DeepLabV3+ architecture tailored specifically for solar panel segmentation. This model replaces the original backbone with MobileNetV2, integrates Canny edge detection to generate enhanced shallow feature maps, designs a novel SE-ASPP module for channel recalibration, and employs parallel dual convolution pathways for shallow features. Experimental results demonstrate that the improved algorithm achieves a precision of 99.50%, mean Intersection over Union (mIoU) of 99.21%, recall of 99.61%, and F1 score of 99.55%, outperforming the baseline DeepLabV3+ by significant margins. The proposed method effectively mitigates boundary wave effects and adhesion issues, offering a robust solution for automated solar panel inspection.

Introduction and Motivation

The rapid expansion of solar energy installations worldwide has created an urgent demand for automated inspection and maintenance of photovoltaic arrays. Solar panels are exposed to harsh environmental conditions, leading to faults such as diode failures, cracks, and hot spots. These defects not only degrade energy conversion efficiency but also pose long-term safety risks. Traditional manual inspection methods are time-consuming, labor-intensive, and often prone to human error. In recent years, deep learning has emerged as a powerful tool for visual inspection. However, most existing object detection algorithms, such as SSD, YOLO, and Faster R-CNN, directly detect fault regions in infrared images, which often results in false positives caused by visually similar objects like metal supports, metal roofs, and other infrared-reflective surfaces. This problem is especially severe in distributed photovoltaic scenarios.

Semantic segmentation offers a more elegant solution: it assigns a class label to every pixel in the image, thereby producing a clean mask of the solar panel regions while completely removing background interference. By feeding this mask into a subsequent fault detection stage, I can greatly reduce misdetection and improve overall accuracy. Among the many semantic segmentation architectures, DeepLabV3+ has become the de facto standard due to its powerful encoder-decoder structure and the use of Atrous Spatial Pyramid Pooling (ASPP). Nevertheless, the original DeepLabV3+ still exhibits insufficient boundary handling for solar panels, particularly in infrared imagery where edge contrast is low. Therefore, I have developed an improved model that enhances the shallow feature semantics and recalibrates the multi-scale features specifically for the solar panel segmentation task.

Related Work

Fully Convolutional Networks (FCN) were the first to adapt convolutional neural networks for dense pixel prediction. They replaced fully connected layers with convolutional layers, allowing arbitrary input sizes. Subsequent architectures improved upon FCN in various ways. U-Net introduced a symmetric encoder-decoder with skip connections, achieving excellent results in medical imaging. PSPNet employed a pyramid pooling module to capture global context. HRNet maintained high-resolution representations throughout the network. DeepLabV3+ combined the encoder-decoder concept with the ASPP module, which uses multiple dilated convolutions with different rates to capture features at multiple scales. For solar panel defect detection, several studies have adapted these networks. For instance, modified U-Net models have been proposed for electroluminescence (EL) image defect detection, achieving high accuracy. However, these methods are often designed for specific fault types and do not fully address the boundary segmentation problem in infrared photovoltaic images. My work focuses on improving DeepLabV3+ for the explicit purpose of extracting solar panel regions from infrared images, with the goal of feeding clean masks into downstream fault detection algorithms.

Proposed Method

Baseline DeepLabV3+ Architecture

The original DeepLabV3+ network consists of an encoder-decoder structure. The encoder uses a backbone network (typically Xception) to extract high-level semantic features. At the top of the encoder, an ASPP module applies four parallel branches: one 1×1 convolution, three 3×3 dilated convolutions with rates of 6, 12, and 18, and an image-level pooling branch. The outputs of these branches are concatenated and passed through a 1×1 convolution to produce the encoded features. The decoder then fuses these high-level features with low-level features from the backbone. The low-level features are first transformed by a 1×1 convolution to reduce channel dimensions, then concatenated with the upsampled high-level features. Finally, a few convolutional layers refine the fused features and upsample them to the original resolution. The baseline model is effective but often produces coarse boundaries and occasional mis-segmentation in complex backgrounds.

Improved Network Architecture

Figure 1 shows the overall structure of my improved DeepLabV3+ model. The key modifications include:

  • Replacing the Xception backbone with MobileNetV2, which is more efficient in terms of parameters and computational cost while maintaining high representational power.
  • Introducing Canny edge detection on the output of the fourth layer of MobileNetV2 to generate richer shallow feature semantic information.
  • Designing an SE-ASPP module that integrates Squeeze-and-Excitation attention into each parallel branch of the ASPP, thereby recalibrating the feature channels and improving the network’s expressiveness.
  • Increasing the number of channels for the shallow feature semantic information by using parallel dual 1×1 convolutional pathways before feeding them into the decoder.

The improved model takes an infrared image of solar panels as input and produces a binary segmentation map where each pixel is classified as either ‘solar panel’ or ‘background’. The entire image is ultimately represented as a clean mask, which preserves only the pixel information of the solar panel regions, thereby eliminating any background distractions for downstream tasks.

MobileNetV2 Backbone

MobileNetV2 is a lightweight convolutional neural network architecture that employs depthwise separable convolutions to reduce computational cost. It introduces two key innovations: linear bottlenecks and inverted residual structures. In a traditional residual block, the number of channels is typically expanded and then compressed. In MobileNetV2, the input is first expanded to a higher dimension using 1×1 convolutions, then processed by depthwise convolutions, and finally compressed back to a lower dimension by another 1×1 convolution. This inverted residual structure helps preserve information while reducing the number of parameters. The activation function used in the bottleneck is ReLU6, which is more robust for low-precision computations. Table 1 shows the architecture of MobileNetV2 used in my implementation.

Layer Index Input Size Operation Expansion Factor Output Channels Bottleneck Repeat Stride
1 224×224×3 Conv2d – 32 1 2
2 112×112×32 Bottleneck 1 16 1 1
3 112×112×16 Bottleneck 6 24 2 2
4 56×56×24 Bottleneck 6 32 3 2
5 28×28×32 Bottleneck 6 64 4 2
6 28×28×64 Bottleneck 6 96 3 1
7 14×14×96 Bottleneck 6 160 3 2
8 7×7×160 Bottleneck 6 320 1 1
9 7×7×320 Conv2d 1×1 – 1280 1 1
10 7×7×1280 Avgpool 7×7 – – 1 –
11 1×1×1280 Conv2d 1×1 – K 1 –

In my improved DeepLabV3+ network, I extract the output from the fourth layer of MobileNetV2 (i.e., the bottleneck layer with output depth 32) and feed it into the Canny edge detection algorithm. This choice is motivated by the fact that shallow layers retain more spatial details, which are crucial for boundary delineation. By using the fourth layer, I minimize information loss while still capturing meaningful edge structures. The output of the Canny block becomes the shallow feature semantic information that is later fused with deep features in the decoder. This parallel processing of shallow and deep features enables the model to combine fine-grained spatial details with high-level context, leading to more precise localization of solar panel boundaries.

Canny Edge Detection

Canny edge detection is a well-known algorithm that identifies edges in images through a multi-stage process. The steps are as follows:

  1. Grayscale conversion and noise reduction: The input feature map (or image) is converted to grayscale and processed with a Gaussian filter to smooth non-edge regions while preserving edge information.
  2. Gradient calculation: The Sobel operator is applied to compute the gradient magnitude and direction for each pixel. The formulas are:

$$G = \sqrt{G_x^2 + G_y^2}$$

$$\theta = \arctan\left(\frac{G_y}{G_x}\right)$$

where \(G_x\) and \(G_y\) are the horizontal and vertical gradients, respectively, \(G\) is the gradient magnitude, and \(\theta\) is the gradient direction.

  1. Non-maximum suppression: For every pixel, the gradient magnitude is compared with its neighbors along the gradient direction. Pixels that are not local maxima are suppressed, producing thin edges.
  2. Double thresholding: Two thresholds (low and high) are used to determine final edge pixels. A pixel with gradient magnitude above the high threshold is considered a strong edge. A pixel below the low threshold is suppressed. A pixel between the thresholds is considered a weak edge and is only retained if it is connected to a strong edge.

In my model, the Canny algorithm is applied to the output of the fourth MobileNetV2 layer, generating edge-enhanced feature maps. These maps are then used as the shallow feature semantic information. By explicitly injecting edge information, the network becomes more adept at recognizing the exact boundaries of solar panels, especially in infrared images where edge contrast is low. The integration of Canny edge detection into a deep learning pipeline is unconventional but effective, as it provides a deterministic edge prior that complements the learned features.

SE-ASPP Module

The Squeeze-and-Excitation (SE) attention mechanism is a powerful technique that recalibrates feature channels based on their inter-dependencies. It consists of two main operations: squeezing and excitation. The squeezing operation uses global average pooling to aggregate spatial information into a channel descriptor. The excitation operation employs two fully connected layers to generate channel-wise attention weights. The original ASPP module in DeepLabV3+ uses dilated convolutions with rates of 6, 12, and 18. While these large rates expand the receptive field, they may fail to capture local details, especially for small or thin objects. For solar panel segmentation, the boundary between panels can be very thin, and large dilation rates might cause the model to overlook subtle edge features.

To address this issue, I propose the SE-ASPP module, as illustrated in the main text. Instead of the default rates, I use dilation rates of 3, 6, and 9. This smaller set of rates is more suitable for the relatively small size and high boundary complexity observed in solar panel infrared images. A rate of 3 captures fine local textures and edge details, a rate of 6 covers slightly larger contours, and a rate of 9 provides broader contextual information. More importantly, I add an SE block after each parallel branch of the ASPP. This design allows the network to learn the importance of each scale’s features and recalibrate them accordingly. The SE block consists of a global average pooling layer, a fully connected layer that reduces the channel dimension, a ReLU activation, another fully connected layer that restores the original channel dimension, and a sigmoid activation to produce channel weights. The weights are then multiplied with the original feature map. The operations of the SE block can be expressed mathematically as follows.

Given an input feature map \( \mathbf{U} = [\mathbf{u}_1, \mathbf{u}_2, \ldots, \mathbf{u}_C] \) of shape \( H \times W \times C \), the squeeze operation is:

$$z_c = F_{sq}(u_c) = \frac{1}{H \times W} \sum_{i=1}^{H} \sum_{j=1}^{W} u_c(i,j)$$

where \( z_c \) is the global average pooled value for the \(c\)-th channel. The excitation operation is:

$$s = F_{ex}(z, W) = \sigma\left( W_2 \delta(W_1 z) \right)$$

where \( W_1 \in \mathbb{R}^{C/r \times C} \) and \( W_2 \in \mathbb{R}^{C \times C/r} \) are learnable weight matrices, \( r \) is the reduction ratio, \( \delta \) is the ReLU activation, and \( \sigma \) is the sigmoid activation. The final recalibrated feature map is:

$$\tilde{\mathbf{X}}_c = F_{scale}(u_c, s_c) = s_c \cdot u_c$$

where \( s_c \in (0, 1) \) is the attention weight for the \(c\)-th channel. By applying this SE mechanism to each ASPP branch, the SE-ASPP module can adaptively emphasize the most relevant scales for each spatial location, thereby improving the model’s ability to distinguish solar panel edges from the background.

Parallel Dual Convolutional Pathways

In the original DeepLabV3+, the encoder’s low-level features are passed through a single 1×1 convolution before being concatenated with the upsampled high-level features in the decoder. In my improved model, I modify this pathway to use two parallel 1×1 convolutions whose outputs are concatenated together. This creates two distinct linear transformations of the shallow feature semantic information, effectively doubling the representational capacity without a significant increase in the number of parameters. The parallel dual convolution pathways can be defined as:

$$F_{shallow}^{‘} = \text{Concat}\left( \kappa_1 * F_{shallow}, \; \kappa_2 * F_{shallow} \right)$$

where \( F_{shallow} \) is the shallow feature map (after Canny edge detection), \( \kappa_1 \) and \( \kappa_2 \) are two different 1×1 convolution kernels, and \( * \) denotes convolution. The concatenated output \( F_{shallow}^{‘} \) is then concatenated with the high-level features from the SE-ASPP module. This design enhances the diversity of shallow features, reduces the risk of overfitting, and improves the overall flexibility and generalization of the model. In addition, increasing the number of channels for shallow features helps the decoder to recover finer spatial details, which is crucial for accurate solar panel boundary delineation.

Experimental Setup

Dataset

I constructed a dataset of infrared images of solar panels using a DJI M300 RTK drone equipped with an HT20 infrared thermal imaging camera. The images were captured at a photovoltaic power station located in a mountainous area, under various illumination conditions and weather scenarios. The raw image resolution is 640×512. In total, I collected 1,865 images, from which I selected 1,820 images containing solar panels. To augment the dataset and improve model robustness, I applied rotation operations to expand the set to 3,640 images, resulting in a total of 11,273 annotated solar panel instances. The dataset was randomly split into training, validation, and test sets with proportions of 70%, 20%, and 10%, respectively. All training and validation images were manually annotated using the Labelme software, generating JSON files that were subsequently converted to PNG format masks (binary masks where solar panel pixels are white and background pixels are black). These masks were used to supervise the semantic segmentation model.

Implementation Details

My experiments were conducted on a system running Windows 10, with the PyTorch deep learning framework version 2.1.2 and Python version 3.8.18. The hardware configuration consisted of an Intel Core i9-13900K CPU and an NVIDIA GeForce RTX 4090 GPU with 24GB of VRAM. During training, all images were resized to 512×512. The initial learning rate was set to 0.0001, and the Adam optimizer was used with a batch size of 16. The model was trained for 100 epochs. Data augmentation included random horizontal flips and random rotations. No other external pre-trained weights were used except for the ImageNet-pretrained MobileNetV2 backbone.

Evaluation Metrics

To quantitatively evaluate the performance of the proposed model, I used four standard metrics: Precision (P), mean Intersection over Union (mIoU), Recall (R), and F1 score. These metrics are derived from the confusion matrix values \(TP\) (true positives), \(FP\) (false positives), and \(FN\) (false negatives). The formulas are as follows.

$$P = \frac{TP}{TP + FP} \times 100\%$$

$$mIoU = \frac{1}{N} \sum_{i=1}^{N} \frac{TP}{TP + FP + FN} \times 100\%$$

$$R = \frac{TP}{TP + FN} \times 100\%$$

$$F1 = 2 \times \frac{P \times R}{P + R} \times 100\%$$

In my binary segmentation task, the number of classes \(N\) is 2 (background and solar panel). Higher values of all metrics indicate better segmentation performance.

Results and Discussion

Comparison with State-of-the-Art Models

I compared my improved DeepLabV3+ model with several well-known semantic segmentation networks: PSPNet, HRNet, U-Net, and the original DeepLabV3+. All models were trained and evaluated under identical experimental settings. Table 2 reports the quantitative results.

Model Precision (%) mIoU (%) Recall (%) F1 Score (%)
PSPNet 96.31 96.83 97.37 96.84
HRNet 97.01 97.29 97.62 97.31
U-Net 96.92 97.15 97.46 97.08
DeepLabV3+ 97.26 97.63 98.04 97.83
Improved DeepLabV3+ (Ours) 99.50 99.21 99.61 99.55

From Table 2, it is evident that the original DeepLabV3+ already outperforms PSPNet, HRNet, and U-Net on all metrics, achieving a precision of 97.26%, mIoU of 97.63%, recall of 98.04%, and F1 score of 97.83%. My improved model further pushes these numbers to 99.50%, 99.21%, 99.61%, and 99.55%, respectively. The improvements are substantial: +2.24% in precision, +1.58% in mIoU, +1.57% in recall, and +1.72% in F1 score. This clearly demonstrates that the proposed modifications significantly enhance the model’s ability to correctly segment solar panel regions while reducing false positives and false negatives. The higher precision indicates that the model rarely mistakes background objects (such as metal supports or roofs) as solar panels. The higher recall indicates that the model successfully captures almost all genuine solar panel pixels. The increased mIoU confirms that the overall overlap between the predicted mask and the ground truth mask is exceptionally high.

Although the numerical differences among the baseline models are not very large, the actual segmentation quality varies dramatically. I randomly selected six infrared images from the test set that represent different background conditions and varying illumination levels. The prediction results are visualized in a comparative figure where the solar panel regions are shown in their original colors and the background is set to black. I observed that PSPNet produced the worst results, with significant mis-segmentation of metal buildings and vehicles. U-Net and the original DeepLabV3+ performed better but still exhibited boundary waviness and occasional adhesion between adjacent solar panels. In contrast, my improved model consistently produced clean, crisp boundaries without any adhesion. It correctly excluded non-target objects such as metal building roofs and cars, even when they appeared in the infrared spectrum similar to solar panels. For images with closely spaced panels, the baseline models often generated masks where two panels were merged together. My model maintained a clear separation. Additionally, the improved model avoided the ‘edge erosion’ and ‘internal hole’ artifacts that were visible in the predictions of other models. This qualitative evaluation reinforces the quantitative results and demonstrates the practical usability of my approach for real-world solar panel inspection.

Ablation Study

To validate the contribution of each proposed component, I conducted a series of ablation experiments. Starting from the original DeepLabV3+ model, I incrementally added the MobileNetV2 backbone, Canny edge detection, SE-ASPP module, and the parallel dual convolution pathways for shallow features. The results are summarized in Table 3.

Experiment Group MobileNetV2 Canny Edge SE-ASPP Dual Channel Precision (%) mIoU (%) Recall (%) F1 Score (%)
1 (Baseline DeepLabV3+) – – – – 97.26 97.63 98.04 97.83
2 √ – – – 98.10 98.95 99.07 98.94
3 √ √ – – 98.54 99.01 99.52 99.01
4 √ √ √ – 98.84 99.03 99.52 99.02
5 (Full model) √ √ √ √ 99.50 99.21 99.61 99.55

From Table 3, the replacement of the Xception backbone with MobileNetV2 (Group 2) yields a remarkable improvement: precision rises by 0.84%, mIoU by 1.32%, recall by 1.03%, and F1 score by 1.11%. This is an interesting outcome because MobileNetV2 is generally considered a lighter and less powerful network than Xception. However, for the solar panel segmentation task, MobileNetV2’s inductive bias appears to be more suitable, likely due to its efficient feature extraction and better regularization effect. The addition of Canny edge detection (Group 3) further improves precision by 0.44% and recall by 0.45%, confirming that the explicit edge information helps the model locate boundaries more accurately. The SE-ASPP module (Group 4) boosts precision by 0.30% while keeping recall roughly unchanged, indicating that the channel recalibration mainly helps to reduce false positives. Finally, the parallel dual convolution pathways (Group 5) provide another leap in performance, raising precision by 0.66% and F1 score by 0.53%. This demonstrates that increasing the diversity of shallow features is highly beneficial for the decoder to reconstruct fine details. Overall, every component contributes positively, and the best results are achieved when all modules are combined.

Discussion on Boundary Quality

One of the main motivations for this work was to overcome the boundary-related issues of traditional semantic segmentation algorithms when applied to solar panel infrared images. The observed defects include:

  • Wavy boundaries: The predicted mask boundary often deviates from the true panel edge, exhibiting a sinusoidal or irregular undulating pattern. This is caused by insufficient high-frequency information in the deep features.
  • Adhesion between panels: When two solar panels are placed close together, the model sometimes fails to separate them, producing a single connected region. This is due to the loss of spatial resolution in the encoding process.
  • Background mis-segmentation: Objects such as metal frames, roofs, and vehicles with similar thermal signatures are incorrectly included in the solar panel mask.

My improved model addresses all three issues. The Canny edge detection provides crisp edge priors that guide the network to respect fine boundaries. The SE-ASPP module with smaller dilation rates (3, 6, 9) preserves local details while still capturing context, thereby preventing the loss of thin separating lines between panels. The parallel dual convolution pathways enrich shallow features, allowing the decoder to recover spatial information that is typically lost during downsampling. As a result, the predicted masks exhibit smooth, continuous, and accurately positioned boundaries. In the qualitative examples, the green bounding boxes highlight the areas where other models show defects such as boundary adhesion or hole erosion; my model produces perfect masks in these same regions.

Another important observation is the performance under varying illumination intensities. Infrared images of solar panels can have significantly different contrast depending on the time of day, weather, and angle of the drone. The original DeepLabV3+ tends to over-segment in low-contrast scenarios, whereas my improved model maintains high accuracy across different conditions. This robustness is likely due to the combination of edge detection and channel recalibration, which makes the model rely less on absolute pixel intensities and more on structural and contextual cues. Consequently, the proposed method is highly reliable for real-world deployment in photovoltaic power stations.

Computational Efficiency

While semantic segmentation accuracy is the primary focus, computational efficiency is also important for practical applications, especially when the model is deployed on edge devices or drones. MobileNetV2 is known for its lightweight architecture, requiring significantly fewer FLOPs and parameters than Xception. The addition of the Canny edge detection module introduces minimal overhead because it operates on a single feature map with 32 channels and involves standard image processing operations. The SE-ASPP module adds a small number of parameters due to the fully connected layers in the SE blocks, but this overhead is negligible relative to the overall network size. The parallel dual convolution pathways also add a modest number of parameters. Overall, my improved model is suitable for real-time inference on modern GPU hardware and can be optimized for embedded platforms. In future work, I plan to deploy the model on an onboard computing unit of an inspection drone to demonstrate real-time solar panel segmentation and fault detection.

Conclusion and Future Work

In this paper, I have presented an improved DeepLabV3+ architecture for the semantic segmentation of solar panels in infrared images. The proposed model integrates four key enhancements: a lightweight MobileNetV2 backbone, Canny edge detection for shallow feature enhancement, an SE-ASPP module for multi-scale channel recalibration, and parallel dual convolution pathways for richer shallow features. Extensive experiments on a real-world dataset of infrared photovoltaic images reveal that my model achieves state-of-the-art performance, with a precision of 99.50%, mIoU of 99.21%, recall of 99.61%, and F1 score of 99.55%. These values represent improvements of 2.24%, 1.58%, 1.57%, and 1.72%, respectively, over the original DeepLabV3+ model. Qualitative comparisons demonstrate that the improved model produces clean segmentation masks without the wavy boundaries, panel adhesion, or background mis-segmentation issues that plague existing methods. The ablation study confirms the contribution of each component, with the full model yielding the best results. This work provides a reliable pre-processing step for photovoltaic panel fault detection, enabling more accurate and robust downstream inspection. In the future, I will further optimize the model for real-time deployment and integrate it with an object detection algorithm to automatically identify and localize faults such as hot spots, cracks, and diode failures within the segmented solar panel regions. I will also expand the dataset to include more diverse environmental conditions, such as cloudy, rainy, and snowy scenarios, to enhance the generalization ability. Additionally, I aim to explore the use of transformer-based architectures combined with edge information to push the segmentation accuracy even higher. Finally, I plan to test the entire pipeline on an embedded edge platform, such as the NVIDIA Jetson series, to facilitate real-world drone-based inspections of large-scale photovoltaic plants.

Scroll to Top