Parsing Line Segments of Floor Plan Images Using Graph Neural Networks
In this paper, we present a GNN-based Line Segment Parser (GLSP), which uses
a junction heatmap to predict line segments' endpoints, and graph neural
networks to extract line segments and their categories. Different from previous
floor plan recognition methods, which rely on semantic segmentation, our
proposed method is able to output vectorized line segment and requires less
post-processing steps to be put into practical use. Our experiments show that
the methods outperform state-of-the-art line segment detection models on
multi-class line segment detection tasks with floor plan images. In the paper,
we use our floor plan dataset named Large-scale Residential Floor Plan data
(LRFP). The dataset contains a total of 271,035 floor plan images. The label
corresponding to each picture contains the scale information, the categories
and outlines of rooms, and the endpoint positions of line segments such as
doors, windows, and walls. Our augmentation method makes the dataset adaptable
to the drawing styles of as many countries and regions as possible.
Mingxiang Chen, Cihui Pan
# Parsing Line Segments of Floor Plan Images Using Graph Neural Networks

###### Abstract

In this paper, we present a GNN-based Line Segment Parser (GLSP), which uses a junction heatmap to predict line segments' endpoints, and graph neural networks to extract line segments and their categories. Different from previous floor plan recognition methods, which rely on semantic segmentation, our proposed method is able to output vectorized line segment and requires less post-processing steps to be put into practical use. Our experiments show that the methods outperform state-of-the-art line segment detection models on multi-class line segment detection tasks with floor plan images. In the paper, we use our floor plan dataset named Large-scale Residential Floor Plan data (LRFP). The dataset contains a total of 271,035 floor plan images. The label corresponding to each picture contains the scale information, the categories and outlines of rooms, and the endpoint positions of line segments such as doors, windows, and walls. Our augmentation method makes the dataset adaptable to the drawing styles of as many countries and regions as possible.

## 1 Introduction

Floor plan recognition has long been an active research field after deep learning has risen as a promising and stable method regarding computer vision problems. The task is straightforwardly designed, that is to recover the vector-graphic representation of a floor plan from a rasterized image, and re-enable further computing capabilities such as editing, synthesis, or analysis. In 2017, Liu _et al._[14] proposed a method that combines deep learning with integer programming to identify key points, room outlines, and room categories. Some studies [15, 21] show that using optical character recognition (OCR) or object detection methods for auxiliary judgment can further improve the accuracy. Although these methods show good results to some extent, they require heavy post-processing steps to be put into practical use.

In this paper, we propose a novel floor plan recognition method based on line segment detection (LSD) using Graph Neural Networks (GNN). While parsing the floor plans with two separate stages may introduce extra complexity, our method is able to extract vectorized line segments from floor plans rather than pixel-wise semantic segments. Despite the recent achievements made by deep learning in the field of LSD, two problems remain unsolved. First, line segments in floor plans have different categories such as doors, windows, or walls, while the detection methods proposed so far are not designed for multi-class line segments. Second, the algorithms performing well in natural scenes may not be the best choice in floor plan recognition tasks. For almost every blueprint images, including floor plans, the line segments are clearly and logically related to each other, which is different from the loose relationship between line segments in natural scenes.

Overall, our contributions are summarized as follows:

Figure 1: The proposed GLSP model can reliably translate images to a set of vectorized line segments with different types rather than semantic segmentation maps in previous studies [14, 28, 15]. Augmentation methods are used so that the floor plans in the dataset have various styles. The walls, doors, and windows in the figures are represented by red, green, and blue line segments, respectively.
* We introduce the task of multi-class line segment detection into the field of floorplan recognition.
* Our proposed method outputs vectorized results of structural elements and requires less post-processing steps to put the algorithm into practical use.
* An attention-based graph neural network is used to capture the relationships between line segments accurately. The model achieves better performance compared to the state-of-the-art wireframe parsing model.

The paper is organized as follows. First, we introduce related works in Section 2. The details of our method are explained in Section 3. The settings of experiments and their results are presented in Section 4. The conclusion is discussed in Section 5.

