CAD (Computer Aided Design) drawing error identification method utilizing deep learning

Through deep learning technology, the problem of insufficient recognition of element nested relationships in the existing technology is solved, and high-precision error recognition and correction are achieved, which improves the accuracy and quality control of CAD mapping.

CN120234854AActive Publication Date: 2025-07-01BEIJING GUANGLIANDA YUNTU DREAM TECH CO LTD

Patent Information

Application Number
CN202510714749.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-30
Publication Date
2025-07-01
Estimated Expiration
2045-05-30

AI Technical Summary

Technical Problem

The existing CAD mapping error recognition methods lack the intelligent recognition ability of the nested relationships of the primitives, making it difficult to detect errors in the nested structure in a timely and accurate manner.

Method used

Deep learning technology is adopted to read the element information of CAD drawings, build the element structure, and extract image features based on the feature extraction network for semantic modeling, identify nested element pairs, perform edge detection and contour fitting, generate boundary constraint ranges, and realize high-precision error recognition and interactive correction.

Benefits of technology

It realizes intelligent identification of the nested relationships of the primitives in CAD drawings, can promptly discover and correct errors in the nested structure, and improves the accuracy of CAD drawing error recognition and quality control level of drawing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120234854A_ABST
    Figure CN120234854A_ABST
Patent Text Reader

Abstract

The invention provides a CAD (Computer Aided Design) drawing error recognition method utilizing deep learning, which relates to the technical field of image data processing and comprises the following steps of: constructing a primitive structure by reading primitive information of a CAD drawing; extracting image features of the drawing based on the feature extraction network to perform semantic modeling on the primitive structure to obtain a primitive structure semantic model; identifying a nested primitive pair; performing edge detection and contour fitting on the nested primitives, and extracting nested edge coordinate points; and obtaining nested edge coordinate points of the nested primitives, generating a boundary constraint range by using the nested edge coordinate points to carry out error recognition on the nested edge coordinate points, and carrying out interactive feedback correction according to an output error recognition result. According to the method and the device, the technical problem that errors in a nested structure are difficult to find timely and accurately due to the lack of intelligent recognition capability for the primitive nesting relationship in the prior art is solved, and the technical effect of improving the CAD drawing error recognition accuracy is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of image data processing, and specifically to a CAD drawing error recognition method using deep learning. Background Art

[0002] In the process of computer-aided design (CAD) drawing, as the complexity of the model increases, the drawing often contains a large number of graphic elements with a hierarchical structure, especially the graphic element structure in the form of a combination of a basic model and nested components. To ensure the quality of the drawing, accurately identifying and correcting drawing errors has become an important link in CAD applications. The existing CAD drawing error recognition methods mainly include rule matching and geometric calculation. The rule matching method checks the CAD drawing according to the pre-set rules. Although the operation is simple, it has poor adaptability to the nested relationship of complex graphic elements and is difficult to identify the hidden errors. The geometric calculation method judges errors by accurately calculating geometric parameters, but has limited understanding of the relevance and semantics between nested graphic elements, resulting in problems such as boundary conflicts, incorrect connections, and occlusion errors that cannot be detected in time. These methods lack the intelligent recognition ability of the nested relationship of graphic elements, resulting in the difficulty of timely and accurately discovering errors in the nested structure and being unable to meet the diverse CAD drawing requirements. Summary of the Invention

[0003] This application provides a CAD drawing error recognition method using deep learning, which solves the technical problem that in the prior art, due to the lack of intelligent recognition ability of the nested relationship of graphic elements in the CAD drawing, it is difficult to timely and accurately discover errors in the nested structure, and achieves the technical effect of realizing high-precision error recognition and interactive correction through semantic modeling and edge constraint analysis, and improving the accuracy of CAD drawing error recognition.

[0004] In view of the above problems, this application provides a CAD drawing error recognition method using deep learning. The method includes: reading the graphic element information of the CAD drawing and constructing a graphic element structure; extracting the image features of the CAD drawing based on a feature extraction network, and performing semantic modeling on the graphic element structure according to the image features to obtain a graphic element structure semantic model; identifying the nested graphic element pairs in the graphic element structure semantic model, where a nested graphic element pair consists of two graphic elements with a nested relationship; performing edge detection and contour fitting on the nested graphic element in the nested graphic element pair to extract the nested edge coordinate points of the nested graphic element; obtaining the nested edge coordinate points of the nested graphic element in the nested graphic element pair, generating a boundary constraint with the nested edge coordinate points to perform error recognition on the nested edge coordinate points, and performing interactive feedback correction according to the output error recognition result.

