Improved U-Net for Solar Panels Extraction

In the context of the global carbon reduction and the “dual carbon” goals proposed by China, the technology of solar photovoltaic (PV) panels, which are commonly referred to as solar panels, has experienced rapid development. Solar panels are installed over wide areas, often in irregular layouts and across diverse scenes, creating a pressing need for efficient and accurate methods to obtain information about their type, location, quantity, and extent. Traditional supervised classification methods and manual interpretation are limited by high labor costs, long detection cycles, and poor generalization across different imagery. In this thesis, I focus on the extraction of solar panels from high-resolution remote sensing imagery using an improved U-Net convolutional neural network. The core contributions include constructing a feature enhancement fusion network, evaluating it against multiple baselines, and demonstrating its practical applicability in large-scale change detection of solar panel installations.

The remainder of this article is organized as follows. Section 2 reviews the theoretical background, including supervised classification techniques and convolutional neural networks. Section 3 describes the datasets used in this study. Section 4 details the improved U-Net architecture. Section 5 presents the experimental setup, ablation studies, and comparative results. Section 6 applies the proposed model to a real-world panda-shaped solar power station. Finally, Section 7 concludes the work.

1. Introduction

The increasing adoption of solar panels as a renewable energy source is driven by global initiatives to reduce greenhouse gas emissions and achieve sustainable development. According to China’s “dual carbon” goals, the installed capacity of solar power has grown enormously, covering not only rooftops but also vast areas of farmland, water surfaces, grasslands, and saline-alkali lands. Because solar panel installations are often scattered and enormous, efficient monitoring is challenging. Remote sensing imagery can provide up-to-date information over large geographic extents, making it the most suitable data source for detecting solar panels. However, the appearance of solar panels varies significantly with different materials, installation angles, lighting conditions, and surrounding environments. This variability makes accurate and automated extraction a difficult task.

Traditional image classification techniques such as maximum likelihood classification, minimum distance classification, and Mahalanobis distance classification rely on spectral statistics and manual training sample selection. They often fail when the target and background have similar spectral responses or when the scene complexity is high. In contrast, deep learning methods based on convolutional neural networks (CNNs) have demonstrated outstanding performance in semantic segmentation tasks. Among them, U-Net stands out due to its symmetric encoder-decoder structure and skip connections, which preserve fine-grained spatial details. Nevertheless, standard U-Net does not generalize well to solar panel extraction in complex scenes because it tends to underutilize multi-scale contextual information and is easily confused by non-target objects such as roofs, roads, or water bodies.

To tackle these challenges, I propose an improved U-Net model that integrates attention mechanisms and residual learning. Specifically, I insert the Convolutional Block Attention Module (CBAM) into both the downsampling and upsampling paths, and replace the plain convolutional layers in the feature extraction blocks with residual modules that embed coordinate attention. The CBAM module recalibrates features along both channel and spatial dimensions, enabling the network to focus more on solar panels while suppressing irrelevant background. The coordinate attention module provides precise positional cues, while residual connections alleviate network degradation and gradient vanishing in deeper architectures. The resulting feature enhancement fusion network achieves significantly higher accuracy and robustness across multiple solar panel scenes.

To validate the effectiveness of the proposed method, I conduct extensive experiments on publicly available solar panel datasets containing four scene types: water surfaces, croplands, saline-alkali lands, and grasslands. I also compare the proposed model with five state-of-the-art semantic segmentation networks: PSPNet, SegNet, DeepLabV3+, HRNet, and the original U-Net. Quantitative results show that my improved model consistently outperforms all baselines in terms of mean Precision, mean Recall, mean F1-score, and mean Intersection over Union (mIoU). Additionally, an independent validation dataset containing shrubwood scenes confirms the strong generalization ability of the model. Finally, I apply the trained model to monitor changes in a large panda-shaped solar power station over several years, demonstrating the practical utility of the method for real-world infrastructure monitoring.

2. Theoretical Background

2.1 Supervised Classification for Remote Sensing

Supervised classification is a classic approach in remote sensing image analysis. It relies on predefined training samples to estimate statistical parameters for each land cover class, and then classifies every pixel based on a decision rule. The most common algorithms include maximum likelihood classification (MLC), minimum distance classification using Euclidean distance, and Mahalanobis distance classification.

