Language model-based indoor space structural partition constraint generation method

By using a language model-based method for generating structured zoning constraints for interior spaces, the system automatically extracts and processes interior space information, solving the problems of low efficiency and insufficient accuracy in traditional interior design, and achieving efficient and flexible space layout optimization.

CN121389210APending Publication Date: 2026-01-23SHIJIAZHUANG CHANGHONG BUILDING DECORATION ENG
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511497374.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-20
Publication Date
2026-01-23

AI Technical Summary

Technical Problem

Traditional interior design methods rely on human experience and manual calculations, resulting in low efficiency, a high risk of errors, difficulty in accurately capturing complex spatial layouts and changes, an inability to quickly adapt to different types or needs of spatial layouts, and a lack of flexibility and efficiency.

Method used

By acquiring four-channel vector floor plans and benchmark spatial datasets, the contour tracking algorithm is used to extract room vertex coordinates, calculate spatial feature parameters, generate spatial connectivity maps, and perform autoregressive training through a pre-trained language model to output indoor spatial structured zoning constraints that meet preset standards.

Benefits of technology

It achieves efficient automation of zoning and connection relationships in the interior design process, accurately generates spatial constraints that meet preset standards, can adapt to different design needs, and improve design efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121389210A_ABST
    Figure CN121389210A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of indoor design, in particular to an indoor space structural partition constraint generation method based on a language model, which comprises the following steps: acquiring a four-channel vector house type image and a reference space data set of a target indoor space, the reference space data set comprises room parameters and connection relation data of various house types; polygonal vertex coordinates of all rooms are extracted from the four-channel vector house type image through a contour tracking algorithm, and an initial vertex data set is obtained; and preprocessing the initial vertex data set and the reference space data set. According to the method, the geometric information of the room can be automatically extracted from the complex house type image by using the contour tracking algorithm, gray stretching, contrast enhancement and other technologies, and standardization processing is carried out, so that partitioning, connection relationships and the like in the interior design process can be efficiently and automatically completed, manual intervention is reduced, and the efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of interior design, in particular to a method for generating structured partition constraints of indoor space based on a language model. BACKGROUND

[0002] With the rapid development of artificial intelligence technology, especially the breakthroughs in deep learning and natural language processing (NLP) fields, traditional industries have gradually recognized the changes brought about by automation and intelligentization. The traditional interior design field, which relies on manual experience and manual calculation, has been unable to meet the demand for efficiency, accuracy, and customization in the modern market.

[0003] Currently, traditional interior design methods usually require designers to manually extract room information and space partitioning, which is a tedious and time-consuming process. Human intervention can easily lead to errors or inconsistencies, and the efficiency is low. It is difficult to use algorithms to automatically complete the analysis and optimization of complex spaces, and designers often need to manually adjust step by step, which lacks flexibility and efficiency.

[0004] In addition, in traditional design, the spatial constraints and connection relationships between rooms are usually measured manually or processed by simple rules, making it difficult to accurately capture complex layouts and changes, which may result in unreasonable design or failure to meet actual needs. Moreover, it is usually fixed to certain design standards and cannot quickly adapt to different types or needs of space layout, which limits its application range in various design projects. SUMMARY

[0005] To achieve the above-mentioned purpose, the present application provides the following technical scheme: a method for generating structured partition constraints of indoor space based on a language model, comprising: obtaining a four-channel vector floor plan of a target indoor space and a reference space data set, wherein the four-channel vector floor plan includes contour information of multiple rooms, and the reference space data set includes room parameters and connection relationship data of multiple types of floor plans; extracting polygon vertex coordinates of each room from the four-channel vector floor plan by a contour tracking algorithm to obtain an initial vertex data set; preprocessing the initial vertex data set and the reference space data set to remove redundant vertices and standardize the coordinates to obtain a standardized vertex data set and a standardized space data set; calculating the area parameters of each room based on the standardized vertex data set, traversing all room pairs, and calculating the boundary distance parameters between rooms according to the vertex coordinates to obtain a space feature parameter set; determining the boundary distance parameters in the space feature parameter set according to a predetermined distance threshold, establishing a connection relationship for room pairs with a boundary distance parameter less than or equal to the threshold, and generating a space connection map; The space connection graph, the area parameter and the standardized space data set are converted into a model training sample, a pre-trained language model is loaded and a low-rank adaptive layer is injected, model training is performed in an autoregressive manner, and a space constraint generation model is obtained. A house type feature of a target indoor space is input into the space constraint generation model, and an indoor space structured partition constraint meeting a preset standard is output, wherein the house type feature includes the number of rooms, the area ratio and the connection relationship.

[0006] Preferably, the polygon vertex coordinates of each room are extracted from the four-channel vector house type graph by a contour tracking algorithm to obtain an initial vertex data set, including: The gray level histogram of the target channel image is calculated to determine the gray level peak interval in the gray level histogram; The gray level stretching range is set based on the gray level peak interval, and the target channel image is subjected to gray level stretching processing; The image after gray level stretching is subjected to adaptive contrast enhancement to strengthen the boundary gray level difference between the room area and the background area, and an enhanced target channel image is obtained; The eight-neighborhood contour tracking algorithm is used to traverse the contour of the target channel image, and the pixel point coordinates of the room contour are recorded; The recorded pixel point coordinates are subjected to polygon fitting to obtain the initial polygon vertex coordinates of each room; The initial polygon vertex coordinates of all rooms are classified and stored according to the room category to form an initial vertex data set.