[0005] One or more technical solutions provided in this application have at least the following beneficial effects: By reading the primitive information of the CAD drawing, a primitive structure is constructed to ensure that subsequent semantic modeling and error recognition are based on a complete set of primitives and their topological structure, providing a structural input for semantic analysis. By extracting the image features of the CAD drawing based on a feature extraction network, semantic modeling is performed on the primitive structure according to the image features to obtain a semantic model of the primitive structure, providing a high-level expression for subsequent nested relationship recognition. Based on the semantic model, nested primitive pairs in the semantic model of the primitive structure are identified, providing a target set for error analysis. Edge detection and contour fitting are performed on the nested primitives in the nested primitive pair to extract the nested edge coordinate points; the nested edge coordinate points of the nested primitive in the nested primitive pair are obtained, and boundary constraint ranges are generated with the nested edge coordinate points to perform error recognition on the nested edge coordinate points, determining whether there are abnormalities such as intersection, exceeding, and occlusion, and performing interactive feedback correction according to the output error recognition result, realizing accurate verification of primitives in the nested relationship, being able to detect and correct errors in a timely manner, and ensuring the accuracy and standardization of the CAD drawing.

[0006] In summary, the present application realizes semantic understanding of the primitive structure in the CAD drawing by introducing deep learning image feature extraction and semantic modeling technologies, can accurately identify the nested relationship between primitives, and further combines edge detection and contour fitting methods to extract primitive boundary information, constructs a boundary constraint model, and accurately identifies drawing errors between nested primitives. By combining the error recognition result with an interactive feedback mechanism, a set of efficient and intelligent closed-loop systems for CAD drawing error recognition and correction is formed, effectively improving the recognition accuracy of errors in the nested structure and the drawing quality control level.

[0007] The above description is only an overview of the technical solution of the present application. In order to be able to understand the technical means of the present application more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the present application more obvious and understandable, the following specifically illustrates the specific embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0008] Figure 1 It is a schematic flowchart of a CAD drawing error recognition method using deep learning provided by an embodiment of the present application.

[0009] Figure 2 It is a schematic flowchart of using the nested edge coordinate points to generate a boundary constraint range to perform error recognition on the nested edge coordinate points in the CAD drawing error recognition method using deep learning provided by an embodiment of the present application.

[0010] Figure 3 It is a schematic flowchart of constructing a compliance determiner for nested primitives in the CAD drawing error recognition method using deep learning provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0011] By providing a CAD drawing error recognition method using deep learning in the embodiments of the present application, the technical problem in the prior art that it is difficult to timely and accurately detect errors in the nested structure due to the lack of intelligent recognition ability for the nested relationship of graphic elements in CAD drawings is solved, and the technical effect of achieving high-precision error recognition and interactive correction through semantic modeling and edge constraint analysis and improving the accuracy of CAD drawing error recognition is achieved.

[0012] As Figure 1 shown, the embodiments of the present application provide a CAD drawing error recognition method using deep learning, and the method includes: Step S1: Read the graphic element information of the CAD drawing and construct a graphic element structure.

[0013] Specifically, a graphic element is a basic constituent unit in a CAD drawing, such as a line segment, a circle, text, a polygon, a block, etc. Call the API of the CAD software to read the graphic element information in the CAD drawing, and organize the graphic elements into structural data according to their attributes such as position, parent-child relationship (such as block reference), layer information, etc., such as a graphic element list, an adjacency matrix or a hierarchical tree structure, to provide an accurate input basis for semantic modeling and error detection.

[0014] Step S2: Extract the image features of the CAD drawing based on a feature extraction network, and perform semantic modeling on the graphic element structure according to the image features to obtain a graphic element structure semantic model.

[0015] Specifically, the feature extraction network is a pre-trained convolutional neural network, such as VGGNet, ResNet, HRNet, etc., which is used to extract the features of different regions in the image, and these image features include texture, boundary, shape, etc. Use a pre-trained convolutional neural network (such as ResNet) as the feature extraction network, render the CAD drawing as an image, input it into the feature extraction network for image feature extraction, and obtain the image features of the CAD drawing. According to the extracted image features, combined with the graphic element structure constructed in Step S1, perform semantic modeling between graphic elements through a graph neural network, fuse the graphic element structure and the image features to generate a graphic element semantic representation, and form a graphic element structure semantic model, so as to support the understanding of the structural hierarchy and context semantics. For example, "a window is nested in a wall" or "a nut is located outside a bolt".

[0016] By extracting the image features of the CAD drawing and performing semantic modeling, the multi-modal semantic association between graphic elements and images is realized, the understanding ability of semantic structures such as spatial nesting and logical attribution in the CAD drawing is improved, and support is provided for high-order relationship modeling.

[0017] Step S3: Identify the nested graphic element pairs of the graphic element structure semantic model, where the nested graphic element pairs are composed of two graphic elements with a nested relationship.

