Process drawing recognition and hierarchical BOM generation method and system based on OCR technology

By automatically recognizing and parsing drawings using OCR technology, a hierarchical BOM table is generated, solving the problem of low efficiency in manually entering BOM tables by machining manufacturers and achieving efficient and accurate BOM generation.

CN118675194BActive Publication Date: 2025-11-04HANGZHOU JIUXIN IOT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410746944.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-11
Publication Date
2025-11-04
Estimated Expiration
2044-06-11

AI Technical Summary

Technical Problem

In the existing technology, after receiving a new order, machining manufacturers need to manually establish the hierarchical relationship between drawings and manually enter and generate a BOM, which leads to low efficiency and is prone to errors.

Method used

A process drawing recognition method based on OCR technology is adopted, including preprocessing, text recognition, and hierarchical BOM generation. It automatically generates hierarchical BOM tables from batch drawings. Through message listening, image processing, text detection, and text recognition models, the drawing content is parsed and BOM tables are generated.

Benefits of technology

It has enabled automated generation of BOM tables, which has improved production efficiency, reduced labor costs, and solved the problems of long processing time and high error rates associated with manual data entry.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118675194B_ABST
    Figure CN118675194B_ABST
Patent Text Reader

Abstract

The application discloses a process drawing recognition and hierarchical BOM generation method and system based on an OCR technology, and the method comprises the following steps: S1, a message listener is continuously used for listening, after receiving a message, message analysis is carried out, a URL address and related information of a drawing are obtained, and a drawing analysis process is triggered; S2, according to the URL address and related information in the message, batch drawing data is automatically acquired; S3, a single drawing is subjected to a pretreatment operation; S4, sub-block image OCR recognition is carried out; S5, text post-processing is carried out on all sub-block images of the single drawing, and a BOM table of the single drawing is further obtained; and S6, a hierarchical BOM is generated. The application can realize the analysis of a single drawing to generate a corresponding BOM table, and can also analyze batch drawings of the same project to generate a hierarchical BOM table, thereby solving the problems that BOM information is manually input for a long time and is prone to errors, improving production efficiency, and reducing labor costs.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] This invention relates to the technical field of mechanical manufacturing, and in particular to the technical field of process drawing recognition and hierarchical BOM generation methods and systems based on OCR technology. [Background Technology]

[0002] After receiving a new order, a machining manufacturer needs to procure raw materials, develop a production plan, and then go through a series of processing and production processes before finally delivering the product to the user. Many of these stages require a Bill of Materials (BOM). The BOM details all the parts, raw materials, components, and their quantities needed to manufacture a product, serving as a fundamental document in the manufacturing process. A product typically contains multiple parts; only by combining the BOMs of all parts can the complete assembly structure of the product be fully expressed, describing the total quantity of all materials in the final product.

[0003] Modern engineering drawings are typically created using software tools. These drawings include component structures and material lists, with the Bill of Materials (BOM) information contained within them. When manufacturers receive a batch of drawings, they often cannot directly access the product's BOM information. They must manually determine the hierarchical relationships between the drawings, manually establish the parent-child relationships for all components, and manually input the data to generate the BOM. When an order involves a large number of drawings, this manual method is insufficient. [Summary of the Invention]

[0004] The purpose of this invention is to solve the problems in the prior art and to propose a method and system for process drawing recognition and hierarchical BOM generation based on OCR technology, which can automatically generate hierarchical BOM tables from a batch of drawings with hierarchical relationships.

[0005] To achieve the above objectives, this invention proposes a method for process drawing recognition and hierarchical BOM generation based on OCR technology, comprising the following steps:

[0006] S1. Use a message listener to continuously listen for messages. Upon receiving a message, parse the message to obtain the URL address and related information of the drawing, and trigger the drawing parsing process.

[0007] S2. Automatically retrieve batch drawing data based on the URL address in the message;

[0008] S3. Perform preprocessing operations on a single drawing, convert the drawing into an image, perform orientation correction and image enhancement on the image, use image processing technology to cut the image according to the lines, cut the entire image into multiple sub-block images, and obtain the corresponding coordinates of the sub-block images. The detail table part in the original drawing is cut into multiple cells.

[0009] S4. Sub-block image OCR recognition, using the preset text detection model and text recognition model, the text content of all sub-block images is recognized by the text content of the sub-block image in the previous step;

[0010] S5. Text post-processing of all sub-block images of a single sheet of paper, according to the text content of all sub-block images, the multiple text contents are restored into lines through coordinate calculation, and the candidate lines of the detail table are screened to obtain the BOM table of a single sheet of paper;

