Skip to Content
Remote SensingRemote Sensing
  • Article
  • Open Access

9 February 2026

26 Pages

PolyGeom: Geometry-Aware Graph Transformer for Building Polygon Extraction in Remote Sensing Images

,
,
,
and
1
School of Cyber Science and Engineering, Xi’an Jiaotong University, Xi’an 710049, China
2
Shenzhen Loop Area Institute, Shenzhen 518038, China
3
College of Computer Science and Technology, Jilin University, Changchun 130012, China
4
Key Laboratory of Symbolic Computation and Knowledge Engineering of Ministry of Education, Jilin University, Changchun 130012, China

Highlights

What are the main findings?
  • This paper proposes the PolyGeom model for building polygon extraction, which integrates rich, pretrained semantic features and introduces a geometry-aware graph transformer that explicitly learns geometry of building polygons.
  • Evaluations on three benchmark datasets (CrowdAI, WHU, BONAI) show that PolyGeom achieves superior building detection accuracy and polygonal shape fidelity.
What are the implications of the main findings?
  • This paper highlights the effectiveness of explicit geometry learning for improved spatial reasoning in remote sensing applications.
  • PolyGeom advances the state of the art in end-to-end building polygon extraction by directly predicting vectorized building shapes.

Abstract

Building polygon extraction is a critical task in remote sensing analysis and a fundamental component of modern urban management. Conventional segmentation-based methods often suffer from geometric distortions during the conversion from masks to polygons. End-to-end polygon prediction approaches (e.g., PolyWorld) alleviate this issue by directly predicting building polygons; however, existing PolyWorld-like methods remain limited in accurate corner vertex detection and polygon reasoning due to insufficient representation learning, particularly for geometry. In this work, we propose PolyGeom, an end-to-end framework equipped with a geometry-aware graph transformer for accurate and robust building polygon extraction. PolyGeom employs the Segment Anything Model (SAM) as its backbone to leverage large-scale pretrained features, thereby capturing both local and global semantics. Moreover, we propose a geometry-aware graph transformer that explicitly models geometry of building polygons, facilitating more reliable polygon reasoning. Extensive experiments on three challenging benchmarks, CrowdAI, WHU, and BONAI datasets, demonstrate that PolyGeom consistently outperforms existing methods in terms of building detection accuracy, topology correctness, and geometry alignment. Ablation studies further validate the effectiveness of the two key proposed designs in building polygon extraction.

1. Introduction

Building polygon extraction is a critical task in remote sensing, as buildings occupy over 80% of land cover in urban areas. It plays a vital role in a wide range of applications, including digital urban planning [1], monitoring of dynamic urban change [2], and map generation [3]. Existing approaches to building polygon extraction can be broadly classified into two categories. (1) Segmentation-based two-stage methods formulate the task as a semantic segmentation problem by first generating pixel-wise masks and then vectorizing them into polygonal representations. While these methods are effective at mask generation, they often suffer from geometric degradation during the vectorization process, making it difficult to preserve structural regularities such as straight building boundaries and sharp corners. (2) End-to-end polygon prediction methods directly predict vertex sequences and edge connections, thereby avoiding mask discretization and enabling building shape modeling. Representative works in this category include Polygon-RNN [4], Curve-GCN [5], PolyWorld [6], and its refined extension Re:PolyWorld [7].
Among polygon prediction methods, PolyWorld-like approaches have demonstrated notable progress by jointly modeling vertex detection, connection inference, and vertex position refinement. However, a closer examination reveals three key limitations in these frameworks. Limitation one: The R2U-Net backbone [8] used for vertex detection relies primarily on local convolutional features, which limits its ability to capture high-level semantic information, such as overall building boundaries and shape, thereby reducing vertex localization accuracy. Limitation two: The graph attention networks employed for connection inference focus solely on vertex-wise features, while neglecting crucial geometric relationships among multiple vertices, such as angles between adjacent edges, which limits their capacity for accurate polygon reasoning. Limitation three: These methods infer connections on a fully connected graph. Although such a structure allows for modeling pairwise relationships among vertices, its high complexity and vast search space make the optimization process highly challenging and computationally inefficient.
To address the three challenges, we propose PolyGeom, a new end-to-end framework equipped with a geometry-aware graph transformer for accurate and robust building polygon extraction. The proposed framework follows a pipeline from visual perception to representation learning, and finally to polygon reasoning, introducing two key improvements. First, we replace the R2U-Net backbone in PolyWorld with the large-scale pretrained Segment Anything Model (SAM) [9], which offers superior global semantic understanding and richer vertex representations. This significantly improves corner vertex detection accuracy, establishing a strong foundation for subsequent polygon reasoning. Second, we design a geometry-aware graph transformer that jointly learns semantic and geometric representations. The model explicitly uses geometric information, such as directional edges and angular relationships, into polygon reasoning, while restricting connectivity to local neighborhoods to enhance computational efficiency.
To validate the effectiveness of PolyGeom, we conduct extensive experiments on three benchmark remote sensing building datasets: CrowdAI mapping challenge [10], WHU building dataset [11], and BONAI building dataset [12]. In addition to widely used detection metrics such as IoU, mAP, and mAR, we further evaluate topological and geometric quality of the obtained building polygons by using specialized metrics including F1topo, IoUtopo, MTA, PoLiS, and F1geom. Results on the CrowdAI dataset show that PolyGeom significantly improves the accuracy of building boundaries and corner alignment. More importantly, the model maintains robust and in many cases superior performance when generalized to more complex datasets such as WHU and BONAI. Ablation studies further confirm the complementary effectiveness of both core components. The SAM backbone yields substantial gains in vertex detection performance in terms of metrics mAP and mAR; and the geometric-aware graph transformer plays a critical role in geometric modeling, yielding notable improvements in enhancing topological consistency, as measured by MTA, PoLiS, and F1geom.
In summary, the contributions of this work are threefold:
  • We propose PolyGeom, an end-to-end framework equipped with a geometry-aware graph transformer and integrated with large-scale pretrained features for accurate and robust building polygon extraction in remote sensing images;
  • We design a geometry-aware graph transformer that models geometric information in building polygons and fuses it with other semantic information to infer polygon edges, significantly improving topological consistency and building geometric fidelity;
  • We validate the proposed PolyGeom on three benchmark remote sensing building datasets, assessing vertex detection accuracy, topology correctness, and geometry alignment. Additionally, we conduct ablation studies that demonstrate the effectiveness and complementarity of the core components of PolyGeom.

3. Methods

We propose PolyGeom, a novel end-to-end framework for accurate and robust building polygon extraction from remote sensing images. PolyGeom jointly performs vertex detection and connection inference, enabling direct prediction of building polygons.

3.1. The Overall Architecture of PolyGeom

The overall architecture of PolyGeom consists of three main modules, as illustrated in Figure 1. The first module is a vertex detection module, which takes a remote sensing image as input and outputs a set of candidate building corners i along with their corresponding positions pi and visual descriptors Fi. The second module is a vertex aggregation module, which treats the detected corners as graph vertices and performs message passing among them to produce matching descriptors hi for each vertex, which are subsequently used for edge prediction. The third module is an edge prediction module, which infers the connectivity between vertices based on these matching descriptors, generating a connection matrix that indicates whether an edge exists between each pair of vertices. Finally, PolyGeom outputs the detected building corner positions together with the predicted connection matrix, which jointly form complete building polygons.
Figure 1. Overall architecture of PolyGeom. PolyGeom consists of three modules: (1) a vertex detection module that takes a remote sensing image as input and outputs candidate building corners with their positions and visual descriptors; (2) a vertex aggregation module that treats the detected corners as graph vertices and performs message passing to produce matching descriptor; and (3) an edge prediction module that infers vertex connectivity, yielding a connection matrix. The final building polygons are formed by these detected vertices (red points) and predicted edges (blue lines).

3.2. Vertex Detection Module with Large-Scale Pretrained Features