For a pixel vector \(\mathbf{x}\), the maximum likelihood classifier assigns it to class \(q_i\) by maximizing the posterior probability \(P(q_i | \mathbf{x})\). Using Bayes’ theorem and assuming Gaussian class distributions, the discriminant function can be written as:

$$
f_i(\mathbf{x}) = \ln P(q_i) – \frac{1}{2} \ln |\mathbf{\Sigma}_i| – \frac{1}{2} (\mathbf{x} – \boldsymbol{\mu}_i)^T \mathbf{\Sigma}_i^{-1} (\mathbf{x} – \boldsymbol{\mu}_i),
$$

where \(P(q_i)\) is the prior probability, \(\mathbf{\Sigma}_i\) is the covariance matrix of class \(i\), and \(\boldsymbol{\mu}_i\) is the mean vector. The pixel is assigned to the class with the largest \(f_i(\mathbf{x})\).

Minimum distance classifiers compute the distance from the pixel to each class center. The Euclidean distance is given by:

$$
d_E(\mathbf{x}, \boldsymbol{\mu}_i) = \sqrt{(\mathbf{x} – \boldsymbol{\mu}_i)^T (\mathbf{x} – \boldsymbol{\mu}_i)}.
$$

The Mahalanobis distance takes into account the covariance structure of the data:

$$
d_M(\mathbf{x}, \boldsymbol{\mu}_i) = \sqrt{(\mathbf{x} – \boldsymbol{\mu}_i)^T \mathbf{\Sigma}_i^{-1} (\mathbf{x} – \boldsymbol{\mu}_i)}.
$$

Although these methods are easy to implement, they require a sufficient number of training pixels for each class and often fail to separate classes with overlapping spectral signatures. In the case of solar panels, their spectral signature can closely resemble that of rooftops or bare soil, especially in panchromatic or true-color imagery. Moreover, the training areas must be manually selected for each image, making the process labor-intensive and not scalable.

2.2 Convolutional Neural Networks

Convolutional neural networks (CNNs) are a class of deep learning models specifically designed for grid-structured data such as images. A CNN typically consists of convolutional layers, activation functions, pooling layers, and fully connected layers. The convolutional layer uses learnable filters to extract local features. The operation can be expressed as:

$$
(f \ast g)(n) = \sum_{\tau} f(\tau) g(n – \tau),
$$

where \(f\) is the input and \(g\) is the convolution kernel. In practice, a bias term is added and the result is passed through a nonlinear activation function such as ReLU. Pooling layers reduce the spatial resolution and increase the receptive field. Common pooling operations are max pooling and average pooling.

For semantic segmentation, fully convolutional networks (FCNs) replace the fully connected layers with upsampling operations, allowing dense pixel-wise predictions. U-Net, introduced by Ronneberger et al., extended this idea with a symmetric encoder-decoder architecture and skip connections. The encoder extracts increasingly abstract features, while the decoder gradually recovers spatial resolution. Skip connections concatenate feature maps from the encoder to the corresponding decoder layers, preserving fine details.

2.3 Advancements in Attention Mechanisms

Attention mechanisms have become essential components for improving CNN performance. The self-attention mechanism allows the model to focus on important regions while suppressing irrelevant ones. Two prominent examples are the Squeeze-and-Excitation (SE) module and the Convolutional Block Attention Module (CBAM). CBAM combines channel attention and spatial attention. The channel attention module applies max pooling and average pooling to the spatial dimensions, passes them through a shared multilayer perceptron, and produces a channel-wise attention vector. The spatial attention module pools along the channel axis and applies a convolutional layer to generate a spatial attention map. These attention maps are multiplied with the input feature map to recalibrate features.

Coordinate attention is a lightweight attention mechanism that captures long-range dependencies along the horizontal and vertical directions. It decomposes the channel attention into two parallel branches: one for the x-direction and one for the y-direction. After pooling the feature map along each direction, the resulting feature maps are concatenated, passed through a shared convolutional layer, and then split to generate attention weights for each direction. This allows the network to encode positional information with negligible parameter overhead.

3. Dataset Description