[0011] S6. Hierarchical BOM generation, according to the BOM table of all single sheets of paper, the hierarchical BOM table of the product is generated, including the analysis of the drawing file name, the calculation of the table structure similarity, the depth-first traversal of all BOM tables according to the correlation field, and the automatic generation of the hierarchical BOM table.

[0012] As a preferred, the drawing preprocessing operation comprises the following steps:

[0013] 1. The acquired pdf drawing is converted into a PNG image, and grayscale and binarization operations are performed;

[0014] 2. Direction recognition of the image, judging whether the image needs to be rotated, using image processing technology to identify the lines in the image, cutting the image into multiple sub-block images according to the lines, calculating the effective sub-blocks of the cut image, according to the length and width of the sub-block image, screening according to the length and width of the sub-block image, counting the length and width of the topK value and the corresponding occurrence frequency from the effective sub-block image, and calculating the average value of the length and width respectively; according to the average value, the length and width values are calculated and compared with the set threshold value to judge whether rotation correction is needed;

[0015] 3. Using image processing technology to identify the lines and intersections of the image, and cutting the image according to these information to obtain multiple sub-block images and the corresponding coordinates of each sub-block image, the detail table part in the original image is cut into multiple sub-blocks, and a sub-block is a single cell in the original drawing.

[0016] As a preferred, the sub-block image OCR recognition comprises the following steps:

[0017] 1. For each sub-block image, image magnification and image enhancement operations are performed;

[0018] 2. Call the pre-set text detection model and text recognition model. The text detection model detects text regions in the image, and the text recognition model recognizes the text in the detected text regions to obtain the text content of the corresponding sub-block image. The two pre-set models are pre-trained model files. The training steps are as follows: collect drawing data in this field, create training data and annotation data, and fine-tune the open-source text detection model and text recognition model respectively to obtain the fine-tuned pre-set text detection model and text recognition model.

[0019] Preferably, the text post-processing includes the following steps:

[0020] 1. Traverse all sub-block images and correct the coordinate errors of row and column coordinates respectively;

[0021] 2. Arrange all sub-block images into rows according to their coordinates, and select the sub-block images that belong to the details column table area as candidate rows;

[0022] 3. Restore the table structure of all candidate row contents, and restore the text content of all sub-block images to the table structure of the detail column in the original drawing, that is, the BOM table of a single drawing, which contains the component information of the drawing and the component details of the subordinate level.

[0023] Preferably, the hierarchical BOM generation includes the following steps:

[0024] 1. Retrieve the associated fields of the drawings in the same batch of projects from relevant information, such as "drawing number";

[0025] 2. Parse the drawing file name and assign different level identifiers to the drawings based on the file name hierarchy, for example: level=1;

[0026] 3. Design an algorithm to parse the filenames of batch drawings and create a hierarchy-filename index; starting from the drawing with the highest level, traverse the BOM table row by row, perform a depth search based on the value of the associated field, and index the next level of drawing BOM table; if it exists, calculate the table structure similarity of the adjacent drawing BOM tables, and calculate the edit distance between the two table headers as the similarity value. If the similarity value is lower than the threshold, no association is performed, otherwise the depth traversal continues; if it does not exist, return to the previous level, and finally generate a BOM table with hierarchical relationship.

[0027] To achieve the above objectives, this invention proposes a hierarchical BOM generation system based on drawing recognition, comprising the following modules:

[0028] The message listening module is used to continuously listen for drawing messages. Upon receiving a message, it parses the message to obtain the drawing's URL address and related information, triggering the drawing parsing process.

[0029] A drawing download module is configured to automatically download batch drawing data according to a URL address in the drawing message;

[0030] A preprocessing module is configured to convert the drawing into an image, correct the direction of the image and enhance the image, cut the image according to lines by using image processing technology, cut the entire image into a plurality of sub-block images, and obtain corresponding coordinates of the sub-block images, wherein the detailed table part in the original drawing is cut into a plurality of cells;

[0031] An OCR recognition module is configured to recognize the text content of the sub-block images by using a preset text detection model and a text recognition model, and obtain the text content of all the sub-block images;

[0032] A text post-processing module is configured to restore a plurality of text contents into lines by coordinate calculation according to the text content of all the sub-block images, screen to obtain a detailed table candidate line, and further obtain a BOM table of a single drawing;

[0033] A hierarchical BOM generation module is configured to generate a hierarchical BOM table of a product according to the BOM tables of all the single drawings, including analyzing a drawing file name, calculating a table structure similarity, performing a depth-first traversal on all the BOM tables according to a correlation field, and automatically generating the hierarchical BOM table.