In PolyGeom, the vertex detection module takes a remote sensing image as input and outputs a set of candidate building corners, together with their corresponding positions and visual descriptors. The module is built upon the ImageEncoderViT from the Segment Anything Model (SAM), a large-scale pretrained segmentation model, together with a lightweight image decoder. The lightweight decoder consists of four transposed convolutional layers with a kernel size of 4 × 4, stride 2, and padding 1. Each layer doubles the spatial resolution while reducing the number of channels, and finally produces the feature map F, which has the same spatial dimensions as the input image. This backbone enables high-quality feature representations that capture both local and global building semantics while preserving the original image resolution, as illustrated in Figure 2. Furthermore, we design a detection head to effectively leverage the resulting segmentation features for our vertex detection task, thereby achieving accurate localization of building corners.
Figure 2. Vertex detection module of PolyGeom. The module adopts the SAM ImageEncoderViT together with a lightweight decoder as its backbone to process the input image and extract visual features F. A detection head then predicts a probability map of candidate building corners. Non-Maximum Suppression (NMS) is subsequently applied to remove redundant responses and retain only the local maximum. The module finally outputs detected vertex positions p i , corresponding vertex descriptors F i , and edge descriptors E i j constructed by the features of intermediate points.
The vertex detection module takes an input image I ∈ R 3 × H × W and processes it through the backbone network to obtain a feature map F ∈ R D × H × W . The detection head consists of two convolutional layers with a kernel size of 1 × 1 and stride 1, thereby preserving spatial resolution while performing channel-wise projection. It projects the feature map F into a detection mask Y ∈ R H × W . Each pixel value in Y represents the probability that the corresponding location is a building corner.
To obtain a sparse and stable set of vertices, Non-Maximum Suppression (NMS) [32] is applied to the probability map. Since a true building corner typically generates a localized high-response region within its neighborhood, NMS effectively removes redundant responses and retains only the local maximum. This process yields a set D of n candidate building corners, along with their corresponding positions P and visual descriptors F, defined as
P = { p i = ( x i , y i ) ∣ i ∈ D } , F = { F i ∈ R D ∣ i ∈ D } .
Here, the position ( x i , y i ) denotes the image coordinates of vertex i, and the visual descriptors Fi represent the corresponding feature vector learned from the image. These visual descriptors are subsequently used for edge prediction between vertices.
In addition to the visual features of individual vertices, we note that the visual information associated with potential edges between vertices also plays a crucial role in determining whether two vertices should be connected to form a building boundary. To incorporate this information, we introduce an edge visual descriptor Eij. Specifically, for an edge between vertices i and j, we uniformly sample K intermediate points along the line segment connecting the two vertices, with their indices denoted as p i → j ( 1 ) , … , p i → j ( K ) . The edge descriptor Eij is constructed by concatenating the visual features of the K intermediate points and then passing the vector through a linear projection, as follows:
E = { E i j ∣ i , j ∈ D } , E i j = linear ( [ F p i → j ( 1 ) , F p i → j ( 2 ) , … , F p i → j ( K ) ] ) .
where [ · ] denotes the tensor concatenation operator. This formulation captures the visual context along the connecting line segment, including building boundaries, shadows, and other information for edge prediction.

3.3. Vertex Aggregation Module via Geometry-Aware Graph Transformer

Based on the detected vertices, the vertex aggregation module learns relational patterns among the detected vertices by aggregating and updating their descriptors. The resulting vertex matching descriptors are then used to predict whether any two vertices are connected to form a building polygon.
In existing PolyWorld, an attention-based GNN is typically employed for vertex aggregation. However, such designs suffer from insufficient modeling of geometric properties. Specifically, PolyWorld does not explicitly incorporate edge directions or geometric relationships between edges, which restricts its ability to perform fine-grained modeling of building geometry. In this paper, we propose a novel geometry-aware graph transformer as the vertex aggregation module. By explicitly incorporating geometric awareness, the network can effectively model and learn the geometric structure of building polygons, thereby improving the quality of building extraction. This philosophy aligns with recent hierarchical geometric message-passing schemes that inject explicit angular and distance cues into graph networks [33].
The proposed geometry-aware graph transformer treats the detected vertices as graph nodes, and then updates their semantic and geometric representations through L stacked message-passing layers. Each layer simultaneously aggregates semantic representations from SAM features and geometric representations via a dual-branch architecture. Finally, the readout function fuses the two streams into final vertex representations, which are fed to the edge prediction module to predict the existence of every candidate edge.
As illustrated in Figure 3, the proposed geometry-aware graph transformer adopts a dual-branch architecture, consisting of a semantic branch and a geometric branch. The two branches are designed to learn semantic information and geometric information through intra-branch information transmission, respectively, while also interacting via inter-branch information exchange to facilitate collaborative learning. The motivation of the dual-branch design stems from our observation that, in building extraction tasks, semantic information and geometric information are both essential and tightly interwoven. Semantic information characterizes whether a region in the image corresponds to a building interior, a building boundary, or a shadow, and it directly influences geometric reasoning. For example, when semantic cues indicate that a region belongs to a building edge, this information can guide the adjustment of edge directions to ensure that building boundaries extend along correct geometric orientations. Conversely, geometric information characterizes the shapes of building polygons and can in turn provide feedback to semantic understanding. For example, in regions near building edges, such geometric cues help refine semantic predictions, making it easier to correctly identify these regions as part of the building structure.
Figure 3. Vertex aggregation module of PolyGeom, built upon a geometry-aware graph transformer. The module comprises two parallel branches, a semantic branch and a geometric branch, which learn semantic and geometric vertex representations, respectively. The final vertex representations are obtained via a Gated Equivariant Block (GEB), which preserves the equivariance of the representations. Gray arrows denote the update process of semantic and geometric representations.
We next introduce the proposed geometry-aware graph transformer by detailing its three key components: representation initialization, intra-branch and inter-branch representation update, and readout function. The overall architecture is partially inspired by the ViSNet, originally proposed for molecular geometry learning [34].

3.3.1. Representation Initialization

We initialize the semantic and geometric representations for each vertex and each edge as follows. For each vertex i, the semantic representation h i 0 ∈ R D and the geometric representation h i → 0 ∈ R 2 × D are initialized as
h i 0 = F i + ∑ j ∈ N p i F j ⊙ linear ϕ ( d i j ) , h i → 0 = 0 → ,
where Fi denotes the visual descriptor of vertex i ∈ D provided by the backbone network, and d i j = ∥ p j − p i ∥ 2 represents the Euclidean distance between vertex i and its neighbor j. The neighbor set N i consists of the top-k nearest vertices to i and within radius R, and ⊙ denotes element-wise multiplication. The base function ϕ ( · ) denotes a radial-basis distance embedding. The learnable linear projection linear ( · ) aligns ϕ ( d i j ) with semantic information Fj, such as texture. This formulation aggregates nearby visual descriptors weighted by geometric affinity, thereby producing a geometry-aware semantic representation.
For each edge connecting vertices i and j, the edge semantic representation u i j ∈ R D and the edge geometric representation u → i j ∈ R 2 are initialized as follows,
u i j = E i j ⊙ linear ϕ ( d i j ) , u i j → = p j − p i ∥ p j − p i ∥ 2
where Eij is the edge visual descriptor extracted from the detection backbone. The semantic representation uij encodes visual information along line segment between the two vertices, capturing informative patterns such as boundary continuity and appearance consistency. The edge geometric representation u i j → encodes the normalized direction from vertex i to j, providing orientation information of edge connecting vertices.

3.3.2. Intra-Branch Representation Update

After initialization, the representations are updated through a dual-branch architecture, in which one branch updates semantic representations and the other updates geometric representations. The representations are updated not only via intra-branch message passing within each branch, but also through inter-branch interactions. We first introduce intra-branch representation updates via message passing within the semantic branch and the geometric branch, respectively.
Message Passing within Semantic Branch. The semantic branch performs message passing using an attention mechanism, which captures semantic relationships and contextual dependencies among different vertices. For detected vertices i , j ∈ D , the Query, Key, and Value in this attention are defined as follows,
Q i l = W Q l h i l , K j l = W K l h j l ⊙ Dense K l ( u i j ) , V j l = W V l h j l ⊙ Dense V l ( u i j ) ,
where l ∈ { 0 , 1 , 2 , … , L − 1 } denotes the layer index, W Q , W K , and W V are learnable projection matrices following the standard transformer attention mechanism, and Dense ( · ) denotes a learnable linear transformation followed by a nonlinear activation function.
It is important to note that we introduce edge semantic information into the computation of the vertex Key K j and Value V j . As a result, the attention weight computed between vertices i and j is modulated by the edge semantic feature u i j l through its influence on the Key and Value representations of vertex j. For example, if the edge ( i , j ) corresponds to a building contour boundary, its visual descriptor can enhance the attention weight between vertices i and j, thereby increasing the likelihood of forming a building polygon.
The aggregation of semantic messages from neighbor j to a target vertex i is
m i l = ∑ j ∈ N i m i j l , m i j l = σ ( Q i l K j l T ) V j .
Here, m i j l denotes the semantic message passed from vertex j to i at layer l, m i l represents the aggregated semantic message from neighborhood, and σ ( · ) denotes an activation function (e.g., softmax function). Through this aggregation, semantic information in neighborhood is adaptively integrated based on vertex relevance and edge characteristics.
Message Passing within Geometric Branch. Message passing within the geometric branch follows an aggregation mechanism similar to that of the semantic branch, with one key distinction: instead of computing attention scores using the standard transformer attention mechanism, the geometric branch derives attention coefficients from semantic-branch messages via a learned linear projection. Specifically, this projection ψ l is implemented as a Dense layer, defined as
ψ l : m i j l → α , α ∈ R 2 × D .
Here, ψ l projects the semantic message m i j l ∈ R D to geometric attention coefficients α ∈ R 2 × D , ensuring dimensional compatibility with the geometric representations.
In the geometric branch, the aggregation of geometric messages from neighboring vertices j to a target vertex i at layer l is given by
m i → l = ∑ j ∈ N i m i j → l , m i j → l = ψ h l ( m i j l ) ⊙ h j → l + ψ u l ( m i j l ) ⊙ u i j → .
Here, m i j → l denotes the geometric message passed from vertex j to i, m i → l represents the aggregated geometric message from neighborhood, and ψ h l and ψ u l are associated with vertex geometric representations and edge geometric representations, respectively.