[0018] Specifically, a nested primitive pair is a directed pair composed of two primitives that have an inclusion, connection, or overlay relationship. For example, in an architectural CAD drawing, a window primitive is nested inside a wall primitive, and these two primitives form a nested primitive pair. After obtaining the primitive structure semantic model, traverse the primitive relationships in the primitive structure semantic model, further analyze the spatial relationships and structural dependencies between primitives, and identify the primitive pairs with nested relationships. Each nested primitive pair includes a nested primitive (such as a door, a decorative block, etc.) and a nested-in primitive (such as a wall, a main structure, etc.).

[0019] By establishing the nested association between primitives, the subsequent error detection process can focus on the areas of potential structural problems, improving the recognition accuracy and efficiency.

[0020] Step S4: Perform edge detection and contour fitting on the nested-in primitive in the nested primitive pair, and extract the nested-in edge coordinate points.

[0021] Specifically, perform edge detection and contour fitting on the nested-in primitive in the nested primitive pair. Use an edge detection algorithm (such as the Canny operator) to find the edge positions of the nested-in primitive, and then use a contour fitting technique (such as B-spline curve fitting) to fit these edge points to obtain the exact contour shape of the nested-in primitive, thereby extracting the nested-in edge coordinate points, providing spatial data support for constructing the constraint region and error judgment.

[0022] Step S5: Obtain the nested edge coordinate points of the nested primitive in the nested primitive pair, generate a boundary constraint range with the nested-in edge coordinate points, perform error identification on the nested edge coordinate points, and perform interactive feedback correction according to the output error identification results.

[0023] Specifically, obtain the nested edge coordinate points of the nested primitive in the nested primitive pair. Then, based on the nested-in edge coordinate points, use geometric calculation methods to generate a boundary constraint range to limit the reasonable position range of the nested primitive. Compare the nested edge coordinate points with the boundary constraint range to determine whether there are errors. If the nested edge coordinate points exceed the boundary constraint range, it is determined that there is an error, and the error identification results are output, including the error type (such as primitive out-of-bounds, offset, etc.) and the error position coordinates. According to these results, perform interactive feedback correction, automatically modify the drawing and feedback to the user for confirmation. For example, in an architectural drawing, if the left edge of the door primitive extends beyond the wall area, it prompts "The door is not nested inside the wall". In a CAD drawing of a human body model, if it is identified that the edge of the clothing primitive enters the inside of the body primitive, it prompts "The edge of the clothing enters the inside of the human body".

[0024] Exemplarily, for the CAD drawing of a mechanical part, there is a large gear (nested primitive) and a small gear (nesting primitive). The small gear is installed inside the large gear, forming a nesting relationship. When reading the primitive information to construct the primitive structure, information such as the geometric shapes (circular), number of teeth, module, center coordinates, rotation angle, etc. of the large gear and the small gear, as well as the layers where the two gears are located (such as "gear layer") are obtained. Image features are extracted through a feature extraction network to identify features such as the tooth shape of the gear and the shape of the center hole, and these features are combined with the primitive structure for semantic modeling to understand the roles and mutual relationships of the large gear and the small gear in the mechanical transmission system. When identifying the nesting primitive pair, by analyzing geometric relationships such as the same center coordinates of the two gears and the small gear being completely inside the large gear, it is determined that the two form a nesting primitive pair. When performing edge detection and contour fitting on the nested primitive (large gear), the Canny operator is used to detect the edge coordinate points of the teeth of the large gear, and then the tooth profile of the large gear is fitted with a B-spline curve to generate a boundary constraint range. For example, the radius of the inner hole of the large gear plus a certain tolerance is used as the constraint boundary. The nesting edge coordinate points of the nesting primitive (small gear) are obtained, that is, the edge coordinate points of the inner hole of the small gear. It is checked whether all the edge coordinate points of the teeth of the small gear are within the boundary constraint range. If it is found that some teeth exceed the boundary, it is determined as a primitive out-of-bounds error, and the error type label "primitive out-of-bounds" and the corresponding error position coordinates are output. According to the error type label, the size or position of the small gear is adjusted to meet the design specifications, and a modified drawing is generated and fed back to the user.

[0025] Through the above steps, the accurate judgment of the spatial position relationship of the nested primitives is achieved. The interactive feedback correction makes the entire error recognition process interactive, which can timely remind the drafter to correct the discovered errors and improve the accuracy of drawing.

[0026] Furthermore, if the number of the nested primitive pairs is multiple, the multiple nested primitive pairs are nested and layered according to the nesting order, and a nested primitive pair sequence from the inner layer to the outer layer is output; taking the nested primitive pair sequence as the error recognition priority, the error recognition results of the multiple nested primitive pairs are corrected through interactive feedback step by step.