[0034] The present application has the beneficial effects that: the present application performs preprocessing operation on the drawing, recognizes the detailed table content in the drawing by using the OCR technology, designs a text post-processing algorithm to obtain the BOM information of a single drawing, and then obtains the hierarchical BOM table of batch drawings by the hierarchical BOM generation module, so as to realize automatic generation of the hierarchical BOM table from batch drawings, realize analysis and generation of the corresponding BOM table for a single drawing, realize analysis and generation of the hierarchical BOM table for batch drawings of the same project, solve the problems of long time for manual input of BOM information and easy errors, improve the production efficiency, and reduce the labor cost.

[0035] The features and advantages of the present application will be described in detail in conjunction with the embodiments and the accompanying drawings.

DRAWINGS

[0036] Figure 1 is a drawing analysis flowchart of the process drawing recognition and hierarchical BOM generation method based on the OCR technology of the present application;

[0037] Figure 2 is a text post-processing flowchart of the process drawing recognition and hierarchical BOM generation method based on the OCR technology of the present application;

[0038] Figure 3 is a hierarchical BOM generation flowchart of the process drawing recognition and hierarchical BOM generation method based on the OCR technology of the present application;

[0039] Figure 4 This is a diagram of the hierarchical BOM generation algorithm for the process drawing recognition and hierarchical BOM generation method based on OCR technology of the present invention.

Detailed Implementation Methods

[0040] See Figure 1 , Figure 2 , Figure 3 and Figure 4 The present invention provides a method for process drawing recognition and hierarchical BOM generation based on OCR technology, comprising the following steps:

[0041] S1. Use a message listener to continuously listen for messages. Upon receiving a message, parse the message to obtain the URL address and related information of the drawing, and trigger the drawing parsing process.

[0042] S2. Automatically retrieve batch drawing data based on the URL address in the message;

[0043] S3. Perform preprocessing operations on a single drawing, convert the drawing into an image, perform orientation correction and image enhancement on the image, use image processing technology to cut the image according to the lines, cut the entire image into multiple sub-block images, and obtain the corresponding coordinates of the sub-block images. The detail table part in the original drawing is cut into multiple cells.

[0044] S4. Sub-block image OCR recognition: Using a preset text detection model and text recognition model, the text content of the sub-block images from the previous step is recognized to obtain the text content of all sub-block images;

[0045] S5. Perform text post-processing on all sub-block images of a single drawing. Based on the text content of all sub-block images, calculate the coordinates to restore multiple text contents into rows, filter to obtain candidate rows for the detail table, and further obtain the BOM table of the single drawing.

[0046] S6. Hierarchical BOM generation: Based on the BOM tables of all individual drawings, a hierarchical BOM table for the product is generated. This includes parsing the drawing file names, calculating the similarity of the table structure, and traversing all BOM tables in depth based on the related fields to automatically generate the hierarchical BOM table.

[0047] The drawing preprocessing operation includes the following steps:

[0048] 1. Convert the acquired PDF drawings into PNG images, and perform grayscale and binarization operations;

[0049] 2. Direction recognition of the image, judgment of whether the image needs to be rotated, line recognition in the image using image processing technology, pre-cutting of the image according to the line, cutting of the image into multiple sub-block images; calculation of effective sub-blocks of the cut image: screening according to the length and width of the sub-block image; from the effective sub-block image, counting the length and width values of the topK occurrence times and the corresponding occurrence times, and calculating the average value of the length and width respectively; calculating the length and width values according to the average value, and comparing with the set threshold value to judge whether rotation correction is needed;

[0050] 3. Line and intersection recognition of the image using image processing technology, and cutting of the image according to the information to obtain multiple sub-block images and the coordinates corresponding to each sub-block image, the detailed table part in the original drawing being cut into multiple sub-blocks, and a sub-block being a single cell in the original drawing;

[0051] The sub-block image OCR recognition includes the following steps:

[0052] 1. Image magnification and image enhancement operation on each sub-block image;

[0053] 2. Calling a preset text detection model and a text recognition model, the text detection model detecting the text area in the image, and the text recognition model recognizing the text in the detected text area to obtain the text content of the corresponding sub-block image, wherein the two preset models are pre-trained model files, and the training steps are as follows: collecting drawing data in the field, making training data and annotation data, and respectively fine-tuning the open source text detection model and the text recognition model to obtain the fine-tuned preset text detection model and the text recognition model;

[0054] The text post-processing includes the following steps:

[0055] 1. Iterating all sub-block images to correct the coordinate errors of the row coordinates and the column coordinates respectively;

