CAD drawing error recognition method based on deep learning
Through deep learning technology, the element structure of CAD drawings is constructed, nested relationships are identified and edge detection is performed, which solves the problem of difficult to detect nested structure errors in the existing technology, realizes high-precision error recognition and interactive correction, and improves the accuracy of CAD drawing.
Patent Information
- Application Number
- CN202510714749.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2045-05-30
AI Technical Summary
The existing technology lacks the ability to identify the nested relationships of elements in CAD drawings, which makes it difficult to detect errors in the nested structure in a timely and accurate manner, and cannot adapt to the diverse CAD drawing requirements.
The element information of CAD drawings is read through deep learning methods, the element structure is constructed, the element structure is performed, the nested element pairs are identified, and the nested edge coordinate points are extracted through edge detection and outline fitting, and the boundary constraint range is generated for error recognition, and combined with interactive feedback correction.
It realizes accurate verification of the elements in nested relationships, can promptly discover and correct errors, and improves the accuracy and standardization of CAD drawing.
Smart Images

Figure CN120234854B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of image data processing, and in particular to a method for identifying CAD drawing errors using deep learning. Background Art
[0002] In the computer-aided design (CAD) drafting process, as model complexity increases, drawings often contain a large number of hierarchical primitives, particularly primitive structures that consist of a combination of base models and nested components. To ensure drawing quality, accurately identifying and correcting drawing errors has become a critical component of CAD applications. Existing CAD drawing error identification methods primarily include rule matching and geometric calculation. Rule matching methods check CAD drawings based on pre-set rules. While simple to operate, they lack adaptability to complex nested primitive relationships and struggle to identify hidden errors. Geometric calculation methods accurately calculate geometric parameters to identify errors, but their understanding of the relationships and semantics between nested primitives is limited, resulting in problems such as boundary conflicts, misconnections, and occlusion errors not being detected in a timely manner. These methods lack the ability to intelligently identify nested primitive relationships, making it difficult to accurately detect errors in nested structures and unable to adapt to the diverse needs of CAD drafting. Summary of the Invention
[0003] This application provides a CAD drawing error recognition method using deep learning, which solves the technical problem that the existing technology lacks the ability to intelligently recognize the nested relationships of graphic elements in CAD drawings, resulting in difficulties in timely and accurate detection of errors in nested structures. It achieves the technical effect of realizing high-precision error recognition and interactive correction through semantic modeling and edge constraint analysis, thereby improving the accuracy of CAD drawing error recognition.
[0004] In view of the above problems, the present application provides a CAD drawing error recognition method using deep learning, the method comprising: 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 of the primitive structure semantic model, wherein the nested primitive pairs are composed of two primitives in a nested relationship; performing edge detection and contour fitting on the nested primitives in the nested primitive pairs, and extracting the nested edge coordinate points; obtaining the nested edge coordinate points of the nested primitives in the nested primitive pairs, generating a boundary constraint range 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 results.
[0005] One or more technical solutions provided in this application have at least the following beneficial effects:
[0006] By reading the primitive information of the CAD drawing and constructing the primitive structure, the subsequent semantic modeling and error recognition are based on a complete primitive set and its topological structure, providing structural input for semantic analysis. By extracting the image features of the CAD drawing using a feature extraction network, the primitive structure is semantically modeled according to these image features to obtain a primitive structure semantic model, providing a high-level representation for subsequent nested relationship recognition. Based on the semantic model, nested primitive pairs in the primitive structure semantic model are identified, providing a target set for error analysis. Edge detection and contour fitting are performed on the nested primitives in the nested primitive pairs to extract the nested edge coordinates. The nested edge coordinates of the nested primitives in the nested primitive pairs are obtained, and boundary constraints are generated using the nested edge coordinates to perform error recognition on the nested edge coordinates. Errors are determined for intersections, overshoots, occlusions, and other anomalies. Interactive feedback correction is performed based on the output error recognition results, achieving precise verification of primitives in nested relationships, enabling timely detection and correction of errors, and ensuring the accuracy and standardization of CAD drawings.
[0007] In summary, this application achieves semantic understanding of the primitive structure in CAD drawings by introducing deep learning image feature extraction and semantic modeling technology. It can accurately identify the nested relationships between primitives, and further combines edge detection and contour fitting methods to extract primitive boundary information, construct a boundary constraint model, and accurately identify drawing errors between nested primitives. By combining error recognition results with an interactive feedback mechanism, a highly efficient and intelligent closed-loop system for CAD drawing error recognition and correction is formed, effectively improving the accuracy of error recognition in nested structures and the level of drawing quality control.
[0008] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 A flowchart of a CAD drawing error recognition method using deep learning provided in an embodiment of the present application.
[0010] Figure 2 A schematic diagram of a process for error identification of nested edge coordinate points using a boundary constraint range generated by the nested edge coordinate points in a CAD drawing error identification method using deep learning provided in an embodiment of the present application.
[0011] Figure 3 A schematic diagram of a process for constructing a nested primitive compliance determiner in a CAD drawing error recognition method using deep learning provided in an embodiment of the present application. DETAILED DESCRIPTION
[0012] The embodiments of the present application provide a CAD drawing error recognition method using deep learning, which solves the technical problem in the prior art that errors in nested structures are difficult to detect in a timely and accurate manner due to the lack of intelligent recognition capability of the nested relationships of graphic elements in CAD drawings. The embodiment of the present application achieves the technical effect of realizing high-precision error recognition and interactive correction through semantic modeling and edge constraint analysis, thereby improving the accuracy of CAD drawing error recognition.
[0013] like Figure 1 As shown, an embodiment of the present application provides a CAD drawing error recognition method using deep learning, the method comprising:
[0014] Step S1: Read the primitive information of the CAD drawing and construct the primitive structure.
[0015] Specifically, primitives are the basic building blocks in CAD drawings, such as line segments, circles, text, polygons, and blocks. The CAD software's API is called to read primitive information from the CAD drawing. These primitives are organized into structural data based on their location, parent-child relationships (such as block references), layer information, and other attributes, such as primitive lists, adjacency matrices, or hierarchical tree structures. This provides accurate input for semantic modeling and error detection.
[0016] Step S2: extracting image features of the CAD drawing based on a feature extraction network, performing semantic modeling on the primitive structure according to the image features, and obtaining a primitive structure semantic model.
[0017] Specifically, the feature extraction network is a pre-trained convolutional neural network, such as VGGNet, ResNet, or HRNet, used to extract features from different regions of an image. These image features include texture, boundaries, and shape. Using a pre-trained convolutional neural network (such as ResNet) as the feature extraction network, the CAD drawing is rendered as an image and input into the feature extraction network for image feature extraction, thereby obtaining the image features of the CAD drawing. Based on the extracted image features and the primitive structure constructed in step S1, a graph neural network is used to perform semantic modeling between primitives. The primitive structure and image features are fused to generate a primitive semantic representation, forming a primitive structure semantic model, thereby supporting the understanding of structural hierarchy and contextual semantics. For example, "the window is nested in the wall" or "the nut is located outside the bolt."
[0018] By extracting the image features of CAD drawings and performing semantic modeling, multimodal semantic associations between graphics elements and images are achieved, improving the ability to understand semantic structures such as spatial nesting and logical attribution in CAD drawings, and providing support for high-order relationship modeling.
[0019] Step S3: Identify nested primitive pairs of the primitive structure semantic model, wherein the nested primitive pairs consist of two primitives in a nested relationship.
[0020] Specifically, a nested element pair is a directed pair consisting of two elements that are contained, connected, or superimposed. For example, in an architectural CAD drawing, a window element is nested within a wall element; these two elements constitute a nested element pair. After obtaining the element structure semantic model, the element relationships in the element structure semantic model are traversed to further analyze the spatial relationships and structural dependencies between elements, identifying element pairs with nested relationships. Each nested element pair consists of a nesting element (such as a door or decorative block) and a nested element (such as a wall or main structure).
[0021] By establishing nested associations between graphics elements, the subsequent error detection process can focus on areas with potential structural problems, thereby improving recognition accuracy and efficiency.
[0022] Step S4: performing edge detection and contour fitting on the nested primitives in the nested primitive pair, and extracting the coordinate points of the nested edges.
[0023] Specifically, edge detection and contour fitting are performed on the nested primitives in the nested primitive pair. Edge detection algorithms (such as the Canny operator) are used to locate the edge positions of the nested primitives. Contour fitting techniques (such as B-spline curve fitting) are then applied to these edge points to obtain the precise contour shape of the nested primitives. The coordinates of the nested edge points are then extracted, providing spatial data support for constructing constraint regions and error judgment.
[0024] Step S5: obtaining the nested edge coordinate points of the nested primitives in the nested primitive pair, performing error recognition on the nested edge coordinate points using the nested edge coordinate points to generate a boundary constraint range, and performing interactive feedback correction according to the output error recognition result.
[0025] Specifically, the nested edge coordinate points of the nested primitives in the nested primitive pair are obtained. Then, based on the nested edge coordinate points, a geometric calculation method is used to generate a boundary constraint range to limit the reasonable position range of the nested primitives. The nested edge coordinate points are compared with the boundary constraint range to determine whether there is an error. If the nested edge coordinate points exceed the boundary constraint range, it is determined that there is an error, and the error recognition result is output, including the error type (such as primitive out of bounds, offset, etc.) and the error position coordinates. Based on these results, interactive feedback correction is performed, the drawing is automatically modified, and feedback is given to the user for confirmation. For example, in an architectural drawing, the left edge of the door primitive deviates from the wall area, and the prompt "The door is not nested in the wall" is displayed. In a CAD drawing of a human body model, the edge of the clothing primitive is identified as entering the inside of the body primitive, and the prompt "The edge of the clothing enters the inside of the human body" is displayed.
[0026] For example, a CAD drawing of a mechanical part contains a large gear (nested primitive) and a small gear (nested primitive), with the small gear mounted inside the large gear, forming a nested relationship. When reading primitive information and constructing the primitive structure, information such as the geometric shape (circular), number of teeth, module, center coordinates, rotation angle, and the layer (e.g., "gear layer") of the large and small gears are obtained. A feature extraction network extracts image features, identifying features such as the gear tooth shape and center hole shape. These features are then combined with the primitive structure for semantic modeling to understand the role and relationship of the large and small gears in the mechanical transmission system. When identifying nested primitive pairs, the system determines that the two gears constitute a nested primitive pair by analyzing geometric relationships such as the identical center coordinates of the two gears and the complete positioning of the small gear inside the large gear. Edge detection and contour fitting are performed on the nested primitive (the large gear). The Canny operator is used to detect the edge coordinates of the large gear teeth. A B-spline curve is then used to fit the large gear tooth profile, generating boundary constraints. For example, the radius of the large gear inner hole plus a certain tolerance serves as the constraint boundary. Obtain the nested edge coordinates of the nested primitive (pinion), i.e., the edge coordinates of the inner hole of the pinion. Check that all the pinion tooth edge coordinates are within the bounding constraints. If some teeth are found to be outside the bounds, it is determined to be an out-of-bounds error. The error type label "Principal out-of-bounds" and the corresponding error position coordinates are output. Based on the error type label, adjust the size or position of the pinion to meet the design specifications, and generate a revised drawing for feedback to the user.
[0027] The above steps enable accurate judgment of the spatial position relationship of nested primitives. Interactive feedback correction makes the entire error recognition process interactive, which can promptly remind cartographers to correct the errors found and improve the accuracy of mapping.
[0028] Furthermore, if there are multiple nested primitive pairs, 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; the nested primitive pair sequence is used as the error recognition priority, and the error recognition results of the multiple nested primitive pairs are interactively fed back and corrected step by step.
[0029] Specifically, if a CAD drawing contains multiple nested primitive pairs, the nesting structure of these primitive pairs must be hierarchically identified and sorted. Based on the nesting relationships identified in the primitive structure semantic model, a nesting order is established according to the topological logic of "nested within whom." Multiple nested primitive pairs are nested and layered, forming a sequence of nested primitive pairs from inner to outer layers. For example, in an architectural CAD drawing, "window - exterior window frame - wall" can be identified as a nested primitive pair sequence with a nesting depth of three.
[0030] Then, using this nested element pair sequence as the priority for error recognition, the system proceeds from the inside out, performing error recognition and interactive feedback correction for each nested element. First, the innermost nested element pair (e.g., window-exterior window frame) undergoes edge alignment and error detection, outputting corresponding prompts. Once the correction is complete or confirmed, error recognition continues for the next higher nested element pair (e.g., exterior window frame-wall).
[0031] Through the nested layering and recognition priority mechanism, a clear-layered and progressive error recognition strategy can be implemented when processing multi-nested and multi-element combination structures, effectively avoiding error transmission or contradictory judgments between nested levels, and improving the clarity and stability of the recognition logic under complex nested structures.
[0032] Further, such as Figure 2 As shown, in step S5, error recognition of the nested edge coordinate points is performed using the nested edge coordinate points to generate a boundary constraint range, including:
[0033] Step S51: constructing a nested primitive compliance determiner and defining error types of the nested primitive compliance determiner, including primitive out-of-bounds, primitive detachment, layer error, and redundant overlap.
[0034] Step S52: the primitive compliance determiner 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 position coordinates.
[0035] Step S53: Output the error type label and error location coordinates as an error recognition result.
[0036] Specifically, a nested primitive compliance determinator is constructed. This determinator is an intelligent module used to identify errors in the logical or spatial relationships between nested primitives. Its core is a multi-label deep learning model. First, several common error types are defined, including primitive out-of-bounds, primitive detachment, layer errors, and redundant overlaps. A primitive out-of-bounds refers to when the edge of a nested primitive exceeds the boundary of the base primitive where it should be located; primitive detachment refers to when a nested primitive does not fall completely within the expected nesting area; a layer error refers to when the layer priority of a nested primitive is unreasonable; and a redundant overlap refers to when the boundary area of a nested primitive and the nested primitive overlap too much. The determinator can be trained using a sample set constructed from historical CAD drawings. Multi-label classification training is performed for each type of error using structures such as convolutional neural networks (CNNs) and graph neural networks (GNNs). The input data includes primitive structural features, boundary coordinate point sets, and layer information, and the output is a multi-dimensional error prediction label.
[0037] The primitive compliance determiner identifies errors in the coordinate distribution area of the nested edge coordinate points based on the boundary constraint range. First, a polygonal boundary range is generated based on the edge coordinate point set of the nested primitive obtained in step S4 as the accommodation area. Subsequently, the edge coordinate point set of the nested primitive is extracted and its geometric relationship with the accommodation area is analyzed. For example, if a large number of nested primitive coordinate points are distributed outside the accommodation area and exceed the preset threshold (such as a proportion of >20%), it is determined that the primitive is out of bounds; if the nested primitive has no intersection with the accommodation area and the minimum bounding box distance is greater than the set threshold (such as 5mm), it is determined that the primitive is detached; if the layer number does not comply with the priority rule table, such as the curtain layer takes 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), it means that the primitives are highly overlapped and redundantly overlapped.
[0038] The identified error type labels ("element out of bounds", "element detachment", "layer error", "redundant overlap") and the coordinates of the error positions are output as the final error recognition results and pushed to the designer or the intelligent repair module to support further interactive correction.
[0039] The above steps systematically identify various potential errors in complex nested element structures by building an element compliance determiner, making up for the limitations of traditional CAD inspection methods that are only based on rules or layer filtering. They build a comprehensive judgment mechanism of structural semantic understanding - boundary space constraints - logical layer review, effectively improving the accuracy of nested class structure error identification in CAD drawing.
[0040] Furthermore, step S52 includes:
[0041] A geometric judgment algorithm is used to determine whether the nested edge coordinate point is within the boundary constraint range, and the number of out-of-bounds coordinate points outside the boundary constraint range is recorded; if the number of out-of-bounds coordinate points is greater than a preset threshold, the error type label is output as the primitive is out of bounds.
[0042] Specifically, out-of-bounds coordinate points refer to those that exceed the boundary constraint range. A geometric judgment algorithm is used to perform boundary constraint judgment on the edge coordinate points of the nested primitives point by point: first, a closed polygonal area is constructed as the boundary constraint range based on the nested edge coordinate points obtained in step S4, and then a judgment is made as to whether the edge coordinate points of the nested primitive are within the boundary constraint range. The number of out-of-bounds coordinate points is counted. If this number exceeds a preset threshold (for example, more than 15% of the total number of edge points), an error type label is output as the primitive is out of bounds.
[0043] Furthermore, step S52 further includes:
[0044] The intersection of the boundary constraint range and the coordinate points of the nested edge coordinate points is identified, and if the intersection of the coordinate points is a zero area, the error type label is output as primitive detachment.
[0045] Specifically, the minimum bounding box of two sets of points, the polygon boundary constraint range and the nested edge coordinate points, is constructed, and the intersection area of the two coordinate points is calculated. If the intersection area is zero or only a small number of pixels (such as less than 10 intersection points), it is considered that there is no physical overlap between the primitives, and the output error type label is primitive detachment.
[0046] Furthermore, step S52 further includes:
[0047] A layer priority rule table is established according to the primitive structure; the layer priority rule table is connected to the primitive compliance determiner to obtain the layer number of the nested primitive corresponding to the nested edge coordinate point, 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, the error type label is output as a layer error.
[0048] Specifically, during the element structure parsing process, a layer priority rule table is constructed. This rule table can preset the hierarchy based on the element category, 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. The layer priority rule table is connected to the element compliance determiner. The layer numbers corresponding to the nested element and the nested element are read. If the layer number priority of the nested element is lower than that of the nested element, it is determined to be a layer logic error, and the output error type label is layer error. This step ensures that the nesting relationship not only conforms to the rationality of the geometric space, but also conforms to the layering specifications of the design logic.
[0049] Furthermore, step S52 further includes:
[0050] Calculate the intersection-and-union ratio of the nested edge coordinate point corresponding to the nested primitive and the nested edge coordinate point; if the intersection-and-union ratio is greater than a preset ratio, output the error type label as redundant overlap.
[0051] Specifically, the intersection-and-union ratio is used to determine whether there is an excessive repetitive drawing problem in space between the nested primitive and the nested primitive. The intersection-and-union ratio refers to the ratio of the intersection area to the union area of two geometric figures (here, the figure composed of the nested edge coordinate points corresponding to the nested primitive and the figure composed of the nested edge coordinate points). It is an indicator to measure the degree of overlap between two figures. The area ratio of the intersection area to the union area of the figure composed of the nested edge points and the nested edge points is calculated. If the intersection-and-union ratio is greater than the preset ratio (such as 0.85), it indicates that the two primitives overlap seriously and there is redundancy. The output error type label is redundant overlap. For example, in some library reference errors, the door primitive may be copied multiple times and superimposed on the original primitive. Such errors are not easy to detect manually but will seriously affect the quality of the drawing.
[0052] Furthermore, the nested relationship includes at least a connection relationship, a containment relationship and a superposition relationship.
[0053] Specifically, in this embodiment, the identification of nested primitive pairs is not limited to geometric nesting but also encompasses various forms of structural relationships, enabling a more comprehensive depiction of the complex dependencies and organizational logic between primitives in CAD drawings. Nesting relationships include at least connection relationships, containment relationships, and overlay relationships. A connection relationship refers to the attachment or extension of two primitives through a structural connection point or functional connection line. For example, a wall primitive and a cable channel primitive are typically connected via an opening or notch, while a table leg primitive in furniture is connected to a tabletop primitive via a line segment. Automatic identification of connection relationships is achieved in primitive semantic modeling by analyzing topological boundary continuity or shared nodes. To identify whether connection relationships exist between primitives, the following analysis process can be employed: The boundary path of each primitive in the constructed primitive structural semantic model is segmented and extracted to generate a set of contact edge pairs between adjacent primitives. Then, a geometric adjacency detection algorithm is used to determine whether any endpoint pairs between the boundaries of two primitives have a distance less than a set threshold (e.g., 2 mm). Common control points (e.g., connecting blocks or common anchor points) are extracted from the vector representation of the CAD primitives to determine whether the primitives are constrained by the same nodes. Determine whether the boundaries of two entities are highly aligned along a certain direction (for example, a light trough and a main beam are collinear), satisfying the connection directionality and boundary overlap characteristics. Finally, the entity pairs that meet any of the above conditions are marked as connected and the connection position coordinates or anchor point locations are recorded.
[0054] The inclusion relationship means that the complete geometric range of one element completely contains another element, and is often used to represent local components or nested components. For example, the room element contains the furniture element, and the equipment outline element contains the wiring port element, etc. The inclusion relationship is identified by using methods such as the bounding box inclusion test and the point set inclusion test. When extracting the inclusion relationship, the following geometric analysis process can be used: establish a rectangular bounding box for all elements, and perform a set relationship judgment on the boundary point sets of the two elements (A and B). If all the boundary points of element B are within the boundary area of element A, it is judged that A contains B. The element pairs that satisfy the "inner element is completely contained in the outer element" are marked as inclusion relationships, and the relationship between the inclusion boundary and the center position is recorded.
[0055] An overlay relationship refers to a situation where the geometric areas of two graphics elements have a significant intersection, but there may not be a top-to-bottom or structural dependency relationship. For example, the lighting design graphics element of a two-layer ceiling may be superimposed on the main structural ceiling graphics element, or multiple symbol graphics elements may be mistakenly superimposed in the same position. This type of relationship is prone to overlapping errors in high-density drawings. The rationality of the overlay can be comprehensively judged based on the graphics layer, legend semantics, and intersection-and-union features. For the identification of overlay relationships, the main focus is on the degree of geometric overlap and layer semantic conflicts between graphics elements. For example, the edge coordinate points of the two graphics elements are extracted to construct their geometric boundary contours. Then, based on the pixel points or boundary point sets, the intersection-and-union ratio of the two graphics elements is calculated. If the intersection-and-union ratio is greater than a preset value (such as 0.3 or 0.5), the two are judged to be superimposed. For all pairs of graphics elements that meet the conditions, overlay relationship marks are output and their overlapping areas are located.
[0056] By expanding nested relationships into three typical structures: connection, inclusion, and overlay, the true logical and semantic context between primitives can be more accurately extracted, thereby improving the contextual awareness and semantic understanding of error recognition. This is particularly true in multi-layered nested drawings, such as complex assembly drawings and electrical installation diagrams, effectively reducing the risk of misidentification and missed recognition, and significantly enhancing applicability to different engineering drawing styles and design specifications.
[0057] Further, such as Figure 3 As shown, step S51 includes:
[0058] Step S511: Read the CAD history file, and mark the error sample training set and the correct sample training set with a nested relationship in the CAD history file as well as the corresponding error type supervision labels.
[0059] Step S512: Input the error sample training set and the correct sample training set into the deep learning model for analysis, and output the multi-label classification results for each error type.
[0060] Step S513: Optimize model parameters by comparing the multi-label classification result with the error type supervision label supervision until the accuracy of the multi-label classification result reaches a preset threshold, and output a nested primitive compliance determiner.
[0061] Specifically, from existing historical CAD project files, we read and filter the entity data containing nested relationships, and manually or semi-automatically annotate the nested structures with entity errors to form an error sample training set; the nested entity pairs with compliant structures and no nesting errors are organized into a correct sample training set; in addition, based on the known fault information or manual annotations in the drawings, all error samples are annotated with corresponding error type supervision labels, including entity out-of-bounds, entity detachment, layer error, redundant overlap, etc.
[0062] The training set of error samples and correct samples is fed into a pre-defined deep neural network, preferably a convolutional neural network or graph neural network architecture with a multi-branch attention mechanism or residual fusion structure. This extracts the primitive structure, boundary features, and nested context relationships, and then trains the model into a multi-label classification deep learning model. The model outputs a multi-label classification probability vector for each nested primitive pair for each error type: ypred = (Pout of bounds, Pdetached, Player, Poverlap). The model supports simultaneous prediction of multiple potential error labels for a nested primitive pair, addressing the complex nature of multiple errors in practice.
[0063] The model output is compared against pre-labeled supervised labels on a per-category basis, using a binary cross-entropy loss function and average accuracy as primary evaluation metrics. The model parameters are continuously updated via a backpropagation algorithm until the multi-label classification accuracy on the validation set reaches a preset threshold (e.g., 95%). Finally, a nested primitive compliance determiner that meets robustness requirements is output. This model not only accurately identifies different types of nesting errors but also automatically adapts to unlabeled combined errors in new samples, significantly enhancing the intelligent level of CAD primitive verification.
[0064] Furthermore, in step S5, interactive feedback correction is performed according to the output erroneous recognition results, including:
[0065] Step S54: determining a correction condition according to the error type label of the error recognition result.
[0066] Step S55: performing coordinate correction on the erroneous position coordinates in the erroneous recognition result according to the correction conditions to obtain a corrected CAD drawing.
[0067] Step S56: simultaneously recording the feedback information of the interactive user based on the revised CAD drawing, and updating the nested primitive compliance determiner according to the feedback information.
[0068] Specifically, based on the error type labels output by the nested element compliance determiner (such as element out-of-bounds, element detachment, layer error, or redundant overlap), corresponding correction strategy templates are preset or customized by the user. For example, if an element is out-of-bounds: the nested element boundary is pulled back to within the boundaries of the nested element; if an element is detached: the element is adsorbed and aligned according to the reference drawing or standard structure; if a layer error occurs: the element's layer is adjusted to comply with the layer priority table specifications; and if a redundant overlap occurs: redundant elements are deleted or overlapping areas are merged. Correction logic is automatically matched based on the error type label, forming clear correction conditions, including parameters such as the target element, constraint range, and correction method.
[0069] Based on the above correction conditions, the CAD drawing engine is called to modify the position, outline or layer properties of the corresponding nested primitives. This step can achieve semi-automatic or fully automatic correction, and supports interactive confirmation and fine-tuning in the user graphical interface, and finally outputs a CAD drawing with accurately corrected coordinates.
[0070] The user's feedback information on the corrected drawing (including operations such as "confirm modification", "cancel modification", and "custom adjustment") is bound to the original error recognition result to form a new annotation sample; by continuously recording and accumulating user feedback behavior, the nested element compliance determiner model is dynamically updated, including retraining model parameters, adjusting classification label weights, introducing a confidence assessment mechanism, etc., to continuously optimize the accuracy and adaptability of error recognition and correction.
[0071] For example, in a mechanical assembly drawing, there is a nested relationship between a bolt (nested entity) and a nut (nested entity). The error recognition result shows that the bolt has an entity out-of-bounds error. According to the error type label "element out-of-bounds", the correction condition is determined to be moving the bolt to 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 units toward the center of the nut. Call the move command of the CAD software to correct the coordinates of the bolt so that it moves 2 units to the boundary constraint range of the nut, and save the corrected CAD drawing. The user reviews the corrected drawing and feedback that the position of the bolt is still unreasonable and may affect the assembly. The user's feedback information is recorded and input into the deep learning model of the nested entity compliance determiner as a new training sample. The model is retrained to optimize the model's recognition conditions and correction methods for entity out-of-bounds errors.
[0072] The closed-loop optimization of the model is achieved through an interactive feedback mechanism, which enables the CAD error recognition process to have continuous learning and adaptive capabilities, significantly improving the reliability and intelligence level in long-term operation.
[0073] In summary, the CAD drawing error recognition method using deep learning provided by the embodiments of the present application has the following beneficial effects:
[0074] By reading primitive information from CAD drawings and constructing a primitive structure, basic information about each primitive in the drawing can be obtained. Next, a deep learning-based feature extraction network extracts image features from the CAD drawing, and semantically models the primitive structure, resulting in a semantic model of the primitive structure. This process leverages the semantic parsing capabilities of image features, effectively improving the automatic recognition and processing of primitives. Subsequently, nested relationships between primitives are identified, and edge detection and contour fitting are used to extract the edge coordinates of nested primitives. This further defines boundary constraints and enables precise error localization. For various error types, including primitive out-of-bounds, primitive detachment, layer errors, and redundant overlap, a nested primitive compliance determiner is constructed, employing geometric algorithms and a layer priority rule table to classify and address each error individually. These error types can be refined and identified using intersection-over-union (IoU), geometric judgment, and layer priority rules, with precise labeling of the error type and location. Furthermore, by gradually correcting primitive positions and structures and incorporating an interactive feedback mechanism, the error recognition model can be updated based on user feedback, enabling dynamic self-learning capabilities.
[0075] 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, which effectively improves the accuracy and real-time performance of error recognition in the nested structure of CAD drawings, significantly reduces the need for manual intervention, and improves the overall drawing quality.
[0076] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to 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 comprises: Read the primitive information of CAD drawings and build primitive structure; Extracting 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 a nested primitive pair of the primitive structure semantic model, wherein the nested primitive pair consists of two primitives in a nested relationship; Performing edge detection and contour fitting on the nested primitives in the nested primitive pair, and extracting the coordinate points of the nested edges; The nested edge coordinate points of the nested primitives in the nested primitive pair are obtained, the boundary constraint range is generated by the nested edge coordinate points to perform error recognition on the nested edge coordinate points, and interactive feedback correction is performed according to the output error recognition result.
2. The CAD drawing error recognition method using deep learning according to claim 1, wherein: If there are multiple nested primitive pairs, nest the multiple nested primitive pairs in layers according to the nesting order, and output a sequence of nested primitive pairs from the inner layer to the outer layer; Taking the nested primitive pair sequence as the error recognition priority, interactive feedback correction is performed on the error recognition results of the multiple nested primitive pairs step by step.
3. The CAD drawing error recognition method using deep learning as claimed in claim 1, characterized in that: Generating a boundary constraint range based on the nested edge coordinate points to perform error recognition on the nested edge coordinate points, the method comprising: Constructing a nested primitive compliance determiner and defining error types of the nested primitive compliance determiner, including primitive out of bounds, primitive detachment, layer error, and redundant overlap; The primitive compliance determiner 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 position coordinates; The error type label and the error position coordinates are output as an error recognition result.
4. The CAD drawing error recognition method using deep learning as claimed in claim 3, wherein: The primitive compliance determiner performs error recognition on the coordinate distribution area of the nested edge coordinate points according to the boundary constraint range, and the method includes: Using a geometric judgment algorithm to determine whether the nested edge coordinate 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 the out-of-bounds coordinate points is greater than a preset threshold, the error type label is output as the primitive out-of-bounds.
5. The CAD drawing error recognition method using deep learning as claimed in claim 3, wherein: The primitive compliance determiner performs error recognition on the coordinate distribution area of the nested edge coordinate points according to the boundary constraint range, and the method includes: The intersection of the boundary constraint range and the coordinate points of the nested edge coordinate points is identified, and if the intersection of the coordinate points is a zero area, the error type label is output as primitive detachment.
6. The CAD drawing error recognition method using deep learning as claimed in claim 3, characterized in that: The primitive compliance determiner performs error recognition on the coordinate distribution area of the nested edge coordinate points according to the boundary constraint range, and the method includes: Establishing a layer priority rule table according to the graphic element structure; Connecting the layer priority rule table with the primitive compliance determiner to obtain the layer number of the nested primitive corresponding to the nested edge coordinate point and the layer number of the nested primitive corresponding to the boundary constraint range; If the layer number of the nested primitive is smaller than the layer number of the nested primitive, the error type label output is layer error.
7. The CAD drawing error recognition method using deep learning as claimed in claim 3, wherein: The primitive compliance determiner performs error recognition on the coordinate distribution area of the nested edge coordinate points according to the boundary constraint range, and the method includes: Calculate the intersection-and-union ratio of the nested edge coordinate point corresponding to the nested primitive and the nested edge coordinate point; If the intersection-over-union ratio is greater than a preset ratio, the error type label is output as redundant overlap.
8. The CAD drawing error recognition method using deep learning according to claim 1, wherein: The nested relationship includes at least a connection relationship, a containment relationship and a superposition relationship.
9. The CAD drawing error recognition method using deep learning as claimed in claim 3, wherein: Building a nested primitive compliance checker involves: Read the CAD history file, and mark the error sample training set and the correct sample training set with a nested relationship in the CAD history file as well as the corresponding error type supervision label; Input the error sample training set and the correct sample training set into the deep learning model for analysis, and output the multi-label classification results of each error type; The multi-label classification result is compared with the error type supervision label to optimize the model parameters until the accuracy of the multi-label classification result reaches a preset threshold, and a nested primitive compliance determiner is output.
10. The CAD drawing error recognition method using deep learning according to claim 3, wherein: Interactive feedback correction is performed according to the output error recognition results, and the method includes: determining a correction condition according to the error type label of the error recognition result; Correct the coordinates of the error position in the error recognition result according to the correction condition to obtain a corrected CAD drawing; At the same time, feedback information of the interactive user based on the revised CAD drawing is recorded, and the nested primitive compliance determiner is updated 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