[0027] Specifically, if there are multiple nested primitive pairs in the CAD drawing, it is necessary to perform hierarchical recognition and sorting processing on the nesting structures of the multiple primitive pairs. Based on the identified nesting relationships in the primitive structure semantic model, a nesting order is established according to the topological logic of "nested in whom", and the multiple nested primitive pairs are nested and layered to form a nested primitive pair sequence from the inner layer to the outer layer. For example, in an architectural CAD drawing, "window - outer window frame - wall" can be identified as a nested primitive pair sequence with a nesting level depth of 3.

[0028] Then, taking this nested primitive pair sequence as the priority of error recognition, and in the order from the inside out, gradually carry out the error recognition and interactive feedback correction processing of the nested primitives. That is, first perform edge alignment judgment and error determination on the innermost nested primitive pair (such as window - outer window frame), and output the corresponding prompt results; after the correction is completed or confirmed to be error - free, continue to perform error recognition on the upper - layer nested primitive pair (such as outer window frame - wall).

[0029] Through the nested - layer and recognition - priority mechanism, when dealing with multi - nested and multi - primitive combined structures, a clear - level and progressive error - recognition strategy can be realized, effectively avoiding error conduction or contradictory judgment between nested levels, and improving the clarity and stability of the recognition logic under complex nested structures.

[0030] Furthermore, as Figure 2 shown, in step S5, using the nested edge coordinate points to generate a boundary constraint range to perform error recognition on the nested edge coordinate points includes:[[]]END]] Step S51: Construct a nested - primitive compliance discriminator, and define the error types of the nested - primitive compliance discriminator, including primitive out - of - bounds, primitive detachment, layer error, and redundant overlap.

[0031] Step S52: The primitive compliance discriminator performs error recognition on the coordinate distribution area of the nested edge coordinate points according to the boundary constraint range, and outputs an error - type label and error - location coordinates.

[0032] Step S53: Output the error - type label and error - location coordinates as the error - recognition result.

[0033] Specifically, construct a nested - primitive compliance discriminator, which is an intelligent module for identifying logical or spatial - relationship errors between nested primitives, and its core is a multi - label deep - learning model. First, define several common error types, specifically including primitive out - of - bounds, primitive detachment, layer error, and redundant overlap. Among them, primitive out - of - bounds means that the edge part of the nested primitive exceeds the boundary range of the basic primitive it should be in; primitive detachment means that the nested primitive does not fall within the expected nested area at all; layer error means that the layer priority of the nested primitive is unreasonable; redundant overlap means that the boundary - area coincidence degree between the nested primitive and the nested - in primitive is too high. This discriminator can be trained by constructing a sample set from historical CAD drawings, using structures such as convolutional neural networks (CNNs) and graph neural networks (GNNs) to perform multi - label classification training for each type of error. The input data includes primitive - structure features, boundary - coordinate point sets, and layer information, and the output is a multi - dimensional error - prediction label.

[0034] The primitive compliance determiner performs error identification on the coordinate distribution area of the nested edge coordinate points according to the boundary constraint range. First, a polygon boundary range is generated based on the set of nested primitive edge coordinate points obtained in step S4 as the accommodation area. Subsequently, the set of edge coordinate points of the nested primitive is extracted, and its geometric relationship with the accommodation area is analyzed. For example, if a large number of coordinate points of the nested primitive are distributed outside the accommodation area and exceed the preset threshold (such as the proportion > 20%), it is determined that the primitive is out of bounds; if there is no intersection between the nested primitive and the accommodation area and the distance of the minimum bounding box is greater than the set threshold (such as 5 mm), it is primitive detachment; if the layer number does not conform to the priority rule table, such as the curtain layer taking precedence over the wall layer, it is determined to be a layer error; if the IoU (Intersection over Union) exceeds the set threshold (such as 0.85), indicating that there is a high degree of overlap of primitives, it is redundant overlap.

[0035] Output the identified error type labels ("primitive out of bounds", "primitive detachment", "layer error", "redundant overlap") and the coordinate positions of the located errors as the final error identification results, and push them to the designers or the intelligent repair module to support further interactive correction.

[0036] The above steps construct a primitive compliance determiner to systematically identify various potential errors in complex nested primitive structures, make up for the limitations of traditional CAD inspection methods that are only based on rules or layer filtering, and construct a comprehensive judgment mechanism of structural semantic understanding - boundary space constraint - logical layer review, effectively improving the accuracy of error identification for nested structures in CAD drawing.

[0037] Further, step S52 includes: Use a geometric judgment algorithm to determine whether the nested edge coordinate points are within the boundary constraint range, and record the number of out-of-bounds coordinate points outside the boundary constraint range; if the number of out-of-bounds coordinate points is greater than the preset threshold, output the error type label as primitive out of bounds.