[0007] Preferably, the eight-neighborhood contour tracking algorithm is used to traverse the contour of the target channel image, and the pixel point coordinates of the room contour are recorded, including: The gray level histogram of the target channel image is calculated to determine the gray level peak interval in the gray level histogram, and the gray level stretching range is set based on the gray level peak interval, and the target channel image is subjected to gray level stretching processing; The image after gray level stretching is subjected to adaptive contrast enhancement to strengthen the boundary gray level difference between the room area and the background area, and an enhanced target channel image is obtained; The contour starting pixel point in the enhanced target channel image is determined, and the starting pixel point is the boundary pixel point between the room area and the background area; The eight-neighborhood search method is used to traverse the adjacent pixel points with the starting pixel point as the center, and it is judged whether the adjacent pixel points belong to the room contour pixel points; The coordinates of all the pixel points determined as the room contour pixel points are recorded to form an initial pixel point set of the room contour; Calculate the distance deviation of each pixel point in the initial pixel point set and the adjacent pixel point, set the distance deviation threshold, remove the pixel point whose distance deviation exceeds the set distance deviation threshold, and keep the pixel point whose distance deviation is within the set distance deviation threshold, to form an effective pixel point set conforming to the room contour feature; Sort the pixel point coordinates in the effective pixel point set in a clockwise direction; Calculate the coordinate difference of adjacent pixel points after sorting, and determine the connection order of the pixel points based on the coordinate difference; Arrange the pixel point coordinates in sequence according to the connection order to construct a pixel point coordinate sequence of the room contour; Perform continuity verification on the pixel point coordinate sequence, supplement the missing contour pixel points, and obtain a complete room contour pixel point coordinate set.

[0008] Preferably, the continuity of the pixel point coordinate sequence is verified, the missing contour pixel points are supplemented, and a complete room contour pixel point coordinate set is obtained, including: Traverse the pixel point coordinate sequence, and calculate the coordinate interval between two adjacent pixel points; When the coordinate interval exceeds the preset interval threshold, it is determined that there is a missing contour pixel point, and the coordinates of the missing pixel point are generated based on the coordinate trend of the adjacent pixel points; Insert the coordinates of the missing pixel point into the pixel point coordinate sequence to form a complete room contour pixel point coordinate set.

[0009] Preferably, the initial vertex data set and the reference space data set are preprocessed to remove redundant vertices and standardize the coordinates to obtain a standardized vertex data set and a standardized space data set, including: Detect the collinearity of the vertex coordinates in the initial vertex data set, and remove the collinear redundant vertices; Remove outliers from the room parameters in the reference space data set, and keep the parameter data within the preset range; Normalize the coordinates of the processed initial vertex data set and the reference space data set to obtain a standardized vertex data set and a standardized space data set.

[0010] Preferably, based on the standardized vertex data set, the area parameters of each room are calculated, all room pairs are traversed, and the boundary distance parameters between rooms are calculated according to the vertex coordinates to obtain a space feature parameter set, including: Based on the room vertex coordinates in the standardized vertex data set, the area parameters of each room are calculated using the polygon area calculation formula; Traverse all room pairs, extract the boundary vertex coordinates of each room pair, and calculate the Manhattan distance between the boundary vertices; taking the minimum Manhattan distance between each pair of rooms as a boundary distance parameter of the pair of rooms; integrating the area parameters of all rooms and the boundary distance parameters of all pairs of rooms to form a set of space feature parameters.

[0011] Preferably, the boundary distance parameters in the set of space feature parameters are determined according to a preset distance threshold, and a connection relationship is established for pairs of rooms with a boundary distance parameter less than or equal to the threshold, and a space connection map is generated, including: determining the preset distance threshold according to the type of the reference space data set, wherein the threshold corresponding to the first type of data set is 8, and the threshold corresponding to the second type of data set is 2; comparing the boundary distance parameters in the set of space feature parameters with the corresponding preset distance threshold; marking pairs of rooms with a boundary distance parameter less than or equal to the preset distance threshold as associated pairs of rooms; representing rooms as circles and the connection relationship of associated pairs of rooms as edges to construct and generate a space connection map.

[0012] Preferably, the space connection map, the area parameter, and the standardized space data set are converted into model training samples, a pre-trained language model is loaded and a low-rank adaptation layer is injected, model training is performed in an autoregressive manner, and a space constraint generation model is obtained, including: converting the space connection map into an adjacency matrix, converting the area parameter into a normalized area vector, and generating a structured text description in combination with the standardized space data set; dividing the structured text description into a training set and a validation set according to a preset ratio; loading a pre-trained LLaMA3-8B model of HuggingFace, performing 8-bit quantization processing, and injecting a low-rank adaptation layer with a rank of 64; using the training set as input, training the model in an autoregressive manner, evaluating the model performance through the validation set and adjusting the parameters until the model converges, and obtaining a space constraint generation model.

[0013] Preferably, the space connection map is converted into an adjacency matrix, the area parameter is converted into a normalized area vector, and a structured text description is generated in combination with the standardized space data set, including: traversing all region nodes in the space connection map, assigning a unique identifier to each region node, determining whether there is a connection relationship between any two region nodes, marking a first value if there is a connection relationship, and marking a second value if there is no connection relationship, taking the identifier of the region node as the row and column index of the matrix, filling the first value and the second value into the corresponding matrix position, and generating a space adjacency matrix; The area parameters of each region are subjected to numerical standardization to obtain a normalized area vector; The spatial adjacency matrix is subjected to dimension expansion processing to convert the two-dimensional matrix into a one-dimensional matrix vector, and the one-dimensional matrix vector is spliced with the normalized area vector at the element level to obtain a spatial comprehensive feature; A parameter mapping rule corresponding to the spatial comprehensive feature is extracted from the standardized spatial data set, and the parameter mapping rule includes a corresponding relationship between feature values and text descriptions; Each feature value in the spatial comprehensive feature is traversed, and a corresponding text expression fragment is matched according to the parameter mapping rule; According to a preset text structure template, each text expression fragment is logically integrated and sequentially arranged to generate a structured text description of the indoor space.

[0014] Preferably, the layout features of the target indoor space are input into the space constraint generation model, and an indoor space structured partition constraint conforming to a preset standard is output, including: The layout features of the target indoor space are extracted, wherein the layout features include the number of rooms, the area proportion of each room, and the connection relationship between rooms; The layout features are converted into a model input format and input into the space constraint generation model; The model outputs a structured text conforming to the FPDJson standard, wherein the structured text includes partition function constraints, area proportion constraints, and channel connection constraints; The output structured text is subjected to format verification, and after passing the verification, it is determined as the indoor space structured partition constraint.

