An end-to-end CAD drawing modeling method and device based on deep learning

Through an end-to-end method based on deep learning, CAD drawings are converted into logic-free hierarchical images, and unsupervised pre-training and supervised fine-tuning of component prediction models are solved, and the existing CAD mold flip technology is time-consuming and low accuracy is achieved, and efficient and accurate CAD drawing mold flip is achieved.

CN119339403BActive Publication Date: 2025-08-01HANGZHOU QUNHE INFORMATION TECHNOLOGIES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411226549.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-03
Publication Date
2025-08-01
Estimated Expiration
2044-09-03

AI Technical Summary

Technical Problem

The existing CAD mold flip technology relies on manual and experience, which leads to mold flip time, low accuracy and poor generalization, making it impossible to achieve end-to-end efficient and accurate mold flip.

Method used

Using an end-to-end method based on deep learning, the vector elements in the CAD drawings are preprocessed into images with no logic level, and the component prediction model is constructed for unsupervised pre-training and supervised fine-tuning, combining 2D object detection and 3D parameterized model generation algorithms to realize automated prediction and post-processing of component vector description.

Benefits of technology

It realizes efficient and accurate mold turning of CAD drawings, reduces manual intervention, improves the generalization ability and accuracy of mold turning, and shortens mold turning time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119339403B_ABST
    Figure CN119339403B_ABST
Patent Text Reader

Abstract

The present invention discloses an end-to-end CAD drawing modeling method and device for deep learning, which includes: preprocessing vector primitives in CAD drawings into geometric figures to form an image without logical hierarchy; constructing a component prediction model for predicting component vector descriptions based on deep learning, and performing two-stage training on the component prediction model, namely unsupervised pre-training and supervised fine-tuning; using the trained component prediction model to predict component vector descriptions, and performing post-processing on the predicted component vector descriptions to ensure the accuracy of the constructed vector descriptions, thereby solving the technical problems of long time consumption, poor accuracy, weak generalization ability, and inability to achieve end-to-end in existing CAD drawing modeling.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of CAD assisted design, and particularly relates to an end-to-end CAD drawing model conversion method and device based on deep learning. Background Art

[0002] In the construction field, computer-aided design (CAD) is an indispensable tool, which greatly improves the efficiency of design and drawing. CAD software can help designers quickly draw accurate house type drawings and cabinet drawings, realize the transformation from design concepts to visual results, and at the same time reduce the time and labor costs required for traditional hand drawing.

[0003] However, despite the wide application of CAD technology, there are still some defects in the existing CAD model conversion technology. CAD model conversion refers to converting CAD drawings into models, and the entire model conversion process can be understood as two core stages, namely primitive recognition and construction.

[0004] Regarding primitive recognition, the current mainstream methods mainly rely on layer convention and feature recognition. Layer convention means that by agreeing with the drawing drafter in advance on keywords, relevant types of components are drawn on the same layer and named with specified keywords for convenient subsequent extraction. Its disadvantage is that for different drawings, the drafter needs to communicate and confirm the drawing method and keyword naming method in advance, with poor flexibility. Feature recognition means that relevant types of primitive components are recognized through features such as geometric features, color features, and legend features summarized from experience. The disadvantage is that it depends on professionals' summary of previous drawings, with poor versatility, and recognition will fail once there are drawings that cannot be covered by the rules.

[0005] Regarding construction, the current mainstream method is to perform vector description construction of actual house type components and cabinet board components based on the geometric rules summarized from a large amount of business experience according to the labeled results obtained from primitive recognition.

[0006] It can be seen that the existing recognition methods in the above two stages have the defect of relying on a large amount of manual work and experience summary, resulting in a large difference between the results after model conversion and the original CAD drawings, and being unable to fully meet the requirements for accuracy and details, thus affecting the accuracy and efficiency of subsequent manufacturing and construction.

[0007] Therefore, aiming at these defects of the existing CAD model conversion technology, further technological innovation and improvement are needed to achieve more efficient and accurate model conversion of CAD drawings, thereby improving the efficiency and accuracy of the building design and manufacturing processes. Summary of the Invention

