Abstract
Delineation of building footprints from high-resolution aerial imagery has emerged as a cornerstone for sustainable urban growth, hazard assessment, and the generation of 3D city models. This article extends our earlier study of U-Net-based building segmentation on 20 cm RGB orthophotos of Athens, Greece. In addition to a U-Net trained from scratch and a U-Net with a pretrained ResNet-34 encoder, we trained bagged ensembles of 20 members for three architectures, including a U-Net++ with a ResNet-50 encoder. All models are trained on the same selected city area and evaluated on a single, spatially disjoint held-out block from another city suburb, for which ground truth was produced. Inference combines eight-fold test-time augmentation with a reconstruction that keeps only the central region of each patch, stitches soft probability maps instead of binary masks, averages them across members, and applies morphological processing to produce the final reconstructed block. This same scene is processed in two ways: first, in its original orientation and, second, aligned with the orientation of the training area buildings through appropriate rotation. The best configuration, a bagged U-Net on the rotated block, reaches a block-level IoU of 89.76% and an F1-score of 94.60%. The same bagged model compares favorably to all other single models after improvement achieved through morphological post-processing.
1. Introduction
Automatic building detection in urban areas using high-resolution aerial imagery plays a vital role in GIS data updating, population estimation, and illegal construction monitoring, alongside traditional applications such as urban planning, and 3D building modeling. The growing availability of high-resolution aerial images has notably enhanced the accuracy of automatically extracted building footprints and, when elevation data is available, generated 3D building models. Nevertheless, automated extraction systems still are faced with significant challenges from shadows, vegetation occlusion, variations in color and texture, and man-made installations found on building rooftops. This work is a comprehensive extension of our initial study presented at the NIDS’2025 conference [1] to further improve the precision of automatically extracted building footprints.
Over the past few years, the deployment of deep learning architectures has become a cornerstone for automated building detection [2,3,4]. Most of these methodologies are based on convolutional networks, prominently featuring configurations like Fully Convolutional Networks (FCNs) [5], the highly popular U-Net architecture [6], and Mask R-CNN [7]. These networks are conventionally optimized using annotated datasets containing manually delineated building footprints as ground truth. While such architectures have achieved substantial breakthroughs across broader computer vision benchmarks—including classification and object localization—semantic segmentation paradigms have recently dominated the field. By executing pixel-level classification to differentiate between building structures and background features, these models yield highly refined segmentation maps close to the true building boundaries.
In this study, we assess the quality of segmentation maps generated for urban building structures using standard evaluation metrics, utilizing a high-resolution aerial dataset from the Kallithea district of Athens, Greece. Our methodology employs two distinct semantic segmentation models derived from the U-Net architecture. We first implement the baseline U-Net, utilizing its U-shaped encoder–decoder framework linked by skip connections. Despite its initial design for biomedical applications, this network has been widely adopted for remote sensing and computer vision applications [8,9]. To take advantage of the extensive feature hierarchies learned by deep convolutional neural networks pretrained on massive image repositories, we also implement a U-Net variant with a ResNet-34 pretrained encoder. Such hybrid architectures often improve classification accuracy, particularly in complex urban environments [10,11]. Finally, to quantify the performance gains enabled by these deep learning approaches, we benchmark both sets of segmentation outputs against a traditional baseline: a shallow, multilayer feedforward neural network operating as a pixel-wise classifier across several spatial neighborhood dimensions.
The present article extends the work presented in [1] in four directions. First, a ground truth segmentation mask was generated for an independent, spatially disjoint held-out building block (located in the Petralona district) in order to assess model transferability to an unseen urban scene both qualitatively and quantitatively. Second, in addition to the two single models mentioned above, 20-member bootstrap-aggregated (bagged) ensembles [12] were trained for three architectures: the original U-Net and U-Net/ResNet-34 models used in [1], and a U-Net++ [13] utilizing an ImageNet-pretrained ResNet-50 encoder. Third, inference is revised: every patch is predicted with eight-fold test-time augmentation [14], only the central region of each prediction is kept, soft probability maps rather than binary masks are stitched and averaged across ensemble members, and morphological post-processing is applied once, to the reconstructed block. Fourth, the held-out evaluation block is processed both in its original orientation and in rotated form to measure how block orientation affects the patch-based pipeline.
The rest of this article is organized as follows. Section 2 reviews related work. Section 3 presents the segmentation models, the bagging scheme and the inference and reconstruction procedure. Section 4 describes the training area and the held-out evaluation block. Section 5 details the training and evaluation protocols. Section 6 presents and discusses the results on the training area and on the held-out block. Finally, Section 7 presents the conclusions.
2. Related Work
Building extraction from high-resolution imagery has been surveyed repeatedly as deep learning replaced hand-crafted features [15,16]. Yuan et al. [15] organize recent methods by the way they represent and learn building evidence and by the form of their input and output, and observe that most published systems are trained and evaluated inside a single dataset. Yang et al. [16] review 243 papers and list five open challenges, three of which appear directly in our results: optimization of complex boundaries, variability of building shape and spectrum, and interference from trees and shadows.
Architecturally, most systems descend from fully convolutional networks [5] and from U-Net [6]. Nested and residual variants such as U-Net++ [13], deep residual U-Net [10] and ResUNet-a [11] refine the skip pathways or the encoder, while attention and boundary-aware modules target the placement of the outlines themselves [17]. Transformer encoders have since been applied to the same task [18], building on general-purpose transformer segmentation architectures [19], and promptable foundation models trained on very large mask corpora have opened a further line of work [20]. The models compared here belong to this convolutional family, because our objective is not to propose a new architecture but to measure how far a careful training and inference protocol carries established ones.
Generalization across areas is measured far less often than accuracy within a dataset, although it is what an operational mapping workflow needs. Pham et al. [21] quantify the degradation: with DeepLabV3+ [22] and a ResNet-18 encoder they report about 85% mean IoU inside the WHU dataset, but 66% under a resolution shift and 51% under a geographic shift from Japanese to Thai imagery, and they show that geometric augmentation recovers a substantial part of that gap. Kshirsagar et al. [23] observe the same geographic bias in building damage assessment across 17 disaster sites. The present study is a small instance of the same problem: the models never see the evaluation block during training.
Two ingredients of the procedure used here are older than the architectures themselves. Bagging [12] and, more recently, deep ensembles [24,25] reduce the variance of a predictor by averaging models trained on different samples or from different initializations, while test-time augmentation [14] averages the predictions of one model over transformations of its input, the aggregation rule itself being a design choice rather than a given [26]. Both are routine in medical image segmentation but are reported less often in building extraction, where most published gains come from new architectures. Simple morphological processing of the predicted mask is common practice [27], yet its configuration is rarely stated or ablated [28]. This article measures all three on the same held-out block.
3. Methodology
Building detection involves delineating building footprints from aerial or satellite imagery through semantic segmentation algorithms that classify pixels or regions into building and background categories. Currently, deep learning architectures consistently deliver state-of-the-art results across a broad spectrum of computer vision applications. Unlike traditional, shallow neural network classifiers that primarily execute independent pixel-wise classification, deep fully convolutional networks produce dense, pixel-wise classifications that effectively segregate building footprints from background features. The following sub-sections describe the segmentation architectures used in this work, the bagging scheme used to build ensembles of them, and the inference procedure that turns patch predictions into a building map of a whole block.
3.1. U-Net Architecture for Building Detection
The classic U-Net model [6] features a symmetric encoder–decoder convolutional design engineered to merge high-level semantic features with high-fidelity spatial details as illustrated in Figure 1a. Within the contracting left part of the network (the encoder), consecutive convolution and pooling operations extract contextual data at progressively reduced resolutions. Conversely, the expansive right part of the network (the decoder) executes up-sampling operations to reconstruct a dense pixel-wise segmentation map. A defining characteristic of the U-Net architecture is the integration of skip connections that bridge corresponding layers between the encoder and the decoder. By transferring high-resolution feature maps directly across these pathways, the network recovers localized spatial features otherwise lost to pooling layers, thereby enabling the delineation of sharper structural boundaries. Actually, this seamless fusion of semantic context and local topology has been demonstrated to significantly enhance the overall segmentation performance. This multi-scale representation strategy ultimately allows the model to precisely extract object contours, even when operating within highly complex or cluttered backgrounds.
Figure 1.
The two U-Net variants as configured in this work: (a) the U-Net architecture and (b) the U-Net++ architecture. Numbers inside the blocks are channel counts and the spatial sizes are those of the 160 × 160 input patches.
In this work, the U-Net is trained from scratch. It has five resolution levels with two 3 × 3 convolutions and ReLU activations per level, max-pooling for down-sampling, and up-sampling followed by concatenation with the encoder features of the same level. Dropout with a rate of 0.5 is applied at the two deepest levels, and a 1 × 1 convolution with sigmoid activation produces the building probability of each pixel. The number of filters at the first level (32 or 64) is selected by hyperparameter search and doubles at every level.
3.2. U-Net with a Pretrained ResNet-34 Encoder
In the second architecture, the standard U-Net decoder is paired with a ResNet-34 [29] backbone, which is a deep residual network (see Figure 2) pretrained on the ImageNet database [30]. Through pretraining, the encoder becomes equipped with edge and texture features that are suitable for aerial images. As in the classic U-Net, skip connections forward feature maps from the encoder’s residual stages to the decoder. This combination of a pretrained ResNet encoder and a U-Net decoder enables the network to exploit both high-level visual representations and fine-grained spatial information. The model is implemented using the segmentation_models library [31]. In the single model, the encoder weights are kept frozen and only the decoder is trained, with the number of filters of the first decoder stage right after the bottleneck (32, 64 or 128) selected by hyperparameter search. In the bagged ensemble, the default decoder configuration is used, and the encoder is first frozen and then fine-tuned together with the decoder (see Section 5.1). Hereafter, this model will be referred to as U-Net/ResNet-34.
Figure 2.
The ResNet-34 encoder of the U-Net/ResNet-34 model as configured in this work; the four stage outputs (shown with different shades of blue) are the feature maps passed to the decoder.
3.3. U-Net++ with a Pretrained ResNet-50 Encoder
U-Net++ extends the conventional U-Net architecture by introducing nested convolutional blocks within the skip connections (Figure 1b), thereby forming a series of interconnected U-Net structures with progressively increasing depth [13]. In this architecture, encoder feature maps are not transferred directly to the corresponding decoder layers. Instead, they pass through intermediate convolutional nodes before reaching the decoder. This dense, nested arrangement facilitates the integration of multi-scale information, since the feature representation at each decoder level incorporates outputs from several encoder and decoder nodes operating at different stages and resolutions. The modified skip pathways of U-Net++ facilitate the integration of feature representations with different levels of semantic abstraction, providing a more versatile fusion mechanism than the direct combination of features at corresponding resolutions in the original U-Net. These modifications can improve segmentation performance, as the nested convolutional blocks and expanded decoder pathways progressively integrate and refine information across the network, both horizontally and vertically.
The U-Net++ architecture is implemented using the keras-unet-collection library [32], employing a ResNet-50 encoder initialized with ImageNet-pretrained weights. It has five levels with 32, 64, 128, 256 and 512 filters, two convolutional layers per block on both the down-sampling and the up-sampling paths, batch normalization and ReLU activations, strided convolutions for down-sampling and transposed convolutions for up-sampling, and a sigmoid output. Deep supervision is not used. This architecture is used only within the bagging scheme.
3.4. Bootstrap Aggregating (Bagging)
Bagging trains several instances of the same model on bootstrap replicates of the training set and combines their outputs. For a training pool of N patches, each replicate is formed by drawing N patches uniformly with replacement. The members therefore differ in the data they see, and, because each member uses its own random seed, also in the initialization of their non-pretrained layers and in the order and augmentation of their mini-batches. This diversity is what allows an ensemble to reduce the variance of its members’ predictions [24,25]. In this work, ensembles of M = 20 members are trained for each architecture, and their predictions are combined by averaging the members’ probability maps pixel-wise (soft voting) before thresholding (Section 3.5).
3.5. Test-Time Augmentation and Block Reconstruction
Each 160 × 160 patch is predicted with test-time augmentation (TTA) [14] over the full dihedral group of eight transformations: the identity, horizontal and vertical flips, rotations by 90°, 180° and 270°, and the two transpositions (i.e., the two diagonal flips). The eight transformed copies are processed in a single batch, each prediction is mapped back to the original orientation, and the eight probability maps are averaged. Averaging is the simplest of several possible aggregation rules [26]; Section 6.3 reports the corresponding comparison for the ensemble members. The resulting probability map is stored with 16-bit precision rather than as a binary mask, so that no decision is made at patch level.
Predictions near the patch border are less reliable, because the network sees less context there. The patch grid is therefore laid out with a stride equal to the central region, 120 pixels, so that the central 120 × 120 parts of neighboring patches meet precisely to cover the block exactly once, while the 20-pixel-wide border of every patch serves only as context. The probability map of the block is assembled from these central parts; for an ensemble, the maps of the 20 members are averaged pixel-wise, each of them already being the average of its eight TTA predictions.
The averaged map is thresholded at 0.5 to produce the binary result with the detected buildings. The reconstruction then applies a 3 × 3 morphological opening followed by a 3 × 3 closing to the finished block, rather than to individual patches, where such processing would act on partial evidence and erode objects against the patch borders; both operations treat the pixels outside the block as neutral, so that they do not erode buildings that touch the block border. Because this default clean-up is arbitrary, a grid search was run on the first annotated block of the Kallithea training area (which overlaps with the training patches), over the size of the closing (3, 5, 7) and opening (3, 5) structuring elements, the filling of enclosed holes (up to 100 pixels, up to 500 pixels, or all of them), and the removal of objects smaller than 50 or 200 pixels. The optimum configuration found with the above procedure was composed of a 5 × 5 closing, a 3 × 3 opening, and the filling of enclosed holes of up to 100 pixels. This configuration was subsequently fixed and applied to evaluate the performance of all models on the spatially disjoint test block in Petralona without any parameter tuning on the evaluation data. Section 6.2 reports the results of this morphological clean-up against the initial output, and Figure 3 summarizes the complete inference pipeline.
Figure 3.
Inference and block reconstruction on the plain version of the Petralona block, shown for the bagged U-Net: (a) the block with its patch grid; (b) the nine overlapping 160 × 160 patches, whose 20-pixel-wide border serves as context only; (c) the central 120 × 120 part of each probability map (with gray, the area outside the annotated block); (d) stitching of these probability maps back into the block; (e) the binary mask after thresholding and clean-up; and (f) its comparison with the ground truth (white for TP, red for FP, black for TN and blue for FN).
4. Data Preparation
4.1. Training Area: Kallithea
This study utilizes 20 cm spatial resolution RGB aerial orthophotos of the Kallithea suburb in Athens, Greece, originally acquired by the National Cadastre and Mapping Agency in 2007. From this dataset, a 1795 × 1825 pixel sub-image was isolated as the primary region of interest (Figure 4a). The outlined square boundaries shown in Figure 4a highlight two distinct building blocks designated for the qualitative and quantitative performance assessment of the developed models. To validate these models, the corresponding building footprint ground truth image (Figure 4b) was manually generated using a combination of bird’s-view images and historic Google Street View imagery from the same area and consistent with the data acquisition year.
Figure 4.
(a) The area of interest in Kallithea; (b) the corresponding ground truth.
To train the multilayer feedforward networks (MFN), three datasets were constructed via random sampling, each containing 20,000 instances. The labeled samples within these datasets were of three kinds based on their spatial context: (a) RGB values of individual pixels along with the binary (0/1) value of the respective ground truth pixel, (b) pixel values extracted from 3 × 3 local neighborhoods, and (c) pixel values extracted from 5 × 5 neighborhoods. For both neighborhood configurations, the target label from the ground truth image was assigned based on the central pixel. Within each dataset, 70% of the samples was allocated for training, while the remaining 30% was divided equally for validation and testing.
Regarding the U-Net architectures, a dataset comprising 19,229 sub-images of 160 × 160 pixels, along with their corresponding ground truth targets, was generated from the primary region of interest. This dataset was compiled using random selection with overlapping patches, supplemented by data augmentation techniques such as vertical reflections and rotations in 90-degree increments. The dimensions of the sub-images were determined to satisfy the architectural constraints of the U-Net, conforming with the progressive reduction in spatial dimensions caused by sequential convolution and pooling layers. Finally, the above dataset was partitioned according to the 70–15–15 splitting ratio into a training subset, a validation subset (used for early stopping and hyperparameter monitoring), and an internal evaluation subset (used to assess model fit within the training region, rather than independent spatial generalization).
Because the 160 × 160 sub-images are sampled randomly and have a high degree of overlapping, the evaluation patches in this dataset share pixels with training patches. Consequently, the accuracy measured on them (Section 6.1) reflects internal evaluation on the training region—indicating how well a model fits the training distribution—rather than independent generalization performance. To assess model transferability to an unseen urban district without data leakage, this article extends our previous work [1] by introducing a newly annotated, spatially disjoint held-out block from a distinct district of Athens, enabling quantitative evaluation. The same patch datasets were used for training and internal validation of the single models. For the bagged ensembles, the dataset was reduced through random selection to 80% of the original size (i.e., 15,383 patches) in order to accelerate training of the ensemble members, of which 10%, also selected at random, was held out for validation, leaving a training pool of N = 13,845 patches from which the bootstrap replicates were drawn.
It is worth noting that the morphological post-processing parameters were tuned using the first of the two urban blocks within the Kallithea training region, which partially overlaps with the training patches. While this introduces a slight optimistic bias when evaluating that specific internal block, freezing the parameters prior to testing ensures they are not overfitted to the unseen Petralona scene. Consequently, the improvements observed on the independent held-out block represent an unbiased and rather conservative estimate of the potential gains achievable with domain-specific post-processing.
4.2. Held-Out Evaluation Block: Petralona
To examine the effect of geographic separation on model transferability, a single annotated building block from the Petralona suburb of Athens was selected (Figure 5). It came from the same orthophoto collection as the training area, it covered 320 × 335 pixels, and its ground truth was produced by hand, as for Kallithea. No patch of this block was used for training or validation; it was used for inference only. This block represents a highly dense and heterogeneous urban layout. In addition to having a different orientation, it features a high concentration of closely spaced urban structures with significant variation in roof materials and objects, complex shading patterns, and surrounding space, serving as a challenging test case for unseen-scene transferability under comparable imaging conditions.
Figure 5.
The building block in the Petralona suburb (left) and its corresponding ground truth (right) used as the held-out evaluation block.
Two versions of the block were prepared. In the plain version, the block was tiled with a stride of 120 pixels into a 3 × 3 grid of 160 × 160 patches. In the rotated version, the neighborhood was first rotated by −13°, so that the sides of the block became parallel to the patch grid from Kallithea region. The rotation angle was found through standard image processing and computer vision techniques on the Kallithea and Petralona images. These techniques included edge detection using filtering with Sobel operators and Otsu’s thresholding, followed by Hough transform to obtain the dominant edge orientations of the two images; the angle of rotation was then computed as the difference between the two orientations. Finally, the rotated image was resampled with bilinear interpolation, and the affine transformation was stored, so that predictions could be brought back into the upright frame.
5. Experimental Setup
5.1. Training Protocols
The hyperparameters of the single models are selected by a random search with KerasTuner [33] over five trials of ten epochs each, maximizing the internal validation IoU. Those hyperparameters are: the learning rate (10−3 or 10−4) and the number of first-level filters (32 or 64) for the U-Net, and the learning rate (log-uniform in [10−5, 10−3]) and the number of decoder filters (32, 64 or 128) for the U-Net/ResNet-34. The selected models are then retrained with the Adam optimizer [34] and the binary cross-entropy (BCE) loss, with early stopping on the validation loss (U-Net, up to 50 epochs) or on the validation IoU (U-Net/ResNet-34, up to 150 epochs), both with a patience of 15 epochs, and the weights of the best epoch are kept (corresponding to the minimum validation loss for U-Net and the maximum validation IoU for U-Net/ResNet-34) to prevent overfitting on the training subset. Inputs are scaled to [0, 1], and no on-the-fly augmentation is applied. The validation subset is used only for this selection and for early stopping, never for a gradient update. The search selected a learning rate of 10−4 and 64 filters at the first level for the U-Net, and a learning rate of 3.8 × 10−4 with 64 decoder filters for the U-Net/ResNet-34, with validation IoU values of 0.909 and 0.933 respectively.
The members of the bagged ensembles are trained with a loss that sums BCE and the Jaccard (IoU) loss, which directly targets the evaluation metric, and with on-the-fly augmentation: random horizontal and vertical flips and rotations by multiples of 90° and, with probability 0.5, random changes in brightness (up to ±15% of the intensity range) and contrast (factor 0.85–1.15). Inputs are normalized as each pretrained encoder expects: the ResNet-34 of the segmentation_models library receives raw 0–255 RGB values, which its first layer normalizes, and the ResNet-50 of keras-unet-collection receives the Keras ImageNet preprocessing, that is, conversion to BGR and subtraction of the ImageNet channel means. The models with a pretrained encoder are trained in two phases. In the first, the encoder is frozen and the decoder is trained with a learning rate of 10−4 for up to 50 epochs, using the validation set for early stopping (patience of 5 epochs, minimum improvement 10−4) and halving of the learning rate after three epochs without improvement (down to 10−6). In the second, all layers are unfrozen and the whole network is fine-tuned with a learning rate of 10−5 for up to 15 epochs, with the same early-stopping rule. In both phases, the weights of the best epoch are restored. The mini-batch size is 64.
The bagged U-Net is the architecture of Section 3.1, trained from scratch. Having no pretrained encoder, it has no frozen phase and is trained in one phase, with the same loss, augmentation, mini-batch size and early-stopping rule as the other members. Table 1 summarizes both protocols. All models were implemented in TensorFlow 2.21/Keras 3.15.1 and trained on an NVIDIA A30 GPU.
Table 1.
Training protocols of the single models and of the members of the bagged ensembles.
5.2. Evaluation Protocol and Metrics
Performance is measured with four standard metrics computed from the confusion matrix variables of the building class. Specifically, True Positives (TP) represent correctly detected building pixels, False Positives (FP) denote background pixels incorrectly classified as buildings, and False Negatives (FN) correspond to actual building pixels that the model missed. Based on these variables, the evaluation indicators are formulated as: Precision = TP/(TP + FP), Recall = TP/(TP + FN), F1-score = 2TP/(2TP + FP + FN) and IoU = TP/(TP + FP + FN). Correctly classified background pixels (true negatives) enter none of the four metrics: precision falls when background is labelled as building, recall when buildings are missed, and the F1-score and IoU when either occurs.
All results on the Petralona block are block-level: for every run, the probability maps of its members are averaged and reconstructed as described in Section 3.5, and the binary map obtained from the whole block is compared with the block ground truth. The metrics are therefore computed once per run, from the pixel counts of the Petralona block, and not averaged over patches. Results are reported with and without the clean-up, since it turns out to matter as much as the choice of model, the tuned configuration of Section 3.5, and plain thresholding at 0.5 with no morphological processing.
6. Results and Discussion
6.1. Evaluation on the Kallithea Region
This subsection reports the internal evaluation results obtained with the models on the two building blocks framed in Figure 4a which are situated within the Kallithea training region. To establish a baseline performance for the building extraction task, a shallow multilayer feedforward network featuring a single hidden layer was optimized for pixel-wise classification across three distinct spatial input configurations. Specifically, the model was evaluated using spatial context from 1 × 1, 3 × 3 and 5 × 5 windows centered on the target pixel. Comparative experiments with the above three spatial neighborhoods on networks with 25 and 50 hidden nodes indicated that a configuration of 50 hidden neurons along with a 5 × 5 input neighborhood yielded peak performance, achieving an accuracy of 82.73% on the randomly partitioned internal evaluation set. This optimized input setting and network architecture also produced the most accurate building footprints across the two specific blocks, as shown in Table 2. Quantitative evaluation of the network’s efficacy relied on four standard segmentation metrics: Intersection over Union (IoU), Precision, Recall, and the F1-score. Additionally, for a qualitative visual verification, the generated building segmentation masks are illustrated in Figure 6.
Table 2.
Performance of the shallow baseline network on the training-area blocks.
Figure 6.
Segmentation results for the two blocks in the Kallithea region obtained using the shallow network: (a) block 1; (b) block 2.
The classic U-Net architecture was trained using a learning rate of 0.0001 and a mini-batch size of 16, incorporating an early stopping mechanism to prevent overfitting on the validation set. When evaluated on the internal evaluation set—composed of randomly sampled 160 × 160 pixel patches—its IoU score was 97.12%. Except for the learning rate stated in Section 5.1, the hybrid U-Net/ResNet-34 variant was trained with the same hyperparameters as the classic U-Net model, yielding an improved IoU score of 98.39% on the same internal evaluation subset.
The quantitative performance of the deep learning architectures across the two urban blocks is presented in Table 3 and Table 4, utilizing the identical four evaluation metrics established for the baseline network. A direct comparison with the baseline framework reveals a substantial performance enhancement across all computed metrics for both deep learning models. To facilitate a qualitative visual inspection, the segmentation maps generated by the top-performing model for each block, along with their respective ground truth annotations, are illustrated in Figure 7.
Table 3.
Segmentation metrics obtained by the U-Net model on the training-area blocks.
Table 4.
Segmentation metrics obtained by the U-Net/ResNet-34 model on the training-area blocks.
Figure 7.
The top building segmentation maps obtained by the two models on the source-area blocks: (a) ground truth of block 1; (b) ground truth of block 2; (c) U-Net segmentation map for block 1; (d) U-Net/ResNet-34 segmentation map for block 2.
The experimental results on the two building blocks of Kallithea were assessed as an internal evaluation rather than an independent test. Due to the spatial proximity and unavoidable patch overlaps inherent to the patch extraction process within the same orthophoto, these specific metrics primarily reflect the models’ capacity for local reconstruction. As widely acknowledged in the literature, automated building extraction remains a highly complex task due to shadows, rooftop variations, and low contrast with the environment. While the models accurately reconstructed the morphology of these two local blocks, their out-of-distribution transferability is explicitly evaluated on the single, entirely unseen and spatially separated Petralona dataset, which shares zero data or pixels with the training phase.
6.2. Evaluation on the Held-Out Block
Table 5 reports the results on the spatially disjoint Petralona block using the morphological post-processing parameters fixed from the Kallithea training region. Applied without any calibration on the evaluation scene, the morphological clean-up adds an unbiased 0.74% to 1.76% over the initial IoU (shown in the last column). With the morphological clean-up the ranking of the models is nearly unchanged—the bagged U-Net on the rotated block remains first with an IoU of 89.76% and an F1-score of 94.60%, ahead of the single U-Net/ResNet-34 on the rotated block (89.53%) and the bagged U-Net on the plain block (89.50%)—while precision (94.03–95.18%) and recall (91.59–94.56%) become balanced, because both closing and hole filling recover missed pixels.
Table 5.
Block-level results on the Petralona block after the morphological clean-up (5 × 5 closing, 3 × 3 opening, enclosed holes up to 100 px filled). The last column is the IoU before clean-up. Best value per column in bold.
Processing the block in rotated form improves the IoU in four of the five configurations, most notably for the single U-Net/ResNet-34 (+2.01%); for the three ensembles the gain is from 0.26% to 0.36%, with the single U-Net being the sole exception (−0.54%). The bagged U-Net++/ResNet-50 achieves the lowest scores among the three ensembles on both versions of the block, with or without morphological post-processing. In particular, it falls 1.8% to 1.9% below the bagged U-Net, performing at the level of the weaker single models.
Because IoU is computed after thresholding and is not a linear function of the predicted probabilities, it is not the metric that averaging is expected to improve. Table 6 therefore evaluates the probability maps themselves: in terms of the Brier score, the ensemble outperforms the mean member in all six configurations and surpasses 14 to 19 of the 20 members. The underperformance of the models with pretrained encoders relative to the original U-Net trained from scratch—particularly that of U-Net++/ResNet-50—is likely driven by architectural and domain factors. Some plausible hypotheses include: (i) the initial spatial down-sampling of the ResNet stem which reduces spatial resolution by 4 times prior to the residual blocks, potentially blurring fine boundary details on 160 × 160 patches, compared with U-Net’s full-resolution initial convolutions; (ii) domain discrepancy, whereby pretrained encoders retain hierarchical representations optimized for general-purpose object recognition rather than the specialized spatial and textural features learned end-to-end by the U-Net trained from scratch; and (iii) the relatively brief unfrozen fine-tuning phase at a low learning rate (see Section 5.1), which may have limited the adaptation of deeper pretrained layers to the target domain.
Table 6.
Brier score of the members and of the ensemble, computed on the probability maps before thresholding. Lower is better.
The spread of the ensemble members by architecture is shown in Table 7. For the results obtained using morphological clean-up, the standard deviation of the members is 0.30–0.33% for the U-Net trained from scratch, 0.41–0.58% for the U-Net++/ResNet-50 and 0.57–0.66% for the U-Net/ResNet-34, so the pretrained ResNet-34 encoder gives the least stable members under bootstrap resampling. The same conclusion could be derived by the min-max deviations where U-Net/ResNet-34 exhibits more than two times higher min-max deviation than U-Net.
Table 7.
Members of each ensemble against the ensemble itself, before and after the clean-up. Δ is the ensemble minus the member mean; the last column counts the members scoring above the ensemble.
Figure 8 shows the ground truth of the block together with the errors of three configurations on its rotated version. The errors form a narrow band along the outlines of the block and of its inner courtyard: no building is missed or invented as a whole. For the two best configurations, about 57% of the missed pixels lie within three pixels of the predicted outline, against 54% for the bagged U-Net++/ResNet-50, so a large part of what separates these configurations is the placement of the boundary rather than detection.
Figure 8.
Ground truth and error maps on the Petralona block (rotated version with post-processing): (a) ground truth, buildings in white; (b) U-Net/ResNet-34, single; (c) U-Net, bagged; (d) U-Net++/ResNet-50, bagged. In (b–d), white marks correctly detected building pixels, black correctly detected background, red false detections and blue missed building pixels.
6.3. Combining the Members
The members of an ensemble are combined by averaging their probability maps before thresholding. Table 8 compares that rule with the median and with hard voting, in which each member is thresholded first and a pixel is kept when at least k of the 20 members call it building. Averaging, the median and majority voting agree to within 0.13 percentage point a rule implies: requiring a single member raises the mean IoU over the six ensembles from 87.97% to 89.81% without morphological processing, but only from 88.86% to 89.54% after the clean-up, because the minimum number and the closing act on the same boundary errors and their effects are not additive.
Table 8.
Block-level IoU of the 20-member ensembles under different rules for combining the members. Mean and median threshold the combined probability at 0.5; k ≥ n keeps the pixels called building by at least n of the 20 members.
6.4. Computational Cost
All models were trained and evaluated on the NVIDIA A30 of Section 5.1. Table 9 reports the complexity and the inference cost of each architecture for the default values of the ensemble protocol, and Table 10 the training cost of both single models and ensemble members. The twenty-member ensemble with eight-fold test-time augmentation needs under 20 s for the whole block against about 1 s for a single model, so the cost of the method lies in training, about 47 h for the full set of models, rather than in inference; the augmentation itself costs only 1.3× in wall-clock time despite eight times the arithmetic, because a batch of eight does not saturate the GPU. Inference time follows network depth rather than arithmetic: at this patch and batch size the GPU is bound by kernel-launch latency, which is why the U-Net trained from scratch is the fastest of the three although it performs the most operations.
Table 9.
Model complexity and inference cost on an NVIDIA A30 for 160 × 160 × 3 patches and ensemble-member (batch 64) protocols. GMACs are the Giga multiply–accumulate operations of one forward pass. The last column reports the inference time per patch with eight-fold TTA.
Table 10.
Training cost on an NVIDIA A30. The single models include the five-trial, ten-epoch hyperparameter search. Totals are upper bounds, that correspond to the maximum number of epochs.
6.5. Discussion
The IoU values of at least 96.66% measured on the training-area blocks (Table 3 and Table 4) reflected the spatial overlap between the training and internal evaluation patches; on the single spatially disjoint block from a different geographic area (Petralona), the block-level IoU of the same architectures lies between 87.59% and 89.76% (Table 5). While these values are lower than the internal evaluation scores, they demonstrate promising transferability to this specific unseen urban block under comparable imaging conditions, though broader generalization across diverse geographic regions and sensors remains to be established.
Three further observations can be made. First, averaging 20 members is worth little over the average member (Table 7): with the clean-up the ensemble lies between 0.03% and 0.28% above it, and without morphological processing between 0.10% and 0.50% above. The difference between a single model and the bagged run of the same architecture is larger, reaching 2.07%, though this comparison also reflects the different training protocols summarized in Table 1. The practical value of bagging here is that it aggregates the 20 members into a single deterministic prediction that mitigates individual member spread (which reaches 2.76%) and avoids the risk of selecting an underperforming run.
Second, processing this same scene in rotated form—which represents an orientation-aligned evaluation of the identical block rather than an independent test sample— helps in four of the five configurations, which supports the reason it was introduced. Third, precision exceeds recall almost in every configuration with morphological clean-up, so most errors are missed building pixels; as Figure 8 shows, these concentrate along building borders, in shadowed areas and in regions whose color resembles the background.
Beyond the morphological post-processing used here, we believe that improving the input images, e.g., through shadow removal or color smoothing with edge-preserving algorithms, and fusing optical with elevation data will further improve the accuracy of segmentation. The recent literature on high-resolution urban datasets demonstrates that the integration of optical imagery with LiDAR data substantially enhances the precision of the extracted building footprints [35].
7. Conclusions and Future Work
This article extended our study of U-Net-based building detection from 20 cm aerial orthophotos presented in [1]. Internal evaluation IoU values above 96% were reported for the two blocks of the training area, reflecting dependencies between training and internal evaluation data. To assess out-of-distribution transferability without data leakage, building detection performance was evaluated on a single, spatially disjoint held-out block from another suburb, Petralona (evaluated in both its original and orientation-aligned forms as two views of the same scene), for which manually annotated ground truth was created. Specifically, our framework incorporated bagged ensembles of 20 members for three architectures, eight-fold test-time augmentation, and a reconstruction scheme that stitches the central regions of soft probability maps, averages them across ensemble members and post-processes the finished block.
On the held-out block, the best configuration, a bagged U-Net applied to the rotated block, reached an IoU of 89.76% and an F1-score of 94.60%. Averaging the 20 members of an ensemble mitigated the prediction spread observed across individual bootstrap runs—yielding a single, stable output that consistently matched or slightly exceeded the mean member performance—while the larger gains over the standalone single models (up to 2.07% in Table 5) also reflect differences in the underlying training protocols. Processing the block in rotated form improved most configurations, while morphological post-processing improved the IoU metrics by 0.74% to 1.76%. The bagged U-Net++ with a ResNet-50 encoder remained the weakest of the three ensembles, suggesting that a deeper encoder and denser skip connections do not by themselves improve out-of-distribution transferability in this setting.
A limitation of the current evaluation framework is the geographic constraint of the independent test set, which is restricted to a single dense block within the Petralona suburb. While this area provides a high density of complex building structures and diverse rooftop occlusions, evaluating the models across wider test areas and varying imaging conditions is essential to establish broader geographic generalization. Future work will scale the model evaluation by manually annotating and incorporating additional structural blocks and areas from the broader Petralona dataset, evaluate transformer-based segmentation architectures within adapted patch-reconstruction pipelines, further refine the post-processing operations, and investigate the integration of RGB aerial images with lower-resolution elevation data to construct precise 3D building models.
Author Contributions
Conceptualization, methodology, formal analysis, data curation, A.M. and N.V.; software, writing—original draft, figures and tables preparation, A.M.; writing—review and editing, N.V.; project administration, supervision, resources, N.V. and D.G. All authors have read and agreed to the published version of the manuscript.
Funding
This research received no external funding.
Data Availability Statement
The data presented in this study are available upon request from the corresponding author due to privacy.
Acknowledgments
We would like to thank the National Cadastre & Mapping Agency of Greece for providing us with the high-resolution aerial photographs.
Conflicts of Interest
The authors declare no conflicts of interest.
Abbreviations
The following abbreviations are used in this manuscript:
| BCE | Binary Cross-Entropy |
| FCN | Fully Convolutional Network |
| FN | False Negative |
| FP | False Positive |
| IoU | Intersection over Union |
| LiDAR | Light Detection and Ranging |
| ResNet | Residual Network |
| TN | True Negative |
| TP | True Positive |
| TTA | Test-Time Augmentation |
References
- Margaris, A.; Vassilas, N.; Ghazanfarpour, D. Building Detection from High-Resolution Aerial Images Using Deep Learning Techniques. In Proceedings of the 5th International Conference on Novel & Intelligent Digital Systems (NiDS 2025), Athens, Greece, 24–26 September 2025; Lecture Notes in Networks and Systems 1707; Springer: Cham, Switzerland, 2026; Volume III, pp. 329–338. [Google Scholar]
- Sun, G.; Huang, H.; Zhang, A.; Li, F.; Zhao, H.; Fu, H. Fusion of Multiscale Convolutional Neural Networks for Building Extraction in Very High-Resolution Images. Remote Sens. 2019, 11, 227. [Google Scholar] [CrossRef] [Scilit]
- Shetty, A.; Mohan, K. Building Extraction in High Spatial Resolution Images Using Deep Learning Techniques. In Proceedings of the 18th International Conference on Computational Science and Its Applications (ICCSA 2018), Melbourne, Australia, July 2018; Lecture Notes in Computer Science 10962; Springer: Cham, Switzerland, 2018; pp. 327–338. [Google Scholar] [CrossRef] [Scilit]
- Hui, J.; Du, M.; Ye, X.; Qin, Q.; Sui, J. Effective Building Extraction from High-Resolution Remote Sensing Images with Multitask Driven Deep Neural Network. IEEE Geosci. Remote Sens. Lett. 2019, 16, 786–790. [Google Scholar] [CrossRef] [Scilit]
- Shelhamer, E.; Long, J.; Darrell, T. Fully Convolutional Networks for Semantic Segmentation. IEEE Trans. Pattern Anal. Mach. Intell. 2017, 39, 640–651. [Google Scholar] [CrossRef] [Scilit]
- Ronneberger, O.; Fischer, P.; Brox, T. U-Net: Convolutional Networks for Biomedical Image Segmentation. In Proceedings of the 18th International Conference on Medical Image Computing and Computer-Assisted Intervention (MICCAI 2015), Munich, Germany, 5–9 October 2015; Springer: Cham, Switzerland, 2015; pp. 234–241. [Google Scholar]
- He, K.; Gkioxari, G.; Dollár, P.; Girshick, R. Mask R-CNN. In Proceedings of the IEEE International Conference on Computer Vision (ICCV 2017), Venice, Italy, 22–29 October 2017; pp. 2980–2988. [Google Scholar]
- Wagner, F.H.; Sanchez, A.; Tarabalka, Y.; Lotte, R.G.; Ferreira, M.P.; Aidar, M.P.M.; Gloor, E.; Phillips, O.L.; Aragão, L.E.O.C. Using the U-Net Convolutional Network to Map Forest Types and Disturbance in the Atlantic Rainforest with Very High Resolution Images. Remote Sens. Ecol. Conserv. 2019, 5, 360–375. [Google Scholar] [CrossRef] [Scilit]
- Wei, Y.; Liu, X.; Lei, J.; Yue, R.; Feng, J. Multiscale Feature U-Net for Remote Sensing Image Segmentation. J. Appl. Remote Sens. 2022, 16, 016507. [Google Scholar] [CrossRef] [Scilit]
- Zhang, Z.; Liu, Q.; Wang, Y. Road Extraction by Deep Residual U-Net. IEEE Geosci. Remote Sens. Lett. 2018, 15, 749–753. [Google Scholar] [CrossRef] [Scilit]
- Diakogiannis, F.I.; Waldner, F.; Caccetta, P.; Wu, C. ResUNet-a: A Deep Learning Framework for Semantic Segmentation of Remotely Sensed Data. ISPRS J. Photogramm. Remote Sens. 2020, 162, 94–114. [Google Scholar] [CrossRef] [Scilit]
- Breiman, L. Bagging Predictors. Mach. Learn. 1996, 24, 123–140. [Google Scholar] [CrossRef] [Scilit]
- Zhou, Z.; Siddiquee, M.; Tajbakhsh, N.; Liang, J. UNet++: A Nested U-Net Architecture for Medical Image Segmentation. In Proceedings of the 4th International Workshop on Deep Learning in Medical Image Analysis and Multimodal Learning for Clinical Decision Support (DLMIA 2018), Granada, Spain, 20 September 2018; pp. 3–11. [Google Scholar]
- Moshkov, N.; Mathe, B.; Kertesz-Farkas, A.; Hollandi, R.; Horvath, P. Test-Time Augmentation for Deep Learning-Based Cell Segmentation on Microscopy Images. Sci. Rep. 2020, 10, 5068, Correction in Sci. Rep. 2021, 11, 3327. [Google Scholar] [CrossRef] [Scilit]
- Yuan, Y.; Shi, X.; Gao, J. Building Extraction from Remote Sensing Images with Deep Learning: A Survey on Vision Techniques. Comput. Vis. Image Underst. 2025, 251, 104253. [Google Scholar] [CrossRef] [Scilit]
- Yang, D.; Gao, X.; Yang, Y.; Guo, K.; Han, K.; Xu, L. Advances and Future Prospects in Building Extraction from High-Resolution Remote Sensing Images. IEEE J. Sel. Top. Appl. Earth Obs. Remote Sens. 2025, 18, 6994–7016. [Google Scholar] [CrossRef] [Scilit]
- Xu, R.; Mao, R.; Zhuang, Z.; Huang, F.; Yang, Y. Building Extraction from Remote Sensing Images Based on Multi-Scale Attention Gate and Enhanced Positional Information. PeerJ Comput. Sci. 2025, 11, e2826. [Google Scholar] [CrossRef] [Scilit]
- Wang, L.; Fang, S.; Meng, X.; Li, R. Building Extraction with Vision Transformer. IEEE Trans. Geosci. Remote Sens. 2022, 60, 5625711. [Google Scholar] [CrossRef] [Scilit]
- Xie, E.; Wang, W.; Yu, Z.; Anandkumar, A.; Alvarez, J.M.; Luo, P. SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers. In Proceedings of the 35th International Conference on Neural Information Processing Systems (NIPS’21), Virtual, 6–14 December 2021; pp. 12077–12090. [Google Scholar]
- Kirillov, A.; Mintun, E.; Ravi, N.; Mao, H.; Rolland, C.; Gustafson, L.; Xiao, T.; Whitehead, S.; Berg, A.C.; Lo, W.-Y.; et al. Segment Anything. In Proceedings of the International Conference on Computer Vision (ICCV 2023), Paris, France, 2–6 October 2023; pp. 3992–4003. [Google Scholar]
- Pham, D.T.; Tran, T.V.; Minh, N.Q.; Li, J.; Zhu, X. Quantifying the Impact of Data Augmentation on Cross-Domain Building Extraction from High-Resolution Imagery. Remote Sens. 2026, 18, 1176. [Google Scholar] [CrossRef] [Scilit]
- Chen, L.-C.; Zhu, Y.; Papandreou, G.; Schroff, F.; Adam, H. Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation. In Proceedings of the 15th European Conference on Computer Vision (ECCV 2018), Munich, Germany, 8–14 September 2018; pp. 801–818. [Google Scholar]
- Kshirsagar, S.; Chandra, B.; Tallal, U.; Bagai, R.; Dutta, A. Geographic Bias Analysis and Cross-Domain Generalization in Deep Learning-Based Building Damage Assessment. Remote Sens. 2026, 18, 1529. [Google Scholar] [CrossRef] [Scilit]
- Lakshminarayanan, B.; Pritzel, A.; Blundell, C. Simple and Scalable Predictive Uncertainty Estimation Using Deep Ensembles. In Proceedings of the 31st International Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, CA, USA, 4–9 December 2017; pp. 6402–6413. [Google Scholar]
- Ganaie, M.A.; Hu, M.; Malik, A.K.; Tanveer, M.; Suganthan, P.N. Ensemble Deep Learning: A Review. Eng. Appl. Artif. Intell. 2022, 115, 105151. [Google Scholar] [CrossRef] [Scilit]
- Shanmugam, D.; Blalock, D.; Balakrishnan, G.; Guttag, J. Better Aggregation in Test-Time Augmentation. Proceedings International Conference on Computer Vision (ICCV 2021), Montreal, QC, Canada, 10–17 October 2021; pp. 1194–1203. [Google Scholar]
- Soille, P.; Pesaresi, M. Advances in Mathematical Morphology Applied to Geoscience and Remote Sensing. IEEE Trans. Geosci. Remote Sens. 2002, 40, 2042–2055. [Google Scholar] [CrossRef] [Scilit]
- Gavankar, N.L.; Ghosh, S.K. Automatic Building Footprint Extraction from High-Resolution Satellite Image Using Mathematical Morphology. Eur. J. Remote Sens. 2018, 51, 182–193. [Google Scholar] [CrossRef] [Scilit]
- He, K.; Zhang, X.; Ren, S.; Sun, J. Deep Residual Learning for Image Recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR 2016), Las Vegas, NV, USA, 27–30 June 2016; pp. 770–778. [Google Scholar] [CrossRef] [Scilit]
- Deng, J.; Dong, W.; Socher, R.; Li, L.-J.; Li, K.; Li, F.-F. ImageNet: A Large-Scale Hierarchical Image Database. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR 2009), Miami, FL, USA, 20–25 June 2009; pp. 248–255. [Google Scholar]
- Iakubovskii, P. Segmentation Models. GitHub Repository. 2019. Available online: https://github.com/qubvel/segmentation_models (accessed on 12 July 2026).
- Sha, Y. Keras-Unet-Collection. GitHub Repository. 2021. Available online: https://github.com/yingkaisha/keras-unet-collection (accessed on 12 July 2026).
- O’Malley, T.; Bursztein, E.; Long, J.; Chollet, F.; Jin, H.; Invernizzi, L.; Zhuo, C.; Gu, B.; Surya, K.; Zhang, Z. KerasTuner. GitHub Repository. 2019. Available online: https://github.com/keras-team/keras-tuner (accessed on 12 July 2026).
- Kingma, D.P.; Ba, J. Adam: A Method for Stochastic Optimization. In Proceedings of the 3rd International Conference on Learning Representations (ICLR 2015), San Diego, CA, USA, 7–9 May 2015. [Google Scholar]
- Audebert, N.; Le Saux, B.; Lefèvre, S. Beyond RGB: Very High Resolution Urban Remote Sensing with Multimodal Deep Networks. ISPRS J. Photogramm. Remote Sens. 2018, 140, 20–32. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.









