A knowledge graph-based method and system for generating indoor spatial layouts
By constructing an indoor space layout generation method based on knowledge graphs, functional requirements are analyzed into space type labels and relational constraints. Geometric parameters that satisfy spatial relational constraints are generated using graph neural networks, which solves the problem of unreasonable layout generation in existing technologies and realizes functionally adapted indoor space layouts.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- RUIDU DESIGN GRP CO LTD
- Filing Date
- 2026-06-16
- Publication Date
- 2026-07-31
AI Technical Summary
Existing indoor space layout generation technologies cannot transform functional requirements into structured labels and relational constraints, making it difficult to use graph neural networks to generate geometric parameters that fit functional requirements. This results in functional mismatches and unreasonable spatial relationships in the generated layout structures.
By acquiring boundary contour data and functional requirement text of the indoor space, parsing them into space type labels and relational constraints, constructing an initial knowledge graph, extracting adjacency feature vectors and weight feature vectors, inputting them into a graph neural network for message passing and node state updates, and generating a combination of geometric parameters that satisfy the spatial relational constraints.
It realizes the transformation of natural language functional requirements into structured graph representations. The generated geometric parameters conform to the spatial functional association logic, reducing parameter disorder and ensuring that the layout generation process follows the established functional constraint logic to form an adapted indoor spatial layout.
Smart Images