3.3.3. Inter-Branch Representation Update

In addition to message passing within each individual branch, the two branches are coupled through inter-branch message passing, including geometric-to-semantic and semantic-to-geometric message passing. This bidirectional interaction enables collaborative learning of semantic and geometric representations.
Geometric-to-Semantic Message Passing (Geom2Sem). Geometric-to-semantic message passing enables the semantic branch to adaptively capture spatial structural information. In this process, the update of semantic representations is guided by messages from the geometric branch, allowing semantically meaningful aggregation under explicit geometric constraints. The semantic representation update induced by Geom2Sem messages is given by
Δ h i l + 1 = W t l h i → l , W s l h i → l · W s m l m i l + Res ( m i l ) ,
where the operator ⟨ · , · ⟩ ∈ R denotes the inner product of the geometric representationn of vertex i, which is able to capture angular relationships among edges interacting at vertex i, as discussed below. The learnable linear map W sm l projects the semantic message m i l into a geometric message. Finally, the residual term Res ( m i l ) = W res m i l propagates the semantic message m i l without geometric modulation, thereby preserving useful semantic information and stabilizing representation learning.
To illustrate how the inner product ⟨ · , · ⟩ ∈ R captures angular relationships, we consider the operator at layer 1 and omit all learnable parameters for simplicity,
h i → 1 , h i → 1 = m i → 0 , m i → 0 = ∑ j ∈ N i m i j → 0 , ∑ k ∈ N i m i k → 0 = ∑ j ∈ N i ψ u 0 ( m i j 0 ) ⊙ u i j → , ∑ k ∈ N i ψ u 0 ( m i k 0 ) ⊙ u i k → = ∑ j ∈ N i ∑ k ∈ N i ψ h 0 ( m i j 0 ) ψ u 0 ( m i k 0 ) cos θ j i k .
Intuitively, these angular relationships play a critical role in building polygon reasoning. For example, when two interacting edges are nearly parallel, corresponding to an angle close to 180°, they are more likely to form a continuous building edge, and the significance of the corresponding vertex interaction is therefore downweighted during semantic updating. Conversely, when the angle between the two edges is around 90°, it indicates a potential building corner. In such cases, the model assigns higher attention to the corresponding vertex, enabling more precise identification of corner structures.
Semantic-to-Geometric Message Passing (Sem2Geom). In our model, the update of geometric representations is likewise guided by semantic context, enabling the geometric branch to learn structural patterns that are consistent with semantic understanding. This semantic guidance allows the model to adaptively refine geometric representations according to high-level semantic information. For example, at semantically salient locations such as building corners, Sem2Geom message passing amplifies geometric attention at the corresponding vertices, enabling more accurate geometric identification.
Formally, the geometric representation update induced by Sem2Geom messages is
Δ h i → l + 1 = W g m l m i l ⊙ W g h l h i → l + m i → l ,
where the term W g m m i l ⊙ W g h h i → l represents semantic-guided modulation, in which the semantic message m i l interacts with the geometric representation h i → l by element-wise multiplication. Learnable weights W m l and W h l are introduced to ensure dimensional compatibility between semantic message and geometric representation. The term m i → l denotes the geometric message from attention-based aggregation in Equation (8).
Finally, the updated semantic and geometric representations are given by
h i l + 1 = h i l + Δ h i l + 1 , h i → l + 1 = h i → l + Δ h i → l + 1 .
This update integrates both intra-branch information propagation within the semantic and geometric branches and inter-branch message exchange, resulting in representations that are jointly aware of semantic and geometric information.

3.3.4. Readout Function

After L layers of message passing, the semantic and geometric representations are fed into a readout function for final vertex representations. The readout function consists of two sequentially stacked Gated Equivariant Blocks (GEBs) [35], defined as
h i o u t , h i → o u t = GEB 2 GEB 1 ( h i L , h i → L ) .
Here, each GEB performs the following computations
t i = Dense R ( [ ∥ W R 1 h i → ∥ , h i ] ) , h i ′ = W R 2 t i , h i ′ → = W R 3 h i → ⊙ W R 4 t i ,
where [ · ] denotes concatenation operator for two tensors, and ∥ · ∥ computes the l 2 -norm along the geometric axis, reducing the term W R 1 h → i ∈ R 2 × D to a D-dimensional vector of Euclidean magnitudes. The GEB enables the fusion of semantic and geometric representations while preserving translational invariance and rotational equivariance, which is crucial for physically consistent building polygon extraction.

3.4. Edge Prediction Module with Bidirectional Matching

Based on the obtained vertex representations, building polygons are constructed by predicting edges between vertices according to their matching scores. To this end, we adopt two matching networks to compute bidirectional matching scores S c l o c k and S c o u n t , which are subsequently combined to obtain the final matching score matrix S,
S = S c l o c k + ( S c o u n t ) ⊤ , s i j c l o c k = MLP c l o c k ( [ h i o u t ∥ h j o u t ] ) , s i j c o u n t = MLP c o u n t ( [ h i o u t ∥ h j o u t ] ) .
Here, S c l o c k and S c o u n t denote the likelihoods of clockwise and counterclockwise connections between pairs of vertices, respectively. The entries s i j c l o c k and s i j c o u n t correspond to the matching scores from detected vertex i to j in the two matrices, representing the respective directional connection likelihoods.
These scores are computed by two four-layer MLPs, each taking as input the concatenated semantic representations of the two vertices. The resulting scores S is then normalized using a Sinkhorn algorithm [36,37], a differentiable version of the Hungarian algorithm, to get the connection matrix C,
C = arg max C ∈ C ∑ i , j ∈ D c i j s i j .
Here, each entry c i j ∈ [ 0 , 1 ] of C represents the probability that vertex i is connected to vertex j. The matrix set C denotes the space of doubly stochastic matrices.

3.5. Loss Function

The loss function of our model is a weighted summation of a vertex detection loss and a matching loss. The detection loss supervises the vertex detection module to classify each pixel as either a building corner or a non-corner,
L detection = − ω ∑ x = 1 H ∑ y = 1 W Y x y log ( Y ^ x y ) − ( 1 − ω ) ∑ x = 1 H ∑ y = 1 W ( 1 − Y x y ) log ( 1 − Y ^ x y ) ,
where matrices Y ∈ R H × W and Y ^ ∈ R H × W denote the ground-truth and predicted corner probability map, respectively, with each pixel indicating whether it corresponds to a building corner. To address the severe class imbalance between corner and non-corner pixels in most remote sensing images, a class-balancing weight ω is applied.
The matching loss jointly supervises the vertex detection module, vertex aggregation module, and edge prediction module, by classifying each pair of detected corners as either forming an edge of a building polygon or not. Specifically, this loss encourages accurate prediction of edge connectivity between vertices,
L matching = − ∑ i , j ∈ D c i j log ( c ^ i j ) ,
where c i j and c ^ i j denote the ground-truth and predicted connectivity between vertices i and j, respectively, indicating whether the two vertices are connected in a building polygon.

3.6. Training and Inference Pipelines