[0015] Compared with the prior art, the beneficial effects of the present application are: The present application can automatically extract the geometric information of the rooms from the complex layout image by using the contour tracking algorithm, gray stretch and contrast enhancement, and can perform standardized processing, which makes the partition and connection relationship in the indoor design process efficient and automatic, reduces manual intervention, improves efficiency, calculates the area and boundary distance of the room, and judges the connection relationship between the rooms according to the preset threshold, which can accurately generate a space constraint conforming to the preset standard, which is very important for the functional layout and space optimization in indoor design; The present application can capture the complex relationships and constraints in the space layout by converting the space connection graph and area parameters into training samples and using a pre-trained language model for autoregressive training, thereby generating a more intelligent and actual demand conforming partition scheme, and can flexibly set the distance threshold according to different types of benchmark space data sets to generate a space partition that adapts to different design requirements. This makes the method can be widely used in different indoor design projects, such as residential, office space, commercial area, etc. Attached Figure Description

[0016] Figure 1 This is a schematic flowchart of the overall method in one embodiment of the present invention. Detailed Implementation

[0017] 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.

[0018] Example 1, please refer to Figure 1 This invention provides a technical solution: a method for generating structured zoning constraints for indoor spaces based on a language model, comprising: S1. Obtain the four-channel vector floor plan of the target indoor space and the baseline space dataset. The four-channel vector floor plan includes the outline information of multiple rooms, and the baseline space dataset includes room parameters and connection relationship data of various apartment types. S2. Extract the polygon vertex coordinates of each room from the four-channel vector floor plan using the contour tracing algorithm to obtain the initial vertex dataset; preprocess the initial vertex dataset and the baseline spatial dataset, remove redundant vertices and standardize the coordinates to obtain the standardized vertex dataset and the standardized spatial dataset. S3. Calculate the area parameters of each room based on the standardized vertex dataset, traverse all room pairs and calculate the boundary distance parameters between rooms based on the vertex coordinates to obtain the spatial feature parameter set; S4. Determine the boundary distance parameters in the spatial feature parameter set according to the preset distance threshold, establish connection relationships for room pairs whose boundary distance parameters are less than or equal to the threshold, and generate a spatial connection map. S5. Transform the spatial connectivity map, area parameters and standardized spatial dataset into model training samples, load the pre-trained language model and inject a low-rank adaptation layer, and train the model using an autoregressive approach to obtain a spatial constraint generation model. S6. Input the floor plan features of the target indoor space into the spatial constraint generation model, and output the structured zoning constraints of the indoor space that meet the preset standards. The floor plan features include the number of rooms, area ratio and connection relationship.

[0019] Note that the four-channel vector floor plan is a digital representation of an indoor floor plan, which contains information about four main channels: the outline (geometry) of the room; the connection between rooms (such as the relationship between doors and walls); the area, shape ratio, etc. of the room; other space features (such as windows, equipment location, etc.); This benchmark space dataset contains room parameters and connection relationship data for multiple different floor plans; for example, a floor plan contains 10 rooms, the area, shape, and connection between these rooms are all recorded; for example: suppose there is a four-channel vector floor plan of a target indoor space, which contains 3 rooms: living room, bedroom, kitchen; Each room has clear outline data (such as coordinates), and describes the connection relationship between them (such as the living room and the bedroom are connected by a door, and the kitchen is separated from the living room by a wall); The boundary information of each room can be extracted from the four-channel vector floor plan by the contour tracing algorithm, and the vertex coordinates of the room can be obtained; these coordinates represent the geometry of the room; by removing redundant vertices and standardizing the coordinates, all room space data is ensured to be in a unified scale; this is to facilitate subsequent comparison and analysis; for example: suppose in the floor plan, the outline of the living room is a rectangle, and the outline of the bedroom is a rectangle; through the contour tracing algorithm, the vertex coordinates of each room are extracted: living room: vertex coordinates may be (0,0), (5,0), (5,4), (0,4), bedroom: vertex coordinates may be (5,0), (8,0), (8,4), (5,4); According to the extracted vertex coordinates, the area of each room can be calculated using geometric algorithms; for example, by using the polygon area formula; calculate the boundary distance between rooms, that is, the shortest distance between rooms (such as the thickness of the wall, the width of the door, etc. to determine the distance between adjacent rooms); Set a threshold, when the boundary distance between rooms is less than or equal to the threshold, consider that the two rooms are "adjacent" and establish a connection relationship between them; according to the boundary distance of the room, generate a graph, each node in the graph represents a room, and each edge represents the connection relationship between the rooms; for example: suppose the threshold is set to 3 meters, the boundary distance between the living room and the bedroom is 2 meters, so they will establish a connection relationship; similarly, the distance between the bedroom and the kitchen may be greater than 3 meters, so they do not establish a connection relationship; The spatial connection graph, area parameters, standardized spatial data set obtained in the step are input into a pre-trained language model as training samples; the model is fine-tuned through a low-rank adaptation layer; an autoregressive method is used in training the model, and the model generates new partition constraints according to the existing input data; for example, assuming that there are many different house type graphs in the training data, containing information such as the number of rooms, area ratio, connection relationship, etc.; the model learns how to generate a standard spatial structure through these data; The characteristics of the target indoor space (such as the number of rooms, area ratio, connection relationship, etc.) are input, and the model outputs an indoor space structured partition constraint that meets the preset standard according to the input; for example, assuming that the input data is a house type graph with 4 rooms: living room, bedroom, kitchen and study, the model may output a structured partition constraint according to the pre-learned rules: the living room is adjacent to the bedroom and study, but the kitchen is far away from the living room; the area of the living room should account for 40% of the entire space, the bedroom and study account for 25%, and the kitchen accounts for 10%; these constraints can be further used for indoor space design to ensure that the design meets reasonable space layout and functional requirements.

[0020] In an optional embodiment, the polygon vertex coordinates of each room are extracted from a four-channel vector house type graph by a contour tracking algorithm to obtain an initial vertex data set, including: A gray level histogram of the target channel image is calculated to determine the gray level peak interval in the gray level histogram; Based on the gray level peak interval, a gray level stretching range is set, and the target channel image is subjected to gray level stretching processing; The image after gray level stretching is subjected to adaptive contrast enhancement to strengthen the boundary gray level difference between the room area and the background area, and an enhanced target channel image is obtained; An eight-neighborhood contour tracking algorithm is used to traverse the contour of the target channel image, and the pixel point coordinates of the room contour are recorded; The recorded pixel point coordinates are subjected to polygon fitting to obtain the initial polygon vertex coordinates of each room; The initial polygon vertex coordinates of all rooms are classified and stored according to room categories to form an initial vertex data set.

