CAD three-dimensional modeling method and device based on G-Mamba state space diffusion algorithm
By using the G-Mamba state space diffusion algorithm in CAD three-dimensional modeling, combined with the hierarchical tree and the Diffusion diffusion model, the stability and efficiency of the generated model in the three-dimensional reconstruction task in the existing technology are solved, and efficient and accurate three-dimensional modeling is achieved.
Patent Information
- Application Number
- CN202510405736.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2045-04-02
AI Technical Summary
The existing deep learning methods face the problems of the training stability of generative models, computational efficiency, and insufficient modeling ability of complex topological structures in three-dimensional reconstruction tasks.
The CAD three-dimensional modeling method based on the G-Mamba state space diffusion algorithm is adopted to construct the CAD sequence data set through a hierarchical tree, and the G-Mamba state space network model is constructed, and the forward and reverse diffusion process is combined with the Diffusion diffusion model to generate high-quality three-dimensional model representation.
Efficient and accurate three-dimensional modeling is realized, which significantly reduces the computational complexity, improves the real-timeness of the model, and improves the modeling ability of complex geometric data.
Smart Images

Figure CN119918115B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of three-dimensional reconstruction of computer-aided design, and specifically relates to a CAD three-dimensional modeling method and device based on a G-Mamba state space diffusion algorithm, and is a CAD-aided modeling sequence generation method and device based on a Diffusion diffusion model and a G-Mamba state space network model. Background Art
[0002] Computer-Aided Design (CAD) 3D reconstruction technology is the process of converting 2D images, point cloud data or text information into 3D models using computer algorithms and mathematical models. This technology has a wide range of applications in industrial design, architectural modeling, medical imaging, virtual reality and other fields. With the rapid development of artificial intelligence and deep learning technology, CAD 3D reconstruction technology is moving towards automation, intelligence and high precision.
[0003] Traditional CAD 3D reconstruction methods mainly rely on geometric modeling and parametric design, which usually require a lot of manual intervention and expertise, and have limitations when dealing with complex shapes and unstructured data. In recent years, 3D reconstruction methods based on deep learning have gradually become a research hotspot, especially generative models have performed well in 3D shape generation and completion tasks. However, existing deep learning methods still face some challenges, such as the training stability of generative models, computational efficiency, and the ability to model complex topological structures.
[0004] As an emerging generative model, Diffusion Models generate high-quality data samples through a gradual denoising process and have achieved remarkable results in image generation and 3D shape generation tasks. Compared with traditional generative adversarial networks (GANs), diffusion models have the advantages of training stability and generation diversity. However, diffusion models require multiple iterations in the generation process, resulting in high computational overhead, which limits their potential in real-time applications, especially when processing geometric sequence data, where their effects are limited.
[0005] On the other hand, state space models (SSM) perform well in sequence modeling tasks, especially the recently proposed Mamba model, which achieves efficient sequence modeling capabilities through a selective state space mechanism. The Mamba model has linear complexity when processing long sequence data and can capture long-term dependencies in the sequence, which provides a new idea for serialized data processing in 3D reconstruction tasks. However, serialized data is not natural language text, it has highly detailed geometric information to constrain model closure. When the Mamba model processes this type of data in a traditional sequence encoding method, it will lead to the loss of some 3D geometric information, thus affecting the rationality of 3D modeling. Summary of the invention
[0006] The object of the present invention is to provide a CAD three-dimensional modeling method and device based on the G-Mamba state space diffusion algorithm to achieve efficient and accurate three-dimensional modeling.
[0007] To achieve the above object, the technical solution adopted by the present invention is:
[0008] In a first aspect, a CAD three-dimensional modeling method based on a G-Mamba state space diffusion algorithm is provided, comprising:
[0009] constructing a CAD data set into a CAD sequence data set using a hierarchical tree, the CAD data set comprising a sketch-extrude element, the CAD sequence data set comprising a sketch-extrude sequence;
[0010] Construct a G-Mamba state space network model, which includes a geometric embedding layer, a temporal embedding layer, and a geometric Mamba state space module;
[0011] A set of sketch-stretch sequences of the CAD sequence data set is obtained, and converted into CAD noise sequence features of pure normal distribution through the forward diffusion process of the Diffusion diffusion model;
[0012] The pure normally distributed CAD noise sequence features are converted into denoised CAD sequence features through the reverse diffusion process of the Diffusion diffusion model, wherein the reverse diffusion process uses the G-Mamba state space network model to output predicted noise according to the sketch-stretch sequence, and denoises the predicted noise through Markov chain back propagation;
[0013] The denoised CAD sequence features are input into a CAD decoder to generate a three-dimensional model representation;
[0014] A loss function is calculated based on the random normal distribution noise and prediction noise imposed by the forward diffusion process, as well as the sketch-stretch sequence and the three-dimensional model representation, and the G-Mamba state space network model and the CAD decoder are updated based on the loss function;
[0015] For the CAD data set to be modeled, the Diffusion model, the trained G-Mamba state space network model and the CAD decoder are used to generate a three-dimensional model representation, and finally a three-dimensional model file is obtained to complete the CAD three-dimensional modeling.
[0016] Several optional methods are also provided below, but they are not intended to be additional limitations on the above-mentioned overall solution, but are merely further supplements or preferences. Under the premise that there are no technical or logical contradictions, each optional method can be combined with the above-mentioned overall solution separately, and multiple optional methods can also be combined.
[0017] Preferably, the step of constructing the CAD data set into a CAD sequence data set using a hierarchical tree comprises:
[0018] Filtering CAD three-dimensional model data whose number of sketch-extruded elements in the CAD data set is outside a threshold range;
[0019] Take the remaining CAD 3D model data after filtering, and construct a sketch-stretch sequence for each sketch-stretch element in the CAD 3D model data. The construction process is as follows:
[0020] The graph structure of sketch elements is converted into a tree structure using a hierarchical tree, and the tree structure is encoded as a sketch geometry data feature;
[0021] Describing the stretching element as a representation of stretching operation-operation behavior-behavior parameter, using a hierarchical tree to convert the representation of the stretching element into a tree structure including three levels of stretching operation-operation behavior-behavior parameter, and encoding the tree structure as a stretching geometric data feature;
[0022] The sketch geometry data feature and the extrusion geometry data feature are combined as a sketch-extrusion sequence;
[0023] All sketch-extrusion elements in the remaining CAD three-dimensional model data after filtering are constructed to obtain a CAD sequence data set.
[0024] Preferably, the geometric embedding layer includes a geometric coding layer, a convolutional layer, an activation function, an attention layer and a linear layer in sequence from the input side to the output side.
[0025] Preferably, the geometric Mamba state space module comprises a plurality of groups of sequentially connected G-Mamba blocks and RMS normalization layers;
[0026] The G-Mamba block includes two branches, the first branch includes a linear layer, a convolutional layer and an activation function connected in sequence, and the second branch includes a linear layer, an attention layer, an activation function and a geometric selection SSM module connected in sequence. The output of the first branch is multiplied by the output of the second branch and then passes through a linear layer as the output of the G-Mamba block.
[0027] Preferably, the processing process of the geometry selection SSM module is as follows:
[0028]
[0029]
[0030] In the formula, is the time step The intermediate time state vector, is the time step The intermediate time state vector, is the activation function in the second branch at time step The output, , and is the linear transformation matrix, recorded as the state matrix, control matrix and output matrix respectively, is the geometric state transition matrix, Select the SSM module for the geometry at time step Output.
[0031] Preferably, the reverse diffusion process uses the G-Mamba state space network model to output the predicted noise according to the sketch-stretch sequence, and denoises the predicted noise through Markov chain back propagation, which is expressed as follows:
[0032]
[0033] In the formula, Represents the time step CAD sequence features, Represents the time step CAD sequence features, Indicates the predicted output of the G-Mamba state space network model given Under the conditions The probability density function of represents the denoised CAD sequence features, Indicates the predicted output of the G-Mamba state space network model given and Under the conditions The probability density function of Represents the time step The mean of a Gaussian distribution, represents the noise parameter, , , , , is the time step The noise distribution, is the time step Initialization parameters, To the time step The accumulated parameter value of To the time step The accumulated parameter value of Indicates based on The average obtained is , the covariance is Gaussian distribution, is the identity matrix.
[0034] Preferably, the CAD decoder comprises a first linear layer for decoding command features in denoised CAD sequence features, and a second linear layer for decoding parameter features of commands in denoised CAD sequence features, and both the first linear layer and the second linear layer are composed of a multi-layer perceptron.
[0035] Preferably, the random normal distribution noise and prediction noise applied based on the forward diffusion process, as well as the sketch-stretch sequence and the three-dimensional model representation calculation loss function include:
[0036] The first loss value is calculated using the L2 norm loss function based on the random normal distribution noise applied by the forward diffusion process and the predicted noise output by the G-Mamba state space network model;
[0037] According to the original sketch-stretch sequence and the final decoded 3D model representation, a second loss value is calculated using a cross entropy loss function;
[0038] The weighted sum of the first loss value and the second loss value is taken as the final loss value.
[0039] Preferably, the calculating the second loss value using a cross entropy loss function according to the original sketch-stretching sequence and the three-dimensional model representation generated by the final decoding comprises:
[0040]
[0041] In the formula, represents the second loss value, Indicates the number of command features in the sketch-extrude sequence. Indicates the first The value of the command feature, Indicates the first The value of the command feature, represents the cross entropy loss function corresponding to command prediction, is a hyperparameter, Indicates the number of parameter features, represents the cross entropy loss function corresponding to parameter prediction, Indicates the first The first command The value of the parameter feature, Indicates the first The first command The value of a parameter feature.
[0042] In a second aspect, a CAD three-dimensional modeling device based on a G-Mamba state space diffusion algorithm is provided, comprising a processor and a memory storing a plurality of computer instructions, wherein the computer instructions, when executed by the processor, implement the steps of the CAD three-dimensional modeling method based on the G-Mamba state space diffusion algorithm.
[0043] The present invention provides a CAD three-dimensional modeling method and device based on the G-Mamba state space diffusion algorithm, which aims to combine the high-quality generation capability of the diffusion model and the efficient geometric sequence modeling capability of the G-Mamba state space network model to achieve efficient and accurate three-dimensional reconstruction. By introducing a continuous diffusion model, the present invention can maintain high-precision detail restoration during the generation process; at the same time, the G-Mamba state space network model is used to efficiently model the serialized representation of three-dimensional geometric data, which significantly reduces the computational complexity and improves the real-time performance of the model. This method provides a new solution for three-dimensional reconstruction tasks in CAD-aided design, which has important theoretical significance and application value. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A flowchart of a CAD three-dimensional modeling method based on the G-Mamba state space diffusion algorithm of the present invention;
[0045] Figure 2 It is a schematic diagram of the flow of the G-Mamba state space diffusion algorithm of the present invention;
[0046] Figure 3 It is a schematic diagram of the structure of the geometric embedding layer of the present invention;
[0047] Figure 4 It is a schematic diagram of the structure of the geometric Mamba state space module of the present invention;
[0048] Figure 5It is a structural schematic diagram of the geometric selection SSM module of the present invention. DETAILED DESCRIPTION
[0049] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0051] In this embodiment, a CAD three-dimensional modeling method based on the G-Mamba state space diffusion algorithm is provided. The method makes full use of the Diffusion diffusion model and combines the Mamba state space as a generator to generate CAD sequence features, so that the model can also have good performance in the field of three-dimensional modeling.
[0052] Specifically, Figure 1 As shown, this embodiment provides a CAD three-dimensional modeling method based on the G-Mamba state space diffusion algorithm, including:
[0053] Step S1: Use a hierarchical tree to construct a CAD data set into a CAD sequence data set.
[0054] The CAD dataset mainly contains data such as the design steps and topological structure of the CAD three-dimensional model, and the main presentation form is sketch-extrusion elements. In this step, the CAD dataset is first filtered, and then the hierarchical tree is used to construct the CAD dataset into a tree-structured CAD sequence dataset. The CAD sequence dataset mainly includes sketch-extrusion sequences. Finally, the CAD sequence dataset is divided into training set, validation set and test set.
[0055] Specifically, this embodiment filters CAD three-dimensional model data whose number of sketch-stretch elements contained in the CAD data set is outside a threshold range, such as filtering CAD three-dimensional model data with more than 40 sketch-stretch elements and less than 3 sketch-stretch elements.
[0056] Then, the remaining CAD 3D model data after filtering is taken, and each sketch-extrusion element in the CAD 3D model data is constructed into a sketch-extrusion sequence. The construction process is as follows:
[0057] The graph structure of the sketch element is converted into a tree structure using a hierarchical tree, and the tree structure is encoded as a sketch geometric data feature. The sketch is composed of one or more geometric faces, and these geometric faces include four basic primitives: line, curve, circle and construction face. These basic primitives are represented by two-dimensional coordinates of parameterized marks (x, y), and parameterized formulas are specified, such as the starting point s and the end point e of the line. In the process of tree structure construction, these basic primitives constitute the nodes of the tree, for example, with the sketch as the root node, and then according to the number of geometric faces contained in the sketch, create a corresponding number of child nodes of the root node (first-level child nodes), and further create a corresponding number of child nodes (second-level child nodes) according to the construction face contained in the geometric face, and then create a corresponding number of child nodes (third-level child nodes) according to the lines, curves and circles contained in the construction face, and assign parameterized marks and parameterized formulas to each node. In order to facilitate computer recognition and processing, the parameterized marks and parameterized formulas are encoded into sketch geometric data features (this embodiment uses binary quantization encoding, using 6 bits, a total of 255 for encoding). The encoding process uses global position parameters (the maximum and minimum values of the sequence are determined by the length of the subtree where the geometric face is located) to define a bounding box to determine the overall position, and also uses a latent sequence code that captures local details to accurately describe the subtle features of each primitive.
[0058] The stretching element is described as a representation of a stretching operation-operation behavior-behavior parameter, and a hierarchical tree is used to convert the representation of the stretching element into a tree structure containing three levels of stretching operation-operation behavior-behavior parameters, and the tree structure is encoded as a stretching geometric data feature. This embodiment defines a geometric surface and the parameters required to convert it into a three-dimensional volume for the stretching element, and the overall tree structure is formed through three levels, namely, stretching operation-operation behavior-behavior parameters. Behavior parameters, such as (d+, d-) represent the stretching distance along the surface normal direction and the opposite direction, θ, φ, γ and (τx, τy, τz) respectively define the direction and displacement of the geometric surface relative to the reference coordinate system; operation behavior, such as a given depth, forming to the next surface; stretching operations, such as new construction, removal, etc. Also, in order to facilitate computer recognition and processing, the stretching operation, operation behavior and behavior parameters are encoded into stretching geometric data features.
[0059] Finally, the sketch geometry data feature and the stretch geometry data feature are concatenated as a sketch-stretch sequence, and the range of the sketch-stretch sequence is 0 to 255.
[0060] All sketch-extrusion elements in the remaining CAD 3D model data after filtering are constructed to obtain a CAD sequence dataset. This example uses the DeepCAD public dataset as an example, and divides 92.5% of the dataset into a training set, 2.5% as a validation set, and 5% as a test set.
[0061] Step S2: construct the G-Mamba state space network model, such as Figure 2 The figure shows a geometric embedding layer, a temporal embedding layer, and a geometric Mamba state space module for feature representation learning and noise generation. The G-Mamba state space network model generates specific noise during the Markov chain back propagation process of the diffusion network model to facilitate the reverse denoising process.
[0062] like Figure 3 As shown in the figure, the geometric embedding layer includes a geometric encoding layer (used to encode the sketch-stretch sequence from 0 to 255 to a CAD sequence feature from -1 to 1), a 1×1 convolution layer, an activation function, an attention layer, and a linear layer from the input side to the output side. The input of the geometric embedding layer is the sketch-stretch sequence, and the output is the CAD sequence feature. .
[0063] The temporal embedding layer consists of two linear layers, with the input being a time step from 0 to T and the output being a time step from 0 to T. The CAD sequence features output by the geometric embedding layer are similar to the time steps output by the temporal embedding layer. Combined to obtain the state space characteristics of the corresponding time step , as input to the geometric Mamba state-space module.
[0064] The geometric Mamba state space module includes multiple groups of G-Mamba blocks and RMS normalization layers connected in sequence. A G-Mamba block and an RMS normalization layer form a group. The geometric Mamba state space module contains multiple groups. G-Mamba blocks can better process complex sequence data. Figure 4 As shown in , the G-Mamba block contains two branches. The first branch includes a linear layer, a convolutional layer, and an activation function connected in sequence. The second branch includes a linear layer, an attention layer, an activation function, and a geometric selection SSM module connected in sequence. The output of the first branch is multiplied by the output of the second branch by elements and then passes through a linear layer as the output of the G-Mamba block. Figure 5 As shown, the processing of the geometry selection SSM module is as follows:
[0065]
[0066]
[0067] In the formula, is the time step The intermediate time state vector, is the time step The intermediate time state vector, is the activation function in the second branch at time step The output, , and is the linear transformation matrix, recorded as the state matrix, control matrix and output matrix respectively, is the geometric state transition matrix, Select the SSM module for the geometry at time step Output.
[0068] Step S3, obtain a set of sketch-stretch sequences of the CAD sequence data set, and convert them into pure normally distributed CAD noise sequences through the forward diffusion process of the Diffusion diffusion model. Obtain a set of CAD sequence data, first use the geometric embedding layer to encode it into the original CAD sequence features, and then add noise to it through random normally distributed noise to convert it into pure normally distributed CAD noise sequence features.
[0069] The forward process of the diffusion model in this example is to gradually add normal distribution noise to the sequence features, gradually destroying the structure of its expression. As increases, the sequence eventually becomes pure normal distribution noise. Its expression is as follows:
[0070]
[0071]
[0072] In the formula, Represents the time step CAD sequence features, Indicates the original CAD sequence feature corresponding to the sketch-extrude sequence, Indicates a given Under the conditions The conditional probability density function of , To the time step The accumulated parameter value of is the time step Initialization parameters, is the identity matrix, Indicates based on The average obtained is , the covariance is Gaussian distribution, It means the mean is 0 and the variance is The random normally distributed noise is , and the time step of the diffusion process is The interval is [0,…, ], represents the final time step of the forward diffusion process.
[0073] Step S4: The CAD noise sequence features of the pure normal distribution are converted into denoised CAD sequence features through the reverse diffusion process of the Diffusion diffusion model. The reverse diffusion process uses the G-Mamba state space network model to output the predicted noise according to the sketch-stretch sequence, and denoises the predicted noise through Markov chain back propagation to gradually restore the original CAD sequence features.
[0074] In this example, the reverse diffusion is to transform the sequence of pure normal distribution noise into Gradually remove noise and finally generate CAD sequence features. The formula is as follows:
[0075]
[0076] In the formula, Indicates the predicted output of the G-Mamba state space network model given Under the conditions The probability density function of represents the denoised CAD sequence feature (ideally, the denoised CAD sequence feature is restored to the original CAD sequence feature corresponding to the sketch-stretch sequence, so this embodiment uses represents the denoised CAD sequence feature. In other embodiments, other symbols may be used to distinguish and represent it, for example ), Indicates the predicted output of the G-Mamba state space network model given and Under the conditions The probability density function of Represents the time step The mean of a Gaussian distribution, represents the noise parameter, , , , is the time step The noise distribution, To the time step The accumulated parameter value of Indicates based on The average obtained is , the covariance is Gaussian distribution of . The time step The mean of the Gaussian distribution, i.e., the value of the reverse diffusion process from the time step The mean of the CAD sequence features up to time step 0 , the calculation formula is as follows:
[0077]
[0078] In the formula, is the time step The initialization parameters are randomly initialized in this embodiment. According to the geometric meaning of the CAD sequence features, in the diffusion process, not only the predicted noise mean is used, but also the CAD decoder is required to obtain the sequence features to improve the accuracy of sequence generation.
[0079] Step S5: Input the denoised CAD sequence features into the CAD decoder to generate a 3D model representation (i.e., a CAD 3D model sequence, in this embodiment, the range is 0-255). This embodiment constructs a decoding module composed of linear layers to further decode the denoised CAD sequence features to generate the final 3D model representation.
[0080] The CAD decoder includes a first linear layer for decoding command features in denoising CAD sequence features, and a second linear layer for decoding parameter features of commands in denoising CAD sequence features, and both the first linear layer and the second linear layer are composed of a multi-layer perceptron. The parameterized marks in the tree structure construction process are regarded as commands, and the parameterized formulas, stretching operations, operation behaviors and behavior parameters in the tree structure construction process are regarded as parameters corresponding to the commands. Therefore, the original CAD sequence features corresponding to the sketch-stretching sequence include command features obtained by command encoding and parameter features obtained by parameter encoding. The corresponding denoising CAD sequence features also include command features and parameter features. Therefore, this embodiment sets two types of corresponding linear layers for decoding.
[0081] Step S6, calculating the loss function based on the random normal distribution noise and prediction noise applied by the forward diffusion process, as well as the sketch-stretch sequence and the three-dimensional model representation, and updating the G-Mamba state space network model and CAD decoder based on the loss function.
[0082] The first loss function designed in this embodiment is: according to the random normal distribution noise applied in the forward diffusion process and the prediction noise output by the G-Mamba state space network model, the first loss value is calculated using the L2 norm loss function, and the formula is as follows:
[0083]
[0084] In the formula, represents the first loss value, Represents input as time steps , Sketch-Extrude Sequence and time step The noise term Calculate the expectation, represents the L2 norm, Represents the time step The target noise, represents the prediction noise at each time step.
[0085] The second loss function designed in this embodiment is: according to the original sketch-stretch sequence and the three-dimensional model representation generated by the final decoding, the second loss value is calculated using the cross entropy loss function, and the formula is as follows:
[0086]
[0087] In the formula, represents the second loss value, Indicates the number of command features in the sketch-extrude sequence. Indicates the first The value of the command feature, Indicates the first The value of the command feature, represents the cross entropy loss function corresponding to command prediction, is a hyperparameter used to balance and , Indicates the number of parameter features, represents the cross entropy loss function corresponding to parameter prediction, Indicates the first The first command The value of the parameter feature, Indicates the first The first command The value of a parameter feature.
[0088] In this embodiment, the weighted sum of the first loss value and the second loss value is taken as the final loss value, and the expression is as follows:
[0089]
[0090] In the formula, represents the final loss value, is the weighted weight. After the loss value is calculated, back propagation is performed to update the G-Mamba state space network model and CAD decoder, and the exponential moving average method is used to optimize the parameters to improve the stability and convergence speed of the model. Then, steps S2 to S6 are repeated until the preset training rounds are reached to ensure that the model fully learns the data features and achieves the optimal performance. In this example, 1000 rounds of training are performed.
[0091] The present invention utilizes the G-Mamba state space diffusion algorithm (including the G-Mamba state space network model and the Diffusion diffusion model) as a generator to directly generate CAD sequence features, and then obtains the CAD three-dimensional model sequence through a CAD decoder. The CAD text module of this method utilizes the G-Mamba state space to enhance the model's learning ability for complex geometric feature sequences, thereby further enhancing the generalization ability of the diffusion model to generate data.
[0092] Step S7, for the CAD data set to be modeled, the Diffusion diffusion model and the trained G-Mamba state space network model and CAD decoder are used to generate a three-dimensional model representation, and finally a three-dimensional model file is obtained to complete the CAD three-dimensional modeling. In practical applications, according to the specific task requirements, a corresponding conditional module (an external interface is connected to a generation instruction condition) is selected, and the trained model is used to perform the CAD three-dimensional modeling task. It is easy to understand that steps S1 to S6 are a training process, and step S7 is a test, verification or application process, and both can be executed independently or simultaneously. In addition, the process of generating a three-dimensional model file according to the three-dimensional model representation is a conventional process and is not improved as the present invention.
[0093] In this embodiment, a CAD three-dimensional modeling method based on the G-Mamba state space diffusion algorithm uses a geometric embedding layer, a G-Mamba block and an RMS normalization module to improve the network's learning ability for complex CAD sequences and speed up the training speed. The method of the present invention has a significant effect on computer-aided design three-dimensional reconstruction. The data set used in the method is a data set with CAD sketches and stretching elements. During training, the G-Mamba state space diffusion algorithm is used to sample sequence features, and a decoder is used to decode the feature sequence to complete the modeling task.
[0094] In another embodiment, the present invention also provides a CAD three-dimensional modeling device based on the G-Mamba state space diffusion algorithm, including a processor and a memory storing a plurality of computer instructions. When the computer instructions are executed by the processor, the steps of the CAD three-dimensional modeling method based on the G-Mamba state space diffusion algorithm are implemented.
[0095] The specific limitations of the CAD three-dimensional modeling device based on the G-Mamba state space diffusion algorithm can be found in the above limitations of the CAD three-dimensional modeling method based on the G-Mamba state space diffusion algorithm, which will not be repeated here.
[0096] The memory and the processor are electrically connected directly or indirectly to achieve data transmission or interaction. For example, these elements can be electrically connected to each other through one or more communication buses or signal lines. The memory stores a computer program that can be run on the processor, and the processor implements the method of the present invention by running the computer program stored in the memory.
[0097] Among them, the memory can be, but is not limited to, random access memory (RAM), read only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable read-only memory (EEPROM), etc.
[0098] The processor may be an integrated circuit chip with data processing capabilities. The above-mentioned processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0099] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0100] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0101] The above-mentioned embodiments only express several implementation modes of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the attached claims.
Claims
1. A CAD three-dimensional modeling method based on the G-Mamba state space diffusion algorithm, characterized in that: The CAD three-dimensional modeling method based on the G-Mamba state space diffusion algorithm comprises: constructing a CAD data set into a CAD sequence data set using a hierarchical tree, the CAD data set comprising a sketch-extrude element, the CAD sequence data set comprising a sketch-extrude sequence; Construct a G-Mamba state space network model, which includes a geometric embedding layer, a temporal embedding layer, and a geometric Mamba state space module; A set of sketch-stretch sequences of the CAD sequence data set is obtained, and converted into CAD noise sequence features of pure normal distribution through the forward diffusion process of the Diffusion diffusion model; The pure normally distributed CAD noise sequence features are converted into denoised CAD sequence features through the reverse diffusion process of the Diffusion diffusion model, wherein the reverse diffusion process uses the G-Mamba state space network model to output predicted noise according to the sketch-stretch sequence, and denoises the predicted noise through Markov chain back propagation; The denoised CAD sequence features are input into a CAD decoder to generate a three-dimensional model representation; A loss function is calculated based on the random normal distribution noise and prediction noise imposed by the forward diffusion process, as well as the sketch-stretch sequence and the three-dimensional model representation, and the G-Mamba state space network model and the CAD decoder are updated based on the loss function; For the CAD data set to be modeled, the Diffusion model, the trained G-Mamba state space network model and the CAD decoder are used to generate a three-dimensional model representation, and finally a three-dimensional model file is obtained to complete the CAD three-dimensional modeling.
2. The CAD three-dimensional modeling method based on the G-Mamba state space diffusion algorithm according to claim 1 is characterized in that: The method of using a hierarchical tree to construct a CAD data set into a CAD sequence data set includes: Filtering CAD three-dimensional model data whose number of sketch-extruded elements in the CAD data set is outside a threshold range; Take the remaining CAD 3D model data after filtering, and construct a sketch-stretch sequence for each sketch-stretch element in the CAD 3D model data. The construction process is as follows: The graph structure of sketch elements is converted into a tree structure using a hierarchical tree, and the tree structure is encoded as a sketch geometry data feature; Describing the stretching element as a representation of stretching operation-operation behavior-behavior parameter, using a hierarchical tree to convert the representation of the stretching element into a tree structure including three levels of stretching operation-operation behavior-behavior parameter, and encoding the tree structure as a stretching geometric data feature; The sketch geometry data feature and the extrusion geometry data feature are combined as a sketch-extrusion sequence; All sketch-extrusion elements in the remaining CAD three-dimensional model data after filtering are constructed to obtain a CAD sequence data set.
3. The CAD three-dimensional modeling method based on the G-Mamba state space diffusion algorithm according to claim 1 is characterized in that: The geometric embedding layer includes a geometric coding layer, a convolutional layer, an activation function, an attention layer and a linear layer from the input side to the output side.
4. The CAD three-dimensional modeling method based on the G-Mamba state space diffusion algorithm according to claim 1, characterized in that: The geometric Mamba state space module includes multiple groups of G-Mamba blocks and RMS normalization layers connected in sequence; The G-Mamba block includes two branches, the first branch includes a linear layer, a convolutional layer and an activation function connected in sequence, and the second branch includes a linear layer, an attention layer, an activation function and a geometric selection SSM module connected in sequence. The output of the first branch is multiplied by the output of the second branch and then passes through a linear layer as the output of the G-Mamba block.
5. The CAD three-dimensional modeling method based on the G-Mamba state space diffusion algorithm according to claim 4 is characterized in that: The processing process of the geometry selection SSM module is as follows: ; ; In the formula, is the time step The intermediate time state vector, is the time step The intermediate time state vector, is the activation function in the second branch at time step The output, , and is the linear transformation matrix, recorded as the state matrix, control matrix and output matrix respectively, is the geometric state transition matrix, Select the SSM module for the geometry at time step Output.
6. The CAD three-dimensional modeling method based on the G-Mamba state space diffusion algorithm according to claim 1, characterized in that: The reverse diffusion process uses the G-Mamba state space network model to predict noise according to the sketch-stretch sequence output, and denoises the predicted noise through Markov chain back propagation, which is expressed as follows: ; In the formula, Represents the time step CAD sequence features, Represents the time step CAD sequence features, Indicates the predicted output of the G-Mamba state space network model given Under the conditions The probability density function of represents the denoised CAD sequence features, Indicates the predicted output of the G-Mamba state space network model given and Under the conditions The probability density function of Represents the time step The mean of a Gaussian distribution, represents the noise parameter, , , , , is the time step The noise distribution, is the time step Initialization parameters, To the time step The accumulated parameter value of To the time step The accumulated parameter value of Indicates based on The average obtained is , the covariance is Gaussian distribution, is the identity matrix.
7. The CAD three-dimensional modeling method based on the G-Mamba state space diffusion algorithm according to claim 1, characterized in that: The CAD decoder comprises a first linear layer for decoding command features in denoised CAD sequence features, and a second linear layer for decoding parameter features of commands in denoised CAD sequence features, and both the first linear layer and the second linear layer are composed of multi-layer perceptrons.
8. The CAD three-dimensional modeling method based on the G-Mamba state space diffusion algorithm according to claim 1, characterized in that: The random normal distribution noise and prediction noise applied based on the forward diffusion process, as well as the sketch-stretch sequence and the three-dimensional model representation calculation loss function include: The first loss value is calculated using the L2 norm loss function based on the random normal distribution noise applied by the forward diffusion process and the predicted noise output by the G-Mamba state space network model; According to the original sketch-stretch sequence and the final decoded 3D model representation, a second loss value is calculated using a cross entropy loss function; The weighted sum of the first loss value and the second loss value is taken as the final loss value.
9. The CAD three-dimensional modeling method based on the G-Mamba state space diffusion algorithm according to claim 8, characterized in that: The second loss value is calculated using a cross entropy loss function according to the original sketch-stretch sequence and the three-dimensional model representation generated by the final decoding, include: ; In the formula, represents the second loss value, Indicates the number of command features in the sketch-extrude sequence. Indicates the first The value of the command feature, Indicates the first The value of the command feature, represents the cross entropy loss function corresponding to command prediction, is a hyperparameter, Indicates the number of parameter features, represents the cross entropy loss function corresponding to parameter prediction, Indicates the first The first command The value of the parameter feature, Indicates the first The first command The value of a parameter feature.
10. A CAD three-dimensional modeling device based on the G-Mamba state space diffusion algorithm, comprising a processor and a memory storing a plurality of computer instructions, characterized in that: When the computer instructions are executed by the processor, the steps of the CAD three-dimensional modeling method based on the G-Mamba state space diffusion algorithm described in any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
CAD drawing generation method based on continuous diffusion model
CN118296680A
Medical ultrasonic image three-dimensional reconstruction method and system based on SDF diffusion
CN118470222A