During training, an input image is fed forward through three modules to produce the final building polygons, as illustrated in Figure 4. The training is conducted in two sequential stages: (i) The pretrained weights of the SAM ImageEncoderViT are initialized, and only the detection loss L d e t e c t i o n is optimized until the vertex detection performance stabilizes. (ii) The full model is then fine-tuned using the combined loss L t o t a l = L d e t e c t i o n + L m a t c h i n g , with equal weights assigned to the two loss components. This weight setting is justified by preliminary observations that L d e t e c t i o n and L m a t c h i n g have comparable magnitude scales.
Figure 4. Illustration of the supervision signal flow during training. Gray arrows denote forward propagation from the input image to the losses; red and blue arrows denote the gradient flows of the detection loss L d e t e c t i o n and the matching loss L m a t c h i n g , respectively.
Notably, once the candidate vertices are obtained, we align them with their ground-truth vertices by an alignment procedure described in Section 3.5. This step ensures that the predicted and ground-truth adjacency matrices share identical index mappings.
During inference, the Hungarian algorithm is employed instead of the Sinkhorn algorithm to generate the optimal binary adjacency matrix. Finally, only edges that form closed polygons are retained, while isolated vertices and dangling edges are discarded.

3.7. Label Construction

First, vertex labels are obtained directly from the dataset. Each building in the dataset is represented as a sequence of polygon vertices. We rasterize the polygon vertices and expand each vertex location into a 5 × 5 pixel patch to increase the number of positive samples, yielding the ground-truth vertex labels Y ^ ∈ R H × W .
Then, the edge labels used for the matching loss are defined by the clockwise connection matrix C ^ ∈ R n × n of the ground-truth vertices: c ^ i j = 1 if vertex j is the immediate successor of vertex i in the polygon, c ^ i j = 0 otherwise. Since NMS may produce more detected vertices than ground-truth vertices, the predicted adjacency matrix can include rows or columns without corresponding ground-truth counterparts. We handle these “extra” vertices by setting the corresponding diagonal entries c ^ i i = 1 , indicating self-loops.

Ground-TruthAlignment for Edge Labels

Before computing the matching loss, it is necessary to establish a one-to-one correspondence between the predicted vertices and the ground-truth vertices in order to construct consistent supervision labels. In practice, predicted vertices are typically unordered and may differ from ground-truth vertices in both number and spatial location; therefore, the ground-truth vertices and edges cannot be directly used without alignment.
To address this issue, we introduce an alignment mechanism that reorders and aligns the predicted vertices to the ground truth based on spatial proximity. Specifically, each ground-truth vertex is matched to its nearest predicted vertex. If the Euclidean distance between a ground-truth vertex and a predicted vertex is below a predefined threshold (e.g., d = 10 pixels) and the predicted vertex has not been previously aligned, it is mapped to the index of the corresponding ground-truth vertex. All remaining unaligned predicted vertices are treated as self-connections and correspond to self-loop edges in the ground truth. Through this alignment procedure, all predicted vertices are reordered and matched to ground-truth vertices, and each predicted edge is aligned with either a ground-truth edge or a ground-truth self-loop, enabling consistent supervision for edge prediction.

4. Experiments

To validate and analyze the proposed PolyGeom model, we conduct comprehensive experiments on three benchmark remote sensing building datasets. We compare PolyGeom with six competing methods using twelve evaluation metrics that span three aspects: building detection accuracy, topological correctness, and geometric alignment.

4.1. Experimental Setting

4.1.1. Datasets

Training building extraction and polygonization models requires high-quality datasets with building polygonal annotations. We conduct experiments on three widely used building polygonal datasets, as shown in Figure 5.
Figure 5. Example visualizations from the three benchmark datasets used in our experiments: (A) CrowdAI dataset, (B) WHU dataset, and (C) BONAI dataset.
CrowdAI dataset [10]: This dataset consists of satellite images with a spatial resolution of 0.3 m per pixel, including over 280,000 images for training and 60,000 images for testing. To mitigate scale distortion caused by pooling operations in the backbone network, all images are upsampled to 320 × 320 pixels. The building annotations are provided in MS COCO format [38], where each instance is accurately labeled with polygonal contours.
WHU dataset [11]: This dataset comprises high-resolution aerial images with a spatial resolution of 0.2 m per pixel and an original image size of 1024 × 1024 pixels. Before training, each image is cropped into smaller 256 × 256 patches, resulting in 55,152 samples, which are further divided into 33,373 training, 4516 validation, and 17,263 testing samples. Similarly, all building instances are annotated in the MS COCO format.
BONAI dataset [12]: The BONAI dataset contains 3300 oblique aerial images, each of size 1024 × 1024 pixels, with a spatial resolution of 0.3 m to 0.6 m per pixel, covering a total of 268,958 annotated building instances. Each building is annotated in MS COCO format. The dataset covers diverse urban scenes across six representative Chinese cities: Shanghai, Beijing, Harbin, Jinan, Chengdu, and Xi’an.
In our experiments, we enhance these datasets by applying rotation-based image augmentation and introducing random noise perturbations to the vertex coordinates. These augmentations improve the robustness and generalization of the model during training.

4.1.2. Evaluation Metrics

To comprehensively evaluate the building extraction performance of our model, we employ twelve evaluation metrics spanning three perspectives: building detection accuracy, topology correctness, and geometry alignment.
Building detection metrics: These metrics evaluate the accuracy of polygon vertex localization and polygon mask prediction. We employ three types of commonly used detection-based evaluation metrics, IoU, C-IoU, and instance-level detection metrics (AP, AR, mAP, mAR), to comprehensively capture the model’s building-detection precision and recall. The detailed definitions are provided below.
  • IoU (Intersection over Union): Measures the pixel-level overlap between the predicted building mask and the ground-truth mask.
    IoU ( M pred , M gt ) = | M pred ∩ M gt | | M pred ∪ M gt |
    where M pred and M gt denote the predicted and ground-truth masks, respectively.
  • C-IoU (Complexity-aware IoU): Extends the standard IoU by incorporating a polygon-complexity constraint, encouraging predictions that not only achieve high overlap with the ground truth but also preserve comparable geometric complexity.
    C - IoU ( M pred , M gt ) = IoU ( M pred , M gt ) · 1 − | N pred − N gt | N pred + N gt
    where N pred and N gt denote the numbers of vertices in the predicted and ground-truth building polygons, respectively.
  • Precision and Recall ( A P r , A R r , m A P , m A R ):  A P r and A R r denote the Average Precision and Average Recall computed under a specified IoU threshold r, where predictions with IoU greater than r are counted as True Positives. Typical thresholds include r = 0.5 and r = 0.75 , corresponding to moderate and stricter overlap requirements for evaluating detection performance.
    A P r = ∫ 0 1 p r ( x ) d x , A R r = 1 N ∑ i = 1 N R r ( i )
    where p r ( x ) is the precision at IoU threshold r as a function of recall x, and R r ( i ) denotes the recall value at the i-th confidence threshold. Furthermore, the mean Average Precision ( m A P ) and mean Average Recall ( m A R ) are computed by averaging A P r and A R r across multiple IoU thresholds, typically from r = 0.5 to r = 0.95 with an interval of 0.05.
    m A P = 1 T ∑ t = 1 T A P r t , m A R = 1 T ∑ t = 1 T A R r t ,
    where T is the total number of IoU thresholds. m A P and m A R thus summarize the model’s detection accuracy and completeness over varying overlap requirements.
Topology correctness metrics: These metrics evaluate whether the predicted polygons correctly reconstruct the connectivity between vertices. That is, whether the predicted edge relationships are topologically consistent with the ground truth. We employ several widely used topology-related metrics, including IoUtopo, F1topo, and N-ratio.
  • IoUtopo: Measures the spatial overlap between the predicted and ground-truth boundaries by computing the intersection over union (IoU) at the boundary level [39]. Because boundaries are typically very thin, a buffer region is applied to dilate both boundaries before the IoU calculation.
    IoU topo = Buffer ( B pred , δ ) ∩ Buffer ( B gt , δ ) Buffer ( B pred , δ ) ∪ Buffer ( B gt , δ ) ,
    where Buffer ( · , δ ) denotes a buffer zone of radius δ centered on the boundary, and δ is empirically set to 5 pixels in our experiments.
  • F1topo: Evaluates topology correctness by measuring the precision and recall of boundary correspondences, and reports their harmonic mean as the overall F1 score,
    P topo = T P topo T P topo + F P topo , R topo = T P topo T P topo + F N topo , F 1 topo = 2 P topo × R topo P topo + R topo .
    Here, a pixel is counted as a True Positive (TP) if it falls within both the predicted boundary buffer and the ground-truth boundary buffer. FP and FN follow analogous definitions.
  • N-ratio: A measure of topological complexity that assesses whether the structural complexity of the predicted polygon matches that of the ground truth.
    N - ratio = N pred N gt ,
    where Npred and Ngt denote the numbers of vertices in the predicted and ground-truth building polygons, respectively. The N-ratio values close to 1 indicate good topological consistency, whereas significantly higher or lower values may suggest over-segmentation or under-segmentation.
