Recognition Method, Storage Medium and Electronic Device for Title Block in Architectural Drawings

By constructing a two-dimensional line segment tree and depth-first search algorithm to identify the frames and marks in architectural drawings, the problem of low identification efficiency in the existing technology is solved, and efficient and accurate frames and marks are achieved.

CN120148065BActive Publication Date: 2025-08-05SHANGHAI BANGTU INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510630558.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-16
Publication Date
2025-08-05
Estimated Expiration
2045-05-16

AI Technical Summary

Technical Problem

In the prior art, the identification efficiency of the frame diagrams in architectural drawings is low and the workload is large. The existing algorithms have problems such as excessive time consumption and low accuracy.

Method used

By obtaining the endpoint coordinate information of straight line segments in architectural drawings, a two-dimensional line segment tree is constructed, the depth-first search algorithm is used to identify the drawing frame area, and the drawing sign area is identified in combination with preset matching conditions and diffusion algorithm, and an independent design data structure and algorithm are used.

Benefits of technology

The efficiency of frame and graph sign recognition is improved, the workload is reduced, and the rapid and accurate identification is achieved, with the recall and accuracy rate reaching 99.5%, 98.9%, 97% and 96.6%, respectively.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120148065B_ABST
    Figure CN120148065B_ABST
Patent Text Reader

Abstract

The present invention relates to a method, storage medium and electronic device for identifying drawing frames and labels in architectural drawings, comprising the following steps: obtaining coordinate information of endpoints of all straight line segments detected from the architectural drawings; constructing a two-dimensional segment tree using the coordinate information of the endpoints of all straight line segments; traversing and searching the two-dimensional segment tree using a depth-first search algorithm to obtain a plurality of target straight line segments related to an outer frame of a drawing frame area in the architectural drawings from among all the straight line segments, and determining the position of the drawing frame area based on the plurality of target straight line segments; and identifying a drawing label area in the architectural drawing from within the drawing frame area based on the position of the drawing frame area. Compared with the existing method of manually marking drawing frames, the method can not only reduce workload but also improve recognition efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of architectural drawing review, and in particular to a method, storage medium and electronic equipment for identifying drawing frames and drawings in architectural drawings. Background Art

[0002] At present, the architectural design industry mostly uses software to draw construction drawings (for example, CAD drawings, etc.). Every manually drawn drawing needs to undergo drawing review to determine whether it violates national standards and specifications.

[0003] Furthermore, the current review of drawing frames is mainly conducted by people selecting drawing frames, so it has the problem of relatively low efficiency.

[0004] Furthermore, existing frame detection algorithms are generally based on large-scale image segmentation techniques. This involves converting an entire CAD drawing into a pixel map using vector graphics, allowing segmentation algorithms in the CV field to perform segmentation. The implementation process of these methods is as follows: a drawing step: creating a vector CAD drawing; a segmentation and labeling step: segmenting and labeling a large number of rendered images; a model training step: using the labeled image information to train a segmentation model; and a segmentation task step: using the trained model to perform segmentation on a newly input pixel map.

[0005] An analysis of the above algorithm reveals the following drawbacks: The drawing process takes time that depends on GPU performance and the size of the drawing. Furthermore, the drawing quality significantly impacts the accuracy of subsequent tasks, resulting in a double loss of performance and accuracy. For continuous frames, where frames are completely adjacent to each other, the segmentation effect is significantly reduced. Furthermore, in order to scale the pixel map to fit, an excessively large scaling ratio may be used, resulting in significant distortion of the coordinates in the original image after detection. By analogy, pixel map-based methods struggle to avoid these three key issues, and the accuracy of the frame detection task significantly impacts the accuracy of subsequent tasks.