[0021] It should be noted that the gray scale histogram is a basic concept in image processing, which represents the number of pixels of different gray levels in the image; for a gray scale image, the gray value is usually between 0 (black) and 255 (white), and the gray scale histogram is to count the frequency of each gray value; by analyzing the gray scale histogram, the peak interval of the gray value distribution can be found, which usually corresponds to the obvious objects or regions in the image; for example, the walls of a room may be concentrated in a certain gray range, while the background area may be in another gray range; for example, suppose the target image is an image of a room, after calculating the gray scale histogram of the image, it is found that there is a peak region between 100 and 150 in the gray value, which indicates that the pixel values of the room area are mainly concentrated in this gray range, while the gray values of the background area are concentrated between 50 and 100; Gray stretching is a method of enhancing image contrast by adjusting the gray value range of the image; in this step, according to the gray peak interval determined in step 1, a new gray range (stretching range) can be set to map the gray values of the image to the new range; by stretching the gray value range, the gray difference of the room area in the image is more obvious, and the contrast of the image is enhanced; for example, suppose the gray peak interval of the room area is [100, 150], and the gray peak interval of the background area is [50, 100]; through gray stretching processing, the gray values of the image can be stretched to a new range, for example, the gray value interval of the room is stretched from [100, 150] to [180, 255], and the gray value interval of the background area is stretched from [50, 100] to [0, 80], which enhances the contrast between the room area and the background area; By adjusting the contrast of the image by an adaptive method, the important regions in the image (such as the boundaries of the room and the background) are more prominent; this method enhances the contrast of the local area of the image, rather than globally adjusting the contrast of the image; the gray difference between the room area and the background area is strengthened, further enhancing the distinguishability of the image, making the boundary of the room more obvious, and easy for subsequent contour tracking and region extraction; for example, suppose after gray stretching, the gray values of the room area are already high, and the gray values of the background area are low; through adaptive contrast enhancement, the boundary of the room area becomes clearer, and the gray value changes more obviously, making it easier to distinguish the room from the background; The eight-neighborhood contour tracing algorithm is a method for extracting contours from an image. It starts from a pixel and traverses the image along its eight neighbors (up, down, left, right, and the four diagonal directions). During the traversal, it records the coordinates of all pixels belonging to the room region as part of the room contour. For example, consider an image with enhanced contrast, where the room region is clearly distinguished from the background. The eight-neighborhood contour tracing algorithm can track the boundary pixels of the room, such as the living room contour, which may consist of a set of coordinate points: [(10, 20), (10, 21), (11, 21), (11, 20),...]. By fitting a polygon to the recorded contour pixels, an approximate room boundary shape can be obtained. This converts the contour pixels into a simplified polygon representation, reducing computational complexity and improving analysis efficiency. The polygon fitting process yields the coordinates of the polygon vertices, which represent the room's geometry. For example, suppose the living room contour consists of multiple pixels. The polygon fitting algorithm can simplify these pixels into a quadrilateral with vertex coordinates: [(10, 20), (10, 30), (20, 30), (20, 20)], which represent the living room's boundary.

[0022] In an optional embodiment, the eight-neighborhood contour tracing algorithm is used to traverse the target channel image and record the pixel coordinates of the room contour, including: Calculate the gray histogram of the target channel image, determine the gray peak interval in the gray histogram, set the gray stretch range based on the gray peak interval, and perform gray stretch processing on the target channel image; Perform adaptive contrast enhancement on the gray stretched image to strengthen the boundary gray difference between the room region and the background region, obtaining an enhanced target channel image; Determine the contour starting pixel in the enhanced target channel image, which is the boundary pixel between the room region and the background region; Use the eight-neighborhood search method to traverse adjacent pixels centered on the starting pixel, and determine whether the adjacent pixels belong to the room contour pixels; Record the coordinates of all pixels determined as room contour pixels to form an initial pixel set of the room contour; Calculate the distance deviation of each pixel in the initial pixel set from its adjacent pixels, set a distance deviation threshold, remove pixels with a distance deviation exceeding the set distance deviation threshold, and retain pixels with a distance deviation within the set distance deviation threshold to form an effective pixel set that meets the room contour characteristics; Sort the pixel coordinates in the effective pixel set in a clockwise direction; The coordinate difference of the adjacent pixel points after calculation is sorted, and the connection order of the pixel points is determined based on the coordinate difference; The pixel point coordinates are arranged in sequence according to the connection order, and a pixel point coordinate sequence of the room contour is constructed. The continuity of the pixel point coordinate sequence is verified, and the missing contour pixel points are supplemented to obtain a complete room contour pixel point coordinate set.