Geometry alignment metrics: These metrics assess the geometry alignment between the predicted polygons and the ground truth. We employ three widely used measures, including PoLiS, Mean Tangential Accuracy (MTA), and Boundary F1, to quantify both positional and directional deviations between predicted vertices/edges and their ground-truth counterparts.
  • PoLiS: Quantifies the geometric discrepancy between the two polygons by averaging the bidirectional minimum vertex-to-boundary distances [40]. Given a predicted polygon A = { p 1 , … , p q } and a ground-truth polygon G = { g 1 , … , g r } , the symmetric directed PoLiS distance from A to G is defined as
    p ( A , G ) = 1 2 q ∑ p j ∈ A min g ∈ ∂ G ∥ p j − g ∥ + 1 2 r ∑ g k ∈ G min p ∈ ∂ A ∥ g k − p ∥ .
    Here, ∂ A and ∂ G denote the boundaries of polygons A and G, respectively. A smaller PoLiS value indicates better building boundary alignment quality.
  • MTA: Measures the maximum deviation in tangent direction between the predicted and ground-truth polygons, reflecting the geometry alignment quality of the prediction [24]. For each predicted polygon, we uniformly sample n vertices { p i } i = 1 n and project them onto their nearest corresponding vertices { g i } i = 1 n on the ground-truth polygon. MTA is then computed as
    MTA = max p i cos − 1 T ( p i ) · T ( g i ) T ( p i ) = p i + 1 − p i ∥ p i + 1 − p i ∥ , T ( g i ) = g i + 1 − g i ∥ g i + 1 − g i ∥ .
    Here, cos − 1 T ( p i ) · T ( g i ) computes the angular deviation between the tangent directions of the predicted and ground-truth polygons. The MTA is defined as the maximum valid angular deviation across all sampled vertices. A smaller MTA indicates a more geometrically consistent polygon.
  • Boundary F1: Measures the edge alignment between the predicted and ground-truth polygons. We first uniformly sample n vertices along each edge of both the predicted and ground-truth polygons, obtaining two boundary vertex sets { p i } i = 1 n and { g i } i = 1 n . Without loss of generality, for each predicted vertex p i , we identify its nearest ground-truth vertex g j through vertex matching. Then, we compute the discrepancy between each matched pair of vertices as d ( p i , g j ) = ∥ p i − g j ∥ . A predicted vertex is counted as a True Positive ( T P bnd ) if d ( p i , g j ) < τ , where τ is a distance tolerance threshold; otherwise, it is a False Positive ( F P bnd ). Any ground-truth points that remain unmatched are counted as False Negatives ( F N bnd ). The precision, recall, and F1 are computed as
    P geom = T P bnd T P bnd + F P bnd , R geom = T P bnd T P bnd + F N bnd , F 1 geom = 2 P bnd R bnd P bnd + R bnd .
    Here, F 1 geom denotes the Boundary F1 score, and higher F 1 geom values indicate more accurate boundary alignment.

4.1.3. Baseline Methods

To validate the effectiveness of our proposed PolyGeom, we compare it against a wide range of state-of-the-art baselines covering both pixel-based segmentation and polygon prediction methods for the building polygon extraction task.
Segmentation-based baselines include Mask R-CNN [16] and FFL [24], which generate dense pixel-wise building masks rather than explicit polygon representations. Since these approaches do not produce polygons, we compare PolyGeom with them only in terms of building detection accuracy (e.g., IoU, C-IoU), where pixel-level masks are the appropriate basis for evaluation. Polygon prediction baselines include PolyMapper [29], PolyWorld [6], Re:PolyWorld [7], and HiSup [25], all of which directly infer building polygons in an end-to-end manner. Accordingly, we compare PolyGeom against these methods across comprehensive metrics, including building detection accuracy, topology correctness, and geometry alignment.
Since the original PolyWorld and HiSup papers do not report results on the above datasets, we reproduce their performance by re-training the models using the authors’ official implementations. For the remaining methods, Mask R-CNN, FFL, PolyMapper, and Re:PolyWorld, we directly report the results reported in their original papers.

4.1.4. Implementation Details

All experiments were implemented in PyTorch 2.4.0 with python 3.10.14, CUDA 12.0 and trained on 4× NVIDIA A800 GPUs. The ImageEncoderViT within the backbone was initialized with ImageNet-1k pretrained weights, and the class-balancing weight ω of the L d e t e c t i o n was fixed at 500. The Adam algorithm with a weight decay of 0.001 and a momentum of 0.9 is used. We restrict the top-30 neighbors to vertices within the radius R, and stack L = 4 message-passing layers in the geometry-aware graph transformer. Each edge samples K = 16 intermediate points. The batch size was set to 16 for BONAI, 32 for CrowdAI, and 64 for WHU. The number of candidate vertices in one image was set to 512 for BONAI and 256 for CrowdAI and WHU. The ground-truth alignment tolerance was set to 10 pixels for BONAI and 5 pixels for CrowdAI and WHU.

4.2. Experiments on CrowdAI Dataset

We first conduct a comprehensive evaluation of our model on the CrowdAI dataset, comparing PolyGeom against all six baseline methods in terms of building detection accuracy, topology correctness, and geometry alignment.

4.2.1. Building Detection Accuracy

For building detection accuracy, we compare the proposed PolyGeom with both pixel-based segmentation approaches (Mask R-CNN and FFL) and polygon prediction methods (PolyMapper, PolyWorld, Re:PolyWorld, and HiSup). The experimental results are summarized in Table 1. PolyGeom achieves either the best or the second-best performance across all the metrics, including IoU, C-IoU, AR50, AR75, AP50, AP75, mAP, and mAR.
Table 1. Building detection accuracy on the CrowdAI dataset. Metrics marked with ↑ indicate that higher values are better; the best results are shown in bold, and the second-best are underlined.
PolyGeom consistently outperforms segmentation-based methods (Mask R-CNN and FFL), demonstrating that adopting a polygon-based representation in our model does not compromise building detection performance; instead, it delivers substantial improvements. Compared with the polygon prediction methods (PolyMapper, PolyWorld, Re:PolyWorld, and HiSup), PolyGeom achieves the highest IoU and C-IoU scores, indicating that the predicted building polygons are more closely aligned with the ground-truth building mask. Meanwhile, PolyGeom shows strong performance on recall-oriented metrics (AR50, AR75, mAR), indicating that the adopted SAM backbone provides a powerful capability to capture a larger number of valid vertices, thereby reducing missed detections. Although HiSup slightly outperforms PolyGeom on precision-oriented metrics (AP50, AP75, mAP), PolyGeom remains highly competitive, even under stricter thresholds such as AP75, demonstrating precise and stable building detection.
Overall, PolyGeom achieves a well-balanced trade-off between building detection coverage and detection precision. It is worth noting that the metrics in Table 1 primarily evaluate pixel-level detection and do not directly reflect the predicted polygon quality.

4.2.2. Topology Correctness

We further evaluate whether the proposed PolyGeom can produce high-quality polygons by comparing it with polygon prediction methods (PolyWorld and HiSup) in terms of topology correctness metrics, including F1topo, IoUtopo, and N-ratio. Pixel-based segmentation methods are not considered here, as they are unable to directly generate polygons.
The experimental results are summarized in Table 2. PolyGeom achieves the best performance on both F1topo and IoUtopo, reaching 93.0% and 87.3%, respectively, outperforming the two state-of-the-art methods. This indicates that PolyGeom more effectively learns the structural information of building boundaries, accurately predicting polygon edge connectivity and avoiding polygonal shape mismatches.
Table 2. Topology correctness and geometry alignment metrics on the CrowdAI dataset. Metrics marked with ↑ indicate that higher values are better, and ↓ denotes lower is better. For N-ratio, values closer to 1 are preferred. The best results are shown in bold.
Although HiSup obtains marginally higher scores on the N-ratio metric, this metric measures consistency in polygonal complexity (i.e., the number of vertices in a polygon) and does not fully capture the correctness of the overall topology. PolyGeom’s clear superiority on the other two key topology metrics offers a more direct and comprehensive indication of its topology correctness.