## 2 Related Works

**Floor plan recognition and reconstruction** At present, many methods based on deep learning divide the problem of floor plan recognition and reconstruction into several more typical sub-problems, such as object detection, semantic segmentation, optical character recognition (OCR), etc. The system would integrate the recognition results of each model through a series of post-processing methods, and output standardized floor plans. For example, Liu _et al._[14] use convolutional neural networks to identify the locations and types of junction points and use integer programming to output the information about walls and doors. The room types are recognized by a per-pixel semantic classification model. However, this method will not work if inclined walls are present in the floor plan since the types of each junction point are predefined. Zeng _et al._[28] improves the accuracy of the semantic segmentation by using a room-boundary guided attention mechanism, while the corresponding post-processing methods are not proposed, so the results obtained are not vectorized floor plans. Surikov _et al._[21] use Faster R-CNN the object detection on floor plans. Lv _et al._[15] improves the algorithm process based on [14], adding steps such as scale prediction, OCR, and object detection, which greatly improves the robustness and usability of the system.

**Datasets of floor plans** To the best of our knowledge, Raster-to-Vec [14] is one of the earliest approaches trying to reconstruct floor plans from images. Its dataset contains 870 vector-graphics annotations. Rent3D [13] is also a very popular open-source floor plan dataset containing 215 floor plan images. Recently, researchers have begun to use larger datasets for model training. Kalervo _et al._[11] provides Cubi-Casa5K, including 5000 floor plan images from Finland. Lv _et al._[15] mentioned Residential Floor Plan data (RFP) in their paper, which contains 7000 floor plans crawled from internet. However, the dataset is not open-source. Although the demand for larger-scale datasets is increasing without a doubt, it is difficult to obtain a large amount of floor plan data due to copyright or personal privacy protection. In addition, the existing floor plan datasets are generally only applicable to certain countries because of the drawing styles. Thus, even if the scale of some datasets such as RPLAN [22] is sufficient to build large models, researchers from other places may be reluctant to use them.

**Line segment detection** Specifically, we use line segment detection methods as the pre-processing module in some of our baseline models. Edge detection [1, 4, 5, 16, 23] and perceptual grouping [7, 9, 20] are classic methods often used by pioneers in this field. In addition, the method based on Hough transform [6, 8, 9, 17] is also a group of commonly used line segment detection methods based on traditional image processing. In the era of deep learning, the methods based on junction prediction represented by LCNN [31] and the methods based on dense prediction represented by AFM [25] have each shown excellent results and performance. HAWP [26] combines the two on their basis, that is, to use the holistic attraction field map to propose a series of line segments, use junctions to fine-tune the results of the proposal or remove unreasonable line segments, and output the confidence of the refined line segments. Later, F-Clip [3] further optimizes the above model, abandons the two-stage paradigm, and improves both speed and accuracy. HAWPv3 [27] explores the self-supervised learning paradigms based on HAWP and can be used as a good wireframe parser for the out-of-distribution images. Some researchers [18, 30] have proposed line segment detection methods based on graph networks. However, they do not perform better [18] than the above-mentioned two-phase parsing paradigm when detecting line segments in natural scenes. Recently, as the potential of the Transformer model being continuously explored, LETR [24] builds a transformer-based end-to-end line segment detection algorithm by adding endpoint distance loss and coarse-to-fine decoding to the transformer model DETR [2], which is originally built for object detection.

## 3 Method