[0006] In terms of algorithmic logic, the drawing step can be called the "preprocessing" of the CV image recognition task. The drawbacks caused by preprocessing are mainly caused by the diversity of drawings. In the process of drawing, designers tend to draw drawings based on human vision - what you see is what you get. For example, when designers draw multiple "sub-items" at the same time in a drawing, they use larger intervals to classify the frames of each sub-item, making the size of the overall effective canvas very large, which may be in the tens of millions of WCS coordinates, or even up to the hundreds of millions. In this case, the distortion ratio of drawing the original canvas content into a common 1080P pixel image is close to 1:1000 to 1:10000, which is unacceptable, so the original canvas content must be divided into regions. If the region division task adopts exactly the same idea, it will face the same problem, which means that a completely new algorithm must be used for pre-processing.

[0007] Therefore, the challenges of the overall task can be summarized as follows: pixel-based images have three major drawbacks that cannot be resolved, while vector-based images face the problem of exponential time expansion, that is, their search time is relatively long, and they also have the problem of relatively low recognition efficiency. Summary of the Invention

[0008] (1) Technical issues to be resolved

[0009] In view of the above-mentioned shortcomings and deficiencies of the prior art, the present invention provides a method, storage medium and electronic device for identifying drawing frames and labels in architectural drawings, which solve the technical problems of large workload and relatively low efficiency in the prior art.

[0010] (2) Technical solution

[0011] In order to achieve the above objectives, the main technical solutions adopted by the present invention include:

[0012] In a first aspect, an embodiment of the present invention provides a method for identifying frames and labels in architectural drawings, comprising: obtaining coordinate information of the endpoints of all straight line segments detected from the architectural drawings; constructing a two-dimensional segment tree using the coordinate information of the endpoints of all straight line segments; 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 frame area in the architectural drawing from all the straight line segments, and determining the position of the frame area based on the multiple target straight line segments; and identifying the label area in the architectural drawing from within the frame area based on the position of the frame area.

[0013] In one 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.

[0014] In one 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 their corresponding coordinate intervals, the maximum value of their corresponding coordinate intervals, and a list of identifiers of straight line segments within their corresponding coordinate intervals.

[0015] In one possible embodiment, a depth-first search algorithm is used to traverse and search the two-dimensional segment tree, including:

[0016] Intersection determination step: 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;

[0017] Determine whether the current line segment and the line segments in the intersection meet preset matching conditions; wherein the preset matching conditions include: being perpendicular to the current line segment and intersecting with the current line segment, and the intersection point of the two intersecting line segments is not near the center of the two intersecting line segments;

[0018] If it is determined that there is a line segment that meets the preset matching condition in the intersection, then continue to perform the intersection determination step on the line segments that meet the preset matching condition until multiple target line segments are found;

[0019] If it is determined that there is no straight line segment that meets the preset matching condition in the intersection, the intersection determination step is continued for the next straight line segment until multiple target straight line segments are found.

[0020] In a possible embodiment, the depth of the first two-dimensional line segment subtree and the depth of the second two-dimensional line segment subtree are both no greater than logn+1, where n is the total number of all line segments.

[0021] In one possible embodiment, it is determined whether a target keyword that strictly matches a preset keyword library can be found from the architectural drawings;

[0022] 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 connects with the target straight line segment. The diffusion is stopped to obtain the first diffused area, and the first diffused area is determined as the label area.

[0023] In a possible embodiment, determining the area after the first diffusion as the image label area includes:

[0024] Determine whether a target line type that matches a preset line type library can be found from the architectural drawing;

[0025] If a target line type that matches the preset line type library can be found in the architectural drawing, a second minimum bounding rectangle area surrounding the target line type is constructed, and the second minimum bounding rectangle area is diffused along the long side direction of the second minimum bounding rectangle area until it contacts the target straight line segment, and then the diffusion is stopped to obtain the second diffused area;

[0026] Determine whether the area overlap between the first diffused area and the second diffused area is greater than a preset value;

[0027] If the area repetition is greater than a preset value, the area after the first diffusion is determined as the label area.

[0028] In a possible embodiment, identifying a drawing label area in an architectural drawing from a drawing frame area further includes:

[0029] If the target keyword that strictly matches the preset keyword library cannot be found, then it is determined whether a target line type that matches the preset line type library can be found from the architectural drawings;

[0030] If a target line type that matches 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 connects with the target straight line segment. The diffusion is stopped to obtain the second diffused area, and the second diffused area is determined as the drawing label area.

