Engineering drawing recognition and OCR methods, text recognition models and electronic equipment
By dividing engineering drawings into frame areas and view areas, and training a text recognition model that recognizes the text information of the view area, combining the named entity recognition model and keyword dictionary filtering method, the problem of low accuracy of text information recognition in engineering drawings is solved, and efficient and accurate drawing information extraction and customer quotation are achieved.
Patent Information
- Application Number
- CN202411814097.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-04
AI Technical Summary
The accuracy of identification of text information in engineering drawings is low, resulting in slow manual reading of drawings, slow quotation speed, long processing cycle, and extraction errors due to information recognition obfuscation.
By dividing engineering drawings into frame areas and view areas, and using computer vision and natural language processing in a targeted manner, a text recognition model that recognizes the text information of the view area is trained, and text information is extracted in combination with the named entity recognition model and keyword dictionary filtering method.
It realizes automatic extraction of drawing information, reduces the training cost of text recognition model, improves the speed and accuracy of drawing information extraction, and shortens customer quotation time.
Smart Images

Figure CN119763143A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of character recognition, and in particular to an engineering drawing recognition method, an OCR method, a text recognition model and an electronic device. Background Art
[0002] Due to the complexity and particularity of text information in engineering drawings, when applying text recognition models to them, there are problems such as high training cost and low recognition accuracy of the text recognition models.
[0003] Taking CAD two-dimensional drawings as an example, they are important carriers for accurately describing the dimensions, tolerances, roughness, relationships and other information of parts or assemblies in the mechanical field. The reading of mechanical drawings has the following difficulties: 1. Two-dimensional drawings generally have multiple views, and different views need to be combined to analyze and understand the spatial relationship of parts or assemblies. 2. Mechanical drawings contain a large amount of information such as dimensions, tolerances, roughness, etc., and a large number of auxiliary lines are introduced to complete the annotation. 3. The drawing of mechanical drawings follows a large number of standards and specifications, and there are many special symbols with specific scenarios and meanings.
[0004] In the field of non-standard parts customization, customers usually submit the customized parts to the factory in the form of CAD drawings. The processing personnel obtain the part information by manually reading the drawings, and then make a quotation and process. Due to the difficulty in reading the mechanical drawings mentioned above, the reading speed of manual reading is slow, which directly leads to the problem of slow quotation speed and long processing cycle. Among them, the slow quotation speed will increase the probability of customer orders being snatched away by competitors, which will directly lead to the loss of customers and orders.
[0005] Therefore, it is necessary to improve the existing recognition method of engineering drawings. Summary of the invention
[0006] In view of the above problems, the present invention provides a method for identifying engineering drawings, comprising the steps of:
[0007] A drawing division step, detecting information of the engineering drawing, and dividing the engineering drawing into a drawing frame area and a view area; and
[0008] A text information recognition step, respectively recognizing text information in the frame area and the view area;
[0009] Among them, identifying the text information of the view area includes: training a text recognition model for identifying the text information of the view area.
[0010] According to the technical solution, by dividing the engineering drawings into the frame area and the view area, and respectively identifying and extracting the text information of each area, the drawing information is automatically extracted, reducing the reliance on manual work. At the same time, based on the information characteristics of the frame area and the view area, by dividing the engineering drawings into the frame area and the view area, and specifically training the text recognition model for identifying the text information in the view area through computer vision and natural language processing, the training cost of the text recognition model is effectively reduced. At the same time, the problem of information recognition / extraction errors caused by confusion between the frame area and the view area due to the particularity of the view area information when the information in the drawing is automatically processed as a whole is solved, effectively improving the speed and accuracy of drawing processing information extraction, thereby improving the speed of engineering drawing information identification and extraction, and then improving the speed of quoting to customers based on the drawing.
[0011] Optionally, the drawing division step includes:
[0012] S1-1, reading engineering drawings; and
[0013] S1-2, segmenting the engineering drawings, dividing the engineering drawings into a frame area and a view area through a connected domain algorithm and a target segmentation model.
[0014] According to the technical solution, the frame area is first obtained by connecting domain division, which reduces the drawing area to be divided. The division of the frame area and the view area can be achieved while reducing the training amount of the target segmentation model.
[0015] Optionally, step S1-1 includes:
[0016] S1-2-1, dividing the engineering drawing into multiple connected areas by a connected domain algorithm, calculating the circumscribed rectangular area of each connected area, and determining the connected area with the largest circumscribed rectangular area as the drawing frame area; and
[0017] S1-2-2, based on the target segmentation model, divide the remaining area outside the frame area obtained in S1-2-1 to obtain the view area and the technical requirement area, and divide the technical requirement area into the frame area.
[0018] Optionally, “training a text recognition model for recognizing text information in a view area” includes:
[0019] For text information with irregular arrangement order, it is annotated based on its regular arrangement order and the text recognition model is trained.
[0020] According to the technical solution, based on the fact that there is irregularly arranged text information in the viewing area that is difficult to identify, the irregularly arranged text is converted into regularly arranged annotated text, making it easy to identify and train corpus, reducing the difficulty of training the text recognition model and improving the accuracy of the text recognition model. After targeted training, the text recognition model can accurately identify irregularly arranged text and give the corresponding text information.
[0021] Optionally, “training a text recognition model for recognizing text information in a view area” includes:
[0022] For text information containing special symbols, mark the corresponding marking text.
[0023] According to the technical solution, based on the fact that there is text information containing special symbols that are difficult to identify in the viewing area, each special symbol in the viewing area is annotated with a corresponding marked text. By converting the special symbols into corresponding marked text for identification, the special symbols can be accurately identified and the corresponding text information can be given, thereby effectively improving the recognition rate of the text recognition model for special symbols.
[0024] The engineering drawing recognition method provided by the present invention also includes: a text information extraction step, which extracts the text information recognized in the text information recognition step based on a named entity recognition model and a keyword dictionary filtering method.
[0025] According to the technical solution, the text information is extracted through named entity recognition and further filtered through a keyword dictionary filtering method, so that the text information of the frame area can be accurately extracted.
[0026] Optionally, “the text information identified by the text information identification step of extracting the text information based on the named entity recognition model and the keyword dictionary filtering method” includes:
[0027] Obtaining a first quantity value returned by the named entity recognition model; and
[0028] If the first quantity value does not exist, the keyword dictionary is used to filter the quantity keywords, and the second quantity value is located and extracted.
[0029] According to the technical solution, by correcting the quantity value based on quantity keywords and text position, it is possible to greatly reduce text information extraction errors caused by non-quantity numbers being mistakenly regarded as quantity information.
[0030] The present invention also provides a text recognition model, which is configured to apply the above-mentioned engineering drawing recognition method to perform engineering drawing recognition.
[0031] The present invention also provides an OCR method, which applies the above-mentioned engineering drawing recognition method.
[0032] The present invention also provides an electronic device, which applies the above-mentioned engineering drawing recognition method, or is configured with the above-mentioned text recognition model; or, uses the above-mentioned OCR method to perform engineering drawing recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 A flowchart of an engineering drawing recognition method in an embodiment of the present invention;
[0034] Figure 2 A flowchart of the steps of dividing drawings in an embodiment of the present invention;
[0035] Figure 3 A flowchart of dividing an engineering drawing into a frame area and a view area by using a connected domain algorithm and a target segmentation model in an embodiment of the present invention;
[0036] Figure 4 A complete engineering drawing schematic diagram read in an embodiment of the present invention;
[0037] Figure 5 A schematic diagram of a divided frame area in an embodiment of the present invention;
[0038] Figure 6 Schematic diagram of divided view areas in an embodiment of the present invention;
[0039] Figure 7 A schematic diagram of a detection frame when detecting view text and frame text in an embodiment of the present invention;
[0040] Figure 8 A schematic diagram of text information arranged in an irregular order in a viewing area in an embodiment of the present invention;
[0041] Fig. 9 Schematic diagram of text information in the frame area in an embodiment of the present invention. DETAILED DESCRIPTION
[0042] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0043] Figure 1 4 is a flow chart of an engineering drawing recognition method in an embodiment of the present invention.
[0044] like Figure 1 As shown, a method for identifying an engineering drawing in this embodiment includes the steps of:
[0045] In the drawing division step S1, information of the engineering drawing is detected, and the engineering drawing is divided into a drawing frame area and a view area.
[0046] The text information recognition step S2 is to recognize the text information of the frame area and the view area respectively.
[0047] The text information extraction step S3 extracts the text information identified in the text information identification step S2.
[0048] Among them, in the text information recognition step S2, recognizing the text information of the view area includes: training a text recognition model for recognizing the text information of the view area.
[0049] Engineering drawings usually include a frame area and a view area. Taking two-dimensional CAD engineering drawings as an example, the frame area mainly includes information such as the material, surface treatment and quantity of the parts, and the information is mainly composed of regular characters such as Chinese, English and numbers; while the view area mainly includes precision information such as dimensions and tolerances, which is mainly composed of numbers, English and special symbols in engineering drawing, and there are cases where numbers, English and symbols are represented in irregular arrangements.
[0050] When the information in the drawing is processed automatically as a whole, due to the particularity of the view area information, it is not only easy to confuse the frame area and the view area information, resulting in information recognition / extraction errors, but also, when the natural language model is used for training, because the character types are complex and the training corpus is mixed with a large amount of corpus from the frame area, it makes model training difficult and the model has poor accuracy in recognizing engineering drawing information.
[0051] In this embodiment, based on the information characteristics of the frame area and the view area, by dividing the engineering drawings into the frame area and the view area, and specifically training a text recognition model for identifying the text information in the view area through computer vision and natural language processing, the problem of information recognition / extraction errors caused by confusion between the frame area and the view area information is solved, and the speed and accuracy of extracting drawing processing information is effectively improved, thereby improving the speed of identifying and extracting engineering drawing information, and further improving the speed of quoting to customers based on the drawings.
[0052] refer to Figure 2 In this embodiment, in the drawing division step S1, the drawing frame area and the view area are divided based on the connected domain algorithm combined with the target segmentation model. The specific steps are as follows:
[0053] S1-1, reading engineering drawings; and
[0054] S1-2, segmenting the engineering drawings, dividing the engineering drawings into a frame area and a view area through a connected domain algorithm and a target segmentation model.
[0055] refer to Figure 3 , S1-2 includes the following sub-steps:
[0056] S1-2-1, divide the engineering drawing into multiple connected areas through the connected domain algorithm, calculate the area of the circumscribed rectangle of each connected area, and determine the connected area with the largest circumscribed rectangle area as the drawing frame area.
[0057] Optionally, in S1-1, reading the drawings may specifically include: using OpenCV to read 2D engineering drawings in .png, .jpg and other formats into computer memory.
[0058] Specifically, the basic steps of the connected domain algorithm in this implementation are as follows:
[0059] 1. Initialization:
[0060] Create a labeling matrix of the same size as the input image and initialize it to zeros.
[0061] Set an initial tag value.
[0062] 2. Traverse the image:
[0063] Starting from the upper left corner of the image, go through each pixel one by one.
[0064] 3. Check pixel values:
[0065] If the current pixel belongs to the target region (i.e., non-zero value), check its neighbors (usually above and left):
[0066] If there is a marked pixel in the neighborhood, mark the current pixel with the same value.
[0067] If there is no marked neighbor, mark the current pixel with the new marking value and increase the marking count.
[0068] 4. Merge equivalence classes:
[0069] Because different paths may give different labels to the same area, these equivalence classes need to be merged.
[0070] 5. Second traversal:
[0071] Traverse the entire image and update the label of each pixel to the final label value according to the merged equivalence class.
[0072] 6. Output:
[0073] Returns the marked image, where pixels with the same mark value form a connected area. Correspondingly, multiple connected areas are obtained, and the area of the circumscribed rectangle of each connected area is calculated. Among them, the connected area with the largest circumscribed rectangle area is the frame area.
[0074] S1-2-2, based on the target segmentation model, divide the remaining area outside the frame area obtained in S1-2-1 to obtain the view area and the technical requirement area, and divide the technical requirement area into the frame area.
[0075] At this point, the image segmentation is completed, and the frame area and the view area are obtained.
[0076] Specifically, the target segmentation model in this embodiment can divide the drawing into the following five modules: parts schematic, single view, annotation text such as technical requirements, drawing frame text, and default surface roughness. Among them, parts schematic, single view, drawing frame text, and default surface roughness are all used as view areas, and annotation text such as technical requirements is the technical requirements area, which is part of the drawing frame area.
[0077] The training process of the target segmentation model in this embodiment is as follows:
[0078] 1. Prepare thousands of 2D CAD engineering drawings as data sets, import them into data annotation software, use polygonal box annotation method to select individual elements of each module, and label them accordingly.
[0079] 2. Read the image and the corresponding polygonal cutting box label, and train the target segmentation model until convergence.
[0080] In this implementation manner, the read engineering drawing is divided by combining the connected domain algorithm and the target segmentation model to obtain a drawing frame area and a view area. Figure 4 Complete engineering drawings read for embodiments of the present invention; Figure 5 The frame area is divided in the embodiment of the present invention; Figure 6 It is the divided viewing area in the implementation manner of the present invention.
[0081] like Figure 5 As shown, the frame area includes a connected area with a maximum bounding rectangle obtained by combining a connected domain algorithm with a bounding rectangle area calculation and a technical requirement area obtained by dividing the target segmentation model.
[0082] like Figure 6 As shown, the view area includes the part diagram, single view, frame text and default surface roughness obtained by dividing the target segmentation model.
[0083] In this implementation, the connected area is first divided by the connected domain algorithm and combined with the calculation of the maximum circumscribed rectangle area to obtain the frame area. The target segmentation model only needs to further identify and segment the remaining drawing content after the frame area is divided, which can effectively reduce the training amount of the target segmentation model and realize the division of the frame area and the view area at the same time.
[0084] In the text information recognition step S2, text information of the frame area and the view area are respectively recognized.
[0085] Specifically, in this embodiment, before performing text information recognition, a segmentation-based deep learning text detection model is first used to perform text detection on the engineering drawings. After obtaining multiple rectangular detection frames, if the center point of the rectangular detection frame is located in the view area, it is classified as view text; if the center point of the rectangular detection frame is located in the drawing frame area, it is classified as drawing frame text; if the center point of the rectangular detection frame is not located in any area, it is regarded as invalid text.
[0086] Specifically, the training process of the segmentation-based deep learning text detection model is as follows:
[0087] 1. Prepare thousands of 2D engineering drawings, import them into data labeling software, use the rectangular box labeling method to label all text areas in the drawings, and construct a training dataset for engineering drawing text detection.
[0088] 2. Read the image and the corresponding detection box label, and train the text detection model until convergence.
[0089] In this embodiment, the accuracy of text detection of the above-mentioned trained deep learning text detection model based on segmentation is better than that of mainstream text detection models such as EAST and PSEnet in experiments, and the detection speed is faster. At the same time, compared with the text detection model based on regression, the text detection model based on segmentation has better compatibility with texts of different shapes and is more suitable for the detection of engineering drawings.
[0090] In addition, since the layout of engineering drawing text is relatively special for general documents, the text is distributed irregularly and rotated, and the lines of the parts themselves can easily interfere with text detection. Therefore, in this implementation, an engineering drawing text detection training data set is constructed, and the segmentation-based deep learning text detection model is specifically retrained, which greatly improves the effect of text detection in the engineering drawing scenario.
[0091] refer to Figure 7 In this embodiment, the trained segmentation-based deep learning text detection model can accurately detect the view text and the frame text. The rectangular detection boxes in the dotted area 1 in the figure are all view text boxes, and the rectangular detection boxes in the dotted area 2 are all frame text boxes. After cropping according to the rectangular detection boxes, the frame text pictures and the view text pictures can be obtained correspondingly for identifying the text information in the corresponding areas.
[0092] For frame text images, the text is mostly horizontal Chinese text. In this implementation, an open source Chinese recognition model is directly used for recognition to obtain the text information of the frame area.
[0093] For view text images, a specially trained view text recognition model is used to perform recognition to obtain text information in the view area.
[0094] Previous recognition methods had a low recognition rate for view parts with a large number of special symbols and unconventional layout texts. They were unable to recognize some special symbols such as surface roughness, coaxiality, perpendicularity, parallelism, etc., and were unable to recognize special layouts such as dimensional tolerances and rotated texts.
[0095] In this implementation, based on the particularity of the text in the view area, text information with irregular arrangement order is marked based on its regular arrangement order; at the same time, the corresponding marking text is marked for text information containing special symbols, and a training data set is constructed under the 2D engineering drawing scenario to perform targeted training of the view text recognition model.
[0096] Specifically, when constructing a training data set for the view text recognition model, the text information containing special symbols in the view area is annotated with corresponding marked text, so as to perform targeted training on the view text recognition model for special symbol recognition. As shown in Table 1 below, in this implementation, the marking method for the corresponding marked text for the text information containing special symbols is as follows:
[0097] For the special symbols corresponding to parallelism, position, flatness, perpendicularity, symmetry, roundness, cylindricity, coaxiality, coaxiality, total run-out, surface roughness, reference plane, hole depth symbol, straightness, countersunk hole symbol, and counterbore symbol, the marking texts are $prl$, $lct$, $flt$, $vtc$, $smt$, $cc$, $cyl$, $cax$, $rbt$, $fbt$, $dt$, $bse$A, $dp$, $ln$, $tp$, and $cb$ respectively.
[0098] Table 1
[0099]
[0100]
[0101] In this implementation, each special symbol in the view area is annotated with a corresponding marking text, and a view text recognition model is trained accordingly. By converting the special symbols into corresponding marking text for recognition, the recognition rate of the special symbols can be effectively improved. As shown in Table 2 below, the trained view text recognition model can accurately recognize special symbols and give corresponding text information.
[0102] Table 2
[0103]
[0104] Specifically, in conventional written text, a line of text is generally arranged horizontally and is relatively neat. However, in engineering drawings, non-horizontally arranged text often appears among horizontally arranged characters. Based on the particularity of text in the view area, when constructing the training data set for the view text recognition model, the text information with irregular arrangement order in the view area is annotated based on its regular arrangement order, so as to conduct targeted training on the view text recognition model for the recognition of text with irregular typesetting.
[0105] In this embodiment, the text information with irregular arrangement order is marked based on its regular arrangement order, and is marked by the marking method of left text + space + text below + space + text above. Figure 8 For the text information with irregular arrangement order, the corresponding labeled text is Φ8.000.00+0.03, which makes it a corpus that is easy to identify and train, reduces the difficulty of text recognition model training, and improves the accuracy of text recognition model recognition.
[0106] In this implementation, for text information with irregular arrangement order in the view area, it is annotated based on its regular arrangement order, and the view text recognition model is trained accordingly. By converting the text with irregular arrangement order into the annotated text with regular arrangement for recognition, the recognition rate of the irregular typesetting text can be effectively improved. As shown in Table 2 above, the trained view text recognition model can accurately recognize the text with irregular arrangement order and give the corresponding text information.
[0107] In this implementation, the view text recognition model is a deep learning view text recognition model based on the attention mechanism. The specific training process of the view text recognition model is as follows:
[0108] 1. Prepare about 2,000 2D engineering drawings, import them into data annotation software, use a rectangular frame to frame the text in the view area, and cut out the view text image according to the rectangular frame, annotate each cropped image, and construct a view text training data set. This step only annotates the non-Chinese text in the view area of the drawing. For text information with irregular arrangement order, it is annotated by the annotation method of left text + space + text below + space + text above based on its regular arrangement order; at the same time, for text information containing special symbols, refer to Table 1 to annotate the corresponding marking text.
[0109] 2. Read the cropped view text image and its corresponding annotated text, import them into the view text recognition model and train them until convergence. In this embodiment, for the view text image with rotated text, the cropped image is rotated to horizontal before recognition.
[0110] The view text recognition model obtained after the above targeted training is a special recognition model for engineering graphics based on the attention mechanism model, which can accurately recognize special symbols and unconventional typeset texts in the view area.
[0111] In addition, the above-mentioned view text recognition model has no artificial assumptions or biases about the layout of text. Its multi-head attention encoding / decoding structure can adapt to the unconventional text layout in engineering graphics, solves the recognition problems of special symbols, special layouts and rotated text, and greatly improves the coverage of text recognition.
[0112] At the same time, thanks to the fact that the engineering drawings are divided into the frame area and the view area and then recognized accordingly in this embodiment, the view text recognition model only needs to recognize the text information in the view area, without the need to correspond to a large number of Chinese characters. The number of character sets is reduced by more than 90%, and the cost of training the model is greatly reduced.
[0113] In the text information extraction step S3, the text information of the frame area and the text information of the view area identified in the text information identification step S2 are extracted.
[0114] Specifically, a named entity recognition (NER) model based on sentence transfer and a keyword dictionary filtering method are used to extract text information from the frame area.
[0115] The named entity recognition (NER) model is a system based on word embedding, residual link CNN network, and transfer syntax analysis, which can ensure efficiency under the premise of high accuracy. In this implementation, the named entity recognition (NER) model is first trained in the context of engineering drawings by manually annotating the text in thousands of engineering drawings.
[0116] The annotation method for the named entity recognition (NER) model training data is as follows:
[0117] 1. First, use a rectangular frame to frame the text that belongs to the frame area and mark the corresponding text.
[0118] 2. Then mark the key information to be extracted with the category to which it belongs, refer to Fig. 9 :SUS304 is the material information, which is labeled as "Material", and the number of the part is 4, which is labeled as "Quantity". The BIEO (Begin, Inside, End, Outside) labeling scheme is used for the character sequence.
[0119] 3. Import the training data into the named entity recognition (NER) model and train until convergence.
[0120] Then, using the specially trained named entity recognition (NER) model, the Chinese text information in the frame area is imported into the model for reasoning to obtain the quantity, material, surface treatment, heat treatment, and surface roughness information.
[0121] Furthermore, since the named entity recognition (NER) model often returns multiple words, such as multiple quantities, multiple materials, etc., multiple post-processing methods are used to filter the keywords to obtain the final key information.
[0122] Specifically, for key information such as material, surface treatment, and heat treatment, the following extraction methods are used:
[0123] Taking material information as an example, firstly, the material phrases output by the named entity recognition (NER) model are segmented using a third-party word segmentation library.
[0124] The word segmentation results are then compared with the words in the material dictionary and divided into the following three cases and processed in different ways:
[0125] If the word segmentation result does not contain the keywords in the material dictionary, the phrase will be output as material information or discarded directly according to the confidence level of the phrase given by the model.
[0126] If there is only one word in the material dictionary in the word segmentation result and the phrase confidence is higher than the preset threshold, the word is directly output as the material information.
[0127] If there are multiple words in the material dictionary in the word segmentation result, and the phrase confidence is higher than the preset threshold, all material texts are intercepted and output as material information.
[0128] In this embodiment, in the text information extraction step S3, the text information is extracted by a named entity recognition (NER) model based on sentence transfer, and then further filtered and screened by keyword dictionary filtering and confidence screening, so that the text information of the frame area can be accurately extracted.
[0129] Specifically, for quantity text information, since the quantity is usually pure numbers, it may be confused with other numerical attributes, such as weight, size, etc. Therefore, in the text information extraction step S3, this embodiment proposes a text information post-processing method to correct the quantity value, including the following steps:
[0130] Obtaining a first quantity value returned by the named entity recognition model; and
[0131] If the first quantity value does not exist, the keyword dictionary is used to filter the quantity keywords, and the second quantity value is located and extracted.
[0132] Wherein, “using a keyword dictionary to filter quantity keywords, locate and extract the second quantity value” includes:
[0133] Obtain quantity keyword positions based on the quantity keyword dictionary;
[0134] Filter out the nearest amount of text based on the text box distance and the set adaptive threshold; and
[0135] A quantity value is obtained by using a regular expression as a second quantity value.
[0136] The specific implementation is as follows:
[0137] First, the quantity value returned by the named entity recognition (NER) model is used as the first quantity value.
[0138] Then, use the quantity keyword dictionary, such as "quantity", "qty", "number", etc., to obtain the quantity keyword position, filter out the nearest quantity text according to the text box distance and the set adaptive threshold, and use the regular method to obtain the quantity value as the second quantity value.
[0139] Finally, the first quantity value is preferentially used as the quantity information output, and when the first quantity value does not exist, the second quantity value is substituted and output as the quantity information.
[0140] In this embodiment, by correcting the quantity value information based on the above-mentioned method of quantity keywords and text positions, it is possible to greatly reduce text information extraction errors caused by non-quantity numbers being mistakenly regarded as quantity information.
[0141] Specifically, for the text information in the view area, the view area text has a relatively regular format, and different types of processing information have different standard formats. In this implementation, the annotation feature of following the industrial drawing standard format is used, and a business rule matching method is adopted to match all the annotation texts in the view area through a set of regular expressions to extract the dimensional tolerance, form and position tolerance, hole, and surface roughness information.
[0142] For example, for the recognized parallelism geometric tolerance text “$prl$0.001A”, the regular expression “$prl$[\d\.]+” can be used to match and obtain the parallelism tolerance of 0.001.
[0143] For the recognized surface roughness text "$dt$6.3", the regular expression "$dt$[\d\.]+" can be used to match it, and the surface roughness is obtained as Ra6.3.
[0144] For the linear dimension tolerance text "20-0.01+0.01", the regular expression "[\d\.]+\s[\+\-\d\.]+\s[\+\-\d\.]" can be used to match it, and its linear dimension tolerance is 0.02.
[0145] For the linear dimension tolerance text "20±0.01", the regular expression "[\d\.]+\s±[\d\.]+" can be used to match it, and its linear dimension tolerance is 0.02.
[0146] In this implementation, based on the annotation characteristics of the industrial drawing standard format, a set of regular expressions is designed, which can be matched with the corresponding annotation text of the view area, and can extract the text information of the view area more quickly and accurately.
[0147] This embodiment also provides a text recognition model, which is configured to apply the above-mentioned engineering drawing recognition method to perform engineering drawing recognition.
[0148] This embodiment also provides an OCR (Optical Character Recognition) method, which uses the above-mentioned engineering drawing recognition method to perform engineering drawing recognition.
[0149] This embodiment also provides an electronic device, which applies the above-mentioned engineering drawing recognition method, or is configured with the above-mentioned text recognition model; or uses the above-mentioned OCR method to perform engineering drawing recognition.
[0150] It should be noted that although two-dimensional CAD drawings are used as examples in this embodiment, it is easy to understand that the engineering drawing recognition method provided in this embodiment can also be applied to other types of engineering drawings with the same or similar characteristics as two-dimensional CAD drawings, and they are not listed one by one here.
[0151] So far, the technical solution of the present invention has been described in conjunction with the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to the above-mentioned specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.
Claims
1. A method for identifying engineering drawings, characterized in that: Includes steps: A drawing division step, detecting information of the engineering drawing and dividing the engineering drawing into a drawing frame area and a view area; and a text information recognition step, respectively recognizing text information of the frame area and the view area; Wherein, identifying the text information of the viewing area includes: training a text recognition model for identifying the text information of the viewing area.
2. The engineering drawing recognition method according to claim 1, characterized in that: The drawing division steps include: S1-1, reading the engineering drawing; and S1-2, segmenting the engineering drawing, dividing the engineering drawing into a frame area and a view area through a connected domain algorithm and a target segmentation model.
3. The engineering drawing recognition method according to claim 2, characterized in that: Step S1-1 includes: S1-2-1, dividing the engineering drawing into multiple connected areas by the connected domain algorithm, calculating the circumscribed rectangular area of each connected area, and determining the connected area with the largest circumscribed rectangular area as the drawing frame area; and S1-2-2, based on the target segmentation model, divide the remaining area outside the frame area obtained in S1-2-1 to obtain the view area and the technical requirement area, and divide the technical requirement area into the frame area.
4. The engineering drawing recognition method according to any one of claims 1 to 3, characterized in that: “Training a text recognition model to recognize text information in the view area” includes: For text information with irregular arrangement order, it is annotated based on its regular arrangement order and the text recognition model is trained.
5. The engineering drawing recognition method according to any one of claims 1 to 3, characterized in that: “Training a text recognition model to recognize text information in the view area” includes: For text information containing special symbols, mark the corresponding marking text.
6. The engineering drawing recognition method according to any one of claims 1 to 3, characterized in that: Also includes: The text information extraction step extracts the text information identified in the text information identification step based on a named entity recognition model and a keyword dictionary filtering method.
7. The engineering drawing recognition method according to claim 6, characterized in that: "The text information identified by the text information identification step based on the named entity recognition model and the keyword dictionary filtering method" includes: Obtaining a first quantity value returned by the named entity recognition model; and If the first quantity value does not exist, the keyword dictionary is used to filter quantity keywords to locate and extract the second quantity value.
8. A text recognition model, characterized in that: The method is configured to apply the engineering drawing recognition method described in any one of claims 1 to 7 to perform engineering drawing recognition.
9. An OCR method, characterized in that: The engineering drawing recognition method described in any one of claims 1 to 7 is applied.
10. An electronic device, characterized in that: The engineering drawing recognition method described in any one of claims 1 to 7 is applied, or the text recognition model described in claim 8 is configured; or the OCR method described in claim 9 is used to perform engineering drawing recognition.
Citation Information
Cited By
Engineering drawing intelligent identification system and method based on deep learning
CN120748001A
An intelligent recognition system and method for engineering drawings based on deep learning
CN120748001B
Machining drawing processing information extraction method based on YOLO + OCR
CN121053671A
Hydraulic cylinder structure size identification method and system based on improved YOLOv8
CN122090483A