Identification method for drawing block and drawing tag in architectural drawing, storage medium and electronic equipment
By using depth-first search algorithm and two-dimensional line segment tree to identify the diagram frame and diagram sign in architectural drawings, the problems of low efficiency and poor accuracy in the existing technology are solved, and efficient and accurate recognition effects are achieved.
Patent Information
- Application Number
- CN202510630558.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-16
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2045-05-16
AI Technical Summary
The frame detection method in existing architectural drawings is inefficient and has performance and accuracy problems caused by pixel drawing processing.
The depth-first search algorithm and a two-dimensional line segment tree are constructed. By obtaining the coordinate information of the endpoints of the straight line segments in the architectural drawings, a two-dimensional line segment tree is constructed, and the search is traversed to determine the location of the frame area, thereby identifying the drawing sign area.
The efficiency of frame and graph sign recognition is improved, the workload is reduced, and the recognition of high accuracy is achieved, with the recall and accuracy rate reaching 99.5% and 98.9% respectively.
Smart Images

Figure CN120148065A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of architectural drawing review, and particularly to a method for identifying title blocks in architectural drawings, a storage medium, and an electronic device. Background Art
[0002] Currently, in the architectural design industry, most construction drawings are drawn using software (for example, CAD drawings, etc.). Each manually drawn drawing needs to be reviewed through drawing review to determine whether it violates national standards and specifications.
[0003] In addition, the current review of title blocks is mainly carried out by manually selecting title blocks, so there is a problem of relatively low efficiency.
[0004] In addition, existing title block detection algorithms generally rely on large-scale image segmentation techniques, that is, the entire CAD drawing is output as a pixel map using vector drawing, so that segmentation algorithms in the CV field can be implemented. And the process of this kind of method is as follows: drawing step of the drawing: draw the vector CAD drawing; segmentation and labeling step: segment and label a large number of drawn images; model training step: use the labeled image information to train the segmentation model; segmentation task step: use the trained model to perform a segmentation task on the newly input pixel map.
[0005] Analyzing the above algorithm, it can be obtained that this method has the following disadvantages: the time consumed in the drawing process depends on the GPU performance and the drawing size, and at the same time, the drawing effect greatly affects the accuracy of subsequent tasks, resulting in a double loss of performance and accuracy; for continuous title blocks, that is, the case where the title blocks are completely adjacent to each other, the segmentation effect will be greatly reduced; in order to scale to obtain a suitable pixel map, an overly large scaling ratio may be used, resulting in serious distortion of the coordinates of the detected result in the original drawing. By analogy, it is difficult for pixel map-based methods to avoid these three key problems, and the accuracy of the title block detection task will greatly affect the accuracy of subsequent tasks.
[0006] In terms of algorithm logic, what the drawing steps do can be called the "preprocessing" of the CV image recognition task. The drawbacks caused by preprocessing are mainly due to the diversity of drawings. During the drawing process by designers, they often draw based more on human vision - what you see is what you get. For example, when multiple "sub-items" are drawn on the same drawing, designers often use a large interval to classify the drawing frames of each sub-item, making the size of the overall effective canvas very large, and its magnitude may be in the tens of millions of WCS coordinates, or even reach the hundred million level. In this case, when the original canvas content is drawn into a common 1080P pixel image, the distortion ratio is close to 1:1000 to 1:10000, which is unacceptable. Therefore, the original canvas content must be divided into regions. However, if the same idea is adopted for the region division task, the same problem will be faced, which means that a completely new algorithm must be used for preprocessing.
[0007] Therefore, the challenges of the overall task can be summarized into the following two points: there are three major drawbacks that cannot be solved based on pixel images, while based on vector images, there is a problem of exponential time expansion, that is, its search time is relatively long, which also means that its recognition efficiency is relatively low. Summary of the Invention
[0008] (I) Technical Problems to be Solved In view of the above-mentioned shortcomings and deficiencies of the prior art, the present invention provides a method, a storage medium, and an electronic device for recognizing the drawing frame labels in architectural drawings, which solve the technical problems of large workload and relatively low efficiency existing in the prior art.
[0009] (II) Technical Solutions To achieve the above object, the main technical solutions adopted by the present invention include: In a first aspect, an embodiment of the present invention provides a method for recognizing the drawing frame labels in architectural drawings, including: obtaining the coordinate information of the endpoints of all straight line segments detected from the architectural drawing; using the coordinate information of the endpoints of all straight line segments to construct a two-dimensional segment tree; traversing and searching the two-dimensional segment tree by using a depth-first search algorithm to obtain multiple target straight line segments related to the outer frame of the drawing frame area in all straight line segments, and determining the position of the drawing frame area based on the multiple target straight line segments; and identifying the drawing label area in the architectural drawing from within the drawing frame area.
[0010] In a possible embodiment, the coordinate information includes X coordinate information and Y coordinate information; the two-dimensional segment tree includes a first two-dimensional segment subtree and a second two-dimensional segment subtree, and the first two-dimensional segment subtree is constructed based on the X coordinate information of the endpoints of all straight line segments, and the second two-dimensional segment subtree is constructed based on the Y coordinate information of the endpoints of all straight line segments.
[0011] In a possible embodiment, the attributes of the first two-dimensional line segment subtree and the attributes of the nodes of the second two-dimensional line segment subtree include, but are not limited to, the minimum value of the corresponding coordinate interval, the maximum value of the corresponding coordinate interval, and a list of the identifiers of the straight line segments within the corresponding coordinate interval.
[0012] In a possible embodiment, a depth-first search algorithm is used to traverse and search the two-dimensional line segment tree, including: Intersection determination step: Find a first target node that matches the current straight line segment from the first two-dimensional line segment subtree, find a second target node that matches the current straight line segment from the second two-dimensional line segment subtree, and determine the intersection of the straight line segment corresponding to the first target node and the straight line segment corresponding to the second target node; wherein, the current straight line segment is one of all the straight line segments; Determine whether the current straight line segment and the straight line segments in the intersection satisfy a preset matching condition; wherein, the preset matching condition includes: being perpendicular to the current straight line segment, intersecting with the current straight line segment, and the intersection points of the two intersecting straight line segments are not near the centers of the two intersecting straight line segments; If it is determined that there are straight line segments in the intersection that satisfy the preset matching condition, continue to execute the intersection determination step for the straight line segments that satisfy the preset matching condition until multiple target straight line segments are searched; If it is determined that there are no straight line segments in the intersection that satisfy the preset matching condition, continue to execute the intersection determination step for the next straight line segment until multiple target straight line segments are searched.
[0013] In a possible embodiment, the depths of both the first two-dimensional line segment subtree and the second two-dimensional line segment subtree are not greater than logn + 1; where n is the total number of all straight line segments.
[0014] In a possible embodiment, determine whether a target keyword that exactly matches the preset keyword library can be found from the architectural drawing; If a target keyword that exactly matches the preset keyword library can be found, construct a first minimum circumscribed rectangle region that encloses the target keyword, and along the long side direction of the first minimum circumscribed rectangle region, expand the first minimum circumscribed rectangle region until it is connected to the target straight line segment, then stop the expansion to obtain a first expanded region, and determine the first expanded region as the title block region.
[0015] In a possible embodiment, determining the first expanded region as the title block region includes: Determine whether a target line type that matches the preset line type library can be found from the architectural drawing; If a target line type matching the preset line type library can be found from the architectural drawing, a second minimum circumscribed rectangle area surrounding the target line type is constructed, and the second minimum circumscribed rectangle area is diffused along the long side direction of the second minimum circumscribed rectangle area until it is diffused to be connected to the target straight line segment, and then the diffusion is stopped to obtain the second diffused area; Determine whether the area repetition degree of the first diffused area and the second diffused area is greater than a preset value; If the area repetition degree is greater than the preset value, the first diffused area is determined as the title block area.
[0016] In a possible embodiment, identifying the title block area in the architectural drawing from the border area further includes: If a target keyword that strictly matches the preset keyword library cannot be found, determine whether a target line type matching the preset line type library can be found from the architectural drawing; If a target line type matching the preset line type library can be found from the architectural drawing, a second minimum circumscribed rectangle area surrounding the target line type is constructed, and the second minimum circumscribed rectangle area is diffused along the long side direction of the second minimum circumscribed rectangle area until it is diffused to be connected to the target straight line segment, and then the diffusion is stopped to obtain the second diffused area, and the second diffused area is determined as the title block area.
[0017] In a second aspect, an embodiment of the present application provides a storage medium, on which a computer program is stored, and when the computer program is run by a processor, the method described in the first aspect or any optional implementation manner of the first aspect is executed.
[0018] In a third aspect, an embodiment of the present application provides an electronic device, including: a processor, a memory, and a bus, the memory stores machine-readable instructions executable by the processor, when the electronic device runs, communication between the processor and the memory is through the bus, and when the machine-readable instructions are executed by the processor, the method described in the first aspect or any optional implementation manner of the first aspect is executed.
[0019] In a fourth aspect, the present application provides a computer program product, and when the computer program product runs on a computer, the computer is enabled to execute the method in the first aspect or any possible implementation manner of the first aspect.
[0020] (3) Beneficial effects The beneficial effects of the present invention are: An embodiment of the present application provides a method for identifying the title block in an architectural drawing, a storage medium, and an electronic device. By obtaining the coordinate information of the endpoints of all straight line segments detected from the architectural drawing, constructing a two-dimensional segment tree using the coordinate information of the endpoints of all straight line segments, and traversing and searching the two-dimensional segment tree using a depth-first search algorithm to obtain multiple target straight line segments related to the outer frame of the title block area in the architectural drawing, determining the position of the title block area based on the multiple target straight line segments, and identifying the title block area in the architectural drawing from within the title block area based on the position of the title block area. Compared with the existing method of manually marking the title block, it can not only reduce the workload but also improve the recognition efficiency.
[0021] To make the above objects, features, and advantages to be achieved by the embodiments of the present application more clearly understandable, the following specifically enumerates preferred embodiments and, in conjunction with the accompanying drawings, provides a detailed description as follows. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] To more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings required to be used in the embodiments of the present application. It should be understood that the following drawings only show some embodiments of the present application and should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0023] Figure 1 Shows a flowchart of a method for identifying the title block in an architectural drawing provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0024] To better explain the present invention for easy understanding, the following will, in conjunction with the drawings, provide a detailed description of the present invention through specific embodiments.
[0025] To solve the problem of relatively low recognition efficiency in the existing technology, an embodiment of the present application provides a method for identifying the title block in an architectural drawing, a storage medium, and an electronic device. It completely abandons the technical route of using pixel maps for title block recognition and uses a newly designed independent data structure and algorithm to directly compress the exponentially expanding time complexity to the Ω(logn) level, quickly and accurately realizing this task.
[0026] To better understand the above technical solutions, the following will describe the exemplary embodiments of the present invention in more detail with reference to the drawings. Although the exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a more clear and thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.
[0027] Please refer to Figure 1 , Figure 1 which shows a flowchart of a method for identifying the title block in a building drawing provided by an embodiment of the present application. It should be understood that this identification method can be executed by an electronic device, and the specific device of the electronic device can be set according to actual needs, and the embodiments of the present application are not limited thereto. For example, the electronic device can be a computer or a server, etc. Specifically, this identification method includes: Step S110, obtaining the coordinate information of the endpoints of all straight line segments detected from the building drawing. Among them, the endpoints refer to the two endpoints of the straight line segment; the coordinate information includes X coordinate information and Y coordinate information.
[0028] It should be understood that the specific form of the building drawing can be set according to actual needs, and the embodiments of the present application are not limited thereto.
[0029] For example, the building drawing can be a CAD drawing, etc.
[0030] Here, it should be noted that the straight line segments involved in the present application can be horizontal or vertical straight line segments. And considering that when the drawing personnel draw the drawing, there will be some deviation between the drawn straight line segment and the strictly horizontal or vertical straight line segment (for example, there is a deviation of 1-2 degrees between the drawn horizontal straight line segment and the horizontal line), it can also be regarded as a horizontal or vertical straight line segment.
[0031] Step S120, using the coordinate information of the endpoints of all straight line segments to construct a two-dimensional segment tree. Among them, the structure of the two-dimensional segment tree can be used to solve various two-dimensional vector graph problems. Its application fields cover various two-dimensional data processing, support rapid construction of trees and graphs, and have good versatility.
[0032] Optionally, considering that the title block is generally composed of straight line segments, the coordinate information of the endpoints of all straight line segments can be detected from the building drawing first, and then a two-dimensional segment tree is constructed using the data of the detected endpoints of the straight line segments. Among them, the two-dimensional segment tree is used to represent the interval where the straight line segment is located, and then these straight line segments fall into different intervals respectively, and the interval is composed of the coordinates of the endpoints of the segment. And for the two-dimensional segment tree, its interval is dynamic and not preset in advance. It needs to be generated according to the coordinates of the endpoints of the relevant straight line segments. And for an interval, it corresponds to at least one straight line segment, and one segment corresponds to one interval.
[0033] And for a building drawing, if there are n line segments in it, then there are 2n endpoints, and thus 2n - 1 intervals can exist.
[0034] In addition, when constructing the two-dimensional segment tree, the present application first constructs the first two-dimensional segment subtree in the X dimension, and then constructs the second two-dimensional segment subtree in the Y dimension. Among them, the first two-dimensional segment subtree is constructed based on the X coordinate information of the endpoints of all straight line segments; the second two-dimensional segment subtree is constructed based on the Y coordinate information of the endpoints of all straight line segments.
[0035] Moreover, after determining the coordinate information of the endpoints of all straight line segments, all intervals can be determined based on the coordinate information of the endpoints of all straight line segments. For example, in the case where the X coordinates of the two endpoints of a straight line segment are 0 and 1, and the X coordinates of the two endpoints of another straight line segment are 2 and 3, then one interval is 0-1, and another interval is 2-3; for another example, in the case where the Y coordinates of the two endpoints of a straight line segment are 0 and 1, and the Y coordinates of the two endpoints of another straight line segment are 0.5 and 1.5, then one interval is 0-0.5, another interval is 0.5-1, and the remaining interval is 1-1.5.
[0036] And for each node of the two-dimensional segment tree, each node of the two-dimensional segment tree includes the following five attributes: the minimum value of the coordinate interval corresponding to the node, the maximum value of the coordinate interval corresponding to the node, a list of the identifiers of all straight line segments within the coordinate interval corresponding to the node (or referred to as the object list within the coordinate interval corresponding to the node), the left child node of the node, and the right child node of the node. Among them, for the left child node and the right child node of the node, in the case where the node includes multiple child nodes, the left child node refers to the smallest child node, and the right child node refers to the largest child node, that is, multiple two-dimensional sub-intervals can be included within the interval, and for each two-dimensional sub-interval, there will also be five attributes such as the minimum value of the coordinate interval of the sub-interval and the maximum value of the coordinate interval of the sub-interval.
[0037] It should be noted here that if the left child node or the right child node of the node does not exist, the left child node or the right child node of the node can be set to be empty.
[0038] Therefore, after constructing the two-dimensional segment trees of the two dimensions, there is no need to search from all the data anymore, and only the intervals related to it need to be searched, thereby improving the efficiency of frame recognition.
[0039] To facilitate the understanding of the construction process of the two-dimensional segment tree, the following will be described through specific embodiments.
[0040] Specifically, first, the coordinate information data of the endpoints of all straight line segments are unified into a quadruple form of (minX, minY, maxX, maxY). Among them, minX refers to the minimum X coordinate among the endpoints of the current straight line segment; minY refers to the minimum Y coordinate among the endpoints of the current straight line segment; maxX refers to the maximum X coordinate among the endpoints of the current straight line segment; maxY refers to the maximum Y coordinate among the endpoints of the current straight line segment; Subsequently, select one dimension from the X dimension and the Y dimension, select the data related to this dimension from all quadruples, and divide the intervals in sequence. And, through the divided intervals, construct a two-dimensional segment subtree of one dimension. And, subsequently, the above steps can be repeatedly executed to construct a two-dimensional segment subtree of the other dimension. Among them, the depths of the two-dimensional segment subtrees of the two dimensions are not greater than logn + 1, where n is the total number of straight line segments of all straight line segments, and the base of logn is 2, that is, they are all balanced binary trees.
[0041] It should be noted here that because the coordinate projection strictly follows the data projection, any quadruple must be able to find a corresponding closed interval [minX, maxX], and this closed interval must exist in a certain node of the segment tree (it may not be strictly included, but must be included).
[0042] After the two-dimensional segment tree is constructed, its properties can be used to quickly search for global primitives. Due to the balanced structure of the tree, it is easy to obtain that the tree depth must be on the order of logn. The time cost of adding each quadruple data is equivalent to the tree depth, so the construction cost of the entire tree is Ω(logn). For searching, the cost of finding all quadruples in a given interval is Ω(logn + k), where k is the number of quadruples in each node. In the ideal state, the value of k is 1 (in the ideal state, all quadruples are evenly distributed in the entire tree, and the number of nodes in the entire tree does not exceed 4n, which can be obtained by summing the size of the maximum interval set and the geometric sequence). In the worst state, the value of k is n / logn, but in either case, its cost is less than Ω(n).
[0043] Step S130, use the depth-first search algorithm to traverse and search the two-dimensional segment tree to obtain multiple target straight line segments among all straight line segments that are related to the outer frame of the drawing area in the architectural drawing, and determine the position of the drawing area based on the multiple target straight line segments.
[0044] Optionally, the intersection determination step: find the first target node that matches the current straight line segment from the first two-dimensional segment subtree, find the second target node that matches the current straight line segment from the second two-dimensional segment subtree, and determine the intersection of the straight line segment corresponding to the first target node and the straight line segment corresponding to the second target node; where the current straight line segment is one of all straight line segments; Determine whether the current straight line segment and the straight line segments in the intersection set meet the preset matching conditions; wherein, the preset matching conditions include: being perpendicular to the current straight line segment and intersecting with the current straight line segment, and the intersection points of the two intersecting straight line segments are not located near the centers of the two intersecting straight line segments. Here, those within the preset distance range on both sides of the center of the straight line segment are regarded as near the center, and the preset distance range can be set according to actual needs; If it is determined that there are straight line segments in the intersection set that meet the preset matching conditions, then continue to perform the intersection determination step on the straight line segments that meet the preset matching conditions until multiple target straight line segments are searched; If it is determined that there are no straight line segments in the intersection set that meet the preset matching conditions, then continue to perform the intersection determination step on the next straight line segment until multiple target straight line segments are searched.
[0045] To facilitate the understanding of step S130, the following will be described through specific embodiments.
[0046] Specifically, in the case of obtaining the quadruples of all straight line segments, any one of the quadruples of the straight line segments can be arbitrarily selected as the starting point. Then, taking this quadruple as the search object, find the intervals of all nodes included in the coordinate data of this quadruple from the first two-dimensional line segment subtree and the second two-dimensional line segment subtree. And since each node corresponds to a straight line, the straight lines corresponding to the intervals found from the first two-dimensional line segment subtree and the straight lines corresponding to the intervals found from the second two-dimensional line segment subtree can be intersected.
[0047] Then, determine whether the selected straight line segment and the straight line segments in the intersection set meet the preset matching conditions. If it is determined that there are straight line segments in the intersection set that meet the preset matching conditions, then continue to perform the above steps on the straight line segments that meet the preset matching conditions; if it is determined that there are no straight line segments in the intersection set that meet the preset matching conditions, then continue to select the next straight line segment from all the straight line segments and perform the above steps on the selected next straight line segment until all the quadruples of the straight line segments have been searched.
[0048] It should be noted here that in the process of executing the depth-first search algorithm, it needs to follow the principle that once searched, it does not need to be searched again.
[0049] Therefore, for a set of quadruples with a quantity of n, the traversal overhead is Ω(n). Since the cost of each traversal search is Ω(logn)~Ω(n / logn), the overhead for completing the relationship construction of all quadruples is Ω(nlogn), and the upper limit is Ω(n 2 / log n), but the upper bound only occurs in the quadruples formed by circular rays, and such quadruples do not exist in architectural drawings (invalid designs). Therefore, it can be scientifically asserted that the overhead of the entire 2D segment tree, from construction to application in connectivity tasks and other previously mentioned difficult tasks, is of order no more than Ω(n log n). Relying on the capabilities of the 2D segment tree, it can be found that even in architectural design drawings with an extremely large quantity, complex tasks that traditional methods would take exponential time to complete can still be accomplished quickly and efficiently.
[0050] However, in the task of title block and border recognition, simply achieving the matching and connectivity search of quadruples is not enough. In the results obtained from the search task, it is necessary to identify which part is the title block, which involves the recognition problem in graphics. Fortunately, due to the function and practical characteristics of the title block in the architectural design industry, it can only be drawn as a rectangle. And from the previously mentioned feature that "all valid graphic elements are drawn within the title block", it can be inferred that the title block is generally the outer edge of the clustered graphics. These two aspects well describe the geometric and graphic features of the title block. Therefore, based on the original task, adjust the matching part in the algorithm strategy so that the matching proceeds along the rectangle's orientation, that is, starting from any side, traversing the rectangle clockwise or counterclockwise, and during the traversal, only look for lines with a perpendicular relationship and intersections near the endpoints, and terminate after finding 4 lines.
[0051] At this time, a closed shape that is only a rectangle can be found. The last difficulty lies in finding the final closed rectangle that meets the target. Due to the particularity of vector information, which describes the drawing method of the image, it can be well used for geometric mathematical operations, but it is very difficult to be used for the judgment of the overall vision. It is very difficult to obtain the overall information from the results, and complex logic must be defined to achieve this goal. At this time, the feature that "the title block is the outer edge of the clustered graphics" must be used to find, among all the rectangles, the one that meets this feature and excludes the interference of isolated outer edges (which may be interference items). This post-processing helps us achieve the precise positioning of the title block.
[0052] Step S140: Based on the position of the title block area, identify the title block area in the architectural drawing from within the title block area.
[0053] Specifically, after obtaining the ideal drawing frame detection result, the title block detection becomes the next problem. Compared with the drawing frame detection, the title block detection technology is relatively mature in the existing technology because the task drawbacks of CV recognition in the drawing frame detection are weakened. The range of the drawing frame is relatively fixed and usually within 100,000 WCS coordinates. Compared with the often-occurring tens of millions or even hundreds of millions of levels in the title block detection task, it is like a drop in the bucket; there is no need to perform segmentation, and the title block is unique; the requirements for resolution and clarity are low, the pre-processing is simple, the range is small, the number of graphic elements is small, and the drawing cost is also small. Therefore, the recognition technology of traditional CV can be well used for this task.
[0054] Based on this, the present application first proposes a method of artificial rule matching recognition, and will use a very efficient and strong generalization ability traditional algorithm to achieve title block detection. And, this algorithm detects the common keywords in the title block through the features formulated by humans, and forms a rectangular area with the distribution of these keywords to initially locate the title block; at the same time, combined with the core geometric feature of the title block - having a group of multiple equal-length parallel lines, the title block range is locked, specifically: Judge whether it is possible to find the target keyword that strictly matches the preset keyword library from the architectural drawing. Among them, the keywords included in the preset keyword library can be set according to actual needs, and the preset keyword library can be updated in real time so that the preset keyword library can cover all keywords as much as possible; strict matching means that the text in the architectural drawing is exactly the same as the keyword. If the meanings are the same but the expressions are different, it does not belong to strict matching; If a target keyword that strictly matches the preset keyword library can be found, a first minimum bounding rectangle area surrounding the target keyword is constructed, and the first minimum bounding rectangle area is expanded along the long side direction of the first minimum bounding rectangle area until it expands to connect with the target straight line segment, then the expansion stops, and a first expanded area is obtained. Then, it is determined whether a target line type that matches the preset line type library can be found from the architectural drawing. If a target line type that matches the preset line type library can be found from the architectural drawing, a second minimum bounding rectangle area surrounding the target line type is constructed, and the second minimum bounding rectangle area is expanded along the long side direction of the second minimum bounding rectangle area until it expands to connect with the target straight line segment, then the expansion stops, and a second expanded area is obtained. It is determined whether the area repetition degree between the first expanded area and the second expanded area is greater than a preset value. If the area repetition degree is greater than the preset value, the first expanded area is determined as the title block area, so that the text of the architectural drawing can be verified by the lines to ensure the accuracy of the result. If a target line type that matches the preset line type library cannot be found from the architectural drawing, the first expanded area is determined as the title block area. Among them, the lines included in the preset line library can also be set according to actual needs, and the preset line library can be updated in real time to make the preset line library cover all lines as much as possible. The specific value of the preset value can be set according to actual needs, and the embodiments of the present application are not limited thereto; If a target keyword that strictly matches the preset keyword library cannot be found, it is determined whether a target line type that matches the preset line type library can be found from the architectural drawing. If a target line type that matches the preset line type library can be found from the architectural drawing, a second minimum bounding rectangle area surrounding the target line type is constructed, and the second minimum bounding rectangle area is expanded along the long side direction of the second minimum bounding rectangle area until it expands to connect with the target straight line segment, then the expansion stops, and a second expanded area is obtained, and the second expanded area is determined as the title block area.
[0055] That is to say, if there are both strict matching results of keywords and matching results of lines in the architectural drawing, the matching results of the lines are used to verify the strict matching results of the keywords to determine the accuracy of the strict matching results of the keywords. If there are only strict matching results of keywords in the architectural drawing, the strict matching results of the keywords are used as intermediate data for subsequent determination of the title block area. Considering that there may be a situation where the text cannot be found in the key drawing, for example, the drafter uses lines to draw the text, so if there are only matching results of lines in the architectural drawing, the matching results of the lines are used as intermediate data for subsequent determination of the title block area.
[0056] Therefore, the time complexity of this algorithm is on the order of Ω(n). The logic of literal keyword matching adopts the data structure of a trie. To adapt to the situation where complete vocabulary is split into single characters, the time overhead is optimized, and the algorithm complexity of its brute-force solution is Ω(n^2).
[0057] In addition, to solve the problem that user operations are complex and still no ideal results can be obtained after complex operations, this application not only completely eliminates the human-machine operation link, but also has high speed and extremely low error and omission rates. According to experiments, the recall rate of frame detection is 99.5%, and the accuracy rate is 98.9%. The recall rate of label detection is 97%, and the accuracy rate is 96.6%. This is not only a breakthrough from zero, but also achieves an accuracy rate that is difficult for models in the field of artificial intelligence to reach. At the same time, since it does not rely on GPU computing power, its various aspects of overhead are extremely low.
[0058] In summary, by means of the above technical solutions, this application completely abandons the technical route of using pixel maps for frame recognition, uses a newly designed and independent data structure and algorithm, directly compresses the exponentially expanding time complexity to the level of Ω(log n), and quickly and accurately realizes this task.
[0059] It should be understood that the above method for identifying frame labels in architectural drawings is only exemplary. Those skilled in the art can make various deformations according to the above method, and the deformed solutions also fall within the protection scope of this application.
[0060] This application provides a storage medium on which a computer program is stored. When the computer program is run by a processor, it executes the method described in the embodiment.
[0061] This application also provides a computer program product. When the computer program product runs on a computer, it causes the computer to execute the method described in the method embodiment.
[0062] Those skilled in the art should understand that the embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can adopt the form of completely hardware embodiments, completely software embodiments, or embodiments combining software and hardware aspects. Moreover, the present invention can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes.
[0063] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, and the combination of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions.
[0064] It should be noted that the words "a" or "an" preceding a component do not exclude the existence of a plurality of such components. The present invention can be implemented by means of hardware including several different components and by means of a suitably programmed computer. Among the several devices listed, several of these devices may be embodied by the same hardware. The use of the words first, second, third, etc. is only for convenience of description and does not indicate any order. These words can be understood as part of the component name.
[0065] In addition, it should be noted that in the description of this specification, the descriptions of terms such as "an embodiment", "some embodiments", "embodiments", "examples", "specific examples" or "some examples", etc. refer to the specific features, structures, materials or characteristics described in connection with the embodiment or example being included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. In addition, without contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.
[0066] Although the preferred embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications after learning the basic creative concepts. Therefore, the technical solutions should be construed as including the preferred embodiments and all changes and modifications falling within the scope of the present invention.
[0067] Obviously, those skilled in the art can make various modifications and variations to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the technical solutions of the present invention and their equivalent technologies, the present invention should also include these modifications and variations.
Claims
1. A method for identifying drawing frames and drawings in architectural drawings, characterized in that: include: Obtaining coordinate information of endpoints of all straight line segments detected from the architectural drawing; Using the coordinate information of the endpoints of all the straight line segments, a two-dimensional segment tree is constructed; Using a depth-first search algorithm to traverse the two-dimensional line segment tree to obtain a plurality of target line segments related to the outer frame of the frame area in the architectural drawing from among all the line segments, and determining the position of the frame area based on the plurality of target line segments; Based on the position of the frame area, a drawing label area in the architectural drawing is identified from within the frame area.
2. The identification method according to claim 1, characterized in that: The coordinate information includes X coordinate information and Y coordinate information; the two-dimensional line segment tree includes a first two-dimensional line segment subtree and a second two-dimensional line segment subtree, and the first two-dimensional line segment subtree is constructed based on the X coordinate information of the endpoints of all the straight line segments, and the second two-dimensional line segment subtree is constructed based on the Y coordinate information of the endpoints of all the straight line segments.
3. The identification method according to claim 2, characterized in that: The attributes of the first two-dimensional line segment subtree and the attributes of the nodes of the second two-dimensional line segment subtree include but are not limited to the minimum value of the corresponding coordinate interval, the maximum value of the corresponding coordinate interval and a list of identifiers of straight line segments within the corresponding coordinate interval.
4. The identification method according to claim 3, characterized in that: The step of using a depth-first search algorithm to traverse and search the two-dimensional segment tree includes: The intersection determination step includes searching for a first target node that matches the current straight line segment from the first two-dimensional line segment subtree, searching for a second target node that matches the current straight line segment from the second two-dimensional line segment subtree, and determining the intersection of the straight line segment corresponding to the first target node and the straight line segment corresponding to the second target node; wherein the current straight line segment is one of all the straight line segments; Determine whether the current straight line segment and the straight line segments in the intersection meet a preset matching condition; wherein the preset matching condition includes: being perpendicular to the current straight line segment and intersecting with the current straight line segment, and the intersection points of the two intersecting straight line segments are not located near the centers of the two intersecting straight line segments; If it is determined that there is a straight line segment satisfying the preset matching condition in the intersection, then continue to perform the intersection determination step on the straight line segments satisfying the preset matching condition until the plurality of target straight line segments are searched; If it is determined that there is no straight line segment satisfying the preset matching condition in the intersection, the intersection determination step is continued to be performed on the next straight line segment until the plurality of target straight line segments are searched.
5. The identification method according to claim 2, characterized in that: The depth of the first two-dimensional line segment subtree and the depth of the second two-dimensional line segment subtree will not be greater than logn+1; wherein n is the total number of all the straight line segments.
6. The identification method according to claim 1, characterized in that: The step of identifying the drawing label area in the architectural drawing from the drawing frame area includes: Determining whether a target keyword that strictly matches a preset keyword library can be found from the architectural drawing; If a target keyword that strictly matches the preset keyword library can be found, a first minimum circumscribed rectangular area surrounding the target keyword is constructed, and the first minimum circumscribed rectangular area is diffused along the long side direction of the first minimum circumscribed rectangular area until it diffuses to the target straight line segment, then the diffusion is stopped to obtain a first diffused area, and the first diffused area is determined as the label area.
7. The identification method according to claim 6, characterized in that: The step of determining the first diffused area as the image label area includes: Determining whether a target line type matching a preset line type library can be found from the architectural drawing; If a target line type matching the preset line type library can be found in the architectural drawing, a second minimum circumscribed rectangular area surrounding the target line type is constructed, and the second minimum circumscribed rectangular area is diffused along the long side direction of the second minimum circumscribed rectangular area until it diffuses to the target straight line segment, and then the diffusion is stopped to obtain a second diffused area; Determining whether a region repetition degree between the region after the first diffusion and the region after the second diffusion is greater than a preset value; If the area repetition degree is greater than the preset value, the area after the first diffusion is determined as the image label area.
8. The identification method according to claim 6, characterized in that: The step of identifying the drawing label area in the architectural drawing from the drawing frame area further comprises: If the target keyword that strictly matches the preset keyword library cannot be found, determining whether a target line type that matches the preset line type library can be found from the architectural drawing; If a target line type matching the preset line type library can be found in the architectural drawing, a second minimum circumscribed rectangular area surrounding the target line type is constructed, and the second minimum circumscribed rectangular area is diffused along the long side direction of the second minimum circumscribed rectangular area until it diffuses to connect with the target straight line segment, and then the diffusion is stopped to obtain a second diffused area, and the second diffused area is determined as the drawing label area.
9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for identifying drawing frames and drawings in architectural drawings as described in any one of claims 1 to 8 is executed.
10. An electronic device comprising a processor, a memory and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the method for identifying drawing frames and drawings in architectural drawings as described in any one of claims 1-8.
Citation Information
Patent Citations
Picture label information extraction method, apparatus and device, and readable storage medium
CN116682130A
CAD drawing frame information extraction method and system
CN117373052A
Data processing method and device in way finding and electronic equipment
CN118925235A
Deep learning-based picture frame information intelligent identification method and system, and storage medium
CN119418359A
Database managementmethod using decoomposed minimum bounding rectangle
KR1020000007169A
Cited By
Electronic drawing label area positioning method and system and storage medium
CN121637599A
An electronic paper signature area positioning method, system and storage medium
CN121637599B