Room layout generation method, electronic device, and storage medium
By generating multiple initial layout results from a large model and making corrections, merging adjacent item areas, adjusting types and directions, and filtering out the target layout result, the problem of efficiency and personalization in room layout design in existing technologies is solved, and efficient and accurate room layout generation is achieved.
Patent Information
- Application Number
- CN202611476422.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-21
- Publication Date
- 2026-11-24
AI Technical Summary
Existing technologies cannot simultaneously meet the needs of high efficiency, mass production, and personalization in room layout design. Manual layout relies on the designer's experience and is highly uncertain, while automatic layout based on business rules has a single output and high iteration costs, making it difficult to adapt to the rapidly changing business pace.
Multiple initial layout results are generated using a large model. Through object detection and correction techniques, adjacent item areas are merged, item types and orientations are adjusted, and multi-dimensional scoring is used to select the target layout result.
It improves the efficiency and accuracy of room layout generation, reduces the occurrence of unreasonable locations and types, meets users' personalized needs, and enhances user experience and satisfaction.
Smart Images

Figure CN123158759A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to a method for generating room layouts, an electronic device, and a storage medium. Background Technology
[0002] Currently, there is an increasing demand for room layout design in both residential and commercial settings, which also places higher demands on design cycles and the personalization and rationality of solutions.
[0003] The relevant technologies for room layout design are based on the following methods: First, manual layout. Since manual layout relies on the designer's personal experience and professional skills, it is inherently uncertain and difficult to meet the industry's demand for large-scale, high-efficiency design. Second, automatic layout based on business rules. This method outputs relatively uniform layout results, making it difficult to meet the increasingly personalized needs of homeowners. For complex layout scenarios, this method has limited adaptability. Furthermore, the iteration cost and cycle of business rules are high, making it difficult to adapt to the rapidly changing pace of business operations. Summary of the Invention
[0004] This disclosure provides a method for generating room layouts, an electronic device, and a storage medium.
[0005] According to one aspect of this disclosure, a method for generating room layouts is provided, comprising: Obtain the floor plan information of the target room; Based on the apartment layout information, multiple initial layout results are generated for the target room, and the initial layout results include the initial occupancy area corresponding to each item in the target room; Target detection is performed on each of the initial occupancy areas to obtain the initial type corresponding to each initial occupancy area; the initial occupancy areas and initial types in each initial layout result are corrected to obtain the candidate layout results corresponding to each initial layout result; the target layout result is selected from multiple candidate layout results.
[0006] According to at least one embodiment of this disclosure, the initial occupancy area and the initial type in each of the initial layout results are modified to obtain candidate layout results corresponding to each of the initial layout results, including: For each initial layout result, each initial occupancy area is modified to obtain the target occupancy area of each initial occupancy area; the initial type of each target occupancy area is modified to obtain the target type of each target occupancy area.
[0007] According to at least one embodiment of this disclosure, for each initial layout result, each initial occupancy area is modified to obtain a target occupancy area for each initial occupancy area, including: Extract the outer contour of each initial occupant region, the outer contour including multiple normalized coordinates; determine candidate occupant regions for each initial occupant region based on the outer contour of each initial occupant region; for each candidate occupant region, if the initial type of the candidate occupant region is sofa, and the initial type of another candidate occupant region adjacent to the candidate occupant region is sofa, then merge the candidate occupant region and the other candidate occupant region to obtain a target occupant region, and determine the candidate direction of the target occupant region based on the candidate occupant region and the other candidate occupant region; or, if the initial type of the candidate occupant region is not sofa, then determine the candidate occupant region as the target occupant region, and determine the candidate direction of the target occupant region based on multiple vertices of the target occupant region.
[0008] According to at least one embodiment of this disclosure, determining candidate occupancy regions for each of the initial occupancy regions based on the outer contour of each initial occupancy region includes: Each normalized coordinate is converted into an actual coordinate; a placeholder rectangle is calculated based on the multiple actual coordinates corresponding to each initial placeholder area; and the placeholder rectangle corresponding to each initial placeholder area is normalized to obtain a candidate placeholder area.
[0009] According to at least one embodiment of this disclosure, if the initial type of the candidate occupant area is a sofa, and the initial type of an adjacent candidate occupant area is also a sofa, then the two adjacent candidate occupant areas are merged to obtain the target occupant area, including: For each room of the target living area, when two adjacent candidate occupancy areas are perpendicular to each other, the adjacency rectangle of the two adjacent candidate occupancy areas is obtained; the blank area is removed from the adjacency rectangle to obtain the target occupancy area, wherein the blank area has no intersection with the two adjacent candidate occupancy areas; or, when two adjacent candidate occupancy areas are parallel to each other, the adjacency rectangle of the two adjacent candidate occupancy areas is obtained, and the adjacency rectangle is the target occupancy area.
[0010] According to at least one embodiment of this disclosure, determining a candidate direction for the target occupancy region based on the candidate occupancy region and the other candidate occupancy region includes: Obtain a first area of the candidate occupant region and a second area of the other candidate occupant region; if the first area is greater than the second area, determine the direction of the candidate occupant region as the candidate direction; if the second area is greater than the first area, determine the direction of the other candidate occupant region as the candidate direction; if the first area is equal to the second area, determine the direction of the candidate occupant region as the candidate direction.
[0011] According to at least one embodiment of this disclosure, determining the target direction based on the candidate directions includes: The target occupant area is moved a preset distance along the candidate direction to obtain an updated occupant area; the first overlap area between the updated occupant area and the room area is calculated, where the room area is the area of the room where the target occupant area is located, and the target room includes at least one of the rooms; the first overlap area and the area of the updated occupant area are calculated to obtain a first overlap rate; if the first overlap rate is not less than the overlap rate threshold, then the candidate direction is the target direction; Alternatively, if the first overlap rate is less than the overlap rate threshold, the candidate direction is changed to obtain the target direction, which is opposite to the candidate direction; based on the target direction, the initial arrangement order of all vertices of the target occupancy region is adjusted to obtain the target arrangement order.
[0012] According to at least one embodiment of this disclosure, the initial type of each of the target occupant regions is modified to obtain the target type of each of the target occupant regions, including: For each target occupant area, obtain the initial size and initial type of the target occupant area; select the corresponding type condition based on the initial size; if the initial size satisfies the type condition, then the initial type is the target type; or, if the initial size does not satisfy the type condition, then change the initial type to obtain the target type.
[0013] According to at least one embodiment of this disclosure, the method further includes: For each target space, obtain the target type and initial aspect ratio corresponding to the target space; select the corresponding aspect ratio condition based on the target type; if the initial aspect ratio of the target space does not meet the aspect ratio condition, adjust the length and width of the target space to obtain the target aspect ratio.
[0014] According to at least one embodiment of this disclosure, the method further includes: When the target type of the target occupancy area is a dining table, and the dining table is rectangular, the length of each edge of the table and the size of the dining chair are obtained; for each edge of the table, the number of dining chairs matching the edge and the spacing between adjacent dining chairs are determined based on the length of the edge of the table and the size of the dining chair; the center point coordinates of each dining chair are determined based on the number of dining chairs and the spacing between the dining chairs; for each dining chair, the dining chair is generated using the center point coordinates corresponding to the dining chair.
[0015] According to at least one embodiment of this disclosure, the method further includes: When the target type of the target occupancy area is a dining table, and the dining table is circular, calculate the perimeter of the dining table; determine the number of dining chairs based on the perimeter and a preset edge distance; determine the spacing angle between adjacent dining chairs based on the number of dining chairs; calculate the center point coordinates and area ratio of each dining chair, where the area ratio is the ratio of the area of the dining chair within the room area to the area of the dining chair, the room area being the area of the room where the target occupancy area is located, and the target room includes multiple rooms; for each dining chair, if the center point coordinates are within the room area and the area ratio is not less than the area ratio threshold, then generate the dining chair with the center point coordinates as the center.
[0016] According to at least one embodiment of this disclosure, selecting a target layout result from a plurality of candidate layout results includes: Occlusion detection, size detection, and position detection are performed on each candidate layout result to obtain a score result; based on the score result of each candidate layout result, the target layout result is selected from multiple candidate layout results.
[0017] According to another aspect of this disclosure, an electronic device is provided, comprising: a memory storing execution instructions; and a processor executing the execution instructions stored in the memory, causing the processor to perform a room layout generation method according to any embodiment of this disclosure.
[0018] According to another aspect of this disclosure, a readable storage medium is provided, wherein executable instructions are stored therein, which, when executed by a processor, are used to implement the room layout generation method of any embodiment of this disclosure. Attached Figure Description
[0019] The accompanying drawings illustrate exemplary embodiments of the present disclosure and, together with the description thereof, serve to explain the principles of the present disclosure. These drawings are included to provide a further understanding of the present disclosure and are incorporated in and constitute a part of this specification.
[0020] Figure 1 This is a schematic diagram of the overall process of a room layout generation method according to one embodiment of the present disclosure.
[0021] Figure 2 This is a schematic diagram of a sample floor plan of one embodiment of this disclosure.
[0022] Figure 3 This is a schematic diagram of a process for correcting each initial layout result according to one embodiment of the present disclosure.
[0023] Figure 4 This is a schematic diagram illustrating the process of modifying the initial occupancy area of each item according to one embodiment of this disclosure.
[0024] Figure 5 This is a schematic diagram of a process for determining candidate occupant regions for each initial occupant region based on the outer contour of each initial occupant region according to one embodiment of the present disclosure.
[0025] Figure 6 This is a schematic diagram of a process for merging adjacent candidate space regions to obtain a target space region according to one embodiment of the present disclosure.
[0026] Figure 7 This is a schematic diagram of the target occupant area according to one embodiment of the present disclosure.
[0027] Figure 8 This is a schematic diagram of the target occupant area according to another embodiment of this disclosure.
[0028] Figure 9 This is a schematic flowchart illustrating a method for determining the candidate direction of a target occupant region based on a candidate occupant region and another candidate occupant region, according to one embodiment of this disclosure.
[0029] Figure 10 This is a schematic diagram of the first side of an L-shaped target occupant area according to one embodiment of this disclosure.
[0030] Figure 11 This is a schematic diagram of a process for determining a target direction based on a candidate direction according to one embodiment of the present disclosure.
[0031] Figure 12 This is a flowchart illustrating an embodiment of the present disclosure of determining the target direction of a target occupant region based on multiple vertices of the target occupant region.
[0032] Figure 13 This is a schematic diagram of the first side of a rectangular target occupant area according to one embodiment of this disclosure.
[0033] Figure 14 This is a flowchart illustrating another embodiment of the present disclosure of modifying the initial type of each target occupant area to obtain the target type of each target occupant area.
[0034] Figure 15 This is a schematic flowchart illustrating the process of determining a target size according to one embodiment of this disclosure.
[0035] Figure 16 This is a schematic diagram of the process for generating a dining chair according to one embodiment of the present disclosure.
[0036] Figure 17 This is a schematic diagram of the process for generating a dining chair according to another embodiment of this disclosure.
[0037] Figure 18 This is a schematic diagram of a process for selecting a target layout result from multiple candidate layout results according to one embodiment of the present disclosure.
[0038] Figure 19 This is a schematic structural block diagram of an electronic device according to one embodiment of the present disclosure. Detailed Implementation
[0039] The present disclosure will now be described in further detail with reference to the accompanying drawings and examples. It should be understood that the specific examples described herein are for illustrative purposes only and are not intended to limit the scope of the disclosure. Furthermore, it should be noted that, for ease of description, only the parts relevant to the present disclosure are shown in the accompanying drawings.
[0040] It should be noted that, where there is no conflict, the embodiments and features described in this disclosure can be combined with each other. The technical solutions of this disclosure will now be described in detail with reference to the accompanying drawings and embodiments.
[0041] In related technologies, room layout solutions, whether using manual layout or automatic layout based on business rules, are difficult to simultaneously take into account design efficiency, design quality, and users' personalized needs, thus greatly reducing user experience and satisfaction.
[0042] To address this, the present disclosure proposes the following technical solution: The apartment layout information is input into a large model, which outputs multiple initial layout results at once, covering a wider range of scenarios and more closely resembling real-world conditions. This significantly improves the efficiency of generating room layouts. Furthermore, each initial layout result is corrected to obtain the corresponding target layout result, thereby greatly reducing the probability of issues such as unreasonable item placement and obstruction, and ultimately significantly improving user experience and satisfaction.
[0043] To facilitate description and make the technical solutions of this disclosure easier to understand, the terminology of this disclosure will be explained before describing the technical solutions of this disclosure.
[0044] 1. First Model: Used to generate the initial placement area for each item in the target room based on the apartment layout information. For example, the 2D U-shaped network model (Unet2DModel) has advantages such as high scene adaptability, accurate determination of the initial placement area, fast speed, easy training, and high engineering usability.
[0045] 2. Second model: Used to perform object detection on each initial occupancy region, obtain the initial type corresponding to each initial occupancy region, and extract the outer contour corresponding to each initial occupancy region. For example, the single-stage object detection model (YouOnly Look Once version, YOLO) has the advantages of fast inference speed, easy training, and high matching degree with the first model.
[0046] Figure 1 This is a schematic diagram illustrating the overall process of a room layout generation method according to one embodiment of this disclosure. Figure 1 As shown, the method includes steps S101 to S105. This method can be executed by a server.
[0047] In step S101, the floor plan information of the target room is obtained.
[0048] The target room refers to the house or room that requires layout design; it can be an entire apartment or a single room. Examples include the living room, dining room, and bedroom. Floor plan information refers to the spatial structure information of the target room, including at least the wall boundaries, room divisions, room dimensions, and door and window locations. Floor plan information can be obtained in various ways, including but not limited to user-uploaded floor plan files, calling the Building Information Modeling (BIM) interface, and receiving floor plan parameters manually entered by the user on the display interface. For example, a floor plan is a two-dimensional plan from a top-down perspective, annotating different rooms and the furniture, walls, doors, and windows within those rooms. Examples include the living room, dining room, bathroom, sofa in the living room, and bed in the bedroom.
[0049] In step S102, multiple initial layout results for the target room are generated based on the apartment type information.
[0050] The initial layout results include the initial occupancy areas for each item in the target room. Multiple initial layout results differ in the specific locations and types of items, thus increasing the diversity of layout schemes. Items refer to furniture, appliances, and other objects that need to be placed in the target room, including but not limited to sofas, dining tables, coffee tables, desks, wardrobes, beds, and televisions. The initial occupancy area refers to the two-dimensional planar area occupied by an item in the target room. The floor plan information is input into the trained first model, which outputs the initial occupancy area for each item in the target room. The initial occupancy area is represented by a rectangle. Each initial occupancy area includes its location coordinates and length and width dimensions. The first model uses the spatial structure of the target room in the floor plan, such as walls, doors, and windows, as constraints, combined with the functions of each room in the target room (e.g., living room, dining room, bedroom, bathroom), to predict the items that need to be placed in each room, as well as the location and area occupied by each item.
[0051] In step S103, target detection is performed on each initial occupancy region to obtain the initial type corresponding to each initial occupancy region.
[0052] Here, the initial type refers to the category of the item corresponding to the initial occupant area, such as sofa, dining table, wardrobe, etc. For each initial occupant area, the trained second model is used to identify the corresponding image region and output the initial type of the item corresponding to that initial occupant area.
[0053] For both the first and second models, training is performed in advance. Specifically, a large number of floor plans are acquired and cleaned multiple times to obtain multiple sample floor plans. The multiple cleaning processes remove floor plans with issues such as doors and windows detached from walls, missing important items, or items exceeding boundaries. Irregularly shaped furniture in the retained floor plans is processed, adjacent rectangles are merged, rooms are marked, and items are repositioned and scaled, thereby improving the training performance of both the first and second models.
[0054] Figure 2 This is a schematic diagram of a sample floor plan of one embodiment of this disclosure.
[0055] like Figure 2 As shown, after cleaning up the floor plan, a sample floor plan is obtained. In this diagram, A indicates that the showerhead has been enlarged and positioned against the wall. B indicates that the bathroom has been marked. C indicates that the cabinets have been merged. D indicates that the irregularly shaped cabinets have been disassembled.
[0056] In step S104, the initial occupancy area and initial type in each initial layout result are corrected to obtain the candidate layout result corresponding to each initial layout result.
[0057] The candidate layout result refers to the layout scheme obtained after correcting the initial occupying area of items and the initial type of the initial occupying area in the initial layout result. The correction process mainly corrects unreasonable content in the output of the large model in steps S102 and S103. For example, the initial occupying area is irregular, the type is incorrectly determined, or the size does not conform to common furniture specifications, thus obtaining the candidate layout result. Therefore, the candidate layout result has higher rationality and accuracy than the initial layout result.
[0058] In step S105, the target layout result is selected from multiple candidate layout results.
[0059] The target layout result refers to the final layout scheme of the target room delivered to the user. Each candidate layout result is scored across multiple dimensions, and the one with the highest score is selected as the target layout result.
[0060] The above technical solution outputs multiple different initial layout results, greatly improving the efficiency of layout result generation. The initial layout results are then corrected to obtain more reasonable and accurate candidate layout results. Finally, the target layout result is selected from these candidate results, satisfying users' personalized needs and improving user experience and satisfaction.
[0061] Figure 3 This is a schematic diagram illustrating the process of correcting each initial layout result according to one embodiment of this disclosure. Figure 3 As shown, the method includes steps S301 to S302.
[0062] In step S301, for each initial layout result, each initial occupancy area is corrected to obtain the target occupancy area for each initial occupancy area.
[0063] The initial placeholder area is represented by a rectangle, which includes the position of the rectangle in the initial layout result as well as the length and width of the rectangle.
[0064] In step S302, the initial type of each target occupant area is modified to obtain the target type of each target occupant area.
[0065] The above technical solution corrects the initial occupancy area and initial type in the initial layout result. Compared with directly outputting the initial layout result, it can correct unreasonable positions, sizes and types in the initial layout result, thereby improving the rationality of the final output target layout result.
[0066] Figure 4 This is a schematic diagram illustrating the process of modifying the initial occupancy area of each item according to one embodiment of this disclosure. Figure 4As shown, the method includes steps S401 to S404.
[0067] In step S401, the outer contour of each initial occupancy area is extracted.
[0068] The outer contour includes multiple normalized coordinates.
[0069] The outer contour refers to the outer perimeter of the initial placement area of an item in the floor plan, including multiple normalized coordinates arranged along the perimeter of the initial placement area. The x and y coordinates of the normalized coordinates range from 0 to 1. Normalized coordinates resolve the issue of dimensional differences between different initial layout results.
[0070] In step S402, candidate occupancy regions for each initial occupancy region are determined based on the outer contour of each initial occupancy region.
[0071] Among them, the candidate occupancy area refers to the standard rectangular occupancy area obtained after the initial occupancy area of the item is preliminarily regularized.
[0072] In step S403, for each candidate occupancy area, if the initial type of the candidate occupancy area is sofa, and the initial type of another candidate occupancy area adjacent to the candidate occupancy area is sofa, then the candidate occupancy area and the other candidate occupancy area are merged to obtain the target occupancy area.
[0073] In step S404, the candidate direction of the target occupancy region is determined based on the candidate occupancy region and another candidate occupancy region.
[0074] In this context, two adjacent candidate occupant areas refer to two candidate occupant areas in the initial layout result that are less than the adjacent threshold. For example, the adjacent threshold can be set to 1 centimeter.
[0075] In other examples, if the initial type of the candidate placeholder is not a sofa, the candidate placeholder is determined as the target placeholder, and the candidate direction of the target placeholder is determined based on multiple vertices of the target placeholder.
[0076] The above technical solution, by employing different processing methods for candidate placement areas of different initial types, can merge adjacent sofas into L-shaped sofas or extended sofas. Simultaneously, it preserves regularized rectangular placement areas for other candidate placement areas, thereby eliminating redundant or unreasonable areas in the initial placement areas while ensuring the rationality of item placement.
[0077] Figure 5 This is a schematic diagram illustrating the process of determining candidate occupant regions for each initial occupant region based on the outer contour of each initial occupant region, according to one embodiment of this disclosure. Figure 5As shown, the method includes steps S501 to S503.
[0078] In step S501, each normalized coordinate is converted into an actual coordinate.
[0079] Here, the actual coordinates are the coordinates in the coordinate system corresponding to the initial layout result. For each normalized coordinate, it is converted into actual coordinates based on the scaling and translation factors. For example, a normalized coordinate can be represented as (p_x, p_y), and the actual coordinates can be represented as (x, y). The normalized coordinate can be converted into actual coordinates based on the following formula: x = p_x ×s + x_min, y = p_y×s + y_min.
[0080] Where s is the maximum size of the shorter side in the actual scene corresponding to the initial layout result, x_min is the actual minimum x-coordinate corresponding to the normalized coordinate range in the initial layout result, and y_min is the actual minimum y-coordinate corresponding to the normalized coordinate range in the initial layout result. If the lower left corner of the initial layout result is aligned with the actual coordinate origin, then x_min and y_min are both 0.
[0081] In step S502, the occupancy rectangle is calculated based on multiple actual coordinates corresponding to each initial occupancy area.
[0082] The placeholder rectangle is the smallest rectangle that completely contains all the actual coordinates. Specifically, the minimum x-coordinate of all actual coordinates of the outer contour is used as the left boundary of the rectangle, and the maximum x-coordinate is used as the right boundary. The minimum y-coordinate is used as the bottom boundary, and the maximum y-coordinate is used as the top boundary. The placeholder rectangle is determined based on the left, right, top, and bottom boundaries.
[0083] The x-coordinate C_x of the center point of the placeholder rectangle can be calculated using the following formula: C_x = (x_min_box + x_max_box) / 2. Where x_min_box is the x-coordinate of the left boundary point of the placeholder rectangle, and x_max_box is the x-coordinate of the right boundary point of the placeholder rectangle.
[0084] The ordinate C_y of the center point of the placeholder rectangle can be calculated using the following formula: C_y = (y_min_box + y_max_box) / 2.
[0085] Where y_min_box is the ordinate of the lower boundary point of the placeholder rectangle, and y_max_box is the ordinate of the upper boundary point of the placeholder rectangle.
[0086] The center point coincides with the center point of the initial placement area, so as to obtain a rectangular placement area while keeping the position of the item roughly unchanged.
[0087] It should be noted that the terms "up," "down," "left," and "right" used in this disclosure are relative and will change depending on the coordinate system.
[0088] In step S503, the occupancy rectangles corresponding to each initial occupancy area are regularized to obtain candidate occupancy areas.
[0089] The regularization process refers to adjusting the length and width of the placeholder rectangle to integer multiples of its length and width.
[0090] The placeholder rectangles corresponding to each initial placeholder area can be rounded using the following formulas: L_new = 5 × round(L_raw / 5), W_new = 5 × round(W_raw / 5). Where L_raw is the length of the placeholder rectangle corresponding to the initial placeholder area, and W_raw is the width. round() is the rounding function. L_new is the length of the candidate placeholder area, and W_new is the width of the candidate placeholder area.
[0091] The above technical solution solves the problems of irregular shape and size deviation in the initial occupancy area output by the model, and obtains a candidate occupancy area with good engineering adaptability.
[0092] Figure 6 This is a schematic diagram illustrating a process of merging adjacent candidate spacer regions to obtain a target spacer region, according to one embodiment of this disclosure. Figure 6 As shown, the method includes steps S601 to S602.
[0093] In step S601, for each room of the target room, when two adjacent candidate occupancy areas are perpendicular to each other, the adjacency rectangle of the two adjacent candidate occupancy areas is obtained.
[0094] In this context, an adjacency rectangle refers to the smallest bounding rectangle that can simultaneously contain two adjacent candidate occupant regions. The positional relationship between two candidate occupant regions can be mutually perpendicular, mutually parallel, or neither mutually perpendicular nor parallel.
[0095] For example, if one candidate spacer is placed horizontally and the other is placed vertically, then they are perpendicular to each other. If both candidate spacers are placed horizontally and have the same or opposite orientations, then they are parallel to each other.
[0096] In step S602, blank areas are removed from adjacent rectangles to obtain the target occupancy area.
[0097] The blank area has no intersection with either of the two adjacent candidate occupancy areas.
[0098] The blank area refers to the portion of the adjacent rectangle that does not intersect with either of the two adjacent candidate spacers. The blank area is subtracted from the adjacent rectangle using a difference operation to obtain the L-shaped target spacer area.
[0099] Figure 7 This is a schematic diagram of the target occupant area according to one embodiment of the present disclosure.
[0100] like Figure 7 As shown, the target space includes a first candidate spacer region and a second candidate spacer region, with the two adjacent candidate spacer regions being perpendicular to each other. The adjacent rectangles of these two candidate spacer regions are obtained, and the blank areas are removed to obtain an L-shaped target spacer region.
[0101] In some other examples, when two adjacent candidate placeholder areas are parallel to each other, the adjacency rectangle of the two adjacent candidate placeholder areas is obtained, and the adjacency rectangle is the target placeholder area.
[0102] Parallelism indicates that two candidate placement areas are nearly collinear; for example, two candidate placement areas are placed side by side in a collinear direction. Consider the two candidate placement areas as a long, rectangular sofa; the adjacent rectangle is the merged overall rectangle, and the adjacent rectangle itself is the target placement area.
[0103] Figure 8 This is a schematic diagram of the target occupant area according to another embodiment of this disclosure.
[0104] like Figure 8 As shown, there are two candidate placeholder areas, a first and a second, which are parallel to each other. The adjacent rectangles of these two candidate placeholder areas are then obtained, which is the target placeholder area.
[0105] In other examples, when two adjacent candidate occupant regions are neither perpendicular nor parallel to each other, the two adjacent candidate occupant regions are not merged, but are corrected separately like other candidate occupant regions.
[0106] The above technical solution selects different merging methods for two adjacent candidate occupancy areas according to their corresponding positional relationship, so as to avoid the problem of visual disharmony caused by two small sofas being placed independently.
[0107] Figure 9 This is a schematic flowchart illustrating a method for determining the candidate direction of a target occupant region based on a candidate occupant region and another candidate occupant region, according to one embodiment of this disclosure. Figure 9 As shown, the method includes steps S901 to S902.
[0108] In step S901, the first area of the candidate occupant region and the second area of the other candidate occupant region are obtained.
[0109] Wherein, the first area and the second area are the areas of the rectangular regions of the first candidate occupancy area and the second candidate occupancy area, respectively.
[0110] In step S902, if the first area is larger than the second area, the direction of the candidate occupancy area is determined as the candidate direction.
[0111] In other examples, if the second area is larger than the first area, the direction of the other candidate placeholder area is determined as the candidate direction. If the first area is equal to the second area, the direction of the candidate placeholder area is determined as the candidate direction.
[0112] When two candidate occupant areas have the same area, the direction of the first candidate occupant area is selected as the candidate direction, thereby ensuring the determinism of the direction selection behavior and avoiding inconsistent direction selection results when the two candidate occupant areas have the same area.
[0113] Figure 10 This is a schematic diagram of the first side of an L-shaped target occupant area according to one embodiment of this disclosure.
[0114] like Figure 10 As shown, the L-shaped target placeholder region includes multiple vertices. Two arrows are shown inside the target placeholder region, indicating the initial arrangement order of the multiple vertices. The first and second vertices determine the first edge.
[0115] The above technical solution determines the direction of the L-shaped target area based on the size relationship between the two candidate areas to be merged, thereby avoiding the problem of inconsistent directions between the two parts of the target area.
[0116] Figure 11 This is a schematic diagram illustrating a process for determining a target direction based on candidate directions, according to one embodiment of this disclosure. Figure 11 As shown, the method includes steps S1101 to S1104.
[0117] In step S1101, the target occupant area is moved a preset distance along the candidate direction to obtain the updated occupant area.
[0118] The preset distance is a pre-set value used to check whether the target area extends beyond the room boundary. For example, the preset distance can be set to 1 centimeter and dynamically adjusted according to the scale of the initial layout.
[0119] In step S1102, the first overlap area between the updated occupancy area and the room area is calculated.
[0120] Here, the room area refers to the area of the room where the target placement area is located. For example, when the target placement area is located in the living room, the room area is the living room area.
[0121] In step S1103, the first overlapping area and the area of the updated occupied area are calculated to obtain the first overlapping rate.
[0122] The first overlap rate is calculated as: First overlap area / Area of the updated occupied area. The first overlap rate ranges from 0 to 1; a higher value indicates a greater overlap between the updated occupied area and the room area. A lower value indicates that most of the updated occupied area is located outside the room area.
[0123] In step S1104, if the first overlap rate is not less than the overlap rate threshold, then the candidate direction is the target direction.
[0124] For example, the overlap rate threshold is 0.8.
[0125] In other examples, if the first overlap rate is less than the overlap rate threshold, the candidate direction is changed to obtain the target direction, which is the opposite of the candidate direction. Based on the target direction, the initial arrangement order of all vertices in the target occupancy region is adjusted to obtain the target arrangement order.
[0126] In this process, after the candidate direction is changed, the initial arrangement order of the vertices in the target occupant region does not match the updated target direction. Therefore, all vertices in the target occupant region are rearranged in a counterclockwise or clockwise direction based on the target direction to obtain the target arrangement order.
[0127] The above technical solution automatically identifies the correctness of candidate directions based on the overlap rate and reverses invalid candidate directions to avoid the problem of incorrect object orientation. Simultaneously, after changing the candidate direction to the target direction, the initial arrangement order of the vertices in the target occupant region is changed to obtain the target arrangement order, ensuring that the target direction matches the polygon ring direction. This facilitates the subsequent rendering module to render correctly according to the target direction.
[0128] Figure 12 This is a schematic diagram illustrating a process for determining the target direction of a target occupant region based on multiple vertices of the target occupant region according to one embodiment of this disclosure. For example... Figure 12 As shown, the method includes steps S1201 to S1207.
[0129] In step S1201, the initial arrangement order of multiple vertices of the target occupancy area is obtained.
[0130] The initial arrangement order can be set in advance according to user needs.
[0131] In step S1202, the first edge of the target occupancy area is determined based on the initial arrangement order.
[0132] In this process, the first two vertices are determined based on the initial arrangement order, and the first edge is determined based on these two vertices.
[0133] In step S1203, candidate directions for the target occupancy region are determined based on the first edge.
[0134] The candidate direction is the direction vector corresponding to the first edge, that is, the unit vector pointing from the first vertex to the second vertex.
[0135] In step S1204, the target occupancy area is moved a preset distance along the candidate direction to obtain the updated occupancy area.
[0136] In step S1205, the second overlap area between the updated occupancy area and the room area is calculated.
[0137] The room area refers to the area of the room where the target occupancy area is located.
[0138] In step S1206, the second overlap area and the area of the updated occupied area are calculated to obtain the second overlap rate.
[0139] Wherein, the second overlap rate = second overlap area / area of the updated occupied region. The value of the second overlap rate ranges from 0 to 1.
[0140] In step S1207, if the second overlap rate is not less than the overlap rate threshold, then the candidate direction is the target direction.
[0141] In other examples, if the second overlap rate is less than the overlap rate threshold, the candidate direction is changed to obtain the target direction. The target direction is the opposite of the candidate direction. Based on the target direction, the initial arrangement order of all vertices in the target occupancy region is adjusted to obtain the target arrangement order.
[0142] Figure 13 This is a schematic diagram of the first side of a rectangular target occupant area according to one embodiment of this disclosure.
[0143] like Figure 13 As shown, the rectangular target area comprises multiple vertices. Two arrows are shown inside the target area, indicating the initial arrangement order of the vertices. The first and second vertices define the first edge.
[0144] The above technical solution, for the rectangular target occupant area, can automatically identify whether the candidate direction is correct based on the initial vertex arrangement order and the translational collision detection method, and reverse the incorrect candidate direction to obtain the target direction, thereby avoiding the problem of incorrect direction of individual unmerged furniture during the rendering process.
[0145] Figure 14 This is a flowchart illustrating another embodiment of the present disclosure, showing the process of modifying the initial type of each target occupant region to obtain the target type of each target occupant. For example... Figure 14 As shown, the method includes steps S1401 to S1403.
[0146] In step S1401, for each target occupancy area, the initial size and initial type of the target occupancy area are obtained.
[0147] The dimensions of the target occupancy area include at least its length and width.
[0148] In step S1402, the corresponding type condition is selected based on the initial size.
[0149] Different initial types correspond to different type conditions, which are used to constrain the thresholds of the length and width of the corresponding target occupancy area.
[0150] In step S1403, if the initial size meets the type condition, then the initial type is the target type.
[0151] Among them, the initial size satisfying the type condition means that the length and width of the target occupancy area simultaneously satisfy the corresponding type condition.
[0152] In other examples, if the initial size does not meet the type condition, the initial type is changed to obtain the target type.
[0153] In this case, the initial size does not meet the type condition, which means that at least one of the length and width of the target place area does not meet the corresponding type condition. In this case, the initial type needs to be modified to another type that matches the type condition of the target place area, that is, the target type.
[0154] For example, if the initial type is a sofa but the length and width are very small, then the length and width do not meet the type conditions corresponding to a sofa, and the sofa should be changed to a single sofa or a booth. If the initial type is a sofa but the length and width are very large, then the length and width do not meet the type conditions corresponding to a sofa, and the sofa should be changed to an L-shaped sofa.
[0155] For example, if the initial type is a TV cabinet, but it's too thin and doesn't meet the thickness requirements for a TV cabinet, then change the TV cabinet to a projector screen. If the initial type is a coffee table or dining table, but the target area is behind the sofa, then change the coffee table or dining table to a desk. If the initial type of a target area in the living room is identified as a wardrobe, but the wardrobe doesn't match the living room, then change the wardrobe to a shoe cabinet, sideboard, or storage cabinet.
[0156] The above technical solution matches the initial size of the target occupancy area with the type conditions corresponding to the initial type to automatically correct incorrect initial types, thereby ensuring that the final output target type matches the type conditions, and thus improving the rationality of the type in the candidate layout results.
[0157] Figure 15 This is a schematic flowchart illustrating the determination of a target size according to one embodiment of this disclosure. Figure 15 As shown, the method includes steps S1501 to S1503.
[0158] In step S1501, for each target occupancy area, the target type and initial aspect ratio corresponding to the target occupancy area are obtained.
[0159] In step S1502, the corresponding aspect ratio condition is selected based on the target type.
[0160] Different candidate types correspond to different aspect ratio conditions, which are set in advance.
[0161] In step S1503, if the initial aspect ratio of the target occupant area does not meet the aspect ratio condition, the length and width of the target occupant area are adjusted to obtain the target aspect ratio.
[0162] Specifically, when the aspect ratio of the target area does not meet the aspect ratio requirements, the aspect ratio of the target area is increased or the aspect ratio of the item is reduced.
[0163] The above technical solution can automatically correct errors in the aspect ratio of the target area, thereby improving the rationality of the aspect ratio of the target area in the candidate layout results.
[0164] Figure 16 This is a schematic diagram illustrating the process of generating a dining chair according to one embodiment of this disclosure. Figure 16 As shown, the method includes steps S1601 to S1604.
[0165] In step S1601, when the target type of the target area is a dining table and the dining table is rectangular, the length of each side of the table and the size of the dining chair in the target area are obtained.
[0166] For a rectangular dining table, the target seating area has four sides. The length of each side is the same as the length of the corresponding side of the rectangle.
[0167] In step S1602, for each table edge, the number of dining chairs matching the table edge and the spacing between adjacent dining chairs are determined based on the length of the table edge and the size of the dining chairs.
[0168] The number N of dining chairs that can be placed on a single side can be calculated using the following formula: N = floor(l_e / (w+g)).
[0169] Where l_e is the length of the table edge, w is the width of the chair, g is the spacing, which is the minimum gap between two adjacent chairs, and floor() is the floor function.
[0170] In step S1603, the center point of each chair is determined based on the number of chairs and the spacing between them.
[0171] The step length of the dining chair on the edge of the table can be calculated using the following formula: step = l_e / N.
[0172] Where l_e is the length of the table edge.
[0173] At every step, a point p_mid is determined at the edge of the table.
[0174] The center point p_chair of each chair can be calculated using the following formula: p_chair = p_mid - n×t.
[0175] Where n is the unit normal vector outside the dining table, and t is the offset distance.
[0176] In step S1604, for each dining chair, the dining chair is generated using the coordinates of its corresponding center point.
[0177] The above technical solution, for rectangular dining tables, uses an adaptive equidistant placement algorithm based on the table side length and chair size to automatically generate multiple chairs that match the table size. When the chair size does not match the table side length, it can also adaptively adjust the size of the chairs and the spacing between them, thereby ensuring that multiple chairs are evenly distributed around the dining table, thus improving the rationality of the chair positions in the candidate layout results.
[0178] Figure 17 This is a schematic diagram of the process for generating a dining chair according to another embodiment of this disclosure. Figure 17 As shown, the method includes steps S1701 to S1705.
[0179] In step S1701, when the target type of the target area is a dining table and the dining table is round, the perimeter of the dining table is calculated.
[0180] Specifically, if the target type of the target area is a dining table and its length does not exceed a length threshold, then the dining table is circular. For example, the length threshold is 100. The length of the target area is used as the diameter, and the radius of the dining table is determined. Then, the perimeter is determined based on the radius.
[0181] In step S1702, the number of dining chairs is determined based on the perimeter and the preset edge distance.
[0182] The preset dining edge distance is the preset average dining edge distance per person, which is the minimum circumference length occupied by each dining chair.
[0183] The number of dining chairs, M, can be calculated using the following formula: M_raw = ceil(C / d_e), M = min(M_raw, M_max).
[0184] Where M is the number of dining chairs, C is the perimeter of the dining table, d_e is the preset edge distance, ceil() is the round-up function, and M_max is the preset maximum number of dining chairs.
[0185] In step S1703, the spacing angle between adjacent dining chairs is determined based on the number of dining chairs.
[0186] The interval angle can be calculated based on the following formula: △θ = 360° / M.
[0187] Where △θ is the interval angle.
[0188] The dining chairs are evenly distributed at equal angles along the outer contour of the dining table.
[0189] In step S1704, the center point coordinates and area ratio of each dining chair are calculated.
[0190] The area ratio is the ratio of the area of the room where the dining chair is located to the area of the dining chair itself.
[0191] The orientation angle θ_i of the i-th dining chair can be calculated using the following formula: θ_i = 360°×(i + 1) / M +θ_0.
[0192] Where θ_0 is the initial reference angle, i = 0, 1, ..., M - 1.
[0193] The center point coordinates P_i of the i-th chair can be calculated using the following formula: P_i = O + u(θ_i)×r, u(θ_i) = (cosθ_i, sinθ_i).
[0194] Where O is the center point of the dining table, r is the radius of the dining table, and u(θ_i) is the unit vector in the corresponding direction.
[0195] The area ratio R_i of the i-th dining chair can be calculated using the following formula: R_i = Area(Γ_i∩Ω) / Area(Γ_i).
[0196] Where Γ_i represents the two-dimensional planar region of dining chair i in the initial layout result, Ω represents the room region where the dining chair is located, Area() represents the area calculation function of the two-dimensional planar region, and Γ_i∩Ω represents the intersection region of dining chair i and room region Ω.
[0197] In step S1705, for each dining chair, if the center point coordinates are located within the room area and the area ratio is not less than the area ratio threshold, then the dining chair is generated with the center point coordinates as the center.
[0198] The area ratio threshold is preset. For dining chairs whose center point is located within the room area and whose area ratio is not less than the area ratio threshold, a corresponding dining chair is generated centered on the coordinates of the center point. Dining chairs that do not meet the conditions are not generated.
[0199] The above technical solution can automatically generate a reasonable number of dining chairs that conform to the room boundary for a round dining table, thereby ensuring that the dining chairs are placed inside the room and avoiding situations where the dining chairs pass through the wall or are half-suspended outside the room, thus improving the rationality of the dining chairs in the candidate layout results in a circular scene.
[0200] Figure 18 This is a schematic diagram of a process for selecting a target layout result from multiple candidate layout results according to one embodiment of the present disclosure.
[0201] like Figure 18 As shown, the method includes steps S1801 to S1802.
[0202] In step S1801, occlusion detection, size detection, and position detection are performed on each candidate layout result to obtain a score result.
[0203] Occlusion detection is used to detect unacceptable overlaps or occlusions between items in the candidate layout. Examples include occlusion of windows, doors, furniture, and passageways. A lower occlusion detection score indicates more severe overlap or occlusion between items in the candidate layout, and the less likely the layout is to be as expected. A higher occlusion detection score indicates that items in the candidate layout are independent and have no significant overlap, and the layout is more likely to be as expected.
[0204] Size detection is used to check whether the dimensions of items in the candidate layout results meet the requirements. The more non-compliance cases there are, the lower the size detection score. The fewer non-compliance cases there are, the higher the size detection score. Examples include whether the sofa and TV are directly opposite each other, the size difference between the sideboard and the sofa, the operating area of the cabinet, and the sofa aisle.
[0205] Position detection is used to check whether the positions of items in the candidate layout meet the requirements. The more non-compliance cases there are, the lower the position detection score. The fewer non-compliance cases there are, the higher the position detection score. For example, the positions of a sofa and a door.
[0206] In step S1802, the target layout result is selected from multiple candidate layout results based on the score of each candidate layout result.
[0207] The scores for occlusion detection, size detection, and position detection are added together to obtain the final score. Multiple scores are then ranked from highest to lowest, and the candidate layout corresponding to the highest score is selected as the target layout.
[0208] The above technical solution comprehensively scores the candidate layout results through three dimensions: occlusion detection, size detection, and position detection. Based on the scoring results, the optimal target layout result is selected from multiple candidate layout results, thereby ensuring the quality of the target layout result and greatly improving user experience and satisfaction.
[0209] The execution entity of the room layout generation method in the specific embodiments of this disclosure can be a server (including a local server or a cloud server).
[0210] Therefore, based on any of the above embodiments, this disclosure also provides an electronic device that can execute the room layout generation method of any of the embodiments described above.
[0211] Figure 19 This is a schematic structural block diagram of an electronic device according to one embodiment of the present disclosure.
[0212] The hardware architecture of the electronic device 1000 can be implemented using a bus architecture. The bus architecture can include any number of interconnect buses and bridges, depending on the specific application of the hardware and overall design constraints. Bus 1100 connects various circuits, including one or more processors 1200, memory 1300, and / or hardware modules. Bus 1100 can also connect various other circuits 1400, such as peripheral devices, voltage regulators, power management circuits, external antennas, etc.
[0213] Bus 1100 can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, this diagram uses only one connection line, but this does not imply that there is only one bus or one type of bus.
[0214] For ease of explanation, certain steps of the above method are described in relation to modules. It should be understood that the corresponding module performing one or more steps of the above method may be one or more hardware modules specifically configured to perform the corresponding step, or implemented by a processor configured to perform the corresponding step, or stored in a computer-readable medium for implementation by a processor, or implemented by some combination thereof.
[0215] This disclosure also provides a readable storage medium storing a computer program that, when executed by a processor, is used to implement the methods described above. A "readable storage medium" can be any means capable of containing, storing, communicating, propagating, or transmitting a program for use by or in conjunction with an instruction execution system, apparatus, or device. More specific examples of a readable storage medium include: an electrical connection with one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic devices, and portable read-only memory (CDROM), etc.
[0216] This disclosure also provides a computer program product, the methods of which can be implemented wholly or partially through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented wholly or partially as a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed, all or part of the processes or functions of this disclosure are performed.
[0217] Computer programs or instructions can be stored in a readable storage medium or transferred from one readable storage medium to another. For example, the computer program or instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The readable storage medium can be any available medium capable of access, or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; an optical medium, such as a digital video optical disc; or a semiconductor medium, such as a solid-state drive. The computer-readable storage medium can be a volatile or non-volatile storage medium, or it can include both volatile and non-volatile types of storage media.
[0218] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, systems, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0219] This disclosure is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus, and computer program products according to this disclosure. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0220] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0221] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0222] Those skilled in the art should understand that the above embodiments are merely for illustrating the present disclosure and are not intended to limit the scope of the disclosure. Those skilled in the art can make other changes or modifications based on the above disclosure, and these changes or modifications still fall within the scope of the present disclosure.
Claims
1. A method for generating room layouts, characterized in that, include: Obtain the floor plan information of the target room; Based on the apartment layout information, multiple initial layout results are generated for the target room, and the initial layout results include the initial occupancy area corresponding to each item in the target room; Target detection is performed on each of the initial occupancy regions to obtain the initial type corresponding to each of the initial occupancy regions; The initial occupancy area and the initial type in each initial layout result are corrected to obtain the candidate layout result corresponding to each initial layout result. The target layout result is selected from the multiple candidate layout results.
2. The method as described in claim 1, characterized in that, The initial placeholder area and initial type in each of the initial layout results are modified to obtain candidate layout results corresponding to each of the initial layout results, including: For each initial layout result, each initial occupancy area is modified to obtain the target occupancy area for each initial occupancy area; The initial type of each target occupant region is modified to obtain the target type of each target occupant region.
3. The method as described in claim 2, characterized in that, For each initial layout result, each initial occupancy area is corrected to obtain the target occupancy area for each initial occupancy area, including: Extract the outer contour of each of the initial occupancy regions, the outer contour comprising multiple normalized coordinates; Candidate occupancy regions for each of the initial occupancy regions are determined based on the outer contour of each initial occupancy region. For each candidate occupancy area, if the initial type of the candidate occupancy area is sofa, and the initial type of another candidate occupancy area adjacent to the candidate occupancy area is sofa, then the candidate occupancy area and the other candidate occupancy area are merged to obtain the target occupancy area, and the candidate direction of the target occupancy area is determined based on the candidate occupancy area and the other candidate occupancy area. or, If the initial type of the candidate placeholder area is not a sofa, then the candidate placeholder area is determined as the target placeholder area, and the candidate direction of the target placeholder area is determined based on multiple vertices of the target placeholder area.
4. The method as described in claim 3, characterized in that, Based on the outer contour of each initial occupancy region, candidate occupancy regions for each initial occupancy region are determined, including: Convert each of the normalized coordinates into actual coordinates; Calculate the occupancy rectangle based on the multiple actual coordinates corresponding to each initial occupancy area; The occupancy rectangles corresponding to each initial occupancy area are regularized to obtain candidate occupancy areas.
5. The method as described in claim 3, characterized in that, If the initial type of the candidate spacer area is sofa, and the initial type of adjacent candidate spacer areas is sofa, then the two adjacent candidate spacer areas are merged to obtain the target spacer area, including: For each room of the target living room, when two adjacent candidate occupancy areas are perpendicular to each other, the adjacency rectangle of the two adjacent candidate occupancy areas is obtained. The target occupant area is obtained by removing the blank area from the adjacent rectangles. The blank area has no intersection with either of the two adjacent candidate occupant areas. or, When two adjacent candidate occupant regions are parallel to each other, the adjacency rectangle of the two adjacent candidate occupant regions is obtained, and the adjacency rectangle is the target occupant region.
6. The method as described in claim 3, characterized in that, Determining the candidate direction of the target occupancy region based on the candidate occupancy region and the other candidate occupancy region includes: Obtain the first area of the candidate occupant region and the second area of the other candidate occupant region; If the first area is larger than the second area, then the direction of the candidate occupancy region is determined as the candidate direction; If the second area is larger than the first area, then the direction of the other candidate occupant area is determined as the candidate direction; If the first area is equal to the second area, then the direction of the candidate occupancy area is determined as the candidate direction.
7. The method as described in claim 3, characterized in that, Determining the target direction based on the candidate directions includes: The target occupancy area is moved a preset distance along the candidate direction to obtain an updated occupancy area; Calculate the first overlap area between the updated occupancy area and the room area, wherein the room area is the area of the room where the target occupancy area is located, and the target room includes at least one of the rooms; The first overlap rate is obtained by calculating the area of the first overlap area and the area of the updated occupied area; If the first overlap rate is not less than the overlap rate threshold, then the candidate direction is the target direction; or, If the first overlap rate is less than the overlap rate threshold, the candidate direction is changed to obtain the target direction, which is opposite to the candidate direction. Based on the target direction, adjust the initial arrangement order of all vertices in the target occupancy area to obtain the target arrangement order.
8. The method as described in claim 2, characterized in that, The initial type of each target occupant region is modified to obtain the target type of each target occupant region, including: For each target occupancy region, obtain the initial size and initial type of the target occupancy region; Select the corresponding type condition based on the initial size; If the initial size satisfies the type condition, then the initial type is the target type; or, If the initial size does not meet the type condition, then the initial type is changed to obtain the target type; Optionally, the method further includes: For each target occupancy area, obtain the target type and initial aspect ratio corresponding to the target occupancy area; Select the corresponding aspect ratio based on the target type; If the initial aspect ratio of the target area does not meet the aspect ratio condition, the length and width of the target area are adjusted to obtain the target aspect ratio. Optionally, the method further includes: When the target type of the target area is a dining table, and the dining table is rectangular, obtain the length of each side of the table and the size of the dining chair in the target area; For each table edge, the number of dining chairs that match the table edge and the spacing between adjacent dining chairs are determined based on the length of the table edge and the size of the dining chairs. The center point coordinates of each dining chair are determined based on the number of dining chairs and the spacing between them. For each of the dining chairs, the dining chair is generated using the coordinates of the center point corresponding to the dining chair; Optionally, the method further includes: When the target type of the target area is a dining table, and the dining table is circular, calculate the perimeter of the dining table; The number of dining chairs is determined based on the perimeter and the preset edge distance. The spacing angle between adjacent dining chairs is determined based on the number of dining chairs. Calculate the center point coordinates and area ratio of each of the dining chairs. The area ratio is the ratio of the area of the dining chair within the room area to the area of the dining chair itself. The room area is the area of the room where the target occupancy area is located. The target room includes multiple rooms. For each of the dining chairs, if the center point coordinates are located within the room area and the area ratio is not less than the area ratio threshold, then the dining chair is generated with the center point coordinates as the center. Optionally, the target layout result is selected from the multiple candidate layout results, including: For each candidate layout result, occlusion detection, size detection, and position detection are performed to obtain a scoring result; The target layout result is selected from the multiple candidate layout results based on the score of each candidate layout result.
9. An electronic device, characterized in that, include: The memory stores execution instructions; as well as A processor that executes the execution instructions stored in the memory, causing the processor to perform the room layout generation method according to any one of claims 1 to 8.
10. A readable storage medium, characterized in that, The readable storage medium stores execution instructions, which, when executed by a processor, are used to implement the room layout generation method according to any one of claims 1 to 8.