The datasets used in this thesis originate from a public high-resolution solar panel (PV) dataset collected in Jiangsu Province, China, via aerial photography with a ground sampling distance (GSD) of 0.3 m. The images cover different land use types where solar panels are commonly installed. I selected four scene categories for model training: WaterSurface (large ponds and reservoirs), Cropland (agricultural fields), SalineAlkali (saline-alkali land), and Grassland (low-density grassland). For model validation, an additional Shrubwood scene was used. Since the original number of images varied by scene, I applied data augmentation to balance the dataset and improve model robustness. The augmentation operations included a 90-degree counterclockwise rotation, noise addition, brightness adjustment, and Gaussian filtering.

Data augmentation was performed at a ratio of 1:5 for every scene, as summarized in the following table.

Scene Resolution Augmentation Ratio Before Augmentation After Augmentation
WaterSurface 0.3 m 1:5 599 2995
Cropland 0.3 m 1:5 951 4755
SalineAlkali 0.3 m 1:5 422 2110
Grassland 0.3 m 1:5 140 700
Shrubwood 0.3 m 1:5 143 715

For the deep learning experiments, each dataset was split into 80% training, 10% validation, and 10% testing. The image size was fixed at \(512 \times 512\) pixels. For the supervised classification experiments, I controlled the time spent on selecting training samples: one unit time was allocated for labeling solar panels, and three units of time were allocated for labeling non-solar-panel objects. Priority was given to objects with spectral similarity to solar panels, such as rooftops, water bodies, and bare soil.

4. Methodology: The Feature Enhancement Fusion Network

The proposed improved U-Net architecture is designed to overcome the limitations of the standard U-Net in solar panel extraction. The overall network structure is illustrated in the following description. The encoder part consists of four downsampling stages, and the decoder part contains four upsampling stages. I introduce two main modifications: (1) CBAM attention modules are added after each convolutional block in both the encoder and decoder paths; (2) the original two consecutive \(3\times 3\) convolutions are replaced by residual modules that incorporate coordinate attention, called Coordinate Attention Residual Modules (CARM).

Let \(\mathbf{F} \in \mathbb{R}^{C \times H \times W}\) be the input feature map at some layer. The CBAM module computes a channel attention vector \(\mathbf{M}_c \in \mathbb{R}^{C \times 1 \times 1}\) and a spatial attention map \(\mathbf{M}_s \in \mathbb{R}^{1 \times H \times W}\). The process is defined as:

$$
\mathbf{F}’ = \mathbf{M}_c(\mathbf{F}) \otimes \mathbf{F}, \quad \mathbf{F}” = \mathbf{M}_s(\mathbf{F}’) \otimes \mathbf{F}’,
$$

where \(\otimes\) denotes element-wise multiplication. The channel attention is computed by:

$$
\mathbf{M}_c(\mathbf{F}) = \sigma(\text{MLP}(\text{AvgPool}(\mathbf{F})) + \text{MLP}(\text{MaxPool}(\mathbf{F}))),
$$

and the spatial attention is:

$$
\mathbf{M}_s(\mathbf{F}’) = \sigma(f^{7\times 7}([\text{AvgPool}(\mathbf{F}’); \text{MaxPool}(\mathbf{F}’)])),
$$

where \(f^{7\times 7}\) is a convolution with a \(7\times 7\) kernel, and \(\sigma\) is the sigmoid activation.

The residual module with coordinate attention is depicted in the architecture. For an input feature \(\mathbf{x}\), the module first applies a \(1\times 1\) convolution, then a \(3\times 3\) convolution, followed by coordinate attention, and finally adds the input via a residual connection. The coordinate attention mechanism encodes precise positional information. It operates as follows: given an input feature tensor, global average pooling is performed in the horizontal direction to generate a feature map of shape \(C \times H \times 1\), and in the vertical direction to generate a feature map of shape \(C \times 1 \times W\). These two maps are concatenated and passed through a \(1\times 1\) convolution, a batch normalization layer, and a nonlinear activation. The result is then split into two parts, each processed by a separate \(1\times 1\) convolution followed by a sigmoid, producing attention weights for the x and y directions. The original feature is re-weighted by these attention maps.

