# Detection and Optimization of Photovoltaic Arrays' Tilt Angles Using Remote Sensing Data
## 2 Methodology
### Detection of 2D Modules in VHR Imagery  
In the first stage, the detection of individual 2D modules is performed on the basis of VHR imagery. This can be accomplished using established semantic segmentation methods using U-shaped encoder-decoder architectures that have a good track record in VHR satellite imagery, namely, bidirectional aggregation network with occlusion handling (BAnet) [35], feature pyramid network based on attention aggregation (A2-FPN) [36], densely connected feature aggregation with Swin vision Transformer (DCSwin) [37], Multi-Attention Network (MANet) [38], and UNet-like Transformer (UnetFormer) [39]. The U-shaped architectures utilize several layers based on the encoding backbone to progressively encode the input image into high-dimensional feature space (i.e., feature embedding), effectively capturing complex features and patterns within the image. These high-dimensional features are then fed into decoding layers that reconstruct the target image (i.e., semantically annotated image). The semantic segmentation produces coarse binary classification, i.e., detection of individual modules (foreground) and disregarding the rest of the image (background). The coarse result is then further refined using FOM, similarly as recently performed by [21]. FOM is a simple U-shaped method over the coarse binary segmentation result, where, in the encoding phase, the feature embedding is achieved using 4 convolutional layers complemented with batch normalization and ReLU activation, while, in the decoding phase, the feature space is upsampled using 4 transposed convolutional layers. Each decoder stage also incorporates skip connections by concatenating the corresponding encoder output, allowing the preservation of high-frequency details. In the results, it is shown that the aforementioned methods are highly suitable for the detection of modules, by also trying various encoder backbones with additional ablation analysis of how FOM significantly affects the quality of the detection. To the authors' knowledge, only the ground truth data annotating the arrays or PV systems within VHR imagery is publicly available, since, at the time of writing of this paper, no datasets annotating individual modules in VHR imagery were found. Hence, in this paper, a basic image processing pipeline is introduced, which requires some manual post-processing, designed to create ground truth data for individual modules in VHR imagery. These data can then be used for training the semantic segmentation models. Initially, the RGB color-coded image is converted to the YCbCr color space, and then only the luminance component (Y) is used for subsequent detection. This reduces the computational complexity from three channels (RGB) to a single channel, which sufficiently defines the shape and structure of the modules. Next, a morphological maxtree [40] is constructed through all gray levels to detect all connected components that approximate rectangles (Figure 3b). Hence, only quadrilaterals with the four inner angles within the range of \([85^{\circ},90^{\circ}]\) are retained (Figure 3b). These are then further filtered based on their neighborhood, wherein each rectangle (a potential module) requires at least two neighboring rectangles with a similar 2D size (i.e., width and height) and spatial orientation (Figure 3c). The retained rectangles are thresholded into a binary mask representing the modules' ground truth data. Lastly, manual postprocessing is performed to remove potential outliers (incorrectly detected modules) or to add missing modules (Figure 3d), since this image processing pipeline cannot detect modules that are obstructed by the surrounding context. Traditional image processing methods are inherently limited by their reliance on predefined heuristics, making them susceptible to performance degradation when faced with complex scenarios common in aerial imagery.