[0031] In a second aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, and the computer program is executed by a processor to execute the method described in the first aspect or any optional implementation of the first aspect.

[0032] In a third aspect, an embodiment of the present application provides an electronic device comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the memory communicate 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 of the first aspect is executed.

[0033] In a fourth aspect, the present application provides a computer program product, which, when running on a computer, enables the computer to execute the method in the first aspect or any possible implementation of the first aspect.

[0034] (3) Beneficial effects

[0035] The beneficial effects of the present invention are:

[0036] An embodiment of the present application provides a method, storage medium, and electronic device for identifying frames and labels in architectural drawings. The method obtains coordinate information of the endpoints of all straight line segments detected from the architectural drawings, constructs a two-dimensional segment tree using the coordinate information of the endpoints of all straight line segments, and uses a depth-first search algorithm to traverse and search the two-dimensional segment tree to obtain multiple target straight line segments related to the outer frame of the frame area in the architectural drawing from all the straight line segments. The method also determines the position of the frame area based on the multiple target straight line segments, and identifies the label area in the architectural drawing from the frame area based on the position of the frame area. Compared with the existing method of manually marking frames, the method can not only reduce the workload but also improve the recognition efficiency.

[0037] In order to make the above-mentioned objectives, features and advantages to be achieved by the embodiments of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.

[0039] Figure 1 A flow chart of a method for identifying drawing frames and labels in architectural drawings provided by an embodiment of the present application is shown. DETAILED DESCRIPTION

[0040] In order to better explain the present invention and facilitate understanding, the present invention is described in detail below through specific implementation methods in conjunction with the accompanying drawings.

[0041] In order to solve the problem of low recognition efficiency in the existing technology, the embodiments of the present application provide a method, storage medium and electronic device for identifying frames and labels in architectural drawings. It completely abandons the technical route of using pixel images for frame recognition, and uses an independently designed new data structure and algorithm to directly compress the exponentially expanded time complexity to the Ω (logn) level, thereby quickly and accurately achieving the task.

[0042] To better understand the above technical solutions, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying 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. Instead, these embodiments are provided to enable a clearer and more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.

[0043] See Figure 1 , Figure 1 A flowchart of a method for identifying drawing frames and labels in architectural drawings provided by an embodiment of the present application is shown. It should be understood that the identification method can be performed by an electronic device, and the specific device of the electronic device can be configured 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. Specifically, the identification method includes:

[0044] Step S110: Obtain the coordinate information of the endpoints of all line segments detected from the architectural drawing, wherein the endpoints refer to the two end points of the line segment; and the coordinate information includes X coordinate information and Y coordinate information.

[0045] It should be understood that the specific form of the architectural drawings can be set according to actual needs, and the embodiments of the present application are not limited thereto.

[0046] For example, the architectural drawing may be a CAD drawing or the like.

[0047] It should be noted here that the straight line segments involved in this application can be horizontal or vertical straight line segments, and considering that when the drawing draftsman draws the drawings, the straight line segments he draws may have some deviations from the horizontal or vertical straight line segments in the strict sense (for example, the horizontal straight line segments he draws may have a deviation of 1-2 degrees from the horizontal line), they can also be regarded as horizontal or vertical straight line segments.

[0048] Step S120: Use the coordinate information of the endpoints of all line segments to construct a 2D segment tree. The 2D segment tree structure can be used to solve various 2D vector graphics problems. Its application covers all types of 2D data processing, supports rapid tree and graph construction, and has excellent versatility.

[0049] Alternatively, considering that a drawing frame is generally composed of straight line segments, the endpoint coordinate information of all straight line segments can be detected from the architectural drawings first, and then the data of the detected straight line segment endpoints can be used to construct a two-dimensional segment tree. The two-dimensional segment tree is used to express the intervals in which the straight line segments are distributed, and then these straight line segments fall into different intervals, and the intervals are composed of the coordinates of the endpoints of the segments. In addition, for the two-dimensional segment tree, its intervals are dynamic and not pre-set. It needs to be generated based on the coordinates of the endpoints of the relevant straight line segments. In addition, for an interval, it corresponds to at least one straight line segment, and one segment corresponds to one interval.