[0038] Specifically, out-of-bounds coordinate points refer to those coordinate points that exceed the boundary constraint range. Use a geometric judgment algorithm to perform boundary constraint judgment on each point of the set of edge coordinate points of the nested primitive: first, construct a closed polygon area based on the nested edge coordinate points obtained in step S4 as the boundary constraint range, and then determine whether the edge coordinate points of the nested primitive are within the boundary constraint range. Count the number of out-of-bounds coordinate points. If this number exceeds the preset threshold (for example, exceeding 15% of the total number of edge points), output the error type label as primitive out of bounds.

[0039] Further, step S52 also includes: Identify the coordinate point intersection of the boundary constraint range and the nested edge coordinate points. If the coordinate point intersection is a zero area, output the error type label as primitive detachment.

[0040] Specifically, construct the minimum bounding boxes of two sets of points, namely the polygon boundary constraint range and the nested edge coordinate points, calculate the intersection area of the coordinate points of the two, and if the intersection area is zero or only a small number of pixel points (such as less than 10 intersection points), it is considered that there is no physical overlap between the graphic elements, and the output error type label is graphic element detachment.

[0041] Furthermore, step S52 further includes: Establish a layer priority rule table according to the graphic element structure; connect the layer priority rule table with the graphic element compliance detector to obtain the layer numbers of the nested graphic elements corresponding to the nested edge coordinate points and the layer numbers of the nested graphic elements corresponding to the boundary constraint range; if the layer number of the nested graphic element is less than the layer number of the nested graphic element, output the error type label as layer error.

[0042] Specifically, during the parsing process of the graphic element structure, construct a layer priority rule table, and this rule table can preset levels according to graphic element categories, functional attributes, or historical industry standards. For example, the structural layer should be superior to the furniture layer, and the wall layer should be superior to the door and window layer. Connect the layer priority rule table with the graphic element compliance detector. Read the layer numbers corresponding to the nested graphic element and the nested graphic element. If the priority of the layer number of the nested graphic element is lower than that of the nested graphic element, it is determined as a layer logic error, and the output error type label is layer error. This step ensures that the nested relationship not only conforms to the geometric space rationality but also conforms to the hierarchical specification in the design logic.

[0043] Furthermore, step S52 further includes: Calculate the intersection-over-union ratio of the nested edge coordinate points corresponding to the nested graphic element and the nested edge coordinate points; if the intersection-over-union ratio is greater than the preset ratio, output the error type label as redundant overlap.

[0044] Specifically, based on the intersection-over-union ratio, judge whether there is an over-duplicate drawing problem between the nested graphic element and the nested graphic element in space. Among them, the intersection-over-union ratio refers to the ratio of the intersection area to the union area of two geometric figures (here, the figures formed by the nested edge coordinate points corresponding to the nested graphic element and the nested edge coordinate points), which is an index to measure the overlapping degree of two figures. Calculate the area ratio of the intersection area to the union area of the figures formed by the nested edge points and the nested edge points. If the intersection-over-union ratio is greater than the preset ratio (such as 0.85), it indicates that the two graphic elements overlap severely and there is redundancy, and the output error type label is redundant overlap. For example, in some cases of incorrect library drawing references, the door graphic element may be copied multiple times and superimposed on the original graphic element, and such errors are not easily discovered manually but will seriously affect the drawing quality.

[0045] Furthermore, the nested relationship at least includes a connection relationship, an inclusion relationship, and a superimposition relationship.

[0046] Specifically, in this embodiment, the recognition of nested graphic elements pairs is not limited to the nesting of geometric positions, but also includes various forms of structural relationships to more comprehensively depict the complex dependencies and organizational logics among graphic elements in CAD drawings. The nesting relationships include at least connection relationships, inclusion relationships, and overlay relationships. A connection relationship means that two graphic elements are attached or extended through a certain structural connection point or functional connection line. For example, a wall graphic element and a cable channel graphic element are usually connected through an opening or a notch, and the leg graphic element in a furniture graphic element is connected to the tabletop graphic element through a line segment. In graphic element semantic modeling, the automatic recognition of connection relationships is achieved by analyzing the continuity of topological boundaries or shared nodes. When identifying whether there is a connection relationship between graphic elements, the following analysis process can be adopted: segmentally extract the boundary paths of each graphic element in the constructed graphic element structure semantic model to generate a set of contact edge pairs of adjacent graphic elements. Then, use a geometric adjacency detection algorithm to determine whether there is an endpoint pair with a distance less than a set threshold (such as 2 mm) between the boundaries of two graphic elements. Extract common control points (such as connection blocks, common anchor points) in the CAD graphic element vector expression to determine whether the graphic elements are constrained by the same node. Determine whether the boundaries of two graphic elements are highly aligned in a certain direction (such as a light slot and a main beam being collinear), satisfying the directionality and boundary coincidence characteristics of the connection. Finally, mark the graphic element pairs that meet any of the above conditions as connection relationships and record the connection position coordinates or the anchored positions.