Similar to previous researches [26, 31] on line segment detection, the floor plan representations are based on the notation of graph theory. A floor plan is defined on an undirected graph \(\mathcal{G}=(\mathcal{P},\mathcal{A})\) where \(i\in\mathcal{P}=\{1,2,...,n\}\) represents the \(i\)-th endpoint of all line segments, and \(a_{i,j}\in\mathcal{A}\), where \(i,j\in\mathcal{P},i\neq j\), represents the line segment from endpoint \(i\) to \(j\). For each endpoint \(i\), the coordinate in the image space is represented by \(p_{i}\). Different from line segment detection, the line segments in the floor plan have different categories (in this article are null, walls, doors, and windows), which are represented by \(c_{i,j}\).
In this section we first introduce the dataset used for training and evaluation in Section 3.1. Figure 2 illustrates an overview of our GNN-based Line Segment Parser (GLSP) architecture. For a floor plan image, we create two intermediate feature maps using identical backbone networks. One is used for junction detection (Section 3.2), and the another is used for building the features of potential connections in the graph (Section 3.3.1). We use a graph neural network to classify the connections (Section 3.3.2 and 3.3.3). Finally, the training strategies and the multi-task loss function are described in Section 3.4.

### Data Description

All the floor plan images and labels in this dataset come from manual annotations by our 3D scanning operators. Each floor plan has been slightly modified, so users would not know their real locations. The houses corresponding to the floor plans are mostly Chinese urban residential buildings. The dataset is randomly split into training, validation, and test sets with 268,035, 1,500, and 1,500 floor plans, respectively. Each sample has 4 floor plan images including pictures with or without items of furniture and room labels. The images are saved in JPG format with a resolution of \(1080\times 720\). The annotations for floor plans include: 1) the scales of images represented by millimeters per pixel, 2) the information of lines including the starting and the ending points, thickness, and the category, choosing from _wall_, _door_, and _window_, and 3) the information of rooms including the category and the contour. Please refer to the supplementary material for augmentation details and statistics about the dataset.

### Junction Detection

We use the stacked Hourglass network [19] as the feature extraction backbone for junction detection and the feature extraction module in the graph-building stage. The network is used in previous line segment detection researches [3, 26, 31] and is also a commonly used model in human keypoint estimation. We choose the same settings as in [26], so that the feature map is \(1/4\) scaled compared to the original image. The features are then up-sampled with a pixel shuffle layer to make the size of the feature map match the input. We make this modification because many endpoints in floor plans are close to each other. Using bins instead of pixels can result in a significant drop in the recall rate (Section 4). Hence, the junction offset module presented in [31] and [26] are removed. The neural network only predicts the junction likelihood \(\hat{J}^{\prime}(p)\), that for each pixel we have

\[\hat{J}^{\prime}(p)=\begin{cases}\hat{J}(p)&\hat{J}(p)=max_{p^{\prime}\in N(p) }\hat{J}(p^{\prime})\\ 0&\text{otherwise}\end{cases} \tag{1}\]

where a non-maximum suppression is applied.

### Line Segment Classification with Graph

We use an attention-based graph network for line segment classification. Attention mechanisms are now widely used in sequence-based tasks and have the advantage of amplifying the most important parts of graphs. This has proven to be useful for many tasks. To learn the relationships between line segments, the inputs to the graph neural network, similar to the definition of a dual graph, is defined on an undirected graph \(\mathcal{G}^{\prime}=(\mathcal{V},\mathcal{E})\) where \(v\in\mathcal{V}=\{1,2,...,n\}\) represents the \(v\)-th line segment, which type is represented by \(c^{\prime}_{v}\). If \(e_{v_{0},v_{1}}=1\) where \(e_{v_{0},v_{1}}\in\mathcal{E}\) and \(v_{0},v_{1}\in\mathcal{V},v_{0}\neq v_{1}\), the \(v_{0}\)-th and \(v_{1}\)-th line segment has a common junction. To clarify, the word "junction" and "line segment" correspond to \(\mathcal{P}\) and \(\mathcal{A}\) in the objective graph \(\mathcal{G}\), respectively; while the word "node" and "edge" correspond to \(\mathcal{V}\) and \(\mathcal{E}\) in the intermediate graph \(\mathcal{G}^{\prime}\), respectively.

#### 3.3.1 Find potential nodes

Averagely, a floor plan graph contains 50-100 junctions, which means a fully connected graph would involve up to 5,000 line segments. As for the intermediate graph \(\mathcal{G}^{\prime}\), that is thousands of nodes and millions of edges. Hence, we provide two node suppression strategies.