[0008] In view of the above, the object of the present invention is to provide an end-to-end CAD drawing modeling method and device based on deep learning, so as to solve the technical problems of long time consumption, poor accuracy, weak generalization, and inability to achieve end-to-end in existing CAD drawing modeling.

[0009] To achieve the above object of the invention, an end-to-end CAD drawing modeling method based on deep learning provided by an embodiment includes the following steps:

[0010] Preprocess the vector primitives in the CAD drawing into geometric shapes and form an image without logical hierarchy;

[0011] Construct a component prediction model based on deep learning for predicting the vector description of components, and perform two-stage training on the component prediction model, namely unsupervised pre-training and supervised fine-tuning;

[0012] Use the trained component prediction model to predict the vector description of components, and post-process the predicted vector description of components to ensure the accuracy of the constructed vector description.

[0013] Preferably, the step of preprocessing the vector primitives in the CAD drawing into geometric shapes and forming an image without logical hierarchy includes:

[0014] Completely break up the three logical hierarchy layers, blocks, and vector primitives included in the CAD drawing from high to low, and further segment, scale, and approximate the line segments, composite line segments, and surface contour types of the vector primitives into basic geometric shapes, and scale and draw the geometric shapes onto a unified bitmap to form an image without logical hierarchy.

[0015] Preferably, when the component is a housing component, the component prediction model constructed based on deep learning includes a first image encoder, Deformable-DETR, and a multi-head output layer connected in sequence, wherein the first image encoder includes a pre-trained VIT encoder and a multi-scale image feature construction layer connected in sequence,

[0016] The image is input into the component prediction model, and after the pre-trained VIT encoder encodes the feature image with a fixed resolution, it passes through the multi-scale image feature construction layer to form multi-scale image features. The multi-scale image features are encoded and decoded by Deformable-DETR and then input into the multi-head output layer, and the vector description of the housing component is predicted in the multi-head output layer, wherein the vector description of the housing component includes the component type, the component bounding box, and the component vector description parameters.

[0017] Preferably, the two-stage training of unsupervised pre-training and supervised fine-tuning on the component prediction model corresponding to the housing component includes:

[0018] The first image encoder in the component prediction model is unsupervised pre-trained using unlabeled CAD drawings after preprocessing;

[0019] The component prediction model is supervised fine-tuned using labeled CAD drawings after preprocessing. The loss functions used during supervised fine-tuning include a class loss constructed based on component types, a parameter regression loss constructed based on component vector description parameters, and a bounding box-related loss constructed based on component bounding boxes. At the same time, for the N sets of prediction results output by the component prediction model and the M sets of supervised data, optimal bipartite graph matching is performed, and the M sets of matching results are used to calculate the parameter loss, parameter regression loss, and bounding box-related loss.

[0020] Preferably, when the component is a housing component, post-processing is performed on the predicted component vector description to ensure the accuracy of the constructed vector description, including:

[0021] Coordinate system conversion, including converting the coordinates of the housing component vector description back to the original CAD drawing coordinate system;

[0022] Fine-tuning the component vector description of the original primitive, including constructing all primitives of the original CAD drawing into an AABB tree, traversing all edges in the housing component vector description under the original CAD drawing coordinate system, and using the AABB tree to search for the original primitives exceeding the threshold as the precise edges in the housing component vector description based on a set threshold.

[0023] Preferably, when the component is a cabinet component composed of multiple plate components, the component prediction model constructed based on deep learning includes a second image encoder and a text decoder connected in sequence;

[0024] The image is input into the component prediction model, the image features are extracted by the second image encoder, and the image features are input into the text decoder to sequentially predict the bounding boxes of each plate component in an autoregressive manner.

[0025] Preferably, when the component is a cabinet component composed of multiple plate components, post-processing is performed on the predicted component vector description to ensure the accuracy of the constructed vector description, including:

[0026] Judging the dependency relationship between two plate components based on the contact area between the bounding boxes of the plate components, modeling a directed acyclic dependency graph based on the dependency relationship, and re-modeling the cabinet model based on the dependency graph.

