Engineering drawing BOM table identification method and device, equipment and storage medium
By adaptively processing low-quality, mixed-format engineering drawings using Gaussian kernel density estimation and integer linear programming models, the problem of low recognition accuracy and excessive manual intervention in existing technologies is solved, achieving efficient BOM recognition and automated processing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN DALEZHUANG CONSTR TECH CO LTD
- Filing Date
- 2026-03-12
- Publication Date
- 2026-04-24
AI Technical Summary
When processing low-quality, mixed-format engineering drawings, existing technologies rely on fixed threshold mechanisms that are sensitive to changes in drawing scale and noise interference, resulting in low recognition accuracy and requiring extensive manual intervention, which affects the automation level and efficiency of large-scale batch processing.
Gaussian kernel density estimation is used to convert drawings into a continuous density field. Candidate table regions are determined through cluster analysis and integer linear programming model. Combined with semantic matching and text classification integration, the system adapts to the scale changes and noise interference of different drawings, thereby improving recognition accuracy and robustness.
It achieves efficient recognition of low-quality, mixed-format drawings, improves recognition accuracy and robustness, reduces the need for manual intervention, and enhances the automation level of large-scale batch processing.
Smart Images

Figure CN121921810A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method, apparatus, device, and storage medium for identifying BOM (Bill of Materials) tables in engineering drawings. Background Technology
[0002] In the field of BOM information extraction from engineering CAD drawings, existing technologies mainly employ methods based on fixed thresholds and simple geometric rules for drawing recognition and processing. These methods typically rely on preset static parameters, such as using fixed angle tolerances (e.g., ±5 degrees) and length thresholds (e.g., 1.0 mm) to filter line segments, and identifying candidate regions through geometric matching. These methods can achieve a certain level of processing efficiency when processing standardized, high-quality CAD drawings.
[0003] In practical engineering applications, a large number of drawings suffer from inconsistent quality and mixed formats, including a mix of scanned documents and CAD vector data, poor coordinate accuracy due to manual drawing, inconsistent formats generated by different software, and drawings with rotation or abnormal scale. Existing fixed threshold mechanisms are highly sensitive to scale changes and noise interference in these low-quality, mixed-format drawings. Because the threshold parameters are statically set, they cannot adapt to different drawing scales and environmental disturbances, leading to a significant increase in line segment selection error rates and a decrease in recognition accuracy. This necessitates substantial manual intervention, severely impacting the automation level and efficiency of large-scale batch processing. Summary of the Invention
[0004] The main objective of this invention is to solve the technical problem that in the processing of low-quality engineering drawings, the fixed threshold mechanism is sensitive to changes in the drawing scale and noise interference, resulting in low recognition accuracy and requiring a large amount of manual intervention. This invention provides a method for identifying the Bill of Materials (BOM) in engineering drawings, wherein the adaptive control method includes: The input engineering drawings are processed by Gaussian kernel density estimation to obtain a continuous density field representing the spatial distribution of the geometric elements in the drawings; Cluster analysis is performed on the geometric elements in the engineering drawings based on the continuous density field, and candidate table regions are determined based on the directional relationship and spatial adjacency relationship between line segments. An integer linear programming model is established for the candidate table region, and global optimization is performed according to preset constraints to obtain the target BOM table region; The text content in the target BOM table area is extracted and semantically matched to determine the correspondence between each text content and the fields in the BOM table. Based on the correspondence, the text content is categorized and integrated to obtain structured BOM information.
[0005] The present invention also provides an engineering drawing BOM (Bill of Materials) recognition device, the engineering drawing BOM recognition device comprising: The density field generation module is used to perform Gaussian kernel density estimation on the input engineering drawings to obtain a continuous density field representing the spatial distribution of the geometric elements in the drawings. The candidate region determination module is used to perform cluster analysis on the geometric elements in the engineering drawings based on the continuous density field, and to determine the candidate table region based on the directional relationship and spatial adjacency relationship between line segments. The target region selection module is used to establish an integer linear programming model for the candidate table region, and perform global optimization solution according to preset constraints to obtain the target BOM table region. The information extraction module is used to extract and semantically match the text content in the target BOM table area, determine the correspondence between each text content and the fields in the BOM table, and classify and integrate the text content according to the correspondence to obtain structured BOM information.
[0006] The present invention also provides an engineering drawing BOM table recognition device, comprising: a memory and at least one processor, wherein the memory stores instructions, and the memory and the at least one processor are interconnected via a line; the at least one processor invokes the instructions in the memory to cause the engineering drawing BOM table recognition device to perform the steps of the above-described engineering drawing BOM table recognition method.
[0007] The present invention also provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the steps of the above-described engineering drawing BOM table identification method.
[0008] The aforementioned engineering drawing BOM (Bill of Materials) identification method, apparatus, equipment, and storage medium perform Gaussian kernel density estimation on the input engineering drawings to convert the mixed vector and raster data into a continuous density field. Based on this continuous density field, geometric elements are clustered, and candidate table regions are determined based on the directional and spatial adjacency relationships between line segments. An integer linear programming model is established for the candidate table regions, and global optimization is performed according to preset constraints to obtain the target BOM table region. The text content in the target BOM table region is extracted and semantically matched to determine the correspondence between each text content and BOM table fields, and then categorized and integrated to obtain structured BOM information. This invention improves the recognition accuracy and robustness of low-quality, mixed-format drawings through adaptive probabilistic modeling and global optimization methods, reducing the need for manual intervention.
[0009] Beneficial Effects: This invention converts engineering drawings into a continuous density field using Gaussian kernel density estimation, achieving a unified representation of mixed vector and raster data and eliminating processing differences caused by different data formats and quality levels. Candidate table regions are determined through cluster analysis and probability distribution modeling based on the continuous density field, replacing the traditional fixed-angle threshold method. This adapts to changes in the scale, rotation angle, and noise interference of different drawings, avoiding recognition failures caused by statically set threshold parameters. An integer linear programming model is used for global optimization of the candidate table regions. When multiple candidate regions conflict, it comprehensively considers the characteristics and constraints of each candidate region, selecting the globally optimal target region and avoiding region omissions or incorrect selections caused by local evaluation. The process of obtaining structured BOM information through semantic matching and text classification integration can handle field expressions in different specifications and language environments, enhancing the method's versatility. Overall, this invention solves the problems of low recognition accuracy and poor robustness in existing technologies when processing low-quality, mixed-format engineering drawings, reducing the need for manual intervention and improving the automation level and efficiency of large-scale batch processing.
[0010] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.
[0011] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0012] Figure 1 This is a schematic diagram of the first embodiment of the engineering drawing BOM table recognition method in this invention; Figure 2 This is a schematic diagram of a second embodiment of the engineering drawing BOM table identification method in this invention; Figure 3 This is a schematic diagram of one embodiment of the engineering drawing BOM table recognition device in this invention; Figure 4 This is a schematic diagram of one embodiment of the engineering drawing BOM table recognition device in this invention. Detailed Implementation
[0013] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0014] The terms "comprising" and "having," and any variations thereof, used in the embodiments of this invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the steps or units listed, but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.
[0015] To facilitate understanding of this embodiment, a method for identifying the Bill of Materials (BOM) in engineering drawings disclosed in this embodiment of the invention will first be described in detail. For example... Figure 1 As shown, this method includes the following steps: 101. Perform Gaussian kernel density estimation on the input engineering drawings to obtain a continuous density field representing the spatial distribution of the geometric elements in the drawings; In this embodiment, the step of performing Gaussian kernel density estimation on the input engineering drawing to obtain a continuous density field representing the spatial distribution of geometric elements in the drawing includes: extracting the coordinates of the geometric elements in the input engineering drawing and mapping them to a pixel grid to obtain a discrete geometric element distribution; determining the standard deviation parameter of the Gaussian kernel function based on the local density characteristics of the discrete geometric element distribution to obtain the kernel function parameter; and applying a Gaussian kernel function with the kernel function parameter to the discrete geometric element distribution for convolution processing to obtain the continuous density field.
[0016] Specifically, geometric elements can include basic CAD primitives such as line segments, arcs, and text objects. For DXF format drawings, the positional information of each geometric element, such as endpoint coordinates and center coordinates, can be directly parsed from the file. For example, for a line segment, its starting point coordinates (x1, y1) and ending point coordinates (x2, y2) can be extracted; for an arc, the center coordinates and radius parameter can be extracted; for a text object, the insertion point coordinates can be extracted. After extracting the coordinates, these coordinate points are mapped to a discrete pixel grid to obtain the discrete geometric element distribution. Specifically, a two-dimensional pixel grid corresponding to the drawing size can be created, and the coordinates of the geometric elements can be mapped to the integer coordinate positions of the pixel grid according to a preset resolution.
[0017] After obtaining the discrete geometric element distribution, the standard deviation parameter σ of the Gaussian kernel function needs to be determined based on the local density characteristics of this discrete distribution. Traditional methods typically use a fixed σ value, such as σ=2.0, but this approach cannot adapt to scale variations and local density differences in different drawings. In this embodiment, the σ value can be adaptively determined based on the local line segment density of each region in the discrete geometric element distribution. Specifically, the pixel grid can be divided into several sub-regions, the number of geometric elements in each sub-region can be counted, and the local density ρ can be calculated. Then, the standard deviation parameter σ of each region can be determined based on the magnitude of the local density ρ, with smaller σ values used for regions with higher density and larger σ values used for regions with lower density. Thus, smaller σ values are used in densely populated regions to preserve detail, while larger σ values are used in sparse regions to enhance continuity.
[0018] After determining the kernel function parameters, a Gaussian kernel function is applied to the discrete geometric element distribution for convolution. Specifically, for the discrete geometric element distribution I(x, y), a two-dimensional Gaussian kernel function can be applied for convolution, and the calculation formula is as follows: ; Here, * represents the convolution operation, and σ is the previously determined standard deviation parameter. This convolution operation diffuses discrete geometric element points to surrounding pixels, forming a continuous density distribution. In practical calculations, separable convolution can be used, first performing a one-dimensional Gaussian convolution in the x-direction, and then another in the y-direction, to reduce computational complexity. After convolution, the originally discrete geometric element points are smoothed into a continuous density field, with density values reflecting the concentration of geometric elements near that location. Thus, the resulting continuous density field unifies the representation of vector and raster data while preserving the spatial distribution characteristics of geometric elements in the drawing, providing a unified data foundation for subsequent cluster analysis and candidate region identification.
[0019] It should be noted that in this embodiment, by adaptively determining the Gaussian kernel parameters, the problem of recognition failure that occurs when the drawing quality varies is effectively addressed by adapting to different drawing scales and noise interference.
[0020] 102. Based on the continuous density field, perform cluster analysis on the geometric elements in the engineering drawings, and determine the candidate table region based on the directional relationship and spatial adjacency relationship between line segments; In this embodiment, density clustering is performed on the continuous density field. The continuous density field can be segmented by a density threshold, and pixels with density values higher than a preset threshold are used as seed points. A density-based spatial clustering algorithm is then used to cluster these seed points, resulting in several geometric element clusters. These clusters represent areas in the drawing where geometric elements are relatively concentrated, such as table areas, graphic areas, and text annotation areas. It should be noted that density clustering can effectively identify high-density areas in the drawing, avoiding the need for manual setting of clustering parameters in traditional methods.
[0021] After obtaining the geometric element clusters, a probability distribution model is performed on the line segment directions within each cluster to obtain the direction distribution characteristics. Specifically, the direction angles of the line segment elements in each cluster can be extracted, and a probability distribution model can be used to model the direction angles. The distribution parameters are estimated through an iterative algorithm, thereby identifying the dominant direction set of each cluster. For example, for a table area, its dominant directions are usually horizontal and vertical; while for a tilted table, the dominant directions will deviate accordingly.
[0022] Furthermore, a geometric constraint graph is constructed based on the directional distribution characteristics and the spatial relationships of line segments. Within this graph, line segments are used as nodes, and parallel and perpendicular relationships between them are used as edges. By performing connected subgraph decomposition on the geometric constraint graph, connected subgraphs that simultaneously satisfy both closure and orthogonality conditions are identified. The regions corresponding to these connected subgraphs are then designated as candidate table regions. In this way, multiple candidate regions that may contain BOM tables can be selected from the drawings, providing input for subsequent global optimization.
[0023] 103. Establish an integer linear programming model for the candidate table region, and perform global optimization solution according to the preset constraints to obtain the target BOM table region; In this embodiment, the step of establishing an integer linear programming model for the candidate table regions and performing global optimization based on preset constraints to obtain the target BOM table region includes: calculating the area ratio, rectangularity, and internal line segment density of each candidate table region to generate candidate region feature vectors; constructing an objective function based on the candidate region feature vectors and setting non-overlapping constraints and singleness constraints between candidate regions to obtain an integer linear programming model; solving the integer linear programming model to obtain the decision variable value that maximizes the objective function value, and determining the candidate table region corresponding to the decision variable value as the target BOM table region.
[0024] Specifically, after obtaining the set of candidate table regions, an integer linear programming model needs to be established for these candidate regions. Global optimization is then performed based on preset constraints to obtain the target BOM table region. It should be noted that since there may be multiple candidate table regions in the drawing, and these regions may overlap, obscure, or conflict in position, traditional methods typically use local evaluation to judge each region individually, which can easily lead to omissions or incorrect selections of candidate regions. In this embodiment, by establishing an integer linear programming model, the characteristics and constraints of each candidate region can be comprehensively considered from a global perspective to select the optimal target region.
[0025] In this embodiment, after obtaining the set of candidate table regions, an integer linear programming model needs to be established for these candidate regions. Global optimization is then performed based on preset constraints to obtain the target BOM table region. It should be noted that since there may be multiple candidate table regions in the drawing, and these regions may overlap, obscure, or conflict in position, traditional methods typically use local evaluation to judge each region individually, which can easily lead to omissions or incorrect selections of candidate regions. In this embodiment, by establishing an integer linear programming model, the characteristics and constraints of each candidate region can be comprehensively considered from a global perspective to select the optimal target region.
[0026] In this embodiment, the feature parameters can include three aspects: area ratio, rectangularity, and internal line segment density. The area ratio can be defined as the ratio of the area of the candidate region to the total area of the drawing, reflecting the relative size of the region. Rectangularity can be determined by calculating the ratio of the area of the smallest bounding rectangle of the candidate region to the actual area. The closer the rectangularity is to 1, the closer the region is to a standard rectangle, which conforms to the typical characteristics of a BOM table. Internal line segment density can be calculated by counting the number of line segments within the candidate region and dividing by the region area. Table regions typically have a high line segment density because tables consist of a large number of horizontal and vertical lines. By calculating these three feature parameters, a three-dimensional feature vector can be generated for each candidate table region.
[0027] After obtaining the feature vectors of the candidate regions, an objective function is constructed based on these feature vectors. In this embodiment, the objective function aims to maximize the overall quality score of the selected regions. Specifically, each candidate region can be assigned a quality score. The score can be calculated based on the area of the figure frame or the confidence level. Therefore, a 0-1 decision variable is introduced. Indicates whether to select the i-th candidate region. =1 indicates that the region is selected; if =0 indicates that the region is not selected. Therefore, the objective function of the integer linear programming model can be expressed as: ; Where N is the total number of candidate table regions. The objective function represents selecting the combination of regions that maximizes the total quality score from all candidate regions.
[0028] In addition to the objective function, constraints need to be set to ensure the rationality of the selection result. In this embodiment, the constraints mainly include two types: non-overlapping constraints and singularity constraints. Non-overlapping constraints require that the selected candidate regions cannot have spatial overlap, avoiding the repeated identification of the same region as multiple BOM tables. Singularity constraints require that only one optimal target region be selected as the BOM table region, which can be represented as... = 1. Furthermore, the range of values for the decision variables is constrained as follows: ∈ {0, 1} indicates that each candidate region can only be selected or not selected, and there is no case of partial selection.
[0029] Combining the objective function and constraints, we can obtain the complete integer linear programming model: ; in This represents the set of all candidate regions that overlap with the j-th candidate region.
[0030] After establishing the integer linear programming model, the model is solved to obtain the values of the decision variables that maximize the objective function. In this embodiment, existing integer linear programming solvers, such as Gurobi and CPLEX, can be used. The solver searches for the optimal solution using algorithms such as branch and bound and cutting planes, returning the optimal values of each decision variable. Then, the candidate table regions corresponding to decision variable values of 1 are determined as the target BOM table regions.
[0031] It should be noted that by establishing an integer linear programming model for global optimization, the problem of candidate region conflict can be effectively solved, avoiding suboptimal selection or omission that may be caused by traditional local evaluation methods, and ensuring that the target region with the best overall quality is selected from multiple candidate regions.
[0032] 104. Extract and semantically match the text content in the target BOM table area to determine the correspondence between each text content and the fields in the BOM table, and classify and integrate the text content according to the correspondence to obtain structured BOM information.
[0033] In this embodiment, the step of extracting and semantically matching the text content in the target BOM table area to determine the correspondence between each text content and BOM table fields, and classifying and integrating the text content according to the correspondence to obtain structured BOM information includes: extracting text from the target BOM table area; identifying header rows and data rows according to the spatial position relationship of the text to obtain a header text set and a data text set; performing word vector encoding on each header text in the header text set; calculating the semantic similarity between the header text and preset BOM field standard words; determining the BOM field type corresponding to each header text based on the maximum similarity value to obtain a field mapping relationship; grouping the text content in the data text set by row according to the field mapping relationship; associating the text in the same row according to the field type corresponding to the column position to obtain the structured BOM information.
[0034] Specifically, optical character recognition (OCR) technology can be used to recognize the text within the table area, or the text content and insertion point coordinates of the TEXT entities can be directly extracted from the DXF file. The extracted text content contains all the text information in the table, such as header field names, component numbers, names, specifications, quantities, and other data items. Then, the header rows and data rows are identified based on the spatial relationship of the text. Specifically, the vertical coordinate position of each text element can be counted, and the text can be divided into different rows based on the clustering of the vertical coordinates. Typically, the first row or the first few rows of the table are header rows, containing field names, while the remaining rows are data rows, containing the specific BOM data. The header rows and data rows can be distinguished by judging the characteristics of the text content. For example, the text in the header rows is usually shorter and contains keywords such as "serial number," "name," and "specification," while the data rows contain specific numerical or descriptive information. In this way, a set of header text and a set of data text can be obtained.
[0035] After obtaining the header text set, each header text needs to be encoded using word vectors to calculate semantic similarity. In this embodiment, a pre-trained word vector model can be used to encode the header text, converting the text into a high-dimensional vector representation. For example, word vector models such as Word2Vec or FastText can be used to encode the header text "component number" into a vector 'a', and the preset BOM field standard vocabulary "number" into a vector 'b'. It should be noted that the preset BOM field standard vocabulary can be predefined according to industry specifications of engineering drawings. For example, in the field of construction engineering, standard fields may include "serial number", "component number", "name", "specification", "material", "quantity", "unit", etc.
[0036] Next, the semantic similarity between the header text and the standard vocabulary in the preset BOM field is calculated. In this embodiment, the semantic similarity can be determined by calculating the cosine similarity between word vectors. Specifically, for the header text vector a and the standard vocabulary vector b, the similarity calculation formula is: ; Where a · b represents the dot product of vectors, and ||a|| and ||b|| represent the magnitudes of the vectors, respectively. The similarity value ranges from [-1, 1], with a similarity closer to 1 indicating a closer semantic relationship between the two texts. For each header text, its similarity to all standard words can be calculated, and the BOM field type corresponding to the header text can be determined based on the maximum similarity value. For example, if the header text "component number" has a similarity of 0.85 with the standard word "number" and a similarity of 0.32 with "name", then the field type corresponding to this header text can be determined as "number". Furthermore, a similarity threshold can be set, such as 0.7. Only when the similarity is greater than this threshold is a match considered successful; otherwise, the header text may belong to a non-standard field or be incorrectly identified, requiring manual intervention. In this way, the field mapping relationship can be obtained, i.e., the standard BOM field type corresponding to each header text.
[0037] After determining the field mapping relationship, the text content in the data text set is grouped by row according to this mapping relationship. Specifically, the data text can be divided into different data rows based on its vertical coordinate position, with each data row corresponding to a record in the BOM table. Then, the text within the same row is associated with the field type corresponding to its column position. For example, for a data row, if the first column text is "01", according to the field mapping relationship, this column corresponds to the "Serial Number" field, so "01" is associated with the Serial Number field; if the second column text is "Main Beam", this column corresponds to the "Name" field, so "Main Beam" is associated with the Name field; if the third column text is "HM400×200×8×13", this column corresponds to the "Specifications" field, so this text is associated with the Specifications field. In this way, the text within the same row can be organized according to field type to form a complete structured record.
[0038] By performing the above processing on all data rows, structured BOM information can be obtained. This structured BOM information can be represented in tabular or database record format, with each record containing fields such as serial number, component number, name, specifications, and quantity, along with their corresponding values. In this way, the unstructured text content in the target BOM table area is converted into structured data, facilitating subsequent data storage, querying, and analysis.
[0039] Furthermore, after classifying and integrating the text content according to the correspondence to obtain structured BOM information, the method further includes: hashing each record in the structured BOM information to convert the text content of each record into a fixed-length minimum hash signature to obtain a record signature set; performing bucketing on the record signature set using the locality-sensitive hashing algorithm to map records with similar signatures to the same or adjacent buckets to obtain candidate duplicate record pairs; calculating the edit distance for the candidate duplicate record pairs, and determining record pairs with an edit distance less than a preset threshold as duplicate records and merging them to obtain deduplicated BOM information.
[0040] Specifically, after classifying and integrating the text content according to the corresponding relationships to obtain structured BOM information, it is necessary to deduplicate this structured BOM information to eliminate possible duplicate records. It should be noted that in the processing of large-scale engineering drawings, due to drawing quality issues, recognition errors, or manual input errors, duplicate or highly similar records may exist in the BOM information. Traditional methods typically use exact matching for deduplication, i.e., comparing the content of each record one by one. However, this method has high computational complexity and time overhead when processing large amounts of data. In this embodiment, by using a combination of least hash signature and locality-sensitive hashing algorithm, the computational overhead can be significantly reduced while ensuring the accuracy of deduplication.
[0041] In this embodiment, each record contains multiple fields, such as serial number, component number, name, specifications, and quantity. The text content of these fields can be concatenated into a string to represent the record. For example, the record "01|Main Beam|HM400×200×8×13|Q345B|2" can be represented as the string "01Main BeamHM400×200×8×13Q345B2". Furthermore, the text content of each record is converted into a fixed-length minimum hash signature. Specifically, the MinHash algorithm can be used to generate the signature. The basic idea of the MinHash algorithm is to perform a hash mapping on the text and take the minimum hash value as part of the signature. For each character or substring in the text, multiple different hash functions can be applied for mapping, and the minimum value calculated by each hash function is selected to form a signature vector. In this embodiment, the length of the MinHash signature can be set to a 50-character ASCII character sequence, calculated as follows: ; Where S represents the set of text content for each record, and h represents the hash function. By generating a MinHash signature for each record, a set of record signatures can be obtained. It should be noted that MinHash signatures have the following property: two records with similar text content will have similar signatures, while records with significantly different text content will have significantly different signatures.
[0042] After obtaining the set of record signatures, the signature set is bucketed using the Locality Sensitive Hashing (LSH) algorithm. The core idea of LSH is to map similar signatures to the same or adjacent buckets, thereby quickly finding potentially duplicate record pairs. In this embodiment, 128 buckets can be set, and the MinHash signatures are allocated to these buckets according to a specific bucketing strategy. Specifically, the first few bits of each signature can be used as the bucket index, assigning the signature to the corresponding bucket. For example, the first 10 and last 18 bits of the signature can be used as two-level indices, forming a multi-level bucketing structure. In this way, records with similar signatures are mapped to the same or adjacent buckets, while records with significantly different signatures are assigned to different buckets. Furthermore, potentially duplicate record pairs can be searched within each bucket or between adjacent buckets. Record pairs assigned to the same or adjacent buckets are marked as candidate duplicate record pairs, resulting in a set of candidate duplicate record pairs. It should be noted that LSH transforms the global pairwise comparison problem into a local intra-bucket comparison problem, significantly reducing computational complexity.
[0043] After obtaining candidate duplicate record pairs, these pairs need further precise verification. In this embodiment, Levenshtein edit distance can be used to measure the similarity between two records. Levenshtein edit distance represents the minimum number of editing operations required to convert one string into another, including insertion, deletion, and replacement of characters. For example, for two records A and B in a candidate duplicate record pair, the edit distance d between their text contents can be calculated. If the edit distance d is less than a preset threshold, for example, d≤3, then these two records can be determined to be duplicate records. It should be noted that the edit distance threshold can be adjusted according to the actual application scenario. A smaller threshold requires records to be highly similar before being considered duplicates, while a larger threshold allows for more differences. In this embodiment, the threshold can be set to 3, meaning that a maximum of 3 characters of difference is allowed between the two records.
[0044] For pairs of records identified as duplicates, a merging process is performed. Specifically, one record can be kept and the other deleted, or the information from the two records can be merged, such as by adding the quantity fields. The merging strategy can be set according to actual needs. After identifying and merging all candidate duplicate record pairs, the deduplicated BOM information can be obtained.
[0045] In this embodiment, the input engineering drawings are processed using Gaussian kernel density estimation to convert the mixed vector and raster data into a continuous density field. Based on this continuous density field, geometric elements are clustered, and candidate table regions are determined based on the directional and spatial adjacency relationships between line segments. An integer linear programming model is established for the candidate table regions, and global optimization is performed according to preset constraints to obtain the target BOM table region. The text content in the target BOM table region is extracted and semantically matched to determine the correspondence between each text content and BOM table fields, and then categorized and integrated to obtain structured BOM information. This invention improves the accuracy and robustness of recognizing low-quality, mixed-format drawings through adaptive probabilistic modeling and global optimization methods, while reducing the need for manual intervention.
[0046] Please see Figure 2 Another embodiment of the engineering drawing BOM table identification method in this application includes: 201. Perform Gaussian kernel density estimation on the input engineering drawings to obtain a continuous density field representing the spatial distribution of the geometric elements in the drawings; In this embodiment, step 201 is similar to step 101, and will not be described again here.
[0047] 202. Perform density clustering on the continuous density field to obtain geometric element clusters; In this embodiment, a density threshold segmentation process is performed on the continuous density field. A preset density threshold θ_d can be set, and pixels with density values higher than this threshold are selected as seed points. These seed points represent the relatively concentrated locations of geometric elements in the drawing. Then, a density-based spatial clustering algorithm is used to cluster these seed points. In this embodiment, a density clustering algorithm such as DBSCAN can be used. The core idea of this algorithm is to aggregate spatially adjacent points with sufficiently high density into a cluster. Specifically, two parameters can be set: the neighborhood radius ε and the minimum number of points. For each seed point, the algorithm searches for other seed points within its ε-neighborhood. If the number of points in the neighborhood is not less than the minimum number of points, these points are grouped into the same cluster. By continuously expanding the neighborhood, density-connected seed points can be gradually aggregated, eventually resulting in several geometric element clusters. These clusters correspond to different functional areas in the drawing, such as table areas, graphic areas, and annotation areas. It should be noted that density-based clustering methods do not require pre-specifying the number of clusters and can adaptively identify high-density areas in drawings, avoiding the problem of manually setting the number of clusters required by traditional methods such as k-means.
[0048] 203. Model the probability distribution of line segment directions in the geometric element clusters to obtain the direction distribution characteristics; In this embodiment, the step of performing cluster analysis on the geometric elements in the engineering drawings based on the continuous density field, and determining candidate table regions based on the directional relationships and spatial adjacency relationships between line segments includes: performing density clustering on the continuous density field to obtain geometric element clusters; performing probability distribution modeling on the line segment directions in the geometric element clusters to obtain directional distribution features; constructing a geometric constraint graph based on the directional distribution features and the spatial positional relationships of the line segments; and performing subgraph recognition on the geometric constraint graph to obtain candidate table regions.
[0049] Specifically, for a line segment, the direction angle θ can be calculated using the arctangent function based on its starting and ending coordinates. The direction angle typically ranges from [0, π] to [-π / 2, π / 2], representing the angle of inclination of the line segment relative to the horizontal direction. By calculating the direction angles of all line segments in a cluster, the direction angle sequence {θ1, θ2, ..., θM} of that cluster can be obtained, where M is the number of line segments within that cluster.
[0050] After obtaining the orientation angle sequence, a Von Mises mixture distribution model is used to probabilistically model the orientation angles. It should be noted that the Von Mises distribution is a probability distribution defined on a circle, making it particularly suitable for modeling angle data. In this embodiment, since the table area typically contains two dominant directions, horizontal and vertical, or the tilted table contains two mutually perpendicular dominant directions, a mixture distribution model can better characterize the distribution features of the orientation angles. The probability density function of the Von Mises mixture distribution can be expressed as: ; Where K represents the amount of the mixed components, which is usually between 2 and 4; Let be the weighting coefficient of the k-th mixture component, satisfying Σ =1; The peak direction of the k-th mixture component is represented by the angle of the dominant direction. This is a concentration parameter, representing the degree of concentration of the directional distribution. The larger the value, the more concentrated the directional distribution is near the peak direction; I0(κk) is the zero-order modified Bessel function, used for normalization.
[0051] Then, the parameters of the mixture distribution are estimated iteratively using the Expectation-Maximization (EM) algorithm. Specifically, the EM algorithm consists of two stages: an E-step and an M-step. In the E-step, the posterior probability of each orientation angle θi belonging to each mixture component is calculated based on the current parameter estimates. In the M-step, the weighting coefficients πk, peak orientation μk, and concentration parameter κk are updated based on the posterior probabilities. By continuously iterating through the E-step and M-step until the parameters converge or the preset number of iterations is reached, the optimal orientation distribution parameters can be obtained.
[0052] After estimating the directional distribution parameters, the orientation angles corresponding to the peak probability density values in the mixed distribution are identified based on these parameters. Specifically, the peak orientation μk of each mixed component can be found, and whether this orientation is the dominant orientation can be determined based on the weighting coefficient πk and the concentration parameter κk. For example, a threshold can be set, and μk is considered the dominant orientation only when πk × κk is greater than a preset value. The identified dominant orientation angles are used as the directional distribution features of the cluster. In this way, each geometric element cluster corresponds to a set of dominant orientations; for example, a standard table corresponds to {0°, 90°}, and a tilted table corresponds to {30°, 120°}. These directional distribution features provide an important basis for subsequent construction of geometric constraint maps and identification of candidate table regions.
[0053] 204. Construct a geometric constraint graph based on the directional distribution characteristics and the spatial positional relationship of the line segments, and perform subgraph recognition on the geometric constraint graph to obtain candidate table regions; In this embodiment, the construction process of the geometric constraint graph can be performed as follows: each line segment in the cluster is used as a node of the graph, and the geometric relationship between the line segments is used as the edge of the graph. For any two line segments i and j, if their direction angles θi and θj satisfy a parallel or perpendicular relationship, then a connecting edge is established between nodes i and j. In this embodiment, the parallel relationship can be defined as |θi-θj|<δ, where δ is the angle tolerance, for example, δ=10°; the perpendicular relationship can be defined as ||θi-θj|-90°|<δ. In addition, the spatial adjacency relationship of the line segments also needs to be considered, that is, whether the two line segments are sufficiently close in space. The shortest distance between the line segments can be calculated, and if the distance is less than a preset adjacency threshold, then the two line segments are considered to have a spatial adjacency relationship. In this way, by combining the directional relationship and the spatial adjacency relationship, a graph structure reflecting the geometric constraints between line segments can be constructed.
[0054] After constructing the geometric constraint graph, the graph is decomposed into connected subgraphs. Specifically, a depth-first search or breadth-first search algorithm can be used to traverse the graph structure and identify each connected subgraph. Then, feature analysis is performed on each connected subgraph to determine whether it satisfies the geometric characteristics of a table. In this embodiment, the table region should simultaneously satisfy the closure and orthogonality conditions. The closure condition requires that the line segments in the connected subgraph can form a closed rectangular or approximately rectangular region; the orthogonality condition requires that there are two sets of mutually perpendicular dominant directions in the subgraph, which corresponds to the aforementioned directional distribution characteristics. For connected subgraphs that simultaneously satisfy both conditions, their corresponding spatial regions are determined as candidate table regions. In addition, further filtering can be performed based on features such as the number of line segments and the coverage area of the subgraph to exclude regions that clearly do not meet the table characteristics. In this way, several candidate table regions can be identified from each cluster, and these regions will serve as input for subsequent global optimization.
[0055] 205. Establish an integer linear programming model for the candidate table region, and perform global optimization solution according to the preset constraints to obtain the target BOM table region; 206. Extract and semantically match the text content in the target BOM table area to determine the correspondence between each text content and the fields in the BOM table, and classify and integrate the text content according to the correspondence to obtain structured BOM information.
[0056] In this embodiment, steps 205-206 are similar to steps 103-104, and will not be described again here.
[0057] In this embodiment, the input engineering drawings are processed using Gaussian kernel density estimation to convert the mixed vector and raster data into a continuous density field. Based on this continuous density field, geometric elements are clustered, and candidate table regions are determined based on the directional and spatial adjacency relationships between line segments. An integer linear programming model is established for the candidate table regions, and global optimization is performed according to preset constraints to obtain the target BOM table region. The text content in the target BOM table region is extracted and semantically matched to determine the correspondence between each text content and BOM table fields, and then categorized and integrated to obtain structured BOM information. This invention improves the accuracy and robustness of recognizing low-quality, mixed-format drawings through adaptive probabilistic modeling and global optimization methods, while reducing the need for manual intervention.
[0058] The above describes the method for identifying the BOM (Bill of Materials) table of engineering drawings in the embodiments of the present invention. The following describes the device for identifying the BOM table of engineering drawings in the embodiments of the present invention. Please refer to [link to device description] for details regarding this device. Figure 3 One embodiment of the engineering drawing BOM table recognition device of the present invention includes: The density field generation module 301 is used to perform Gaussian kernel density estimation on the input engineering drawings to obtain a continuous density field representing the spatial distribution of the geometric elements of the drawings. The candidate region determination module 302 is used to perform cluster analysis on the geometric elements in the engineering drawings based on the continuous density field, and to determine the candidate table region based on the directional relationship and spatial adjacency relationship between line segments. The target region selection module 303 is used to establish an integer linear programming model for the candidate table region, and perform global optimization solution according to preset constraints to obtain the target BOM table region. The information extraction module 304 is used to extract and semantically match the text content in the target BOM table area, determine the correspondence between each text content and the fields of the BOM table, and classify and integrate the text content according to the correspondence to obtain structured BOM information.
[0059] In this embodiment of the invention, the engineering drawing BOM recognition device operates the aforementioned engineering drawing BOM recognition method. The device extracts text and performs semantic parsing on the requirement document to obtain structured requirement information. This structured requirement information is then input to a first intelligent agent, which generates an initial test case set based on a language model. The initial test case set is then input to a second intelligent agent, which performs a quality assessment of the initial test case set and obtains an assessment result. Based on the assessment result, the generation strategy of the first intelligent agent is adjusted, and the initial test case set is optimized to obtain the target test case set. This invention, through a dual-agent collaborative mechanism, achieves automated generation and iterative optimization of test cases, effectively improving the efficiency and quality of engineering drawing BOM recognition.
[0060] above Figure 3 The engineering drawing BOM recognition device in this embodiment of the invention is described in detail from the perspective of unitized functional entities. The engineering drawing BOM recognition device in this embodiment of the invention is described in detail from the perspective of hardware processing.
[0061] Figure 4 This is a schematic diagram of the structure of an engineering drawing BOM (Bill of Materials) recognition device 400 provided in an embodiment of the present invention. The engineering drawing BOM recognition device 400 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 410 (e.g., one or more processors) and a memory 420, and one or more storage media 430 (e.g., one or more mass storage devices) storing application programs 433 or data 432. The memory 420 and storage media 430 can be temporary or persistent storage. The program stored in the storage media 430 may include one or more units (not shown in the diagram), each unit may include a series of instruction operations on the engineering drawing BOM recognition device 400. Furthermore, the processor 410 may be configured to communicate with the storage media 430 and execute the series of instruction operations in the storage media 430 on the engineering drawing BOM recognition device 400 to implement the steps of the above-described engineering drawing BOM recognition method.
[0062] The engineering drawing BOM (Bill of Materials) identification device 400 may also include one or more power supplies 440, one or more wired or wireless network interfaces 450, one or more input / output interfaces 460, and / or one or more operating systems 431, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will understand that... Figure 4The illustrated structure of the engineering drawing BOM recognition device does not constitute a limitation on the engineering drawing BOM recognition device provided by the present invention. It may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.
[0063] The present invention also provides a computer-readable storage medium, which can be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, wherein the computer-readable storage medium stores instructions that, when the instructions are executed on a computer, cause the computer to perform the steps of the engineering drawing BOM table identification method.
[0064] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system, device, or unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0065] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0066] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for identifying the Bill of Materials (BOM) in engineering drawings, characterized in that, The method for identifying the BOM (Bill of Materials) table in engineering drawings includes: The input engineering drawings are processed by Gaussian kernel density estimation to obtain a continuous density field representing the spatial distribution of the geometric elements in the drawings; Cluster analysis is performed on the geometric elements in the engineering drawings based on the continuous density field, and candidate table regions are determined based on the directional relationship and spatial adjacency relationship between line segments. An integer linear programming model is established for the candidate table region, and global optimization is performed according to preset constraints to obtain the target BOM table region; The text content in the target BOM table area is extracted and semantically matched to determine the correspondence between each text content and the fields in the BOM table. Based on the correspondence, the text content is categorized and integrated to obtain structured BOM information.
2. The method for identifying the BOM (Bill of Materials) table in engineering drawings according to claim 1, characterized in that, The process of performing Gaussian kernel density estimation on the input engineering drawings to obtain a continuous density field representing the spatial distribution of the geometric elements in the drawings includes: The coordinates of the geometric elements in the input engineering drawing are extracted and mapped to a pixel grid to obtain the discrete geometric element distribution; The standard deviation parameter of the Gaussian kernel function is determined based on the local density characteristics of the discrete geometric element distribution, thus obtaining the kernel function parameters; The discrete geometric element distribution is convolved with a Gaussian kernel function having the kernel function parameters to obtain the continuous density field.
3. The method for identifying the BOM (Bill of Materials) of engineering drawings according to claim 1, characterized in that, The step of clustering geometric elements in the engineering drawings based on the continuous density field and determining candidate table regions based on the directional and spatial adjacency relationships between line segments includes: Density clustering is performed on the continuous density field to obtain geometric element clusters; The probability distribution of line segment directions in the geometric element clusters is modeled to obtain the direction distribution characteristics. A geometric constraint graph is constructed based on the directional distribution characteristics and the spatial positional relationship of line segments. Subgraph recognition is performed on the geometric constraint graph to obtain candidate table regions.
4. The method for identifying the BOM (Bill of Materials) of engineering drawings according to claim 3, characterized in that, The probability distribution modeling of line segment directions in the geometric element clusters, resulting in directional distribution features, includes: Extract the start and end coordinates of each line segment in the geometric element cluster, calculate the direction angle of each line segment, and obtain the direction angle sequence. The orientation angle sequence is modeled using the Von Mises mixture distribution model. The weight coefficients, peak direction, and concentration parameters of the mixture distribution are estimated iteratively using the expectation-maximization algorithm to obtain the orientation distribution parameters. Based on the directional distribution parameters, the directional angle corresponding to the probability density peak in the mixed distribution is identified, and the peak directional angle is taken as the dominant direction to obtain the directional distribution characteristics.
5. The method for identifying the BOM (Bill of Materials) table in engineering drawings according to claim 1, characterized in that, The step of establishing an integer linear programming model for the candidate table region and performing global optimization based on preset constraints to obtain the target BOM table region includes: Calculate the area ratio, rectangularity, and internal line segment density of each candidate table region to generate a candidate region feature vector; Based on the feature vectors of the candidate regions, an objective function is constructed, and non-overlapping constraints and singleness constraints are set between the candidate regions to obtain an integer linear programming model. Solve the integer linear programming model to obtain the values of the decision variables that maximize the objective function value, and determine the candidate table area corresponding to the decision variable values as the target BOM table area.
6. The method for identifying the BOM (Bill of Materials) table in engineering drawings according to claim 1, characterized in that, The process of extracting and semantically matching the text content in the target BOM table area to determine the correspondence between each text content and a BOM table field, and then classifying and integrating the text content based on the correspondence to obtain structured BOM information includes: Text is extracted from the target BOM table area, and the header row and data row are identified based on the spatial relationship of the text to obtain the header text set and the data text set. Each header text in the header text set is encoded with word vectors, and the semantic similarity between the header text and the preset BOM field standard words is calculated. The BOM field type corresponding to each header text is determined based on the maximum similarity value, and the field mapping relationship is obtained. Based on the field mapping relationship, the text content in the data text set is grouped by row, and the text in the same row is associated according to the field type corresponding to the column position to obtain the structured BOM information.
7. The method for identifying the BOM (Bill of Materials) table in engineering drawings according to claim 1, characterized in that, After classifying and integrating the text content according to the correspondence to obtain structured BOM information, the method further includes: Each record in the structured BOM information is hash-encoded, and the text content of each record is converted into a fixed-length minimum hash signature to obtain a record signature set; The record signature set is bucketed using the Locality Sensitive Hash algorithm, which maps records with similar signatures to the same or adjacent buckets to obtain candidate duplicate record pairs. The edit distance is calculated for the candidate duplicate record pairs. Record pairs with an edit distance less than a preset threshold are identified as duplicate records and merged to obtain the deduplicated BOM information.
8. A device for recognizing engineering drawing BOM (Bill of Materials) sheets, characterized in that, The engineering drawing BOM table recognition device includes: The density field generation module is used to perform Gaussian kernel density estimation on the input engineering drawings to obtain a continuous density field representing the spatial distribution of the geometric elements of the drawings. The candidate region determination module is used to perform cluster analysis on the geometric elements in the engineering drawings based on the continuous density field, and to determine the candidate table region based on the directional relationship and spatial adjacency relationship between line segments. The target region selection module is used to establish an integer linear programming model for the candidate table region, and perform global optimization solution according to preset constraints to obtain the target BOM table region. The information extraction module is used to extract and semantically match the text content in the target BOM table area, determine the correspondence between each text content and the fields in the BOM table, and classify and integrate the text content according to the correspondence to obtain structured BOM information.
9. A device for recognizing engineering drawing BOM (Bill of Materials) tables, characterized in that, The engineering drawing BOM table recognition device includes: a memory and at least one processor, wherein the memory stores instructions; The at least one processor invokes the instructions in the memory to cause the engineering drawing BOM recognition device to perform the steps of the engineering drawing BOM recognition method as described in any one of claims 1-7.
10. A computer-readable storage medium storing instructions thereon, characterized in that, When the instruction is executed by the processor, it implements the steps of the engineering drawing BOM table identification method as described in any one of claims 1-7.