This design provides several advantages for solar panel extraction:

  • The CBAM module enhances the discriminative power of features, emphasizing panel regions while suppressing background clutter.
  • The coordinate attention module helps the model locate panels with irregular shapes and sizes, avoiding misclassification of objects like roads or buildings.
  • Residual connections improve gradient flow and allow for a deeper network without degradation, increasing model stability and robustness.

In the original U-Net, each level includes two \(3\times 3\) convolutions followed by ReLU activation. In my implementation, I replaced these plain convolutions with the coordinate attention residual modules, except for the first layer after the input, where I kept a standard \(3\times 3\) convolution to preserve spatial dimensions. All use batch normalization and ReLU. The decoder upsamples feature maps using \(2\times 2\) transposed convolutions, and skip connections concatenate the encoder features with the corresponding decoder features. A final \(1\times 1\) convolution produces the two-class output (solar panels vs. background).

5. Experiments and Analysis

5.1 Experimental Setup

All experiments were conducted on an Ubuntu 18.04 system with Python 3.6 and PyTorch 1.6.1. The hardware was an NVIDIA GeForce RTX 2080 Ti with 12 GB memory. The model was trained with a batch size of 4 during the frozen stage and 1 during the fine-tuning stage. The optimizer was Adam with an initial learning rate of \(10^{-4}\) for the frozen backbone and \(10^{-5}\) for the fine-tuned layers. The number of epochs was set to 100. The loss function was the binary cross-entropy, defined as:

$$
L = -\frac{1}{N} \sum_{j=1}^{N} \left[ y_j \log(p_j) + (1 – y_j) \log(1 – p_j) \right],
$$

where \(y_j\) is the ground truth label (0 or 1) and \(p_j\) is the predicted probability for pixel \(j\).

For quantitative evaluation, I used four metrics: Precision, Recall, F1-score, and Intersection over Union (IoU). For a binary classification, the metrics are defined as:

$$
\text{Precision} = \frac{TP}{TP + FP}, \quad \text{Recall} = \frac{TP}{TP + FN}, \quad F_1 = \frac{2 \cdot \text{Precision} \cdot \text{Recall}}{\text{Precision} + \text{Recall}}, \quad \text{IoU} = \frac{TP}{TP + FP + FN}.
$$

I computed the mean values (mP, mRecall, mF1, mIoU) over the test set of each scene.

5.2 Supervised Classification Results

I first evaluated the three supervised classification algorithms on the four training scene test sets. The classification was binary: solar panels versus non-solar panels. To ensure fairness, the training sample selection time was controlled as described earlier. The results were assessed using overall accuracy and Kappa coefficient.

For the Cropland scene, the maximum likelihood classifier gave the best overall accuracy among the three, but the visual result still contained many misclassifications on roads and agricultural fields. The Euclidean distance classifier produced Kappa of 0.596 and overall accuracy of 30.11%, which was far lower due to severe over-classification of non-solar pixels. The Mahalanobis distance classifier was even worse, failing to separate solar panels at all. These results highlight the fundamental weakness of pixel-based spectral methods for this task.

For the Grassland scene, the maximum likelihood classifier achieved an overall accuracy of 40.52% and Kappa of 0.3285, while Euclidean distance achieved 34.22% and 0.3382. Interestingly, the Mahalanobis distance classifier performed much better here, with an overall accuracy of 91.25% and Kappa of 0.7953. However, its good performance was likely due to the specific spectral distribution in this dataset, and it still failed to distinguish water from solar panels.

For the SalineAlkali scene, the three classifiers obtained overall accuracies of 91.03%, 86.27%, and 93.53%, with Kappa values of 0.7067, 0.5638, and 0.7521, respectively. The maximum likelihood and Mahalanobis classifiers produced acceptable results in terms of the overall percentage, but visual inspection revealed many small patches of confusion between solar panels and rooftops or bare land.

For the WaterSurface scene, the overall accuracies were 90.60%, 75.92%, and 92.99%, with Kappa values of 0.6866, 0.2885, and 0.7517. The main confusion occurred between solar panels and the edges of water bodies where the spectral reflection was similar.

In summary, supervised classification methods lack generality. They require per-image training samples, are sensitive to the choice of training areas, and fail to leverage spatial contextual information. Consequently, they are not suitable for large-scale solar panel extraction.

5.3 Ablation Study