[0027] To achieve the above-mentioned invention purpose, an end-to-end CAD drawing model conversion method based on deep learning provided by an embodiment of the present invention further includes:

[0028] A preprocessing module, which is used to preprocess the vector primitives in the CAD drawing into geometric figures and form an image without logical levels;

[0029] A model construction and training module, which is used to construct a component prediction model for predicting a component vector description based on deep learning, and perform two-stage training on the component prediction model, namely unsupervised pre-training and supervised fine-tuning:

[0030] A prediction and post-processing module, which is used to use the trained component prediction model to predict the component vector description, and post-process the predicted component vector description to ensure the accuracy of the constructed vector description.

[0031] To achieve the above invention purpose, the embodiment also provides a computing device, including a memory and one or more processors. An executable code is stored in the memory. When the one or more processors execute the executable code, it is used to implement the above end-to-end CAD drawing model conversion method based on deep learning.

[0032] To achieve the above invention purpose, the embodiment also provides a computer-readable storage medium, on which a program is stored. When the program is executed by a processor, it implements the above end-to-end CAD drawing model conversion method based on deep learning.

[0033] Compared with the prior art, the beneficial effects of the present invention at least include:

[0034] On the basis of preprocessing the vector primitives in the CAD drawing into geometric figures and forming an image without logical hierarchy, a component prediction model for predicting the component vector description is constructed and two-stage training of unsupervised pre-training and supervised fine-tuning is performed, so as to improve the generalization of the model. Then, the trained component prediction model is used to predict the component vector description, and the predicted component vector description is post-processed to ensure the accuracy of the constructed vector description. In this way, the CAD drawing is modeled end-to-end based on deep learning, without relying on manual work, with short time consumption and high accuracy. Description of the Drawings

[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0036] Figure 1 is a flowchart of the end-to-end CAD drawing model conversion method based on deep learning provided by the embodiment;

[0037] Figure 2 is a schematic diagram of an image without logical hierarchy provided by the embodiment;

[0038] Figure 3It is a schematic structural diagram of a component prediction model corresponding to the housing type component provided by the embodiment;

[0039] Figure 4 It is a schematic structural diagram of the first image encoder provided by the embodiment;

[0040] Figure 5 It is a schematic structural diagram of a component prediction model corresponding to the cabinet component provided by the embodiment;

[0041] Figure 6 It is a schematic structural diagram of an end-to-end CAD drawing model conversion device based on deep learning provided by the embodiment. Detailed implementation manners

[0042] To make the objectives, technical solutions and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific implementation manners described herein are only used to explain the present invention and do not limit the protection scope of the present invention.

[0043] The inventive concept of the present invention is: to solve the technical problems of long time consumption, poor accuracy, weak generalization, and inability to achieve end-to-end in the existing CAD drawing model conversion, the embodiments of the present invention provide an end-to-end CAD drawing model conversion method and device based on deep learning, which uniformly convert CAD drawings in any format into images, pre-train the image encoder in an unsupervised manner, and then for downstream tasks, combine 2D object detection algorithms and 3D parametric model generation algorithms to perform supervised fine-tuning on the component prediction model, and then organically combine with the post-processing geometric algorithm to form a new and complete end-to-end vector component model conversion scheme for CAD drawings.

[0044] As Figure 1 shown, an end-to-end CAD drawing model conversion method based on deep learning provided by the embodiment includes the following steps:

[0045] S1. Preprocess the vector primitives in the CAD drawing into geometric figures and form an image without logical hierarchy.

[0046] In the embodiment, the original CAD drawing includes three different logical hierarchies, from high to low are layer, block, and vector primitive, and the primitive types include line segment, composite line segment, and surface contour. Preprocess the original CAD drawing to process the vector primitives in the CAD drawing into a format that the model can understand, specifically including: completely disassembling the hierarchical layers, blocks, and vector primitives in the CAD drawing, and further segmenting, scaling, and approximating the line segment, composite line segment, and surface contour types of the vector primitives into basic geometric figures, and scaling and drawing the geometric figures onto a unified bitmap based on a fixed physical-to-image scaling ratio to form an image without logical hierarchy, as Figure 2as shown

