Residential subspace structure identification method and equipment based on CAD (Computer Aided Design) drawing
By exporting pictures from CAD drawings and using AI models and image processing technology, the subspace structure and door and window positions of the apartment are automatically identified, and the time-consuming problem of designers' manual analysis is solved, which improves the designer's work efficiency and the convenience of design proposal recommendations .
Patent Information
- Application Number
- CN202411757814.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2024-12-31
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art lacks automated methods to quickly analyze the subspace structure and door and window position information drawn on CAD drawings, resulting in designers requiring repeated and time-consuming manual analysis to match the structure of the client's house.
By exporting the subspace images of the apartment from the CAD drawings, defining category annotations, building a data set and training an AI model, the subspace contour and door and window position information are extracted using image processing methods, including identification using the DeepLabv3+ model and iterative adaptive point algorithm.
It realizes automatic identification of the subspace structure and door and window position information of the CAD drawings, improves the designer's work efficiency, and can easily obtain and organize drawing data to recommend suitable soft decoration design solutions.
Smart Images

Figure CN119229468A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of computers, and in particular to a method for identifying a subspace structure of an apartment drawn on a CAD drawing. Background Art
[0002] Soft decoration design refers to the layout design of sofas, cabinets and other furniture in a house space of a certain size and structure. It is a very important step in house decoration. There are generally multiple sub-spaces in a house type, such as bedroom space, living room space, etc. The soft decoration design of each sub-space needs to be formulated according to the regional outline structure of the sub-space and the location of doors and windows.
[0003] Soft furnishing designers usually draw CAD drawings for each subspace. The outline of the space is depicted by lines of fixed color and thickness on the drawings. In a certain sense, the lines represent the walls that surround the space. In addition, doors and windows are also depicted on the drawings with specific lines and shapes. In the end, there will be an area with lines drawn on the drawings, which can describe the structure of the subspace and the location of doors and windows in the corresponding apartment.
[0004] Soft furnishing designers will design soft furnishing layouts for each subspace with different structures, generate renderings and provide them to customers for selection, and CAD drawings are the basis of the entire process. In one application scenario, soft furnishing designers already have soft furnishing design plans for multiple different spaces, and need to select plans whose structures and door and window positions are consistent or similar to those of the customer's house and recommend them to the customer for reference. This process requires the designer to analyze again whether the spatial structure on the CAD drawing is consistent with the spatial structure of the customer's house, that is, it is necessary to analyze the information of the subspace structure and door and window positions drawn on the CAD drawing. This process is repetitive and time-consuming, and there is currently no method or process that can automatically complete this work. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a residential subspace structure recognition method and device based on CAD drawings to help soft furnishing designers quickly obtain the apartment subspace structure data depicted in the CAD drawings.
[0006] An aspect of an embodiment of the present invention provides a method for segmenting a subspace of a floor plan and extracting structural data, comprising: Develop a process for exporting apartment subspace images from CAD drawings, define the categories to be segmented, annotate apartment subspace images by category to obtain annotation files, and construct an apartment subspace dataset; Training an AI model based on the apartment subspace data set to obtain segmentation results in the apartment subspace image; Based on the segmentation result, an outline of the subspace described by the apartment subspace picture is obtained by an image processing method; The doors and windows in the outline of the subspace described by the apartment subspace picture are identified by a variety of image processing methods to obtain the position information of the doors and windows.
[0007] Optionally, the method further includes formulating a process for exporting apartment subspace images from CAD drawings, defining categories to be segmented, annotating the apartment subspace images by categories to obtain annotated files, and constructing an apartment subspace dataset, which includes: Based on the specification of using different colors and symbols to depict doors, windows and walls in apartment subspaces in CAD drawings, parameter selection for exporting apartment subspace images from CAD drawings is formulated so that the expression forms of doors, windows and walls in each apartment subspace image are unified; The categories to be segmented in the apartment subspace picture are defined, and the apartment subspace picture is annotated at the pixel level with different colors according to the categories to obtain an annotation file of the apartment subspace picture.
[0008] Optionally, the method further includes training an AI model according to the apartment subspace data set to obtain a segmentation result in the apartment subspace picture, and the step includes: DeepLabv3+ is used as the backbone network, and the training on the housing subspace dataset is completed by setting the input preprocessing process and loss function; Use the trained AI model to identify the apartment subspace image and obtain a semantic segmentation prediction result.
[0009] Optionally, the method further includes obtaining, based on the segmentation result, a contour of the subspace described by the apartment subspace picture by an image processing method, the step comprising: Based on the segmentation result, a subspace region is extracted, and an initial contour of the subspace region is calculated by an iterative adaptive point algorithm; The final contour information of the subspace is obtained by iteratively optimizing the initial contour of the subspace region.
[0010] Optionally, the method further comprises extracting a subspace region based on the segmentation result, and calculating an initial contour of the subspace region by an iterative adaptive point algorithm, the step comprising: The subspace area is proposed by HSV color, and the binary mask image of the area is obtained; Performing edge detection on the binary mask image by using the edge detection Canny algorithm; According to the edge information, find all the coordinate points in the contour; Polygon fitting is performed on all the coordinate points through an iterative adaptive point algorithm to obtain an initial outline of the subspace area.
[0011] Optionally, the method further comprises iteratively optimizing an initial contour of the subspace region to obtain final contour information of the subspace, the step comprising: Deleting two adjacent points in the contour whose distance is no more than 20 cm in sequence, and adding the middle point between the two points to the contour; Sequentially straighten two connected line segments formed by three adjacent points in the contour so that the two line segments are connected horizontally or vertically.
[0012] Optionally, the method further includes identifying doors and windows in the outline of the subspace described by the apartment subspace image by using a plurality of image processing methods to obtain location information of the doors and windows, and this step includes: The area representing the gate is extracted through the pre-defined HSV color of the gate, the binary mask of the area is obtained, and the starting point and end point of the gate are calculated; The area representing the window is extracted through the HSV color of the pre-defined window, the binary mask image of the area is obtained, and the start and end points of the window are calculated.
[0013] Optionally, the method further comprises the step of extracting a region representing the gate by using the HSV color of the predefined gate, obtaining a binary mask of the region, and calculating the start and end points of the gate, the step comprising: Calculate the smallest quadrilateral that contains the binary mask image, and count the colors of pixels near the four vertices of the quadrilateral on the apartment subspace image; The two points with both gate pixels and wall pixels are defined as the start and end points of the gate. The start and end points are selected in clockwise order.
[0014] Optionally, the method further includes extracting a region representing the window by using a predefined HSV color of the window, obtaining a binary mask image of the region, and calculating a start point and an end point of the window, the step comprising: Calculate the smallest quadrilateral that contains the binary mask image, and count the colors of pixels near the four vertices of the quadrilateral on the apartment subspace image; The two points that have both window pixels and wall pixels are defined as the start and end points of the window. The start and end points are selected in clockwise order.
[0015] Another aspect of an embodiment of the present invention further provides an electronic device, including a processor and a memory; The memory is used to store programs; The processor executes the program to implement the method described above.
[0016] Another aspect of the embodiments of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a program, and the program is executed by a processor to implement the method described above.
[0017] The embodiment of the present invention also discloses a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device can read the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the above method.
[0018] The embodiment of the present invention constructs a data set for identifying apartment subspaces based on CAD drawings; uses the data set to train a segmentation model, takes apartment subspace images derived from CAD drawings as input, and outputs segmentation results; based on the segmentation results, uses a variety of image processing methods to identify the outline of the apartment subspace drawn in the original CAD drawings and the door and window position information. The recognition of apartment subspace images based on CAD drawings by the present invention is a method obtained based on the process processing of all steps of the present invention, which can help soft furnishing designers more conveniently obtain the structure and door and window position information data of the apartment subspace drawn in the original CAD drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0020] Figure 1 is a flowchart of the overall steps of an embodiment of the present invention; Figure 2a-2b is the segmentation result image; Figure 3 This is a schematic diagram of the apartment subspace exported from the CAD drawing. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0022] Before completing the method proposed in this application, multiple CAD drawings of apartment subspaces drawn by designers should be used as basic data. In order to train a model to recognize apartment subspace images, it is necessary to formulate unified parameters of CAD drawings to obtain an apartment subspace image dataset in a unified format.
[0023] After the deep learning model is trained, the segmentation result of the subspace image is obtained by taking the apartment subspace image as input. The contour recognition and door and window location information of the subspace are performed on the segmentation result. First, the grayscale image of the subspace area is extracted based on the rules of different color categories of the segmentation result. The initial contour of the space is calculated by the iterative adaptation point algorithm. The number of vertices of the initial contour is deleted through iterative optimization to obtain a better contour. Finally, the doors and windows of the original apartment subspace are recognized based on color and symbol to obtain the location information of the doors and windows.
[0024] Specifically, this example describes a residential subspace structure identification method based on CAD drawings. The method flow is as follows: Figure 1 As shown. First, the CAD drawings are exported into pictures describing a certain apartment subspace through a unified export rule. Then, the apartment subspace pictures are labeled based on the defined categories to obtain a data set. Then, the deep learning model is trained to obtain the apartment subspace segmentation result map. Then, the segmentation result map is processed to obtain the outline of the subspace and the original apartment subspace picture to obtain the door and window structure information. Specifically, the following steps are included: 1. Export pictures from CAD drawings and create a dataset of apartment subspaces; Ⅰ. Establish unified export rules. Specific rules can be established according to the common settings of different software. Unified rules ensure that the description of the walls, doors, and windows of the apartment subspaces in the exported images, including line color, thickness, and shape, are consistent; II. Define the categories in the apartment subspace image as indoor and outdoor, where indoor includes the entire area of the subspace described in the image; III. Label each derived apartment subspace image based on the category, in a labeling manner: label each category with a different color using a rectangle or polygon.
[0025] 2. Train a deep learning model to segment and identify apartment subspace images; Ⅰ. Using DeepLabv3+ as the backbone network, training on the floor plan dataset is completed by setting the input preprocessing process and the cross entropy loss function to obtain a deep learning model; II. Take the apartment subspace image as input and output the segmentation result image through the deep learning model, such as Figure 2a-2b , represents the subspace area in the image.
[0026] 3. Process the apartment subspace segmentation result map to obtain the outline of the subspace and the original apartment subspace image to obtain the door and window structure information; Ⅰ. Extracting the outline of the subspace described in the image according to the segmentation result; a. On the segmentation result map, extract the area covering all indoor categories through the HSV color of the indoor category, that is, the subspace area in the original apartment subspace map. Then obtain the binary mask map of the area; b. Perform edge detection on the binary mask image by using the Canny edge detection algorithm to obtain edge information of the subspace region, ie, the original contour points; c. Performing polygon fitting on the original contour points by an iterative adaptive point algorithm to obtain the initial contour of the subspace in the apartment subspace image; d. Iterative optimization of the initial contour; a) When the distance between two vertices of a polygon is less than a threshold, the two points are merged into one point, and the coordinates are the average of the two vertex coordinates. The above threshold is half the thickness of the wall; b) When the vector formed by two adjacent points is offset within 20° in the horizontal or vertical direction, the vector is straightened. The specific operation is to align the coordinates of the point with the smaller horizontal or vertical coordinate with the coordinates of the other point, so that the two points are aligned in the horizontal or vertical direction; Ⅱ. Extract the door and window structure information from the original apartment subspace image through a variety of image processing methods; The process of extracting door and window structure information from the original apartment subspace image is similar, including the following steps: e. In the unified rules for exporting images from CAD drawings, the colors of doors and windows in the exported images are unified; binary mask images of doors and windows are generated based on the HSV values of the colors; f. Calculate the smallest quadrilateral containing each binary mask image, and count the color of the pixels near the four vertices of the quadrilateral on the original apartment subspace image, especially the color distribution of the door, wall, and window pixels near the point; g. The two endpoints of the door and window have obvious distribution characteristics in the original apartment subspace image, and the two endpoints of the door and window are selected based on the distribution characteristics; a) If Figure 3 In the example, there are both door pixels and wall pixels near the two end points of the door. Based on the rule, two points that meet the rule are selected from the vertices of the quadrilateral containing the door binary mask image; b) If Figure 3 In the example, there are both window pixels and wall pixels near the four endpoints of the window, and the middle value of the corresponding endpoints of the two longer sides is selected as the starting endpoint of the window. Based on this rule, two points that meet this rule are calculated among the vertices of the quadrilateral containing the window binary mask image; In summary, the method of the present invention has the following characteristics: After applying this method, designers can process and batch obtain the outline results and door and window structure data of the subspaces drawn in the existing CAD drawings with subspaces in the apartment type, so as to help designers conveniently organize the soft decoration design schemes corresponding to the drawings according to the structures of different spaces, and further quickly recommend suitable design schemes to users. The operation is simple, providing designers with a convenient tool that can greatly improve their work efficiency.
[0027] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part for which is described as a larger operation is performed independently.
[0028] In addition, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features described may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in separate physical devices or software modules. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present invention. More specifically, in view of the properties, functions, and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional skills of the engineer. Therefore, those skilled in the art can implement the present invention set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.
[0029] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0030] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0031] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0032] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0033] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0034] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
[0035] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the described embodiments. Those skilled in the art may make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.
Claims
1. A residential subspace structure identification method based on CAD drawings, characterized in that: include: Develop a process for exporting apartment subspace images from CAD drawings, define the categories to be segmented, annotate apartment subspace images by category to obtain annotation files, and construct an apartment subspace dataset; Training an AI model based on the apartment subspace data set to obtain segmentation results in the apartment subspace image; Based on the segmentation result, the outline of the subspace described by the apartment subspace picture is obtained by an image processing method, which includes proposing a subspace area by HSV color based on the segmentation result to obtain a binary mask image of the area; performing edge detection on the binary mask image by edge detection Canny algorithm; finding all coordinate points in the outline according to edge information; performing polygon fitting on all the coordinate points by iterative adaptive point algorithm to obtain the initial outline of the subspace area; By iteratively optimizing the initial contour of the subspace region, final contour information of the subspace is obtained; The doors and windows in the outline of the subspace described by the apartment subspace picture are identified by using a variety of image processing methods to obtain the position information of the doors and windows.
2. A residential subspace structure identification method based on CAD drawings as claimed in claim 1, characterized in that: The process of exporting apartment subspace images from CAD drawings is formulated, the categories to be segmented are defined, the apartment subspace images are annotated by categories to obtain annotated files, and an apartment subspace dataset is constructed, including: The CAD drawings depict doors, windows and walls in the apartment subspaces by using different colors and symbols, and parameter selection for exporting apartment subspace images from the CAD drawings is formulated so that the expression forms of the doors, windows and walls in each of the apartment subspace images are unified; The categories to be segmented in the apartment subspace picture are defined, and the apartment subspace picture is annotated at the pixel level with different colors according to the categories to obtain an annotation file of the apartment subspace picture.
3. A residential subspace structure identification method based on CAD drawings as claimed in claim 1, characterized in that: The step of training the AI model according to the apartment subspace data set to obtain the segmentation result in the apartment subspace picture includes: DeepLabv3+ is used as the backbone network, and the training on the housing subspace dataset is completed by setting the input preprocessing process and loss function; Use the trained AI model to identify the apartment subspace image and obtain the semantic segmentation prediction result.
4. A residential subspace structure identification method based on CAD drawings as claimed in claim 1, characterized in that: The steps of iteratively optimizing the initial contour of the subspace region to obtain the final contour information of the subspace include: Deleting two adjacent points in the contour whose distance is no more than 20 cm in sequence, and adding the middle point between the two points to the contour; Sequentially straighten two connected line segments formed by three adjacent points in the contour so that the two line segments are connected horizontally or vertically.
5. The residential subspace structure identification method based on CAD drawings as claimed in claim 1, characterized in that: The steps of identifying doors and windows in the outline of the subspace described by the apartment subspace picture by using multiple image processing methods to obtain the position information of the doors and windows include: The area representing the gate is extracted through the pre-defined HSV color of the gate, the binary mask of the area is obtained, and the starting point and end point of the gate are calculated; The area representing the window is extracted through the HSV color of the pre-defined window, the binary mask image of the area is obtained, and the start and end points of the window are calculated.
6. A residential subspace structure identification method based on CAD drawings as claimed in claim 5, characterized in that: The steps of extracting the region representing the gate by the HSV color of the predefined gate, obtaining the binary mask of the region, and calculating the start and end points of the gate include: Calculate the smallest quadrilateral that contains the binary mask image, and count the colors of pixels near the four vertices of the quadrilateral on the apartment subspace image; Two points with both gate pixels and wall pixels are defined as the starting point and the end point of the gate, and the starting point and the end point are selected in a clockwise order.
7. A residential subspace structure identification method based on CAD drawings as claimed in claim 5, characterized in that: The steps of extracting a region representing the window by using the predefined HSV color of the window, obtaining a binary mask of the region, and calculating the start and end points of the window include: Calculate the smallest quadrilateral that contains the binary mask image, and count the colors of pixels near the four vertices of the quadrilateral on the apartment subspace image; Two points with both window pixels and wall pixels are defined as the starting point and the end point of the window, and the starting point and the end point are selected in a clockwise order.
8. An electronic device, characterized in that: including a processor and a memory; The memory is used to store programs; The processor executes the program to implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Space recognition method and device for CAD drawing, electronic equipment and storage medium
CN111008597A
Image data annotation method and device, electronic device and storage medium
CN113160257A
Method for accurately segmenting whole residence space on CAD (Computer Aided Design) drawing
CN114494692A
Method for identifying furniture components in bedroom space of building major based on deep learning
CN114494716A
Wall area identification method, system and equipment of plane house type drawing and medium
CN114973297A
Cited By
Application method, device and medium for matching home products based on floor plan
CN119762720A
Space identification method and system based on YOLO model, terminal and medium
CN120997866A