[0047] An inclusion relationship means that the complete geometric range of one graphic element completely encloses another graphic element, which is often used to represent local components or nested components. For example, a furniture graphic element is included in a room graphic element, and a wiring port graphic element is included in an equipment contour graphic element, etc. The inclusion relationship is recognized by means of boundary bounding box inclusion tests, point set inclusion tests, etc. When extracting the inclusion relationship, the following geometric analysis process can be adopted: establish rectangular bounding boxes for all graphic elements, and judge the set relationship of the boundary point sets of two graphic elements (A, B). If all the boundary points of graphic element B are within the boundary region of graphic element A, then it is judged that A includes B, mark the graphic element pairs that meet the condition of "the inner graphic element is completely included in the outer graphic element" as inclusion relationships, and record the relationship between the inclusion boundary and the center position.

[0048] The overlay relationship means that there is a significant intersection in the geometric regions of two graphic elements, but there may not necessarily be an up-down or structural attachment relationship. For example, the lighting design graphic elements of two layers of ceiling suspended ceilings may be overlaid on the main structure suspended ceiling graphic elements, or multiple symbol graphic elements may be mis-overlaid at the same position. Such relationships are prone to overlapping errors in high-density drawings, and the rationality of the overlay can be comprehensively judged based on the graphic element layers, legend semantics, and intersection-over-union ratio characteristics. For the recognition of the overlay relationship, the main focus is on the geometric coincidence degree and layer semantic conflict between graphic elements. Exemplarily, for two graphic elements, extract their edge coordinate points, construct their geometric boundary contours, and then, based on pixel points or boundary point sets, calculate the intersection-over-union ratio of the two graphic elements. If the intersection-over-union ratio is greater than a preset value (such as 0.3 or 0.5), it is determined that the two have an overlay. Output an overlay relationship label for all graphic element pairs that meet the conditions, and locate their overlapping regions.

[0049] By expanding the nesting relationship into three typical structures: connection, inclusion, and overlay, the true logic and semantic context between graphic elements can be more accurately extracted, thereby enhancing the context awareness ability and semantic understanding depth of error recognition. Especially in multi-layer nested drawings such as complex component assembly drawings and electrical installation drawings, the risks of misrecognition and missed recognition can be effectively reduced, and the applicability to different engineering drawing styles and design specifications can be significantly enhanced.

[0050] Furthermore, as Figure 3 shown, step S51 includes: Step S511: Read the CAD historical file, and label the error sample training set, correct sample training set with nesting relationships in the CAD historical file, and the corresponding error type supervision labels.

[0051] Step S512: Input the error sample training set and correct sample training set into the deep learning model for analysis, and output the multi-label classification results of each error type.

[0052] Step S513: Optimize the model parameters by supervising and comparing the multi-label classification results with the error type supervision labels until the accuracy rate of the multi-label classification results reaches the preset threshold, and output a compliance discriminator for nested graphic elements.

[0053] Specifically, from the existing CAD historical engineering files, read and screen the graphic element data containing nesting relationships, and manually or semi-automatically label the nested structures with graphic element errors to form an error sample training set; sort out the nested graphic element pairs with compliant structures and no nesting errors into a correct sample training set; in addition, based on the known fault information or manual annotations in the drawings, label the corresponding error type supervision labels for all error samples, including graphic element out-of-bounds, graphic element detachment, layer errors, redundant overlaps, etc.

[0054] Input the above-mentioned error sample training set and correct sample training set into a preset deep neural network. Preferably, use a convolutional neural network or graph neural network architecture with a multi-branch attention mechanism or residual fusion structure to extract graphic element structures, boundary features, and nested context relationships, and input them into a multi-label classification deep learning model for training. The model outputs a multi-label classification probability vector for each pair of nested graphic elements on each error type, that is: ypred = (P out-of-bounds, P detachment, P layer, P overlap). The model supports predicting multiple potential error labels for a pair of nested graphic elements simultaneously to address the situation where multiple errors coexist in practice.

[0055] Compare the error of each class between the model output result and the pre-annotated supervision label, and use the binary cross-entropy loss function and average accuracy as the main evaluation indicators; continuously update the model parameters through the backpropagation algorithm until the multi-label classification accuracy on the validation set reaches a preset threshold (such as 95%), and finally output a nested graphic element compliance determiner that meets the robustness requirements. This model can not only accurately identify different nested error types but also automatically adapt to the combined errors not annotated in new samples, greatly enhancing the intelligent level of CAD graphic element verification.

[0056] Further, in step S5, perform interactive feedback correction according to the output error recognition result, including: Step S54: Determine the correction condition according to the error type label of the error recognition result.

[0057] Step S55: Correct the coordinate of the error position in the error recognition result according to the correction condition to obtain a corrected CAD drawing.