[0050] Also, for an architectural drawing, if there are n line segments, then there are 2n endpoints, and thus there can be 2n-1 intervals.

[0051] In addition, when constructing a two-dimensional segment tree, the present application first constructs a first two-dimensional segment subtree in the X dimension, and then constructs a second two-dimensional segment subtree in the Y dimension. 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.

[0052] Furthermore, 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, if the X coordinates of the two endpoints of one 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, if the Y coordinates of the two endpoints of one straight line segment are 0 and 1, and the Y coordinates of the other 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.

[0053] Furthermore, each node in the two-dimensional line 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 identifiers of all straight line segments within the coordinate interval corresponding to the node (or a list of objects within the coordinate interval corresponding to the node), the left child node of the node, and the right child node of the node. Specifically, for the left child node and the right child node of the node, if 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, i.e., the interval may also include multiple two-dimensional sub-intervals, and each two-dimensional sub-interval may also have five attributes, such as the minimum value of the sub-interval's coordinate interval and the maximum value of the sub-interval's coordinate interval.

[0054] It should be noted here that if a node does not have a left child node or a right child node, the left child node or the right child node of the node can be set to empty.

[0055] Therefore, after constructing the two-dimensional segment tree of two dimensions, there is no need to search from all the data, but only to find the interval related to it, thereby improving the efficiency of frame recognition.

[0056] To facilitate understanding of the construction process of a two-dimensional segment tree, a specific embodiment is used to describe it below.

[0057] Specifically, first, the coordinate information data of the endpoints of all line segments are unified into a four-tuple form of (minX, minY, maxX, maxY). Among them, minX refers to the minimum X coordinate among the endpoints of the current line segment; minY refers to the minimum Y coordinate among the endpoints of the current line segment; maxX refers to the maximum X coordinate among the endpoints of the current line segment; maxY refers to the maximum Y coordinate among the endpoints of the current line segment;

[0058] Then, one dimension is selected from the X and Y dimensions, and data related to that dimension is selected from all quads, and the intervals are divided in sequence. Furthermore, a two-dimensional segment subtree of one dimension is constructed using the divided intervals. Furthermore, the above steps can be repeated to construct a two-dimensional segment subtree of the other dimension. The depth of the two-dimensional segment subtrees of both dimensions will not exceed logn+1, where n is the total number of all line segments, and the base of logn is 2, meaning that they are both balanced binary trees.

[0059] It should be noted here that since the coordinate projection is strictly in accordance with the data projection, any quadruple can definitely find the corresponding closed interval [minX, maxX], and this closed interval must exist in a node of the segment tree (may not be strictly included, but it must be included).

[0060] Once the two-dimensional segment tree is constructed, its properties can be exploited to quickly search for global primitives. Due to the tree's balanced structure, the tree depth is simply on the order of logn. Each addition of a quadruple requires a time cost equal to the tree depth, resulting in a construction cost of Ω(logn). For searches, the cost of finding all quadruple pairs in a given interval is Ω(logn+k), where k is the number of quadruple pairs per node. Ideally, k is 1 (all quadruple pairs are evenly distributed throughout the tree, and the number of nodes in the tree does not exceed 4n, which can be calculated by summing the size of the largest interval set with a geometric progression). In the worst case, k is n / logn, but in either case, the cost is less than Ω(n).

[0061] In step S130 , a depth-first search algorithm is used 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 all the line segments, and the position of the frame area is determined based on the plurality of target line segments.

[0062] Optionally, 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;

[0063] Determine whether the current line segment and the line segments in the intersection meet preset matching conditions. Preset matching conditions include: being perpendicular to the current line segment and intersecting the current line segment, and the intersection of the two intersecting line segments is not near the center of the two intersecting line segments. Line segments within a preset distance range on both sides of the center of the line segment are considered to be near the center, and the preset distance range can be set according to actual needs.