To verify the effectiveness of each component in the proposed model, I conducted an ablation study on the original U-Net. Five configurations are defined in the following table.

Configuration Backbone Residual Block Coordinate Attention CBAM
① (U-Net) VGG No No No
② VGG Yes No No
③ VGG Yes Yes No
④ VGG No No Yes
⑤ (Proposed) VGG Yes Yes Yes

I trained each configuration on the four scene datasets separately. The loss curves showed that the proposed model converged steadily and reached lower loss values compared to the baseline. For instance, in the WaterSurface dataset, the training loss reached near zero after about 83 epochs. The visual predictions on a representative test image are described as follows. The original U-Net produced fragmented predictions and incorrectly identified a substation as solar panels. Adding the residual block reduced feature loss and slightly improved the edge completeness. The coordinate attention residual module further refined the segmentation, while the addition of CBAM notably increased focus on solar panels and reduced background interference. The full model combined all improvements and yielded the most accurate mask, closely matching the ground truth.

The quantitative results for the ablation study on WaterSurface are presented in the following table.

Method mPrecision mRecall mF1 mIoU
U-Net 88.45% 94.19% 91.23% 88.73%
+Residual 89.73% 94.72% 92.14% 89.66%
+CoordAtt 91.02% 95.21% 93.06% 91.32%
+CBAM 92.47% 96.06% 94.23% 92.51%
Proposed 92.47% 96.32% 94.35% 92.67%

The ablation results for Cropland, SalineAlkali, and Grassland showed similar trends. The improvement was largest when CBAM and coordinate attention residual modules were combined. For Cropland, the proposed model increased mIoU by 4.06% over the original U-Net. For SalineAlkali, the increases in mP, mRecall, mF1, and mIoU were 4.74%, 4.17%, 4.46%, and 2.58%, respectively. For Grassland, the corresponding increases were 3.57%, 2.86%, 3.32%, and 3.48%. These results confirm that each introduced module contributes positively, and their combination is crucial for optimal performance.

5.4 Comparison with State-of-the-Art Models

I compared the proposed model with PSPNet, SegNet, DeepLabV3+, HRNet, and the original U-Net on the four scene test sets. All models were trained under the same experimental settings. Visual results indicated that most baseline models had severe boundary leakages, adjacent solar panels being merged together, and confusion with substations or buildings. The proposed model consistently produced more complete and well-defined segmentation masks.

The quantitative results for each scene are presented below.

WaterSurface

Model mPrecision mRecall mF1 mIoU
PSPNet 90.68% 93.76% 92.19% 89.70%
SegNet 89.85% 92.54% 91.18% 90.85%
DeepLabV3+ 90.91% 94.08% 92.47% 90.24%
HRNet 91.26% 95.04% 93.11% 91.15%
U-Net 90.53% 94.71% 92.57% 90.62%
Ours 92.47% 96.32% 94.35% 92.67%

SalineAlkali

Model mPrecision mRecall mF1 mIoU
PSPNet 89.72% 92.19% 90.94% 89.71%
SegNet 88.73% 92.28% 90.47% 87.67%
DeepLabV3+ 91.42% 93.54% 92.47% 90.77%
HRNet 91.75% 92.47% 92.11% 91.08%
U-Net 91.32% 91.86% 91.59% 90.84%
Ours 93.53% 95.84% 94.67% 92.06%

Grassland

Model mPrecision mRecall mF1 mIoU
PSPNet 83.12% 93.47% 87.99% 79.95%
SegNet 85.91% 92.60% 86.02% 85.66%
DeepLabV3+ 86.14% 93.63% 89.73% 85.06%
HRNet 90.55% 92.68% 91.60% 89.47%
U-Net 88.73% 90.15% 89.43% 88.50%
Ours 93.00% 94.54% 93.76% 92.12%

Cropland

Model mPrecision mRecall mF1 mIoU
PSPNet 89.23% 92.11% 90.65% 88.76%
SegNet 90.84% 93.26% 91.91% 90.81%
DeepLabV3+ 91.93% 93.69% 92.80% 90.38%
HRNet 91.15% 91.82% 91.48% 91.24%
U-Net 91.23% 92.59% 91.90% 91.37%
Ours 92.51% 96.72% 94.57% 92.75%