[0023] It should be noted that the gray histogram of the image refers to the number of pixels corresponding to each gray level (from 0 to 255) in the image; by calculating the gray histogram, it can be observed which gray value pixels are most concentrated in the image; from the histogram, the area with higher gray value (i.e. the room area) can be found; the gray values of these areas are concentrated in a certain interval; for example, the color of the wall or the floor may be within a certain specific gray range; example: assuming that there is a picture of a room, after calculating its gray histogram, it is found that there is a peak value between 100 and 150 in the gray value, indicating that the room area is mainly these gray values; this interval is the set gray peak interval; By mapping the gray value (i.e. stretching the low gray value in the image to the high gray value range), the contrast of the image is enhanced; the purpose is to expand the gray value range and strengthen the difference between the room and the background; the gray value interval is expanded from the peak area, making the contrast between the room area and the background area more obvious; example: assuming that the gray value interval of the room area is [100, 150] and the gray value interval of the background area is [50, 100], the gray value of the room area can be mapped to [180, 255] and the gray value of the background area can be mapped to [0, 80] by gray stretching; in this way, the difference between the room area and the background becomes more obvious; Adaptive contrast enhancement enhances the contrast according to the local image area, which is different from global contrast adjustment; in this way, the boundary between the room area and the background area can be made clearer, avoiding the loss of background details that may occur with global enhancement; example: local enhancement is performed on the image after gray stretching, the contrast is enhanced at the edge of the room, making the boundary between the wall of the room and the background clearer, and avoiding the background details from becoming blurred; The contour starting pixel point is usually the junction of the room area and the background area (i.e. the boundary pixel point of the contour); starting from the starting pixel point, the eight adjacent pixel points (including up, down, left, right and four diagonal directions) are checked to determine whether these pixel points belong to the contour of the room area; example: assuming that a pixel point (10, 20) is found in the image to be the junction of the room and the background, which is used as the starting point, the eight neighborhood pixel points around it are checked to determine whether they belong to part of the room contour; Record all the pixel points judged as the room area boundary to form a preliminary room contour point set; example: suppose multiple boundary pixel points are found through eight-neighborhood search, such as (10, 20), (10, 21), (11, 20), (11, 21), etc., which constitute the initial pixel point set of the room contour; Calculate the distance deviation between each pixel point in the initial pixel point set and its adjacent pixel points (for example, some pixel points may deviate from the contour far away); set a threshold value, eliminate the pixel points whose distance deviation exceeds the threshold value, and only keep the effective pixel points that meet the room contour characteristics; example: suppose the distance between the coordinates of some pixel points is too large, which causes them to no longer be the boundary points of the room; a distance deviation threshold value (such as 5 pixels) can be set to eliminate those points whose distance from the neighborhood pixel points is greater than 5 pixels, and keep the pixel points that meet the requirements; According to the coordinates of the effective pixel points, sort them in the clockwise direction to determine the connection order between the pixel points; according to the sorted pixel point coordinates, connect adjacent pixel points to form a complete room contour; example: sort the effective room contour pixel points in the clockwise direction to obtain a point sequence: [(10, 20), (11, 20), (11, 21), (10, 21)], and connect these points according to this sequence to form the boundary of the room; Check whether the contour point sequence is continuous, and if missing contour pixel points are found, supplement them to ensure the integrity of the contour; example: suppose there are some interval gaps in the sorted pixel point sequence, which are supplemented by interpolation or other methods to ensure the integrity of the room contour.

[0024] In an optional embodiment, the continuity of the pixel point coordinate sequence is checked, missing contour pixel points are supplemented, and a complete room contour pixel point coordinate set is obtained, including: Iterate through the pixel point coordinate sequence to calculate the coordinate interval between two adjacent pixel points; When the coordinate interval exceeds a preset interval threshold value, it is determined that there is a missing contour pixel point, and the coordinates of the missing pixel point are generated based on the coordinate trend of the adjacent pixel points; Insert the coordinates of the missing pixel point into the pixel point coordinate sequence to form a complete room contour pixel point coordinate set.

[0025] It should be noted that the pixel point coordinate sequence of the room contour is traversed to check the interval between two adjacent pixel points; the coordinate interval refers to the difference in position of two adjacent pixel points in the image; generally, the coordinate interval of two pixel points is obtained by calculating the horizontal (x-axis) and vertical (y-axis) distance between them; example: assuming that the initial pixel point coordinate sequence of the room contour (arranged in clockwise order) is as follows: point A: (10, 10), point B: (12, 12), point C: (15, 12), and point D: (18, 10), these points need to be traversed, and the coordinate interval between two adjacent points is calculated: the interval from A to B is (12-10, 12-10) = (2, 2), the interval from B to C is (15-12, 12-12) = (3, 0), and the interval from C to D is (18-15, 10-12) = (3, -2); A preset threshold is set to represent the maximum acceptable distance between adjacent pixel points; if the coordinate interval between two adjacent pixel points exceeds this threshold, it means that there may be missing pixel points; example: assuming that the set interval threshold is 2 pixels; in the above example: the interval from A to B is (2, 2), which does not exceed the threshold, and is normal; the interval from B to C is (3, 0), the horizontal interval exceeds the threshold of 2, indicating that a pixel point may be missing; the interval from C to D is (3, -2), both the horizontal and vertical intervals exceed the threshold, indicating that a pixel point may be missing; According to the coordinate difference between adjacent pixel points, the missing pixel point position can be inferred; generally, according to the straight line interpolation method, the missing pixel point coordinates are generated along the coordinate trend of two adjacent pixel points; example: assuming that the missing pixel points between B and C need to be filled: the coordinates of B are (12, 12), and the coordinates of C are (15, 12); the horizontal interval is 3, and the vertical interval is 0, indicating that the two points are horizontal in the horizontal direction, so the missing point should be on this horizontal line; according to the horizontal interval, the positions of the missing points can be inferred to generate (13, 12) and (14, 12) two pixel points; for the missing pixel points between C and D: the coordinates of C are (15, 12), and the coordinates of D are (18, 10); the horizontal interval is 3, and the vertical interval is -2, indicating that there is a certain inclination between the two points; the missing pixel point coordinates can be gradually generated by interpolation method; for example, the missing points may be (16, 11) and (17, 10); According to the generated missing pixel point coordinates, they are inserted into the original pixel point coordinate sequence to ensure that the outline becomes continuous and complete; example: assuming that (13, 12) and (14, 12) are inserted between B and C, and (16, 11) and (17, 10) are inserted between C and D; the final room outline pixel point coordinate sequence will be: (10, 10), (12, 12), (13, 12), (14, 12), (15, 12), (16, 11), (17, 10), (18, 10).

[0026] In an optional embodiment, the area parameters of each room are calculated based on the standardized vertex data set, the boundary distance parameters between rooms are calculated according to the vertex coordinates by traversing all room pairs, and the space feature parameter set is obtained, including: Based on the room vertex coordinates in the standardized vertex data set, the area parameters of each room are calculated using the polygon area calculation formula; Traverse all room pairs, extract the boundary vertex coordinates of each room pair, and calculate the Manhattan distance between the boundary vertices; The minimum Manhattan distance of each room pair is taken as the boundary distance parameter of the room pair; Integrate the area parameters of all rooms and the boundary distance parameters of all room pairs to form the space feature parameter set.