[0047] S2. Build a component prediction model based on deep learning to predict the vector description of components according to images, and perform two-stage training on the component prediction model, namely unsupervised pre-training and supervised fine-tuning.

[0048] In the embodiment, the component prediction model built based on deep learning is used to predict the vector description of components. The image preprocessed in S1 is input into the component prediction model, and the vector description of the component is predicted and output. At the same time, limited by the limited CAD drawing data containing supervision information, when training the component prediction model, an unsupervised pre-training and supervised fine-tuning two-stage training method is adopted. Among them, unsupervised pre-training refers to performing unsupervised pre-training based on a large amount of unlabeled CAD drawing data, and supervised fine-tuning refers to performing supervised fine-tuning based on a relatively small amount of labeled CAD drawing data according to the drawing type for downstream tasks to obtain the final component prediction model.

[0049] In the embodiment, the components include housing components and cabinet components. For housing components, their vector descriptions can be represented by a set of planar curve parameters with component category (class) and thickness attributes, and usually the following three types are used:

[0050] 1. Straight line segment: starting point, ending point;

[0051] 2. Arc: starting point, ending point, convexity;

[0052] 3. Bezier curve: starting point, ending point, control point;

[0053] Among them, the planar coordinate points of each type of planar curve can be represented by the x-axis offset and y-axis offset (x, y) in the bitmap. Then the starting point, ending point, and control point are represented as (start_x, start_y), (end_x, end_y), and the control point (control_x, control_y) respectively. At the same time, the convexity is represented as bulge. In addition, an additional parameter parameter_type can be added to distinguish the specific planar curve parameter type. Based on this, a single housing component can be represented by the following parameters: [class, parameter_type, start_x, start_y, end_x, end_y, thickness, bulge, control_x, control_y]. For an input image, there are multiple housing components. Therefore, the final model output result can be represented as a set of the above parameters.

[0054] When constructing the component prediction model corresponding to the housing unit components, according to the idea of ensemble prediction, a new model structure VIT-MultiScale-Deformable-DETR is designed as the component prediction model based on the 2D object detection algorithm model Deformable-DETR and the first image encoder composed of the pre-trained Vision Transformer (VIT).

[0055] As Figure 3 shown, the component prediction model corresponding to the housing unit components includes a first image encoder, Deformable-DETR, and a multi-head output layer connected in sequence. The first image encoder includes a pre-trained VIT encoder and a multi-scale image feature construction layer connected in sequence. Among them, the multi-head output layer can adopt multiple MLP layers. The pre-processed image is input into the component prediction model. After the pre-trained VIT encodes the feature image with a fixed resolution, it passes through the multi-scale image feature construction layer to form multi-scale image features. The multi-scale image features are encoded and decoded by Deformable-DETR and then input into the multi-head output layer, and the vector description of the housing unit components is predicted in the multi-head output layer. The vector description of the housing unit components includes component type, component bounding box, and component vector description parameters.

[0056] In the embodiment, the pre-trained VIT encoder included in the first image encoder is used to extract image features. Before it is applied, the VIT encoder is unsupervised pre-trained based on MAE (Masked AutoEncoder) and using a large amount of unlabeled CAD drawing data pairs. Among them, MAE refers to an unsupervised pre-training method for images, by randomly masking some tokens in the image token sequence and trying to reconstruct. The embodiment also draws on the method of Feature Pyramid Network (FPN). The multi-scale image feature construction layer adopts a simple feature pyramid structure. Based on the fixed-resolution output of the VIT encoder, multi-scale image features are generated by combining methods such as convolution / identity mapping / deconvolution, and its structure is as Figure 4 shown.

