Engineering drawing automatic labeling method and device and medium
Through image preprocessing and edge detection combined with neural network model and natural language processing, the annotation rule library is constructed, and the annotation results are optimized, which solves the problem of insufficient flexibility and accuracy in traditional methods, and realizes efficient automatic annotation of engineering drawings.
Patent Information
- Application Number
- CN202510812730.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-18
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2045-06-18
AI Technical Summary
The automatic labeling function of traditional three-dimensional software engineering drawings has poor flexibility and accuracy, making it difficult to adapt to complex engineering drawings and specific industry rules constraints, affecting actual production guidance.
The graphics features are obtained through image preprocessing and edge detection, and feature extraction is performed using pre-trained neural network models, and the labeling rules library is constructed in combination with natural language processing, and the labeling results are optimized through post-processing algorithms.
It significantly improves the feature integrity of the engineering drawings and the generalization ability of labeling, ensures that the labeling results meet engineering standards, improves the flexibility and accuracy of labeling, and guides the efficiency of production practice.
Smart Images

Figure CN120340032A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing, and particularly to an automatic engineering drawing annotation method, device, and medium. Background Art
[0002] The annotation of engineering drawings includes information such as dimension annotation, tolerance annotation, and technical requirements. Accurate and complete annotation is crucial for understanding and implementing engineering designs.
[0003] Currently, the automatic annotation function of traditional 3D software engineering drawings mainly generates annotations automatically based on rules. There are few selectable rule items, and most annotation methods rely on specific engineering drawing formats or predefined rule sets, making it difficult to adjust according to actual needs, affecting the flexibility of annotation and resulting in the inability of the automatic annotation results to efficiently guide actual production.
[0004] With the development of artificial intelligence technology and natural language processing technology, realizing 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 have poor adaptability to annotation rules when faced with complex engineering drawings and specific industry rule constraints. The flexibility and accuracy of annotation still need to be improved, and it is difficult to meet the diverse needs of actual engineering applications. Summary of the Invention
[0006] To solve the above problems, this application proposes an automatic engineering drawing annotation method, including: Obtain an engineering drawing, perform image preprocessing on the engineering drawing, and perform edge detection on the engineering drawing to obtain an edge detection image; Extract features according to the edge detection image through a pre-trained neural network model to obtain image features; Annotate the image features according to the annotation rules in the annotation rule library constructed in advance through natural language processing; Optimize the annotation result based on a post-processing algorithm.
[0007] In one example, the construction process of the annotation rule library includes: Obtain natural language text for describing annotation rules, perform word segmentation and part-of-speech tagging on the natural language text, and perform character denoising through regular expressions; Construct a syntax analysis tree through a dependency syntax analysis algorithm, and perform semantic analysis through the syntax analysis tree and a pre-set engineering semantic knowledge base; Generate corresponding annotation rules according to the semantic analysis results and pre-obtained annotation terms through a predefined rule pattern; After structuring the annotation rules, store them to build an annotation rule library.
[0008] In one example, the method further includes: Regularly determine the activity of each annotation rule in the annotation rule library; Regularly eliminate the annotation rules whose activity is lower than a preset level; Determine whether there is corresponding note information for the engineering drawing; If there is the note information, update the annotation rules matched by the engineering drawing in the annotation rule library according to the note information.
[0009] In one example, annotating the image features according to the annotation rules in the annotation rule library constructed in advance through natural language processing specifically includes: Construct an annotation rule library in advance through natural language processing, extract the annotation feature patterns of each industry based on the industries corresponding to each annotation rule in the annotation rule library, generate scene feature vectors, and obtain the similarity relationships between industries according to the similarities between the scene feature vectors; Determine the specified industry corresponding to the engineering drawing, and determine the weights between the engineering drawing and each annotation rule according to the similarity relationships between the specified industry and each industry in the annotation rule library; Based on the weights, calculate the matching degrees between the image features and each annotation rule, and annotate the image features according to the annotation rule with the highest matching degree.
[0010] In one example, performing image preprocessing on the engineering drawing and performing edge detection on the engineering drawing to obtain an edge detection image specifically includes: Convert the file format of the engineering drawing to obtain an engineering drawing in a preset file format; Perform image noise reduction processing on the engineering drawing through a filtering algorithm; Perform grayscale processing on the engineering drawing to obtain a grayscale processed image; Perform edge detection on the grayscale processed image through an edge detection algorithm to obtain an edge detection image.
[0011] In one example, the training process of the neural network model includes: Build a neural network model based on a multi-layer convolutional neural network architecture; the neural network model includes a convolutional layer, a pooling layer, and a fully connected layer; Collect engineering drawings as training samples; the training samples include multiple types and multiple industries; Based on the training samples, use the cross-entropy loss function and train the neural network model by the stochastic gradient descent method to update the model parameters of the neural network model.
[0012] In one example, based on a post-processing algorithm, optimize the annotation results, specifically including: Remove the annotation results with an overlap degree higher than a preset threshold through the non-maximum suppression algorithm; Remove the annotation results that do not conform to the preset text specifications according to the preset text specifications; Remove redundant annotation elements according to the association relationship between the annotation elements in the annotation results; Verify the removed annotation results based on the geometric topological relationship and annotation logical relationship of the engineering drawing.
[0013] In one example, remove redundant annotation elements according to the association relationship between the annotation elements in the annotation results, specifically including: Determine the annotation elements included in the annotation results and determine the preset association relationship; the annotation elements include annotation names, annotation symbols, annotation values, and annotation remarks; the association relationship includes semantic relationship, geometric topological relationship, and position relationship; Based on the position relationship, determine multiple specified annotation results pointing to the same position in all engineering drawings; If it is determined through the semantic relationship that there is a first specified situation or a second specified situation in the multiple specified annotation results, then remove the redundant specified annotation results according to the semantic relationship; the first specified situation includes that the similarities between the annotation name, the annotation symbol, and the annotation value are all higher than a first preset similarity; the second specified situation includes that the similarity between the annotation names is higher than the preset similarity, and at least some of the annotation symbols, annotation values, and annotation remarks are different; If it is determined through the geometric topological relationship that there is a geometric inclusion relationship between the annotation name, the annotation symbol, and the annotation value in the multiple specified annotation results, then remove the redundant specified annotation results according to the geometric inclusion relationship.
[0014] On the other hand, the present application also proposes an engineering drawing automatic annotation device, including: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the engineering drawing automatic annotation method as described in any of the above examples.
[0015] On the other hand, the present application also proposes a non-volatile computer storage medium storing computer-executable instructions, and the computer-executable instructions are configured as: the engineering drawing automatic annotation method described in any of the above examples.
[0016] The engineering drawing automatic annotation method proposed by the present application can bring the following beneficial effects: 1. Through image preprocessing and edge detection, the structural features of the engineering drawing are effectively extracted, significantly improving the feature integrity of complex engineering drawings, solving the problem of incomplete feature extraction of traditional deep learning methods in complex drawings, and providing a more accurate input basis for subsequent annotation.
[0017] 2. Using a pre-trained neural network model to extract features from the edge-detected image, breaking through the limitation of traditional rule methods that rely on manually defined features, being able to automatically learn the visual patterns of dimension lines, tolerance symbols, and technical requirement texts in engineering drawings, adapting to diverse engineering drawing formats, and improving the generalization ability of annotation.
[0018] 3. By constructing an annotation rule library through natural language processing, converting industry standards and enterprise-customized rules into dynamically adjustable structured data, supporting flexible configuration of annotation rules. Compared with traditional fixed rule sets, the rules can be updated in real time according to actual engineering needs, improving the flexibility of annotation.
[0019] 4. Based on a post-processing algorithm, geometric constraint verification and industry rule adaptation are performed on the annotation results to ensure that the annotation results meet engineering standards, avoiding problems such as chaotic annotation positions and incorrect symbols in traditional methods, and directly improving the guiding efficiency of the annotation results for production practice. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The drawings described herein are used to provide a further understanding of the present application, and constitute a part of the present application. The schematic embodiments of the present application and their descriptions are used to explain the present application, and do not constitute an improper limitation of the present application. In the drawings: Figure 1 is a schematic flow chart of the engineering drawing automatic annotation method in an embodiment of the present application; Figure 2 is a schematic diagram of the setting interface of annotation rules in a certain situation in an embodiment of the present application; Figure 3 is a schematic diagram of the engineering drawing automatic annotation device in an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0021] 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 of this application and the corresponding drawings. Apparently, the described embodiments are only a part of the embodiments of this application, rather than all of them. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this application without creative efforts belong to the scope of protection of this application.
[0022] The following will detail the technical solutions provided by each embodiment of this application in conjunction with the drawings.
[0023] As Figure 1 shown, the embodiments of this application provide an automatic dimensioning method for engineering drawings, including: S101: Obtain an engineering drawing, perform image preprocessing on the engineering drawing, and perform edge detection on the engineering drawing to obtain an edge detection image.
[0024] An engineering drawing is a graphical file that precisely expresses technical requirements such as engineering design, manufacturing, and construction through standardized diagrams, symbols, and text. Engineering drawings can generally include forms of two-dimensional images and three-dimensional images. Among them, two-dimensional images can include views of each side, sectional views, etc., while three-dimensional images can include images from different perspectives.
[0025] Specifically, first perform image preprocessing to improve the image quality for subsequent processing.
[0026] Convert the file format of the engineering drawing to obtain an engineering drawing in a preset file format. For example, use an image format conversion tool to convert the input engineering drawing file (such as BMP, TIFF, PDF, DWG, etc. formats) to a preset file format (such as PNG format) to adapt to subsequent processing.
[0027] Perform image noise reduction processing on the engineering drawing through a filtering algorithm. For example, use a Gaussian filtering algorithm to perform noise reduction on the input engineering drawing. The size of the Gaussian filter kernel is adjusted according to the resolution and noise situation of the engineering drawing view. A 3×3 or 5×5 filter kernel can be selected to perform a convolution operation on the engineering drawing to effectively remove salt-and-pepper noise and Gaussian noise in the image and make the image smoother.
[0028] Perform grayscale processing on the engineering drawing to obtain a grayscale processed image. Convert the color engineering drawing to a grayscale image using the weighted average method. The calculation formula can be: 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.
[0029] Through an edge detection algorithm, edge detection is performed on the grayscale processed image to obtain an edge detection image. For example, through the Canny algorithm, setting the low threshold to 50 and the high threshold to 150, the contour edges in the engineering drawing are detected to obtain an edge detection image.
[0030] S102: Through a pre-trained neural network model, image features are extracted according to the edge detection image to obtain image features.
[0031] A deep learning model is used to extract features from the preprocessed engineering drawing. For example, a Convolutional Neural Networks (CNN) model is selected for feature extraction. The CNN model is trained with engineering drawing samples and can learn the image feature representations of different elements (such as lines, shapes, text regions, etc.) in the engineering drawing.
[0032] Specifically, the training process of the neural network model includes: constructing a neural network model based on a multi-layer convolutional neural network architecture; among them, the neural network model includes a convolutional layer, a pooling layer, and a fully connected layer. For example, a multi-layer convolutional neural network model is constructed, and the model contains multiple convolutional layers, pooling layers, and fully connected layers. The convolutional layer uses a 3×3 convolutional kernel, a stride of 1, and a padding of 1 to fully extract the local features of the engineering drawing. The pooling layer uses max pooling, the pooling kernel size is 2×2, and the stride is 2 to reduce the dimension of the feature map.
[0033] Engineering drawings are collected as training samples; the training samples include various types and various industries. The types of engineering drawings can include two-dimensional images, three-dimensional images, and can be further classified. For example, different views of two-dimensional images are regarded as different types. The industries can include the mechanical industry, the construction industry, the electronics industry, the chemical industry, etc.
[0034] Based on the training samples, the cross-entropy loss function is used, and the neural network model is trained by the stochastic gradient descent method to update the model parameters of the neural network model.
[0035] The training samples have been pre-annotated, and the neural network model is trained in a supervised training manner. Or, at least some of the training samples have been pre-annotated, and the neural network model is trained in a self-supervised learning manner.
[0036] During the training process, the cross-entropy loss function is used as the optimization target, and the stochastic parallel gradient descent algorithm (SPGD) is used for parameter update, and the learning rate is set to 0.001. After multiple rounds of training, the model can accurately learn the feature representations of different elements in the engineering drawing.
[0037] S103: Annotate the image features according to the annotation rules in the annotation rule library pre - constructed through natural language processing.
[0038] For the annotation rule library, some annotation rules are usually preset in it. These annotation rules are usually formed based on corresponding standards (such as regional standards, industry standards, national standards, international standards, etc.). At this time, users can directly use these annotation rules, or modify and improve the obtained annotation rules through natural language, or add corresponding annotation rules through corresponding standards and natural language.
[0039] The annotation rule library pre - constructed through natural language processing contains multiple annotation rules. Annotation rules are the standardized descriptions of the syntactic structure, semantic constraints, and annotation behaviors for defining annotation elements (including annotation names, annotation values, annotation symbols, etc.). It is the bridge connecting the image recognition results and engineering semantics, ensuring that the automatic annotation results conform to industry standards and enterprise specifications. For example, the annotation rule corresponding to chamfer annotation is "Chamfer C + value", and the regular expression of this annotation rule is "Chamfer C\d+"; also, for example, the annotation rule for thread annotation is "Thread M [diameter] × [pitch]", and the regular expression of this annotation rule is "Thread M\d+×\d+"; among them, Chamfer C and Thread M are annotation names, value, diameter, and pitch are annotation values, and + and × are annotation symbols. In some special cases, there may also be annotation remarks, such as for some annotations with undetermined values, or for some annotations with multiple names.
[0040] Specifically, the construction process of the annotation rule library includes: Obtain the natural - language text used to describe the annotation rules, perform word - segmentation processing and part - of - speech tagging on the natural - language text, and remove noise characters through regular expressions. The acquisition of the natural - language text can be obtained through the corresponding knowledge base, work manual, or expert experience, which describes the corresponding annotation rules in the way of natural language.
[0041] Word - segmentation and part - of - speech tagging can be performed through an open - source natural - language processing toolkit. Write regular expressions to remove noise characters, such as HTML tags, special punctuation, etc. Taking Python as an example, the regular expression can be: r[^a-zA-Z0 - 0\s].
[0042] Construct a syntactic analysis tree through the dependency parsing algorithm, and perform semantic analysis through the syntactic analysis tree and a pre-set engineering semantic knowledge base. Among them, the dependency parsing algorithm is mainly used to analyze the syntactic dependency relationships between words in a sentence (such as subject-predicate, verb-object, etc.), and display the structure of the sentence by constructing a syntactic analysis tree. The semantic knowledge base contains common terms, concepts and their relationships in the engineering field.
[0043] According to the semantic analysis results and the pre-acquired labeled terms, generate corresponding labeling rules through pre-defined rule patterns. The labeled terms can be obtained from the engineering semantic knowledge base, which mainly targets fields such as mechanical engineering and architecture, and mainly includes common labeling terms and expressions in the industry such as "Chamfer C[value]" and "Thread M[value]×[pitch]". Taking "Chamfer C[value]" as an example, the semantic of this rule is defined in the rule base as representing the chamfer size, and the syntactic structure is "Chamfer C + value". The labeling type is chamfer labeling.
[0044] After structuring the labeling rules, store them to build a labeling rule base. For example, store all the defined labeling rules in a structured manner in a database, and the rule base is stored in XML or JSON format for easy maintenance and extension.
[0045] Furthermore, in order to ensure the real-time nature of the labeling rule base, corresponding dynamic update capabilities can be set. Regularly determine the activity of each labeling rule in the labeling rule base. The activity can be obtained through indicators such as the matching success rate and the user adoption rate.
[0046] For engineering drawings, determine whether there is corresponding note information, which is usually natural language provided by users.
[0047] If there is note information, update the labeling rules matched by the engineering drawing in the labeling rule base according to the note information. Through a similar method as when establishing the labeling rule base, perform natural language analysis on the note information, so as to combine it with the successfully matched labeling rules for update, thereby further realizing the dynamic update capability. The updated labeling rules can coexist with the original labeling rules, and the user can choose which one to use during matching, or the original labeling rules can be overwritten.
[0048] As Figure 2 shown, some labeling rules in the labeling rule base are provided, where the content of each labeling dimension can be set. For example, the font, arrow type, text distance and other labeling styles and formats used by the labeling rules can be set, and different labeling elements such as annotations (corresponding to the labeling name) and dimensions (corresponding to the labeling value) can also be set.
[0049] After obtaining the semantic analysis result, it can be structured and then matched one by one with the rules in the annotation rule library to determine which annotation rule is hit. If the corresponding annotation rule is hit, the image can be annotated according to this annotation rule in combination with the relevant feature values obtained from the image features.
[0050] Of course, if the semantic analysis result does not hit the corresponding annotation rule, it can be used as a new annotation rule and added to the annotation rule library.
[0051] During the automatic annotation process, the image features such as the elements and geometry recognized in the neural network model are annotated according to the matching annotation rules. For example, according to the image features, the coordinate information of each key point is recognized, and then the specific size value is obtained through geometric calculation, so as to supplement and limit the specific values of each annotation element in the annotation rule, and the automatic annotation is realized according to the font, arrow type, etc. specified in the annotation rule. Of course, the annotation styles and formats such as font and arrow type can be customized according to engineering standards.
[0052] S104: Optimize the annotation result based on the post-processing algorithm.
[0053] After obtaining the annotation result, the annotation result of automatic annotation can also be optimized, and unreasonable annotations (such as too small or too large annotation text, overlapping annotations, etc.) can be removed through some post-processing algorithms. Among them, corresponding manual review steps can also be added. For example, for some annotation results with a confidence level lower than a certain value (such as set to 0.7), manual review is triggered. The confidence level can represent indicators such as the credibility and overlapping degree of the annotation result.
[0054] Specifically, during the optimization process, through the Non-Maximum Suppression (NMS) algorithm, the annotation results with an overlapping degree higher than the preset threshold are removed. For example, set the preset threshold to 0.5. When removing the annotation results with too high an overlapping degree, any one of them can be selected for removal, or these annotation results can be displaced.
[0055] According to the preset text specifications, the annotation results that do not conform to the text specifications are removed. The text specifications can include: font size, font type, etc., and the annotation results that are too small or too large are removed.
[0056] Remove redundant annotation elements according to the association relationships among the various annotation elements in the annotation results. Among them, determine that the annotation results include multiple types of annotation elements, and determine the preset association relationships. The types of annotation elements include annotation names, annotation symbols, annotation values, annotation remarks, etc., and the association relationships include semantic relationships, geometric topological relationships, and positional relationships. The semantic relationship is used to describe the target annotated by the annotation result, the geometric topological relationship is used to describe whether there is a connection, inclusion, etc. relationship between the annotation result and other annotation results, and the positional relationship is used to describe the position corresponding to the annotation result.
[0057] Based on the positional relationship, determine, among all engineering drawings, multiple specified annotation results that point to the same position. Whether they point to the same position can be determined according to the pointing position of the arrow in the annotation result. If the overlap degree between the regions pointed to by the arrows is relatively high, it can be considered that they point to the same position.
[0058] For these multiple specified annotation results, make a judgment through the semantic relationship. If it is determined that there is a first specified situation or a second specified situation among the multiple specified annotation results, then remove the redundant specified annotation results according to the semantic relationship.
[0059] Among them, the first specified situation includes that the similarities among the annotation name, annotation symbol, and annotation value are all higher than the first preset similarity. In this case, it is considered that there is a situation of duplicate annotation, and the redundant specified annotation results among them can be removed.
[0060] The second specified situation includes that the similarity of the annotation names is higher than the preset similarity, and at least some of the annotation symbols, annotation values, and annotation remarks are different. This difference can include: the annotation symbols are opposite, the annotation values are different, the standard remarks are different, etc. In this case, it is considered that there is a situation of contradictory annotation, and the same dimension is marked with multiple values at the same time. When removing the redundant values, it can be analyzed again through image features to obtain the correct annotation result and retain it, or it can be handed over to manual processing.
[0061] It is also possible to judge through the geometric topological relationship to obtain a third specified situation. In the third specified situation, judge through the geometric topological relationship to determine that among the multiple specified annotation results, there is a geometric inclusion relationship among the annotation name, annotation symbol, and annotation value, then it is determined to belong to the third specified situation. The third specified situation corresponds to the duplicate annotation of implicit dimensions. For example, there are three annotation results, namely annotation result A, annotation result B, and annotation result C, which are used to annotate the lengths of line segment A, line segment B, and line segment C respectively, and line segment C is obtained by combining line segment A + line segment B. At this time, the sum of the lengths of each segment (line segment A and line segment B) is equal to the total length (line segment C), resulting in redundant annotation. At this time, remove the redundant specified annotation results according to the geometric inclusion relationship. It is possible to remove the marking results of the segments based on the requirements, or remove the marking results of the total length.
[0062] After removing the redundant annotation results, the remaining annotation results can be verified again based on the geometric topological relationship and annotation logical relationship of the engineering drawing. Among them, the annotation logical relationship can be composed of semantic relationship and positional relationship, which is used to describe whether the positions specified by each semantics conform to the corresponding logic.
[0063] 1. Through image preprocessing and edge detection, the structural features of the engineering drawing are effectively extracted, significantly improving the feature integrity of complex engineering drawings, solving the problem of incomplete feature extraction in complex drawings by traditional deep learning methods, and providing a more accurate input basis for subsequent annotation.
[0064] 2. Use a pre-trained neural network model to extract features from the edge-detected image, breaking through the limitation of traditional rule-based methods that rely on manually defined features, being able to automatically learn the visual patterns of dimension lines, tolerance symbols, and technical requirement texts in engineering drawings, adapting to diverse engineering drawing formats, and improving the generalization ability of annotation.
[0065] 3. Build an annotation rule library through natural language processing, convert industry standards and enterprise self-defined rules into structured data that can be dynamically adjusted, and support flexible configuration of annotation rules. Compared with traditional fixed rule sets, the rules can be updated in real time according to actual engineering needs, improving the flexibility of annotation.
[0066] 4. Based on a post-processing algorithm, perform geometric constraint verification and industry rule adaptation on the annotation results to ensure that the annotation results conform to engineering standards, avoiding problems such as chaotic annotation positions and incorrect symbols in traditional methods, and directly improving the guiding efficiency of the annotation results for production practice.
[0067] In one embodiment, since there are annotation rules for various industries in the annotation rule library, during matching, there may be other industry's annotation rules that are matched and similar. Directly using this annotation rule may lead to the failure of this annotation.
[0068] Based on this, after building an annotation rule library through natural language processing in advance, based on the industries corresponding to each annotation rule in the annotation rule library, extract the annotation feature patterns of each industry through meta-learning to generate scene feature vectors. Industries can be divided manually and added through labels when setting annotation rules, which can include machinery, architecture, electronics, etc.
[0069] Meta-Learning can adopt the MAML (Model-Agnostic Meta-Learning) architecture to preprocess the collected samples, and respectively perform annotation mode statistics on engineering drawings in the machinery, architecture, and electronics industries. For example, in the machinery industry, high-frequency annotation types include chamfers, threads, geometric tolerances, etc.; in the architecture industry, the spatial distribution characteristics of annotations include floor elevations, axis dimension chains, etc.; in the electronics industry, special symbol annotations include pad sizes, pin numbers, etc.
[0070] For different industries, randomly select N industries as tasks, and for each task, perform meta-training with a corresponding support set and query set. At this time, adopt contrastive loss to force the feature vectors of samples in the same industry to be similar and the vectors across industries to be significantly different.
[0071] After the final training is completed, retain the meta-model for identifying the scene feature vectors corresponding to different industries.
[0072] At this time, based on the similarity between the scene feature vectors, obtain the similarity relationships between industries. The higher the similarity between any two industries, the closer the similarity relationship between the two industries is considered.
[0073] Determine the specified industry corresponding to the engineering drawing, and based on the similarity relationships between the specified industry and each industry in the annotation rule library, determine the weights between the engineering drawing and each annotation rule. Generally, it is considered that the weight corresponding to the specified industry is 1. For other industries in the annotation rule library, the closer their similarity relationships are, the higher their corresponding weights, with a maximum not exceeding 1.
[0074] At this time, based on the weights, calculate the matching degrees between the image features and each annotation rule, and based on the annotation rule with the highest matching degree, annotate the image features. For example, directly calculate the matching degree between the annotation rule and the image features, and after calculating the matching degree, perform weighted processing according to the weights to obtain the annotation rule with the highest matching degree for annotation.
[0075] As Figure 3 shown, the embodiment of the present application also proposes an automatic engineering drawing annotation device, including: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the automatic engineering drawing annotation method as described in any of the above embodiments.
[0076] An embodiment of the present application also provides a non-volatile computer storage medium storing computer-executable instructions, and the computer-executable instructions are configured as: the engineering drawing automatic annotation method according to any one of the above embodiments.
[0077] Each embodiment in the present application is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the device and medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and for the relevant parts, reference can be made to the partial description of the method embodiments.
[0078] The device and medium provided by the embodiments of the present application correspond one-to-one with the method. Therefore, the device and medium also have beneficial technical effects similar to those of the corresponding method. Since the beneficial technical effects of the method have been described in detail above, the beneficial technical effects of the device and medium will not be elaborated here.
[0079] The above description is only for the embodiments of the present application and is not intended to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
Claims
1. An automatic dimensioning method for engineering drawings, characterized in that, Including: Obtain an engineering drawing, perform image preprocessing on the engineering drawing, and perform edge detection on the engineering drawing to obtain an edge detection image; Through a pre-trained neural network model, extract features from the edge detection image to obtain image features; Label the image features according to the labeling rules in a labeling rule library constructed in advance through natural language processing; Optimize the labeling results based on a post-processing algorithm.
2. The automatic dimensioning method for engineering drawings according to claim 1, characterized in that, The construction process of the labeling rule library includes: Obtain natural language text for describing labeling rules, perform word segmentation and part-of-speech tagging on the natural language text, and perform character denoising through regular expressions; Construct a syntactic analysis tree through a dependency parsing algorithm, and perform semantic analysis through the syntactic analysis tree and a pre-set engineering semantic knowledge base; According to the semantic analysis results and pre-obtained labeling terms, generate corresponding labeling rules through a pre-defined rule pattern; After structuring the labeling rules, store them to construct a labeling rule library.
3. The automatic dimensioning method for engineering drawings according to claim 2, wherein, The method further includes: Regularly determine the activity of each labeling rule in the labeling rule library; Regularly eliminate labeling rules with activity lower than a preset level; Determine whether there is corresponding note information for the engineering drawing; If there is the note information, update the labeling rules matched by the engineering drawing in the labeling rule library according to the note information.
4. The automatic dimensioning method for engineering drawings according to claim 1, wherein Label the image features according to the labeling rules in a labeling rule library constructed in advance through natural language processing, specifically including: Construct a labeling rule library in advance through natural language processing, extract labeling feature patterns of each industry based on the industries corresponding to each labeling rule in the labeling rule library, generate scene feature vectors, and obtain the similarity relationship between each industry according to the similarity between the scene feature vectors; Determine the specified industry corresponding to the engineering drawing, and determine the weights between the engineering drawing and each labeling rule according to the similarity relationship between the specified industry and each industry in the labeling rule library; Based on the weights, calculate the matching degree between the image features and each labeling rule, and label the image features according to the labeling rule with the highest matching degree.
5. The automatic dimensioning method for engineering drawings according to claim 1, wherein Perform image preprocessing on the engineering drawing and perform edge detection on the engineering drawing to obtain an edge detection image, specifically including: Convert the file format of the engineering drawing to obtain an engineering drawing in a preset file format; Perform image denoising processing on the engineering drawing through a filtering algorithm; Perform grayscale processing on the engineering drawing to obtain a grayscale processed image; Perform edge detection on the grayscale processed image through an edge detection algorithm to obtain an edge detection image.
6. The automatic dimensioning method for engineering drawings according to claim 1, characterized in that, The training process of the neural network model includes: Construct a neural network model based on a multi-layer convolutional neural network architecture; the neural network model includes a convolutional layer, a pooling layer, and a fully connected layer; Collect engineering drawings as training samples; the training samples include multiple types and multiple industries; Based on the training samples, use the cross-entropy loss function and train the neural network model by the stochastic gradient descent method to update the model parameters of the neural network model.
7. The automatic dimensioning method for engineering drawings according to claim 1, wherein Based on the post-processing algorithm, optimize the annotation results, specifically including: Remove the annotation results with an overlap degree higher than the preset threshold through the non-maximum suppression algorithm; Remove the annotation results that do not conform to the preset text specification according to the preset text specification; Remove redundant annotation elements according to the association relationship between the annotation elements in the annotation results; Verify the removed annotation results based on the geometric topological relationship and annotation logical relationship of the engineering drawings.
8. The automatic dimensioning method for engineering drawings according to claim 7, characterized in that, Remove redundant annotation elements according to the association relationship between the annotation elements in the annotation results, specifically including: Determine the annotation elements included in the annotation results and determine the preset association relationship; the annotation elements include annotation names, annotation symbols, annotation values, and annotation remarks; the association relationship includes semantic relationship, geometric topological relationship, and position relationship; Based on the position relationship, determine multiple specified annotation results that point to the same position in all engineering drawings; If it is determined through the semantic relationship that there is a first specified situation or a second specified situation among the multiple specified annotation results, then remove the redundant specified annotation results according to the semantic relationship; the first specified situation includes that the similarities between the annotation name, the annotation symbol, and the annotation value are all higher than the first preset similarity; the second specified situation includes that the similarity between the annotation names is higher than the preset similarity, and at least some of the annotation symbols, annotation values, and annotation remarks are different; If it is determined through the geometric topological relationship that there is a geometric inclusion relationship among the annotation name, the annotation symbol, and the annotation value in the multiple specified annotation results, then remove the redundant specified annotation results according to the geometric inclusion relationship.
9. An automatic dimensioning device for engineering drawings, characterized in that, Including: At least one processor; And, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the engineering drawing automatic annotation method according to any one of claims 1 to 8.
10. A non-volatile computer storage medium stores computer-executable instructions, characterized in that, The computer-executable instructions are set to: the engineering drawing automatic annotation method according to any one of claims 1 to 8.
Citation Information
Patent Citations
System and method for avoiding overlapping of annotation information based on PDMS drawing output
CN106528937A
System and method for constructing information-analysis-oriented knowledge maps
CN106815293A
Self-service query statistics analysis method based on natural language processing
CN107818148A
Automatic image labeling method, device and equipment and computer readable storage medium
CN110110800A
Engineering drawing labeling system and method
CN114398507A
Cited By
Vector drawing generation method and system based on GAI, terminal and medium
CN120997867A
Automatic analysis and labeling method for KiCad EDA engineering data
CN121413549A