[0056] 2. Arranging all sub-block images into rows according to the coordinates, and selecting the sub-block images belonging to the detailed column table area as candidate rows;

[0057] 3. Restoring the table structure of all candidate row contents, restoring the text content of all sub-block images into the detailed column table structure in the original drawing, i.e. the BOM table of a single drawing, containing the part information of the drawing and the part details of the subordinate first-level parts;

[0058] The hierarchical BOM generation includes the following steps:

[0059] 1. Obtaining the associated fields of the same batch project drawings from the related information, such as "drawing number";

[0060] 2. Analyze the drawing file name, and identify the drawing at different levels according to the file name level, for example: level = 1;

[0061] 3. Design an algorithm to analyze the file name of a batch of drawings, create a level-file name index, start from the drawing with the highest level, traverse the BOM table row by row, perform a depth search according to the value of the associated field, index the next layer drawing BOM table, if there is, calculate the table structure similarity of the adjacent level drawing BOM table, calculate the edit distance between the two table headers as the similarity value, if the similarity value is lower than the threshold value, do not associate, otherwise continue to depth traversal, if there is not, return to the last layer, and finally generate a BOM table with hierarchical relationship.

[0062] To achieve the above purpose, the application provides a hierarchical BOM generation system based on drawing recognition, comprising the following modules:

[0063] A message monitoring module is used for continuously monitoring drawing messages, and after receiving the messages, message analysis is performed to obtain the URL address and related information of the drawing, and a drawing analysis process is triggered;

[0064] A drawing download module is used for automatically downloading batch drawing data according to the URL address in the drawing message;

[0065] A preprocessing module is used for converting the drawing into an image, correcting the direction of the image and enhancing the image, using image processing technology to cut the image according to the lines, cutting the entire image into multiple sub-block images, and obtaining the corresponding coordinates of the sub-block images, and the detail table part in the original drawing is cut into multiple cells;

[0066] An OCR recognition module is used for using a preset text detection model and a text recognition model to recognize the text content of the sub-block image, and obtaining the text content of all sub-block images;

[0067] A text post-processing module is used for restoring multiple text contents to a row according to the text content of all sub-block images through coordinate calculation, screening to obtain a candidate row of the detail table, and further obtaining the BOM table of a single drawing;

[0068] A hierarchical BOM generation module is used for generating a hierarchical BOM table of a product according to the BOM table of all single drawings, including analyzing the drawing file name, calculating the table structure similarity, performing a depth-first traversal of all BOM tables according to the associated field, and automatically generating a hierarchical BOM table.

[0069] The present application realizes automatic generation of hierarchical BOM table from batch drawings by pre-processing drawings, using OCR technology to identify the content of the detailed table in the drawing, designing a text post-processing algorithm to obtain the BOM information of a single drawing, and then using a hierarchical BOM generation module to obtain the hierarchical BOM table of batch drawings. The present application can realize the analysis of a single drawing to generate a corresponding BOM table, and can also analyze batch drawings of the same project to generate a hierarchical BOM table, thereby solving the problems of long time for manual input of BOM information and easy errors, improving production efficiency and reducing labor costs.

[0070] The above examples are illustrative of the present application and are not limiting of the present application. Any simple modifications of the present application are intended to fall within the scope of the present application.

Claims

1. A method for recognizing process drawings and generating hierarchical BOMs based on OCR technology, characterized by: Includes the following steps: S1. Use a message listener to continuously listen for messages. Upon receiving a message, parse the message to obtain the URL address and related information of the drawing, and trigger the drawing parsing process. S2. Automatically retrieve batch drawing data based on the URL address in the message; S3. Perform preprocessing operations on a single drawing, convert the drawing into an image, perform orientation correction and image enhancement on the image, use image processing technology to cut the image according to the lines, cut the entire image into multiple sub-block images, and obtain the corresponding coordinates of the sub-block images. The detail table part in the original drawing is cut into multiple cells. S4. Sub-block image OCR recognition: Using a preset text detection model and text recognition model, the text content of the sub-block images from the previous step is recognized to obtain the text content of all sub-block images; S5. Perform text post-processing on all sub-block images of a single drawing. Based on the text content of all sub-block images, calculate the coordinates to restore multiple text contents into rows, filter to obtain candidate rows for the detail table, and further obtain the BOM table of the single drawing. S6. Hierarchical BOM Generation: Based on the BOM tables of all individual drawings, generate a hierarchical BOM table for the product. This includes parsing the drawing file names, calculating the similarity of the table structure, and automatically generating the hierarchical BOM table by traversing all BOM tables in a depth-first manner based on the associated fields.