[0058] Step S56: At the same time, record the feedback information of the interactive user based on the corrected CAD drawing, and update the nested graphic element compliance determiner according to the feedback information.

[0059] Specifically, according to the error type label output by the nested graphic element compliance determiner (such as graphic element out-of-bounds, graphic element detachment, layer error, or redundant overlap), preset or customize the corresponding correction strategy template by the user. For example, for graphic element out-of-bounds: pull the boundary of the nested graphic element back within the boundary range of the nested graphic element; for graphic element detachment: align the graphic element according to the reference drawing or standard structure; for layer error: adjust the layer where the graphic element is located to comply with the specification of the layer priority table; for redundant overlap: delete redundant graphic elements or merge overlapping areas. Automatically match the correction logic based on the error type label to form clear correction conditions, including parameters such as the target graphic element, constraint range, and correction method.

[0060] According to the above correction conditions, call the CAD drawing engine to perform operations on the corresponding nested graphic elements to modify the element position, contour, or layer attributes; this step can achieve semi-automatic or full-automatic correction, and at the same time support user graphical interface interaction confirmation and fine-tuning, and finally output a CAD drawing with accurately corrected coordinates.

[0061] Bind the feedback information of the user on the corrected drawing (including operation behaviors such as "confirm modification", "cancel modification", "custom adjustment", etc.) to the original error recognition result to form a new annotation sample; by continuously recording and accumulating user feedback behaviors, dynamically update the nested graphic element compliance discriminator model, including retraining model parameters, adjusting classification label weights, introducing a confidence evaluation mechanism, etc., to continuously optimize the accuracy and adaptability of error recognition and correction.

[0062] Exemplarily, in a mechanical assembly drawing, there is a nested relationship between a bolt (nested graphic element) and a nut (nested-by graphic element). The error recognition result shows that the bolt has an element out-of-bounds error. According to the error type label "element out-of-bounds", the correction condition is determined to move the bolt within the boundary constraint range of the nut. Calculate the distance and direction that the bolt needs to move. For example, the bolt needs to move 2 unit distances in the direction of the nut center. Call the move command of the CAD software to correct the coordinates of the bolt so that it moves 2 unit distances within the boundary constraint range of the nut, and save the corrected CAD drawing. The user views the corrected drawing and feedbacks that the position of the bolt is still unreasonable and may affect the assembly. Record the user's feedback information and input it as a new training sample into the deep learning model of the nested graphic element compliance discriminator to retrain the model and optimize the error recognition conditions and correction methods for element out-of-bounds errors of the model.

[0063] Implement the closed-loop optimization of the model through an interactive feedback mechanism, so that the CAD error recognition process has the ability of continuous learning and self-adaptation, and significantly improves the reliability and intelligence level during long-term operation.

[0064] In summary, the CAD drawing error recognition method using deep learning provided by the embodiments of the present application has the following beneficial effects: By reading the primitive information of CAD drawings and constructing a primitive structure, the basic information of each primitive in the drawing can be obtained. Then, based on a deep learning feature extraction network, the image features of the CAD drawing are extracted, and then semantic modeling is performed on the primitive structure to obtain a semantic model of the primitive structure. In this process, the semantic parsing ability of the image features is introduced, effectively improving the automatic recognition and processing ability of the primitives. Subsequently, the nesting relationship between the primitives is identified, and through edge detection and contour fitting, the edge coordinates of the nested primitives are extracted, and the boundary constraint range is further defined to achieve accurate error positioning. For various error types, including primitive out-of-bounds, primitive detachment, layer errors, and redundant overlaps, etc., by constructing a compliance discriminator for nested primitives and using geometric algorithms and a layer priority rule table, the errors are classified and processed one by one. These error types can be refined and recognized through the intersection over union, geometric judgment, and layer priority rules, and the error types and positions are accurately marked. Further, by gradually correcting the primitive positions and structures and combining an interactive feedback mechanism, the error recognition model can be updated according to the user feedback, enabling this method to have the ability of dynamic self-learning.

[0065] Overall, the embodiments of the present application combine deep learning and image processing methods to provide a high-precision CAD drawing error recognition and correction mechanism, effectively improving the recognition accuracy and real-time performance of errors in the nested structure of CAD drawings, significantly reducing the need for manual intervention, and improving the overall quality of drawing.

[0066] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments shown herein, but rather will be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A CAD drawing error recognition method using deep learning, characterized in that, The method includes: Reading the primitive information of the CAD drawing and constructing a primitive structure; Extracting the image features of the CAD drawing based on a feature extraction network, and performing semantic modeling on the primitive structure according to the image features to obtain a primitive structure semantic model; Identifying nested primitive pairs in the primitive structure semantic model, where a nested primitive pair consists of two primitives with a nested relationship; Performing edge detection and contour fitting on the nested primitive in the nested primitive pair, and extracting the coordinates of the nested edge points; Obtaining the coordinates of the nested edge points of the nested primitive in the nested primitive pair, generating a boundary constraint range with the coordinates of the nested edge points to perform error identification on the coordinates of the nested edge points, and performing interactive feedback correction according to the output error identification result.