[0064] If it is determined that there is a line segment that meets the preset matching condition in the intersection, then continue to perform the intersection determination step on the line segments that meet the preset matching condition until multiple target line segments are found;

[0065] If it is determined that there is no straight line segment that meets the preset matching condition in the intersection, the intersection determination step is continued for the next straight line segment until multiple target straight line segments are found.

[0066] To facilitate understanding of step S130, a specific embodiment is used to describe it below.

[0067] Specifically, when obtaining a quadruple of all straight line segments, you can arbitrarily select the quadruple of one of the straight line segments as the starting point. Then, using the quadruple as the search object, find the interval of all nodes within the coordinate data of the quadruple from the first two-dimensional segment subtree and the second two-dimensional segment subtree. Since each node corresponds to a straight line, the straight lines corresponding to the interval found from the first two-dimensional segment subtree and the straight lines corresponding to the interval found from the second two-dimensional segment subtree can be intersected.

[0068] Then, a determination is made as to whether the selected line segment and the line segments in the intersection satisfy the preset matching criteria. If a line segment that satisfies the preset matching criteria is determined to exist in the intersection, the above steps are continued for the line segment that satisfies the preset matching criteria. If a line segment that satisfies the preset matching criteria is determined to not exist in the intersection, the next line segment is selected from all line segments and the above steps are continued for the next selected line segment until all line segment quads have been searched.

[0069] It should be noted here that in the process of executing the depth-first search algorithm, it needs to follow the principle of no need to search again after searching.

[0070] Therefore, for a set of four-tuples with a number of n, the traversal cost is Ω(n). Since the cost of each traversal search is Ω(logn)~Ω(n / logn), the cost of completing the relationship construction of all four-tuples is Ω(nlogn), and the upper limit is Ω(n 2 / logn), but the upper limit only occurs for quadruplets consisting of circular rays, which do not exist in architectural drawings (invalid designs). Therefore, we can scientifically assert that the cost of constructing the entire 2D segment tree, from its construction to its application to difficult tasks such as connectivity, does not exceed Ω(nlogn). Leveraging the power of 2D segment trees, we can demonstrate that even within extremely large architectural design drawings, complex tasks that would require exponential time with traditional methods can be quickly and efficiently completed.

[0071] However, in the task of identifying frames and labels, simply matching and connecting quadruplets is not enough. In the results of the search task, it is necessary to identify which part is the frame, which involves the problem of graphics recognition. Fortunately, frames in the architectural design industry can only be drawn as rectangles due to their function and practical characteristics. Furthermore, based on the characteristic mentioned at the beginning that "all valid elements are drawn within the frame," it can be inferred that the frame is generally the outer edge of the clustered graphics. These two characteristics well describe the geometric and graphic features of the frame. Therefore, based on the original task, the matching part of the algorithm strategy is adjusted so that the matching is carried out according to the direction of the rectangle. That is, starting from any edge, traversing the rectangle clockwise or counterclockwise, and during the traversal process, only looking for lines with vertical relationships and intersection points near the endpoints, and terminating after finding four lines.

[0072] At this point, we can find a closed shape that is simply a rectangle. The final challenge lies in finding the final enclosing rectangle that meets our goal. Due to the special nature of vector information, it describes the image's rendering method, making it well suited for geometric operations but very difficult to use for overall visual judgment. It's difficult to extract holistic information from the results, and complex logic must be defined to achieve this. At this point, we must utilize the characteristic that the "frame is the outer edge of the clustered shape." We must find all rectangles that meet this characteristic, while eliminating any isolated outer edges (which may be interference). This post-processing helps us accurately locate the frame.

[0073] Step S140 : Based on the position of the frame area, a label area in the architectural drawing is identified from within the frame area.

[0074] Specifically, after obtaining the ideal frame detection results, label detection becomes the next challenge. Compared to frame detection, label detection technology is relatively mature among existing technologies. This is because the disadvantages of CV recognition in frame detection are weakened. The range of the frame is relatively fixed and usually within 100,000 WCS coordinates. Compared with the tens of millions or even hundreds of millions of coordinates that often appear in label detection tasks, it is like a small witch compared to a big witch; there is no need to segment, and the label is unique; the resolution and clarity requirements are low, the pre-processing is simple, and the range is small, the number of primitives is small, and the drawing overhead is also small. Therefore, traditional CV recognition technology can be used well for this task.