[0057] In the embodiment, the multi-head output layer can adopt three MLP layers, corresponding to three prediction heads, which are responsible for predicting different component categories (class), vector description parameters (parameter) of the components, and component bounding boxes (bounding box). Deformable-DETR includes a Deformable Transformer Encoder and a Deformable Transformer Decoder. In the Deformable Transformer Decoder, object queries are input. Each time an image is input, the Deformable Transformer Decoder can generate N outputs each time, where N is the same as the number of object queries. These N outputs then pass through a group of MLPs to output N sets of vector descriptions of the housing components. It should be noted that in the CAD model conversion application scenario of the present invention, the parameter prediction head outputs the true vector description of the component. The present invention retains the bounding box prediction head, and its function is to assist in the matching calculation process between the prediction result and the GT, and to add an additional supervision item to the loss to help the model converge more stably.

[0058] When performing supervised fine-tuning training on the component prediction model, the pre-processed annotated CAD drawings are used to fine-tune the component prediction model. The loss function used in the supervised fine-tuning includes a category loss constructed based on the component type. This category loss can adopt a focal loss constructed based on the predicted component category and the component category label. It also includes a parameter regression loss constructed based on the component vector description parameters. This parameter regression loss can adopt an L1 loss constructed based on the predicted component vector description parameters and the true values of the component vector description parameters. It further includes a bounding box-related loss constructed based on the component bounding box. This bounding box-related loss can adopt an L1 loss (regression loss) and an iou loss constructed based on the predicted bounding box and the true value of the bounding box. On this basis, the predicted vector descriptions of the N sets of housing components do not participate in all loss calculations. Specifically, for the N sets of predicted vector descriptions output by the component prediction model and the M sets of supervised data, optimal bipartite graph matching is performed, and the M sets of matching results are used to calculate the category loss, parameter regression loss, and bounding box-related loss.

[0059] For cabinet components, each cabinet component is assembled by a series of panel parts. Therefore, when defining the vector description of cabinet panel parts, the 3D model of the cabinet can be converted into a bounding box (3D bounding box) representation with panel parts as the granularity, and after quantization processing, it is further processed into a token sequence. Specifically, a single panel part can be expressed as a subsequence of length 6, [x1, y1, z1, x2, y2, z2], where [x1, y1, z1] jointly describe the coordinates of one corner of the 3D bounding box, and [x2, y2, z2] describe the coordinates of the other corner. The entire cabinet consists of N panel parts and can be described as a sequence of length 6*n, [panel part 1, panel part 2,..., panel part n].

[0060] When constructing the component prediction model corresponding to the cabinet panel parts, a 3D parametric model generation algorithm is used to construct the component prediction model as shown in Figure 5 The component prediction model shown specifically includes a second image encoder and a text decoder connected in sequence. The preprocessed image is input into the component prediction model as shown in Figure 5 The component prediction model shown. The second image encoder extracts image features, and the image features are input into the text decoder to sequentially predict the bounding box of each panel part in an autoregressive manner, and output the token sequence of the three-dimensional structure of the cabinet panel parts.

[0061] The second image encoder can use a pre-trained VIT encoder. The difference from the first image encoder is that it does not use the multi-scale image feature construction layer, and only uses the pre-trained VIT encoder to extract image features. Before this pre-trained VIT encoder is applied, it is also based on MAE and uses a large amount of unlabeled CAD drawing data pairs for unsupervised pre-training of the VIT encoder.

[0062] The text decoder can use a Transformer Decoder to predict the next token and sequentially predict the bounding box coordinate attributes of a single panel part in an autoregressive form. Before this text decoder is applied, it also needs to be trained in combination with the downstream task. Specifically, during training, the entire component prediction model is supervised and fine-tuned together with the pre-trained VIT encoder. The labeled CAD drawings are preprocessed and then input into the component prediction model, and loss functions such as cross-entropy loss are used for supervised training.

[0063] S3. Use the trained component prediction model to predict the component vector description, and post-process the predicted component vector description to ensure the accuracy of the constructed vector description.

[0064] In the embodiment, the trained component prediction model is deployed and a visual interaction interface is provided, and then end-to-end CAD drawing model conversion prediction is realized. Specifically, the user uploads a CAD drawing through the visual interaction interface. After being preprocessed, the CAD drawing is input into the trained component prediction model. Through forward inference prediction, a component vector description is output. Specifically, for the household components, the corresponding component prediction model is used for inference prediction, and for the cabinet components, the corresponding component prediction model is used for inference prediction. Then, post-processing is performed on the prediction results to ensure the accuracy of the vector description, and an accurate vector description is returned to the user.