4.2.3. Geometry Alignment

We also evaluate whether the proposed PolyGeom can generate high-quality polygons by comparing it with polygon prediction methods (PolyWorld and HiSup) in terms of geometry alignment metrics, including PoLiS, MTA, and F 1 τ geom . The experimental results are summarized in Table 2. PolyGeom demonstrates clear superiority over the two baselines.
PolyGeom achieves the lowest MTA score (29.8), indicating the smallest tangent-direction deviation and reducing geometric anomalies such as misplaced edges. Second, the PoLiS score decreases to 0.550, corresponding to a 43.7% improvement over PolyWorld (0.977) and a 25.4% improvement over HiSup (0.738). These results highlight PolyGeom’s strong capability in vertex localization and polygon reasoning. In addition, for the F 1 τ geom alignment metrics, PolyGeom achieves the highest scores under both the relaxed threshold (τ = 2) and the strict threshold (τ = 1), demonstrating that the predicted polygons are well aligned with the ground-truth polygons. Overall, PolyGeom exhibits outstanding performance in both vertex displacement control and polygon reasoning, enabling high-precision extraction of complex building polygons.

4.2.4. Visual Comparison

Figure 6 presents a visual comparison of building polygon extraction among HiSup, PolyWorld, and the proposed PolyGeom. Each building instance is illustrated using a colored polygon. While HiSup and PolyWorld can roughly capture the overall building instances, their predictions still exhibit noticeable deviations from the ground-truth polygons (yellow). The polygons produced by these methods often suffer from misplaced vertices (fourth row) and loose or drifting boundaries (third row), leading to noticeable misalignment with the true building polygons. Moreover, they struggle to handle complex structures such as irregular building shapes (second row).
Figure 6. Visual comparison of building polygon extraction among HiSup, PolyWorld, and the proposed PolyGeom. Each method’s results are shown using distinct-colored polygon overlays, with ground-truth annotations highlighted in yellow. The comparison clearly shows that PolyGeom achieves superior alignment between the predicted polygons and the ground truth.
In contrast, the proposed PolyGeom demonstrates superior geometry alignment with the ground-truth polygons (third column). Its predictions closely follow the ground-truth boundaries and accurately capture key building characteristics, such as wall segments and roof indentations. Notably, in the last-row examples, where PolyWorld fails to capture the complex structure, PolyGeom maintains coherent boundary tracing and produces a well-closed polygon, highlighting its stronger capability in geometric reasoning. Overall, this visual comparison confirms that PolyGeom provides accurate building polygons, achieving clear advantages in structural building extraction over existing methods.

4.3. Experiments on WHU Datasets and BONAI Datasets

We further validate PolyGeom on additional remote sensing image datasets, including the WHU and BONAI datasets, evaluating its performance in terms of building detection accuracy, topology correctness, and geometry alignment. The experimental results are summarized in Table 3. PolyGeom outperforms PolyWorld, the representative polygon prediction method, on most metrics, and it achieves particularly consistent advantages in topology correctness and geometry alignment. These results demonstrate the clear advantage of incorporating explicit building geometry learning via a geometry-aware graph transformer. We further analyze the advantage in ablation experiments.
Table 3. Building detection accuracy, topology correctness, and geometry alignment on the WHU and BONAI datasets. Metrics marked with ↑ indicate that higher values are better, and ↓ denotes lower is better. For N-ratio, values closer to 1 are preferred. The best results are shown in bold.
On the WHU dataset, PolyGeom outperforms PolyWorld in building detection accuracy, as measured by IoU, C-IoU, and mAR, while also achieving consistent improvements across topology and geometry metrics, including F1topo, IoUtopo, N-ratio, and F 1 τ geom .
On the more challenging BONAI dataset, where images have a spatial resolution of 0.3–0.6 m per pixel and contain irregular buildings with blurred boundaries that pose significant challenges for polygon reasoning, PolyGeom once again demonstrates pronounced performance improvements. Specifically, substantial gains are observed. IoU improves by 12.5, increasing from 33.8 to 46.3, and cIoU improves by 13.4, rising from 24.6 to 38.0. In terms of topology and geometry accuracy, F1topo increases by 8.2 (from 35.5 to 43.7), IoUtopo improves by 6.3 (from 23.2 to 29.5), and F 1 τ = 2 geom improves by 10.7, increasing from 25.7 to 36.4. These results indicate that, beyond accurate building detection, PolyGeom demonstrates superior geometric understanding and polygon reasoning for complex building structures, leading to a stronger structural building extraction capability.

4.4. Ablation Experiments

We further analyze the performance gains introduced by the two innovations of PolyGeom. Compared with PolyWorld, PolyGeom incorporates two major enhancements that together account for the significant improvements observed above. First, PolyGeom replaces the R2U-Net backbone with SAM for pixel-level representation learning. As a large-scale pretrained segmentation encoder, SAM provides substantially stronger semantic feature extraction capability, allowing the model to more accurately capture both global building layouts and fine-grained local contexts. Second, PolyGeom introduces a geometry-aware graph transformer in place of the attention-based GNN used in PolyWorld. While the attention-based GNN primarily operates on vertex-level semantic features, the proposed geometry-aware graph transformer explicitly models building geometry, including angular relationships and coordinate-based structural information.
The ablation results are summarized in Table 4, evaluated in terms of building detection accuracy, topological correctness, and geometric alignment. As a baseline model, “w/o SAM & Geo-GT” denotes PolyGeom without both SAM and the geometry-aware graph transformer, which corresponds to PolyWorld in this experiment. Specifically, for the vertex-detection module we replace SAM with a lightweight Recurrent Residual U-Net (R2U-Net) that augments skip connections with recurrent convolution blocks to capture fine-grained pixel features, which serves as a fair baseline to verify the superiority of SAM feature extraction capability. In place of Geo-GT, we use an attentional graph neural network that updates node features by weighted aggregation of neighbors’ features, with weights learned via a self-attention mechanism and without any explicit geometric information modeling. When equipped with the large-scale pretrained SAM backbone, “w/o Geo-GT” exhibits substantial gains across almost all metrics. C-IoU increases by 3.8, rising from 88.3 to 92.1. AP75 improves by 10.7, increasing from 68.8 to 79.5, while AR75 improves by 6.2, from 82.0 to 88.2. In addition, mAP increases by 9.5, from 63.8 to 73.3, and mAR improves by 7.8, rising from 76.1 to 83.9. Notable improvements are also observed in polygon reasoning quality. F1topo increases by 5.0, from 86.6 to 91.6, IoUtopo improves by 8.1, from 76.7 to 84.8, and the N-ratio rises from 0.942 to 0.971. These results indicate that stronger feature encoding not only enhances detection performance but also promotes the structural reliability of the predicted polygons.
Table 4. Ablation analysis in terms of building detection accuracy, topology correctness, and geometry alignment. “w/o SAM & Geo-GT” and “w/o Geo-GT” denote PolyGeom without both SAM and geometry-aware graph transformer, and without the transformer, respectively.
The full PolyGeom model, equipped with both the SAM backbone and the geometry-aware graph transformer, further improves performance across those metrics. For example, mAP increases by 2.4, from 73.3 to 75.7, and F1topo improves by 1.4, from 91.6 to 93.0. Notably, the advantages become substantially more pronounced in terms of geometry alignment. PoLiS decreases from 0.692 to 0.550, corresponding to a 20.5% reduction in error, MTA is reduced from 31.3 to 29.8, and F 1 geom ( τ = 1 ) increases by 7.8, from 54.5 to 62.3. These results demonstrate that the geometry-aware graph transformer primarily enhances fine-grained geometric structure construction. In summary, incorporating SAM primarily enhances robust detection and topology quality, while the geometry-aware graph transformer focuses on improving fine-grained geometry modeling, particularly for buildings with complex boundaries. Together, these components enable the superior building polygon extraction performance of PolyGeom.
Additionally, we evaluate the efficiency advantage of the proposed geometry-aware graph transformer over a fully connected graph baseline. We conduct ablation studies with different graph configurations. The first configuration uses a fully connected graph among all candidate vertices, as adopted by PolyWorld-like methods. In contrast, our geometry-aware graph transformer connects only the top-k nearest candidate vertices. All experiments are conducted on the CrowdAI dataset with a batch size of 128.
The fully connected graph baseline suffers from severe inefficiency: it reaches a peak GPU memory usage of 16.16 GB and requires 49.97 ms per image for inference, resulting in only 20.01 frames per second (FPS). This inefficiency stems from the (O(n2))) edge features introduced by the fully connected graph, which incur excessive memory consumption and redundant computation across all node pairs. In contrast, the sparse graph configuration with a limited number of neighbors significantly improves efficiency. Under the top-30 setting, peak GPU memory usage is reduced by 68.7% (from 16.16 GB to 5.06 GB), and per-image inference time is decreased by 23.17% (from 49.97 ms to 38.39 ms), boosting the inference speed to 26.05 FPS.