The proposed model achieved the highest mF1 and mIoU in all four scenes. The average improvement in mIoU over the best baseline was approximately 1.5% to 2.6%, which is significant given the already high performance of the baselines. The improvements were particularly pronounced in scenes with complex backgrounds, such as Grassland and SalineAlkali, where the attention mechanisms effectively reduced false positives.

5.5 Generalization Validation

To test the generalization capability of the proposed model, I used the independent Shrubwood dataset, which was not seen during training. The proposed model was trained on the four scene datasets (WaterSurface, Cropland, SalineAlkali, Grassland) and then evaluated on Shrubwood test images. The results were compared with the original U-Net. The visual predictions show that the proposed model successfully extracted solar panels despite the different surrounding vegetation and terrain, whereas the original U-Net produced many false positives and incomplete boundaries. The quantitative evaluation on Shrubwood is shown below.

Model mPrecision mRecall mF1 mIoU
U-Net 88.61% 89.43% 89.02% 89.01%
Ours 92.35% 93.82% 93.08% 93.08%

These results confirm that the improvements not only boost accuracy on similar scenes but also enhance the model’s adaptability to unseen environments, which is critical for real-world applications.

6. Application to Change Detection of a Panda-Shaped Solar Power Station

To demonstrate the practical value of the proposed method, I applied the trained model to monitor a large panda-shaped solar power station located in northern China. The station was built on saline-alkali land, which is similar to the SalineAlkali training scene. I obtained high-resolution satellite images (1 m GSD) from 2014, 2017, and 2020. After performing standard preprocessing steps such as radiometric calibration and geometric registration, I cropped the large images into patches of \(512 \times 512\) pixels. The solar panel extraction model, trained on the SalineAlkali dataset, was then used to predict the masks for each patch. The predicted patches were stitched together to form a complete map of the solar panels for each year.

The resulting maps clearly show the evolution of the solar farm. In 2014, only a small portion of the area was covered with solar panels. By 2017, the majority of the station had been constructed, and by 2020, the installation was essentially complete. Based on the pixel counts and the known resolution, I estimated the total area of solar panels for each year, as summarized in the following table.

Year Estimated Area (km²)
2014 3.082
2017 4.010
2020 4.253

This application demonstrates that the proposed model can be effectively used for long-term monitoring of solar panel installations, providing valuable information for infrastructure management, energy estimation, and environmental impact assessment. The method reduces the need for manual field surveys and enables rapid assessments over large areas.

7. Conclusion and Future Work

In this thesis, I proposed an improved U-Net network for the automatic extraction of solar panels from high-resolution remote sensing imagery. The key innovation is the integration of CBAM attention modules and coordinate attention residual blocks into the standard U-Net. The proposed feature enhancement fusion network effectively captures multi-scale contextual information, pays more attention to solar panel regions, and maintains robust performance in complex scenes.

Through extensive experiments on four scene-specific datasets and one validation dataset, I demonstrated that the proposed method outperforms traditional supervised classifiers and five state-of-the-art semantic segmentation models. The ablation study confirmed the individual contributions of the residual module, coordinate attention, and CBAM. The generalization validation on an unseen shrubwood dataset indicated superior transferability. Furthermore, the successful application to change detection of a panda-shaped solar power station highlighted the practical utility of the method for real-world infrastructure monitoring.

Despite the remarkable results, there are some limitations. The model was trained on images with a specific resolution (0.3 m GSD) and geographic region. The performance on lower-resolution satellite images or in different climate zones may degrade. Future work will focus on collecting more diverse datasets, including satellite images with various spatial resolutions and more scene types. Additionally, the model is computationally heavier than the original U-Net due to the added modules. I plan to explore lightweight attention mechanisms and knowledge distillation to reduce inference time while maintaining high accuracy. Finally, I aim to extend the method to not only extract solar panels but also classify their types (e.g., fixed-tilt or tracking) and estimate their energy generation potential, which would be highly valuable for renewable energy planning and management.

In conclusion, the improved U-Net presented in this research provides a reliable and efficient solution for solar panel extraction, contributing to the advancement of remote sensing applications in the field of renewable energy. The methods and findings can assist governmental agencies, energy companies, and environmental organizations in monitoring and managing solar panel installations more effectively.

Scroll to Top