Figure CN122490673A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of spatial layout planning technology, and in particular to a method and system for generating indoor spatial layouts based on knowledge graphs. Background Technology
[0002] Interior space layout generation is a crucial aspect of architectural interior design. Current layout generation methods largely rely on fixed templates or standardized arrangement logic, simply dividing spaces based on basic dimensions and functional requirements, lacking structured analysis and processing of the semantic meaning of these functional needs. Conventional techniques cannot transform textual functional requirements into standardized labels and relational constraints, nor can they build a structured knowledge representation system based on these labels and constraints. The logical connections between spatial functions are difficult to represent in a quantifiable, graphical form.
[0003] Existing layout generation methods mostly employ traditional algorithms to directly solve for spatial geometric parameters. They lack the processing logic to extract node adjacency feature vectors and edge weight feature vectors from structured knowledge graphs, making it difficult to utilize graph neural networks to complete feature message passing and node state iterative updates. The generation process of geometric parameters is detached from the inherent spatial relationships, lacks semantic constraints, and the generated geometric parameters fail to align with the spatial relationship logic implicit in functional requirements.
[0004] Traditional layout generation methods lack a process for searching for constraints within the range of geometric parameters. It is difficult to match and verify multi-dimensional spatial relationship constraints one by one. The selected geometric parameter combinations are prone to violating the spatial association rules set by functional requirements. The layout structure formed after filling to the spatial boundary outline is prone to functional matching deviations and unreasonable spatial relationships. Summary of the Invention
[0005] The purpose of this invention is to address the shortcomings of existing technologies by proposing a knowledge graph-based method and system for generating indoor spatial layouts.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: a method for generating indoor spatial layout based on knowledge graphs, comprising:
[0007] Obtain the boundary contour data and functional requirements text of the target indoor space;
[0008] The functional requirement text is parsed into spatial type labels and spatial relationship constraints;
[0009] An initial spatial knowledge graph is constructed using the spatial type labels as nodes and the spatial relationship constraints as edges.
[0010] Extract the adjacency feature vector of each node and the weight feature vector of each edge from the initial spatial knowledge graph;
[0011] The adjacency feature vector and the weight feature vector are input into the graph neural network for message passing and node state updating;
[0012] The updated node state vector is mapped to the geometric parameter candidate set for each spatial cell;
[0013] A constraint satisfaction search is performed on the candidate set of geometric parameters to filter out combinations of geometric parameters that satisfy all spatial relation constraints;
[0014] The geometric parameters are combined and filled into the boundary contour data to generate a preliminary spatial layout scheme.
[0015] As a further aspect of the present invention, the steps of obtaining the boundary contour data and functional requirement text of the target indoor space specifically include:
[0016] Receive 2D floor plan files of indoor spaces uploaded by users;
[0017] Perform image binarization processing on the two-dimensional planar drawing file to separate the wall area and the opening area;
[0018] A contour tracking algorithm is performed on the binarized image to extract the inner boundary line of the outer wall as the boundary contour data.
[0019] Simultaneously, it receives text descriptions input by the user as the functional requirement text;
[0020] The functional requirements text contains at least one spatial type keyword and at least one spatial relative position descriptor.
[0021] As a further aspect of the present invention, the step of parsing the functional requirement text into spatial type labels and spatial relationship constraints specifically includes:
[0022] Perform Chinese word segmentation on the functional requirement text to obtain a word sequence;
[0023] Each word in the word sequence is matched with a predefined spatial type dictionary to identify spatial type labels;
[0024] The words in the word sequence that are not matched as spatial type labels are matched with a predefined spatial relation dictionary to identify spatial relation words;
[0025] Extract the relation type and relation parameters from the spatial relation terms;
[0026] The relationship type includes at least one of the following: adjacency relationship, containment relationship, alignment relationship, and distance constraint relationship;
[0027] Establish a corresponding association between the identified spatial type labels and the extracted spatial relationship constraints.
[0028] As a further aspect of the present invention, the step of constructing an initial spatial knowledge graph using the spatial type labels as nodes and the spatial relationship constraints as edges specifically includes:
[0029] Create a graph data structure;
[0030] Create a node object in the graph data structure for each identified spatial type label;
[0031] Create an edge object in the graph data structure for each spatial relation constraint;
[0032] Each edge object connects two node objects;
[0033] Each edge object's properties record the relation type name and relation parameter value corresponding to that edge;
[0034] The graph data structure containing all node objects and all edge objects is used as the initial spatial knowledge graph.
[0035] As a further aspect of the present invention, the step of extracting the adjacency feature vector of each node and the weight feature vector of each edge from the initial spatial knowledge graph specifically includes:
[0036] Traverse each node object in the initial spatial knowledge graph;
[0037] For the currently traversed node object, collect the type labels of all adjacent node objects directly connected to that node object as an adjacency type set;
[0038] The set of adjacency types is encoded into a fixed-length binary vector as the adjacency feature vector of the node object;
[0039] Traverse each edge object in the initial spatial knowledge graph;
[0040] For the edge object currently being traversed, the relation type name of the edge object is encoded as an independent vector;
[0041] The unique vector is concatenated with the preset initial weight value to form the weight feature vector of the edge object.
[0042] As a further aspect of the present invention, the step of inputting the adjacency feature vector and the weight feature vector into a graph neural network for message passing and node state updating specifically includes:
[0043] Initialize a hidden state vector for each node object in the initial spatial knowledge graph;
[0044] For each node object, collect the hidden state vectors of all its neighboring node objects;
[0045] For each node object, collect the weight feature vectors of the edge objects between that node object and each of its neighboring node objects;
[0046] The weighted message vector is obtained by multiplying the hidden state vector of the adjacent node objects on each edge element by the weight feature vector of that edge.
[0047] The aggregated message vector of a node object is obtained by summing all the weighted message vectors collected from the same node object.
[0048] The hidden state vector of the current node object is concatenated with the aggregated message vector and then input into the multilayer perceptron;
[0049] The output vector of the multilayer perceptron is used as the updated hidden state vector of the node object.
[0050] Repeat the node update process until the change in the hidden state vector of all node objects is lower than a preset threshold.
[0051] As a further aspect of the present invention, the step of mapping the updated node state vector to a candidate set of geometric parameters for each spatial cell specifically includes:
[0052] The updated hidden state vector of each node object is input into the first fully connected network to obtain the minimum and maximum values of the spatial length range corresponding to that node object;
[0053] The updated hidden state vector of the same node object is input into the second fully connected network to obtain the minimum and maximum values of the spatial width range corresponding to the node object;
[0054] The updated hidden state vector of the same node object is input into the third fully connected network to obtain the position coordinate range of the node object;
[0055] The spatial length range, spatial width range, and position coordinate range corresponding to the same node object are combined into a triple and used as a parameter candidate entry for that node object.
[0056] Generate multiple different parameter candidate entries for each node object;
[0057] The set of parameter candidate entries for all node objects is used as the geometric parameter candidate set for each spatial element.
[0058] As a further aspect of the present invention, the step of performing a constraint satisfaction search in the candidate set of geometric parameters to filter out combinations of geometric parameters that satisfy all spatial relationship constraints specifically includes:
[0059] Select one candidate item from the parameter candidate items of each node object to form a candidate combination;
[0060] For each spatial cell in the current candidate combination, calculate the linear equations of the four boundary lines of the spatial cell based on the length, width, and position coordinates of the spatial cell;
[0061] For each pair of spatial cells with adjacency constraints in the current candidate combination, calculate the minimum distance between the boundary line of the first spatial cell and the boundary line of the second spatial cell.
[0062] Determine whether the minimum spacing is less than a preset adjacent tolerance threshold;
[0063] For each pair of spatial cells with alignment constraints in the current candidate combination, calculate the parallel offset distance between the reference boundary line of the first spatial cell and the reference boundary line of the second spatial cell.
[0064] Determine whether the parallel offset distance is less than a preset alignment tolerance threshold;
[0065] For each pair of spatial cells with distance constraints in the current candidate combination, calculate the Euclidean distance between the geometric center point of the first spatial cell and the geometric center point of the second spatial cell.
[0066] Determine whether the absolute value of the difference between the Euclidean distance value and the preset target distance value is less than a preset distance tolerance threshold;
[0067] When the current candidate combination satisfies all spatial relation constraints, the candidate combination is marked as a valid geometric parameter combination.
[0068] Iterate through all candidate combinations and collect all valid geometric parameter combinations.
[0069] As a further aspect of the present invention, the step of filling the geometric parameter combination into the boundary contour data to generate a preliminary spatial layout scheme specifically includes:
[0070] Read the position coordinates, length, and width of each spatial unit from the effective combination of geometric parameters;
[0071] The coordinates of the lower left anchor point of each spatial unit within the boundary contour data are determined based on the position coordinates of each spatial unit.
[0072] The coordinates of the upper right corner of the spatial unit are calculated from the coordinates of the lower left anchor point based on the length and width of the spatial unit.
[0073] The rectangular area between the coordinates of the lower left corner anchor point and the coordinates of the upper right corner is marked as the occupied area of the spatial unit;
[0074] Detect whether there is any overlap between the occupied areas of all spatial units;
[0075] When overlap exists, select the other valid geometric parameter combination that is farthest from the overlapping area and re-execute the occupied area marking operation;
[0076] When there is no overlap between the occupied areas of all spatial units, the set of all occupied areas is taken as the preliminary spatial layout scheme.
[0077] As a further aspect of the present invention, the present invention also includes an indoor space layout generation system based on a knowledge graph. The system includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the steps of the indoor space layout generation method based on a knowledge graph as described above.
[0078] Compared with the prior art, the advantages and positive effects of the present invention are as follows:
[0079] By setting spatial type labels obtained from parsing functional requirement text as knowledge graph nodes and spatial relationship constraints as knowledge graph edges to construct an initial spatial knowledge graph, and then extracting node adjacency feature vectors and edge weight feature vectors from the graph, the functional requirements in natural language form can be transformed into a structured graph representation. The functional attributes of the space itself and the interrelationship constraints can be converted into standardized vector forms for quantitative expression, mitigating the semantic biases generated during machine parsing of unstructured text. This allows various association rules of indoor space to form a unified digital representation, providing a standardized feature input form for subsequent model calculations.
[0080] The extracted adjacency feature vectors and weight feature vectors are input into a graph neural network, which executes a message passing process and updates the node states. Based on the updated node state vectors, a set of candidate geometric parameters for each spatial unit is generated. This allows for the mining of the intrinsic relationships between spatial units based on graph topological associations. The generation process of geometric parameters closely follows the spatial constraints analyzed in the previous steps, and the generation process of the parameter candidate sets follows the intrinsic logic of spatial functional arrangement, reducing the disorder of parameters caused by random generation methods.
[0081] Within the candidate set of geometric parameters, a constraint satisfaction search process is executed. All spatial relationship constraints are matched and filtered one by one to select geometric parameter combinations that meet the constraint conditions. The internal filling arrangement is then completed according to the spatial boundary contour. The geometric parameter combinations can conform to the preset spatial association rules, and the layout generation process follows the established functional constraint logic, so that the final interior space layout fits the spatial arrangement logic corresponding to the original functional requirements and is adapted to the operation logic of automated interior space layout generation. Attached Figure Description
[0082] Figure 1 This is a state diagram of an indoor space layout generation method based on knowledge graphs as described in this invention.
[0083] Figure 2 A flowchart for obtaining the boundary outline and functional requirements of the interior space;
[0084] Figure 3 A flowchart illustrating the message passing and node state update process in a neural network. Detailed Implementation
[0085] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0086] See Figure 1 This invention provides a knowledge graph-based method for generating indoor spatial layouts, the specific method including:
[0087] The process involves: acquiring boundary contour data and functional requirement text for the target indoor space; parsing the functional requirement text into space type labels and spatial relationship constraints; constructing an initial spatial knowledge graph using space type labels as nodes and spatial relationship constraints as edges; extracting the adjacency feature vector of each node and the weight feature vector of each edge from the initial spatial knowledge graph; inputting the adjacency feature vector and weight feature vector into a graph neural network for message passing and node state updates; mapping the updated node state vectors to a set of geometric parameter candidates for each spatial unit; performing a constraint satisfaction search in the geometric parameter candidate set to select geometric parameter combinations that satisfy all spatial relationship constraints; and filling the boundary contour data with the geometric parameter combinations to generate a preliminary spatial layout scheme.
[0088] In one embodiment of the present invention, see [reference] Figure 2The system receives a two-dimensional floor plan file of the interior space uploaded by the user, performs image binarization processing on the two-dimensional floor plan file to separate the wall area and the opening area; performs a contour tracking algorithm on the binarized image to extract the inner boundary line of the outer wall as the boundary contour data; and simultaneously receives a text description input by the user as the functional requirement text, which contains at least one space type keyword and at least one spatial relative position descriptor.
[0089] In practice, users submit a two-dimensional floor plan of a residential apartment through an interactive interface. This floor plan is a raster image of the building's floor plan. After receiving the floor plan, the computer converts it into a grayscale image and performs image binarization. The specific steps of image binarization are as follows: The histogram distribution of the grayscale image is statistically analyzed, and the grayscale value corresponding to the lowest point of the histogram is used as a segmentation threshold. Pixels with grayscale values below the threshold are set to black, representing wall areas, while pixels with grayscale values above the threshold are set to white, representing opening areas and non-wall areas. This separates wall areas from opening areas, resulting in the binarized image. A contour tracking algorithm is performed on the binarized image. The algorithm scans from the top left corner of the image, finding the first white pixel as the starting boundary point, and searches for adjacent white pixels in a clockwise direction, gradually tracking the closed boundary contour. Among the tracked contours, the outermost contour with the most pixels is extracted by calculating the enclosing area of each contour. The pixel sequence of the outermost contour is connected according to the image coordinate system to form the inner boundary line of the outer wall. The coordinate set of the inner boundary line is recorded as boundary contour data. Simultaneously, user-input text descriptions are received as functional requirement text. The functional requirement text is a natural language sentence containing at least one spatial type keyword and at least one spatial relative position descriptor. For example, the received functional requirement text is "The living room needs to be close to the balcony, the master bedroom includes an ensuite bathroom, and the kitchen is adjacent to the dining room." In the functional requirement text, "living room," "balcony," "master bedroom," "ensuite bathroom," "kitchen," and "dining room" are spatial type keywords, and "close to," "includes," and "adjacent" are spatial relative position descriptors. The spatial type keywords correspond to the room types that need to be divided in the interior space, and the spatial relative position descriptors define the relative layout relationships between the rooms.
[0090] In practical implementation, before performing image binarization on the 2D floor plan file, Gaussian filtering is applied to the interior space 2D floor plan file to remove noise introduced by scanning or photographing the drawings, improving the segmentation accuracy of wall areas and opening areas. Image binarization employs an adaptive thresholding method, dividing the interior space 2D floor plan file into multiple local windows. Within each local window, a local average grayscale value is calculated, and this local average grayscale value is used as the binarization criterion for the corresponding window, ensuring that walls in areas with uneven lighting can be correctly separated from opening areas. When extracting the inner boundary line of the outer wall, the contour tracking algorithm first performs morphological dilation on the binarized image to connect minor breaks in the wall lines caused by image quality issues. Then, morphological erosion is used to restore the original wall thickness, ensuring the continuity and integrity of contour tracking. After extracting the inner boundary line of the outer wall, polygon fitting is performed on the boundary contour data. Using a preset fitting accuracy, the inner boundary line of the outer wall is simplified into a sequence of closed polygon vertices composed of finite straight line segments, reducing data storage while preserving the shape characteristics of the inner boundary line of the outer wall.
[0091] In some embodiments, while receiving the user-uploaded two-dimensional floor plan of the interior space, the system also receives the user's editing operations on the functional requirement text. The user selects space type keywords from a pre-defined list of space types and spatial relative position descriptors from a list of relationship types, and constructs a combination relationship between the space type keywords and spatial relative position descriptors by dragging and dropping lines. The system automatically concatenates the combination relationship into the functional requirement text. The functional requirement text can also be text data obtained through speech recognition. The user reads a paragraph of space layout requirements, and the system transcribes it into text content through acoustic and language models, and then extracts space type keywords and spatial relative position descriptors.
[0092] In some embodiments, when performing image binarization processing on a two-dimensional floor plan file, if the interior space two-dimensional floor plan file is a vector format file, the vector format file is first rasterized into a bitmap image of a preset resolution, and then image binarization processing and contour tracking operations are performed on the bitmap image. The boundary contour data includes not only the inner boundary lines of the exterior walls, but also the boundary contours of the interior load-bearing structures or manholes. The boundary contours of the load-bearing structures and manholes are retained as immovable areas in the subsequent spatial layout generation, and the geometric parameters of the spatial units are filled around the immovable areas.
[0093] It is understandable that the spatial outline expressed in the two-dimensional floor plan file of the interior space is a single-story residential floor plan. The inner boundary line of the exterior wall represents the maximum range of usable space. The area inside the outline does not include the area occupied by the thickness of the exterior wall, so the boundary outline data directly defines the effective area for the arrangement of spatial units. In the functional requirements text, a single spatial relative position description may simultaneously modify multiple spatial type keywords. For example, in the statement "the living room is adjacent to the master bedroom and the secondary bedroom," the "adjacent" relationship simultaneously relates to the three spatial type keywords "living room," "master bedroom," and "secondary bedroom."
[0094] It is understandable that when the contour tracking algorithm extracts the inner boundary line of the exterior wall, the origin of the coordinates of the inner boundary line is consistent with the origin of the image coordinates of the two-dimensional floor plan file of the interior space, both being the upper left corner of the image, with the x-axis pointing to the right and the y-axis pointing downwards. If it is necessary to convert the boundary contour data to actual physical dimensions, the coordinates can be scaled according to the drawing scale attached to the two-dimensional floor plan file of the interior space. The scaled boundary contour data is in millimeters, which is beneficial for the accurate calculation of subsequent geometric parameters. The functional requirements text allows the use of directional descriptive terms, such as "east" and "south." After the directional descriptive terms are recognized, they are combined with the north direction of the architectural drawing to convert them into directional constraints within the spatial coordinate system.
[0095] In one embodiment of the present invention, Chinese word segmentation is performed on the functional requirement text to obtain a word sequence; each word in the word sequence is matched with a predefined spatial type dictionary to identify spatial type labels; words not matched as spatial type labels are matched with a predefined spatial relation dictionary to identify spatial relation words; relation types and relation parameters are extracted from the identified spatial relation words, where relation types include at least one of adjacent relations, containment relations, alignment relations, and distance constraint relations; and a corresponding association is established between the identified spatial type labels and the extracted spatial relation constraints. A graph data structure is created, and a node object is created in the graph data structure for each identified spatial type label; an edge object is created in the graph data structure for each spatial relation constraint, and each edge object connects two node objects. The relation type name and relation parameter value corresponding to the edge are recorded in the attributes of the edge object; the graph data structure containing all node objects and all edge objects is used as the initial spatial knowledge graph.
[0096] In the specific implementation, the functional requirement text is "The living room needs to be close to the balcony, the master bedroom needs to include an ensuite bathroom, and the kitchen and dining room need to be adjacent." Chinese word segmentation is performed on the functional requirement text using a dictionary-based maximum matching algorithm to divide the text into word sequences. Each word in the sequence is compared one by one with a predefined spatial type dictionary. This dictionary includes common room names found in residential homes, such as "living room," "dining room," "master bedroom," "secondary bedroom," "study," "kitchen," "bathroom," "balcony," "storage room," "entrance hall," "corridor," and "cloakroom." Successfully matched words in the sequence are marked as identified spatial type tags, resulting in the set of spatial type tags {living room, balcony, master bedroom, ensuite bathroom, kitchen, dining room}. Subsequently, the remaining words in the sequence that are not matched as spatial type tags are matched with a predefined spatial relationship dictionary. This dictionary includes spatial layout relation words such as "close to," "adjacent," "containing," "aligned," "connected," "away from," "parallel," and "facing." The identified spatial relationship words after matching are "close to," "containing," and "adjacent." The relationship types and parameters are extracted from the identified spatial relation terms. For the relation term "proximity," the relationship type is a distance constraint, and the relation parameter is the minimum distance value within the adjacent tolerance threshold. For the relation term "containment," the relationship type is an inclusion relationship, and the relation parameter is that the included spatial unit must be located inside the containing spatial unit. For the relation term "adjacent," the relationship type is an adjacency relationship, and the relation parameter is that the distance between the boundaries of the two spatial units approaches zero. Each identified spatial type label is associated with the extracted spatial relation constraints, resulting in the following associations: living room is near balcony, master bedroom includes ensuite bathroom, kitchen and dining room are adjacent.
[0097] In the specific implementation, a graph data structure is created, stored in the form of an adjacency list. The graph data structure contains a node set and an edge set; the node set stores node objects, and the edge set stores edge objects. For each identified spatial type label, a node object is created in the graph data structure. Six spatial type labels correspond to six node objects, each assigned a unique node identifier. The attribute field of the node object records the name string of the spatial type label. For each spatial relationship constraint, an edge object is created in the graph data structure. Three spatial relationship constraints correspond to three edge objects, each connecting two node objects. For example, the edge object for "Living room near balcony" connects the living room node object and the balcony node object; the edge object for "Master bedroom includes ensuite bathroom" connects the master bedroom node object and the ensuite bathroom node object; and the edge object for "Kitchen adjacent to dining room" connects the kitchen node object and the dining room node object. The attributes of each edge object record the corresponding relationship type name and relationship parameter value. The relationship type name field contains a string description of the relationship type, and the relationship parameter value field contains the numerical value representing constraints such as distance or depth. The graph data structure containing all six node objects and three edge objects is used as the initial spatial knowledge graph. The initial spatial knowledge graph expresses the complete set of spatial types in the functional requirement text, as well as the topological and constraint relationships between spatial types.
[0098] In practical implementation, during Chinese word segmentation, a stop word removal operation is performed on the word sequence to remove functional words such as "need," "of," and "with," retaining content words that carry spatial type and spatial relation semantics to improve the accuracy and efficiency of subsequent dictionary matching. The matching of spatial relation words in the spatial relation dictionary adopts a forward maximum matching strategy. Starting from the beginning of the word sequence, a string equal in length to the longest term in the spatial relation dictionary is truncated for matching. If the match fails, the truncated length is shortened and matching continues until a match is successful or the string length is zero. When extracting relation parameters from spatial relation words, fuzzy quantifiers are converted to precise numerical values. When a modifier describing degree appears between two spatial type labels connected by a relation word in the word sequence, the modifier is quantified as an adjustment coefficient for the relation parameter.
[0099] In some embodiments, edge space type labels such as "balcony" are marked as boundary attachment types in a predefined space type dictionary. When creating a node object, the node object's attribute fields additionally record the boundary attachment identifier, indicating that one side boundary of the balcony space unit needs to coincide with the inner boundary line of the outer wall of the boundary contour data. When an inclusion relationship such as "master bedroom includes an ensuite bathroom" is converted into an edge object, the relationship type name of the edge object is recorded as an inclusion relationship, and the relationship parameter value of the edge object is recorded as a two-dimensional coordinate offset range, used to limit the location area of the ensuite bathroom inside the master bedroom.
[0100] In some embodiments, when multiple spatial relation constraints within the functional requirement text point to the same pair of spatial type labels, these multiple spatial relation constraints are merged into an edge object. The edge object's attributes record multiple relation type names and corresponding relation parameter values, forming a combined constraint. When constructing the initial spatial knowledge graph, the graph data structure also supports representing nested spatial relations in the form of an abstract syntax tree, parsing nested text descriptions into a hierarchical spatial region containment structure, which is reflected in the hierarchical attributes of node objects and edge objects.
[0101] It is understandable that the predefined spatial type dictionary and predefined spatial relationship dictionary support updates and expansions. Users can add corresponding spatial type entries and spatial relationship entries based on different building types, such as office buildings, schools, and hospitals, making the Chinese word segmentation and dictionary matching modules adaptable to various indoor spatial layout scenarios. During spatial relationship extraction, the initial default values of relationship parameters are determined by standards such as passageway width and furniture size thresholds in building codes. These relationship parameters provide a basic reference for subsequent node state updates and geometric parameter generation. It is also understandable that node identifiers for node objects follow the indexing rules within the graph data structure. Node identifiers are assigned sequentially starting from zero, and the mapping relationship between node identifiers and spatial type labels is recorded in a separate mapping table. This allows for quick retrieval of the corresponding node object and its vector representation through the node identifier during the message passing phase of the graph neural network. The connection relationships of edge objects are represented by pairs of node identifiers. The storage structure of edge objects contains an unordered combination of start and end node identifiers, indicating that the graph data structure is an undirected graph, and spatial relationship constraints are bidirectional.
[0102] In one embodiment of the present invention, see [reference] Figure 3It iterates through each node object in the initial spatial knowledge graph. For the currently traversed node object, it collects the type labels of all directly connected neighboring node objects as an adjacency type set, and encodes the adjacency type set into a fixed-length binary vector as the adjacency feature vector of the node object. It also iterates through each edge object in the initial spatial knowledge graph. For the currently traversed edge object, it encodes the relation type name of the edge object into a one-hot vector, and concatenates the one-hot vector with the preset initial weight value to form the weight feature vector of the edge object. A hidden state vector is initialized for each node object in the initial spatial knowledge graph. For each node object, the hidden state vectors of all its neighboring node objects and the weight feature vectors of the edge objects between the node object and each neighboring node object are collected. The hidden state vector of each neighboring node object on each edge is multiplied element-wise by the weight feature vector of that edge to obtain a weighted message vector. All weighted message vectors collected for the same node object are summed to obtain the aggregated message vector of the node object. The hidden state vector of the current node object and the aggregated message vector are concatenated and input into a multilayer perceptron. The output vector of the multilayer perceptron is used as the updated hidden state vector of the node object. The node update process is repeated until the change in the hidden state vector of all node objects is lower than a preset threshold.
[0103] In the specific implementation, the initial spatial knowledge graph contains six node objects and three edge objects. The six node objects correspond to the spatial type labels living room, balcony, master bedroom, ensuite bathroom, kitchen, and dining room, respectively. The three edge objects correspond to the distance constraint relationship between the living room and balcony, the containment relationship between the master bedroom and ensuite bathroom, and the adjacency relationship between the kitchen and dining room, respectively. Each node object in the initial spatial knowledge graph is traversed. For the currently traversed living room node object, the type labels of all adjacent node objects directly connected to the living room node object are collected. For balcony node objects, the adjacency type set only contains the balcony type label. The adjacency type set is encoded into a fixed-length binary vector as the adjacency feature vector of the living room node object. The encoding method is as follows: the length of the fixed-length binary vector is equal to the total number of spatial type labels in the predefined spatial type dictionary. Each bit of the binary vector corresponds to a spatial type label; if the corresponding spatial type label exists in the adjacency type set, the bit is set to 1; otherwise, it is set to 0. Following the same method, sequentially traverse the balcony node object, master bedroom node object, enclosed bathroom node object, kitchen node object, and dining room node object, collecting the adjacency type set of each node object and encoding it to generate the corresponding adjacency feature vector. For each edge object in the initial spatial knowledge graph, for the currently traversed edge object between the living room and balcony, encode the relation type name of the edge object as a one-hot vector. The relation type is a distance constraint relation. The dimension of the one-hot vector equals the total number of relation types in the predefined spatial relation dictionary. The bit corresponding to the distance constraint relation in the one-hot vector is set to 1, and the other bits are set to 0. Concatenate the one-hot vector with the preset initial weight value to form the weight feature vector of the edge object. The initial weight value is a scalar with a value between 0 and 1, obtained by normalizing the relation parameter values. Repeat the same method to traverse the edge objects between the master bedroom and enclosed bathroom, and between the kitchen and dining room, encoding the relation type and generating the corresponding weight feature vector.
[0104] In the specific implementation, a hidden state vector is initialized for each node object in the initial spatial knowledge graph. The living room node object, balcony node object, master bedroom node object, separate bathroom node object, kitchen node object, and dining room node object are each assigned a hidden state vector of dimension d. The components of the hidden state vector are filled with random numbers following a uniform distribution. When inputting the adjacency feature vector and weight feature vector into the graph neural network for message passing and node state updates: For the living room node object, the hidden state vectors of its adjacent node objects (i.e., the balcony node object) are collected, along with the weight feature vectors of the edge objects between the living room and balcony node objects. The hidden state vector of the balcony node object is then multiplied element-wise with the weight feature vector of the living room-balcony edge object. In this element-wise multiplication operation, each dimension of the weight feature vector is multiplied with the corresponding dimension of the hidden state vector to obtain a weighted message vector. Since the living room node object has only one adjacent edge, the aggregated message vector is equal to the single weighted message vector mentioned above. The hidden state vector of the living room node object is concatenated with the aggregated message vector. This concatenation operation links the d-dimensional hidden state vector with the d-dimensional weighted message vector end-to-end, forming a 2d-dimensional concatenated vector. This concatenated vector is then input into a multilayer perceptron, which consists of an input layer, two hidden layers, and an output layer. The input layer has 2d neurons, the first hidden layer has d neurons, the second hidden layer has d neurons, and the output layer has d neurons. All layers are fully connected and use the ReLU activation function. The output vector of the multilayer perceptron serves as the updated hidden state vector for the living room node object. Similarly, for the balcony node object, the hidden state vectors of its neighboring living room node objects are collected and element-wise multiplied with the weighted feature vectors of the living room-balcony edge objects to obtain a weighted message vector. This weighted message vector is then summed to obtain the aggregated message vector, which is concatenated with the current hidden state vector of the balcony node object before being input into the multilayer perceptron to obtain the updated hidden state vector. For the master bedroom node object, whose adjacent node is the independent bathroom node object, the hidden state vector of the independent bathroom node object and the weighted feature vector of the master bedroom-independent bathroom edge object are collected and subjected to the same message weighting, aggregation, concatenation, and multilayer perceptron mapping operations to obtain the updated hidden state vector of the master bedroom node object. For the independent bathroom node object, whose adjacent node is the master bedroom node object, the same update method is used. For the kitchen node object, whose adjacent node is the dining room node object, the hidden state vector of the dining room node object and the weighted feature vector of the kitchen-dining room edge object are collected, and then message passing and state updates are performed. For the dining room node object, whose adjacent node is the kitchen node object, the state update is completed in a symmetrical manner.
[0105] In practice, after updating the hidden state vectors of all six node objects in one round, the Euclidean distance between the hidden state vectors of each node object before and after the update is calculated as the change. The maximum value of the changes among all node objects is compared with a preset threshold of 0.001. If the maximum value is not less than the preset threshold, the node update process is repeated: the updated hidden state vectors of the neighboring node objects and the weight feature vectors of the edge objects are collected again, and the weighted message vector calculation, aggregated message vector summation, vector concatenation, and multilayer perceptron forward propagation are performed again to obtain the hidden state vectors after the new round of updates. The node update process is repeated until the changes in the hidden state vectors of all node objects are lower than the preset threshold of 0.001 after a certain iteration. At this point, the message passing and node state update process of the graph neural network terminates, and the final hidden state vectors of the six node objects contain global topological information and constraint satisfaction features between spatial units. Finally, the hidden state vector of the living room node object encodes its structural information that is adjacent to the balcony and subject to distance constraints. The hidden state vector of the master bedroom node object encodes its hierarchical information that includes an independent bathroom. The hidden state vector of the kitchen node object encodes its close proximity relationship with the dining room. Each hidden state vector serves as the semantic basis for the subsequent generation of geometric parameters.
[0106] In practice, the aggregated message vector is calculated using the following formula:
[0107]
[0108] in: This represents the aggregated message vector of the i-th node object. Let j represent the set of indices of all adjacent node objects that are directly adjacent to the i-th node object, where j represents the index of the adjacent node object. This represents the weight feature vector of the edge object between the i-th node object and the j-th node object, and ⊙ represents the element-wise multiplication operation. Let represent the hidden state vector of the j-th neighboring node object, and ∑ represent the element-wise summation operation on the weighted message vectors of all neighbors.
[0109] In some embodiments, the initialization process of the hidden state vector of a node object employs a strategy to avoid zero vectors and symmetry traps. A small deviation is introduced into the hidden state vector of each node object during initialization, ensuring that even if adjacent nodes are topologically symmetrical, their initial hidden state vectors will have numerical differences, thus promoting asymmetric information flow during the message passing process of the graph neural network. The calculation of the preset initial weight values in the weight feature vector considers the magnitude difference in spatial relationship constraints. When the relationship parameter value represents physical distance, the initial weight value is inversely proportional to the relationship parameter value; when the relationship parameter value represents containment depth, the initial weight value is directly proportional to the relationship parameter value. In some embodiments, the graph neural network structure during message passing is extended to include an attention mechanism. When collecting the hidden state vectors of neighboring node objects, an attention coefficient is calculated for each neighboring node object relative to the current node object. The attention coefficient is determined by the similarity between the hidden state vectors of the current node object and those of neighboring node objects. The weighted message vector is obtained by weighting the neighboring node hidden state vectors, the weight feature vector, and the attention coefficient, enhancing the graph neural network's ability to perceive important spatial relationship constraints.
[0110] In one embodiment of the present invention, the updated hidden state vector of each node object is input into a first fully connected network to obtain the minimum and maximum values of the spatial length range corresponding to the node object; the same hidden state vector is input into a second fully connected network to obtain the minimum and maximum values of the spatial width range; the same hidden state vector is input into a third fully connected network to obtain the position coordinate range; the spatial length range, spatial width range, and position coordinate range corresponding to the same node object are combined into a triplet as a parameter candidate entry for the node object; multiple different parameter candidate entries are generated for each node object, and the set of parameter candidate entries for all node objects is used as the geometric parameter candidate set for each spatial unit. When performing constraint satisfaction search in the geometric parameter candidate set: For each node object, select one candidate entry from the parameter candidate entries to form a candidate combination; for each spatial cell in the current candidate combination, calculate the linear equations of the four boundary lines of the spatial cell based on its length, width, and position coordinates; for each pair of spatial cells with adjacency constraints, calculate the minimum distance between the boundary lines of the first and second spatial cells, and determine if the minimum distance is less than a preset adjacency tolerance threshold; for each pair of spatial cells with alignment constraints, calculate the parallel offset distance between the reference boundary lines of the first and second spatial cells, and determine if it is less than a preset alignment tolerance threshold; for each pair of spatial cells with distance constraints, calculate the Euclidean distance between the geometric center points of the first and second spatial cells, and determine if the absolute value of the difference between the Euclidean distance and the preset target distance is less than a preset distance tolerance threshold; when the current candidate combination satisfies all spatial relationship constraints, mark the candidate combination as a valid geometric parameter combination; traverse all candidate combinations and collect all valid geometric parameter combinations.
[0111] In the specific implementation, the hidden state vector dimension d is set to 128, and the six node objects are the living room node object, balcony node object, master bedroom node object, separate bathroom node object, kitchen node object, and dining room node object. The updated hidden state vector of each node object is input into the first fully connected network. The structure of the first fully connected network is 128 neurons in the input layer, 64 neurons in the hidden layer, and 2 neurons in the output layer. The two neurons in the output layer output the minimum and maximum values of the spatial length range, respectively. After the hidden state vector of the living room node object is forward-computed by the first fully connected network, it outputs the minimum length of the living room space unit as 4500 mm and the maximum length as 6000 mm. The updated hidden state vector of the same node object is input into the second fully connected network. The structure of the second fully connected network is the same as that of the first fully connected network, but the network weight parameters are independent. It outputs the minimum and maximum values of the spatial width range. After the hidden state vector of the living room node object is processed by the second fully connected network, it outputs the minimum width of the living room space unit as 3600 mm and the maximum width as 5000 mm. The updated hidden state vector of the same node object is input into a third fully connected network. This network has an input layer of 128 neurons, a hidden layer of 64 neurons, and an output layer of 2 neurons. The two output neurons output the x-coordinate and y-coordinate reference values for the location coordinate range, respectively. The hidden state vector of the living room node object, after passing through this network, outputs the x-coordinate reference value of 2100 mm and the y-coordinate reference value of 3800 mm for the living room spatial unit. The spatial length range, spatial width range, and location coordinate range corresponding to the same node object are combined into a triplet. The triplet has the form (minimum length, maximum length, minimum width, maximum width, x-coordinate reference value, y-coordinate reference value). One parameter candidate for the living room node object is (4500, 6000, 3600, 5000, 2100, 3800). Multiple different parameter candidate entries are generated for each node object. The generation method is to inject Gaussian noise with different standard deviations into the hidden state vector and then re-input it into the first fully connected network, the second fully connected network, and the third fully connected network to obtain multiple sets of length range, width range, and position coordinate range. Each set constitutes a parameter candidate entry. The number of parameter candidate entries generated for each node object is set to eight. A total of forty-eight parameter candidate entries are generated for all six node objects. The set of forty-eight parameter candidate entries is used as the geometric parameter candidate set for each spatial unit.
[0112] In practice, a constraint satisfaction search is performed on the candidate set of geometric parameters to filter out combinations of geometric parameters that satisfy all spatial relation constraints. From the eight parameter candidate entries of each node object, one candidate entry is selected to form a candidate combination. For each of the six node objects, one candidate entry is selected to form a six-tuple candidate combination, resulting in a total of eight to the power of six, or 262,144 combinations. The constraint satisfaction search employs a backtracking search strategy to traverse the candidate combination space. For the current candidate combination reached during the backtracking search, the linear equations of the four boundary lines of each spatial unit in the current candidate combination are calculated based on the unit's length, width, and position coordinates. Taking the living room space unit as an example, the length (5000 mm), width (4200 mm), x-coordinate reference value (2100 mm), and y-coordinate reference value (3800 mm) of the living room space unit are selected from the candidate entries. These positional coordinate reference values are used as the geometric center point coordinates of the living room space unit. The equations of the four boundary lines of the living room space unit are calculated as follows: Left boundary line x = 2100 - 2500 = -400, converted to an indoor coordinate system value; Right boundary line x = 2100 + 2500 = 4600; Lower boundary line y = 3800 - 2100 = 1700; Upper boundary line y = 3800 + 2100 = 5900. These four boundary lines form a rectangular bounding box, reflecting the two-dimensional area occupied by the living room space unit within the boundary contour data.
[0113] In practical implementation, for a pair of spatial units with adjacency constraints in the current candidate combination—namely, the kitchen space unit corresponding to the kitchen node object and the restaurant space unit corresponding to the restaurant node object—the minimum distance between the boundary lines of the kitchen space unit and the restaurant space unit is calculated. The kitchen space unit obtains a length value of 3600 mm, a width value of 3000 mm, an x-coordinate reference value of 5800 mm, and a y-coordinate reference value of 2000 mm from the candidate entries, and calculates its four boundary lines. The restaurant space unit obtains a length value of 3900 mm, a width value of 3300 mm, an x-coordinate reference value of 6200 mm, and a y-coordinate reference value of 5200 mm from the candidate entries, and calculates its four boundary lines. The minimum distance between the right boundary line of the kitchen space unit and the left boundary line of the restaurant space unit is calculated, and this minimum distance is compared with a preset adjacency tolerance threshold, which is set to 100 mm. It is then determined whether the minimum distance is less than 100 mm; if the minimum distance is less than 100 mm, the adjacency constraint is considered satisfied. For spatial unit pairs with alignment constraints in the current candidate combination, since the alignment constraints are not parsed from the functional requirements text, the alignment constraint check item is assumed to be satisfied in this example scenario. For a pair of spatial units with distance constraints in the current candidate combination, namely the living room spatial unit corresponding to the living room node object and the balcony spatial unit corresponding to the balcony node object, the Euclidean distance between the geometric center points of the living room spatial unit and the balcony spatial unit is calculated respectively. The geometric center point of the living room spatial unit is (x-coordinate reference value 2100, y-coordinate reference value 3800). The balcony spatial unit obtains a length value of 3600 mm, a width value of 1500 mm, an x-coordinate reference value of 2100 mm, and a y-coordinate reference value of 6500 mm from the candidate entries. The geometric center point of the balcony spatial unit is (2100, 6500). The Euclidean distance calculation formula is as follows:
[0114]
[0115] Where: s represents the Euclidean distance between the two geometric center points. and These represent the x and y coordinates of the geometric center point of the first spatial unit, respectively. and Let x and y represent the x and y coordinates of the geometric center point of the second spatial unit, respectively. Substituting the numerical values, the Euclidean distance is calculated to be 2700 mm. The preset target distance is set to 2500 mm. The absolute value of the difference between the Euclidean distance of 2700 mm and the preset target distance of 2500 mm is calculated to be 200 mm. It is then determined whether 200 mm is less than the preset distance tolerance threshold, which is 300 mm. Since 200 mm is less than 300 mm, the distance constraint is satisfied. For a pair of spatial units in the current candidate combination that have an inclusion constraint—namely, the master bedroom spatial unit corresponding to the master bedroom node object and the independent bathroom spatial unit corresponding to the independent bathroom node object—it is checked whether all four boundary lines of the independent bathroom spatial unit are located inside the four boundary lines of the master bedroom spatial unit. If all boundary lines are inside, the inclusion constraint is considered satisfied. When the current candidate combination simultaneously satisfies the adjacency constraint, distance constraint, inclusion constraint, and automatically satisfied alignment constraint, the current candidate combination is marked as a valid geometric parameter combination. The backtracking search traverses all 262,144 candidate combinations, collecting all effective geometric parameter combinations that satisfy all spatial relationship constraints. The number of effective geometric parameter combinations is approximately several hundred to several thousand. All effective geometric parameter combinations constitute the effective geometric parameter combination set.
[0116] In some embodiments, when generating multiple parameter candidate entries for each node object, the injected noise standard deviation is divided into three levels, corresponding to the compact layout, standard layout, and loose layout preferences of the spatial cells, respectively. Noise with a smaller standard deviation generates candidate entry values concentrated near the reference value, while noise with a larger standard deviation generates candidate entry values dispersed over a wider range. After injecting the three levels of noise, each node object generates a total of twenty-four parameter candidate entries. These candidate entries are assigned different selection priorities in the subsequent constraint satisfaction search, with candidate entries corresponding to the compact layout preference being preferentially selected by the backtracking search algorithm.
[0117] In some embodiments, the constraint satisfaction search process introduces a conflict learning mechanism. When a candidate combination is discarded because the spatial relationship constraint of one pair of spatial units is not satisfied, the conflicting spatial unit pair and the corresponding candidate entry index are recorded to reduce the probability of conflicting candidate entries appearing simultaneously in subsequent backtracking searches. The constraint satisfaction search adopts a heuristic search order, prioritizing the instantiation of candidate entries for node objects that have the most spatial relationship constraint connections with other node objects. The living room node object, which has both distance constraints and potential alignment requirements, is ranked first in the search order, followed by the balcony node object, then the kitchen node object, the dining room node object, the master bedroom node object, and the detached bathroom node object.
[0118] It is understandable that the weight parameters of the first, second, and third fully connected networks are jointly trained with the graph neural network parameters during the graph neural network training phase. The training loss function includes a regression loss term on the geometric parameter range against the actual spatial dimensions, ensuring that the length and width ranges output by the fully connected networks can cover a reasonable spatial size range that conforms to the building's functional use. When outputting the location coordinate range, the training constraints of the third fully connected network include a penalty term for the location coordinates not exceeding the boundary contour data range. It is understandable that when performing constraint satisfaction search in the geometric parameter candidate set, the preset values of the adjacent tolerance threshold, alignment tolerance threshold, and distance tolerance threshold affect the number of effective geometric parameter combinations and the flexibility of the layout scheme. The adjacent tolerance threshold of 100 mm corresponds to the acceptable gap between the plaster layer of the building wall and construction errors; the distance tolerance threshold of 300 mm adapts to the comfortable passage distance deviation range between functional areas in the residential interior; the alignment tolerance threshold is preset to 50 mm, corresponding to the allowable offset when the sensitivity of visual alignment effect is low. All three tolerance thresholds can be parameterized according to the user's requirements for layout precision.
[0119] In one embodiment of the present invention, the position coordinates, length, and width of each spatial unit are read from the effective geometric parameter combination; the lower left corner anchor point coordinates of the spatial unit within the boundary contour data are determined based on the position coordinates of each spatial unit; the upper right corner coordinates are calculated from the lower left corner anchor point coordinates based on the length and width of the spatial unit; the rectangular area between the lower left corner anchor point coordinates and the upper right corner coordinates is marked as the occupied area of the spatial unit; whether there is overlap between the occupied areas of all spatial units is detected; when there is overlap, another effective geometric parameter combination farthest from the overlapping area is selected, and the occupied area marking operation is re-executed; when there is no overlap between the occupied areas of all spatial units, the set of all occupied areas is taken as the preliminary spatial layout scheme.
[0120] In practical implementation, the effective geometric parameter combination set contains hundreds to thousands of effective geometric parameter combinations that satisfy all spatial relationship constraints. Each effective geometric parameter combination consists of the length, width, and position coordinates of six spatial units: living room, balcony, master bedroom, independent bathroom, kitchen, and dining room. The first effective geometric parameter combination is selected from the effective geometric parameter combination set in the order of generation, and the position coordinates, length, and width values of each spatial unit are read from the first effective geometric parameter combination. The coordinates of the living room space unit are (2100, 3800), with a length of 5000 mm and a width of 4200 mm; the coordinates of the balcony space unit are (2100, 6500), with a length of 3600 mm and a width of 1500 mm; the coordinates of the master bedroom space unit are (6200, 3800), with a length of 4500 mm and a width of 4800 mm; the coordinates of the separate bathroom space unit are (6200, 6200), with a length of 2100 mm and a width of 1800 mm; the coordinates of the kitchen space unit are (5800, 2000), with a length of 3600 mm and a width of 3000 mm; and the coordinates of the dining room space unit are (6200, 5200), with a length of 3900 mm and a width of 3300 mm.
[0121] In practice, the coordinates of the lower left corner anchor point of each spatial unit within the boundary contour data are determined based on its position coordinates. This is done by using the position coordinates as the geometric center point of the spatial unit, shifting it to the left by half the length value to obtain the x-coordinate of the lower left corner anchor point, and shifting it downwards by half the width value to obtain the y-coordinate. Taking a living room spatial unit as an example, the geometric center point coordinates are (2100, 3800), the length is 5000 mm, and the width is 4200 mm. The x-coordinate of the lower left corner anchor point is calculated as 2100 - 5000 / 2 = -400, and the y-coordinate is calculated as 3800 - 4200 / 2 = 1700. Therefore, the lower left corner anchor point coordinates are (-400, 1700). Based on the length and width of the living room space unit, calculate the coordinates of the upper right corner starting from the lower left anchor point. The x-coordinate of the upper right corner is calculated as -400 + 5000 = 4600, and the y-coordinate is calculated as 1700 + 4200 = 5900. The upper right corner coordinates of the living room space unit are (4600, 5900). Mark the rectangular area between the lower left anchor point coordinates (-400, 1700) and the upper right corner coordinates (4600, 5900) as the occupied area of the living room space unit. In the same way, determine the lower left anchor point coordinates of the balcony space unit as (300, 5750), and the upper right corner coordinates of the balcony space unit as (3900, 7250). Mark the rectangular area between (300, 5750) and (3900, 7250) as the occupied area of the balcony space unit. The bottom left corner of the master bedroom unit has coordinates of (3950, 1400), and the top right corner has coordinates of (8450, 6200). The rectangular area between (3950, 1400) and (8450, 6200) is marked as the occupied area of the master bedroom unit. Similarly, the bottom left corner of the ensuite bathroom unit has coordinates of (5150, 5300), and the top right corner has coordinates of (7250, 7100). The rectangular area between (5150, 5300) and (7250, 7100) is marked as the occupied area of the ensuite bathroom unit. Likewise, the bottom left corner of the kitchen unit has coordinates of (4000, 500), and the top right corner has coordinates of (7600, 3500). The rectangular area between (4000, 500) and (7600, 3500) is marked as the occupied area of the kitchen unit. The coordinates of the lower left corner anchor point of the restaurant space unit are (4250, 3550), and the coordinates of the upper right corner of the restaurant space unit are (8150, 6850). The rectangular area between (4250, 3550) and (8150, 6850) is marked as the occupied area of the restaurant space unit.
[0122] In the specific implementation, the overlap between the occupied areas of all six spatial units is detected. The overlap detection adopts a polygonal overlap detection algorithm, which performs two-dimensional axis-aligned rectangle intersection judgment on the occupied area rectangles of each pair of spatial units. The intersection rectangle of the occupied area of the living room spatial unit and the occupied area of the balcony spatial unit is calculated. The x-axis range of the occupied area of the living room spatial unit is [-400, 4600], and the x-axis range of the occupied area of the balcony spatial unit is [300, 3900], with an overlap interval of [300, 3900] in the x-axis direction; the y-axis range of the occupied area of the living room spatial unit is [1700, 5900], and the y-axis range of the occupied area of the balcony spatial unit is [5750, 7250], with an overlap interval of [5750, 5900] in the y-axis direction. The area of the intersection rectangle of the occupied areas of the two spatial units is (3900-300)×(5900-5750)=3600×150=540000 square millimeters. The overlapping area is not empty, and it is determined that there is an overlap between the living room spatial unit and the balcony spatial unit. The overlap between the living room and master bedroom space units is further detected. The x-axis range of the living room space unit [-400, 4600] overlaps with the x-axis range of the master bedroom space unit [3950, 8450] in the range of [3950, 4600]. The y-axis range of the living room space unit [1700, 5900] overlaps with the y-axis range of the master bedroom space unit [1400, 6200] in the range of [1700, 5900]. The area of the intersecting rectangles is not zero, indicating an overlap. When an overlap is detected, the total area and spatial location of the overlapping area are recorded. If the first set of valid geometric parameter combinations does not meet the non-overlap condition, the first set of valid geometric parameter combinations is marked as unavailable. From the set of valid geometric parameter combinations, select the other valid geometric parameter combination that is furthest from the overlapping area. The selection strategy is as follows: traverse the set of valid geometric parameter combinations that have not yet been marked as unusable, calculate the sum of Euclidean distances between the center points of the occupied areas of all spatial units contained in each group of valid geometric parameter combinations and the recorded geometric center points of the overlapping areas, and select the valid geometric parameter combination with the largest sum of distances as the next valid geometric parameter combination to be selected. For the other selected valid geometric parameter combination, re-execute the aforementioned occupied area marking operation, re-read the position coordinates, length, and width values of the six spatial units in the newly selected valid geometric parameter combination, redetermine the coordinates of the lower left anchor point and calculate the upper right coordinates, and re-mark the occupied areas of the six spatial units.
[0123] In practice, overlap detection is performed again on the occupied areas of the six newly marked spatial units. If overlap still exists, the other valid geometric parameter combination farthest from the overlapping area is selected from the set of valid geometric parameter combinations, and the occupied area marking operation is re-executed. This process is repeated until all six spatial units' occupied areas are free from overlap after marking a certain set of valid geometric parameter combinations. When there is no overlap between the occupied areas of all spatial units, the set of all occupied areas is taken as the preliminary spatial layout scheme. The preliminary spatial layout scheme is as follows: the living room space unit occupies a rectangular area defined by points (-400, 1700) and (4600, 5900); the balcony space unit occupies a rectangular area defined by points (300, 5750) and (3900, 7250); the master bedroom space unit occupies a rectangular area defined by points (3950, 1400) and (8450, 6200); the independent bathroom space unit occupies a rectangular area defined by points (5150, 5300) and (7250, 7100); the kitchen space unit occupies a rectangular area defined by points (4000, 500) and (7600, 3500); and the dining room space unit occupies a rectangular area defined by points (4250, 3550) and (8150, 6850). The union of these six rectangular areas constitutes a complete spatial functional zoning within the boundary contour data.
[0124] In some embodiments, the calculation of the lower left anchor point coordinates is not based on the geometric center point offset, but is directly specified by the position coordinate values in the effective geometric parameter combination as the lower left anchor point coordinates of the spatial unit. The position coordinate values are directly used as the lower left anchor point reference coordinates through the output of the third fully connected network during the generation stage of the geometric parameter candidate set. The conversion formula for the geometric center point coordinates is:
[0125]
[0126] in: This represents the x-coordinate of the geometric center point of a spatial unit. This represents the x-coordinate of the lower left anchor point of the spatial unit. This represents the length of the spatial unit. In this approach, overlap detection and relation constraint checks uniformly adopt the coordinate system of the lower left anchor point, reducing the step of converting position coordinates to the coordinates of the occupied area.
[0127] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments that can be applied to other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.
Claims
1. A method for generating indoor spatial layout based on knowledge graphs, characterized in that, include: Obtain the boundary contour data and functional requirements text of the target indoor space; The functional requirement text is parsed into spatial type labels and spatial relationship constraints; An initial spatial knowledge graph is constructed using the spatial type labels as nodes and the spatial relationship constraints as edges. Extract the adjacency feature vector of each node and the weight feature vector of each edge from the initial spatial knowledge graph; The adjacency feature vector and the weight feature vector are input into the graph neural network for message passing and node state updating; The updated node state vector is mapped to the geometric parameter candidate set for each spatial cell; A constraint satisfaction search is performed on the candidate set of geometric parameters to filter out combinations of geometric parameters that satisfy all spatial relation constraints; The geometric parameters are combined and filled into the boundary contour data to generate a preliminary spatial layout scheme.
2. The method for generating indoor spatial layout based on knowledge graphs according to claim 1, characterized in that, The steps to obtain the boundary contour data and functional requirements text of the target interior space specifically include: Receive 2D floor plan files of indoor spaces uploaded by users; Perform image binarization processing on the two-dimensional planar drawing file to separate the wall area and the opening area; A contour tracking algorithm is performed on the binarized image to extract the inner boundary line of the outer wall as the boundary contour data. Simultaneously, it receives text descriptions input by the user as the functional requirement text; The functional requirements text contains at least one spatial type keyword and at least one spatial relative position descriptor.
3. The method for generating indoor spatial layout based on knowledge graphs according to claim 1, characterized in that, The steps of parsing the functional requirement text into spatial type labels and spatial relationship constraints specifically include: Perform Chinese word segmentation on the functional requirement text to obtain a word sequence; Each word in the word sequence is matched with a predefined spatial type dictionary to identify spatial type labels; The words in the word sequence that are not matched as spatial type labels are matched with a predefined spatial relation dictionary to identify spatial relation words; Extract the relation type and relation parameters from the spatial relation terms; The relationship type includes at least one of the following: adjacency relationship, containment relationship, alignment relationship, and distance constraint relationship; Establish a corresponding association between the identified spatial type labels and the extracted spatial relationship constraints.
4. The method for generating indoor spatial layout based on knowledge graphs according to claim 3, characterized in that, The steps for constructing an initial spatial knowledge graph using the spatial type labels as nodes and the spatial relationship constraints as edges specifically include: Create a graph data structure; Create a node object in the graph data structure for each identified spatial type label; Create an edge object in the graph data structure for each spatial relation constraint; Each edge object connects two node objects; Each edge object's properties record the relation type name and relation parameter value corresponding to that edge; The graph data structure containing all node objects and all edge objects is used as the initial spatial knowledge graph.
5. The method for generating indoor spatial layout based on knowledge graphs according to claim 4, characterized in that, The steps of extracting the adjacency feature vector of each node and the weight feature vector of each edge from the initial spatial knowledge graph specifically include: Iterate through each node object in the initial spatial knowledge graph; For the currently traversed node object, collect the type labels of all adjacent node objects directly connected to that node object as an adjacency type set; The set of adjacency types is encoded into a fixed-length binary vector as the adjacency feature vector of the node object; Traverse each edge object in the initial spatial knowledge graph; For the edge object currently being traversed, the relation type name of the edge object is encoded as an independent vector; The unique vector is concatenated with the preset initial weight value to form the weight feature vector of the edge object.
6. The method for generating indoor spatial layout based on knowledge graphs according to claim 5, characterized in that, The steps of inputting the adjacency feature vector and the weight feature vector into the graph neural network for message passing and node state updating specifically include: Initialize a hidden state vector for each node object in the initial spatial knowledge graph; For each node object, collect the hidden state vectors of all its neighboring node objects; For each node object, collect the weight feature vectors of the edge objects between that node object and each of its neighboring node objects; The weighted message vector is obtained by multiplying the hidden state vector of the adjacent node objects on each edge element by the weight feature vector of that edge. The aggregated message vector of a node object is obtained by summing all the weighted message vectors collected from the same node object. The hidden state vector of the current node object is concatenated with the aggregated message vector and then input into the multilayer perceptron; The output vector of the multilayer perceptron is used as the updated hidden state vector of the node object. Repeat the node update process until the change in the hidden state vector of all node objects is lower than a preset threshold.
7. The method for generating indoor spatial layout based on knowledge graphs according to claim 6, characterized in that, The step of mapping the updated node state vector to the geometric parameter candidate set for each spatial cell specifically includes: The updated hidden state vector of each node object is input into the first fully connected network to obtain the minimum and maximum values of the spatial length range corresponding to that node object; The updated hidden state vector of the same node object is input into the second fully connected network to obtain the minimum and maximum values of the spatial width range corresponding to the node object; The updated hidden state vector of the same node object is input into the third fully connected network to obtain the position coordinate range of the node object; The spatial length range, spatial width range, and position coordinate range corresponding to the same node object are combined into a triple and used as a parameter candidate entry for that node object. Generate multiple different parameter candidate entries for each node object; The set of parameter candidate entries for all node objects is used as the geometric parameter candidate set for each spatial element.
8. The method for generating indoor spatial layout based on knowledge graphs according to claim 7, characterized in that, The step of performing a constraint satisfaction search in the candidate set of geometric parameters to filter out combinations of geometric parameters that satisfy all spatial relationship constraints specifically includes: Select one candidate item from the parameter candidate items of each node object to form a candidate combination; For each spatial cell in the current candidate combination, calculate the linear equations of the four boundary lines of the spatial cell based on the length, width, and position coordinates of the spatial cell; For each pair of spatial cells with adjacency constraints in the current candidate combination, calculate the minimum distance between the boundary line of the first spatial cell and the boundary line of the second spatial cell. Determine whether the minimum spacing is less than a preset adjacent tolerance threshold; For each pair of spatial cells with alignment constraints in the current candidate combination, calculate the parallel offset distance between the reference boundary line of the first spatial cell and the reference boundary line of the second spatial cell. Determine whether the parallel offset distance is less than a preset alignment tolerance threshold; For each pair of spatial cells with distance constraints in the current candidate combination, calculate the Euclidean distance between the geometric center point of the first spatial cell and the geometric center point of the second spatial cell. Determine whether the absolute value of the difference between the Euclidean distance value and the preset target distance value is less than a preset distance tolerance threshold; When the current candidate combination satisfies all spatial relation constraints, the candidate combination is marked as a valid geometric parameter combination. Iterate through all candidate combinations and collect all valid geometric parameter combinations.
9. The method for generating indoor spatial layout based on knowledge graphs according to claim 8, characterized in that, The step of filling the boundary contour data with the geometric parameter combination to generate a preliminary spatial layout scheme specifically includes: Read the position coordinates, length, and width of each spatial unit from the effective combination of geometric parameters; The coordinates of the lower left anchor point of each spatial unit within the boundary contour data are determined based on the position coordinates of each spatial unit. The coordinates of the upper right corner of the spatial unit are calculated from the coordinates of the lower left anchor point based on the length and width of the spatial unit. The rectangular area between the coordinates of the lower left corner anchor point and the coordinates of the upper right corner is marked as the occupied area of the spatial unit; Detect whether there is any overlap between the occupied areas of all spatial units; When overlap exists, select the other valid geometric parameter combination that is farthest from the overlapping area and re-execute the occupied area marking operation; When there is no overlap between the occupied areas of all spatial units, the set of all occupied areas is taken as the preliminary spatial layout scheme.
10. A knowledge graph-based indoor space layout generation system, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the knowledge graph-based indoor space layout generation method described in any one of claims 1 to 9.