[0065] The vector description of the household component prediction is post-processed for the vector description corresponding to each component at the image scale to ensure the accuracy of the vector description and make it more in line with the accuracy of the original drawing. Specifically, it includes coordinate system conversion and fine-tuning of the component vector description of the original primitive. Among them, the coordinate system conversion refers to converting the coordinates of the household component vector description back to the original CAD drawing coordinate system; fine-tuning the component vector description of the original primitive includes: constructing all primitives of the original CAD drawing into an AABB tree, traversing all the edges in the household component vector description under the original CAD drawing coordinate system, and based on a set threshold, using the AABB tree to search for the original primitives that exceed the threshold as the accurate edges in the household component vector description.

[0066] The vector description of the cabinet component prediction is an expression of a series of panel bounding boxes without the connection between the panels. To make the prediction result more holistic, the predicted vector description of the cabinet component includes: calculating the contact area between each panel, judging the dependency relationship between two panels based on the contact area between the bounding boxes of the panels, modeling a directed acyclic dependency graph based on the dependency relationship, and re-modeling the cabinet model based on the dependency graph.

[0067] As Figure 6 shown, the embodiment also provides an end-to-end CAD drawing model conversion device based on deep learning, including a preprocessing module 61, a model construction and training module 62, and a prediction and post-processing module 63. Among them, the preprocessing module 61 is used to preprocess the vector primitives in the CAD drawing into geometric figures and form an image without logical levels; the model construction and training module 62 is used to construct a component prediction model for predicting the component vector description based on deep learning, and perform two-stage training on the component prediction model, namely unsupervised pre-training and supervised fine-tuning: the prediction and post-processing module 63 is used to predict the component vector description by using the trained component prediction model, and perform post-processing on the predicted component vector description to ensure the accuracy of the constructed vector description.

[0068] It should be noted that when the above-described end-to-end CAD drawing modeling device based on deep learning performs CAD drawing modeling, the above-described functional modules should be used as examples for illustration. The above functions can be allocated to different functional modules according to needs, that is, the internal structure of the terminal or server is divided into different functional modules to complete all or part of the functions described above. In addition, the above-described end-to-end CAD drawing modeling device based on deep learning and the embodiment of the end-to-end CAD drawing modeling method based on deep learning belong to the same inventive concept. For the specific implementation process, please refer to the embodiment of the end-to-end CAD drawing modeling method based on deep learning, which will not be elaborated here.

[0069] Based on the same inventive concept, the embodiment also provides a computing device, including a memory and one or more processors. The memory stores executable code. When the one or more processors execute the executable code, it is used to implement the above-described end-to-end CAD drawing modeling method based on deep learning, specifically including the following steps:

[0070] S1. Preprocess the vector primitives in the CAD drawing into geometric figures and form an image without logical hierarchy;

[0071] S2. Build a component prediction model based on deep learning for predicting the vector description of components according to the image, and perform two-stage training on the component prediction model, namely unsupervised pre-training and supervised fine-tuning;

[0072] S3. Use the trained component prediction model to predict the vector description of the component, and post-process the predicted vector description of the component to ensure the accuracy of the constructed vector description.

[0073] For the computing device provided in the embodiment, at the hardware level, in addition to including a processor and a memory, it also includes other hardware required for other services such as an internal bus, a network interface, and a memory. The memory is a non-volatile memory. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to implement the above-described end-to-end CAD drawing modeling method based on deep learning in S1 - S3. Of course, in addition to the software implementation method, the present invention does not exclude other implementation methods, such as logical devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logical unit, and can also be hardware or a logical device.

[0074] Based on the same inventive concept, the embodiment also provides a computer-readable storage medium, on which a program is stored. When the program is executed by a processor, it implements the above-described end-to-end CAD drawing modeling method based on deep learning, specifically including the following steps:

[0075] S$. Preprocess the vector primitives in the CAD drawing into geometric figures and form an image without logical hierarchy;

[0076] S2. Build a component prediction model for predicting the vector description of components according to images based on deep learning, and perform two-stage training on the component prediction model, namely unsupervised pre-training and supervised fine-tuning;

[0077] S3. Use the trained component prediction model to predict the vector description of components, and post-process the predicted vector description of components to ensure the accuracy of the constructed vector description.

[0078] In the embodiment, the computer-readable medium includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data.

[0079] The end-to-end component reverse modeling technical solution of the CAD drawings provided in the above embodiment has the following technical effects compared with the existing methods (such as "vector primitive attribution" first and then post-processing construction, "image segmentation" first and then post-processing construction, and construction based on pure business rules, etc.):

[0080] 1. Strong generalization performance: The component prediction models in the present invention are all trained based on the paradigm of pre-training first and then fine-tuning. A large amount of drawing data is used in the training process, which improves the generalization ability of the model, and the recognition ability for drawings (new drawings uploaded by users) that have not been seen in the training stage will be better;

[0081] 2. End-to-end output of the vector description of components: The present invention enables the component prediction model to directly output the vector description of components, successfully avoiding a large number of post-processing construction logics based on empirical summaries in the existing methods, and only retaining a small amount of post-processing logic to fine-tune the results of the model prediction, with stronger program maintainability and shorter time consumption;

[0082] 3. Realize the data flywheel: The vector structure predicted by the component prediction model is the data structure actually generated by the user in a certain tool. That is, the more the user uses the tool, the richer the data available for training will be, thus making it easier to realize model iteration and further improving the recognition ability.

[0083] The above specific embodiments have detailed the technical solutions and beneficial effects of the present invention. It should be understood that the above is only the most preferred embodiment of the present invention, and is not used to limit the present invention. Any modifications, supplements, equivalent replacements, etc. made within the scope of the principles of the present invention shall be included in the protection scope of the present invention.

Claims

1. An end-to-end CAD drawing modeling method based on deep learning, characterized in that, Including the following steps: Preprocess the vector primitives in the CAD drawing into geometric shapes and form an image without logical hierarchy; Based on deep learning, construct a component prediction model for predicting the vector description of components, and perform two-stage training on the component prediction model, namely unsupervised pre-training and supervised fine-tuning; when the component is a housing component, the component prediction model constructed based on deep learning includes a first image encoder, Deformable-DETR, and a multi-head output layer connected in sequence, where the first image encoder includes a pre-trained VIT encoder and a multi-scale image feature construction layer connected in sequence. The image is input into the component prediction model, and after the pre-trained VIT encoder encodes the feature image with a fixed resolution, it passes through the multi-scale image feature construction layer to form multi-scale image features. The multi-scale image features are encoded and decoded by Deformable-DETR and then input into the multi-head output layer, and the vector description of the housing component is predicted in the multi-head output layer, where the vector description of the housing component includes component type, component bounding box, and component vector description parameters; Use the trained component prediction model to predict the vector description of the component, and post-process the predicted vector description of the component, including: When the component is a housing component, post-process the predicted vector description of the component to ensure the accuracy of the constructed vector description, including: coordinate system conversion, including converting the coordinates of the vector description of the housing component back to the original CAD drawing coordinate system; fine-tuning the vector description of the original primitives, including constructing all the primitives of the original CAD drawing into an AABB tree, traversing all the edges in the vector description of the housing component in the original CAD drawing coordinate system, and based on a set threshold, using the AABB tree to search for the original primitives exceeding the threshold as the exact edges in the vector description of the housing component.

2. The end-to-end CAD drawing modeling method based on deep learning according to claim 1, wherein The preprocessing of the vector primitives in the CAD drawing into geometric shapes and forming an image without logical hierarchy includes: Completely break up the three logical hierarchy layers, blocks, and vector primitives included in the CAD drawing from high to low, and further cut, scale, and approximate the line segments, composite line segments, and surface contour types of the vector primitives into basic geometric shapes, and scale and draw the geometric shapes onto a unified bitmap to form an image without logical hierarchy.

