Automatic annotation methods, equipment and media for engineering drawings
By combining image preprocessing, edge detection, and neural network model feature extraction with natural language processing to construct a labeling rule base and optimize the labeling results, the problem of insufficient flexibility and accuracy in automatic labeling in traditional methods is solved, and efficient, flexible and accurate labeling of engineering drawings is achieved.
Patent Information
- Application Number
- CN202510812730.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-18
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2045-06-18
AI Technical Summary
Traditional 3D software engineering drawings have poor flexibility and accuracy in automatic annotation, making it difficult to adapt to complex engineering drawings and specific industry rules and constraints, and unable to meet diverse needs.
The engineering drawing features are obtained through image preprocessing and edge detection. Feature extraction is performed using a pre-trained neural network model. A labeling rule base is constructed by combining natural language processing, and the labeling results are optimized through post-processing algorithms.
It significantly improves the feature integrity and annotation generalization ability of complex engineering drawings, supports flexible configuration and real-time rule updates, ensures that annotation results meet engineering standards, and improves the accuracy of annotation results and the efficiency of production practice guidance.
Smart Images

Figure CN120340032B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing, specifically to methods, devices, and media for automatic annotation of engineering drawings. Background Art
[0002] The annotations on engineering drawings include information such as dimensions, tolerances, and technical requirements. Accurate and complete annotations are crucial for understanding and implementing engineering designs.
[0003] Currently, the automatic annotation function of traditional 3D software engineering drawings is mainly based on rules to automatically generate annotations. There are few rule options available, and the annotation methods mostly depend on specific engineering drawing formats or predefined rule sets, making it difficult to adjust according to actual needs. This affects the flexibility of annotation and results in the automatic annotation results not being able to efficiently guide actual production.
[0004] With the development of artificial intelligence and natural language processing technologies, the automatic annotation of engineering drawings has become a key requirement for improving design efficiency and quality.
[0005] However, traditional deep learning-based automatic annotation methods are poorly adaptable to annotation rules when faced with complex engineering drawings and specific industry constraints. The flexibility and accuracy of annotation still need to be improved, making it difficult to meet the diverse needs of practical engineering applications. Summary of the Invention
[0006] To address the aforementioned problems, this application proposes an automatic annotation method for engineering drawings, comprising:
[0007] Obtain an engineering drawing, perform image preprocessing on the engineering drawing, and perform edge detection on the engineering drawing to obtain an edge-detected image;
[0008] Image features are obtained by extracting features from the edge detection image using a pre-trained neural network model.
[0009] The image features are labeled according to the labeling rules in the labeling rule library pre-constructed through natural language processing;
[0010] The annotation results are optimized based on post-processing algorithms.
[0011] In one example, the process of building the annotation rule base includes:
[0012] Natural language text used to describe the annotation rules is obtained, and the natural language text is segmented and tagged with parts of speech, and character noise is removed using regular expressions;
[0013] A syntax analysis tree is constructed using a dependency parsing algorithm, and semantic analysis is performed using the syntax analysis tree and a pre-set engineering semantic knowledge base.
[0014] Based on the semantic analysis results and the pre-acquired annotation terms, corresponding annotation rules are generated through predefined rule patterns;
[0015] After the annotation rules are structured, they are stored to build an annotation rule library.
[0016] In one example, the method further includes:
[0017] Periodically determine the activity level of each annotation rule in the annotation rule base;
[0018] Labeling rules with activity levels below a preset threshold will be periodically phased out.
[0019] For the aforementioned engineering drawing, determine whether there is corresponding annotation information;
[0020] If the aforementioned remarks exist, the annotation rules matching the engineering drawing in the annotation rule library are updated based on the remarks.
[0021] In one example, the image features are labeled according to labeling rules in a pre-built labeling rule base constructed through natural language processing, specifically including:
[0022] A labeling rule base is pre-built using natural language processing. Based on the industries corresponding to each labeling rule in the labeling rule base, the labeling feature patterns of each industry are extracted through meta-learning to generate scene feature vectors. The similarity relationship between industries is obtained based on the similarity between the scene feature vectors.
[0023] The designated industry corresponding to the engineering drawing is determined, and the weight between the engineering drawing and each annotation rule is determined based on the similarity relationship between the designated industry and each industry in the annotation rule library.
[0024] Based on the weights, the matching degree between the image features and each annotation rule is calculated, and the image features are annotated according to the annotation rule with the highest matching degree.
[0025] In one example, image preprocessing and edge detection are performed on the engineering drawing to obtain an edge-detected image, specifically including:
[0026] The engineering drawing is converted to a file format to obtain an engineering drawing in a preset file format;
[0027] The engineering drawing is subjected to image noise reduction processing using a filtering algorithm;
[0028] The engineering drawing is processed into a grayscale image.
[0029] An edge detection image is obtained by performing edge detection on the grayscale image using an edge detection algorithm.
[0030] In one example, the training process of the neural network model includes:
[0031] A neural network model is constructed based on a multi-layer convolutional neural network architecture; the neural network model includes convolutional layers, pooling layers, and fully connected layers.
[0032] Engineering drawings were collected as training samples; the training samples included various types and industries.
[0033] Based on the training samples, the cross-entropy loss function is used, and the neural network model is trained using stochastic gradient descent to update the model parameters of the neural network model.
[0034] In one example, the annotation results are optimized based on a post-processing algorithm, specifically including:
[0035] The non-maximum suppression algorithm is used to remove annotation results with an overlap exceeding a preset threshold.
[0036] According to the preset text specifications, the annotation results that do not conform to the text specifications are removed;
[0037] Based on the relationships between the annotation elements in the annotation results, redundant annotation elements are removed;
[0038] The annotation results after removal are verified based on the geometric topological relationships and annotation logic relationships of the engineering drawings.
[0039] In one example, redundant annotation elements are removed based on the relationships between the annotation elements in the annotation results. Specifically, this includes:
[0040] The annotation elements included in the annotation results are determined, and the preset association relationships are determined; the annotation elements include annotation name, annotation symbol, annotation value, and annotation remarks; the association relationships include semantic relationships, geometric topological relationships, and positional relationships;
[0041] Based on the aforementioned positional relationship, determine multiple specified annotation results pointing to the same location in all engineering drawings;
[0042] If a first specified condition or a second specified condition is determined by semantic relationship, then redundant specified labeling results are removed according to the semantic relationship; the first specified condition includes that the similarity between the label name, the label symbol, and the label value is higher than a first preset similarity; the second specified condition includes that the similarity between the label names is higher than a preset similarity, and that at least some of the label symbols, the label values, and the label remarks are different;
[0043] If, by judging through geometric topological relationships, it is determined that there is a geometric inclusion relationship between the annotation name, the annotation symbol, and the annotation value among the multiple specified annotation results, then redundant specified annotation results are removed according to the geometric inclusion relationship.
[0044] On the other hand, this application also proposes an automatic annotation device for engineering drawings, comprising:
[0045] At least one processor; and,
[0046] A memory communicatively connected to the at least one processor; wherein,
[0047] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the automatic drawing annotation method as described in any of the above examples.
[0048] On the other hand, this application also proposes a non-volatile computer storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured as: the automatic annotation method for engineering drawings described in any of the above examples.
[0049] The automatic annotation method for engineering drawings proposed in this application can bring the following beneficial effects:
[0050] 1. By preprocessing images and detecting edges, the structural features of engineering drawings are effectively extracted, significantly improving the feature integrity of complex engineering drawings. This solves the problem of incomplete feature extraction in complex drawings by traditional deep learning methods, providing a more accurate input basis for subsequent annotation.
[0051] 2. By using a pre-trained neural network model to extract features from edge detection images, it breaks through the limitations of traditional rule-based methods that rely on manually defined features. It can automatically learn the visual patterns of dimension lines, tolerance symbols, and technical requirement text in engineering drawings, adapt to diverse engineering drawing formats, and improve the generalization ability of annotation.
[0052] 3. By building an annotation rule base through natural language processing, industry standards and enterprise-defined rules are transformed into dynamically adjustable structured data, supporting flexible configuration of annotation rules. Compared to traditional fixed rule sets, rules can be updated in real time according to actual engineering needs, improving annotation flexibility.
[0053] 4. Based on post-processing algorithms, the annotation results are geometrically constrained and adapted to industry rules to ensure that the annotation results meet engineering standards, avoid problems such as chaotic annotation positions and incorrect symbols in traditional methods, and directly improve the efficiency of the annotation results in guiding production practice. Attached Figure Description
[0054] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0055] Figure 1 This is a flowchart illustrating the automatic annotation method for engineering drawings in the embodiments of this application;
[0056] Figure 2 This is a schematic diagram of the annotation rule setting interface in one scenario of this application embodiment;
[0057] Figure 3 This is a schematic diagram of the automatic annotation device for engineering drawings in the embodiments of this application. Detailed Implementation
[0058] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0059] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.
[0060] like Figure 1 As shown, this application provides an automatic annotation method for engineering drawings, including:
[0061] S101: Obtain the engineering drawing, perform image preprocessing on the engineering drawing, and perform edge detection on the engineering drawing to obtain an edge detection image.
[0062] Engineering drawings are graphic documents that accurately express the technical requirements of engineering design, manufacturing, and construction through standardized diagrams, symbols, and text. Engineering drawings can typically include two-dimensional or three-dimensional images. Two-dimensional images can include side views, sectional views, etc., while three-dimensional images can include images from different perspectives.
[0063] Specifically, image preprocessing is performed first to improve image quality and facilitate subsequent processing.
[0064] Convert the engineering drawings to a predefined file format. For example, use an image format conversion tool to convert the input engineering drawing file (e.g., BMP, TIFF, PDF, DWG, etc.) to a predefined file format (e.g., PNG) to suit subsequent processing.
[0065] Image denoising is performed on engineering drawings using filtering algorithms. For example, Gaussian filtering can be used to denoise the input engineering drawing. The size of the Gaussian filter kernel can be adjusted according to the resolution and noise level of the engineering drawing view. A 3×3 or 5×5 filter kernel can be selected. Convolution operation is then performed on the engineering drawing to effectively extract salt-and-pepper noise and Gaussian noise from the image, making the image smoother.
[0066] The engineering drawing is processed into a grayscale image. The color engineering drawing is converted to a grayscale image using a weighted average method. The calculation formula is: Gray = 0.299×R + 0.587×G + 0.114×B, where R, G, and B are the red, green, and blue components of the color image, respectively.
[0067] Edge detection algorithms are used to perform edge detection on grayscale images to obtain edge-detected images. For example, using the Canny algorithm, with a low threshold of 50 and a high threshold of 150, contour edges in an engineering drawing are detected to obtain an edge-detected image.
[0068] S102: Using a pre-trained neural network model, feature extraction is performed on the edge detection image to obtain image features.
[0069] Deep learning models are used to extract features from the preprocessed engineering drawings. For example, a Convolutional Neural Network (CNN) model can be chosen for feature extraction. After being trained on engineering drawing samples, the CNN model can learn the image feature representations of different elements (such as lines, shapes, text regions, etc.) in the engineering drawing.
[0070] Specifically, the training process of a neural network model includes: constructing a neural network model based on a multi-layer convolutional neural network architecture; wherein the neural network model includes convolutional layers, pooling layers, and fully connected layers. For example, constructing a multi-layer convolutional neural network model, the model contains multiple convolutional layers, pooling layers, and fully connected layers. The convolutional layers use 3×3 convolutional kernels with a stride of 1 and padding of 1 to fully extract local features from the feature map. The pooling layers use max pooling with a 2×2 kernel size and a stride of 2 to reduce the dimensionality of the feature map.
[0071] Engineering drawings are collected as training samples; these samples include various types and industries. The types of engineering drawings can include 2D images and 3D images, and can be further classified, for example, different views of a 2D image can be considered as different types. Industries can include machinery, construction, electronics, chemical, etc.
[0072] Based on the training samples, the cross-entropy loss function is used, and the neural network model is trained using stochastic gradient descent to update the model parameters.
[0073] The training samples have been pre-labeled, and the neural network model is trained using supervised training. Alternatively, at least some of the training samples have been pre-labeled, and the neural network model is trained using self-supervised learning.
[0074] During training, the cross-entropy loss function was used as the optimization objective, and the stochastic parallel gradient descent algorithm (SPGD) was employed for parameter updates, with a learning rate set to 0.001. After multiple rounds of training, the model was able to accurately learn the feature representations of different elements in the engineering drawing.
[0075] S103: The image features are labeled according to the labeling rules in the labeling rule library pre-constructed through natural language processing.
[0076] For annotation rule bases, there are usually some pre-set annotation rules, which are typically based on relevant standards (such as regional standards, industry standards, national standards, international standards, etc.). At this time, users can directly use the annotation rules, modify and improve the existing annotation rules through natural language, or add corresponding annotation rules through relevant standards and natural language.
[0077] A pre-built annotation rule library using natural language processing contains multiple annotation rules. Annotation rules are standardized descriptions used to define the syntactic structure, semantic constraints, and annotation behavior of annotation elements (including annotation names, annotation values, annotation symbols, etc.). They serve as a bridge connecting image recognition results and engineering semantics, ensuring that automatic annotation results conform to industry standards and enterprise specifications. For example, the annotation rule for a chamfer is "Chamfer C + value," and the regular expression for this rule is "Chamfer C\d+". Another example is the annotation rule for a thread, "Thread M [diameter] × [pitch]," and the regular expression for this rule is "Thread M\d+ ×\d+". Here, Chamfer C and Thread M are the annotation names, the values (value, diameter, pitch) are the annotation values, and + and × are the annotation symbols. In some special cases, annotation remarks may also exist, such as for annotations with undetermined values or annotations with multiple names.
[0078] Specifically, the process of building the annotation rule base includes:
[0079] The process involves acquiring natural language text describing the annotation rules, performing word segmentation and part-of-speech tagging on the text, and then using regular expressions for character denoising. The natural language text can be obtained from relevant knowledge bases, manuals, or expert experience, and it describes the annotation rules in natural language.
[0080] Word segmentation and part-of-speech tagging can be performed using open-source natural language processing toolkits. Noise characters, such as HTML tags and special punctuation, can be removed by writing regular expressions. For example, in Python, a regular expression could be: `r[^a-zA-Z0-0\s]`.
[0081] A parse tree is constructed using a dependency parsing algorithm, and semantic analysis is performed using this parse tree and a pre-defined engineering semantic knowledge base. The dependency parsing algorithm primarily analyzes the grammatical dependencies between words in a sentence (e.g., subject-verb, verb-object), and displays the sentence structure by constructing the parse tree. The semantic knowledge base contains common engineering terms, concepts, and their relationships.
[0082] Based on the semantic analysis results and pre-acquired annotation terms, corresponding annotation rules are generated using predefined rule patterns. Annotation terms can be obtained from an engineering semantic knowledge base, primarily targeting fields such as mechanical engineering and architecture. These include common industry annotation terms and expressions such as "Chamfer C [numerical value]" and "Thread M [numerical value] × [pitch]". Taking "Chamfer C [numerical value]" as an example, the rule pattern is defined in the rule base as representing the chamfer dimension, with the syntax "Chamfer C + numerical value". The annotation type is chamfer annotation.
[0083] After structuring the annotation rules, a rule library is built. For example, all defined annotation rules can be stored in a database in a structured manner, with the rule library stored in XML or JSON format for easy maintenance and expansion.
[0084] Furthermore, to ensure the real-time nature of the annotation rule base, a dynamic update capability can be configured. The activity level of each annotation rule in the rule base should be determined periodically. Activity level can be obtained through metrics such as matching success rate and user adoption rate.
[0085] For the engineering drawings, determine whether there are corresponding annotations, which are usually provided by the user in natural language.
[0086] If annotation information exists, the annotation rules matching the engineering drawing in the annotation rule base are updated based on this information. Using a method similar to that used when building the annotation rule base, natural language processing is performed on the annotation information to combine it with the successfully matched annotation rules for updating, thus further enabling dynamic updates. The updated annotation rules can coexist with the original annotation rules, allowing the user to choose which to use during matching, or they can override the original annotation rules.
[0087] like Figure 2 As shown, some annotation rules from the annotation rule library are provided, where you can set the content of each annotation size. For example, you can set the annotation style and format such as font, arrow type, and text distance used by the annotation rule, and you can also set different annotation elements such as annotations (corresponding to annotation names) and dimensions (corresponding to annotation values).
[0088] After obtaining the semantic analysis results, they can be structured and matched one by one with the rules in the annotation rule base to determine which annotation rule is matched. If the corresponding annotation rule is matched, the image can be annotated according to that annotation rule and the relevant feature values obtained from the image features.
[0089] Of course, if the semantic analysis result does not match the corresponding annotation rule, it can be added to the annotation rule library as a new annotation rule.
[0090] During automatic annotation, the neural network model identifies elements and geometric features in the view and annotates them according to matching annotation rules. For example, based on image features, the coordinates of key points are identified, and then specific dimensions are calculated geometrically. This supplements and limits the specific values of each annotation element in the annotation rules, and automatic annotation is achieved according to the font, arrow type, etc., specified in the annotation rules. Of course, annotation styles and formats such as font and arrow type can be customized according to engineering standards.
[0091] S104: Optimize the annotation results based on post-processing algorithms.
[0092] After obtaining the annotation results, the automatically generated annotations can be optimized by using post-processing algorithms to remove unreasonable annotations (such as annotations that are too small or too large, or overlapping annotations). Furthermore, a manual review step can be added. For example, manual review can be triggered for annotations with a confidence level below a certain value (e.g., set to 0.7). The confidence level can represent indicators such as the reliability and degree of overlap of the annotation result.
[0093] Specifically, during the optimization process, non-maximum suppression (NMS) is used to remove annotations with an overlap exceeding a preset threshold. For example, if the preset threshold is set to 0.5, when removing annotations with excessive overlap, either one can be randomly selected for removal, or these annotations can be shifted.
[0094] According to preset text specifications, annotation results that do not conform to the text specifications are removed. Text specifications may include: font size, font type, etc. Annotation results that are too small or too large are removed.
[0095] Based on the relationships between the annotation elements in the annotation results, redundant annotation elements are removed. This involves determining that the annotation results include multiple annotation elements and establishing pre-defined relationships. Annotation element types include annotation name, annotation symbol, annotation value, and annotation remarks. Relationships include semantic relationships, geometric topological relationships, and positional relationships. Semantic relationships describe the target annotated by the annotation result; geometric topological relationships describe whether the annotation result is connected or contained to other annotation results; and positional relationships describe the location corresponding to the annotation result.
[0096] Based on positional relationships, identify multiple specified annotations pointing to the same location across all engineering drawings. Whether an annotation points to the same location can be determined by the direction of the arrow within the annotation. If the areas pointed to by the arrows have a high degree of overlap, they can be considered to point to the same location.
[0097] For these multiple specified annotation results, the semantic relationship is used to determine whether there is a first specified case or a second specified case among the multiple specified annotation results. Then, the redundant specified annotation results are removed according to the semantic relationship.
[0098] The first specified case includes situations where the similarity between the label name, label symbol, and label value is all higher than the first preset similarity. In this case, it is considered that there are duplicate labels, and the redundant specified label results can be removed.
[0099] The second specified situation includes cases where the similarity between label names is higher than the preset similarity, and at least some of the label symbols, label values, and label notes are different. These differences can include: opposite label symbols, different label values, different label notes, etc. In this case, contradictory labeling is considered to exist, where the same dimension is simultaneously labeled with multiple values. When removing redundant values, image features can be analyzed again to obtain and retain the correct labeling result, or it can be handled manually.
[0100] A third specified case can also be determined through geometric topological relationships. In this case, if a geometric inclusion relationship exists between the annotation name, annotation symbol, and annotation value among multiple specified annotation results, then it is determined to belong to the third specified case. The third specified case corresponds to the repetitive annotation of implicit dimensions. For example, there are three annotation results: annotation result A, annotation result B, and annotation result C, used to annotate the lengths of line segments A, B, and C respectively. Line segment C is obtained by combining line segments A and B. In this case, the sum of the lengths of each segment (line segment A and line segment B) equals the total length (line segment C), resulting in redundant annotations. In this situation, redundant specified annotation results can be removed based on geometric inclusion relationships. This can be done by removing the annotation results of the segments or removing the annotation results of the total length, depending on the requirements.
[0101] After removing redundant annotations, the results can be re-verified based on the geometric topology and annotation logic of the engineering drawing. The annotation logic can consist of semantic and positional relationships, used to describe whether each semantically specified position conforms to the corresponding logic.
[0102] 1. By preprocessing images and detecting edges, the structural features of engineering drawings are effectively extracted, significantly improving the feature integrity of complex engineering drawings. This solves the problem of incomplete feature extraction in complex drawings by traditional deep learning methods, providing a more accurate input basis for subsequent annotation.
[0103] 2. By using a pre-trained neural network model to extract features from edge detection images, it breaks through the limitations of traditional rule-based methods that rely on manually defined features. It can automatically learn the visual patterns of dimension lines, tolerance symbols, and technical requirement text in engineering drawings, adapt to diverse engineering drawing formats, and improve the generalization ability of annotation.
[0104] 3. By building an annotation rule base through natural language processing, industry standards and enterprise-defined rules are transformed into dynamically adjustable structured data, supporting flexible configuration of annotation rules. Compared to traditional fixed rule sets, rules can be updated in real time according to actual engineering needs, improving annotation flexibility.
[0105] 4. Based on post-processing algorithms, the annotation results are geometrically constrained and adapted to industry rules to ensure that the annotation results meet engineering standards, avoid problems such as chaotic annotation positions and incorrect symbols in traditional methods, and directly improve the efficiency of the annotation results in guiding production practice.
[0106] In one embodiment, since the annotation rule base contains annotation rules for various industries, during matching, there may be annotation rules from other industries that match similarly. Directly using such annotation rules may cause the annotation to fail.
[0107] Based on this, after pre-constructing a labeling rule base using natural language processing, the labeling feature patterns of each industry corresponding to the labeling rules in the rule base are extracted through meta-learning to generate scene feature vectors. Industries can be manually categorized and added via labels when setting labeling rules; these industries can include machinery, construction, electronics, etc.
[0108] Meta-learning can employ a Model-Agnostic Meta-Learning (MAML) architecture to preprocess the collected samples and perform statistical analysis on annotation patterns for engineering drawings in the mechanical, architectural, and electronic industries. For example, in the mechanical industry, high-frequency annotation types include chamfers, threads, and geometric tolerances; in the architectural industry, annotation spatial distribution characteristics include floor elevations and axis dimension chains; and in the electronic industry, special symbol annotations include pad dimensions and pin numbers.
[0109] For different industries, N industries are randomly selected as tasks. Each task corresponds to a support set and a query set for meta-training. At this time, contrastive loss is used to force the feature vectors of samples in the same industry to be similar, while the vectors of cross-industry samples are significantly different.
[0110] After the training is completed, the meta-model is retained and used to identify scene feature vectors corresponding to different industries.
[0111] At this point, the similarity between different industries is determined based on the similarity between the scene feature vectors. The higher the similarity between any two industries, the closer the similarity between them is considered to be.
[0112] The designated industry corresponding to the engineering drawing is determined, and the weight between the engineering drawing and each annotation rule is determined based on the similarity relationship between the designated industry and other industries in the annotation rule library. It is generally assumed that the weight corresponding to the designated industry is 1. Among other industries in the annotation rule library, the closer the similarity relationship, the higher the corresponding weight, up to a maximum of 1.
[0113] At this point, based on the weights, the matching degree between the image features and each annotation rule is calculated, and the image features are labeled according to the annotation rule with the highest matching degree. For example, the matching degree can be calculated directly based on the annotation rule and the image features. After calculating the matching degree, a weighted average is performed according to the weights to obtain the annotation rule with the highest matching degree, which is then used for annotation.
[0114] like Figure 3 As shown in the embodiments of this application, an automatic annotation device for engineering drawings is also proposed, comprising:
[0115] At least one processor; and,
[0116] A memory communicatively connected to the at least one processor; wherein,
[0117] The memory stores instructions that can be executed by the at least one processor, which, when executed, enable the at least one processor to perform the automatic drawing annotation method as described in any of the above embodiments.
[0118] This application also proposes a non-volatile computer storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured as the automatic annotation method for engineering drawings described in any of the above embodiments.
[0119] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device and medium embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the description of the method embodiments.
[0120] The devices and media provided in this application are one-to-one with the methods. Therefore, the devices and media also have similar beneficial technical effects as their corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.
[0121] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. An automatic annotation method for engineering drawings, characterized in that, include: Obtain an engineering drawing, perform image preprocessing on the engineering drawing, and perform edge detection on the engineering drawing to obtain an edge-detected image; Image features are obtained by extracting features from the edge detection image using a pre-trained neural network model. The image features are labeled according to the labeling rules in the labeling rule library pre-constructed through natural language processing; The annotation results are optimized based on post-processing algorithms; The construction process of the annotation rule base includes: Natural language text used to describe the annotation rules is obtained, and the natural language text is segmented and tagged with parts of speech, and character noise is removed using regular expressions; A syntax analysis tree is constructed using a dependency parsing algorithm, and semantic analysis is performed using the syntax analysis tree and a pre-set engineering semantic knowledge base. Based on the semantic analysis results and the pre-acquired annotation terms, corresponding annotation rules are generated through predefined rule patterns; After structuring the annotation rules, store them to build an annotation rule library; After obtaining and structuring the semantic analysis results, they are matched one by one with the rules in the annotation rule base to determine which annotation rule is matched. If the corresponding annotation rule is matched, the image is annotated according to the annotation rule and the relevant feature values obtained from the image features. If the semantic analysis result does not match the corresponding annotation rule, it is added to the annotation rule base as a new annotation rule. Based on the image features, the coordinate information of each key point is identified, and then the specific size values are obtained through geometric calculations. The specific values of each annotation element in the annotation rule are supplemented and limited, and automatic annotation is achieved according to the font and arrow type specified in the annotation rule. The method further includes: Periodically determine the activity level of each annotation rule in the annotation rule base; Labeling rules with activity levels below a preset threshold will be periodically phased out. For the aforementioned engineering drawing, determine whether there is corresponding annotation information; If the aforementioned remarks exist, the annotation rules that match the engineering drawing in the annotation rule library are updated according to the aforementioned remarks. The annotation results are optimized based on post-processing algorithms, specifically including: The non-maximum suppression algorithm is used to remove annotation results with an overlap exceeding a preset threshold. According to the preset text specifications, the annotation results that do not conform to the text specifications are removed; Based on the relationships between the annotation elements in the annotation results, redundant annotation elements are removed; The annotation results after removal are verified based on the geometric topological relationships and annotation logic relationships of the engineering drawings; Based on the relationships between the annotation elements in the annotation results, redundant annotation elements are removed, specifically including: The annotation elements included in the annotation results are determined, and the preset association relationships are determined; the annotation elements include annotation name, annotation symbol, annotation value, and annotation remarks; the association relationships include semantic relationships, geometric topological relationships, and positional relationships; Based on the aforementioned positional relationship, determine multiple specified annotation results pointing to the same location in all engineering drawings; If a first specified condition or a second specified condition is determined by semantic relationship, then redundant specified labeling results are removed according to the semantic relationship; the first specified condition includes that the similarity between the label name, the label symbol, and the label value is higher than a first preset similarity; the second specified condition includes that the similarity between the label names is higher than a preset similarity, and that at least some of the label symbols, the label values, and the label remarks are different; If, by judging through geometric topological relationships, it is determined that there is a geometric inclusion relationship between the annotation name, the annotation symbol, and the annotation value among the multiple specified annotation results, then redundant specified annotation results are removed according to the geometric inclusion relationship.
2. The automatic annotation method for engineering drawings according to claim 1, characterized in that, The image features are labeled according to the labeling rules in the pre-constructed labeling rule base built through natural language processing, specifically including: A labeling rule base is pre-built using natural language processing. Based on the industries corresponding to each labeling rule in the labeling rule base, the labeling feature patterns of each industry are extracted through meta-learning to generate scene feature vectors. The similarity relationship between industries is obtained based on the similarity between the scene feature vectors. The designated industry corresponding to the engineering drawing is determined, and the weight between the engineering drawing and each annotation rule is determined based on the similarity relationship between the designated industry and each industry in the annotation rule library. Based on the weights, the matching degree between the image features and each annotation rule is calculated, and the image features are annotated according to the annotation rule with the highest matching degree.
3. The automatic annotation method for engineering drawings according to claim 1, characterized in that, The process includes image preprocessing of the engineering drawing and edge detection of the engineering drawing to obtain an edge-detected image, specifically including: The engineering drawing is converted to a file format to obtain an engineering drawing in a preset file format; The engineering drawing is subjected to image noise reduction processing using a filtering algorithm; The engineering drawing is processed into a grayscale image. An edge detection image is obtained by performing edge detection on the grayscale image using an edge detection algorithm.
4. The automatic annotation method for engineering drawings according to claim 1, characterized in that, The training process of the neural network model includes: A neural network model is constructed based on a multi-layer convolutional neural network architecture; the neural network model includes convolutional layers, pooling layers, and fully connected layers. Engineering drawings were collected as training samples; the training samples included various types and industries. Based on the training samples, the cross-entropy loss function is used, and the neural network model is trained using stochastic gradient descent to update the model parameters of the neural network model.
5. An automatic annotation device for engineering drawings, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the automatic drawing annotation method as described in any one of claims 1 to 4.
6. A non-volatile computer storage medium storing computer-executable instructions, characterized in that, The computer-executable instructions are set to: the automatic annotation method for engineering drawings as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Automatic image labeling method, device and equipment and computer readable storage medium
CN110110800A