**Non-shortest suppression (NSS)** Similar to Non-maximum Suppression (NMS), NSS selects line segments out of a fully connected graph by the angles and lengths. If two line segments have a common point, and the angle between is less than \(\mathcal{D}_{NSS}\), the longer line segment would be removed. Note that \(\mathcal{D}_{NSS}\) is a dynamic threshold depending on the length and the direction of the longer line segment that

\[\mathcal{D}_{NSS}=\begin{cases}2^{\circ}&\text{the line is ``potential''}\\ 22.5^{\circ}&\text{otherwise}\end{cases} \tag{2}\]

In this paper, the line is "potential" if its length is less than 20 pixels or

Figure 2: An overview of the model structure.
\[\min(\theta_{0},\theta_{1},\theta_{2},\theta_{3})<\frac{200}{l}+2 \tag{3}\]

where \(\theta_{0}\), \(\theta_{1}\), \(\theta_{2}\), and \(\theta_{3}\) are the angles (in degrees) between the line segment and the vector \((0,1)\), \((0,-1)\), \((1,0)\), \((-1,0)\), respectively. Here, \(l\) represents the length of the line segment (in pixels).

**Non-diagonal suppression (NDS)** NDS is more aggressive comparing to NSS that the line is discarded if it is not "potential". Note that not all line segments in floor plans are horizontal or vertical lines. The inclined walls are usually longer due to aesthetic and architectural reasons [15], so that the line segments of the convex hull are also added to the set of potential line segments regardless of the above suppression.

#### 3.3.2 Embeddings

The primitive edge embedding consists of the normalized 2-dimensional coordinate values of the junction. The range of which is bounded by \([-1,1)\). The primitive node embedding includes: 1) basic information about the line segment, and 2) line features extracted from the second feature map. The vectors are concatenated to form the node embedding.

The basic information of line segments contains the normalized coordinates of the midpoint and two endpoints of the line segment, the length of the line segment, and the absolute cosine value of the angle between the line segment and the horizontal axis. Note the order of the endpoints should not affect the result, so that the endpoints are randomly switched in our implementation.

To extract the feature vector of each line segment, we introduce Rotated Region of Interest (RRoI) Pooling. It conceptually combines the advantages of LoI pooling and RoI Align. In wireframe detection, each ground truth line segment is usually in a position where the color gradient changes drastically so that the width is usually narrow. However, line segments in a floor plan are usually thick or painted with unique textures to represent special structures such as sliding doors and load-bearing walls. Hence, in addition to selecting sampling points along the direction of the line segment, RRoI also selects sampling points along the normal of the line segment as shown in Figure 3. The set of distances along the normal used in our model is \(\{-1,0,1\}\), and the number of points along the line is 32. A 2D max-pooling layer with a kernel size of (2,3) is used to reduce the shape of the feature from 32 by 3 to 16 by 1.

#### 3.3.3 Connection Classification

We adopt an attention based Graph Neural Network (GNN) similar to the design of Gated Attention Network (GaAN) [29] as our classification model to capture the relationship between nodes and classify the type of each node:

\[\mathbf{x}_{m,i}=\mathrm{FC}_{\theta_{o}}\big{(}\mathbf{x}_{m-1,i}\oplus \sum_{k=1}^{K}\sum_{j\in\mathcal{N}_{i}}w_{i,j}^{(k)}\circ\mathrm{FC}_{\theta_ {w}^{(k)}}^{h}(\mathbf{z}_{j})\big{)} \tag{4}\]

Here, \(\mathbf{x}_{m,i}\) is the vector of node \(i\) at the \(m\)-th iteration. \(\mathcal{N}_{i}\) represents node \(i\)'s neighbours, and \(\mathbf{z}\) is the reference vector of a neighbour node. \(K\) is the number of heads, and both \(\oplus\) and \(\|\) are the concatenation operation. \(\circ\) represents element-wise multiplication. FC means fully connected layers, and \(\theta\) represents the corresponding parameters. The formulation of the channel-wise attention between node \(i\) and its neighbour \(j\) is