4.5. Sensitivity Analysis of Key Hyperparameter

As mentioned in Section 3.2, the edge descriptor Eij is constructed by uniformly sampling K intermediate points along the line segment connecting two vertices, concatenating their visual features, and projecting the resulting vector via a linear layer. Since the number of sampled points K is a key parameter for the edge descriptor, we conduct a sensitivity analysis across different values of K to evaluate its robustness. Specifically, we evaluate model performance under varying sampling density by setting K ∈ { 8 , 16 , 32 } on the CrowdAI. The experimental results are summarized in Table 5, which indicates that configurations with K = 8 and K = 32 yield slightly inferior performance compared to K = 16.
Table 5. Sensitivity analysis of the number of sampled intermediate points K.
For K = 8, corresponding to an undersampling cases, the linear mapping layer receives a low-dimensional concatenated feature vector, whose limited representational capacity is insufficient to encode diverse edge patterns. The sparsely sampled points fail to provide adequate spatial information for learning a comprehensive edge representation. In contrast, in the oversampling cases with K = 32, the higher-dimensional input significantly enlarges the parameter space of the linear layer, encouraging the model to fit redundant or noise-driven features. This modest sensitivity indicates that the edge descriptor is robust to the sampling density. Accordingly, we adopt K = 16 as an effective trade-off between descriptive power and generalization.

5. Discussion

PolyGeom addresses limitations of existing PolyWorld-like methods through three key design choices. First, by adopting the image encoder of the large-scale pretrained Segment Anything Model, PolyGeom significantly improves vertex detection by capturing both local and global building semantics. This overcomes the limited global awareness of R2U-Net backbones, providing more reliable corner localization for downstream polygon reasoning. Second, PolyGeom introduces a geometry-aware graph transformer that explicitly incorporates geometric information, such as edge directions and angular relationships, into polygon reasoning. In contrast to prior attention-based GNNs of PolyWorld-like methods that rely primarily on vertex-wise features, this design enables effective geometric learning and improves the structural quality of extracted building polygons. Third, to address the inefficiency of fully connection inference, PolyGeom restricts connectivity reasoning to local neighborhoods. This significantly reduces computational complexity while also lowering the risk of spurious connections by constraining the solution space.
Our methodology can be roughly summarized as “detect building corners and connect them correctly to form building polygons.” Consequently, missing or overly dense vertices lead to truncated corners or warped edges relative to the ground-truth polygons. Typical failure cases are illustrated in Figure 7, where yellow dots and green edges denote ground-truth vertices and edges, while red dots and blue edges represent the predictions. (a) Missing vertices cause corner truncation or excessive simplification of complex building polygons. (b) Redundant vertices around a corner result in locally twisted or warped edges. (c) Incorrect assignments produced by the Hungarian algorithm further exacerbate these errors: in the top row, nearly indistinguishable vertex representations confuse the model, whereas in the bottom row, abundant distractor points mislead the edge prediction.
Figure 7. Failure cases on the BONAI (top) and CrowdAI (bottom) datasets. Yellow dots indicate ground-truth vertices, green edges denote ground-truth edges, red dots represent our predicted vertices, and blue edges indicate predicted edges. (a) Over-simplification caused by missed keypoints; (b) twisted local edges; (c) erroneous edge assignments.

6. Conclusions

This paper presents PolyGeom, an end-to-end framework for building polygon extraction that unifies large-scale pretrained visual representations with explicit geometry learning. By adopting the Segment Anything Model (SAM), PolyGeom enhances global semantic perception and improves building corner detection. Furthermore, a geometry-aware graph transformer with a dual-branch architecture is proposed to jointly learn semantic and geometric vertex representations. Extensive experiments on three benchmarks demonstrate that PolyGeom consistently improves building polygon extraction in terms of detection accuracy, topology correctness, and geometry alignment. These findings highlight that high-quality building polygon extraction requires a unified consideration of detection, topology, and geometry, rather than relying solely on pixel-level segmentation.
In future work, we plan to extend PolyGeom to three-dimensional (3D) polygons, advancing polygon reasoning from 2D to 3D. Such an extension is highly valuable for large-scale city reconstruction, urban simulation, and digital twin applications. By incorporating multi-view observations and explicit 3D geometric constraints, this direction will enable more comprehensive modeling of complex building structures. More broadly, it opens up new opportunities for geometry-aware deep learning in remote sensing, further expanding its applicability to advanced urban analysis and spatial intelligence.

Author Contributions

Conceptualization and methodology, H.P. and B.Y.; investigation and validation, H.P., H.L. and X.H.; writing—original draft, H.P. and H.D.; writing—review and editing, H.P., H.D. and B.Y.; supervision, H.P. and H.D. All authors have read and agreed to the published version of the manuscript.

Funding

The work described in this paper was supported by the National Natural Science Foundation of China (62202369, 62572382, 62506292), Postdoctoral Fellowship Program (2024M762604), and the XJTU Research Fund for AI Science (2025YXYC004, GZB20240605), and was partially supported by the Shenzhen Loop Area Institute.

Data Availability Statement

All datasets used in this study are publicly available. The CrowdAI dataset was introduced as part of the CrowdAI Mapping Challenge by Mohanty et al. [10]. The WHU Building Dataset was released by Ji et al. [11]. The BONAI dataset was proposed by Wang et al. [12]. No proprietary or restricted data were used in this research, and all datasets can be accessed through their original publications or challenge websites.

Acknowledgments

During the preparation of this manuscript, the authors used ChatGPT (GPT-5) solely for language polishing and grammar refinement. The authors have reviewed and edited the output and take full responsibility for the content of this publication.

Conflicts of Interest

The authors declare no conflicts of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.

