A macroscopic evacuation network model fast automatic modeling method based on semantic segmentation
Patent Information
- Application Number
- CN202510582123.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-07
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2045-05-07
AI Technical Summary
所述方法能够利用建筑平面光栅图像实现宏观疏散网络模型的快速自动建模,该方法主要实现了宏观疏散网络模型的自动建模,解决了人工建模工作重复、耗时费力的问题
[0021]本发明基于搭建的语义分割模型,提出了一种自动完成宏观疏散网络模型建模的方法。该方法能够利用平面光栅图像,快速自动生成宏观疏散网络模型,并建立对应的拓扑疏散网络图。通过将本发明提出的宏观疏散网络模型自动建模方法在3层建筑实例上的结果与人工建模结果的分析对比,可以看出本发明提出的自动建模方法能较大幅度地减少宏观疏散网络模型所需的建模时间,将时间缩短到1/150,具有显著的速度优势,因此可以缓解人工计算工作重复、耗时的问题,结合宏观模拟方法能够适用于大量建筑及单体建筑不同布局的快速疏散模拟。
Smart Images

Figure CN120510246B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of simulation technology for crowd evacuation within buildings, and in particular to a rapid automatic modeling method for macroscopic evacuation network models based on semantic segmentation. Background Technology
[0002] Ensuring the safe evacuation of people within buildings is of paramount importance for protecting lives, and simulating the evacuation process within buildings is crucial for guaranteeing the safety of people in emergencies. Simultaneously, due to technological advancements and the widespread use of simulation models, an increasing number of evacuation simulation tools have been designed for evacuation simulation. These tools can reduce casualties during accidents, improve evacuation efficiency, reveal shortcomings in building design, and enable building managers to prepare for various emergency situations. Existing literature uses different Building Information Modeling (BIM)-based evacuation simulation tools to simulate emergency evacuation of people in buildings, primarily using software such as Autodesk Revit, PyroSim, Unity3D, AnyLogic, and Pathfinder. Based on different levels of accuracy, evacuation models can be divided into three categories: macro-models, micro-models, and meso-models. Macro-evacuation network models abstract the passable areas within a building space into a graph network model containing nodes and arcs. Rooms are abstracted as nodes, and areas such as corridors are abstracted as arcs connecting room nodes. Furthermore, in macro-models, each person has the same attributes. Microscopic models consider the different attributes of each individual, enabling detailed simulations, but this also means requiring a huge amount of computation, especially when dealing with the evacuation of large and complex buildings. Mesoscopic models, on the other hand, fall between macroscopic and microscopic models to provide realistic and feasible evacuation plans.
[0003] Existing literature, when using macroscopic models such as EVACNET4 for macroscopic evacuation, requires providing an evacuation network model that abstracts building geometry into nodes and arcs. This evacuation network model includes the evacuation network diagram, the evacuation network structure, and the evacuation information required for macroscopic evacuation, such as passage width and arc length between nodes. Similarly, when performing microscopic evacuation simulations, some software, such as AnyLogic, also requires providing an evacuation road network to save computational costs. However, most of these evacuation network models are created manually, which is extremely time-consuming, repetitive, and inefficient when dealing with large or complex buildings. Therefore, there is an urgent need for methods to automatically create evacuation network models.
[0004] In recent years, deep learning has been continuously developing and widely applied in various disciplines and fields. In the field of architectural design, patents utilizing deep learning to extract architectural information from floor plans have made rapid progress. These patents identify and extract architectural information including doors, rooms, walls, and characters. However, due to the often different colors, line thicknesses, and symbols used by construction and engineering companies, and the fact that stored floor plans are usually complex and blurry, there are currently challenges in using deep learning to recognize floor plans. But with the publication of more and more patents related to floor plan recognition and the release of more and more open-source datasets, the difficulties in floor plan recognition are gradually being overcome. Furthermore, considering that architectural floor plans are usually stored as raster images during use, using deep learning to recognize raster images and extract architectural information remains the optimal method.
[0005] Therefore, this invention proposes an efficient method for automatically generating macroscopic evacuation network models by using deep learning to identify building floor plans and extract building information from them. Summary of the Invention
[0006] The purpose of this invention is to address the problems in existing technologies by proposing a rapid and automatic modeling method for macroscopic evacuation network models based on semantic segmentation. This method enables rapid and automatic modeling of macroscopic evacuation network models using architectural planar raster images. It primarily achieves automatic modeling of macroscopic evacuation network models, solving the problems of repetitive, time-consuming, and labor-intensive manual modeling work.
[0007] This invention is achieved through the following technical solution: This invention proposes a fast automatic modeling method for macroscopic sparse network models based on semantic segmentation, the method comprising the following steps:
[0008] Step 1: Use the established semantic segmentation model to identify the building floor plan and optimize the prediction results through image morphology processing. In Step 1, the semantic segmentation model is used to identify the building floor plan raster image to obtain the semantic segmentation results of the door and room areas, and the final prediction results are obtained through post-processing using image morphology methods.
[0009] Step 2: Extract building evacuation information based on semantic segmentation results and establish a node network graph and a passable area graph. In step 2, evacuation information is extracted from image information, and a node network graph containing node information is established, consisting of source nodes, intermediate nodes and exit nodes, thereby further obtaining a passable area graph with intermediate node information.
[0010] Step 3: Combine the node network diagram and the passable area diagram to perform evacuation flow analysis and complete the macroscopic evacuation network model modeling. In Step 3, the A* algorithm is used to perform evacuation flow analysis on the passable area diagram and the node network diagram to establish an evacuation road network from the source node to each exit node. This network is then simplified into a simplified evacuation road network represented by the nodes through which the route passes. This simplified evacuation road network, combined with the evacuation information contained in the network, constitutes the macroscopic evacuation network model.
[0011] Furthermore, the semantic segmentation model uses the DeepLabV3+ network as the basic model; during the model training phase, the standard cross-entropy loss function is used as the semantic segmentation loss; the optimization of the prediction result through image morphology processing is specifically as follows: (1) Two locally connected objects are disconnected on the raster image, one of which is located in the center and the other is located at the bottom; first, the raster image is converted into a binary image, where pixel value 1 belongs to the object itself and pixel value 0 belongs to the background; pixel values belonging to the connected region are highlighted in red, and the binary image is morphologically eroded and dilated using a standard 3×3 convolution kernel, and the green area represents the area where the value changes from 1 to 0 after erosion. Except for the two areas highlighted in red, the values of other areas change back to 1 after dilation; (2) Objects with overlapping areas are disconnected. After morphological opening operation, i.e., erosion followed by dilation, the pixels in the overlapping area change from 1 to 0, while the other areas retain their original values; through the convolution kernel and another convolution kernel symmetrical to it, the problem of adhesion between two different object regions of arbitrary shape is realized.
[0012] Furthermore, in step one, a region growing method is used to detect connected regions in the building floor plan. Specifically, the building floor plan is converted into a binary image, with pixel values of 0 or 1; walls and obstacles are depicted as lines, while room areas are left blank to represent passable areas; first, the binary image is processed, and a seed pixel P with a value of 1 is selected. S The adjacent points are then checked as candidate points; subsequently, the candidate point is verified to determine if its pixel value is 1; if it is confirmed to be 1, it is designated as a valid point P. T And become the new seed pixel; this process continues until all seed pixels have been detected, thereby generating a sequence containing all P pixels. T Merged regions of points; the extracted merged regions will be clustered based on the region size and an adaptive threshold will be calculated. Regions smaller than the threshold will be considered as useless regions caused by symbols and removed from the merged regions. The final image will be combined with the semantic segmentation results of rooms and doors through image logic AND operation to further supplement unidentified room region points.
[0013] Furthermore, in step two, the source node represents the starting position of the person and is set at the geometric center of the room area; the exit node represents the overall exit of the building; the intermediate node refers to all nodes in the simplified route represented by nodes other than the source node and the exit node, which includes two types of nodes: potentially congested nodes and stair nodes; potentially congested nodes are nodes where the passable width changes, while stair nodes serve as connecting nodes between upper and lower floors.
[0014] Furthermore, the basic nodes constituting the three types of nodes are room nodes and door nodes, whose information is obtained by processing the semantic segmentation results. The cv2.findContours function in the OpenCV library is used to identify the contours of rooms and doors from the optimized semantic segmentation results. The obtained room and door contours are processed separately to determine the room nodes and door nodes and their corresponding information.
[0015] Furthermore, in step two, the maximum embedding rectangle iterative search method is used to divide a single large region or a region with a complex shape into multiple regular rectangular regions for the source node of the complex region, and these rectangles are selected to represent the single large region or the region with a complex shape. The maximum embedding rectangle iterative search method uses the original region as the search range, finds the largest rectangle with the largest area in the search range and records it, and then deletes the rectangular region from the search range. The above steps are repeated in the new search range until the area of the largest rectangle found is less than the set threshold.
[0016] Furthermore, in step three, the evacuation route representation in the simplified evacuation road network is simplified. Specifically, each route is represented as a sequence of its source node, intermediate nodes, and exit node. Then, intermediate nodes that are unlikely to cause congestion are excluded. This process ultimately yields a simplified evacuation route consisting of a source node, intermediate node 1, intermediate node 2, ..., intermediate node n, and an exit node.
[0017] Furthermore, the topological evacuation network diagram corresponding to the macroscopic evacuation network model is a floor plan-based representation that integrates source nodes, intermediate nodes, and exit nodes with simplified evacuation routes and overlays them onto the original building layout. In the single-floor evacuation network diagram, nodes are depicted as numbered circles, with each number corresponding to a specific node. The numbering order follows two key principles: (1) first number the source nodes, then the intermediate nodes, and finally the exit nodes; (2) change from the lower floor to the upper floor according to the building floor order. Different types of nodes are represented by different colors, and simplified evacuation routes are represented by line segments connecting nodes, with arrows indicating the direction of movement.
[0018] The present invention also proposes an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method for rapid automatic modeling of macroscopic sparse network models based on semantic segmentation.
[0019] The present invention also proposes a computer-readable storage medium for storing computer instructions, which, when executed by a processor, implement the steps of the method for rapid automatic modeling of macroscopic sparse network models based on semantic segmentation.
[0020] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0021] This invention proposes a method for automatically modeling macroscopic evacuation networks based on a semantic segmentation model. This method can quickly and automatically generate macroscopic evacuation network models and establish corresponding topological evacuation network diagrams using planar raster images. By comparing the results of the proposed automatic macroscopic evacuation network modeling method on a 3-story building example with those obtained manually, it can be seen that the proposed automatic modeling method can significantly reduce the modeling time required for macroscopic evacuation network models, shortening it to 1 / 150th of the time, demonstrating a significant speed advantage. Therefore, it can alleviate the problems of repetitive and time-consuming manual calculations. Combined with macroscopic simulation methods, it can be applied to the rapid evacuation simulation of a large number of buildings and individual buildings with different layouts. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0023] Figure 1 This is a schematic diagram of the original image and its semantic annotation. (a) is the original image, and (b) is the annotated image.
[0024] Figure 2 This is a schematic diagram of the image augmentation results. Among them, (a) is random rotation, (b) random cropping, (c) random flipping, (d) randomly rotated label, (e) randomly cropped label, and (f) randomly flipped label.
[0025] Figure 3 These are the training results. Among them, (a) is the loss curve and (b) is the mean intersection-union (MIOU) curve.
[0026] Figure 4 This is a schematic diagram of the semantic segmentation test results.
[0027] Figure 5 This is a schematic diagram of the process of breaking apart the adhesive area between different objects.
[0028] Figure 6 This is a schematic diagram illustrating the process of breaking up overlapping areas between different objects.
[0029] Figure 7 This is a schematic diagram of breaking the adhesion using opening operations.
[0030] Figure 8 This is a schematic diagram illustrating the principle of the region growing method.
[0031] Figure 9 This is a schematic diagram of the passable area map. (a) is the original map, and (b) is the map with intermediate nodes.
[0032] Figure 10 These are schematic diagrams showing the fitting results for the door and room regions. Among them, (a) is the minimum rectangle fitting for the door region, and (b) is the polygon fitting for the room region.
[0033] Figure 11 This is a schematic diagram of iterative embedding of rectangles in a complex region.
[0034] Figure 12 This is a schematic diagram illustrating the principle of finding nodes with varying passable width.
[0035] Figure 13 This is a floor plan of a three-story building. (a) is the first floor plan, and (b) is the second and third floor plan.
[0036] Figure 14 This is a schematic diagram of the initial semantic segmentation prediction results for a three-story building. (a) shows the prediction results for the first layer, and (b) shows the prediction results for the second and third layers.
[0037] Figure 15 This is a schematic diagram of the optimized room category prediction results. (a) represents the first-floor room area, and (b) represents the second and third-floor room areas.
[0038] Figure 16 This is a schematic diagram of the optimized door category prediction results. (a) represents the first-floor door area, and (b) represents the second- and third-floor door areas.
[0039] Figure 17 This is a schematic diagram of the node network of a three-story building. (a) is the first floor plan, and (b) is the second and third floor plan.
[0040] Figure 18 This is a schematic diagram of the accessible areas of a three-story building. (a) shows the accessible area on the first floor, and (b) shows the accessible areas on the second and third floors.
[0041] Figure 19This is a schematic diagram of the evacuation flow.
[0042] Figure 20 This is a schematic diagram of the evacuation network for a three-story building. (a) is the evacuation network diagram for the first floor, (b) is the evacuation network diagram for the second and third floors, and (c) is the overall evacuation network diagram. Detailed Implementation
[0043] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0044] Combination Figures 1-20 This invention proposes a fast automatic modeling method for macroscopic sparse network models based on semantic segmentation. The method includes the following steps:
[0045] Step 1: Use the established semantic segmentation model to identify the building floor plan and optimize the prediction results through image morphology processing. In Step 1, the semantic segmentation model is used to identify the building floor plan raster image to obtain the semantic segmentation results of the door and room areas, and the final prediction results are obtained through post-processing using image morphology methods.
[0046] This invention constructs a semantic segmentation dataset for doors and rooms and trains a semantic segmentation model based on deeplabV3+. Then, post-processing of the segmentation results is performed using methods such as image morphology processing. The construction and training process of the semantic segmentation model will be described below.
[0047] To construct the dataset, 509 residential building floor plans were extracted from the Cubicasa5k dataset as the original images, such as... Figure 1 As shown. LabelMe is used to annotate elements of interest: doors and rooms. These two areas collectively define the areas people can enter, and different colors are used to distinguish them. Therefore, the original dataset contains 509 original images and their corresponding semantically annotated images. Subsequently, image augmentation techniques were used to expand the original dataset, thereby increasing the sample size. First, random rotation and cropping were used to tilt the walls of the original images, resulting in images with tilted walls (…). Figure 2 ) and their corresponding labels ( Figure 2 Furthermore, by combining random flipping (including vertical and horizontal flipping), different architectural floor plans and their semantic annotations were obtained. Figure 2Ultimately, after applying these three operations, a dataset containing 1200 architectural floor plans and their annotations was obtained. In this new dataset, the dataset was divided into a training set of 960 images and a test set of 240 images in a 4:1 ratio.
[0048] To achieve accurate and efficient image semantic segmentation, the semantic segmentation model uses the DeepLabV3+ network as its base model. By utilizing depthwise separable convolutions, this network significantly reduces parameters, improves computational efficiency, and minimizes model complexity while preserving high-quality segmentation results. A key feature of DeepLabV3+ is its integration of spatial pyramid pooling, which effectively captures contextual information across multiple scales, thereby facilitating robust processing of multi-scale objects.
[0049] During the model training phase, the standard cross-entropy loss function was used as the semantic segmentation loss. To improve the model's generalization ability, data augmentation techniques, including random rotation and flipping, were employed. Furthermore, hyperparameters such as the learning rate, batch size, and number of training epochs were carefully tuned to ensure the network effectively captures comprehensive semantic information from images. The performance evaluation of the model in this invention uses the Mean Intersection over Union (MIOU) metric. MIOU quantifies the model's accuracy by calculating the ratio of the intersection to the union of the predicted results and the true labels. Specifically, the IOU for each category can be calculated first, and then the average of the IOUs for all categories can be obtained to obtain the MIOU. The formula for calculating MIOU is shown in formula (1).
[0050]
[0051] Where N is the total number of categories, TP i FP is the true number of cases in the i-th class (the number of samples correctly predicted by the model to be in that class). i FN is the number of false positives in the i-th class (the number of samples incorrectly predicted as belonging to that class by the model). i MIOU represents the number of false negatives in the i-th class (the number of samples incorrectly predicted as belonging to other classes). A higher MIOU indicates better segmentation performance across different classes. By introducing the DeepLabV3+ network, this invention aims to build a robust foundational model, providing reliable semantic segmentation support for subsequent automated methods.
[0052] A semantic segmentation model is trained using the prepared dataset. The loss curve of the model in this invention is shown below. Figure 3 As shown in the figure, the four curves represent the training loss curve, the test loss curve, the smoothed training loss curve, and the smoothed test loss curve, respectively. Smoothing loss SL i Calculated by Equation 2, where L i For the current loss, Li-1 The previous smoothing loss is represented by α, which is a smoothing factor. The smoothing factor typically ranges from 0 to 1 and determines the weight of past losses; in this invention, α is set to 0.6. From... Figure 3 As can be seen, after 100 epochs, the training loss of the model decreased to 0.155 and the validation loss decreased to 0.147, indicating that the model had converged. Figure 3 (b) The MIOU curve of the trained model. After an initial rapid increase, the curve flattens out and reaches 85.39% at 100 epochs.
[0053] SL i =α·L i +(1-α)·L i-1 (2)
[0054] The trained model is used to predict planar graphs similar to samples in the dataset. The prediction results are as follows: Figure 4 As shown in the figure, the base image is the floor plan of the building to be predicted, the green area represents the predicted room categories, and the red area represents the predicted door categories. The prediction results show that the trained semantic segmentation model can effectively identify the rooms and doors in the floor plan, providing a solid foundation for subsequent image processing and evacuation information extraction.
[0055] In semantic segmentation of architectural floor plans, limited image resolution and delicate wall structures often lead to boundary adhesion and room regions in the segmentation output, thus affecting the accuracy of spatial contour recognition. To alleviate this problem, this invention introduces a specialized morphological processing framework that can solve the adhesion problem between different regions at any angle and in any direction.
[0056] Morphological image processing includes operations such as erosion, dilation, opening, and closing. Erosion and dilation are fundamental operations in this field. Both operations involve convolving an image or a portion of an image with a kernel of arbitrary shape and size, using an anchor point as a reference point. Erosion aims to identify local minima, while dilation seeks local maxima. Let A represent a binary image and E represent a kernel; define a translation operation (E)z, where (E)z represents moving the anchor point of the convolution kernel E to a point z on the image. During this movement, if all values within the kernel region are 1, erosion assigns a value of 1 or 0 to the anchor point; while if at least one value within the kernel region is 1, dilation assigns a value of 1 or 0 to the anchor point, as shown in equations (3) and (4). Therefore, erosion reduces or thins objects in a binary image, while dilation increases or coarsens them. Based on these concepts, the opening operation involves erosion followed by dilation, while the closing operation involves dilation followed by erosion. The morphological opening operation, which involves erosion followed by dilation, allows the opening operation to break the connection regions between objects.
[0057]
[0058] Figure 5 This paper describes the process of breaking two locally connected objects in a raster image. One connected region is located at the center, and the other at the bottom. First, the raster image is converted into a binary image, where pixel values of 1 belong to the object itself, and pixel values of 0 belong to the background. Pixel values belonging to connected regions are highlighted in red. Morphological erosion and dilation are performed on the binary image using a standard 3×3 convolution kernel. Green areas represent regions where the value changes from 1 to 0 after erosion. Except for the two highlighted red areas, the values in other areas change back to 1 after dilation. This method can eliminate interconnected regions between non-overlapping objects. However, breaking objects with overlapping regions requires special handling. Figure 6 It demonstrates the process of handling two interconnected objects with overlapping areas. Figure 6 The binary image shown on the left contains overlapping pixels highlighted in red. After morphological opening (erosion followed by dilation), the pixels in the overlapping area change from 1 to 0, while the remaining areas retain their original values. By using a convolution kernel and another symmetrical convolution kernel, the problem of adhesion between regions of two different objects of arbitrary shapes is solved.
[0059] After applying the above method to process the semantic segmentation results, the problem of contiguous regions was effectively solved. Figure 7 The example results after morphological opening are shown. In the figure, multiple contiguous regions exist in the semantic segmentation result. Due to the subtle connections between different rooms during the contour extraction stage, these contiguous regions were identified as individual room regions. By applying the aforementioned morphological method, these contiguous regions were successfully separated, thus achieving accurate differentiation between different rooms during the contour extraction stage.
[0060] The present invention also employs the region growing method to detect connected regions in architectural floor plans. Region growing is an image segmentation technique that utilizes pixel similarity to gradually merge adjacent pixels from a pre-selected seed pixel, thereby forming connected regions with similar features. Figure 8 This invention demonstrates the principle and examples of the proposed region growing method. In this invention, a building floor plan is converted into a binary image, with pixel values either 0 or 1; walls and obstacles are depicted as lines, while room areas are left blank to represent passable areas; the binary image is first processed, and a seed pixel P with a value of 1 is selected. S The adjacent points are then checked as candidate points; subsequently, the candidate point is verified to determine if its pixel value is 1; if it is confirmed to be 1, it is designated as a valid point P. TAnd become the new seed pixel; this process continues until all seed pixels have been detected, thereby generating a sequence containing all P pixels. T Merged regions of points; the extracted merged regions will be clustered based on the region size and an adaptive threshold will be calculated. Regions smaller than the threshold will be considered as useless regions caused by symbols and removed from the merged regions. The final image will be combined with the semantic segmentation results of rooms and doors through image logic AND operation to further supplement unidentified room region points.
[0061] Step 2: Extract building evacuation information based on semantic segmentation results and establish a node network graph and a passable area graph. In step 2, evacuation information is extracted from image information, and a node network graph containing node information is established, consisting of source nodes, intermediate nodes and exit nodes, thereby further obtaining a passable area graph with intermediate node information.
[0062] In step two, the macroscopic evacuation network model consists of nodes and arcs connecting them, with these nodes derived from building information. The evacuation network typically includes three main types of nodes: source nodes, intermediate nodes, and exit nodes. Source nodes represent the starting point of a person's journey and are located at the geometric center of the room area; exit nodes represent the overall exit of the building, usually a door; intermediate nodes refer to all nodes in the simplified route represented by nodes, excluding source and exit nodes, and include two types: potentially congested nodes and stair nodes; potentially congested nodes are those where the passable width changes, while stair nodes serve as connecting nodes between upper and lower floors.
[0063] The basic nodes that make up the three types of nodes are room nodes and door nodes, and their information is obtained by processing the semantic segmentation results. The cv2.findContours function in the OpenCV library is used to identify the contours of rooms and doors from the optimized semantic segmentation results. The obtained room and door contours are processed separately to determine the room nodes and door nodes and their corresponding information.
[0064] In this invention, a "door" refers to an area connecting two rooms (including corridors), and its outline is typically rectangular or approximately rectangular. Therefore, this invention utilizes the `cv2.minArerRect` function from the OpenCV library to fit the semantic segmentation results of the door to a shape such as... Figure 10 In the minimum rectangle shown, all pixels belonging to the gate region are enclosed. On the one hand, this improves the accuracy of semantic segmentation of the gate by identifying unlabeled pixels that should belong to the gate region; on the other hand, the feature information of the gate, including the center point coordinates, the rectangle's length and width, rotation angle, and normal vector, can be calculated using the coordinates of the four vertices of the minimum rectangle.
[0065] The primary goal of this stage is to obtain the coordinates and area of the room's center point, as well as the number of polygon edges constituting the contour. However, due to pixel-level semantic segmentation prediction, the resulting contour boundaries are often not smooth enough and consist of numerous points. The significant discrepancy between the results and reality makes accurately determining the number of polygon edges extremely difficult. To more closely approximate the actual number of polygon edges in a room, this invention uses the `cv2.approxPolyDP` function from the OpenCV library to fit the polygons to the room contour, such as... Figure 10 As shown, the cv2.approxPolyDP function uses an algorithm that simplifies the shape and extracts key points by approximating the curve as a series of simplified points. In this function, the epsilon parameter controls the approximation degree of the DP algorithm; its value is the maximum distance between the original contour boundary points and the approximate polygon boundary. In this invention, the threshold is flexibly adjusted according to the contour length to accurately determine the number of sides in the room area contour.
[0066] In summary, by employing minimum rectangle fitting and approximate polygon fitting techniques, room nodes and door nodes can be extracted from architectural floor plans, obtaining their main feature information. For rooms, this includes center point coordinates, area, and number of polygon sides; for doors, it includes center point coordinates, area, vertex coordinates, rotation angle, and normal vector.
[0067] Exit nodes are connection points between the interior and exterior of a building, typically represented by door nodes. For an exit door node, one side connects to an interior area, and the other side connects to an exterior area; for other door nodes, both sides connect to two interior areas. Therefore, exit nodes can be evaluated using this characteristic. The specific implementation is as follows: Starting from the center point of the door node, extend outwards along two normal vectors, recording points within a certain length range, and determining if the pixel value of these points is 0. If the pixel value of all sampled points is 255, then the door node is not an exit node. Conversely, if the pixel value of sampled points on one side is continuously 0, then the door node is confirmed as an exit node.
[0068] Some rooms in large buildings, such as hospital lobbies, are large in area and complex in shape, sometimes with their geometric center located outside the area, thus requiring a reassessment of the source node's location. Given the sheer size and complex geometry of these areas, it is necessary to decompose them into discrete, representative subdomains. It is easy to see that these areas can be viewed as multiple interconnected rooms, with connecting sections (e.g., corridors) typically being regular areas. Therefore, this invention employs a maximum embedding rectangle iterative search method to divide a single large or complex-shaped area into multiple regular rectangular regions, selecting these rectangles to represent the single large or complex-shaped area. The maximum embedding rectangle iterative search method uses the original area as the search range, finding and recording the largest rectangle within the search range, then deleting that rectangle from the search range. This process is repeated in a new search range until the area of the found largest rectangle is less than a set threshold.
[0069] This invention selects the contours to be segmented by simultaneously considering the room area and the number of sides of the outline polygon. Iterative calculations are performed on each contour, and the segmented rectangular regions are recorded for subsequent processing. Figure 11 The diagram illustrates the area to be segmented, with the red rectangle representing the segmentation result after iterative computation. A minimum room area threshold is set (20,000 square pixels in this invention). The iteration stops when the area of the largest embedded rectangle found is less than this threshold. At this point, the segmentation of the large, complex area is complete, and the placement of all source nodes is finished.
[0070] The method proposed in this invention deploys intermediate nodes in locations where congestion may occur, most of which exhibit varying passage widths. These locations with varying passage widths fall into two main categories: door nodes, identified through semantic segmentation, and narrow passageways caused by variations in room width. By combining the segmentation results with subsequent analysis techniques, all nodes with varying passage widths within the passable space can be automatically detected.
[0071] First, the complex region is segmented using an iterative maximum embedding rectangle method, resulting in multiple rectangles covering a certain area (90% in this invention). Then, by extending any point along two normal vectors perpendicular to the major axis of each rectangle until they intersect an obstacle, the distances l1 and l2 from that point to the sides of the corridor are obtained. The sum of l1 and l2 represents the passable width at that point. For example, Figure 12The diagram shows an area where the passable width changes. According to the area segmentation results, this area consists of two rectangles. The method in this patent divides the width of each rectangle into n parts (n=3 in this patent) and extends dividing lines along both ends, thus obtaining n sets of detection points. Then, the passable width sequence for each detection point set is calculated. For each sequence, it is determined whether the passable width has changed and where the change occurred, whether the change value is greater than a minimum threshold, and whether the smaller value before and after the change is less than the maximum threshold for possible congestion width. If these conditions are met, the width change point is recorded as an intermediate node, and the coordinates of the intermediate node are modified to the center of the passage.
[0072] Furthermore, the changes in passage width can be categorized into two types: abrupt and gradual. For abrupt changes, the abrupt point should obviously be chosen as the node where the passage width changes. In gradual changes, the width change will be less than a threshold. Therefore, in smooth transition scenarios, to identify the starting point of the width change, it is first necessary to verify whether continuous width changes exist under specified conditions. Then, the position where the width transition begins is designated as an intermediate node. These nodes where the passage width changes, together with the gate nodes, constitute the intermediate nodes.
[0073] Based on the method described above, all three types of nodes are finally obtained: source nodes, intermediate nodes, and exit nodes, as well as the required evacuation information including the coordinates and passage width of these nodes, and the node network is obtained based on the above information.
[0074] The semantic segmentation results of doors and rooms were merged and converted into binary images. Figure 9 In this image, areas corresponding to doors and rooms are displayed in white with a pixel value of 255, while other areas (such as walls and outdoor spaces) are represented in black with a pixel value of 0. Therefore, this image is referred to in this invention as a passable area map, where areas with a pixel value of 255 are designated as passable areas, and areas with a pixel value of 0 are designated as impassable areas.
[0075] Furthermore, the method of this invention transforms the extracted intermediate nodes into different instance objects and reconstructs them on the passable area map. Through the above method, the center point coordinates, gate width, and normal vector of the gate node are obtained. During reconstruction, these are reconstructed into a rectangular region with a width reduced to 2. Simultaneously, during the reconstruction process, distinct pixel values within the range of 0-254 are selected to fill the rectangular region, establishing a mapping relationship between nodes and pixels. The final reconstruction result is as follows. Figure 9 The image shown is the evacuation map used in this invention. This map is an 8-bit grayscale image with pixel values ranging from 0 to 255. 0-pixel areas represent outdoor areas, walls, obstacles, etc.; 255-pixel areas represent passable indoor areas; and 1-254-pixel areas represent different intermediate nodes.
[0076] Step 3: Combine the node network diagram and the passable area diagram to perform evacuation flow analysis and complete the macroscopic evacuation network model modeling. In Step 3, the A* algorithm is used to perform evacuation flow analysis on the passable area diagram and the node network diagram to establish an evacuation road network from the source node to each exit node. This network is then simplified into a simplified evacuation road network represented by the nodes through which the route passes. This simplified evacuation road network, combined with the evacuation information contained in the network, constitutes the macroscopic evacuation network model.
[0077] This invention utilizes the A-Star algorithm, employing a map of accessible areas as the map source and exit nodes as the endpoints, to analyze evacuation flow patterns. Pixel values of all points along the evacuation flow lines in the accessible area map are recorded, ranging from 1 to 255, to represent different areas of the evacuation route. Pixel value 255 represents the main access area within the building, while the final pixel value on the path corresponds to the exit node. Pixel values between 1 and 254 represent intermediate nodes. To analyze the congestion at these intermediate nodes, the frequency of each pixel value across all evacuation routes is calculated. This frequency reflects the number of routes passing through each corresponding intermediate node. By defining a congestion threshold, intermediate nodes that occur more frequently than this threshold are identified as potential congestion nodes. This analysis identifies all potentially congested intermediate nodes.
[0078] After identifying potentially congested intermediate nodes, the evacuation route representation in the simplified evacuation road network is simplified. Specifically, each route is represented as a sequence of its source node, intermediate nodes, and exit node. Then, intermediate nodes that are unlikely to be congested are excluded. This process ultimately yields a simplified evacuation route consisting of a source node, intermediate node 1, intermediate node 2, ..., intermediate node n, and an exit node.
[0079] The topological evacuation network diagram corresponding to the macroscopic evacuation network model is a floor plan-based representation that integrates source nodes, intermediate nodes, and exit nodes with simplified evacuation routes and overlays them onto the original building layout. In the single-floor evacuation network diagram, nodes are depicted as numbered circles, with each number corresponding to a specific node. The numbering order follows two key principles: (1) first number the source nodes, then the intermediate nodes, and finally the exit nodes; (2) change from the bottom floor to the top floor according to the building floor order. Different types of nodes are represented by different colors, and simplified evacuation routes are represented by line segments connecting nodes, with arrows indicating the direction of movement.
[0080] For multi-story buildings, this invention first generates individual evacuation network maps, then applies perspective transformation to project each map onto a uniform horizontal plane. Finally, the individual evacuation network maps are vertically stitched together in sequence, and red dashed lines are added to connect the evacuation staircases between each floor, thus forming a complete multi-story evacuation network map, i.e., a macroscopic evacuation network model.
[0081] Example
[0082] The following is a specific embodiment of the automatic modeling method for macroscopic evacuation networks proposed in this invention. The example is a three-story hospital in City H. The specific implementation process of the method proposed in this invention on this three-story building instance is as follows:
[0083] Step 1: Use the constructed semantic segmentation model to identify building floor plans, and optimize the prediction results through image morphology processing;
[0084] The hospital's floor plan from the first to the third floor is as follows: Figure 13 As shown, the second and third floor plans are identical. In the event of emergencies such as earthquakes or fires, only four evacuation staircases distributed in different locations within the building are considered as escape routes; elevators are not considered. The pre-built semantic segmentation model is used to predict the building floor plan, and the initial prediction results for door and room areas are as follows: Figure 14 As shown, the results contain issues such as missing values and adhesion. Next, morphological processing methods and region growing were used to optimize the prediction results, resulting in the optimized prediction results shown below. Figure 15 , 16 As shown, the final prediction result is excellent and meets the accuracy requirements.
[0085] Step 2: Extract building evacuation information based on the semantic segmentation results, and establish a node network graph and a passable area graph;
[0086] Based on the semantic segmentation results of door and room categories obtained in step one, the method proposed in this invention is used to extract source nodes, intermediate nodes, and exit nodes, resulting in a building node network diagram as follows: Figure 17 As shown in the figure. This includes nodes representing complex regions segmented using the method of this invention, and nodes with varying passable widths. This results in a passable region map with intermediate nodes, as shown in the figure. Figure 18 As shown.
[0087] Step 3: Combine node information, node network diagram and passable area map to conduct evacuation flow line analysis and complete the macro-evacuation network model modeling.
[0088] In this case, the evacuation streamline diagram obtained using the A-star algorithm is as follows: Figure 19As shown in the figure. Combining the passable area map with intermediate nodes, evacuation flow analysis is performed to obtain potentially congested intermediate nodes and simplified evacuation routes, which are then output as the final model, achieving rapid modeling of the macroscopic evacuation network. The topological macroscopic evacuation network diagram given by the method described in this invention is shown in the figure. Figure 20 Therefore, the model information (nodes, paths, etc.) is stored in an Excel file.
[0089] The three-story building in the example would require at least 8 hours for experienced professionals to manually build a macroscopic evacuation network model, and the model's accuracy could not be guaranteed, as it was highly susceptible to subjective influence. In contrast, the rapid automatic modeling method proposed in this invention can complete the construction of a macroscopic evacuation network model from a floor plan in just 3 minutes.
[0090] The present invention also proposes an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method for rapid automatic modeling of macroscopic sparse network models based on semantic segmentation.
[0091] The present invention also proposes a computer-readable storage medium for storing computer instructions, which, when executed by a processor, implement the steps of the method for rapid automatic modeling of macroscopic sparse network models based on semantic segmentation.
[0092] The memory in this application embodiment can be volatile memory or non-volatile memory, or it can include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DRRAM). It should be noted that the memory used in the methods described in this invention is intended to include, but is not limited to, these and any other suitable types of memory.
[0093] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., high-density digital video discs (DVDs)), or semiconductor media (e.g., solid-state disks (SSDs)).
[0094] In implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software. The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware processor, or by a combination of hardware and software modules in the processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, detailed descriptions are omitted here.
[0095] It should be noted that the processor in the embodiments of this application can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method embodiments can be completed by the integrated logic circuitry in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads the information in the memory and, in conjunction with its hardware, completes the steps of the above methods.
[0096] The above provides a detailed description of a fast automatic modeling method for macroscopic sparse network models based on semantic segmentation proposed in this invention. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.
Claims
1. A fast and automatic modeling method for macroscopic sparse network models based on semantic segmentation, characterized in that, The method includes the following steps: Step 1: Use the established semantic segmentation model to identify the building floor plan and optimize the prediction results through image morphology processing. In Step 1, the semantic segmentation model is used to identify the building floor plan raster image to obtain the semantic segmentation results of the door and room areas, and the final prediction results are obtained through post-processing using image morphology methods. Step 2: Extract building evacuation information based on semantic segmentation results and establish a node network graph and a passable area graph. In step 2, evacuation information is extracted from image information, and a node network graph containing node information is established, consisting of source nodes, intermediate nodes and exit nodes, thereby further obtaining a passable area graph with intermediate node information. Step 3: Combine the node network diagram and the passable area diagram to perform evacuation flow analysis and complete the macroscopic evacuation network model modeling. In Step 3, the A* algorithm is used to perform evacuation flow analysis on the passable area diagram and the node network diagram to establish an evacuation road network from the source node to each exit node. This network is then simplified into a simplified evacuation road network represented by the nodes through which the route passes. This simplified evacuation road network, combined with the evacuation information contained in the network, constitutes the macroscopic evacuation network model. The semantic segmentation model uses DeepLabV3+ network as the basic model; during the model training phase, the standard cross-entropy loss function is used as the semantic segmentation loss; the optimization of the prediction result through image morphology processing is specifically as follows: (1) Two locally connected objects are disconnected on the raster image, one of which is located in the center and the other is located at the bottom; first, the raster image is converted into a binary image, where pixel value 1 belongs to the object itself and pixel value 0 belongs to the background; pixel values belonging to the connected region are highlighted in red, and the binary image is morphologically eroded and dilated using a standard 3×3 convolution kernel, and the green area represents the area where the value changes from 1 to 0 after erosion. Except for the two areas highlighted in red, the values of other areas change back to 1 after dilation; (2) Objects with overlapping areas are disconnected. After morphological opening operation, i.e., erosion followed by dilation, the pixels in the overlapping area change from 1 to 0, while the other areas retain their original values; the problem of adhesion between two different object regions of arbitrary shape is realized through the convolution kernel and another convolution kernel symmetrical to it.
2. The method according to claim 1, characterized in that, In step one, the region growing method is used to detect connected regions in the building floor plan. Specifically, the building floor plan is converted into a binary image, with pixel values of 0 or 1; walls and obstacles are depicted as lines, while room areas are left blank to represent passable areas; first, the binary image is processed, and a seed pixel with a value of 1 is selected. P S The process involves checking adjacent points as candidate points; then, verifying the candidate point to determine if its pixel value is 1; if it is confirmed to be 1, it is designated as a valid point. P T And become the new seed pixel; this process continues until all seed pixels have been detected, thus generating a sequence containing all... P T Merged regions of points; the extracted merged regions will be clustered based on the region size and an adaptive threshold will be calculated. Regions smaller than the threshold will be considered as useless regions caused by symbols and removed from the merged regions. The final image will be combined with the semantic segmentation results of rooms and doors through image logic AND operation to further supplement unidentified room region points.
3. The method according to claim 1, characterized in that, In step two, the source node represents the starting position of the person and is set at the geometric center of the room area; the exit node represents the overall exit of the building; the intermediate node refers to all nodes in the simplified route represented by nodes other than the source node and the exit node, which includes two types of nodes: potentially congested nodes and stair nodes; potentially congested nodes are nodes where the passable width changes, while stair nodes serve as connecting nodes between upper and lower floors.
4. The method according to claim 3, characterized in that, The basic nodes that make up the three types of nodes are room nodes and door nodes, and their information is obtained by processing the semantic segmentation results. The cv2.findContours function in the OpenCV library is used to identify the contours of rooms and doors from the optimized semantic segmentation results. The obtained room and door contours are processed separately to determine the room nodes and door nodes and their corresponding information.
5. The method according to claim 1, characterized in that, In step two, the maximum embedding rectangle iterative search method is used to divide a single large region or a region with a complex shape into multiple regular rectangular regions for the source node of the complex region, and these rectangles are selected to represent the single large region or the region with a complex shape. The maximum embedding rectangle iterative search method uses the original region as the search range, finds the largest rectangle with the largest area in the search range and records it, and then deletes the rectangular region from the search range. The above steps are repeated in the new search range until the area of the largest rectangle found is less than the set threshold.
6. The method according to claim 1, characterized in that, In step three, the evacuation route representation in the simplified evacuation network is simplified. Specifically, each route is represented as a sequence of its source node, intermediate nodes, and exit node. Then, intermediate nodes that are unlikely to cause congestion are excluded. This process ultimately yields a simplified evacuation route consisting of a source node, intermediate node 1, intermediate node 2, ..., intermediate node n, and an exit node.
7. The method according to claim 1, characterized in that, The topological evacuation network diagram corresponding to the macroscopic evacuation network model is a floor plan-based representation that integrates source nodes, intermediate nodes, and exit nodes with simplified evacuation routes and overlays them onto the original building layout. In the single-floor evacuation network diagram, nodes are depicted as numbered circles, with each number corresponding to a specific node. The numbering order follows two key principles: (1) first number the source nodes, then the intermediate nodes, and finally the exit nodes; (2) change from the bottom floor upwards according to the building floor order. Different types of nodes are represented by different colors, and simplified evacuation routes are represented by line segments connecting nodes, with arrows indicating the direction of movement.
8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1-7.
9. A computer-readable storage medium for storing computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the steps of the method according to any one of claims 1-7.