\[w_{i,j,c}^{(k)}=\frac{\exp\left(\phi_{w,c}^{(k)}\left(\mathbf{x}_{i},\mathbf{ z}_{j},\mathbf{e}_{i,j}\right)\right)}{\sum_{l=1}^{|\mathcal{N}_{i}|}\exp\left( \phi_{w,c}^{(k)}\left(\mathbf{x}_{i},\mathbf{z}_{l},\mathbf{e}_{i,l}\right) \right)} \tag{5}\]

where \(c\) represents \(c\)-th channel, and \(\mathbf{e}_{i,j}\) is the feature of the edge from \(i\) to \(j\). The dot product attention is replaced by fully connected layers to aggregate information of edges:

\[\phi_{w}^{(k)}(\mathbf{x},\mathbf{z},\mathbf{e})=\mathrm{FC}_{\theta_{w}^{(k) }}\left(\psi_{w}^{(k)}(\mathbf{x},\mathbf{z},\mathbf{e})\right) \tag{6}\]

Here, \(\psi_{w}^{(k)}(\mathbf{x},\mathbf{z},\mathbf{e})\) concatenates the projected features:

\[\psi_{w}^{(k)}(\mathbf{x},\mathbf{z},\mathbf{e})=\mathrm{FC}_{\theta_{w}^{(k) }}(\mathbf{x})\oplus\mathrm{FC}_{\theta_{w}^{(k)}}(\mathbf{z})\oplus\mathrm{ FC}_{\theta_{e}^{(k)}}(\mathbf{e}) \tag{7}\]

The output vector of node \(i\) is

\[\mathbf{y}_{i}=\sigma(\mathbf{x}_{M,i}) \tag{8}\]

where \(M\) is the depth of the GNN, and \(\sigma(\cdot)\) is the sigmoid function which determines the likelihood of each line segment category.

### Multi-task Learning

We use the segmentation map of the structural elements (walls, door, and windows) to supervise the intermediate layers of hourglass modules. The proposed model is trained with the following loss function:

\[\mathbb{L}=\mathbb{L}_{Hourglass}+\mathbb{L}_{Junc}+\mathbb{L}_{Graph} \tag{9}\]

Figure 3: Visual comparison of different pooling methods. From left to right, 1) feature map; 2) the proposed line; 3) line of interest (LoI); 4) rotated region of interest (RRoI); 5) region of interest (RoI). The red dots in the 3rd to 5th picture represent the sampling points given by each pooling method.
where all three losses are binary cross entropy loss. In our experiments, \(\mathbb{L}_{Graph}\) is not added for the first 10,000 steps. The category of a node in the ground truth of the intermediate graph \(\mathcal{G}^{\prime}\) is regarded as one of the above structural elements if the \(L_{2}\) distance between the node and any of these ground truths is less than \(d_{max}=25\).

## 4 Experiments

### Baselines

**Modified HAWP** We choose the previous state-of-the-art model in wireframe parsing as one of our baseline approaches, yet the model is not designed for multi-class line segment detection. Thus, a few modifications are made: 1) The fully connected layers are no longer projecting LoI features to scores but to categories. 2) The junction detection module is aligned with our method described in Section 3.2. 3) The RRoI line feature extraction module is introduced to replace LoI. The effect of each modification is discussed in Section 4.4. As in the original paper, the binary cross entropy loss is used to train the models.

**GLSP as an integratable module** The GLSP model can also be used as an integratable module on a conventional line segment detection algorithm. Here, we choose the modified HAWP as the line segment detection algorithm, and the same techniques described in Section 3.3.1 to build the graph. The line segment classification results given by the modified HAWP are added to the features of nodes (the green line in Figure 4), and the performance of adding line features extracted from the feature map of the modified HAWP model into the GNN (the red line in Figure 4) is also tested in the ablation study. The two modules are trained independently, so the parameters of the modified HAWP would not be updated when training the GNN. The binary cross entropy loss is used to train the GNN.
models are trained for 2 epochs, where the learning rate is \(2\times 10^{-4}\) for the first epoch, and \(2\times 10^{-5}\) for the other. The batch size equals 8 if GLSP is an integratable module and NDS is used as the suppression strategy, and 4 otherwise.