[0075] Based on this, this application proposes for the first time a method for manual rule matching and recognition, which uses a highly efficient and generalizable traditional algorithm to detect image labels. Furthermore, the algorithm uses artificially defined features to detect common keywords in image labels and organizes the distribution of these keywords into rectangular areas to initially locate the image labels. Furthermore, the algorithm combines the core geometric features of image labels—a set of multiple parallel lines of equal length—to lock the image label range. Specifically:

[0076] Determine whether the target keyword can be found in the architectural drawings and strictly matches the preset keyword library. 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 to ensure that the preset keyword library covers all keywords as much as possible. A strict match means that the text in the architectural drawing is exactly the same as the keyword. If the meaning is the same but the expression is different, it does not constitute a strict match.

[0077] 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 is diffused to the target straight line segment, and then the diffusion is stopped to obtain the first diffused area, and it is judged whether a target line type that matches the preset line type library can be found in the architectural drawings; if a target line type that matches the preset line type library can be found in the architectural drawings, a second minimum circumscribed rectangular area surrounding the target line type is constructed, and the second minimum circumscribed rectangular area is diffused along the second minimum circumscribed rectangular area. The second minimum circumscribed rectangular area is diffused in the long side direction of the circumscribed rectangular area until it is diffused to the target straight line segment, then the diffusion is stopped to obtain the second diffused area; it is determined whether the area repetition of the first diffused area and the second diffused area is greater than the preset value; if the area repetition is greater than the preset value, the first diffused area is determined as the drawing label area, so that the text of the architectural drawing can be verified by lines to ensure the accuracy of the result; if the target line type that matches the preset line type library cannot be found from the architectural drawing, the first diffused area is determined as the drawing label area. Among them, the lines contained 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 embodiment of the present application is not limited to this;

[0078] If the target keyword that strictly matches the preset keyword library cannot be found, it is determined whether the target line type that matches the preset line type library can be found from the architectural drawings; if the target line type that matches the preset line type library can be found from the architectural drawings, 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 the second diffused area, and the second diffused area is determined as the drawing label area.

[0079] That is to say, if there are both strict matching results of keywords and matching results of lines in the architectural drawings, the strict matching results of lines are used to verify the strict matching results of keywords to determine the accuracy of the strict matching results of keywords; if there are only strict matching results of keywords in the architectural drawings, the strict matching results of keywords are used as intermediate data for subsequent determination of the drawing label area; considering that there may be situations where text cannot be found in the key drawings, for example, the draftsman uses lines to draw the text, if there are only matching results of lines in the architectural drawings, the matching results of lines are used as intermediate data for subsequent determination of the drawing label area.

[0080] Therefore, the time complexity of this algorithm is on the order of Ω(n). The logic for text keyword matching uses a dictionary tree data structure. In order to adapt to the situation where complete words are broken down into single words, the time overhead is optimized. The algorithm complexity of the brute force solution is Ω(n2).

[0081] In addition, in order to solve the problem of complex user operations and still not getting the ideal results after complex operations, this application not only completely eliminates the human-computer operation link, but also has a fast speed and extremely low error rate. According to experiments, the recall rate of frame detection is 99.5%, the accuracy rate is 98.9%, and 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 to achieve for models in the field of artificial intelligence. At the same time, because it does not rely on GPU computing power, its overhead in all aspects is extremely low.

[0082] In summary, with the help of the above technical solution, this application completely abandons the technical route of using pixel images for frame recognition, and uses an independently designed new data structure and algorithm to directly compress the exponential expansion time complexity to the Ω (logn) level, thereby quickly and accurately achieving the task.

[0083] It should be understood that the above-mentioned method for identifying drawing frames and labels in architectural drawings is merely exemplary, and those skilled in the art may make various modifications based on the above-mentioned method, and the modified schemes also fall within the scope of protection of this application.

