House type wall processing method, system, medium and equipment based on target detection
By detecting furniture and walls in floor plans, pixel processing and outline filling, the problem of low recognition accuracy in floor plans in the prior art is solved, and higher recognition accuracy and image quality are achieved.
Patent Information
- Application Number
- CN202210117568.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-08
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2042-02-08
AI Technical Summary
In the prior art, the CAD floor plan recognition algorithm has irregular design and large human interference factors, resulting in low recognition accuracy, especially inability to deal with complex floor structures in real scenarios.
The wall processing method of floor plan based on target detection is adopted. By detecting the furniture in the floor plan and positioning the area where it is located, pixel RGB assignment processing is performed, the wall outline is detected and filled, and the standard training floor plan is obtained.
It improves the accuracy of floor plan recognition, reduces image interference information, and enhances the standardization and recognition accuracy of model training samples.
Smart Images

Figure CN114612923B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of target detection, and in particular to a method, system, medium and equipment for processing wall of a house plan based on target detection. Background Art
[0002] At present, a variety of CAD floor plan recognition algorithms have been proposed on the market, such as automatic recognition of walls, doors and windows based on traditional image processing and rule restrictions. However, due to the problems of non-standard design and large human interference factors in CAD floor plans, the recognition accuracy is inaccurate. However, the recognition accuracy depends to a large extent on the drawing specifications of the floor plan and the degree of confusion of the components. Traditional algorithms can only process horizontal and vertical walls and are not suitable for complex floor plan structures in real scenes.
[0003] In response to the problems of traditional image processing methods, the R&D team chose to use the most cutting-edge deep learning methods to improve recognition accuracy. Through segmentation networks and key point detection technology, wall lines, components and spaces are automatically identified and divided, greatly increasing recognition generalization.
[0004] In order to improve the accuracy of apartment type recognition, it is necessary to first standardize and preprocess the input apartment type samples of the deep learning model. As the most important component in the apartment type, the processing method of the wall directly affects the quality of the image. The standardized apartment type samples obtained by the wall processing method can further reduce image interference information and improve the accuracy of apartment type recognition. Summary of the invention
[0005] In view of the above-mentioned shortcomings of the prior art, the purpose of the present invention is to provide a method, system, medium and equipment for processing wall of floor plan based on target detection, so as to solve the above problems in the prior art.
[0006] To achieve the above-mentioned purpose and other related purposes, the present invention provides a method for processing floor plan walls based on target detection, the method comprising: detecting furniture in the floor plan and locating the area where the furniture is located; assigning RGB values to pixels in the area where the furniture is located; performing contour detection on floor plan components to obtain floor plan contour information; filtering the floor plan contour according to a screening condition to obtain the floor plan wall contour; and filling the wall contour to obtain a standard training floor plan.
[0007] In one embodiment of the present invention, the method further includes: performing clustering statistics on the size of furniture in the data set in the floor plan; obtaining N detection frames of different sizes through clustering statistics, and defining M detection frames of different proportions for each size frame, where N and M are positive integers; predicting K detection frames in the floor plan and classifying the furniture in the detection frames; calculating the IOU of two similar detection frames, and if it is greater than a preset threshold, integrating the two frames into one, until the IOU between any two detection frames is less than the preset threshold to obtain a final detection frame; defining the final detection frame as the area where the furniture is located and detecting vertical and horizontal straight lines around the area where the furniture is to be detected.
[0008] In one embodiment of the present invention, the method further includes obtaining a statistical proportion of pixels having the same RGB value outside the area where the furniture is located in the floor plan; comparing and obtaining the RGB values of the same pixels having the largest proportion; and replacing the RGB values of the pixels in the area where the furniture is located with the RGB values.
[0009] In one embodiment of the present invention, the method also includes calculating the contour of the floor plan through cv2.findContours and saving it in the form of a tree diagram; recording the contour subscript, the coordinates of the contour points and the subscript of the parent contour for the contour; defining the subscript of the outermost parent contour as -1; looping to update the parent contour of the contour, recording the depth of the node until the parent contour subscript of the latest node is -1; and returning the depth of the node.
[0010] In one embodiment of the present invention, the method further includes: step 1: connecting the first and last two contour points of the three adjacent contour points in the contour as endpoints to form a line segment AB; step 2: calculating the vertical distance d between the middle contour point among the three contour points and the line segment AB; step 3: comparing d with a preset threshold value threshold, if d is less than the threshold, taking the line segment AB as the approximate constituent line segment of the contour; if d is greater than the threshold, taking C as the endpoint to form line segments AC and BC as the approximate constituent line segments of the contour; step 4: repeating steps 1 to 3 to obtain the approximate constituent line segments of the contour as the constituent line segments of the contour and recording the number of endpoints constituting the contour segments.
[0011] In one embodiment of the present invention, the screening conditions in the method are: determine whether the contour depth is less than P, if not, filter the contour; calculate the maximum inscribed circle radius of the contour, determine whether the maximum inscribed circle radius is within a preset range, if not, filter the contour; calculate the proportion of the area of the acquired contour to the area of the floor plan, determine whether the proportion is within a preset range, if not, filter the contour; calculate the ratio of the perimeter of the contour to the contour area, determine whether the ratio is greater than a preset value, if not, filter the contour; calculate the number of endpoints of the line segment constituting the contour, determine whether the number of endpoints is within a preset range, if not, filter the contour.
[0012] In one embodiment of the present invention, the method further includes: obtaining RGB values of pixel points constituting the outline of the floor plan; and replacing RGB values of pixel points within the wall outline of the floor plan with the RGB values.
[0013] To achieve the above-mentioned purpose and other related purposes, the present invention provides a house plan wall processing system based on target detection, the system comprising: a positioning module, used to detect furniture in the house plan and locate the area where the furniture is located; a detection module, used to perform contour detection on the house plan components to obtain the house plan contour information; a filtering module, used to filter the house plan contour according to a filtering condition to obtain the house plan wall contour; and a filling module, used to perform pixel filling on the area where the furniture is located and the wall contour.
[0014] To achieve the above-mentioned purpose and other related purposes, the present invention provides a computer-readable storage medium, which stores a computer program. When the computer program is loaded and executed by a processor, the method for processing wall surfaces in a floor plan based on target detection is implemented.
[0015] To achieve the above-mentioned purpose and other related purposes, the present invention provides an electronic device, including: a processor, a memory and a communication interface; wherein the memory is used to store a computer program; the processor is used to load and execute the computer program so that the electronic device executes the floor plan wall processing method based on target detection; the communication interface is used to realize communication between the access device and other devices.
[0016] As described above, the present invention provides a method for processing floor plan walls based on target detection. In order to achieve the purpose of improving the accuracy of floor plan recognition through deep learning methods, the walls of floor plan samples input into the deep learning model are preprocessed by this method to input more standard floor plans to improve the image quality, reduce interference information, and improve the standardization of model training samples and the recognition accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1Shown is a flow chart of a method for processing floor plan walls based on target detection in one embodiment of the present invention.
[0018] Figure 2 Shown is a schematic diagram of an initial floor plan of a floor plan wall processing method based on target detection in one embodiment of the present invention.
[0019] Figure 3 Shown is a schematic diagram of a floor plan with furniture removed according to a floor plan wall processing method based on target detection in one embodiment of the present invention.
[0020] Figure 4 Shown is a schematic diagram of wall components of a floor plan according to a floor plan wall processing method based on target detection in one embodiment of the present invention.
[0021] Figure 5 Shown is a module schematic diagram of a house plan wall processing system based on target detection in one embodiment of the present invention.
[0022] Figure 6 Shown is a schematic structural diagram of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION
[0023] The following describes the embodiments of the present invention through specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in the field without making creative work belong to the scope of protection of the present invention.
[0024] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0025] In order to solve the problem of low recognition accuracy caused by non-standard drawing of floor plan samples and chaotic components in the prior art, the present invention provides a floor plan wall processing method, system, medium and equipment based on target detection.
[0026] like Figure 1 As shown, this embodiment provides a method for processing wall of a floor plan based on target detection, and the method comprises the following steps:
[0027] S11: Detect furniture in the floor plan and locate the area where the furniture is located.
[0028] Specifically, we first use the clustering method to Figure 2 The sizes of furniture in the data set in the floor plan shown are counted, and then N detection frames of different sizes are obtained according to the clustering statistics results, and M different proportions are set for each detection frame. N and M are determined according to the actual clustering results. In actual applications, 3 different sizes of detection frames are used, 3 proportions are set for each type of detection frame, and a total of 9 detection frames are used to achieve furniture coverage.
[0029] Furthermore, K detection boxes are randomly placed in the floor plan and the furniture in the detection boxes are predicted and classified. K is no more than L and is determined according to the size of the floor plan. In practical applications, L can be set to 1000.
[0030] Furthermore, the IOU of two similar detection frames is calculated. If it is greater than a preset threshold, the two frames are integrated into one. This step is repeated until the IOU between any two detection frames is less than the preset threshold to obtain the final detection frame, which is defined as the area where the furniture is located.
[0031] Preferably, vertical and horizontal straight lines around the area where the furniture is located are detected, and the surrounding straight lines are excluded from the area where the furniture is located to avoid pixel RGB value assignment processing in S12.
[0032] S12: Assigning values to the RGB pixels in the area where the furniture is located.
[0033] Specifically, the number of pixels with the same RGB value outside the area where the furniture is located in the floor plan is obtained by counting, and the proportion of pixels with different RGB values is calculated according to the number of pixels with the same RGB value, and finally the pixel RGB value with the largest proportion is obtained.
[0034] Furthermore, the RGB value is used to replace the RGB value of all pixels in the area where the furniture is located. For example, white is 255255255. In layman's terms, the area where the furniture is located is filled with white, and the following is obtained: Figure 3 Floor plan shown.
[0035] S13: Performing contour detection on the floor plan components to obtain floor plan contour information.
[0036] Specifically, first, the contour of the floor plan is calculated through cv2.findContours and saved in the form of a tree diagram. Secondly, the contour subscript, the coordinates of the contour points and the subscript of the parent contour are recorded for each contour. Then the subscript of the outermost parent contour is defined as -1. Finally, the parent contour of the current contour is continuously updated while recording the depth of the node until the parent contour subscript of the latest node is -1, at which time the depth of the node is returned.
[0037] Furthermore, the contour is preprocessed through the following steps.
[0038] Step 1: Take the first and last two points of the three adjacent contour points in the contour as endpoints and connect the two points to form a line segment AB;
[0039] Step 2: Calculate the perpendicular distance d between the middle contour point C among the three contour points and the line segment AB.
[0040] Step 3: Compare d with the preset threshold. If d is less than the threshold, segment AB is used as the approximate constituent segment of the contour. If d is greater than the threshold, segment AC and BC are formed as the approximate constituent segments of the contour using C as the endpoints.
[0041] Step 4: Repeat steps 1 to 3 to obtain approximate constituent line segments of the contour as constituent line segments of the contour, and record the number of endpoints constituting the contour line segments.
[0042] Preferably, the preset threshold value threshold can be set to 0.001*the area of the largest contour. If d is less than 0.001*the area of the largest contour, the contour point C is filtered and the line segment AB is used as the approximate constituent line segment of the contour. It should be noted that 0.001 is an application threshold value, which can be adjusted according to actual conditions.
[0043] Through the above steps, the polygon contour is fitted, and the contour information is represented by fewer points, thereby reducing the number of points constituting the contour.
[0044] S14: Filter the floor plan outline according to the screening condition to obtain the wall outline of the floor plan.
[0045] Specifically, a wall contour screening condition is determined, and the screening condition is iteratively confirmed by updating the deep learning model.
[0046] Further, it is determined whether the contour depth obtained in S13 is less than P. If not, the contour is filtered. For example, if P is 4 and the contour depth is greater than or equal to 4, it is determined that the contour is not a wall contour and the contour is filtered.
[0047] Further, the maximum inscribed circle radius of the contour is calculated to determine whether the maximum inscribed circle radius of the contour is within a preset range, and if not, the contour is filtered. For example, the preset range is set to 0.5-2 times the wall thickness according to the normal wall thickness, and if the maximum inscribed circle radius is not within the range, the contour is filtered.
[0048] Further, the proportion of the area of the obtained outline to the area of the floor plan is calculated, and it is determined whether the proportion is within a preset range. If not, the outline is filtered. For example, according to the area of a normal floor plan, the preset range of the wall outline area is set to 0.1%-3% of the floor plan area. If the wall outline area is not within the range, the outline is filtered.
[0049] Further, the ratio of the perimeter to the contour area of the contour is calculated to determine whether the ratio is greater than a preset value, and if not, the contour is filtered. For example, according to the theorem of normal polygons, the threshold of the ratio of the perimeter to the contour area is set to 0.06, and if the ratio is not within the range, the contour is filtered.
[0050] Further, the number of endpoints constituting the line segments of the contour is calculated and obtained by S13, and it is determined whether the number of endpoints is within a preset range, and if not, the contour is filtered. For example, the number of endpoints is set to 4-40 points, and if the number of endpoints is not within the range, the contour is filtered.
[0051] Through the above screening conditions, suitable wall contours are obtained as important components of the standard floor plan for model training.
[0052] S15: Fill the wall outline to obtain a standard training floor plan.
[0053] Specifically, the RGB values of the pixels constituting the outline of the floor plan are obtained, and the RGB values are used to replace the RGB values of the pixels within the wall outline of the floor plan. For example, black 0 0 0. In layman's terms, the area within the wall outline is filled with black, and the following is obtained: Figure 4 Wall component diagram shown.
[0054] All or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to the computer program. Based on such understanding, the present invention also provides a computer program product, including one or more computer instructions. The computer instructions can be stored in a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computer or a data storage device such as a server or a data center that includes one or more available media integrated.
[0055] See also Figure 5This embodiment provides a floor plan wall processing system 50 based on target detection, which is installed in an electronic device as a software to execute the floor plan wall processing method based on target detection described in the above method embodiment when running. Since the technical principle of this system embodiment is similar to that of the above method embodiment, the same technical details will not be repeated.
[0056] The house plan wall processing system 50 based on target detection in this embodiment specifically includes: a positioning module 51, a detection module 52, a filtering module 53, and a filling module 54. The positioning module 51 is used to detect furniture in the house plan and locate the area where the furniture is located; the detection module 52 is used to perform contour detection on the house plan components to obtain the house plan contour information; the filtering module 53 is used to filter the house plan contour according to the screening condition to obtain the house plan wall contour; the positioning module 51 is used to perform pixel filling on the area where the furniture is located and the wall contour.
[0057] Those skilled in the art should understand that Figure 5 The division of each module in the embodiment is only a division of a logical function, and can be fully or partially integrated into one or more physical entities during actual implementation. And these modules can all be implemented in the form of software called by a processing element, or all in the form of hardware, or some modules can be implemented in the form of software called by a processing element, and some modules can be implemented in the form of hardware. For example, the detection module 52 can be a separately established processing element, or it can be integrated in a certain chip for implementation. In addition, it can also be stored in a memory in the form of program code, and a certain processing element calls and executes the function of the detection module 52. The implementation of other modules is similar. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in a processor element or an instruction in the form of software.
[0058] See also Figure 6 This embodiment provides an electronic device, which may be a portable computer, a smart phone, a tablet computer, etc. In detail, the electronic device at least includes: a memory 62, a processor 63, and a communication interface 64 connected via a bus 61, wherein the communication interface 64 is used to realize communication between the data access device and other devices, wherein the memory 62 is used to store computer programs, and the processor 63 is used to execute the computer programs stored in the memory 62 to execute all or part of the steps in the aforementioned method embodiment.
[0059] The system bus mentioned above can be a Peripheral Pomponent Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface is used to realize the communication between the database access device and other devices (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM), and may also include non-volatile memory, such as at least one disk storage.
[0060] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0061] In summary, the present invention provides a method, system, medium and device for processing wall of house type diagram based on target detection. For house type diagrams with complex real scenes, structural recognition, splitting and data annotation are performed on them so as to train deep learning models as samples of house type diagrams. Through furniture detection, contour detection, image recognition and component detection models in complex house type diagrams, the wall, one of the most important components in the house type, is separated and the corresponding wall contour, wall thickness and position are annotated, thereby denoising the house type diagram, further improving the image quality, reducing interference information and improving the recognition accuracy. Therefore, the present invention effectively overcomes various shortcomings in the prior art and has a high industrial utilization value.
[0062] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.
Claims
1. A method for processing wall surfaces in floor plan based on target detection. It is characterized in that include: Detecting furniture in the floor plan and locating the area where the furniture is located; Assigning values to the RGB pixels in the area where the furniture is located; Performing contour detection on the floor plan components to obtain floor plan contour information; Filter the outline of the floor plan according to the screening condition to obtain the wall outline of the floor plan; Fill in the wall outlines to obtain the standard training floor plan; Count and obtain the percentage of pixels with the same RGB value outside the area where the furniture is located in the floor plan; Compare and obtain the RGB values of the same pixels with the largest proportion; The RGB value is used to replace the RGB value of the pixel point in the area where the furniture is located; Calculate the outline of the floor plan through cv2.findContours and save it in the form of a tree diagram; Record the contour subscript, the coordinates of the contour points and the subscript of the parent contour for the contour; Define the subscript of the outermost parent contour as -1; Looping to update the parent contour of the contour, recording the depth of the node, until the parent contour of the latest node is subscripted to -1; Returns the depth of a node; Step 1: Take the first and last two contour points of the three adjacent contour points in the contour as endpoints and connect the two points to form a line segment AB; Step 2: Calculate the vertical distance d between the middle contour point among the three contour points and the line segment AB; Step 3: Compare d with a preset threshold value. If d is less than the threshold value, line segment AB is used as the approximate line segment of the contour. If d is greater than the threshold value, line segments AC and BC are formed with C as the endpoints as the approximate line segments of the contour. Step 4: Repeat steps 1 to 3 to obtain approximate constituent line segments of the contour as constituent line segments of the contour and record the number of endpoints of the contour line segments; The screening conditions are: Determine whether the contour depth is less than P, if not, filter the contour; Calculate the maximum inscribed circle radius of the contour, and determine whether the maximum inscribed circle radius is within a preset range, if not, filter the contour; Calculate the ratio of the area of the obtained outline to the area of the floor plan, and determine whether the ratio is within a preset range. If not, filter the outline; Calculate the ratio of the perimeter of the contour to the contour area, determine whether the ratio is greater than a preset value, and if not, filter the contour; The number of endpoints of the line segments constituting the contour is calculated, and it is determined whether the number of endpoints is within a preset range. If not, the contour is filtered.
2. The method according to claim 1, It is characterized in that Also includes: Performing cluster statistics on the furniture sizes in the data set in the floor plan; Obtain N detection frames of different sizes through clustering statistics, and define M detection frames of different proportions for each size frame, where N and M are positive integers; Predicting K detection boxes in the floor plan and classifying the furniture in the detection boxes; Calculate the IOU of two similar detection frames. If it is greater than the preset threshold, merge the two frames into one, until the IOU between any two detection frames is less than the preset threshold to obtain the final detection frame. The final detection frame is defined as the area where the furniture is located, and vertical and horizontal straight lines around the area where the furniture is located are detected.
3. The method according to claim 1, It is characterized in that Obtaining RGB values of pixels constituting the outline of the floor plan; The RGB value is used to replace the RGB value of the pixel point within the wall outline of the floor plan.
4. A house plan wall processing system based on target detection, It is characterized in that The system comprises: A positioning module, used to detect furniture in the floor plan and locate the area where the furniture is located; A detection module, used for performing contour detection on the components of the floor plan to obtain the contour information of the floor plan; Count and obtain the percentage of pixels with the same RGB value outside the area where the furniture is located in the floor plan; Compare and obtain the RGB values of the same pixels with the largest proportion; The RGB value is used to replace the RGB value of the pixel point in the area where the furniture is located; Calculate the outline of the floor plan through cv2.findContours and save it in the form of a tree diagram; Record the contour subscript, the coordinates of the contour points and the subscript of the parent contour for the contour; Define the subscript of the outermost parent contour as -1; Looping to update the parent contour of the contour, recording the depth of the node, until the parent contour of the latest node is subscripted to -1; Returns the depth of a node; Step 1: Take the first and last two contour points of the three adjacent contour points in the contour as endpoints and connect the two points to form a line segment AB; Step 2: Calculate the vertical distance d between the middle contour point among the three contour points and the line segment AB; Step 3: Compare d with a preset threshold value. If d is less than the threshold value, line segment AB is used as the approximate line segment of the contour. If d is greater than the threshold value, line segments AC and BC are formed with C as the endpoints as the approximate line segments of the contour. Step 4: Repeat steps 1 to 3 to obtain approximate constituent line segments of the contour as constituent line segments of the contour and record the number of endpoints of the contour line segments; A filtering module, used for filtering the outline of the floor plan according to a filtering condition to obtain the outline of the wall of the floor plan; Determine whether the contour depth is less than P, if not, filter the contour; Calculate the maximum inscribed circle radius of the contour, and determine whether the maximum inscribed circle radius is within a preset range, if not, filter the contour; Calculate the ratio of the area of the obtained outline to the area of the floor plan, and determine whether the ratio is within a preset range. If not, filter the outline; Calculate the ratio of the perimeter of the contour to the contour area, determine whether the ratio is greater than a preset value, and if not, filter the contour; Calculate the number of endpoints of the line segments constituting the contour, and determine whether the number of endpoints is within a preset range, and if not, filter the contour; A filling module is used to fill the area where the furniture is located and the wall outline with pixels.
5. A computer-readable storage medium having a computer program stored therein, It is characterized in that When the computer program is loaded and executed by the processor, the method for processing wall in a floor plan based on target detection as described in any one of claims 1 to 3 is implemented.
6. An electronic device, It is characterized in that include: Processor, memory and communication interface; wherein, The memory is used to store computer programs; The processor is used to load and execute the computer program so that the electronic device executes the floor plan wall processing method based on target detection as described in any one of claims 1 to 3; The communication interface is used to implement communication between the access device and other devices.
Citation Information
Patent Citations
Method and device for assisting in identifying a wall body in CAD based on deep learning
CN108804815A