[0027] In an optional embodiment, the boundary distance parameters in the space feature parameter set are determined according to a preset distance threshold, a connection relationship is established for room pairs with a boundary distance parameter less than or equal to the threshold, and a space connection map is generated, including: The preset distance threshold is determined according to the type of the reference space data set, wherein the threshold corresponding to the first type of data set is 8, and the threshold corresponding to the second type of data set is 2; Compare the boundary distance parameters in the space feature parameter set with the corresponding preset distance threshold; Room pairs with a boundary distance parameter less than or equal to the preset distance threshold are marked as associated room pairs; The rooms are represented by circles, and the connection relationship of the associated room pairs is represented by edges, to construct and generate a space connection map.

[0028] It should be noted that if the vertex coordinates of a room are the vertices of a polygon, the "polygon area formula" can be used to calculate the area; common formulas include the cross product method, for each pair of rooms, the boundary vertices need to be found, which usually refers to the vertices in contact with other rooms; example: assume that there are two rooms with standardized vertex coordinates: room 1: vertex A: (0, 0), B: (0, 1), C: (1, 1), D: (1, 0), room 2: vertex E: (1, 0), F: (1, 2), G: (3, 2), H: (3, 0), from the vertex coordinates of the two rooms, extract the shared boundary vertices of the two rooms: shared boundary vertices: point D: (1, 0) and point E: (1, 0), calculate the Manhattan distance between the two points: dManhattan=∣1−1∣+∣0−0∣=0, this result means that there is no distance between their boundary vertices, in fact, they are coincident (i.e. they share a boundary); If there are multiple shared boundary vertices, the Manhattan distance between these boundary vertex pairs needs to be calculated, and the minimum value is selected as the "boundary distance" of the room pair; example: if room 1 and room 2 not only share points D and E, but also share other boundaries, such as: room 1 and room 2 also have point B: (0, 1) and point F: (1, 2); calculate their Manhattan distance: dManhattan=∣0−1∣+∣1−2∣=1+1=2, assuming that these two points are the only shared points, the minimum Manhattan distance is 2, i.e. the boundary distance parameter of the two rooms is 2; The areas of all rooms and the boundary distance parameters of room pairs are integrated together to form a set of spatial feature parameters; these features can be used for subsequent analysis, classification, clustering or other spatial optimization tasks; example: assume that the following processed room data: the area of room 1 is 1 square meter, the area of room 2 is 2 square meters, the minimum Manhattan distance between room 1 and room 2 is 2, then the spatial feature parameter set can be represented as: area parameter: room 1 is 1 square meter, room 2 is 2 square meters, boundary distance parameter: the boundary distance between room 1 and room 2 is 2, the final spatial feature parameter set is: {room 1 area = 1 square meter, room 2 area = 2 square meters, room 1 and room 2 boundary distance = 2}{room 1 area = 1 square meter, room 2 area = 2 square meters, room 1 and room 2 boundary distance = 2}.

[0029] In an optional embodiment, the spatial connection graph, the area parameter and the standardized spatial data set are converted into model training samples, a pre-trained language model is loaded and a low-rank adaptation layer is injected, the model is trained in an autoregressive manner to obtain a spatial constraint generation model, including: Convert the spatial connection graph into an adjacency matrix, convert the area parameter into a normalized area vector, and generate a structured text description combined with the standardized spatial data set; Divide the structured text description into a training set and a validation set according to a preset ratio; Load the pre-trained LLaMA 3-8B model from HuggingFace, use 8-bit quantization processing, and inject a low-rank adaptation layer with a rank of 64; Use the training set as input to train the model in an autoregressive manner, evaluate the model performance through the validation set, and adjust the parameters until the model converges, obtaining a spatial constraint generation model.

[0030] It should be noted that the spatial connection graph is a graph data structure that describes the connection relationships between rooms or space elements; each room or space element is considered a node, and the connection relationships between rooms (such as adjacency, shared boundaries, etc.) form the edges of the graph; the adjacency matrix is a two-dimensional matrix representing the connection relationships between nodes in the graph; for each pair of nodes (rooms), if they have a connection (such as a shared boundary), the corresponding matrix element is 1, otherwise it is 0; area is an important spatial feature, and normalization refers to converting the area value according to a certain standardization method so that the area is within a fixed range (usually [0, 1]); this ensures that the areas of all rooms are compared on the same scale; Structured text description is the process of converting spatial data (such as room connection relationships, area, boundary, etc.) into natural language descriptions; for example, it can generate descriptions of the area, adjacency relationship, etc. of each room; example: for the information of rooms A, B and C, the following structured text can be generated: "Room A has an area of 10 square meters and is adjacent to room B;"、"Room B has an area of 20 square meters and is adjacent to rooms A and C;"、"Room C has an area of 30 square meters and is adjacent to room B;" These text descriptions can include room area, adjacency relationship, etc. spatial information; In machine learning, data sets are usually divided into training sets and validation sets, with the training set used to train the model and the validation set used to evaluate the model performance; common division ratios are 80% (training set) and 20% (validation set); LLaMA (Large Language Model Meta AI) is a pre-trained large language model provided by Meta; 8B indicates that the model has 80 billion parameters; 8-bit quantization is the process of converting floating-point parameters to 8-bit integers, which can reduce the storage requirements of the model and improve inference speed; To adapt to specific tasks or data sets, a low-rank adaptation layer (LoRA, Low-Rank Adaptation) can be injected into the pre-trained model; rank 64 means that a 64-dimensional adaptation layer is added to the model to improve the performance of specific tasks.