[0084] The present application provides a storage medium having a computer program stored thereon. When a processor executes the computer program, the method described in the embodiment is executed.

[0085] The present application also provides a computer program product, which, when running on a computer, enables the computer to execute the method described in the method embodiment.

[0086] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.

[0087] The present invention is described with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each process flow and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions.

[0088] It should be noted that the word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The present invention may be implemented by means of hardware comprising several distinct 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 for convenience only and does not imply any order. These words should be understood as part of the component name.

[0089] In addition, it should be noted that, in the description of this specification, the description of the terms "one embodiment", "some embodiments", "embodiment", "example", "specific example" 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 expressions 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 any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.

[0090] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments after learning the basic creative concepts. Therefore, the technical solutions should be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0091] Obviously, those skilled in the art may make various modifications and variations to the present invention without departing from the spirit and scope of the present invention. Thus, if such modifications and variations fall within the scope of the technical solution of the present invention and its equivalents, the present invention shall also include such modifications and variations.

Claims

1. A method for identifying frame and label in architectural drawings, characterized in that: include: Obtaining coordinate information of 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 the straight line segments; traversing the two-dimensional line segment tree using a depth-first search algorithm 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 a position of the frame area based on the plurality of target line segments; Based on the position of the frame area, identifying a drawing label area in the architectural drawing from within the frame area; The construction process of the two-dimensional segment tree includes: Unify the coordinate information data of the endpoints of all the straight line segments into a four-tuple form of (minX, minY, maxX, maxY); wherein 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; and maxY refers to the maximum Y coordinate among the endpoints of the current straight line segment; Select one dimension from the X dimension and the Y dimension, select data related to the dimension from all quadruples, divide the intervals in sequence, and construct a two-dimensional line segment subtree of one dimension through the divided intervals, and then repeat the above steps to construct a two-dimensional line segment subtree of another dimension; wherein the depth of the two-dimensional line segment subtrees of the two dimensions will not be greater than logn+1, where n is the total number of all the straight line segments.

2. The identification method according to claim 1, characterized in that The two-dimensional line segment subtrees of the two dimensions include a first two-dimensional line segment subtree of the X dimension and a second two-dimensional line segment subtree of the Y dimension; the attributes of the nodes of the first two-dimensional line segment subtree and 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.

3. The identification method according to claim 2, characterized in that The traversal search of the two-dimensional segment tree using a depth-first search algorithm 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; Determining whether the current line segment and the line segments in the intersection meet preset matching conditions; wherein the preset matching conditions include: being perpendicular to the current line segment and intersecting with the current line segment, and the intersection point of the two intersecting line segments is not located near the center of the two intersecting line segments; If it is determined that there is a straight line segment that meets the preset matching condition in the intersection, then continue to perform the intersection determination step on the straight line segments that meet the preset matching condition until the plurality of target straight line segments are found; If it is determined that there is no straight line segment that meets the preset matching condition in the intersection, the intersection determination step is continued to be performed on the next straight line segment until the multiple target straight line segments are searched.

4. The identification method according to claim 1, wherein: 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.

5. The identification method according to claim 4, characterized in that: The step of determining the first diffused area as the image label area includes: Determining whether a target line type that matches a 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 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 of the second minimum circumscribed rectangular area until it contacts the target straight line segment, and then the diffusion is stopped to obtain a second diffused area; Determining whether a degree of overlap between the first diffused area and the second diffused area is greater than a preset value; If the area repetition is greater than the preset value, the area after the first diffusion is determined as the label area.

6. The identification method according to claim 4, characterized in that: The step of identifying the drawing label area in the architectural drawing from the drawing frame area further includes: If the target keyword that strictly matches the preset keyword library cannot be found, then 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 that matches 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 connects with the target straight line segment. The diffusion is then stopped to obtain a second diffused area, and the second diffused area is determined as the drawing label area.

7. 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 labels in architectural drawings according to any one of claims 1 to 6 is executed.

8. 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 labels in architectural drawings according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • CAD drawing frame information extraction method and system

    CN117373052A