All models are optimized by the ADAM optimizer [12] setting the weight decay to \(1\times 10^{-4}\). HAWP-M, HAWP-M+, and HAWP-M* in the following experiments represent the HAWP with the first, the first two, and all modifications in Section 4.1. The kernel size for NMS is 3 if not mentioned. In Table 2, the model "HAWP-M* + GNN" does not use line segment feature extracted from the feature map of the modified HAWP (the red line in figure 4), which effect are evaluated in the ablation study section.

### Evaluation Metrics

We follow the definition of Structural Average Precision (sAP) used in [31] and [26], whereas the results are evaluated on the ground truths with resolutions of \(512\times 512\) rather than \(128\times 128\) in [26]. Please refer to the supplementary material for the results of sAP for each class (wall, door, and window). sAP\({}_{N}\) represents Structural Average Precision without considering the class of line segments. The mean of sAP values over different categories is denoted as msAP. We set the threshold of \(L_{2}\) distance \(\vartheta_{L}\) to 8, 16, 32, and denote the results as msAP\({}^{\vartheta_{L}}\) and sAP\({}^{\vartheta_{L}}_{N}\). The vectorized junction AP (sAP\({}_{J}\)) is designed in a similar way, where the threshold \(\vartheta_{J}\in\{2,4,8\}\).

### Results and Analysis

Table 2 and Figure 6 shows the performance of line segment detection for baseline models and GLSP. The modifications made to HAWP improve its performance, whereas using GLSP as an integratable module and the end-to-end GLSP is a better choice for both junction detection and line segment detection. In Section 3.2, we argue that using bins instead of pixels can result in a significant drop in the recall rate of junction detection, which is verified in Table 1 and Figure 5. By comparing the accuracy of different models, it is not difficult to infer that the accuracy of junction detection can influence the accuracy of line segment detection to some extent. We also adjust the kernel size of NMS, and it can be seen from the table that a larger range of NMS does harm junction detection. GLSP predicts the junctions much better than HAWP-M*, and we suggest the reason may be that the feature map is only used to detect junctions and does not need to be shared with the module of line segment proposal. Please refer to the supplementary material for qualitative examples from the models mentioned above.
SF represent assigning the basic information of the line segments, assigning line segment detection results (the green line in Figure 4), assigning the pooling results of line segment detection network (the red line in Figure 4), and assigning line features extracted from the second image feature extraction networks (the blue line in Figure 2 and 4) to the nodes of the intermediate graph \(\mathcal{G}^{\prime}\), respectively.

If the GLSP is used as an integratable module, adding the line segment classification results is much better than adding line features extracted from the feature map of the modified HAWP model. The latter can also have negative effects in some cases. Therefore, the model "HAWP-M* + GNN" in Table 2 does not adopt the feature. The second feature map can slightly improve the performance of both paradigms. NSS may be a better choice compared to NDS, but the number of nodes in \(\mathcal{G}^{\prime}\) of NSS is approximately 4