2. The method for recognizing process drawings and generating hierarchical BOMs based on OCR technology as described in claim 1, characterized in that: The drawing preprocessing operation includes the following steps: (1) Convert the obtained PDF drawings into PNG images and perform grayscale and binarization operations; (2) Perform orientation recognition on the image to determine whether the image needs to be rotated. Use image processing technology to identify lines in the image and pre-cut the image according to the lines to cut the image into multiple sub-block images. Calculate the effective sub-blocks for all sub-block images after cutting: filter according to the length and width of the sub-block images; from the effective sub-block images, count the length and width values ​​of the top K occurrences and their corresponding occurrences, and calculate the average length and width respectively; calculate the length and width values ​​according to the average values, compare them with the set threshold, and determine whether rotation correction is needed. (3) Use image processing technology to identify the lines and intersections of the image, and cut the image according to this information to obtain multiple sub-block images and the coordinates corresponding to each sub-block image. The detail table part in the original image is cut into multiple sub-blocks, and a sub-block is a cell in the original drawing.

3. The method for recognizing process drawings and generating hierarchical BOMs based on OCR technology as described in claim 1, characterized in that: The sub-block image OCR recognition includes the following steps: (1) Perform image magnification and image enhancement operations on each sub-block image; (2) Call the pre-set text detection model and text recognition model. The text detection model detects the text regions in the image, and the text recognition model recognizes the text in the detected text regions to obtain the text content of the corresponding sub-block image. The two pre-set models are pre-trained model files. The training steps are as follows: collect drawing data in this field, make training data and annotation data, and fine-tune the open-source text detection model and text recognition model respectively to obtain the fine-tuned pre-set text detection model and text recognition model.

4. The method for recognizing process drawings and generating hierarchical BOMs based on OCR technology as described in claim 1, characterized in that: The text post-processing includes the following steps: (1) Traverse all sub-block images and correct the coordinate errors of row and column coordinates respectively; (2) Arrange all sub-block images into rows according to coordinates, and select the sub-block images belonging to the details column table area as candidate rows; (3) Restore the table structure of all candidate row contents, restore the text content of all sub-block images to the table structure of the detail column in the original drawing, that is, the BOM table of a single drawing, which contains the component information of the drawing and the component details of the subordinate level.

5. The method for recognizing process drawings and generating hierarchical BOMs based on OCR technology as described in claim 1, characterized in that: The generation of the hierarchical BOM includes the following steps: (1) Obtain the associated fields of the drawings for the same batch of projects from the relevant information; (2) Parse the drawing file name and identify the drawing at different levels according to the file name level; (3) Design an algorithm to parse the file names of batch drawings and create a hierarchy-file name index; starting from the drawing with the highest level, traverse the BOM table row by row, perform a depth search based on the value of the associated field, and index the next level of drawing BOM table; if it exists, calculate the table structure similarity of the drawing BOM tables of adjacent levels, calculate the edit distance between the two table headers as the similarity value, if the similarity value is lower than the threshold, do not associate, otherwise continue the depth traversal; if it does not exist, return to the previous level, and finally generate a BOM table with hierarchical relationship.

6. A hierarchical BOM generation system based on drawing recognition, characterized in that: Includes the following modules: The message listening module is used to continuously listen for drawing messages. Upon receiving a message, it parses the message to obtain the drawing's URL address and related information, triggering the drawing parsing process. The drawing download module is used to automatically download and obtain batch drawing data based on the URL address in the drawing message; The preprocessing module is used to convert drawings into images, perform orientation correction and image enhancement on the images, and use image processing technology to cut the images according to the lines, cutting the entire image into multiple sub-block images, and obtaining the corresponding coordinates of the sub-block images. The detail table part in the original drawing is cut into multiple cells. The OCR recognition module is used to perform text content recognition on sub-block images using a preset text detection model and text recognition model, and obtain the text content of all sub-block images. The text post-processing module is used to restore multiple text contents into rows based on the text content of all sub-block images through coordinate calculation, filter out candidate rows for the detail table, and further obtain the BOM table for a single drawing. The hierarchical BOM generation module is used to generate a hierarchical BOM table for the product based on the BOM tables of all individual drawings. This includes parsing the drawing file names, calculating the similarity of the table structure, and traversing all BOM tables in a depth-first manner based on the associated fields to automatically generate the hierarchical BOM table.

Citation Information

Patent Citations

  • Engineering drawing BOM identification method and device, electronic equipment and storage medium

    CN114694159A

  • Enterprise feeding checking method based on OCR image-text automatic identification

    CN115456536A