Table information extraction method, device and equipment for single-line diagram document in PDF format and medium
By combining semantic sequence analysis and optical character recognition technology with template matching and language models, the problem of efficiency and accuracy in extracting table data from PDF pipeline single-line diagram documents was solved, achieving efficient and accurate extraction and standardized processing of table information.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- AIDE INTELLIGENT TECHNOLOGY (QINGDAO) CO LTD
- Filing Date
- 2026-03-25
- Publication Date
- 2026-06-05
AI Technical Summary
Existing technologies face challenges in extracting tabular data from single-line pipe diagrams in PDF format, including high human and time costs, difficulty in ensuring data accuracy and timeliness, and especially difficulties in recognition and high misidentification rates due to differences in layout among different design institutes.
Using a template matching algorithm based on semantic sequence analysis and optical character recognition technology, combined with a language model for the pipeline domain, the text content of pipeline material lists, design parameter lists, and project lists is identified and integrated through template library matching and region of interest segmentation, and then standardized to generate structured Excel spreadsheets.
It enables efficient and accurate extraction of tabular information from PDF format pipeline single-line diagram documents with different layouts, reduces human resource consumption, improves the efficiency and accuracy of data extraction, and solves the data standardization problem.
Smart Images

Figure CN122157274A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of pipeline engineering, and in particular to a method, apparatus, equipment, and medium for extracting tabular information from PDF format pipeline single-line diagram documents. Background Technology
[0002] In the fields of petroleum, chemical, and power engineering design and construction, single-line pipeline diagrams are core technical documents guiding project construction and operation, containing a wealth of key design parameters and material information. Currently, the industry primarily relies on manual visual inspection and reading of drawings to manually input data into databases or systems when extracting tabular data from single-line pipeline diagrams in PDF (Portable Document Format) format. This traditional method not only consumes significant human and time resources but is also highly susceptible to fatigue-related errors, making it difficult to guarantee the accuracy and timeliness of the data. With the increasing scale of engineering projects, processing massive amounts of drawing data has become a bottleneck restricting project progress.
[0003] While AI (Artificial Intelligence) has made some progress in general drawing recognition, table recognition and information extraction for single-line piping diagrams in PDF format still face many complex technical challenges. Although single-line piping diagrams mainly consist of three parts: a material list, a design parameter list, and a project list, the differences in drafting standards among different design institutes result in highly non-standardized tables. This means that the layout of single-line piping diagrams varies significantly between different design institutes, greatly increasing the difficulty of recognition. Taking the material list as an example, its location, field descriptions, and quantity in the drawings differ, and its style is complex, including bordered tables and borderless tables distinguished only by alignment. Furthermore, inconsistent row spacing makes traditional OCR (Optical Character Recognition) prone to line-by-line errors when the spacing is small, and prone to splitting the same semantic error into multiple rows when the spacing is large. At the same time, redundant category descriptions in the table header are often misidentified as columns, and redundant non-critical fields mixed in the table are difficult to accurately remove. The design parameter table and project table also face the challenge of variable layout, such as inconsistent header positions and random merged cell positions, making it difficult to determine column relationships. Furthermore, different design institutes often use various expressions to refer to the same field in the header descriptions, resulting in significant semantic differences and making it difficult to meet the need for accurate table extraction. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide a method, apparatus, device, and medium for extracting table information from PDF format pipe single-line diagram documents. This method avoids consuming significant human and time resources, solves the data standardization problem and processing obstacles caused by diverse layouts, and enables the extraction of table information from PDF format pipe single-line diagram documents with different layouts. It also improves the efficiency and accuracy of table information extraction. The specific solution is as follows: Firstly, this application provides a method for extracting tabular information from a PDF format pipeline single-line diagram document, including: Obtain a PDF document of a single-line pipe diagram with any layout, and convert the single-line pipe diagram document into a target single-line pipe diagram in image format; wherein, the single-line pipe diagram includes several components, and the components include a pipe material table, a pipe design parameter table, and a pipe project table; Based on the template matching algorithm of semantic sequence analysis, a target template pipeline single-line diagram corresponding to the target pipeline single-line diagram is matched from a preset template library. Based on the layout of the target template pipeline single-line diagram, several component images corresponding to regions of interest are cut out from the target pipeline single-line diagram. The preset template library stores several template pipeline single-line diagrams with different layouts. The image of the first region of interest corresponding to the pipe material list is preprocessed, and table recognition is performed on the processed region of interest image to output structured material list data based on the text content and position information of each cell; the preprocessing includes irrelevant content removal and auxiliary line drawing; Optical character recognition technology is used to identify text blocks from the second region of interest image corresponding to the pipeline design parameter table / pipeline project table. Based on the semantic entities, semantic categories and location information of each text block, the attribution relationship and entity mapping relationship between the semantic entities of each text block are determined, so as to integrate the semantic entities of each text block to obtain structured design table data / project table data. Using a pipeline domain language model and based on a dynamic prompting mechanism, the non-standardized headers in the material list data, the design list data, and the project list data are standardized and then converted into Excel spreadsheet files.
[0005] Optionally, before converting the single-line pipe diagram document into a target single-line pipe diagram in image format, the method further includes: By analyzing the position and size of the embedded images in the single-line diagram document, watermarked images are filtered from the embedded images and then erased from the single-line diagram document. And / or, check the field type corresponding to the interactive control in the single-line diagram document of the pipeline, and remove the interactive control of the signature field type in the single-line diagram document of the pipeline; And / or, scan the annotation list in the single-line pipe diagram document, and delete the annotation objects of the signature type in the annotation list in the single-line pipe diagram document.
[0006] Optionally, converting the single-line pipe diagram document into a target single-line pipe diagram in image format includes: Obtain the baseline dots per inch from the single-line diagram document of the pipeline; A scaling factor is determined based on the baseline dots per inch and the target dots per inch, and a linear transformation matrix is constructed based on the scaling factor; The linear transformation matrix is used to convert the pipeline single-line diagram document into a target pipeline single-line diagram in image format; Wherein, the number of dots per inch in the target pipeline single-line diagram is the target number of dots per inch, and the image channels of the target pipeline single-line diagram correspond to the image format.
[0007] Optionally, the template matching algorithm based on semantic sequence analysis matches a target template pipeline single-line diagram corresponding to the target pipeline single-line diagram from a preset template library, and based on the layout of the target template pipeline single-line diagram, cuts out several component region images corresponding to each component from the target pipeline single-line diagram, including: Semantic similarity is calculated between the target pipeline single-line diagram and each template pipeline single-line diagram in the preset template library, and based on the similarity, it is matched from the preset template library to see if there is a target template pipeline single-line diagram that meets the preset similarity conditions. If not, the user's region selection instructions for several components in the target pipeline single-line diagram are obtained through a preset interactive interface, and the target regions of interest corresponding to the several components in the target pipeline single-line diagram are determined based on the region selection instructions. If it exists, then based on the regions of interest corresponding to the components in the single-line diagram of the target pipeline, determine the target regions of interest corresponding to the components in the single-line diagram of the target pipeline; After determining the target regions of interest (ROIs) corresponding to several components in the single-line diagram of the target pipeline, the ROI images corresponding to several components are cut out from the single-line diagram of the target pipeline based on the ROIs.
[0008] Optionally, the preprocessing of the first region of interest image corresponding to the pipe material table, and the table recognition of the processed region of interest image to output structured material table data based on the text content and location information of each cell, includes: Text information is identified from the first region of interest image corresponding to the pipe material list using optical character recognition technology; The text information is matched with a first preset keyword to determine irrelevant information from the text information, and the irrelevant information is covered in the first region of interest image to obtain a covered region of interest image; The remaining information is matched with the second preset keyword to determine invalid information from the remaining information, and the region corresponding to the invalid information in the covered region of interest image is cropped to obtain a cropped region of interest image; the remaining information is the information in the text information other than the irrelevant information; Optical character recognition technology is used to identify target serial numbers that meet preset serial number conditions from the cropped region of interest image, and auxiliary lines are drawn in the cropped region of interest image based on the position of the target serial number to obtain the processed region of interest image; Based on the auxiliary lines in the processed region of interest image, table recognition is performed on the processed region of interest image to extract the text content and location information of each cell, and named entity recognition technology is used to identify key entities in the text content of each cell, so as to output structured material table data based on the text content, key entities and location information of each cell.
[0009] Optionally, the step of determining the attribution and entity mapping relationships between the semantic entities of each text block based on the semantic entities, semantic categories, and location information of each text block, in order to integrate the semantic entities of each file block to obtain structured design table data / project table data, includes: The semantic entity recognition model is used to perform semantic entity recognition on each of the text blocks, and the semantic entities of each of the text blocks are semantically classified to determine the semantic category corresponding to the semantic entities of each text block. The semantic entities, semantic categories, and location information of each text block are input into the relation extraction model to determine the table layout structure of the pipeline design parameter table / pipeline project table based on the location information of each text block. Using the table layout structure and based on the semantic entities and semantic categories of each text block, the row and column belonging relationships and entity mapping relationships between the semantic entities of each text block are determined. Based on the row and column attribution relationships and the entity mapping relationships, the semantic entities of each text block are integrated according to the table layout structure to obtain structured design table data / project table data.
[0010] Optionally, the step of standardizing the non-standardized headers in the material list data, design list data, and project list data using a pipeline domain language model and based on a dynamic prompting mechanism, and then converting them into an Excel spreadsheet file after standardization, includes: The non-standardized headers in the material list data, design list data, and project list data are converted into standardized headers using a pipeline domain language model. The pipeline domain language model is a model trained based on a pre-established mapping relationship between non-standardized and standardized headers in the pipeline domain. Based on the material list data, the design list data, and the project list data, prompt words are dynamically generated, and the material list data, the design list data, and the project list data are converted into JSON format using the prompt words; The material list data, design list data, and project list data, which belong to the same PDF page and are in JSON format, are integrated, and the integrated table data is converted into an Excel spreadsheet file.
[0011] Secondly, this application provides a device for extracting tabular information from a PDF format pipeline single-line diagram document, comprising: The image conversion module is used to acquire a single-line pipe diagram document in PDF format with any layout, and convert the single-line pipe diagram document into a target single-line pipe diagram in image format; wherein, the single-line pipe diagram includes several components, and the several components include a pipe material table, a pipe design parameter table, and a pipe project table; The image segmentation module is used to match a target template pipeline single-line diagram corresponding to the target pipeline single-line diagram from a preset template library based on a template matching algorithm of semantic sequence analysis, and to segment out several component region images from the target pipeline single-line diagram based on the layout of the target pipeline single-line diagram; the preset template library stores several template pipeline single-line diagrams with different layouts; The first table information extraction module is used to preprocess the image of the first region of interest corresponding to the pipe material table, and to perform table recognition on the processed region of interest image to output structured material table data based on the text content and position information of each cell; the preprocessing includes removing irrelevant content and drawing auxiliary lines; The second table information extraction module is used to identify text blocks from the second region of interest image corresponding to the pipeline design parameter table / pipeline project table using optical character recognition technology, and to determine the attribution relationship and entity mapping relationship between the semantic entities of each text block based on the semantic entity, semantic category and location information of each text block, so as to integrate the semantic entities of each text block to obtain structured design table data / project table data. The table file conversion module is used to standardize the non-standardized table headers in the material table data, the design table data, and the project table data by using a pipeline domain language model and based on a dynamic prompting word mechanism, and then convert them into Excel table files after standardization.
[0012] Thirdly, this application provides an electronic device, comprising: Memory, used to store computer programs; A processor is used to execute the computer program to implement the aforementioned method for extracting tabular information from a PDF format pipeline single-line diagram document.
[0013] Fourthly, this application provides a computer-readable storage medium for storing a computer program, which, when executed by a processor, implements the aforementioned method for extracting table information from a PDF format pipeline single-line diagram document.
[0014] In this application, a single-line pipe diagram document in PDF format with arbitrary layout is obtained, and the single-line pipe diagram document is converted into a target single-line pipe diagram in image format. The single-line pipe diagram includes several components, including a pipe material table, a pipe design parameter table, and a pipe project table. Based on a template matching algorithm using semantic sequence analysis, a target template single-line pipe diagram corresponding to the target single-line pipe diagram is matched from a preset template library. Based on the layout of the target template single-line pipe diagram, regions of interest (ROI) images corresponding to several components are cut out from the target single-line pipe diagram. The preset template library stores several template single-line pipe diagrams with different layouts. The first ROI image corresponding to the pipe material table is preprocessed, and the processed ROI image is then processed. Table recognition is performed to output structured material list data based on the text content and location information of each cell; the preprocessing includes irrelevant content removal and auxiliary line drawing; text blocks are identified from the second region of interest image corresponding to the pipeline design parameter table / pipeline project table using optical character recognition technology, and the attribution relationship and entity mapping relationship between the semantic entities of each text block are determined based on the semantic entities, semantic categories and location information of each text block, so as to integrate the semantic entities of each text block to obtain structured design table data / project table data; non-standardized table headers in the material list data, design table data and project table data are standardized using a pipeline domain language model and based on a dynamic prompting word mechanism, and then converted into an Excel spreadsheet file after standardization.
[0015] Therefore, this application can convert PDF-format pipe single-line diagram documents with arbitrary layouts into target pipe single-line diagrams in image format. Then, based on a template matching algorithm using semantic sequence analysis, it can extract regions of interest (ROI) images corresponding to the pipe material table, pipe design parameter table, and pipe project table from the target pipe single-line diagram. Since the pipe material table, pipe design parameter table, and pipe project table differ in their table drawing, a differentiated table recognition method is used to extract table information, thereby improving the accuracy of table information extraction. For the pipe material table, irrelevant content is first removed and auxiliary lines are drawn on the corresponding ROI image before table recognition is performed to extract structured material table data. Irrelevant content removal avoids the extraction of irrelevant content or misidentification of irrelevant content that could lead to errors in table information extraction. Auxiliary line drawing avoids issues such as serial recognition when line spacing is small and splitting of the same semantic error into multiple lines when line spacing is large. For pipeline design parameter tables and pipeline project tables, text blocks are identified from the corresponding regions of interest (ROI) images. Based on the semantic entities, semantic categories, and location information of each text block, the row and column relationships and entity mapping relationships between the semantic entities of each file block are determined. This allows for the integration of the semantic entities of each file block to obtain structured design table data / project table data. Through semantic recognition and relationship extraction, the complex situations of inconsistent header positions and merged cells in pipeline design parameter tables and pipeline project tables are effectively addressed. Furthermore, by standardizing the non-standardized headers in the table data, the problem of significant semantic differences in header descriptions is effectively solved, meeting the need for accurate extraction of table information. In this way, this application can extract table information from PDF format pipeline single-line diagram documents with different layouts. This not only has a high degree of automation, avoiding the consumption of large amounts of human resources and time costs and improving the efficiency of table information extraction, but also solves the data standardization problem and processing obstacles caused by diverse layouts, improving the accuracy and quality stability of table information extraction. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0017] Figure 1 A flowchart illustrating a method for extracting tabular information from a PDF format single-line pipe diagram document, provided in this application embodiment; Figure 2A flowchart of a region of interest image segmentation provided in this application embodiment; Figure 3 A flowchart for extracting material list data is provided for an embodiment of this application; Figure 4 A flowchart for extracting design table data / project table data is provided for embodiments of this application; Figure 5 A schematic diagram of a device for extracting tabular information from a PDF format pipeline single-line diagram document, provided in an embodiment of this application; Figure 6 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0018] The technical solutions of the embodiments 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, and 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.
[0019] Currently, extracting tabular data from PDF-format pipe single-line diagrams in the industry mainly relies on manual visual identification and reading of the drawings, followed by manual input into databases or systems. This not only consumes significant human resources and time but is also highly susceptible to fatigue-related errors, making it difficult to guarantee the accuracy and timeliness of the data. Although AI-powered drawing recognition has made some progress in general fields, table recognition and information extraction from PDF-format pipe single-line diagrams still face many complex technical challenges.
[0020] In response, this application provides a method for extracting table information from PDF format pipe single-line diagram documents. This method avoids consuming a large amount of human resources and time, solves the data standardization problem and processing obstacles caused by the diversification of page layouts, and enables the extraction of table information from PDF format pipe single-line diagram documents with different page layouts. At the same time, it can improve the efficiency and accuracy of table information extraction.
[0021] See Figure 1 As shown in the figure, this invention discloses a method for extracting table information from a PDF format pipeline single-line diagram document, including: Step S11: Obtain a single-line pipe diagram document in PDF format with any layout, and convert the single-line pipe diagram document into a target single-line pipe diagram in image format; wherein, the single-line pipe diagram includes several components, and the several components include a pipe material table, a pipe design parameter table, and a pipe project table.
[0022] Since different design institutes may have different layouts for PDF-format pipe single-line diagram documents, this application has designed a method for extracting table information from PDF-format pipe single-line diagram documents with different layouts. This method can be used for PDF-format pipe single-line diagram documents with any layout to achieve efficient and accurate extraction of table information.
[0023] Specifically, this application first obtains a single-line pipe diagram document in PDF format with arbitrary layout, and converts it into a target single-line pipe diagram in image format. Each page of the PDF single-line pipe diagram document is a single-line pipe diagram text, and this application needs to perform table recognition and information extraction on each page of PDF.
[0024] It should be noted that a single-line piping diagram comprises several components, including a piping material list, a piping design parameter list, and a piping item list, as well as the piping layout itself. The piping material list records the materials required for the piping; the piping design parameter list records design parameters such as design pressure and design temperature; and the piping item list records the correspondence between the piping layout and the piping items.
[0025] Before converting a PDF pipeline diagram document into an image format target pipeline diagram, this application designs a dedicated tool for low-level PDF document parsing to remove watermark images and digital signatures from the PDF pipeline diagram document. This tool can accurately identify the object organization structure of the PDF document to automatically detect and remove annotation-type digital signatures, signature controls, and static watermark images embedded as images. Furthermore, the tool supports both single PDF document processing and batch processing modes. When processing large-scale document collections, it can preserve the original directory structure and provides a breakpoint resume mechanism to ensure the reliability of long-term processing.
[0026] For watermarked images, this application analyzes the position and size of the embedded images in a PDF-format pipe single-line diagram document to filter watermarked images from the embedded images and then erases the watermarked images in the PDF-format pipe single-line diagram document.
[0027] Specifically, the watermark image processing employs an image feature-based recognition strategy. By analyzing the position and size features of embedded images in the PDF-format pipe diagram document, watermark images are filtered from the embedded images. A watermark feature library is established by calculating the hash feature value of each watermark image to avoid repeatedly processing the same watermark images. For the identified watermark images, a dedicated tool processes the PDF-format pipe diagram document through a low-level erasure mechanism. This mechanism can completely remove the watermark image from the underlying data, leaving only blank areas and maintaining the visual integrity of the document.
[0028] For signature controls, this application checks the field type corresponding to the interactive control in the PDF format pipeline single-line diagram document, and removes the interactive control of the signature field type in the PDF format pipeline single-line diagram document.
[0029] Specifically, the specialized tool iterates through all interactive controls in the PDF-format pipe single-line diagram document and determines the field type corresponding to the interactive control to accurately identify interactive controls with signature field types, and then removes interactive controls with signature field types from the PDF-format pipe single-line diagram document.
[0030] For annotation-type digital signatures, this application scans the annotation list in a PDF-format pipe single-line diagram document and deletes the annotation objects belonging to the signature type from the annotation list in the PDF-format pipe single-line diagram document.
[0031] Specifically, the specialized tool scans the annotation list on each page of the single-line pipe diagram document in PDF format, filters out annotation objects that belong to the signature type from the annotation list, and then deletes the annotation objects that belong to the signature type from the annotation list in the single-line pipe diagram document in PDF format.
[0032] This application embodiment removes interactive controls of the signature field type from the pipeline single-line diagram document in PDF format and deletes annotation objects of the signature type from the annotation list, thereby ensuring coverage of various digital signature forms that may exist in the PDF document through collaborative work.
[0033] Subsequently, this embodiment of the application requires converting the PDF format pipe single-line diagram document into a target pipe single-line diagram in image format. The specific conversion process includes: obtaining the baseline dots per inch (DPI) of the PDF format pipe single-line diagram document; determining the scaling factor based on the baseline DPI and the target DPI, and constructing a linear transformation matrix based on the scaling factor; and using the linear transformation matrix to convert the PDF format pipe single-line diagram document into a target pipe single-line diagram in image format. The DPI of the target pipe single-line diagram is the target DPI, and the image channels of the target pipe single-line diagram correspond to the image format.
[0034] Understandably, this application employs a resolution control method based on matrix transformation. First, it obtains the baseline dots per inch (DPI) of the PDF-format pipe single-line diagram document. Then, it calculates the ratio of the baseline DPI to the target DPI as a scaling factor and constructs a linear transformation matrix based on this factor. Finally, it applies the linear transformation matrix to each page of the PDF-format pipe single-line diagram document, converting it into an image-format target pipe single-line diagram. This ensures that the DPI of the target pipe single-line diagram matches the target DPI, achieving precise size control. This method guarantees the pixel accuracy of the converted image, avoids image quality loss caused by post-processing scaling, and ensures that lines and text in detailed documents such as engineering drawings remain clearly legible.
[0035] Furthermore, this application implements intelligent adaptive format adaptation processing based on the characteristics of different image formats. For PNG (Portable Network Graphics) and TIFF (Tag Image File Format) formats that support transparency channels, the target pipeline single-line graph's image channels retain the original RGBA (Red, Green, Blue, Alpha) four channels, ensuring no loss of transparency information. For JPEG (Joint Photographic Experts Group) format that does not support transparency, automatic RGB three-channel conversion is performed, making the target pipeline single-line graph's image channels RGB three channels, ensuring accurate preservation of color information. Each image format uses optimized encoding parameters to achieve efficient file compression while ensuring visual quality.
[0036] Step S12: According to the template matching algorithm of semantic sequence analysis, a target template pipeline single-line diagram corresponding to the target pipeline single-line diagram is matched from the preset template library. Based on the layout of the target template pipeline single-line diagram, several component images corresponding to the regions of interest are cut out from the target pipeline single-line diagram. The preset template library stores several template pipeline single-line diagrams with different layouts.
[0037] In this embodiment of the application, after converting the PDF format pipeline single-line diagram document into an image format target pipeline single-line diagram, it is necessary to cut out the regions of interest images corresponding to the pipeline material table, pipeline design parameter table, and pipeline project table from the target pipeline single-line diagram.
[0038] Specifically, such as Figure 2 As shown, this application calculates the semantic similarity between the target pipeline single-line diagram and each template pipeline single-line diagram in the preset template library, and matches the preset template library to see if a target template pipeline single-line diagram that meets the preset similarity condition exists. If it does not exist, the application obtains the user's region selection instructions for several components in the target pipeline single-line diagram through a preset interactive interface, and determines the target regions of interest (ROIs) corresponding to the several components in the target pipeline single-line diagram based on the region selection instructions. If they exist, the application determines the target regions of interest corresponding to the several components in the target pipeline single-line diagram based on the regions of interest corresponding to the several components in the target template pipeline single-line diagram. After determining the target regions of interest corresponding to the several components in the target pipeline single-line diagram, the application cuts out the images of the regions of interest corresponding to the several components from the target pipeline single-line diagram based on the target regions of interest.
[0039] Understandably, this application employs template matching technology to construct a multi-dimensional feature fingerprint by extracting the text layout features and key field sequences of the target pipeline single-line diagram and the template pipeline single-line diagram. In turn, the semantic similarity between the target pipeline single-line diagram and the template pipeline single-line diagram is calculated by comparing the text layout features and key field sequences of the target pipeline single-line diagram and the template pipeline single-line diagram.
[0040] Furthermore, the preset similarity conditions include the target template pipeline single-line diagram having the highest similarity among all similarities, and exceeding a preset similarity threshold. Accordingly, this application introduces an adaptive condition judgment mechanism and an interactive selection process, specifically including: when a target template pipeline single-line diagram that meets the preset similarity conditions exists in the preset template library, the system directly reuses the regions of interest corresponding to several components in the target template pipeline single-line diagram; that is, based on the regions of interest corresponding to several components in the target template pipeline single-line diagram, the system determines the target regions of interest corresponding to several components in the target pipeline single-line diagram. When no target template pipeline single-line diagram that meets the preset similarity conditions exists in the preset template library, the system automatically switches to interactive mode. This allows the system to obtain the user's region selection instructions for several components in the target pipeline single-line diagram through a preset interactive interface. Based on the region selection instructions, the system determines the target regions of interest (ROIs) corresponding to each component in the target pipeline single-line diagram. This enables users to manually select the ROIs corresponding to the table and updates the target pipeline single-line diagram with the manually selected ROIs to the preset template library. This continuously enriches the preset template library, optimizes the generalization ability of template matching, and ensures the accuracy of ROI determination for complex non-standard pipeline single-line diagrams.
[0041] It should be noted that the incremental template library mechanism is the core technical solution designed by this invention to address the issue of diverse layouts for single-line pipeline diagrams. The mechanism's workflow is as follows: For new drawings, the drawing is first identified by region, and key information features are extracted. Then, the extracted features are semantically matched with existing templates in the template library. If the match is successful (similarity exceeds a preset threshold), the region coordinate information of the matched template is directly reused. If the match fails, the operator manually selects the regions of interest from the material list, design parameter list, and project list through the interactive interface. The system then stores the coordinates of the three selected regions as new templates in the template library. Currently, the incremental template library has accumulated layout templates from over 30 design institutes, effectively supporting the rapid processing of batch drawings.
[0042] In this way, this application can quickly identify template pipe single-line diagrams that match the target pipe single-line diagram through template matching, avoiding redundant calculations of manual selection or table area detection for each pipe single-line diagram, realizing one-time configuration for batch processing of pipe single-line diagrams, and supporting batch reuse of preset template library.
[0043] After identifying the regions of interest (ROIs) corresponding to several components in the target pipeline single-line diagram, this application converts the normalized coordinates of the ROIs to pixel coordinates and implements a multi-layered boundary protection mechanism during the coordinate transformation process. Then, using the pixel coordinates, it cuts out the ROI images corresponding to the components from the target pipeline single-line diagram; that is, it cuts out the ROI images corresponding to the pipeline material list, pipeline design parameter list, and pipeline project list, respectively. Additionally, this application can also cut out the ROI image corresponding to the pipeline diagram from the target pipeline single-line diagram. Subsequently, this application numbers the ROI images corresponding to the pipeline diagram, pipeline material list, pipeline design parameter list, and pipeline project list in the order of pipeline diagram, pipeline material list, pipeline design parameter list, and pipeline project list, and saves them to their respective independent folders.
[0044] In addition, this application also provides a labeled image generation function, which can automatically draw the bounding boxes of all cutting areas on the target pipeline single-line diagram, and use category labels (such as pipeline diagram, pipeline material table, pipeline design parameter table and pipeline project table) to label the drawn bounding boxes to generate labeled images, and save the labeled images as independent PNG files, providing users with an intuitive reference for the cutting effect, and facilitating the verification of the accuracy and completeness of the template configuration.
[0045] Step S13: Preprocess the image of the first region of interest corresponding to the pipe material table, and perform table recognition on the processed region of interest image to output structured material table data based on the text content and position information of each cell; the preprocessing includes removing irrelevant content and drawing auxiliary lines.
[0046] In this embodiment of the application, for the first region of interest image corresponding to the pipeline material table, the first region of interest image is first preprocessed, including the removal of irrelevant content and the drawing of auxiliary lines, to obtain a processed region of interest image. Then, the drawn auxiliary lines are used to extract table information from the processed region of interest image to extract the text content and position information of each cell. Finally, based on the text content and position information of each cell, structured material table data is output.
[0047] Specifically, such as Figure 3As shown, this application utilizes optical character recognition (OCR) technology to identify text information from a first region of interest (ROI) image corresponding to a pipe material list; matches the text information with a first preset keyword to identify irrelevant information from the text information, and covers the irrelevant information in the first ROI image to obtain a covered ROI image; matches the remaining information with a second preset keyword to identify invalid information from the remaining information, and crops the region corresponding to the invalid information in the covered ROI image to obtain a cropped ROI image; the remaining information is the information in the text information excluding irrelevant information; uses OCR technology to identify target serial numbers that meet preset serial number conditions from the cropped ROI image, and draws auxiliary lines in the cropped ROI image based on the position of the target serial numbers to obtain a processed ROI image; based on the auxiliary lines in the processed ROI image, performs table recognition on the processed ROI image to extract the text content and position information of each cell, and utilizes named entity recognition (NAME). The Recognition by Recognition (NER) technology identifies key entities in the text content of each cell, and outputs structured bill of materials data based on the text content, key entities and location information of each cell.
[0048] In other words, this application uses an OCR engine to perform high-precision text recognition on the region of interest (ROI) image corresponding to the pipe material table, sequentially executing three core steps: irrelevant information coverage, invalid region cropping, and auxiliary line drawing. The specific process is as follows: First, irrelevant information, such as irrelevant title text, is identified from the text information recognized by OCR through fuzzy matching with a first preset keyword. Then, this irrelevant information is covered in the ROI image. Next, the remaining information in the text information, excluding irrelevant information, is identified through fuzzy matching with a second preset keyword. Invalid information is then identified from the remaining information, and the image is vertically cropped based on the position of the invalid information, according to an offset, to remove invalid regions. Finally, the ROI image is re-OCR-recognized to identify valid serial numbers through three conditions: pure number verification, reasonable range judgment, and leftmost position verification. Black auxiliary lines are drawn based on the positions of the valid serial numbers, using these three conditions to avoid misidentifying data columns in the table as serial numbers. It should be noted that each step is optimized based on the output of the previous step, and an incremental progressive image modification strategy is used during processing to avoid performance loss caused by multiple full-image copies.
[0049] Among these, "pure number verification" refers to performing pure number verification on the text recognized by OCR, retaining only the pure number text. "Reasonable range judgment" refers to judging the pure number text within a preset reasonable range to filter target number text that meets the preset reasonable range. For example, the preset reasonable range can be 1~100, 1~200, etc., and can be configured according to actual needs. "Leftmost position verification" refers to verifying the position of the target number text in the region of interest image at the leftmost position, since table numbers are generally located at the leftmost edge of the table.
[0050] It should be noted that the drawing of auxiliary lines is one of the core technical features of this invention, used to solve the problem of recognizing borderless tables in the material table of a single-line pipeline diagram. The specific implementation process is as follows: First, using OCR technology, target serial numbers that meet preset serial number conditions are identified from the cropped region of interest image. Valid serial numbers are filtered through a triple-condition process of pure number verification, reasonable range judgment, and leftmost position verification. Then, black auxiliary lines are drawn starting 2 pixels above each valid serial number position to form horizontal dividing lines. Finally, based on the drawn auxiliary lines, table recognition is performed on the image, transforming the borderless table into a bordered table structure, thereby improving the accuracy of subsequent table recognition.
[0051] It should also be noted that, during the matching process of the first and second preset keywords, to address potential text recognition errors or distortions in engineering drawings, as well as common issues in OCR recognition such as character misrecognition and spacing variations, this application employs a configurable matching threshold. A successful match is determined when the matching degree with the keyword is higher than the threshold, meaning irrelevant or invalid information has been matched. A failed match is determined when the matching degree is lower than or equal to the threshold, meaning no irrelevant or invalid information has been matched. This ensures keyword matching accuracy while providing appropriate error tolerance. Furthermore, users can adjust the matching threshold according to the actual drawing quality to balance matching precision and recall.
[0052] Furthermore, this application achieves high-precision table recognition through named entity recognition technology, and customized table recognition guidance instructions drive the model's operation. The model can accurately understand the table structure in the region of interest image based on drawn auxiliary lines, automatically identify the row and column separators of the table, and accurately extract the text content of each cell and its positional relationship in the table based on the row and column separators; at the same time, it uses named entity recognition technology to perform key entity recognition on the text content of each cell to accurately locate the core information in the pipeline material table, and then, based on the text content, key entities, and positional relationships of each cell, it finally outputs structured material table data that conforms to the syntax specification of Markdown (a lightweight markup language).
[0053] It's worth noting that an intelligent image resizing preprocessing mechanism is implemented for image inputs from different sources and at different resolutions. When any side of the image is detected to exceed 2048 pixels, a proportional scaling operation is automatically performed, adjusting the longest side to 2048 pixels while maintaining the image's aspect ratio. This preprocessing strategy reduces the computational burden on the model, avoids memory overflow issues caused by excessively large images, and ensures that table details remain clearly discernible.
[0054] Step S14: Using optical character recognition technology, identify text blocks from the second region of interest image corresponding to the pipeline design parameter table / pipeline project table, and based on the semantic entities, semantic categories and location information of each text block, determine the attribution relationship and entity mapping relationship between the semantic entities of each text block, so as to integrate the semantic entities of each text block to obtain structured design table data / project table data.
[0055] In this embodiment of the application, for the second region of interest images corresponding to the pipeline design parameter table and the pipeline project table, optical character recognition technology is first used to identify text blocks from the second region of interest image. Based on the semantic entities, semantic categories and location information of each text block, the row and column attribution relationships and entity mapping relationships between the semantic entities of each file block are determined. Using the row and column attribution relationships and entity mapping relationships, the semantic entities of each file block are integrated to obtain structured design table data and project table data.
[0056] Specifically, such as Figure 4 As shown, after identifying text blocks from the second region of interest image corresponding to the pipeline design parameter table / pipeline project table using optical character recognition technology, this application uses a semantic entity recognition (SER) model to perform semantic entity recognition on each text block separately, and performs semantic classification on the semantic entities of each identified text block to determine the semantic category corresponding to the semantic entities of each text block; inputs the semantic entities, semantic categories, and location information of each text block into a relation extraction (RE) model to determine the table layout structure of the pipeline design parameter table / pipeline project table based on the location information of each text block, uses the table layout structure and based on the semantic entities and semantic categories of each text block to determine the row and column attribution relationships and entity mapping relationships between the semantic entities of each text block; based on the row and column attribution relationships and entity mapping relationships, the semantic entities of each text block are integrated according to the table layout structure to obtain structured design table data / project table data.
[0057] Given that general pre-trained models are difficult to directly adapt to complex pipeline engineering drawing scenarios, this invention adopts a customized approach to construct and train semantic entity recognition models and relation extraction models.
[0058] For the semantic entity recognition model, this application collects a large amount of historical text data of pipeline single-line graphs and annotates the historical text data with semantic entities and semantic categories to construct a dedicated semantic label set. The semantic label set is then used to train the semantic entity recognition model in a targeted manner, enabling it to accurately recognize semantic entities and classify semantics in text blocks, thereby clarifying the semantic entities and semantic categories of each text block.
[0059] For the relation extraction model, this application further constructs training samples containing the location information of text blocks (e.g., the two-dimensional coordinates, row and column positions, and spacing information of text blocks in the region of interest image) and semantic features (e.g., the semantic entities and semantic categories of text blocks) to supervise the learning training of the relation extraction model. This allows the relation extraction model to use layout structure reproduction technology and the two-dimensional coordinate information of each text block to identify the physical area distribution of the pipeline design parameter table and pipeline project table. By analyzing the row and column positions and spacing information of the text blocks, the model divides the functional areas of the pipeline design parameter table and pipeline project table into header areas and data areas. At the same time, it determines the boundary range of the table cells and the row and column hierarchy relationship, thereby constructing the table layout structure of the pipeline design parameter table and pipeline project table. This enables the relation extraction model to deeply analyze the table layout logic and accurately extract the row and column belonging relationships and entity mapping relationships between the semantic entities of each text block using the table layout structure and based on the semantic entities and semantic categories of each text block.
[0060] It should be noted that the semantic entity recognition model and relation extraction model are trained based on the LayoutLMv3-base-chinese framework. LayoutLMv3 is a pre-trained model for document understanding that can simultaneously process text, layout, and image information, making it very suitable for table recognition tasks in pipeline single-line diagrams. This application collected approximately 1000 data points from over 30 design institutes for model fine-tuning, with training data covering common field types in pipeline single-line diagrams. After targeted training, the model can accurately identify semantic entities and semantic categories in text blocks and correctly extract row and column relationships and entity mapping relationships between semantic entities, achieving a recognition accuracy of over 95%.
[0061] Finally, based on a well-trained entity mapping network, this application integrates the semantic entities of each text block according to the table layout structure, based on the row and column relationships and entity mapping relationships between the semantic entities of each text block, to obtain structured table data and item table data that conform to Markdown syntax specifications.
[0062] Step S15: Using the pipeline domain language model and based on the dynamic prompt word mechanism, standardize the non-standardized headers in the material list data, the design list data, and the project list data, and convert them into Excel spreadsheet files after standardization.
[0063] In this embodiment, after obtaining structured material list data, design list data, and project list data, the non-standardized headers in these data are converted into standardized headers using a pipeline domain language model. The pipeline domain language model is trained based on a pre-established mapping relationship between non-standardized and standardized headers in the pipeline domain. Prompt words are dynamically generated based on the material list data, design list data, and project list data, and these prompt words are used to convert the material list data, design list data, and project list data into JSON (JavaScript Object Notation) format. The JSON-formatted material list data, design list data, and project list data belonging to the same PDF page are integrated, and the integrated table data is converted into an Excel spreadsheet file.
[0064] For the pipeline domain language model, this application constructs a dedicated corpus containing rich semantic differences by collecting data from pipeline material tables, pipeline design parameter tables, and pipeline project tables covering multiple historical projects of design institutes, and establishes a mapping relationship from non-standardized table headers to standardized table headers. This mapping relationship is then used to perform targeted pre-training and fine-tuning of a selected open-source lightweight language model, enabling it to deeply learn the professional terminology, abbreviation habits, and implicit semantic logic of the pipeline engineering field, thereby obtaining a well-trained pipeline domain language model. Through this process, the pipeline domain language model can accurately capture entity relationships under different expression methods, automatically converting non-standardized table headers in the original tables into standardized table headers that conform to industry standards and specifications, solving the problems of data inconsistency, non-standardization, and incompatibility caused by different drawing habits of design institutes.
[0065] It should be noted that the pipeline domain language model used for header standardization is based on the lightweight open-source Qwen3-8B large language model, fine-tuned. Qwen3-8B has good Chinese semantic understanding capabilities and low deployment costs, making it suitable for application scenarios in the pipeline engineering field. This application collected field description information from more than 30 design institutes to construct training data, established a mapping relationship between non-standardized and standardized headers, and fine-tuned the model for the pipeline domain. The fine-tuned model can better understand the professional terminology and expression habits of the pipeline engineering field, accurately identify the same field referred to by different expressions, and achieve a preliminary standardization success rate of over 90%.
[0066] Furthermore, to achieve deep fusion and structured output of multi-source data from pipeline material lists, pipeline design parameter lists, and pipeline project lists, this application first utilizes a pre-defined natural language processing model interface, combined with dynamic prompt word configuration, to convert the structured material list data, design list data, and project list data conforming to Markdown syntax specifications into a compliant JSON format. This process supports three processing modes: single text, single file, and batch directory. It also features dynamic prompt word management (prompt words can be dynamically configured based on the structured material list data, design list data, and project list data), configuration hot reload (dynamically loading configurations without stopping or restarting), and a fault-tolerant retry mechanism for large model calls (retrying when large model calls encounter errors). It can also flexibly switch the design institute name during runtime, demonstrating strong adaptability. Subsequently, the system rigorously validates and cleans the generated JSON-formatted material list data, design list data, and project list data, removing invalid and redundant fields. Using PDF page numbers as key indexes, it intelligently integrates material list data, design list data, and project list data belonging to the same PDF page into unified tabular data. Finally, the Pandas library (an open-source software library based on the Python programming language) is used to convert the unified tabular data into a structured Excel spreadsheet file and save it. At the same time, the system has an intelligent path parsing function that can automatically preserve the original directory structure and create an output directory. It captures file read / write and format matching anomalies throughout the process, and finally delivers an Excel spreadsheet file that integrates all pipeline information, has a standard format, and is easy to use for subsequent statistical analysis.
[0067] The method proposed in this application significantly improves the efficiency of extracting tabular information from single-line pipeline diagrams, enabling it to meet the urgent needs of processing massive amounts of drawings in large-scale pipeline engineering projects. Taking a large pipeline project containing 100,000 drawings as an example, under the traditional manual method, a designer can only process about 120 drawings per day, requiring a huge amount of manpower and time to complete the entire project. However, using the method proposed in this application, the extraction of tabular information from a single drawing takes only about 5 seconds, and the system supports 24 / 7 uninterrupted operation. The processing time for drawings of the same scale can be shortened from several months to several days, achieving an order-of-magnitude leap in processing efficiency and effectively solving the problem of mismatch between project progress and drawing processing speed.
[0068] Furthermore, this application boasts high recognition accuracy and intelligent post-processing advantages, significantly reducing the workload of manual review. Using the method described in this application, the accuracy rate of table information extraction reaches over 90%, drastically reducing the error rate of manual data entry. More importantly, the system is designed with intelligent error prompts and post-processing mechanisms to address potential minor deviations during table information extraction. This shifts the focus of manual work from literal entry to efficient error checking, further reducing the overall workload and ensuring the completeness and consistency of the final extracted table data.
[0069] Furthermore, the method described in this application can significantly optimize human resource allocation and unleash the creativity of engineers. By replacing highly repetitive mechanical labor with automation technology, valuable designer resources are freed from inefficient drawing reading and can be invested in more creative design optimization and core technology research and development. This ensures the quality of information extraction from tables while improving overall operational efficiency and digital transformation, providing strong technical support for the intelligent construction of industries such as petrochemicals.
[0070] Furthermore, this application provides a detailed description of the technological development process. The technical solution of this invention was developed based on in-depth research into the actual needs of the pipeline engineering field and repeated experimental verification. During the development process, several technical obstacles were encountered, which were overcome one by one by introducing multiple innovative ideas and systematic solutions. The following are the key nodes in the technological development process and the process of resolving technical obstacles: (a) Evolution of layout recognition schemes.
[0071] In the early stages of technology development, the initial consideration was to use layout-based page recognition technology to uniformly extract and combine tables across the entire drawing layout. However, actual testing revealed that the layout recognition model performed poorly when processing single-line pipe diagrams. The main reason was the significant differences in layout between design institutes, and even within the same design institute, the layout of drawings for different projects could vary, making it impossible to standardize the layout. A general layout model struggled to adapt to these highly non-standardized layout characteristics.
[0072] To address the aforementioned issues, this application proposes a segmented processing approach: first, the drawing layout is divided into three independent areas: a materials table, a design parameter table, and a project table; then, each area is processed separately. To further reduce the computational overhead of each area division, this application innovatively designs a semantic similarity matching algorithm based on the extraction of fixed area features from the drawing layout. By extracting fixed area features from the drawing and performing semantic similarity matching with a template library, rapid layout recognition is achieved. Simultaneously, an incremental template library mechanism is introduced to support the dynamic addition and accumulation of new templates; currently, over 30 design institute layout templates have been accumulated.
[0073] (ii) Evolution of material list identification scheme.
[0074] Regarding the recognition of material lists, the initial attempt was to directly use the general OCR technology (PaddleOCR) for text recognition. However, the test results showed that general OCR had three core problems that could not be solved: when the row spacing of the table was small, serialization errors were prone to occur, confusing the content of adjacent rows; when the row spacing of the table was large, splitting errors were prone to occur, incorrectly splitting the content of the same row into multiple rows; and redundant classification descriptions in the material list were easily misidentified as header columns.
[0075] To address the aforementioned issues, this application proposes a combined pre-processing and post-processing technical solution. In the pre-processing stage: redundant fields are removed using irrelevant content removal technology, and borderless tables are transformed into bordered tables using auxiliary line drawing technology. Specifically, auxiliary lines are drawn starting 2 pixels above the serial number, clearly distinguishing the boundaries between different rows. In the post-processing stage: the recognition results are corrected using a rule-matching algorithm, further improving the recognition accuracy. After processing using the above techniques, the accuracy of material table recognition is improved from 80% using general OCR to 97%.
[0076] (III) Evolution of the design parameter table and project table identification scheme.
[0077] The design parameter table and project table differ significantly in style from the materials table. The materials table resembles an Excel spreadsheet, with a header row and multiple data rows; while the design parameter table and project table resemble a registration form, making it difficult to clearly distinguish between header and data rows, and often including cells spanning multiple rows. This complex table structure makes traditional table recognition methods inapplicable.
[0078] Following technical research, this application determined a technical solution combining Semantic Entity Recognition (SER) and Relation Extraction (RE). However, pre-trained SER and RE models performed poorly when processing single-line pipeline diagrams, primarily due to the lack of specialized knowledge in pipeline engineering within general pre-trained models. Therefore, this application collected approximately 1000 data points from over 30 design institutes for model training. The training data covered fields including: unit name, total sheet, page, pipeline number, operating temperature, operating pressure, design temperature, design pressure, insulation material, insulation thickness, anti-corrosion coating, heat treatment, pipeline class, standard pressure, rust removal quantity, anti-corrosion quantity, protective layer thickness, material, serial number, material code, technical specifications, material name, nominal diameter, outer diameter, material, connection method, unit, net quantity, etc. After targeted training, the recognition accuracy of the SER and RE models reached over 95%, and with post-processing rule correction, the final accuracy was improved to over 99%.
[0079] (iv) Evolution of the standardization scheme for table headers.
[0080] After data extraction, non-standardized headers need to be converted into standardized headers to achieve unified storage and analysis of data from different design institutes. Because different design institutes describe the same field significantly differently (e.g., "design temperature" vs. "design temperature (°C)", "operating pressure" vs. "operating pressure (MPa)"), traditional rule-matching methods are insufficient to cover all variations.
[0081] Following research and technology selection, this application determined to use a fine-tuned lightweight open-source large language model (Qwen3-8B) to solve the header standardization problem. Training data was constructed by collecting field description information from over 30 design institutes, and the model was fine-tuned to enable it to understand the semantics of the pipeline engineering domain. The fine-tuned model can accurately identify the same field referred to by different expressions, achieving an initial standardization success rate of over 90%. Based on this, post-processing techniques using rule matching were combined to correct common errors, ultimately improving the standardization accuracy to over 99%.
[0082] The technical solution of this invention has also undergone experimental verification and practical application testing, and it has achieved significant technical progress in terms of recognition accuracy, processing efficiency, error type control, and standardization effect. The following are specific comparative data on technical effects: 1. Comparison of recognition accuracy.
[0083] Regarding the accuracy of material list recognition, the method of this invention achieved 97%, significantly outperforming the 80% accuracy of general OCR tools (such as PaddleOCR) and the historical average accuracy of 95% for manual input. General OCR tools exhibit significant errors in line break recognition and data splitting when processing material lists for single-line pipe diagrams. When the row spacing is small, serial errors are prone to occur, while when the row spacing is large, the same semantic content is easily split into multiple lines, leading to a significant drop in recognition accuracy. This invention effectively solves these problems through auxiliary line drawing technology and rule matching algorithms, improving the recognition accuracy by 17 percentage points.
[0084] Table 1 Comparison of Material List Identification Accuracy
[0085] 2. Comparison of processing efficiency.
[0086] In terms of processing efficiency, the method of this invention processes a single drawing in 5 seconds, compared to 200 seconds per drawing processed manually, representing a 40-fold improvement in efficiency. Furthermore, the method of this invention supports uninterrupted automated operation, while manual processing is limited by working hours and fatigue. Based on an 8-hour workday, a person can process a maximum of approximately 144 drawings per day, while the method of this invention can operate 24 hours a day without interruption, achieving a daily processing capacity of up to 17,280 drawings, representing a qualitative leap in processing efficiency.
[0087] Table 2 Comparison of Processing Efficiency
[0088] 3. Error type control effect.
[0089] This invention effectively solves three core error problems in the identification of material lists in single-line pipe diagrams: serialization errors, splitting errors, and header identification errors. Testing has verified that the identification accuracy for these three types of errors reaches over 95%, while traditional OCR technology cannot effectively solve these problems.
[0090] Serialization errors refer to errors caused by OCR misinterpreting the content of adjacent rows when the row spacing in a table is small. This invention effectively distinguishes the content of different rows by drawing auxiliary lines at the serial number positions, thus avoiding serialization errors. Splitting errors refer to the incorrect splitting of the content of the same row into multiple rows when the row spacing in a table is large. This invention transforms borderless tables into bordered tables by drawing auxiliary lines, ensuring the integrity of the content of the same row. Header recognition errors refer to the misrecognition of the table header due to redundant classification descriptions in the material table. This invention effectively eliminates redundant fields and improves the accuracy of table header recognition through irrelevant content removal and keyword matching techniques.
[0091] Table 3 Comparison of Error Type Control Effects
[0092] 4. Standardization effect of table headers.
[0093] To address the issue of different design institutes using different field descriptions to refer to the same field (such as "design temperature" vs. "design temperature (°C)", "operating pressure" vs. "operating pressure (MPa)"), this invention employs a finely tuned, lightweight large language model (such as Qwen3-8B) for header standardization. By collecting common field descriptions from over 30 design institutes as training data for fine-tuning, the model's initial standardization success rate reached over 90%. Based on this, combined with rule-matching post-processing techniques, common errors were corrected, ultimately achieving a header standardization accuracy rate of over 99%.
[0094] Table 4. Effect of header standardization
[0095] It should be noted that the technical solution of this invention has been verified in actual projects. The verification data comes from approximately 2,000 single-line pipeline drawings from three newly connected design institutes. The drawing formats of these design institutes differ from those of the design institutes from which the training data originated, effectively verifying the generalization ability of the technical solution. The verification results show that the technical solution of this invention achieved the expected results on drawings from different design institutes. Core indicators such as the accuracy rate of material list recognition, the accuracy rate of design parameter table and project table recognition, and the accuracy rate of table header standardization all meet the design requirements, proving the feasibility and practicality of the technical solution.
[0096] Furthermore, through practical application verification, the technical solution of this invention has demonstrated the following advantages: First, it can quickly adapt to the drawing formats of new design institutes, and the incremental template library mechanism effectively supports the rapid addition of new templates; Second, the recognition accuracy is stable and is not affected by the differences in design institute formats; Third, it has high processing efficiency and can meet the needs of large-scale drawing processing; Fourth, it has good standardization effect and can unify the data of different design institutes into a standard format, which facilitates subsequent data analysis and application.
[0097] Ultimately, the technical solution of this invention has achieved significant technical progress compared with the prior art, specifically in the following aspects: (1) Significantly improved recognition accuracy: The recognition accuracy of the material table has increased from 80% of the general OCR to 97%, an increase of 17 percentage points; the core problems such as serial errors, splitting errors and table header recognition errors have been effectively solved by the auxiliary line drawing technology.
[0098] (2) Processing efficiency is greatly improved: the processing time for a single drawing is reduced from 200 seconds by manual labor to 5 seconds, and the efficiency is increased by 40 times; it supports 24-hour uninterrupted operation and the daily processing capacity is increased by 120 times.
[0099] (3) Excellent standardization effect: By combining fine-tuning of the Qwen3-8B large language model with rule matching post-processing, the standardization accuracy of the table header reaches more than 99%, effectively solving the problem of differences in field descriptions among different design institutes.
[0100] (4) Strong generalization ability: Through incremental template library mechanism and domain model fine-tuning, the technical solution can quickly adapt to the drawing format of the new design institute, and its effectiveness has been verified on 2,000 drawings from different sources.
[0101] (5) High degree of automation: From PDF input to standardized Excel output, the entire process does not require manual intervention, realizing full automation of the extraction of information from pipeline single-line diagram tables.
[0102] See Figure 5 As shown, this embodiment of the invention discloses a device for extracting table information from a PDF format pipeline single-line diagram document, comprising: Image conversion module 11 is used to acquire a single-line pipe diagram document in PDF format with arbitrary layout, and convert the single-line pipe diagram document into a target single-line pipe diagram in image format; wherein, the single-line pipe diagram includes several components, and the several components include a pipe material table, a pipe design parameter table and a pipe project table; The image segmentation module 12 is used to match a target template pipeline single-line diagram corresponding to the target pipeline single-line diagram from a preset template library according to a template matching algorithm based on semantic sequence analysis, and to segment out several component region images corresponding to the target pipeline single-line diagram based on the layout of the target pipeline single-line diagram; the preset template library stores several template pipeline single-line diagrams with different layouts; The first table information extraction module 13 is used to preprocess the image of the first region of interest corresponding to the pipe material table, and to perform table recognition on the processed region of interest image to output structured material table data based on the text content and position information of each cell; the preprocessing includes removing irrelevant content and drawing auxiliary lines; The second table information extraction module 14 is used to identify text blocks from the second region of interest image corresponding to the pipeline design parameter table / pipeline project table using optical character recognition technology, and to determine the attribution relationship and entity mapping relationship between the semantic entities of each text block based on the semantic entity, semantic category and location information of each text block, so as to integrate the semantic entities of each text block to obtain structured design table data / project table data. The table file conversion module 15 is used to standardize the non-standardized table headers in the material table data, the design table data, and the project table data using a pipeline domain language model and based on a dynamic prompting word mechanism, and then convert them into Excel table files after standardization.
[0103] It should be noted that since the embodiments of the device part correspond to the embodiments of the aforementioned method part, the specific implementation steps of the embodiments of the device part can be referred to the embodiments of the aforementioned method part, and will not be repeated here.
[0104] Therefore, this application can convert PDF-format pipe single-line diagram documents with arbitrary layouts into target pipe single-line diagrams in image format. Then, based on a template matching algorithm using semantic sequence analysis, it can extract regions of interest (ROI) images corresponding to the pipe material table, pipe design parameter table, and pipe project table from the target pipe single-line diagram. Since the pipe material table, pipe design parameter table, and pipe project table differ in their table drawing, a differentiated table recognition method is used to extract table information, thereby improving the accuracy of table information extraction. For the pipe material table, irrelevant content is first removed and auxiliary lines are drawn on the corresponding ROI image before table recognition is performed to extract structured material table data. Irrelevant content removal avoids the extraction of irrelevant content or misidentification of irrelevant content that could lead to errors in table information extraction. Auxiliary line drawing avoids issues such as serial recognition when line spacing is small and splitting of the same semantic error into multiple lines when line spacing is large. For pipeline design parameter tables and pipeline project tables, text blocks are identified from the corresponding regions of interest (ROI) images. Based on the semantic entities, semantic categories, and location information of each text block, the row and column relationships and entity mapping relationships between the semantic entities of each file block are determined. This allows for the integration of the semantic entities of each file block to obtain structured design table data / project table data. Through semantic recognition and relationship extraction, the complex situations of inconsistent header positions and merged cells in pipeline design parameter tables and pipeline project tables are effectively addressed. Furthermore, by standardizing the non-standardized headers in the table data, the problem of significant semantic differences in header descriptions is effectively solved, meeting the need for accurate extraction of table information. In this way, this application can extract table information from PDF format pipeline single-line diagram documents with different layouts. This not only has a high degree of automation, avoiding the consumption of large amounts of human resources and time costs and improving the efficiency of table information extraction, but also solves the data standardization problem and processing obstacles caused by diverse layouts, improving the accuracy and quality stability of table information extraction.
[0105] Furthermore, embodiments of this application also disclose an electronic device, Figure 6 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0106] Figure 6This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the method for extracting table information from PDF format pipeline diagram documents disclosed in any of the foregoing embodiments. Alternatively, the electronic device 20 in this embodiment may specifically be a computer.
[0107] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0108] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0109] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to a computer program capable of performing the table information extraction method for a PDF format pipeline diagram document executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.
[0110] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned method for extracting table information from a PDF format pipeline single-line diagram document. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0111] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0112] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0113] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0114] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0115] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for extracting table information from a PDF format single-line pipe diagram document, characterized in that, include: Obtain a PDF document of a single-line pipe diagram with any layout, and convert the single-line pipe diagram document into a target single-line pipe diagram in image format; wherein, the single-line pipe diagram includes several components, and the components include a pipe material table, a pipe design parameter table, and a pipe project table; Based on the template matching algorithm of semantic sequence analysis, a target template pipeline single-line diagram corresponding to the target pipeline single-line diagram is matched from a preset template library. Based on the layout of the target template pipeline single-line diagram, several component images corresponding to the regions of interest are cut out from the target pipeline single-line diagram. The preset template library stores several template pipeline single-line diagrams with different layouts. The image of the first region of interest corresponding to the pipe material list is preprocessed, and table recognition is performed on the processed region of interest image to output structured material list data based on the text content and position information of each cell; the preprocessing includes irrelevant content removal and auxiliary line drawing; Optical character recognition technology is used to identify text blocks from the second region of interest image corresponding to the pipeline design parameter table / pipeline project table. Based on the semantic entities, semantic categories and location information of each text block, the attribution relationship and entity mapping relationship between the semantic entities of each text block are determined, so as to integrate the semantic entities of each text block to obtain structured design table data / project table data. Using a pipeline domain language model and based on a dynamic prompting mechanism, the non-standardized headers in the material list data, the design list data, and the project list data are standardized and then converted into Excel spreadsheet files.
2. The method for extracting table information from a PDF format single-line pipe diagram document according to claim 1, characterized in that, Before converting the single-line pipe diagram document into a target single-line pipe diagram in image format, the method further includes: By analyzing the position and size of the embedded images in the single-line diagram document, watermarked images are filtered from the embedded images and then erased from the single-line diagram document. And / or, check the field type corresponding to the interactive control in the single-line diagram document of the pipeline, and remove the interactive control of the signature field type in the single-line diagram document of the pipeline; And / or, scan the annotation list in the single-line pipe diagram document, and delete the annotation objects of the signature type in the annotation list in the single-line pipe diagram document.
3. The method for extracting table information from a PDF format single-line pipe diagram document according to claim 1, characterized in that, The step of converting the single-line pipe diagram document into a target single-line pipe diagram in image format includes: Obtain the baseline dots per inch from the single-line diagram document of the pipeline; A scaling factor is determined based on the baseline dots per inch and the target dots per inch, and a linear transformation matrix is constructed based on the scaling factor; The linear transformation matrix is used to convert the pipeline single-line diagram document into a target pipeline single-line diagram in image format; Wherein, the number of dots per inch in the target pipeline single-line diagram is the target number of dots per inch, and the image channels of the target pipeline single-line diagram correspond to the image format.
4. The method for extracting table information from a PDF format single-line pipe diagram document according to claim 1, characterized in that, The template matching algorithm based on semantic sequence analysis matches a target template pipeline single-line diagram from a preset template library that corresponds to the target pipeline single-line diagram. Based on the layout of the target template pipeline single-line diagram, it cuts out several component-specific region-of-interest images from the target pipeline single-line diagram, including: Semantic similarity is calculated between the target pipeline single-line diagram and each template pipeline single-line diagram in the preset template library, and based on the similarity, it is matched from the preset template library to see if there is a target template pipeline single-line diagram that meets the preset similarity conditions. If not, the user's region selection instructions for several components in the target pipeline single-line diagram are obtained through a preset interactive interface, and the target regions of interest corresponding to the several components in the target pipeline single-line diagram are determined based on the region selection instructions. If it exists, then based on the regions of interest corresponding to the components in the single-line diagram of the target pipeline, determine the target regions of interest corresponding to the components in the single-line diagram of the target pipeline; After determining the target regions of interest (ROIs) corresponding to several components in the single-line diagram of the target pipeline, the ROI images corresponding to several components are cut out from the single-line diagram of the target pipeline based on the ROIs.
5. The method for extracting table information from a PDF format single-line pipe diagram document according to claim 1, characterized in that, The process of preprocessing the image of the first region of interest corresponding to the pipe material table, and performing table recognition on the processed region of interest image to output structured material table data based on the text content and location information of each cell, includes: Text information is identified from the first region of interest image corresponding to the pipe material list using optical character recognition technology; The text information is matched with a first preset keyword to determine irrelevant information from the text information, and the irrelevant information is covered in the first region of interest image to obtain a covered region of interest image; The remaining information is matched with the second preset keyword to determine invalid information from the remaining information, and the region corresponding to the invalid information in the covered region of interest image is cropped to obtain a cropped region of interest image; the remaining information is the information in the text information other than the irrelevant information; Optical character recognition technology is used to identify target serial numbers that meet preset serial number conditions from the cropped region of interest image, and auxiliary lines are drawn in the cropped region of interest image based on the position of the target serial number to obtain the processed region of interest image; Based on the auxiliary lines in the processed region of interest image, table recognition is performed on the processed region of interest image to extract the text content and location information of each cell, and named entity recognition technology is used to identify key entities in the text content of each cell, so as to output structured material table data based on the text content, key entities and location information of each cell.
6. The method for extracting table information from a PDF format single-line pipe diagram document according to claim 1, characterized in that, Based on the semantic entities, semantic categories, and location information of each text block, the hierarchical relationships and entity mapping relationships between the semantic entities of each file block are determined, so as to integrate the semantic entities of each file block to obtain structured design table data / project table data, including: The semantic entity recognition model is used to perform semantic entity recognition on each of the text blocks, and the semantic entities of each of the text blocks are semantically classified to determine the semantic category corresponding to the semantic entities of each text block. The semantic entities, semantic categories, and location information of each text block are input into the relation extraction model to determine the table layout structure of the pipeline design parameter table / pipeline project table based on the location information of each text block. Using the table layout structure and based on the semantic entities and semantic categories of each text block, the row and column belonging relationships and entity mapping relationships between the semantic entities of each text block are determined. Based on the row and column attribution relationships and the entity mapping relationships, the semantic entities of each text block are integrated according to the table layout structure to obtain structured design table data / project table data.
7. The method for extracting table information from a PDF format single-line pipe diagram document according to any one of claims 1 to 6, characterized in that, The process of standardizing non-standardized headers in the material list data, design list data, and project list data using a pipeline domain language model and based on a dynamic prompting mechanism, and then converting the standardized headers into an Excel spreadsheet file, includes: The non-standardized headers in the material list data, design list data, and project list data are converted into standardized headers using a pipeline domain language model. The pipeline domain language model is a model trained based on a pre-established mapping relationship between non-standardized and standardized headers in the pipeline domain. Based on the material list data, the design list data, and the project list data, prompt words are dynamically generated, and the material list data, the design list data, and the project list data are converted into JSON format using the prompt words; The material list data, design list data, and project list data, which belong to the same PDF page and are in JSON format, are integrated, and the integrated table data is converted into an Excel spreadsheet file.
8. A device for extracting tabular information from a PDF format pipeline single-line diagram document, characterized in that, include: The image conversion module is used to acquire a single-line pipe diagram document in PDF format with any layout, and convert the single-line pipe diagram document into a target single-line pipe diagram in image format; wherein, the single-line pipe diagram includes several components, and the several components include a pipe material table, a pipe design parameter table, and a pipe project table; The image segmentation module is used to match a target template pipeline single-line diagram corresponding to the target pipeline single-line diagram from a preset template library based on a template matching algorithm of semantic sequence analysis, and to segment out several component region images from the target pipeline single-line diagram based on the layout of the target pipeline single-line diagram; the preset template library stores several template pipeline single-line diagrams with different layouts; The first table information extraction module is used to preprocess the image of the first region of interest corresponding to the pipe material table, and to perform table recognition on the processed region of interest image to output structured material table data based on the text content and position information of each cell; the preprocessing includes removing irrelevant content and drawing auxiliary lines; The second table information extraction module is used to identify text blocks from the second region of interest image corresponding to the pipeline design parameter table / pipeline project table using optical character recognition technology, and to determine the attribution relationship and entity mapping relationship between the semantic entities of each text block based on the semantic entity, semantic category and location information of each text block, so as to integrate the semantic entities of each text block to obtain structured design table data / project table data. The table file conversion module is used to standardize the non-standardized table headers in the material table data, the design table data, and the project table data by using a pipeline domain language model and based on a dynamic prompting word mechanism, and then convert them into Excel table files after standardization.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the method for extracting tabular information from a PDF format pipeline single-line diagram document as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store a computer program, which, when executed by a processor, implements the method for extracting tabular information from a PDF format pipeline single-line diagram document as described in any one of claims 1 to 7.