2. The CAD drawing error recognition method using deep learning according to claim 1, wherein If the number of nested primitive pairs is multiple, nesting and layering the multiple nested primitive pairs in the nesting order, and outputting a nested primitive pair sequence from the inner layer to the outer layer; Taking the nested primitive pair sequence as the error identification priority, and performing interactive feedback correction on the error identification results of the multiple nested primitive pairs level by level.

3. The CAD drawing error recognition method using deep learning according to claim 1, wherein Generating a boundary constraint range with the coordinates of the nested edge points to perform error identification on the coordinates of the nested edge points, and the method includes: Constructing a nested primitive compliance discriminator, and defining the error types of the nested primitive compliance discriminator, including primitive out-of-bounds, primitive detachment, layer error, and redundant overlap; The primitive compliance discriminator performs error identification on the coordinate distribution area of the nested edge points according to the boundary constraint range, and outputs an error type label and error position coordinates; Outputting the error type label and error position coordinates as the error identification result.

4. The CAD drawing error recognition method using deep learning according to claim 3, characterized in that, The primitive compliance discriminator performs error identification on the coordinate distribution area of the nested edge points according to the boundary constraint range, and the method includes: Using a geometric judgment algorithm to determine whether the nested edge points are within the boundary constraint range, and recording the number of out-of-bounds coordinate points outside the boundary constraint range; If the number of out-of-bounds coordinate points is greater than a preset threshold, outputting the error type label as primitive out-of-bounds.

5. The CAD drawing error recognition method using deep learning according to claim 3, wherein The primitive compliance discriminator performs error identification on the coordinate distribution area of the nested edge points according to the boundary constraint range, and the method includes: Identifying the coordinate point intersection of the boundary constraint range and the nested edge points, and if the coordinate point intersection is a zero area, outputting the error type label as primitive detachment.

6. The CAD drawing error recognition method using deep learning according to claim 3, characterized in that, The primitive compliance discriminator performs error identification on the coordinate distribution area of the nested edge points according to the boundary constraint range, and the method includes: Establishing a layer priority rule table according to the primitive structure; Connecting the layer priority rule table with the primitive compliance discriminator, obtaining the layer number of the nested primitive corresponding to the nested edge points, and the layer number of the nested primitive corresponding to the boundary constraint range; If the layer number of the nested primitive is less than the layer number of the nested primitive, outputting the error type label as layer error.

7. The CAD drawing error recognition method using deep learning according to claim 3, characterized in that, The primitive compliance determiner performs error identification on the coordinate distribution area of the nested edge coordinate points according to the boundary constraint range. The method includes: Calculating the intersection over union of the nested primitive corresponding nested edge coordinate points and the nested edge coordinate points; If the intersection over union is greater than a preset ratio, output the error type label as redundant overlap.

8. The CAD drawing error recognition method using deep learning according to claim 1, characterized in that, The nested relationship at least includes a connection relationship, a containment relationship, and an overlay relationship.

9. The CAD drawing error recognition method using deep learning according to claim 3, wherein Constructing a nested primitive compliance determiner includes: Reading a CAD historical file, annotating an error sample training set, a correct sample training set with a nested relationship in the CAD historical file, and corresponding error type supervision labels; Inputting the error sample training set and the correct sample training set into a deep learning model for analysis, and outputting multi-label classification results for each error type; Optimizing the model parameters by supervising and comparing the multi-label classification results with the error type supervision labels until the accuracy of the multi-label classification results reaches a preset threshold, and outputting a nested primitive compliance determiner.

10. The CAD drawing error recognition method using deep learning according to claim 3, characterized in that, Performing interactive feedback correction according to the output error identification result. The method includes: Determining a correction condition according to the error type label of the error identification result; Performing coordinate correction on the error position coordinates in the error identification result according to the correction condition to obtain a corrected CAD drawing; At the same time, recording the feedback information of the interactive user based on the corrected CAD drawing, and updating the nested primitive compliance determiner according to the feedback information.

Citation Information

Patent Citations

  • Drawing review method, device, computer equipment and storage medium

    CN110517223A

  • Intelligent identification method and system for drawing review

    CN117809153A

  • Pixel recognition method and device, electronic equipment and storage medium

    CN118314596A

  • Method for detecting border tiles or border pixels of a primitive for tile-based rendering

    US20090147016A1

Cited By

  • Line segment attribute identification method, device and equipment for printed circuit board

    CN121685917A

  • Automatic detection method and device for CAD drawing errors and storage medium

    CN122347811A