[0031] In an optional embodiment, the spatial connection graph is converted into an adjacency matrix, the area parameter is converted into a normalized area vector, and a structured text description is generated in combination with the standardized spatial data set, including: All region nodes in the spatial connection graph are traversed, and each region node is assigned a unique identifier. It is determined whether there is a connection relationship between any two region nodes. If there is a connection relationship, it is marked as a first value, and if there is no connection relationship, it is marked as a second value. The first value and the second value are filled into the corresponding matrix position with the region node identifier as the matrix row and column index to generate a spatial adjacency matrix. The area parameters of each region are numerically standardized to obtain a normalized area vector. The spatial adjacency matrix is subjected to dimension expansion processing to convert the two-dimensional matrix into a one-dimensional matrix vector. The one-dimensional matrix vector and the normalized area vector are element-level spliced to obtain a spatial comprehensive feature. The parameter mapping rule corresponding to the spatial comprehensive feature is extracted from the standardized spatial data set. The parameter mapping rule includes the correspondence between the feature value and the text description. Each feature value in the spatial comprehensive feature is traversed, and the corresponding text expression fragment is matched according to the parameter mapping rule. According to the preset text structure template, the text expression fragments are logically integrated and sequentially arranged to generate a structured text description of the indoor space.

[0032] It should be noted that each room or region in the spatial connection graph is regarded as a node, and the connection relationship in the graph constitutes the edge of the graph. Each region node is assigned a unique number or symbol, usually represented by an integer or a string. It is determined whether any two rooms are adjacent or connected. If there is a connection between them (such as sharing walls, doorways, etc.), it is marked as "first value". Otherwise, it is marked as "second value". Assuming that rooms A and B are adjacent, B and C are adjacent, and C and D are adjacent, the connection relationship is as follows: Room A is adjacent to Room B → 1 (first value), Room B is adjacent to Room C → 1 (first value), Room C is adjacent to Room D → 1 (first value), Room A is not adjacent to Room C → 0 (second value), Room A is not adjacent to Room D → 0 (second value), and Room B is not adjacent to Room D → 0 (second value). According to each feature value in the spatial comprehensive feature, the mapping rule is found and the corresponding text description is generated. Example: for feature value 0 (room A), generate text according to mapping rule: "Room A is small in area;", for feature value 1 (connection relationship), generate text: "Room A and Room B are adjacent;", combine all text descriptions in logical order to form a complete structured description, usually arranged according to room information (area, connection relationship, etc.).

[0033] In an optional embodiment, a house type feature of a target indoor space is input into a space constraint generation model, and an indoor space structured partition constraint conforming to a preset standard is output, including: extracting a house type feature of the target indoor space, wherein the house type feature includes a number of rooms, an area proportion of each room, and a connection relationship between rooms; converting the house type feature into a model input format, and inputting the space constraint generation model; the model outputs a structured text conforming to an FPDJson standard, wherein the structured text includes a partition function constraint, an area proportion constraint, and a channel connection constraint; performing format verification on the output structured text, and determining the indoor space structured partition constraint after passing the verification.

[0034] The embodiments of the present application are described in detail above in combination with the drawings, but the present application is not limited thereto, and various changes can be made within the knowledge of those skilled in the art without departing from the spirit of the present application.

Claims

1. A method for generating structured zoning constraints for indoor spaces based on a language model, characterized in that, include: Obtain a four-channel vector floor plan of the target indoor space and a reference space dataset, wherein the four-channel vector floor plan includes the outline information of multiple rooms, and the reference space dataset includes room parameters and connection relationship data of various apartment types; The polygon vertex coordinates of each room are extracted from the four-channel vector floor plan using a contour tracing algorithm to obtain an initial vertex dataset. The initial vertex dataset and the baseline spatial dataset are preprocessed to remove redundant vertices and standardize the coordinates to obtain a standardized vertex dataset and a standardized spatial dataset. Based on the standardized vertex dataset, the area parameters of each room are calculated, all room pairs are traversed, and the boundary distance parameters between rooms are calculated according to the vertex coordinates to obtain a set of spatial feature parameters. The boundary distance parameters in the spatial feature parameter set are determined according to a preset distance threshold. A connection relationship is established between room pairs whose boundary distance parameters are less than or equal to the threshold, and a spatial connection map is generated. The spatial connectivity map, the area parameters, and the standardized spatial dataset are transformed into model training samples. A pre-trained language model is loaded and a low-rank adaptation layer is injected. The model is trained using an autoregressive approach to obtain a spatial constraint generation model. The floor plan features of the target indoor space are input into the spatial constraint generation model, and the output is a structured zoning constraint of the indoor space that conforms to the preset standard. The floor plan features include the number of rooms, area ratio, and connection relationship.

2. The method for generating structured zoning constraints for indoor spaces based on a language model according to claim 1, characterized in that, The polygon vertex coordinates of each room are extracted from the four-channel vector floor plan using a contour tracing algorithm to obtain an initial vertex dataset, including: Calculate the gray-level histogram of the target channel image and determine the gray-level peak range in the gray-level histogram; The gray-level stretching range is set based on the gray-level peak range, and gray-level stretching processing is performed on the target channel image. Adaptive contrast enhancement is performed on the grayscale stretched image to strengthen the grayscale difference between the room area and the background area, resulting in an enhanced target channel image. An eight-neighbor contour tracing algorithm is used to perform contour traversal on the target channel image and record the pixel coordinates of the room contour. Polygon fitting is performed on the recorded pixel coordinates to obtain the initial polygon vertex coordinates of each room; The initial polygon vertex coordinates of all rooms are stored according to room category, forming an initial vertex dataset.

3. The method for generating structured zoning constraints for indoor spaces based on a language model according to claim 2, characterized in that, An eight-neighbor contour traversal algorithm is used to perform contour traversal on the target channel image, recording the pixel coordinates of the room contour, including: Calculate the grayscale histogram of the target channel image, determine the grayscale peak range in the grayscale histogram, set the grayscale stretching range based on the grayscale peak range, and perform grayscale stretching processing on the target channel image. Adaptive contrast enhancement is performed on the grayscale stretched image to strengthen the grayscale difference between the room area and the background area, resulting in an enhanced target channel image. In the enhanced target channel image, the starting pixel of the contour is determined, which is the boundary pixel between the room region and the background region; Using the starting pixel as the center, the adjacent pixels are traversed using an eight-neighbor search method to determine whether the adjacent pixels belong to the room outline pixels. Record the coordinates of all pixels that are identified as part of the room outline to form the initial set of pixels for the room outline; Calculate the distance deviation between each pixel in the initial pixel set and its neighboring pixels, set a distance deviation threshold, remove pixels whose distance deviation exceeds the set distance deviation threshold, and retain pixels whose distance deviation is within the set distance deviation threshold to form an effective pixel set that conforms to the room outline features; Sort the coordinates of the pixels in the set of valid pixels in a clockwise direction; Calculate the coordinate difference between adjacent pixels after sorting, and determine the connection order of the pixels based on the coordinate difference; Arrange the pixel coordinates sequentially according to the connection order to construct the pixel coordinate sequence of the room outline; The continuity of the pixel coordinate sequence is checked, and missing contour pixels are added to obtain a complete set of room contour pixel coordinates.