References

  1. Jadhav, S.; Durairaj, M.; Reenadevi, R.; Subbulakshmi, R.; Gupta, V.; Ramesh, J.V.N. Spatiotemporal data fusion and deep learning for remote sensing-based sustainable urban planning. Int. J. Syst. Assur. Eng. Manag. 2024. [Google Scholar] [CrossRef] [Scilit]
  2. Lin, L.; Di, L.; Zhang, C.; Guo, L.; Zhao, H.; Islam, D.; Li, H.; Liu, Z.; Middleton, G. Modeling urban redevelopment: A novel approach using time-series remote sensing data and machine learning. Geogr. Sustain. 2024, 5, 211–219. [Google Scholar] [CrossRef] [Scilit]
  3. Chen, X.; Yu, A.; Sun, Q.; Guo, W.; Xu, Q.; Wen, B. Updating road maps at city scale with remote sensed images and existing vector maps. IEEE Trans. Geosci. Remote Sens. 2024, 62, 1–21. [Google Scholar] [CrossRef] [Scilit]
  4. Castrejon, L.; Kundu, K.; Urtasun, R.; Fidler, S. Annotating object instances with a polygon-rnn. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017; pp. 5230–5238. [Google Scholar]
  5. Ling, H.; Gao, J.; Kar, A.; Chen, W.; Fidler, S. Fast interactive object annotation with curve-gcn. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Long Beach, CA, USA, 15–20 June 2019; pp. 5257–5266. [Google Scholar]
  6. Zorzi, S.; Bazrafkan, S.; Habenschuss, S.; Fraundorfer, F. Polyworld: Polygonal building extraction with graph neural networks in satellite images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, New Orleans, LA, USA, 18–24 June 2022; pp. 1848–1857. [Google Scholar]
  7. Zorzi, S.; Fraundorfer, F. Re: PolyWorld-A graph neural network for polygonal scene parsing. In Proceedings of the Proceedings of the IEEE/CVF International Conference on Computer Vision, Paris, France, 1–6 October 2023; pp. 16762–16771. [Google Scholar]
  8. Alom, M.Z.; Hasan, M.; Yakopcic, C.; Taha, T.M.; Asari, V.K. Recurrent residual convolutional neural network based on u-net (r2u-net) for medical image segmentation. arXiv 2018, arXiv:1802.06955. [Google Scholar]
  9. 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 IEEE/CVF International Conference on Computer Vision, Paris, France, 1–6 October 2023; pp. 4015–4026. [Google Scholar]
  10. Mohanty, S.P.; Czakon, J.; Kaczmarek, K.A.; Pyskir, A.; Tarasiewicz, P.; Kunwar, S.; Rohrbach, J.; Luo, D.; Prasad, M.; Fleer, S.; et al. Deep Learning for Understanding Satellite Imagery: An Experimental Survey. Front. Artif. Intell. 2020, 3, 534696. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  11. Ji, S.; Wei, S.; Lu, M. Fully convolutional networks for multisource building extraction from an open aerial and satellite imagery data set. IEEE Trans. Geosci. Remote Sens. 2018, 57, 574–586. [Google Scholar] [CrossRef] [Scilit]
  12. Wang, J.; Meng, L.; Li, W.; Yang, W.; Yu, L.; Xia, G.S. Learning to Extract Building Footprints from Off-Nadir Aerial Images. IEEE Trans. Pattern Anal. Mach. Intell. 2022, 45, 1294–1301. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  13. Long, J.; Shelhamer, E.; Darrell, T. Fully convolutional networks for semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Boston, MA, USA, 7–12 June 2015; pp. 3431–3440. [Google Scholar]
  14. Ronneberger, O.; Fischer, P.; Brox, T. U-net: Convolutional networks for biomedical image segmentation. In Proceedings of the International Conference on Medical image Computing and Computer-Assisted Intervention, Munich, Germany, 5–9 October 2015; Springer: Berlin/Heidelberg, Germany, 2015; pp. 234–241. [Google Scholar]
  15. Chen, L.C.; Papandreou, G.; Kokkinos, I.; Murphy, K.; Yuille, A.L. Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected crfs. IEEE Trans. Pattern Anal. Mach. Intell. 2017, 40, 834–848. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  16. He, K.; Gkioxari, G.; Dollár, P.; Girshick, R. Mask r-cnn. In Proceedings of the IEEE International Conference on Computer Vision, Venice, Italy, 22–29 October 2017; pp. 2961–2969. [Google Scholar]
  17. Zhao, K.; Kang, J.; Jung, J.; Sohn, G. Building extraction from satellite images using mask R-CNN with building boundary regularization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, Salt Lake City, UT, USA, 18–22 June 2018; pp. 247–251. [Google Scholar]
  18. Douglas, D.H.; Peucker, T.K. Algorithms for the reduction of the number of points required to represent a digitized line or its caricature. Cartogr. Int. J. Geogr. Inf. Geovis. 1973, 10, 112–122. [Google Scholar] [CrossRef] [Scilit]
  19. Sohn, G.; Jwa, Y.; Jung, J.; Kim, H. An implicit regularization for 3D building rooftop modeling using airborne lidar data. ISPRS Ann. Photogramm. Remote Sens. Spat. Inf. Sci. 2012, 1, 305–310. [Google Scholar] [CrossRef] [Scilit]
  20. Cheng, D.; Liao, R.; Fidler, S.; Urtasun, R. Darnet: Deep active ray network for building segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Long Beach, CA, USA, 15–20 June 2019; pp. 7431–7439. [Google Scholar]
  21. Tang, M.; Djelouah, A.; Perazzi, F.; Boykov, Y.; Schroers, C. Normalized cut loss for weakly-supervised cnn segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–23 June 2018; pp. 1818–1827. [Google Scholar]
  22. Tang, M.; Perazzi, F.; Djelouah, A.; Ben Ayed, I.; Schroers, C.; Boykov, Y. On regularized losses for weakly-supervised cnn segmentation. In Proceedings of the European Conference on Computer Vision (ECCV), Munich, Germany, 8–14 September 2018; pp. 507–522. [Google Scholar]
  23. Marcos, D.; Tuia, D.; Kellenberger, B.; Zhang, L.; Bai, M.; Liao, R.; Urtasun, R. Learning deep structured active contours end-to-end. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–23 June 2018; pp. 8877–8885. [Google Scholar]
  24. Girard, N.; Smirnov, D.; Solomon, J.; Tarabalka, Y. Polygonal building extraction by frame field learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Virtual, 19–25 June 2021; pp. 5891–5900. [Google Scholar]
  25. Xu, B.; Xu, J.; Xue, N.; Xia, G.S. HiSup: Accurate polygonal mapping of buildings in satellite imagery with hierarchical supervision. ISPRS J. Photogramm. Remote Sens. 2023, 198, 284–296. [Google Scholar] [CrossRef] [Scilit]
  26. Acuna, D.; Ling, H.; Kar, A.; Fidler, S. Efficient interactive annotation of segmentation datasets with polygon-rnn++. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–23 June 2018; pp. 859–868. [Google Scholar]
  27. Pei, H.; Wei, B.; Chang, K.; Zhang, C.; Yang, B. Curvature regularization to prevent distortion in graph embedding. Adv. Neural Inf. Process. Syst. 2020, 33, 20779–20790. [Google Scholar]
  28. Liang, J.; Homayounfar, N.; Ma, W.C.; Xiong, Y.; Hu, R.; Urtasun, R. Polytransform: Deep polygon transformer for instance segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Virtual, 14–19 June 2020; pp. 9131–9140. [Google Scholar]
  29. Li, Z.; Wegner, J.D.; Lucchi, A. Topological map extraction from overhead images. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Seoul, Republic of Korea, 27 October–2 November 2019; pp. 1715–1724. [Google Scholar]
  30. Bronstein, M.M.; Bruna, J.; LeCun, Y.; Szlam, A.; Vandergheynst, P. Geometric deep learning: Going beyond euclidean data. IEEE Signal Process. Mag. 2017, 34, 18–42. [Google Scholar] [CrossRef] [Scilit]
  31. Pei, H.; Wei, B.; Chang, K.C.; Lei, Y.; Yang, B. Geom-GCN: Geometric graph convolutional networks. In Proceedings of the International Conference on Learning Representations, Virtual, 26 April–1 May 2020. [Google Scholar]
  32. Hosang, J.; Benenson, R.; Schiele, B. Learning non-maximum suppression. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017; pp. 4507–4515. [Google Scholar]
  33. Pei, H.; Chen, T.; Deng, H.; Tao, J.; Wang, P.; Guan, X. HAGO-Net: Hierarchical Geometric Message Passing for Molecular Representation Learning. In Proceedings of the AAAI Conference on Artificial Intelligence, Vancouver, BC, Canada, 20–27 February 2024; Volume 38, pp. 14572–14580. [Google Scholar]
  34. Wang, Y.; Wang, T.; Li, S.; He, X.; Li, M.; Wang, Z.; Zheng, N.; Shao, B.; Liu, T.Y. Enhancing geometric representations for molecules with equivariant vector-scalar interactive message passing. Nat. Commun. 2024, 15, 313. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  35. Schütt, K.; Unke, O.; Gastegger, M. Equivariant message passing for the prediction of tensorial properties and molecular spectra. In Proceedings of the International Conference on Machine Learning, Virtual, 18–24 July 2021; PMLR: Cambridge, MA, USA, 2021; pp. 9377–9388. [Google Scholar]
  36. Cuturi, M. Sinkhorn distances: Lightspeed computation of optimal transport. Adv. Neural Inf. Process. Syst. 2013, 26, 2292. [Google Scholar]
  37. Sinkhorn, R.; Knopp, P. Concerning nonnegative matrices and doubly stochastic matrices. Pac. J. Math. 1967, 21, 343–348. [Google Scholar] [CrossRef] [Scilit]
  38. Lin, T.Y.; Maire, M.; Belongie, S.; Hays, J.; Perona, P.; Ramanan, D.; Dollár, P.; Zitnick, C.L. Microsoft coco: Common objects in context. In Proceedings of the European Conference on Computer Vision, Zurich, Switzerland, 6–12 September 2014; Springer: Berlin/Heidelberg, Germany, 2014; pp. 740–755. [Google Scholar]
  39. Yang, B.; Zhang, M.; Zhang, Z.; Zhang, Z.; Hu, X. Topdig: Class-agnostic topological directional graph extraction from remote sensing images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 18–22 June 2023; pp. 1265–1274. [Google Scholar]
  40. Avbelj, J.; Müller, R.; Bamler, R. A metric for polygon comparison and building extraction evaluation. IEEE Geosci. Remote Sens. Lett. 2014, 12, 170–174. [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.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.