A method for identifying image tags
By identifying and gridding text elements in CAD construction drawings, the problem of inconsistent drawing signature formats among different design institutes was solved, and the automatic extraction and optimization of drawing signature information was achieved, ensuring the integrity and logical rationality of the drawing signature area.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TECHNOLOGY (CHENGDU) CO LTD
- Filing Date
- 2026-01-28
- Publication Date
- 2026-04-17
AI Technical Summary
The inconsistent formats of drawing labels from different design institutes lead to uncertain locations and difficulties in content recognition, making it difficult for existing technologies to automatically identify drawing label information in CAD construction drawings.
By identifying text elements in construction drawings, determining potential title texts based on a pre-set database, gridding the title frame area, performing rationality verification, expanding the grid border, and determining the final title table, the automatic identification and extraction of title areas is achieved.
It automatically identifies and extracts title information from CAD construction drawings, solving the problems of uncertain location and difficulty in content recognition caused by inconsistent title format, optimizing the quality of title text, and ensuring the integrity and logical rationality of the title area.
Smart Images

Figure CN121600545B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to intelligent processing of drawings in the field of engineering design, and particularly to a method for drawing label recognition. Background Technology
[0002] CAD electronic drawings are mainly created using engineering design software such as AutoCAD and Tianzheng CAD. When producing drawings, design institutes will indicate the main information of the drawing frame in the title block area, including: drawing name, project name, drawing number, version, issuing unit, and specialty.
[0003] Currently, there is no unified standard for drawing frames among design institutes, and the naming and placement of drawing label information also vary, making computer recognition difficult. Therefore, there is an urgent need to provide a drawing label recognition method to solve the problems of uncertain location and difficulty in content recognition. Summary of the Invention
[0004] To address the problems of uncertain label location and difficulty in label content recognition, this invention provides a label recognition method.
[0005] The invention includes a method for identifying graphic signatures. The method includes: identifying text elements in a construction drawing and determining potential graphic signature texts within the text elements based on a preset database; determining a first cell based on the shortest first text among the potential graphic signature texts, and gridding the drawing frame area of the construction drawing based on the first cell; determining a first grid border in the drawing frame area based on the position information of the potential graphic signature texts; performing a reasonableness verification on the first grid border; in response to the first grid border passing the reasonableness verification, determining a target graphic signature text, and expanding the first grid border based on preset parameters to determine a second grid border; determining a third grid border based on the position information of the text elements in the construction drawing and the second grid border; determining a second cell based on the shortest second text among the target graphic signature texts, and gridding the third grid border based on the second cell to determine an initial graphic signature table; and determining a graphic signature table based on the text elements within the third grid border and the initial graphic signature table.
[0006] The beneficial effects of the above invention include, but are not limited to: (1) The above-mentioned label recognition method can automatically identify and extract label information in CAD construction drawings. It solves the problem of uncertain position and difficulty in content recognition caused by the inconsistent label formats of different design institutes, and finally restores the label table; (2) Through projection analysis and multi-condition filtering, it can intelligently remove interfering text and optimize the quality of label text. Among them, length filtering can exclude excessively long projection intervals, which usually correspond to non-label fields such as title rows or sidebars that run through the entire drawing frame area. Through field type filtering, it can prioritize the area with the highest information density and the richest label field types; (3) Through intelligent traversal and field association judgment, it can achieve accurate cell merging, ensuring the integrity of the label area and the logical rationality of the same label field. Attached Figure Description
[0007] The present invention will be further described by way of exemplary embodiments, which will be described in detail with reference to the accompanying drawings. These embodiments are not limiting, and in these embodiments, the same reference numerals denote the same structures, wherein:
[0008] Figure 1 This is an exemplary flowchart of a label recognition method according to some embodiments of this specification;
[0009] Figure 2 This is an exemplary flowchart illustrating the performance of a plausibility check on a first grid border according to some embodiments of this specification;
[0010] Figure 3 This is an exemplary flowchart illustrating the determination of a title table according to some embodiments of this specification;
[0011] Figure 4 This is an exemplary flowchart illustrating, according to some embodiments of this specification, of determining whether each target label text after grouping needs to be merged into cells;
[0012] Figure 5 This is an exemplary schematic diagram of a first grid border that has passed a plausibility test, as shown in some embodiments of this specification;
[0013] Figure 6 This is an exemplary schematic diagram of a first grid border that has not passed a reasonableness check, as shown in some embodiments of this specification. Detailed Implementation
[0014] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are merely some examples or embodiments of the present invention. For those skilled in the art, these drawings can be applied to other similar scenarios without creative effort. Unless obvious from the context or otherwise specified, the same reference numerals in the drawings represent the same structures or operations.
[0015] Unless the context clearly indicates an exception, words such as "a," "an," "a kind," and / or "the" do not specifically refer to the singular and may also include the plural. Generally speaking, the terms "comprising" and "including" only indicate the inclusion of explicitly identified steps and elements, which do not constitute an exclusive list, and the method or apparatus may also include other steps or elements.
[0016] This invention uses flowcharts to illustrate the operations performed by the system according to embodiments of the invention. It should be understood that the preceding or following operations are not necessarily performed precisely in sequence. Instead, the steps can be processed in reverse order or simultaneously. Furthermore, other operations can be added to these processes, or one or more steps can be removed from them.
[0017] Figure 1 This is an exemplary flowchart of a label recognition method according to some embodiments of this specification. Figure 1 As shown, process 100 includes the following steps. In some embodiments, process 100 may be executed by a processor.
[0018] In some embodiments, the processor may include a central processing unit (CPU), a digital signal processor (DSP), a system-on-a-chip (SoC), a microcontroller unit (MCU), a computer, a user console, or any combination thereof. In some embodiments, the processor may include a single server or a group of servers. The server group may be centralized or distributed. In some embodiments, the processor may be local or remote. In some embodiments, the processor may be implemented on a cloud platform. By way of example only, the cloud platform may include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an internal cloud, a multi-tiered cloud, or any combination thereof.
[0019] Step S110: Identify text elements in the construction drawings and determine potential title texts in the text elements based on a preset database.
[0020] Construction drawings are drawings in which construction-related text needs to be identified. Construction drawings can be obtained from local storage, remote access, or by scanning paper construction drawings.
[0021] A text primitive refers to a text object in a construction drawing, which includes text content and font style information corresponding to the text content. The text content refers to the characters in the text primitive. The font style information corresponding to the text content may include font type, font size, etc. By way of example only, "Project Name" is a text primitive, the text content is the project name, and the font style information includes regular script in size four, etc.
[0022] In some embodiments, the processor can identify text primitives in a construction drawing in various ways. For example, by performing character parsing on the construction drawing to identify and extract all text primitives in the construction drawing. The character parsing method includes, but is not limited to, Computer-Aided Design (CAD) parsing technology.
[0023] Potential title block text refers to a text object that is initially identified from a text primitive and may belong to a title block field.
[0024] A preset database stores a large number of title block names for title block fields. A title block field refers to a text label used in a construction drawing to identify various information categories. For example, "Project Name", "Drawing Number", "Drawing Name", "Date", etc. The title block name of a title block field refers to a name that can characterize the title block field, and may include the standard name and common variant names of the title block field. The standard name of a title block field can be derived from relevant specification documents and industry general standards, etc., and the common variant names can be derived from industry habits and common expressions, etc. For example, the standard name of the title block field "Project Name" is "Project Name", and the common variant names may include "Name", "Engineering Name", "Engineering Construction Project Name", etc. In some embodiments, the preset database can be pre-constructed manually or by a system. The preset database can be stored locally or in the cloud.
[0025] In some embodiments, the processor can determine potential title block text in a text primitive based on the preset database in various ways. For example, the processor can determine a text primitive with a text similarity greater than a similarity threshold to any one or more title block names in the preset database as potential title block text. Alternatively, the processor can determine a text primitive that is exactly the same as a title block name in the preset database as potential title block text. The text similarity between the text primitive and the title block name can be determined based on a similarity algorithm (such as cosine similarity, etc.). The similarity threshold can be set manually or configured by the system by default.
[0026] Step S120: Based on the first text with the minimum length in the potential title block text, determine the first cell, and grid the drawing frame area of the construction drawing based on the first cell. <s
[0027] The first text refers to the text with the minimum length in the potential title block text. The minimum length may refer to the minimum size of the text bounding box.
[0028] The text bounding box of a potential title block refers to the smallest rectangular area that can enclose the potential title block text. In some embodiments, the text bounding box can be a computable derived attribute. For example, in CAD, the text bounding box of a potential title block can be calculated by reading the calculation logic corresponding to the text bounding box (such as the corresponding function in the DWG library). The text bounding box includes its own geometric information, such as the two-dimensional coordinates of its upper left vertex in the drawing coordinate system, width and height parameters, etc. The drawing coordinate system can be a preset planar coordinate system of the plane where the title block area is located, such as a Cartesian coordinate system with the lower left vertex of the title block area as the origin, the row direction of the grid coordinate system as the horizontal direction (X direction), and the column direction of the grid coordinate system as the vertical direction (Y direction). The size of the text bounding box can refer to the area of the text bounding box calculated by its width and height.
[0029] In some embodiments, the shortest text in the potential tag text may include multiple texts, and any one of them may be selected as the first text.
[0030] The first cell refers to the grid cell size determined based on the font size of the first text. In some embodiments, the processor can calculate the width and height parameters of the first cell based on the font size of the first text. For example, the first cell can be the smallest rectangle capable of enclosing the first text. Alternatively, the first cell can be an enlarged rectangle that increases the height of the smallest rectangle capable of enclosing the first text. The height enlargement ratio can be a preset small value (such as 1.1) to avoid a single first cell enclosing more than one potential tag text.
[0031] The drawing frame area refers to the printable area or valid content area of a construction drawing. In some embodiments, the drawing frame area can be pre-calibrated manually or automatically by a processor.
[0032] In some embodiments, the processor can mesh the frame area of the construction drawing, using the first cell as the dividing unit, thus dividing it into a grid structure. The meshed frame area includes multiple first cells, and each first cell has a corresponding row and column number. The cell position of the first cell can be represented by its row and column coordinates in the grid coordinate system corresponding to the meshed frame area. The row and column coordinates can be represented in the form of (row number, column number) to facilitate the representation of the position of text elements.
[0033] Step S130: Determine the first grid border in the image frame area based on the location information of the potential image tag text.
[0034] The first grid border refers to the smallest grid border that encloses all potential tag text. The area within the first grid border can be considered the initial tag area, which refers to the area where the tag field is located.
[0035] In some embodiments, the location information of the potential tag text can be represented by the row and column coordinates of all the first cells occupied by the potential tag text in the gridded frame area. For example, (1,3) represents the first row and third column, and (1,2-3) represents the first row and second column and the first row and third column.
[0036] In some embodiments, the processor may determine the minimum row number, maximum row number, minimum column number, and maximum column number of the cell occupied by the potential sign-on text based on the location information of the potential sign-on text; and determine the border of the rectangular grid area defined by the minimum row number, maximum row number, minimum column number, and maximum column number as the first grid border.
[0037] In some embodiments, the location information also includes a text bounding box. The processor determines a first grid border within the frame region based on the location information of the potential signature text, which may include: determining the smallest grid border of the text bounding box that surrounds all potential signature text as the first grid border.
[0038] In some embodiments, the processor can obtain the text bounding boxes of all potential tag texts and map them to a grid coordinate system according to the geometric information of the text bounding boxes themselves, in order to determine the smallest rectangular grid border that surrounds all potential tag texts, and define it as the first grid border. The internal region of the first grid border is composed of grids (i.e., the cells mentioned above). The mapping method includes, but is not limited to, techniques such as coordinate transformation formulas.
[0039] In some embodiments of this specification, the first grid border is quickly and accurately positioned by precisely calculating the text bounding box, providing a reliable spatial basis for subsequent processing.
[0040] Step S140: Perform a rationality verification on the first grid border.
[0041] Reasonableness verification refers to judging the reasonableness of the first grid border. Reasonableness verification can avoid problems such as the first grid border area being too large due to interference items in the potential signature text (such as text elements that are misjudged as potential signature text), thus ensuring the reasonableness of the first grid border.
[0042] In some embodiments, the validity verification result of the first grid border includes two cases: the first grid border passes the validity verification, and the first grid border fails the validity verification. The first grid border is deemed to have passed the validity verification when all validity verification items pass. The first grid border is deemed to have failed the validity verification when any one or more validity verification items fail.
[0043] Figure 5This is an exemplary schematic diagram of a first grid border that has passed a plausibility verification, as shown in some embodiments of this specification. Figure 5 In the figure, frame 501 is the first grid border that has passed the rationality verification. Figure 6 This is an exemplary schematic diagram of a first grid border that has not passed a plausibility test, as shown in some embodiments of this specification. Figure 6 In the middle, the right frame 601 should be the first grid border that can pass the rationality verification. However, because there is a potential tag text "name" that is misjudged on the left, the left frame 602 is the text bounding box of the misjudged potential tag text, causing the first grid border to be as shown in frame 603. During the rationality verification process, the first grid border shown in frame 603 will fail the rationality verification.
[0044] For instructions on how to perform a plausibility check on the first grid border, please see [link to relevant documentation]. Figure 2 And its related descriptions.
[0045] In step S150, in response to the first grid border passing the rationality verification, the target label text is determined, and the first grid border is expanded based on preset parameters to determine the second grid border.
[0046] The target tag text refers to the text object that has been confirmed as a valid tag field through reasonableness validation.
[0047] In some embodiments, in response to the first grid border passing the reasonableness verification, the processor may determine all potential title texts within the first grid border that have passed the reasonableness verification as the target title text. In some embodiments, in response to the first grid border failing the reasonableness verification, the processor may filter the potential title texts to determine new title texts, and determine a new first grid border based on the new title texts, to re-perform reasonableness verification until the first grid border passes the reasonableness verification. For instructions on filtering new title texts, please refer to [link to documentation]. Figure 2 And its related descriptions.
[0048] The preset parameters refer to the pre-defined coefficients for expanding the first grid border, including the area expansion coefficient and expansion rules. The second grid border refers to the grid border after the first grid border is expanded based on the preset parameters. The area within the second grid border can be considered as the initially optimized label area.
[0049] Since the subsequent population of the title tag table requires not only the title tag field but also its corresponding value—for example, the title tag field "Project Name" with the value "Central Park"—the first grid border needs to be expanded to include both the target title tag text and its corresponding value.
[0050] In some embodiments, the region expansion coefficient and expansion rule can be preset manually or by the system. For example, the expansion rule can be expansion along the four sides of the first grid border, the region expansion coefficient can be the expansion multiple of the four sides of the first grid border, and the region expansion coefficient can be a fixed coefficient or an adaptive coefficient to ensure that the second grid border can include all target tag text and at least a portion of the value corresponding to each target tag text.
[0051] Step S160: Determine the third grid border based on the position information of the text elements in the construction drawings and the second grid border.
[0052] In some embodiments, the positional information of a text element can be represented by the row and column coordinates of all the cells occupied by the text element in the gridded frame area.
[0053] The third grid border refers to the final grid area determined based on the actual distribution of text elements in the construction drawings. The area within the third grid border can be considered the final, precisely determined title area. Since the second grid border may only include a portion of the value corresponding to each title field, it is necessary to adjust the second grid border so that the adjusted second grid border, i.e., the third grid border, can completely include the target title text and its corresponding value.
[0054] In some embodiments, the processor can determine the text primitives that intersect with the second grid border based on the row and column coordinates of the text primitives; and modify the second grid border to determine the smallest grid border surrounding the text primitives that intersect with the second grid border as the third grid edge.
[0055] In some embodiments, the location information includes text bounding boxes. The processor determines a third grid border based on the location information of text elements in the construction drawing and a second grid border. This may include: identifying text elements whose text bounding boxes in the construction drawing partially overlap with the second grid border as reference text elements; and identifying the smallest grid border of the text bounding boxes that surround all reference text elements as the third grid border.
[0056] The text bounding box of a text primitive refers to the smallest rectangular area that can enclose the text primitive. For an explanation of text bounding boxes, please refer to the relevant description above.
[0057] The partial overlap between the text bounding box of a text primitive and the second grid border indicates a geometric intersection relationship between them. Geometric intersection relationships include various types such as the second grid border completely containing the text bounding box of the text primitive, the second grid border partially overlapping the text bounding box of the text primitive, and the second grid border meeting the boundary of the text bounding box of the text primitive.
[0058] A reference text primitive refers to a text primitive whose text bounding box partially overlaps with the border of the second grid. Any text primitive satisfying one or more of the above geometric intersection relationships is considered a reference text primitive. Therefore, reference text primitives include the target tag text, the value corresponding to the target tag text, and other text primitives that may be omitted and are related to the content of the target tag text.
[0059] In some embodiments, the processor can map the text bounding boxes of text elements in the construction drawings to a grid coordinate system, determine the text elements corresponding to the text bounding boxes that partially overlap with the second grid border in the grid coordinate system, and define them as reference text elements; and determine the minimum grid border of the text bounding boxes that enclose all reference text elements in the grid coordinate system, and define it as the third grid border.
[0060] In some embodiments of the present invention, the third grid border is calculated based on the actual distribution of reference text primitives, which can accurately and completely determine the third grid border.
[0061] Step S170: Based on the second text with the shortest length in the target tag text, determine the second cell, and based on the second cell, grid the third grid border to determine the initial tag table.
[0062] The second text refers to the shortest text in the target tag text. In some embodiments, the shortest text in the target tag text may include multiple texts, and any one of them can be selected as the second text. The second text may be the same as or different from the first text.
[0063] The second cell refers to the grid cell size determined based on the font size of the second text.
[0064] In some embodiments, the processor can calculate the width and height parameters of the second cell based on the size information of the second text. For example, the second cell can be the smallest rectangle capable of enclosing the second text. Alternatively, the second cell can be an enlarged rectangle that increases the height of the smallest rectangle capable of enclosing the second text. The height enlargement ratio can be a preset small value (such as 1.1) to avoid one second cell enclosing more than one target label text.
[0065] The initial label table refers to the basic table structure after the third grid border is divided into grids.
[0066] In some embodiments, the processor can grid the area within the third grid border, using the second cell as the dividing unit, to obtain an initial label table. The area within the gridded third grid border includes multiple second cells, and each second cell has a row and column number. The cell position of the second cell can be represented by its row and column coordinates in the grid coordinate system corresponding to the area within the gridded third grid border.
[0067] Step S180: Determine the label table based on the text elements within the third grid border and the initial label table.
[0068] Text primitives within the third grid border refer to all text objects within the third grid border.
[0069] The title chart table refers to the final table that reflects the actual layout and structure of the title chart.
[0070] In some embodiments, the processor determines the label table by merging and adjusting the initial label table, for example, by traversing each text element within the third grid border. For more information on this topic, please refer to [link to relevant documentation]. Figure 3 and Figure 4 Related descriptions.
[0071] The above-described label recognition method can automatically identify and extract label information from CAD construction drawings. It solves the problems of uncertain location and difficulty in content recognition caused by inconsistent label formats among different design institutes, and ultimately reconstructs the label table.
[0072] Figure 2 This is an exemplary flowchart illustrating the performance of a rationality verification of a first grid border according to some embodiments of the present invention. Figure 2 As shown, process 200 includes the following steps. In some embodiments, process 200 may be executed by a processor.
[0073] Step S210: Perform a first reasonableness verification based on the first number of the first cells within the first grid border.
[0074] The first quantity refers to the total number of first cells contained within the first grid border. The first cells contained within the first grid border include both the first cells completely contained within the first grid border and the first cells intersecting with the first grid border. In other words, any first cell covered by the first grid border and its inner area is counted in the first quantity.
[0075] In some embodiments, the processor can determine a first quantity by calculating the number of rows and columns of the first cells contained within the first grid border and multiplying the number of rows and columns. The first reasonableness verification refers to the verification of whether the size of the first grid border is reasonable.
[0076] In some embodiments, the processor performs a first reasonableness verification based on a first number of first cells within a first grid border, which may include verifying whether the ratio of the first number to a second number of first cells in the frame area is lower than a preset ratio threshold.
[0077] The second quantity refers to the total number of first cells contained within the frame area. The first cells contained within the frame area include the first cell completely covered by the frame area and the first cell intersecting the border of the frame area. The second quantity is calculated in the same way as the first quantity.
[0078] A preset ratio threshold refers to a value used to determine whether the ratio of a first quantity to a second quantity is reasonable. In some embodiments, the preset ratio threshold can be manually set and is typically less than 0.15. In some embodiments, the preset ratio threshold can also be determined by the processor based on the type of construction drawing by querying a preset lookup table. The preset lookup table includes multiple construction drawing types and their corresponding preset ratio thresholds. The preset lookup table can be constructed based on historical data, and the preset ratio threshold corresponding to each construction drawing type can be represented by the average of the historical actual ratio thresholds corresponding to a large number of historical construction drawings of that type.
[0079] In some embodiments, if the ratio of the first quantity to the second quantity is greater than a preset ratio threshold, it is determined that the first grid border has failed the first rationality verification; if the ratio of the first quantity to the second quantity is equal to or less than the preset ratio threshold, it is determined that the first grid border has passed the first rationality verification.
[0080] In some embodiments of this specification, the reasonableness of the area size of the first grid border is verified by using a preset ratio threshold. This can prevent the area of the title tag from becoming too large due to interference items in the potential title tag text, and ensure that the area of the first grid border has a reasonable size range.
[0081] In some embodiments, the processor may also perform a first reasonableness verification in other ways based on a first number of first cells within a first grid border, without limitation.
[0082] There are two possible outcomes: the first reasonableness verification passes or fails. If the first reasonableness verification passes, proceed to step S220; if the first reasonableness verification fails, proceed to step S240.
[0083] In step S220, in response to the passing of the first rationality verification, a second rationality verification is performed based on the center point position of the first grid border.
[0084] In some embodiments, the position of the center point of the first grid border can be represented by the two-dimensional coordinates of the geometric center point of the first grid border in the drawing coordinate system, or by the row and column coordinates of the first cell in the grid coordinate system where the geometric center point of the first grid border is located.
[0085] The second rationality verification refers to the verification of whether the position of the first grid border is reasonable.
[0086] In some embodiments, the processor performs a second rationality verification based on the center point position of the first grid border, which may include: verifying whether the minimum distance between the center point position and the border of the frame area is lower than a preset distance threshold.
[0087] The minimum distance between the center point and the border of the drawing frame area refers to the shortest vertical distance from the center point to the border of the drawing frame area. The border of the drawing frame area consists of four boundary lines. In some embodiments, when the center point is represented by two-dimensional coordinates in the drawing coordinate system, the border of the drawing frame area can be represented by the equations of four straight lines corresponding to the four boundary lines in the drawing coordinate system, and the minimum distance can be determined by the formula for the distance from a point to a line. When the center point is represented by row and column coordinates in the grid coordinate system, the minimum distance can be represented by the product of the minimum number of first cells traversed from the center point along the same row and column to the four boundary lines of the drawing frame area and the width and height parameters (width or height) of the first cell.
[0088] A preset distance threshold is a value used to determine whether the minimum distance between the center point and the border of the frame area is reasonable. In some embodiments, the preset distance threshold can be determined based on the length of the boundary line of the frame area in the direction corresponding to the minimum distance. For example, if the minimum distance is the distance from the center point to the upper boundary line of the frame area in the horizontal direction, then the preset distance threshold can be a preset multiple of the length of the upper boundary line (i.e., the width of the frame area). The preset multiple can be manually set in advance, such as 0.1.
[0089] In some embodiments, if the minimum distance is higher than a preset distance threshold, the first grid border is determined to have failed the second rationality verification; if the minimum distance is equal to or lower than the preset distance threshold, the first grid border is determined to have passed the second rationality verification.
[0090] In some embodiments of this specification, since the title block area is usually located in the corner of the frame area, a preset distance threshold can be used to verify whether the position of the first grid border conforms to the conventional layout features of the construction drawings. This further avoids deviations in the title block area position caused by interference items in the potential title block text (such as non-title block fields involved in the drawing body, annotation area, etc. located in the center of the construction drawings), ensuring that the first grid border is located in a reasonable position area.
[0091] In some embodiments, the processor may also perform a second reasonableness verification in other ways based on the center point position of the first grid border, without limitation.
[0092] In step S230, in response to the second reasonableness verification being passed, it is determined that the first grid border has passed the reasonableness verification.
[0093] When both the first and second rationality verifications pass, the first grid border is deemed to have passed the rationality verification and proceeds to the subsequent processing flow.
[0094] In step S240, in response to the failure of the first or second reasonableness verification, the potential signage text is filtered to determine new signage text, and a new first grid border is determined based on the new signage text to re-perform reasonableness verification.
[0095] In some embodiments, the processor filters potential tag text to determine new tag text, which may include: determining a first projection line segment and a second projection line segment of potential tag text in a first direction; filtering the first and second projection line segments corresponding to all potential tag text based on length and field type conditions to determine a target projection line segment; and determining new tag text based on the potential tag text corresponding to the target projection line segment.
[0096] The first direction refers to the row direction of the grid coordinate system, which is the horizontal direction (X direction) of the drawing coordinate system. The second direction refers to the column direction of the grid coordinate system, which is the vertical direction (Y direction) of the drawing coordinate system.
[0097] In some embodiments, the processor can project the text bounding box of each potential signature text along a first direction to generate multiple first projection lines, and project the text bounding box of each potential signature text along a second direction to generate multiple second projection lines.
[0098] The first projection segment represents the distribution range of the potential signature text in the first direction. The second projection segment represents the distribution range of the potential signature text in the second direction. Multiple first projection segments of multiple potential signature texts may overlap or connect; overlapping or connecting first projection segments can be merged into a single first projection segment. The same applies to the second projection segment.
[0099] The length condition refers to the criteria used to filter the first and second projected line segments based on their length. In some embodiments, the processor can filter the first and second projected line segments corresponding to all potential tag text based on the length condition. For example, it can calculate the ratio of the length of each first projected line segment to the length of the frame area in the first direction (i.e., the width of the frame area), and the ratio of the length of each second projected line segment to the length of the frame area in the second direction (i.e., the height of the frame area); and delete the first and second projected line segments whose length ratio is greater than a preset length ratio threshold. The preset length ratio threshold can be manually preset, for example, 0.15.
[0100] Field type criteria refer to the conditions for filtering the first and second projected line segments based on the field type of the title tag. The title tag field type can be determined by the title tag name of the title tag field; title tag fields belonging to the same title tag name are of the same title tag field type. For an explanation of title tag names, please refer to [link to documentation]. Figure 1 Related descriptions.
[0101] In some embodiments, the processor can further filter the first and second projected line segments that have been filtered by length criteria based on field type conditions. For example, the processor can count the number of label field types contained in each of the first and second projected line segments filtered by length criteria, and select the first projected line segment with the largest number of label field types or the shortest length among the second projected line segments as the target projected line segment. The target projected line segment directly reflects the layout direction (horizontal or vertical) of the label area.
[0102] For example only, such as Figure 6 As shown, the text bounding boxes of multiple potential tag texts overlap along the projection segments of the second direction, forming a second projection segment A. Multiple projection segments along the first direction form first projection segments B1, B2, B3, B4, and B5, respectively. The second projection segment A contains the largest number of tag field types and is therefore the target projection segment. The second projection segment A reflects that the tag area is laid out vertically and represents the distribution range along the first direction of the text within the potential tag text that is more likely to be the actual tag text.
[0103] In some embodiments, the processor can extract all potential tag texts located within the target projection line segment interval, determine them as the filtered new tag texts, and use them to recalculate the first grid border and re-perform the rationality verification.
[0104] In some embodiments of this specification, projection analysis and multi-condition filtering can intelligently remove interfering text and optimize the quality of the title text. Specifically, length filtering can exclude excessively long projection intervals, which typically correspond to non-title fields such as title rows or sidebars that span the entire title frame area. Field type filtering can prioritize areas with the highest information density and the richest variety of title field types.
[0105] In some embodiments, the processor may also filter potential tag texts in other ways to determine new tag texts, without limitation.
[0106] In some embodiments of this specification, by establishing a dual verification system based on the first number of first grid borders and the center point position, unreasonable first grid borders can be effectively identified, and new title text can be re-selected.
[0107] Figure 3 This is an exemplary flowchart illustrating the determination of a title table according to some embodiments of this specification. Figure 3 As shown, process 300 includes the following steps. In some embodiments, process 300 may be executed by a processor.
[0108] Step S310: Adjust the row segments in the initial sign table based on the cross-row sign text in the initial sign table, and mark the occupied cells.
[0109] For instructions on the initial label form, please refer to [link / reference]. Figure 1 Related descriptions.
[0110] Multi-line title text refers to target title text that spans multiple lines vertically. Multi-line title text is usually caused by larger font sizes or layout requirements.
[0111] In some embodiments, the processor can determine cross-line tag text in the initial tag table using various methods. For example, the processor can determine cross-line tag text by determining whether the font height of the target tag text exceeds the height of the second cell, where the font height of the target tag text is determined based on the font size of the target tag text. As another example, the processor can determine cross-line tag text by using the row and column coordinates of the target tag text in the initial tag table.
[0112] Adjusting row segments refers to modifying the position of row separators in the initial title tag table, including deleting or adding row separators. For example, adding row separators can split a single line into multiple lines, while deleting row separators can merge multiple lines into a single line, to match the actual height of the target title tag text.
[0113] In some embodiments, the processor may merge the second cell occupied by the cross-line caption text and mark it as an occupied cell to prevent duplicate allocation or incorrect merging in subsequent processing; adjust the row segments in the initial caption table based on the merged occupied row of the cross-line caption text, for example, delete the row segments covered inside the merged occupied row of the cross-line caption text.
[0114] In some embodiments, the processor adjusts the row segments in the initial sign-to-table based on the cross-line sign-to-table text in the initial sign-to-table, which may include: traversing the cross-line sign-to-table text in the initial sign-to-table in a second direction; in response to the number of rows occupied by the cross-line sign-to-table text being 2, using the bottom boundary value of the text bounding box of the cross-line sign-to-table text in the second direction as the dividing starting point, and re-dividing the untraversed area using the second cell; in response to the number of rows occupied by the cross-line sign-to-table text being greater than 2, merging the occupied rows of the cross-line sign-to-table text; and continuing to traverse until there is no more cross-line sign-to-table text.
[0115] For an explanation of the second direction, please refer to [link / reference]. Figure 1 Related descriptions.
[0116] The number of rows occupied by the cross-line title text is 2, which means that the cross-line title text occupies exactly two rows of the second cell in the initial title table. In other words, the font height of the cross-line title text is exactly twice the height of the second cell.
[0117] In some embodiments, the processor can traverse the cross-line tag text in the initial tag table from top to bottom in a second direction. When the number of rows occupied by the cross-line tag text is 2, the line segments covered by the two occupied rows of the cross-line tag text are deleted, and the bottom boundary value of the text bounding box of the cross-line tag text is used as the dividing starting point to re-grid the untraversed area in the initial tag table using the second cell. The untraversed area can refer to the area where the bottom boundary of the text bounding box of the current cross-line tag text points downwards in the second direction. The grid division process can be found in [reference needed]. Figure 1 Description of step S170.
[0118] A cross-line tag text occupying more than 2 rows means that the cross-line tag text occupies more than two rows of the second cell in the initial tag table, that is, the font height of the cross-line tag text is greater than twice the height of the second cell. In some embodiments, when the cross-line tag text occupies more than 2 rows, the processor can merge the occupied rows of the cross-line tag text and delete the line segments covered by the multiple occupied rows of the cross-line tag text.
[0119] In some embodiments of this specification, for cross-line title text, by performing the above-mentioned line merging and re-division, layout errors caused by insufficient line height can be avoided, ensuring that the initial title table after adjustment can accurately reflect the actual layout of the construction drawings.
[0120] Step S320: Group the target label text by row number and / or column number.
[0121] In some embodiments, the processor may group the target tag text based on the row and / or column numbers of the target tag text in the adjusted initial tag table. For example, all target tag text in the first row may be grouped into a first group, all target tag text in the second row into a second group, and so on. Another example is that all target tag text in the first column may be grouped into a first group, all target tag text in the second column into a second group, and so on.
[0122] In some embodiments, grouping by row or column number can be determined based on the layout orientation of the title block area. When the title block area is laid out horizontally, it is grouped by column number; when the title block area is laid out vertically, it is grouped by row number.
[0123] In some embodiments, the processor can internally sort the target caption text within each group. When grouping by column number, the target caption text within each group is sorted by row number in ascending order within the same column; when grouping by row number, the target caption text within each group is sorted by column number in ascending order within the same row. This sorting can simulate human reading order (from top to bottom, from left to right), making it easier for staff to view.
[0124] Step S330: Iterate through each target title text after grouping to determine whether cell merging is required, and determine the title cell and the area position of each target title text after grouping.
[0125] A title block is a contiguous area of cells occupied by the target title text and its corresponding value.
[0126] The location of the label cell can be represented by the row and column coordinates of the cell it occupies in the grid coordinate system corresponding to the adjusted initial label table. For example, (1-2, 2-3) means that the starting row number is 1, the ending row number is 2, the starting column number is 2, and the ending column number is 3, in the order from top to bottom and from left to right.
[0127] In some embodiments, further description regarding whether cell merging is required for sequentially traversing each grouped target title text, and determining the title cell and its region location for each grouped target title text, can be found in [reference needed]. Figure 4 .
[0128] Step S340: Map the area location to the spatial location in the construction drawings.
[0129] Spatial location refers to the coordinate range of the construction drawings in the drawing coordinate system.
[0130] In some embodiments, the processor can map the regional location to the spatial location in the construction drawings using mapping methods such as coordinate transformation formulas.
[0131] Step S350: Based on the spatial location and the location information of text elements in the construction drawings, fill the title block with content to determine the title block table.
[0132] For an explanation of the location information of text elements in construction drawings, please refer to [link / reference]. Figure 1 Related descriptions.
[0133] In some embodiments, the processor can locate all text elements located at the spatial position of the title block in the construction drawing based on the spatial position of the title block and the position information of the text elements in the construction drawing, and fill the title block with the corresponding text elements. Once all title blocks are filled, the title block table is determined.
[0134] In some embodiments of this specification, a structured chart table can be generated and its content can be automatically filled by dynamically adjusting the table and merging cells.
[0135] Figure 4 This is an exemplary flowchart illustrating, according to some embodiments of this specification, the determination of whether each target label text after grouping needs to be merged into cells.
[0136] For each target image tag text after grouping, execute... Figure 4 The following steps are shown in process 400. In some embodiments, process 400 may be executed by a processor.
[0137] Step S410: Starting from the current column of the current cell where the target label text is located, and ending at the maximum column number of the current row, iterate through the cells following the current cell in the current row to see if they are occupied.
[0138] The subsequent cell refers to the cell in the column following the current column of the current row. The current cell containing the target title text refers to the cell occupied by the target title text currently being processed within the adjusted initial title table.
[0139] In step S420, in response to the fact that the adjacent cells of the current cell are not occupied, the current cell is merged with the adjacent cells to obtain the merged cell, and the subsequent cells of the merged cell in the current row are traversed.
[0140] The adjacent cell of the current cell refers to the cell in the same row that is in the column adjacent to the current cell, that is, the cell to the right of the current cell in the same row.
[0141] Step S430: In response to the adjacent cell being occupied, determine whether the target label text occupying the adjacent cell and the target label text belong to the same label field.
[0142] In some embodiments, the processor can determine whether target tag text occupying adjacent cells and target tag text in the current cell belong to the same tag field by analyzing their text content. For example, the same content expressed in different languages belongs to the same tag field.
[0143] Step S440-1: If they belong to the same label field, merge the current cell with the occupied adjacent cell to obtain the merged cell, and continue to traverse the subsequent cells of the merged cell in the current row.
[0144] Step S440-2: If the data does not belong to the same tag field, then end the traversal of the current row.
[0145] Step S450: After the current row is traversed, starting from the current column and ending at the largest column number of the next row, iterate through each cell in the next row to see if it is occupied.
[0146] In step S460, in response to the fact that the cell in the next row is not occupied, the cell in the next row is merged with the cell in the current row in the same column.
[0147] In step S470, in response to the cell in the next row being occupied, it is determined whether the target tag text occupying the cell in the next row and the target tag text belong to the same tag field.
[0148] The method for determining whether the target tag text of the cell occupying the next row belongs to the same tag field as the target tag text of the current cell is similar to step S430, and will not be repeated here.
[0149] In step S480-1, if they belong to the same label field, the cell in the next row that is occupied will be merged with the cell in the current row of the same column.
[0150] Step S480-2: If the text does not belong to the same title field, then end the cell merging of the current target title text.
[0151] After merging the cells of the current target title text, the processor can perform the above process on the next target title text.
[0152] In some embodiments of this specification, precise cell merging is achieved through intelligent traversal and field association judgment, ensuring the integrity of the title area and the logical rationality of the same title field.
[0153] It should be noted that the descriptions of processes 100-400 above are merely illustrative and do not limit the scope of the invention. Those skilled in the art can make various modifications and changes to processes 100-400 under the guidance of this invention. However, these modifications and changes are still within the scope of this invention.
[0154] The basic concepts have been described above. It is clear that the detailed disclosure above is merely illustrative and does not constitute a limitation of the present invention. Although not explicitly stated herein, various modifications, improvements, and corrections may be made to the present invention by those skilled in the art. Such modifications, improvements, and corrections are suggested in this invention and therefore remain within the spirit and scope of the exemplary embodiments of the present invention.
[0155] Furthermore, this invention uses specific terms to describe embodiments of the invention. For example, "some embodiments" refers to a particular feature, structure, or characteristic associated with at least one embodiment of the invention. Additionally, certain features, structures, or characteristics in one or more embodiments of the invention can be appropriately combined.
[0156] It should be noted that, in order to simplify the descriptions disclosed herein and thus aid in the understanding of one or more embodiments of the invention, the foregoing description of embodiments of this specification may sometimes combine multiple features into a single embodiment, drawing, or description thereof. However, this method of disclosure does not imply that the subject matter of this specification requires more features than those mentioned in the claims. In fact, the embodiments contain fewer features than all the features of a single embodiment disclosed above.
[0157] Finally, it should be understood that the embodiments described in this specification are merely illustrative of the principles of the embodiments described herein. Other variations may also fall within the scope of this specification. Therefore, alternative configurations of the embodiments described herein are intended to be illustrative rather than limiting, and should be considered consistent with the teachings of this specification. Accordingly, the embodiments described herein are not limited to those explicitly introduced and described herein.
Claims
1. A method for identifying image tags, characterized in that, The method includes: Identify text elements in construction drawings and determine potential title texts in the text elements based on a preset database; Based on the first text with the shortest length among the potential title texts, a first cell is determined, and the frame area of the construction drawing is gridded based on the first cell; Based on the location information of the potential image tag text, determine the first grid border in the image frame area; Perform a reasonableness verification on the first grid border, including: A first reasonableness verification is performed based on the first number of the first cells within the first grid border. The first reasonableness verification includes verifying whether the ratio of the first number to the second number of the first cells in the frame area is lower than a preset ratio threshold. In response to the first reasonableness verification being passed, a second reasonableness verification is performed based on the center point position of the first grid border. The second reasonableness verification includes verifying whether the minimum distance between the center point position and the border of the frame area is lower than a preset distance threshold. In response to the second reasonableness verification being passed, it is determined that the first grid border has passed the reasonableness verification; In response to the failure of the first or second reasonableness verification, the potential tag text is filtered to determine new tag text, and a new first grid border is determined based on the new tag text to re-execute the reasonableness verification; In response to the first grid border passing the rationality verification, the target image tag text is determined, and the first grid border is expanded based on preset parameters to determine the second grid border; Based on the position information of the text elements in the construction drawings and the second grid border, the third grid border is determined; Based on the second text with the shortest length in the target signature text, determine the second cell, and based on the second cell, grid the border of the third grid to determine the initial signature table; The title table is determined based on the text elements within the third grid border and the initial title table.
2. The method according to claim 1, characterized in that, The location information includes a text bounding box; determining the first grid border in the frame area based on the location information of the potential tag text includes: The smallest grid border of the text bounding box that surrounds all the potential tag text is determined as the first grid border.
3. The method according to claim 1, characterized in that, The process of filtering the potential image tag texts to determine new image tag texts includes: Determine the first projection line segment of the potential graphic text in the first direction and the second projection line segment in the second direction; Based on length and field type conditions, the first and second projection segments corresponding to all potential tag texts are filtered to determine the target projection segment. The new image tag text is determined based on the potential image tag text corresponding to the target projection line segment.
4. The method according to claim 1, characterized in that, The location information includes a text bounding box; determining the third grid border based on the location information of the text elements in the construction drawing and the second grid border includes: Text elements whose text bounding boxes in the construction drawings partially overlap with the border of the second grid are identified as reference text elements. The smallest grid border of the text bounding box that surrounds all the reference text primitives is determined as the third grid border.
5. The method according to claim 1, characterized in that, The process of determining the title table based on the text elements within the third grid border and the initial title table includes: Adjust the row segments in the initial sign-to-table based on the cross-row sign-to-table text in the initial sign-to-table, and mark the occupied cells; Group the target image text by row number and / or column number; Iterate through each target title text after grouping to determine whether cell merging is required, and determine the title cell and the area position of each target title text after grouping; Map the location of the area to a spatial location in the construction drawings; Based on the spatial location and the location information of the text elements in the construction drawings, content is filled into the title grid to determine the title table.
6. The method according to claim 5, characterized in that, The step of adjusting the row segments in the initial sign-out table based on the cross-line sign-out text in the initial sign-out table includes: Traverse the cross-line tag text in the initial tag table in the second direction; In response to the fact that the number of rows occupied by the cross-line title text is 2, the bottom boundary value of the text bounding box of the cross-line title text in the second direction is used as the dividing starting point, and the second cell is used again to divide the untraversed area; In response to the fact that the number of lines occupied by the cross-line title text is greater than 2, the occupied lines of the cross-line title text are merged; Continue iterating until there is no more cross-line tag text.
7. The method according to claim 5, characterized in that, The step of sequentially traversing each target title text after grouping to determine whether cell merging is required, and determining the title cell and its area position for each target title text after grouping, includes: For each target image tag text after the grouping... Starting from the current column of the current cell where the target image text is located, and ending at the maximum column number of the current row, iterate through the cells in the current row to see if the cells following the current cell are occupied. In response to the fact that the adjacent cells of the current cell are not occupied, the current cell is merged with the adjacent cells to obtain a merged cell, and the subsequent cells of the merged cell in the current row are traversed. In response to the adjacent cell being occupied, determine whether the target tag text occupying the adjacent cell and the target tag text belong to the same tag field; If they belong to the same label field, the current cell is merged with the occupied adjacent cell to obtain the merged cell, and the subsequent cells of the merged cell in the current row are traversed. If it does not belong to the same image tag field, then the traversal of the current row ends; After the current row is traversed, starting from the current column and ending at the largest column number of the next row, iterate through each cell in the next row to see if it is occupied. In response to the fact that the cell in the next row is not occupied, the cell in the next row is merged with the cell in the current row in the same column; In response to the cell in the next row being occupied, determine whether the target tag text occupying the cell in the next row and the target tag text belong to the same tag field; If they belong to the same label field, the cell in the next row that is occupied will be merged with the cell in the current row in the same column; If the text does not belong to the same title field, then the merging of the current target title text cells will end.
Citation Information
Patent Citations
Picture label information extraction method, apparatus and device, and readable storage medium
CN116682130A
Engineering drawing label automatic identification method and system based on template matching
CN119763144A