\begin{table}
\begin{tabular}{l c c c c c c c c c} \hline \hline BI & PR & DR & SF & NSS & msAP\({}^{8}\) & msAP\({}^{16}\) & msAP\({}^{32}\) & sAP\({}^{8}_{N}\) & sAP\({}^{16}_{N}\) & sAP\({}^{32}_{N}\) \\ \hline HAWP-M* + GNN & & & & & & & & & \\ \hline \(\bigcirc\) & \(\bigcirc\) & & & \(79.66\pm 0.35\) & \(85.07\pm 0.08\) & \(85.96\pm 0.07\) & \(80.19\pm 0.29\) & \(84.38\pm 0.12\) & \(85.04\pm 0.06\) \\ \(\bigcirc\) & & \(\bigcirc\) & & \(85.16\pm 0.32\) & \(90.24\pm 0.14\) & \(91.13\pm 0.04\) & \(81.03\pm 0.20\) & \(84.84\pm 0.11\) & \(85.44\pm 0.05\) \\ \(\bigcirc\) & \(\bigcirc\) & \(\bigcirc\) & & \(85.37\pm 0.32\) & \(90.47\pm 0.16\) & \(91.36\pm 0.06\) & \(81.23\pm 0.20\) & \(84.91\pm 0.11\) & \(85.50\pm 0.05\) \\ \(\bigcirc\) & & \(\bigcirc\) & \(\bigcirc\) & \(85.72\pm 0.27\) & \(91.30\pm 0.14\) & \(92.26\pm 0.03\) & \(81.17\pm 0.21\) & \(85.13\pm 0.11\) & \(85.75\pm 0.05\) \\ \(\bigcirc\) & \(\bigcirc\) & \(\bigcirc\) & \(\bigcirc\) & \(85.11\pm 0.29\) & \(90.70\pm 0.11\) & \(91.66\pm 0.02\) & \(80.78\pm 0.28\) & \(84.91\pm 0.12\) & \(85.56\pm 0.05\) \\ \(\bigcirc\) & & \(\bigcirc\) & \(\bigcirc\) & \(\bigcirc\) & \(\mathbf{85.86}\pm 0.35\) & \(\mathbf{91.50}\pm 0.16\) & \(\mathbf{92.5}\pm 0.04\) & \(\mathbf{81.38}\pm 0.27\) & \(\mathbf{85.25}\pm 0.13\) & \(\mathbf{85.87}\pm 0.06\) \\ \hline
**GLSP** & & & & & & & & & & \\ \hline \(\bigcirc\) & & & & & & & & & & \\ \(\bigcirc\) & & & & & & & & & & \\ \(\bigcirc\) & & & & & & & & & & \\ \(\bigcirc\) & & & & & & & & & & \\ \(\bigcirc\) & & & & & & & & & & \\ \hline \hline \end{tabular}
\end{table}
Table 3: The ablation study of different designs. If NSS is not marked, NDS is used as the suppression strategy.

Figure 7: Precision-Recall (PR) curves of (a) GLSP as integratable modules, and (b) end-to-end GLSp.
times that of NDS.

Another problem we would like to discuss is adding prior knowledge or limitations to the training process. Here, we introduce two possible prior knowledge to the loss function after the category \(c^{\prime}_{v_{i}}\) for node \(v_{i}\) is predicted: 1) the graph loss for \(v_{i}\) is doubled if the line segment it represented is intersected with node \(v_{j}\)'s corresponding line segment, where \(v_{i}\neq v_{j}\), while both are classified as meaningful line segments (a wall, a door, or a window), and 2) the graph loss for a node is doubled if a sequence of nodes \(K\) can be found that a) \(v_{i}\in K\), b) the line segments represented by the nodes in the sequence are connected end-to-end, and c)\(\forall k\in K\), \(c^{\prime}_{k}\in\{\text{wall},\text{window}\}\), which means the area is not connected to other parts of the floor plan. The losses are introduced after the model has been trained for 20,000 steps. We use PK to represent whether the loss of prior knowledge is used, and \(N_{r}\) and \(N_{R}\) to represent the number of enclosed rooms, and the number of enclosed rooms with doors, respectively. As shown in Table 4 and Figure 8, the strategy improves the number of valid rooms in the final results, but slightly reduces the accuracy of the line segment detection.

## 5 Conclusion

In this paper, we present GLSP, a line segment detection algorithm based on Graph Attention Network. The proposed model can be used as an end-to-end algorithm or an integratable module on existing line segment detection models. The former one preform better than the latter paradigm on our open-source floor plan dataset LRFP. Our proposed methods are capable to output vectorized results of junctions and line segments, which may reduce the amount of computation for post-processing works when reconstructing editable floor plans from images.