4. The method for generating structured zoning constraints for indoor spaces based on a language model according to claim 3, characterized in that, The continuity of the pixel coordinate sequence is checked, and missing contour pixels are added to obtain a complete set of room contour pixel coordinates, including: Traverse the sequence of pixel coordinates and calculate the coordinate interval between two adjacent pixels; When the coordinate interval exceeds the preset interval threshold, it is determined that there are missing contour pixels, and the coordinates of the missing pixels are generated based on the coordinate trend of adjacent pixels. The coordinates of the missing pixels are inserted into the pixel coordinate sequence to form a complete set of pixel coordinates for the room outline.

5. The method for generating structured zoning constraints for indoor spaces based on a language model according to claim 4, characterized in that, The initial vertex dataset and the baseline space dataset are preprocessed by removing redundant vertices and standardizing the coordinates to obtain a standardized vertex dataset and a standardized space dataset, including: Collinearity detection is performed on the vertex coordinates in the initial vertex dataset, and collinear redundant vertices are removed; Outlier values ​​are removed from the room parameters in the baseline spatial dataset, and parameter data that meets the preset range are retained; The processed initial vertex dataset and reference space dataset are normalized to obtain a normalized vertex dataset and a normalized space dataset.

6. The method for generating structured zoning constraints for indoor spaces based on a language model according to claim 5, characterized in that, Based on the standardized vertex dataset, the area parameters of each room are calculated. All room pairs are traversed, and the boundary distance parameters between rooms are calculated based on the vertex coordinates, resulting in a set of spatial feature parameters, including: Based on the room vertex coordinates in the standardized vertex dataset, the area parameters of each room are calculated using the polygon area calculation formula. Traverse all room pairs, extract the coordinates of the boundary vertices of each room pair, and calculate the Manhattan distance between the boundary vertices; Use the minimum Manhattan distance of each room pair as the boundary distance parameter for that room pair; The area parameters of all rooms and the boundary distance parameters of all room pairs are integrated to form a set of spatial feature parameters.

7. The method for generating structured zoning constraints for indoor spaces based on a language model according to claim 6, characterized in that, Based on a preset distance threshold, the boundary distance parameters in the spatial feature parameter set are determined, and connection relationships are established for room pairs whose boundary distance parameters are less than or equal to the threshold, generating a spatial connection map, including: The preset distance threshold is determined based on the type of the benchmark spatial dataset, where the threshold for the first type of dataset is 8 and the threshold for the second type of dataset is 2. The boundary distance parameters in the spatial feature parameter set are compared with the corresponding preset distance thresholds; Room pairs whose boundary distance parameter is less than or equal to a preset distance threshold are marked as associated room pairs; Rooms are represented by circles, and the connections between related room pairs are represented by edges. A spatial connection map is constructed and generated.

8. The method for generating structured zoning constraints for indoor spaces based on a language model according to claim 7, characterized in that, The spatial connectivity map, the area parameters, and the standardized spatial dataset are transformed into model training samples. A pre-trained language model is loaded and a low-rank adaptation layer is injected. The model is trained using an autoregressive approach to obtain a spatially constrained generation model, including: The spatial connectivity graph is transformed into an adjacency matrix, the area parameter is transformed into a normalized area vector, and a structured text description is generated by combining the standardized spatial dataset. The structured text description is divided into a training set and a validation set according to a preset ratio; Load the pre-trained LLaMA3-8B model of HuggingFace, perform 8-bit quantization, and inject a low-rank adaptation layer with a rank of 64; Using the training set as input, the model is trained using an autoregressive approach. The model performance is evaluated and parameters are adjusted using the validation set until the model converges, resulting in a spatially constrained generative model.

9. The method for generating structured zoning constraints for indoor spaces based on a language model according to claim 8, characterized in that, The process includes converting the spatial connectivity graph into an adjacency matrix, converting the area parameter into a normalized area vector, and generating a structured text description based on the standardized spatial dataset, including: Traverse all region nodes in the spatial connectivity graph and assign a unique identifier to each region node; determine whether there is a connection between any two region nodes. If there is a connection, mark it with the first value; if there is no connection, mark it with the second value; use the identifier of the region node as the matrix row and column index, fill the first value and the second value into the corresponding matrix positions, and generate a spatial adjacency matrix. The area parameters of each region are numerically standardized to obtain a normalized area vector; The spatial adjacency matrix is ​​expanded to convert the two-dimensional matrix into a one-dimensional matrix vector. The one-dimensional matrix vector is then concatenated with the normalized area vector element-wise to obtain the spatial comprehensive features. Extract parameter mapping rules corresponding to spatial comprehensive features from a standardized spatial dataset. The parameter mapping rules include the correspondence between feature values ​​and text descriptions. Iterate through each feature value in the spatial comprehensive features and match the corresponding text description fragments according to the parameter mapping rules; Following a preset text structure template, the various text fragments are logically integrated and arranged in sequence to generate a structured text description of the interior space.

10. The method for generating structured zoning constraints for indoor spaces based on a language model according to claim 9, characterized in that, The floor plan features of the target interior space are input into the spatial constraint generation model, and the output is a structured zoning constraint of the interior space that conforms to a preset standard, including: Extract the floor plan features of the target interior space, wherein the floor plan features include the number of rooms, the area ratio of each room, and the connection relationship between the rooms; The apartment layout features are converted into a model input format, and the spatial constraints are input to generate a model. The model outputs structured text conforming to the FPDJson standard, wherein the structured text includes partitioning functional constraints, area ratio constraints, and channel connection constraints. The output structured text is formatted and validated. If the validation is successful, it is determined to be an interior space structured zoning constraint.