Engineering drawing detection method based on synthetic data and computer equipment
By constructing an engineering drawing material library and generating synthetic data, the target detection model is trained to solve the problem of complex table detection, improve detection efficiency and accuracy, and achieve efficient detection and extraction of complex tables in engineering drawings.
Patent Information
- Application Number
- CN202410748725.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2024-09-06
AI Technical Summary
It is difficult for the existing technology to effectively detect and process tables in engineering drawings with complex structures, especially due to the interference of legend lines and the lack of training data for engineering drawings, resulting in false detections and low detection efficiency.
By building an engineering drawing material library, synthetic engineering drawings are generated, and these synthetic data are used to train the target detection model, including generating complex tables and data enhancement processing, and combined with Fast R-CNN, Mask R-CNN or YOLO models for training and detection.
The generalization ability and adaptability of the target detection model are improved, and complex tables in engineering drawings can be efficiently detected and extracted, significantly improving work efficiency and reducing costs.
Smart Images

Figure CN118609150A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent image processing, and in particular to an engineering drawing detection method based on synthetic data and a computer device. Background Art
[0002] In engineering design and maintenance, engineering drawings are crucial information carriers. Engineering drawings usually contain a wealth of information, including graphics, text descriptions, parts lists, etc. Among them, the parts list often exists in the form of a table, describing the key information such as the properties, quantity, and location of various parts. However, due to the particularity of engineering drawings, the tables therein often present complex layouts and structures, including different types of parts intertwined and intricate rows and columns. This complexity poses a challenge to the digital processing of engineering drawings.
[0003] Traditional image signal processing methods usually use morphological corrosion and dilation techniques to filter out horizontal and vertical lines, and then determine the presence of tables based on the intersection distribution. However, this method is easily disturbed by legend lines and may lead to false detection. On the other hand, data-driven methods have shown good results in recent years, but they are mainly trained on traditional documents (such as academic papers) and lack the ability to distinguish and detect complex tables in engineering drawings. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide an engineering drawing detection method based on synthetic data and a computer device.
[0005] The technical solution adopted by the present invention to solve the technical problem is: to provide an engineering drawing detection method based on synthetic data, comprising:
[0006] Step S10. Detecting a plurality of real engineering drawings, and extracting real information elements from the real engineering drawings, wherein the real information elements in each of the real engineering drawings include at least one of a real legend, a real text, or a real table;
[0007] Step S20. Using the real legend, real text and real table, construct an engineering drawing material library;
[0008] Step S30. Acquire information elements of engineering drawings from the engineering drawing material library, and generate a plurality of synthetic engineering drawings according to the information elements;
[0009] Step S40: Using the synthetic engineering drawings, train the target detection model.
[0010] Furthermore, generating a plurality of engineering drawings according to the information elements in step S30 includes:
[0011] According to the real table, a complex table is constructed, wherein the complex table is a table with irregular shape, layout, structure or rows and columns;
[0012] The composite engineering drawing is constructed using at least one of the complex table, the real legend, and the real text.
[0013] Furthermore, the step S30 includes: performing data enhancement processing on the synthetic engineering drawing.
[0014] Furthermore, the constructing of a complex table includes:
[0015] Using a preset table generation algorithm, extracting table constituent elements from the real table to generate a synthetic table, wherein the synthetic table is a rectangular table with regular rows and columns;
[0016] The synthetic table is combined with the real table to generate the complex table.
[0017] Furthermore, the training of the target detection model in step S40 includes: training multiple target detection models, and screening the best target detection model according to the standard, wherein the target detection model includes: Fast R-CNN model, Mask R-CNN model or YOLO model.
[0018] Furthermore, the step S40 includes:
[0019] A method that uses both synthetic engineering drawings and real engineering drawings for joint training; or,
[0020] The target detection model is first pre-trained using synthetic engineering drawings, and then fine-tuned using real engineering drawings.
[0021] Furthermore, the engineering drawing detection method provided by the present invention further comprises the following steps:
[0022] Step S50: using the target detection model to digitally process the real engineering drawings to be detected.
[0023] Furthermore, the step S50 of digitalizing the target engineering drawing includes:
[0024] Step S51. Use the target detection model to perform fine-grained detection on the complex table in the real engineering drawing to be detected, and identify the sub-tables in the complex table.
[0025] Furthermore, after step S50, the following steps are further included:
[0026] Step S60: Classify the sub-tables using a preset morphological algorithm, so as to merge sub-tables of the same type.
[0027] A computer device is also provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements any of the above-mentioned engineering drawing detection methods based on synthetic data when executing the computer program.
[0028] The implementation of the engineering drawing detection method and computer device based on synthetic data of the present invention has the following beneficial effects: by establishing a comprehensive drawing information element material library, it is easy to generate synthetic engineering drawings, providing more diverse training data for the target detection model, and improving the generalization ability and adaptability of the model. Furthermore, through the training of the synthetic data set, the model can better understand the complex structure in the engineering drawings, improve the detection performance, and can achieve efficient detection and extraction of complex tables in the engineering drawings, significantly improving work efficiency and reducing costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:
[0030] Figure 1 It is a flow chart of a first embodiment of an engineering drawing detection method based on synthetic data provided by the present invention.
[0031] Figure 2 It is a flowchart of constructing an engineering drawing material library according to the first embodiment of the present invention.
[0032] Figure 3 It is a flow chart of the synthetic engineering drawing of the first embodiment of the present invention.
[0033] Figure 4 FIG. 4 is an exemplary diagram of a complex table according to the first embodiment of the present invention. DETAILED DESCRIPTION
[0034] In order to have a clearer understanding of the technical features, purposes and effects of the present invention, the specific implementation methods of the present invention are now described in detail with reference to the accompanying drawings. It should be noted that the terms "first", "second", "third", etc. are only for the convenience of describing the present technical solution, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first", "second", "third", etc. may explicitly or implicitly include one or more of the features. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0035] In the following description, for the purpose of illustration rather than limitation, specific details such as specific system structures and technologies are provided to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may also be implemented in other embodiments without these specific details.
[0036] like Figure 1 As shown, in a first embodiment of an engineering drawing detection method based on synthetic data provided by the present invention, the method includes:
[0037] Step S10. Detect a plurality of real engineering drawings, and extract real information elements from the real engineering drawings, wherein the real information elements in each of the real engineering drawings include at least one of a real legend, a real text, or a real table.
[0038] Step S20: Utilize the real legend, real text and real table to build an engineering drawing material library.
[0039] Specifically, in engineering design and maintenance, engineering drawings are crucial information carriers. Real engineering drawings are engineering drawings used in engineering design and maintenance activities, and usually contain rich information, such as graphics, text descriptions, parts lists, etc. However, real engineering drawings often have very little data or are difficult to obtain. Therefore, it is necessary to build an engineering drawing material library to collect real engineering drawing data in order to generate synthetic engineering drawing data and obtain rich and diverse training samples.
[0040] First, take a photo or scan the real engineering drawing to obtain image data of the real engineering drawing, and extract information elements such as real legends, real texts or real tables. The real legends are the legends on the real engineering drawings (including but not limited to structural diagrams, flow diagrams, icons, etc. of equipment or components), the real texts are the text descriptions on the real engineering drawings, and the real tables are the tables on the real engineering drawings.
[0041] like Figure 2 As shown, real engineering drawings mainly contain three types of information elements: text, table, and legend. In this embodiment, the existing engineering drawings are processed, the information elements therein are extracted, and they are classified and sorted, and the information elements of the same type are merged into a material library to construct a table material library, a text material library, and a legend material library. The technical solution of this embodiment can extract and integrate the information in the existing engineering drawings, provide a large amount of material for synthesizing engineering drawings, and the synthesized engineering drawings composed of the elements in the material library can maintain the authenticity and diversity of the synthesized engineering drawings to the greatest extent.
[0042] Among them, the above-mentioned extraction process can adopt a semi-automated method, combined with automatic prediction and manual correction. The specific operation is: use a common target detection algorithm to pre-label the text, legend or table information in the image data in the real engineering drawing, and then manually determine the pre-labeled information to determine whether it is the key information that needs to be extracted. The combination of the two can ensure the accuracy and reliability of each information material and save human resources.
[0043] Step S30: Acquire information elements of engineering drawings from an engineering drawing material library, and generate a plurality of synthetic engineering drawings according to the information elements.
[0044] In this step, it should be noted that the synthetic engineering drawing can be obtained by combining at least one of the information elements such as real legends, real texts or real tables, or by combining multiple information elements of one information element. Multiple information elements are randomly sampled from the engineering drawing material library and then combined into an image to obtain a synthetic engineering drawing.
[0045] In the process of synthesizing engineering drawings, it is necessary to perform data enhancement operations on the information elements extracted from real engineering drawings. This is because, although the extracted information elements are real, the information obtained after the extraction is relatively refined and neat. If used directly, they will either be repeated with the real engineering drawings that have been processed, or be too simple and fail to achieve the training purpose.
[0046] In a specific embodiment, some data enhancement operations include: Random flipping: flipping the image of the synthetic engineering drawing horizontally or vertically, and using the flipped image for training can increase the robustness of the target detection model. Random erasing: randomly selecting an area in the image of the synthetic engineering drawing and setting its pixel value to 0 or a fixed value, thereby increasing the anti-interference ability of the trained model. Color jittering: randomly adjusting the color information such as brightness, contrast and saturation of the image of the synthetic engineering drawing, thereby increasing the generalization ability of the trained model. Image scaling: randomly adjusting the image size of the synthetic engineering drawing to increase the scale invariance of the trained model. Data enhancement operations also include: row and column transformation of tables, random flipping, and combination and arrangement of texts.
[0047] After data enhancement operations, complex information elements such as complex texts, complex legends, and complex tables are obtained, and synthetic engineering drawings are constructed using complex information elements.
[0048] Implementing the technical solution of this embodiment can solve the problem that the existing number of real engineering drawings is small, resulting in insufficient training sources and inability to achieve training objectives. Synthetic engineering drawings have the advantages of being close in complexity to real engineering drawings, having real data and diverse combinations. They can provide a large number of training sets for the training of target detection models. The trained detection model can perfectly perform the detection work of real engineering drawings, greatly liberating manpower, improving work efficiency, reducing costs, and having important practical significance.
[0049] Furthermore, the detection method in the prior art can only process regular tables with rectangular outlines, but cannot process complex tables, which is prone to detection errors. In order to solve the problem of complex table detection, the step of generating a synthetic engineering drawing in this embodiment specifically includes: constructing a complex table according to information elements, wherein the complex table is a table with irregular shape, layout, structure or rows and columns; and constructing a synthetic engineering drawing using at least one of the complex table, the real legend and the real text.
[0050] like Figure 4 As shown, complex tables include but are not limited to: irregularly shaped tables (such as Figure 4 a, not a regular rectangular table), a table with irregular rows and columns (such as Figure 4 b, not a regular table with n rows and m columns), irregularly laid out tables (such as Figure 4 c, tables containing merged cells), and tables with multiple overlapping subtables (such as Figure 4 d).
[0051] Among them, building complex tables includes the following methods:
[0052] refer to Figure 3 In this embodiment, some real tables are randomly selected from the engineering drawing material library, and then spliced or overlapped to obtain complex tables. The complex tables are combined with some other real texts and legends to form multiple synthetic engineering drawings. Using these synthetic engineering drawings containing complex tables to train the target detection model can enable the target detection model to better understand the complex table structure in the engineering drawings, thereby improving the detection performance.
[0053] In an optional embodiment, in order to increase the diversity of information elements, a preset table generation algorithm is used to extract table constituent elements from a real table to generate a synthetic table, wherein the synthetic table is a rectangular table with regular rows and columns; the synthetic table is then combined with the real table to synthesize a complex table.
[0054] Specifically, a text extraction algorithm, such as the OCR method, is used to identify the data text in the real table, and then regular expressions are used to parse the text. The Pandas toolkit is then used to generate a rectangular synthetic table with random rows, columns, and content. Random sampling is then performed from the synthetic table and the real table for splicing and overlapping to synthesize a large number of complex tables, so as to increase the diversity and amount of training data and improve the detection capability of the trained model for complex tables.
[0055] Step S40: Using the synthetic engineering drawings, train the target detection model.
[0056] Specifically, multiple target detection models are trained, and the best target detection model is screened according to the standards, wherein the target detection models used include but are not limited to: Fast R-CNN model, Mask R-CNN model or YOLO model. After multiple training and calibration, the most suitable target detection model is finally screened out, and the screening criteria include: COCO indicators.
[0057] Optionally, the training method includes: a method of jointly training with synthetic engineering drawings and real engineering drawings; or, first pre-training the target detection model with synthetic engineering drawings, and then fine-tuning the target detection model with real engineering drawings. Pre-training refers to training the model on a large amount of labeled data so that the model learns the characteristics and rules of the data. This process usually requires a lot of computing resources and time. The purpose of pre-training is to enable the model to converge faster in subsequent tasks and have better generalization capabilities. Fine-tuning refers to correcting the model using data from specific tasks based on pre-training. The fine-tuning process usually only requires less computing resources and time because the model has learned a lot of knowledge and features in the pre-training stage.
[0058] After the object detection model is trained, the COCO index is used to evaluate the performance. For example, the average precision, average recall and accuracy of these object detection models are calculated, and then the best object detection model is selected based on these indicators. For example, each indicator of each model is scored, and the model with the highest total score is selected as the best object detection model.
[0059] In some other embodiments, different parameters can be set for the same type of model, so as to construct multiple target detection models for training. In addition, the screening criteria are not limited to COCO indicators. This embodiment only lists several common models and indicators. In fact, any model that can perform target detection can be used for training and screening. The screened model can play a great role in the effective detection of real engineering drawings to be detected. After training and screening, the generalization ability and adaptability of the model are greatly improved.
[0060] In a specific embodiment, it also includes: Step S50. Using the target detection model, digitally process the real engineering drawings to be detected.
[0061] Specifically, the best object detection model obtained by screening is used to detect the image data of the real engineering drawing to be detected, and whether there are texts, legends or tables in the real engineering drawing, and their positions are detected. The digital processing of the table includes: step S51. Using the screened object detection model, a complex table in the real engineering drawing to be detected is fine-grained detected, and a sub-table in the complex table is identified.
[0062] Due to the particularity of engineering drawings, the tables in them often present complex layouts and structures, including different types of parts intertwined, and intricate rows and columns. The trained object detection model is an efficient and accurate detection method for processing these complex tables, legends, and texts. The object detection model is used to identify complex tables from the image data of real engineering drawings, and then fine-grained detection is performed to identify each sub-table in the complex table.
[0063] Furthermore, after step S50, the method further includes: step S60: using a morphological algorithm to classify the sub-tables, so as to merge sub-tables of the same type.
[0064] In this embodiment, after the screened target detection model detects the target real engineering drawing, the morphological algorithm is used to compare the types of the sub-tables in the real engineering drawing so as to merge the sub-tables of the same type for manual review and use, improve information integrity, and promote subsequent information filtering and structural processing of table information. For example, through binary erosion and expansion, binary opening and closing operations, skeleton extraction, extreme erosion, hit-miss transformation, morphological gradient and other operations, the number, length and width of each row and column of the sub-table are detected, so as to compare whether the two sub-tables belong to the same category based on this information.
[0065] By implementing the technical solution of this embodiment, a comprehensive drawing information element material library is established to facilitate the generation of synthetic engineering drawings, which provides more diverse training data for the target detection model and improves the generalization ability and adaptability of the model. Furthermore, through the training of synthetic data sets, the model can better understand the complex structures in engineering drawings, improve detection performance, and achieve efficient detection and extraction of complex tables in engineering drawings, significantly improving work efficiency and reducing costs.
[0066] In addition, the present invention also constructs a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements the steps of the engineering drawing detection method based on synthetic data in any of the above embodiments when executing the computer program. The computer device in the present invention can be a notebook, a desktop, a workstation, an industrial computer, a server, etc.
[0067] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0068] It can be understood that the above embodiments only express the preferred implementation modes of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the patent scope of the present invention. It should be pointed out that, for ordinary technicians in this field, the above technical features can be freely combined without departing from the concept of the present invention, and several deformations and improvements can be made, which all belong to the protection scope of the present invention. Therefore, all equivalent changes and modifications made to the scope of the claims of the present invention should belong to the coverage of the claims of the present invention.
Claims
1. A method for detecting engineering drawings based on synthetic data, characterized in that: include: Step S10. Detecting a plurality of real engineering drawings, and extracting real information elements from the real engineering drawings, wherein the real information elements in each of the real engineering drawings include at least one of a real legend, a real text, or a real table; Step S20. Using the real legend, real text and real table, construct an engineering drawing material library; Step S30. Acquire information elements of engineering drawings from the engineering drawing material library, and generate a plurality of synthetic engineering drawings according to the information elements; Step S40: Using the synthetic engineering drawings, train the target detection model.
2. The engineering drawing detection method according to claim 1, characterized in that: The step S30 of generating a plurality of synthetic engineering drawings according to the information elements comprises: According to the real table, a complex table is constructed, wherein the complex table is a table with irregular shape, layout, structure or rows and columns; The composite engineering drawing is constructed using at least one of the complex table, the real legend, and the real text.
3. The engineering drawing detection method according to claim 1, characterized in that: The step S30 includes: performing data enhancement processing on the synthetic engineering drawing.
4. The engineering drawing detection method according to claim 2, characterized in that: The construction of a complex table includes: Using a preset table generation algorithm, extracting table constituent elements from the real table to generate a synthetic table, wherein the synthetic table is a rectangular table with regular rows and columns; The synthetic table is combined with the real table to generate the complex table.
5. The engineering drawing detection method according to claim 1, characterized in that: The training of the target detection model in step S40 includes: training multiple target detection models, and screening the best target detection model according to the standard, wherein the target detection model includes: Fast R-CNN model, Mask R-CNN model or YOLO model.
6. The engineering drawing detection method according to claim 1, characterized in that: The step S40 comprises: A method that uses both synthetic engineering drawings and real engineering drawings for joint training; or, The target detection model is first pre-trained using synthetic engineering drawings, and then fine-tuned using real engineering drawings.
7. The engineering drawing detection method according to any one of claims 1 to 6, characterized in that: The following steps are also included: Step S50: using the target detection model to digitally process the real engineering drawings to be detected.
8. The engineering drawing detection method according to claim 7, characterized in that: The step S50 of digitalizing the target engineering drawing includes: Step S51. Use the target detection model to perform fine-grained detection on the complex table in the real engineering drawing to be detected, and identify the sub-tables in the complex table.
9. The engineering drawing detection method according to claim 7, characterized in that: After step S50, the following steps are further included: Step S60: Classify the sub-tables using a preset morphological algorithm, so as to merge sub-tables of the same type.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the method for detecting engineering drawings based on synthetic data described in any one of claims 1 to 9 is implemented.