3. The end-to-end CAD drawing reverse modeling method based on deep learning according to claim 1, characterized in that The two-stage training of unsupervised pre-training and supervised fine-tuning on the component prediction model corresponding to the housing component includes: Perform unsupervised pre-training on the first image encoder in the component prediction model using the preprocessed CAD drawing without annotations; Perform supervised fine-tuning on the component prediction model using the preprocessed CAD drawing with annotations. The loss functions used during supervised fine-tuning include a category loss constructed based on the component type, a parameter regression loss constructed based on the component vector description parameters, and a bounding box-related loss constructed based on the component bounding box. At the same time, for the N sets of prediction results output by the component prediction model and the M sets of supervised data, perform optimal bipartite graph matching, and use the M sets of matching results to calculate the parameter loss, parameter regression loss, and bounding box-related loss.

4. The end-to-end CAD drawing modeling method based on deep learning according to claim 1, characterized in that, When the component is a cabinet component composed of multiple plate components, the component prediction model constructed based on deep learning includes a second image encoder and a text decoder connected in sequence; The image is input into the component prediction model, and the image features are extracted by the second image encoder, and the image features are input into the text decoder to sequentially predict the bounding boxes of each plate component in an autoregressive manner.

5. The end-to-end CAD drawing modeling method based on deep learning according to claim 1, characterized in that When the component is a cabinet component composed of multiple plate components, post-processing is performed on the predicted component vector description to ensure the accuracy of the constructed vector description, including: Judging the dependency relationship between two plate components according to the contact area between the bounding boxes of the plate components, modeling a directed acyclic dependency graph according to the dependency relationship, and re-modeling the cabinet model according to the dependency graph.

6. An end-to-end CAD drawing modeling device based on deep learning, characterized in that, Including: A preprocessing module, which is used to preprocess the vector graphics in the CAD drawing into geometric graphics and form an image without logical hierarchy; A model construction and training module, which is used to construct a component prediction model based on deep learning for predicting the component vector description according to the image, and perform two-stage training on the component prediction model: unsupervised pre-training and supervised fine-tuning. When the component is a housing component, the component prediction model constructed based on deep learning includes a first image encoder, Deformable-DETR, and a multi-head output layer connected in sequence. The first image encoder includes a pre-trained VIT encoder and a multi-scale image feature construction layer connected in sequence. The image is input into the component prediction model, and the feature image with a fixed resolution is encoded by the pre-trained VIT and then passed through the multi-scale image feature construction layer to form multi-scale image features. The multi-scale image features are encoded and decoded by Deformable-DETR and then input into the multi-head output layer, and the vector description of the housing component is predicted in the multi-head output layer, where the vector description of the housing component includes the component type, the component bounding box, and the component vector description parameters; A prediction and post-processing module, which is used to predict the component vector description by using the trained component prediction model and perform post-processing on the predicted component vector description, including: When the component is a housing component, post-processing is performed on the predicted component vector description to ensure the accuracy of the constructed vector description, including: coordinate system conversion, including converting the coordinates of the housing component vector description back to the original CAD drawing coordinate system; fine-tuning the component vector description of the original primitive, including constructing all the primitives of the original CAD drawing into an AABB tree, traversing all the edges in the housing component vector description in the original CAD drawing coordinate system, and based on a set threshold, using the AABB tree to search for the original primitives that exceed the threshold as the precise edges in the housing component vector description.

7. A computing device, comprising a memory and one or more processors, wherein executable code is stored in the memory, characterized in that, When the one or more processors execute the executable code, it is used to implement the end-to-end CAD drawing modeling method based on deep learning according to any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, A program is stored thereon, and when the program is executed by a processor, it implements the end-to-end CAD drawing modeling method based on deep learning according to any one of claims 1-5.

Citation Information

Patent Citations

  • Vector building drawing based method for reconstructing three-dimensional model

    CN101673410A

  • CAD vector model generation method and device based on building sketch contour sequence

    CN117454495A