Processing feature identification method based on graph encoder and sequence decoder

Through the method based on graph encoder and sequence decoder, a graph-oriented sequence prediction network model is constructed, which solves the problem of intersection features and merged surface recognition in the three-dimensional CAD model, and achieves high-accurate processing feature recognition.

CN119027933APending Publication Date: 2024-11-26HANGZHOU DIANZI UNIV
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411035256.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-31
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

Existing machining feature recognition techniques are difficult to automatically identify intersecting features and multiple interpretations in three-dimensional CAD models, especially in boundary representation models, and it is difficult to deal with merged surfaces shared by multiple feature instances.

Method used

Using the processing feature recognition method based on graph encoder and sequence decoder, a sequence prediction network model for graph representation is constructed. Through graph encoder and sequence decoder, feature matching rules are automatically learned, and the surface sets of all feature instances can be output, which can be processed. The merged faces shared by multiple feature instances do not limit the number and type of feature instances to which each face belongs.

Benefits of technology

The accuracy of automatically identifying processing feature instances from the three-dimensional CAD boundary representation model is realized, and the intersection features and merged surfaces can be identified, which improves the accuracy of processing feature recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119027933A_ABST
    Figure CN119027933A_ABST
Patent Text Reader

Abstract

The invention discloses a processing feature identification method based on a graph encoder and a sequence decoder, and the method comprises the steps: firstly constructing a sequence prediction network model oriented to graph representation, inputting the graph representation of a three-dimensional CAD model, and outputting a surface sequence and type representing a processing feature instance; secondly, defining a training sample data structure, and preprocessing training data; then defining a loss function and an evaluation index, and training and optimizing the sequence prediction network model through the preprocessed training data to obtain an optimized sequence prediction network model; and finally, inputting an unlabeled three-dimensional CAD model into the optimized sequence prediction network model, and predicting the surface sequence and type of the processing feature instance in a reasoning mode. According to the method, the combined surface shared by a plurality of feature instances can be processed, and accurate processing feature recognition is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of three-dimensional CAD model processing feature recognition, and in particular relates to a processing feature recognition method based on a graph encoder and a sequence decoder. Background Art

[0002] Representing a part as a sequence of machining features helps to realize automatic planning of machining processes. Each machining feature defines the area that needs to be removed from the blank. The type and parameters of the machining feature directly correspond to the tool type and machining method, and it is easy to design algorithms to automatically convert machining features into tool paths. Since the part model obtained in the design stage usually does not contain machining features, it is necessary to identify machining features from the design model of the part.

[0003] There are two types of existing processing feature recognition technologies, rule-based and learning-based. A processing feature recognition method based on triangular meshes and neural networks, patent number CN112488176A, a three-dimensional model multi-processing feature recognition method for three-dimensional machining process design, patent number CN115841598A. The samples in the data sets constructed by these two methods are isolated processing features. When predicting, it is necessary to first separate the processing feature instances. It is not suitable for boundary representation models or intersecting features containing shared faces. A part processing feature recognition method based on machine vision learning recognition, patent number CN114067231A, a processing feature classification and recognition method based on deep learning, patent number CN116824226A. The data samples of these two methods are images, relying on the two-dimensional image of the part to recognize the processing features, and it is difficult to capture the complete image of the obscured processing features. A processing feature recognition method based on NX secondary development and graph neural network, patent number CN114491841A, a processing feature recognition method based on a double-layer graph neural network, patent number CN117197801A. The data sets of these two methods are boundary representation models containing face types. The faces represented by the boundaries are classified by the graph neural network, but the processing feature instances to which the faces belong are not identified. Summary of the invention

[0004] The difficulty of machining feature recognition lies in the automatic recognition and multiple interpretations of intersecting features. The purpose of the present invention is to automatically identify machining feature instances from a three-dimensional CAD boundary representation model of a part, and to improve the accuracy of intersecting machining feature recognition through advanced deep learning technology. The present invention proposes a machining feature recognition method based on a graph encoder and a sequence decoder, which can automatically learn feature matching rules and output a face set of all feature instances. The method does not limit the number and type of feature instances to which each face belongs, and can process merged faces shared by multiple feature instances.

[0005] The technical solution adopted by this patent application to solve its technical problem is:

[0006] This application proposes a processing feature recognition method based on a graph encoder and a sequence decoder, and the steps of recognizing processing features include:

[0007] 1. Construct a graph-oriented sequence prediction network model, with the input being the graph representation of the 3D CAD model and the output being the face sequence and type representing the machining feature instance.

[0008] 2. Define the training sample data structure and preprocess the training data. The training sample includes two parts: the graph representation and the face sequence annotation of the 3D CAD model. The preprocessing extracts the face features and the structural information of the graph from the input graph representation, and pads the graph nodes and face sequences to the set length.

[0009] 3. Define the loss function and evaluation indicators, train and optimize the sequence prediction network model through the preprocessed training data, and obtain the optimized sequence prediction network model.

[0010] 4. Input the unlabeled 3D CAD model into the optimized sequence prediction network model to predict the face sequence and type of the processing feature instance in the inference mode.

[0011] Technical features of step 1 include:

[0012] 1.1 The input of the sequence prediction network model is a graph with node attributes. This graph corresponds to the boundary representation of a 3D CAD model, where nodes represent faces and edges represent shared edges between adjacent faces. The attributes of the nodes represent the geometry of the faces.

[0013] 1.2 The output of the sequence prediction network model is an integer sequence containing face id, feature type and end mark. Each continuous face id represents a feature instance. The end mark indicates the end of the entire sequence. The feature type is used to separate face sequences of different feature instances and also indicates the type of the processing feature instance immediately before it.

[0014] 1.3 The sequence prediction network model consists of two parts: a graph encoder and a sequence decoder. The graph encoder consists of two parts: a geometric encoding module and a topological encoding module. The geometric encoding module is constructed using the surface encoder UVNetSurfaceEncoder of UV-Net. The topological encoding module is constructed using the graph self-attention layer GraphormerLayer of the dgl library. The input graph first passes through the geometric encoding module to encode the surface geometry represented by the node attributes to obtain the geometric embedding of the node. The topological encoding module then encodes the geometric embedding of the graph and the node to obtain the semantic embedding of the node. The sequence decoder includes a sequence self-attention module, a sequence-graph cross-attention module, and a pointer network Pointer Net. The sequence self-attention module and the sequence-graph cross-attention module are constructed with reference to the decoder of Transformer. The sequence self-attention module encodes the labeled sequence (training phase) or the predicted sequence (inference phase) to obtain the sequence embedding. The sequence-graph cross-attention module calculates the attention coefficient between the sequence embedding and the graph node semantic embedding output by the graph encoder, and generates or updates the pointer vector according to the attention coefficient. Pointer Net converts the pointer vector into a probability distribution on the graph node, and takes the node number with the largest probability to form the output sequence.

[0015] Technical features of step 2 include:

[0016] For each 3D CAD model in the training dataset, a unique sequence annotation is constructed for each training sample by sorting all the machining feature instances of the 3D CAD model and all the faces of each feature instance. The machining feature instances are sorted based on the dependency, creation order, and spatial position of the feature instances. The faces are sorted based on whether the face is the bottom or side face and the spatial position of the face. The dependency relationship means that the definition of a machining feature instance is based on the boundary of another machining feature instance.

[0017] Technical features of step 3 include:

[0018] Negative log-likelihood loss is used as the loss function, and the padded nodes do not participate in the loss calculation. By defining loss weights for each training sample, the contribution of nodes representing feature types and nodes representing surfaces to the loss function is distinguished.

[0019] Advantages or beneficial effects of the present invention:

[0020] Compared with the prior art, the present invention can automatically identify processing feature instances that have intersections and contain merged faces from the boundary representation model. This is because technical feature 1 constructs an end-to-end processing feature instance segmentation network, the sequence decoder can predict the face sequence of the feature instance and allow merged faces to appear in the face sequences of different feature instances, and the three-dimensional CAD model data set described in technical feature 2 contains the face sequence annotation information of the processing feature instance required for training the network, and the sequence is unique. The present invention can automatically learn feature matching rules, output the face set of all feature instances, do not limit the number and type of feature instances to which each face belongs, can process merged faces shared by multiple feature instances, and achieve accurate processing feature recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 The steps for implementing the processing feature recognition method based on the graph encoder and the sequence decoder of the present invention;

[0022] Figure 2 A network architecture diagram of Example 1.3, including input and output examples, intermediate data formats, constituent modules, and module connection relationships;

[0023] Figure 3 for Figure 1 The specific composition and data flow diagram of the graph self-attention module in the network architecture;

[0024] Figure 4 for Figure 1 The specific composition and data flow diagram of the sequence self-attention module in the network architecture;

[0025] Figure 5 for Figure 1 The specific composition and data flow diagram of the sequence-graph cross-attention module in the network architecture;

[0026] Figure 6 for Figure 1 Data flow diagram of Pointer Net in network architecture;

[0027] Figure 7 This is an example of a training sample of Example 2.1, including a 3D CAD model and a corresponding graphical representation. DETAILED DESCRIPTION

[0028] The implementation steps of the processing feature recognition method based on the graph encoder and sequence decoder proposed in the present invention are as follows: Figure 1 The specific description is as follows:

[0029] 1. Build a sequence prediction network model based on graph representation.

[0030] 1.1 The input of the network is a graph with node attributes, \(G = \langle V, E\rangle\), where \(V\) and \(E\) are the node set and the edge set respectively. This graph corresponds to the boundary representation model, where nodes represent faces and edges represent the shared edges of adjacent faces. The attributes of the nodes represent the geometry of the faces.

[0031] 1.2 The output of the network is an integer sequence containing face IDs, feature types, and end flags. Suppose the face set of the boundary representation model corresponding to the input graph is \(F=\{f 1 , f 2 , \ldots, f n \}\). Denote the number of machining feature types as \(C\). Then, in the output sequence, 1 to \(C\) represent feature types, 0 represents the end flag, \(C + 1\) to \(C + n\) represent face IDs, and \(C + i\) represents face \(f i \). Denote the output sequence as \(O=\{o 1 , o 2 , \ldots, o m \}\), where \(o i \in\{0, 1, \ldots, C + n\}\), \(1\leq o m-1 \leq C\), and \(o m = 0\). A subsequence \(\{o i , o i+1 , \ldots, o i+k \}\), \(i\geq1\), \(i + k\leq m - 2\), \(k\geq0\), defines a machining feature instance \(I\) if and only if \((i = 1\) or \(1\leq o i-1 \leq C)\) and \((1\leq o i+k+1 \leq C)\) and the type of \(I\) is \(o i+k+1 \). Arranging all subsequences that satisfy the above conditions in the order of their appearance in the original sequence gives the machining feature instance sequence of the model, \(M=\{I 1 , I 2 , \ldots, I p \}\), and for \(s\lt t\), we have \(i\lt j\). The prediction sequence \(O\) can represent machining feature instances that include shared faces. For two machining feature instances \(I s \) and \(I t \), if such that \(o i = o j = k\), then face \(f k \) is the shared face of \(I s \) and \(I t \).

[0032] 1.3 Figure 2The architecture of the sequence prediction network is described. First, the geometry of the face is encoded by the face encoder. After that, C+1 virtual nodes are added to the graph output by the face encoder, one of which represents the end mark and the rest represent the processing feature types. The node numbering is adjusted so that the end mark node is numbered 0, the processing feature type nodes are numbered 1 to C, and the face node numbering starts from C+1. Next, the sequence encoding is generated through the graph self-attention module, the sequence self-attention module, and the sequence-graph cross-attention module. N layers of sequence self-attention modules and cross-attention modules are set, and the output of each layer is used as the input of the next layer. Finally, the sequence encoding is converted into a graph node index sequence through PointerNet.

[0033] UV-Net's surface convolution network UVNetSurfaceEncoder is used as the surface encoder. The input data is the node features representing the surface geometry, and its shape is batch_node_sum*in_channels*H*W. batch_node_sum is the sum of the number of nodes in the batch graphs. Since the number of nodes in each graph is different, the sum of the number of nodes in each batch of graphs is also different. batch is the number of samples in each batch of data, and its value is specified by the user. H and W represent the sampling steps in the parameter domain u and v directions, respectively, and their values ​​are specified by the user. in_channels is the length of the input feature vector of the sampling point. The input features of the sampling point include the coordinates of the point, the normal, and the geodesic distance to the surface boundary (points inside the surface are positive, and points outside the surface are negative), f i =(x, y, z, n x , n y , n z , gd). The sampling points and their input features are generated in the data preprocessing stage. The output data is the embedded features of the nodes, and its shape is batch_node_sum*output_dim, where output_dim is the length of the embedded feature vector of the face.

[0034] The graph self-attention module is constructed using LayerNorm of the pytorch library, GraphormerLayer of the dgl library, degree encoder DegreeEncoder, path encoder PathEncoder, and distance encoder SpatialEncoder. Its architecture is as follows: Figure 3As shown. Set N layers of GraphormerLayer, and the node features output by each layer are used as the input of the next layer. The embedding and bias of virtual nodes are learnable parameters. The input of the graph self-attention module includes node features (batch*N*64), node in-degree (batch*N), node out-degree (batch*N), shortest path (batch*N*N*L*d), shortest distance (batch*N*N), and node attention mask (batch*N*N). batch is the number of samples in each batch, and d is the feature dimension, and their values ​​are specified by the user. N and L are the maximum number of nodes and the maximum path length of all graphs in the training dataset, respectively. Add virtual nodes to the graph output by UVNetSurfaceEncoder and pad the number of nodes to N. The virtual nodes are added before the original node sequence, and the padding nodes are added after the original node sequence. The embedding features of the virtual nodes and the padding nodes are initialized to 0. The masks of the rows and columns corresponding to the padding nodes are set to invalid. The node in-degree, node out-degree, shortest path, and shortest distance are generated in the data preprocessing stage. The output of the graph self-attention module is the node embedding feature x(batch*N*embedding_dim). embedding_dim is the dimension of the node embedding feature, and its value is specified by the user.

[0035] like Figure 4 As shown in Figure 1, the sequence self-attention module is constructed with reference to the decoder of Transformer. Depending on the stage of the network model, the input of the sequence self-attention module is different. In the training stage, the input is the encoding sequence of the corresponding nodes collected from the graph output by the face encoder according to the real processing feature instance sequence. In the inference stage, the input is the encoding sequence of the corresponding nodes collected from the graph output by the face encoder according to the predicted processing feature instance sequence. A learnable encoding indicating the beginning of the sequence is added to the front of the input sequence. The output is a new encoding sequence with the same length as the input sequence. The shape of the input and output sequences is batch*N*64, where N is the maximum sequence length. The padding mask is used to mark the position to be masked after the input sequence, and the attention mask is used to mark the position after the current position to be masked, both of which have a shape of batch*N.

[0036] Figure 5 is the sequence-graph cross-attention module architecture, where tgt is the sequence encoding output by the sequence self-attention module, src is the graph node encoding output by the graph self-attention module, and source sequence mask and target sequence mask are masks used to mark the sequence padding positions.

[0037] Figure 4 and Figure 5In , the attention layer is used to calculate the attention coefficient of the input sequence Q on K, and perform weighted summation on V to obtain a new output sequence. Q, K, and V are obtained by performing different linear transformations on src and tgt. Figure 3 and Figure 4 The three linear layers in output V, K, and Q from left to right. Layer normalization is a layer normalization operation whose input weights and biases are learnable parameters.

[0038] Figure 6 It is the PointerNet architecture. The block at the bottom represents the sequence encoding output by the sequence-graph cross-attention module. Each encoding in the sequence is respectively calculated with the graph node encoding output by the graph self-attention module to calculate the attention score, and the attention score is converted into a probability distribution on the graph node through softmax. The node number with the largest probability is taken as the output of the corresponding position in the predicted sequence.

[0039] 2. Define the training sample data structure and preprocess the training data.

[0040] 2.1 The training sample is a 3D CAD part model, whose boundary representation information is saved in a STEP file, and the sample's processing feature instance annotation is saved in a json file of the same name. The instance annotation is defined as a list of processing feature instances. The processing feature instance is defined as a dictionary containing two keys 'type' and 'faces'. The value of 'type' is the processing feature type. The processing feature type is represented by a predefined integer. The value of 'faces' is a list of the numbers of all faces belonging to the processing feature instance. Each face is assigned a unique and consecutive number in the order of topological traversal. Both the processing feature instance list and the face number list are ordered lists.

[0041] The face list is sorted by the following steps: (1) The faces are divided into bottom faces and side faces. The bottom faces are faces perpendicular to the stretching direction of the machining feature, and the side faces are faces parallel to the stretching direction of the machining feature. A local right-handed coordinate system is established with the center point of the bottom face bounding box as the origin, the long side of the bounding box as the y-axis, the short side of the bounding box as the z-axis, and the bottom face normal as the x-axis. (2) The coordinates of the center point of each face in the local coordinate system are calculated, and the faces are sorted according to the lexicographic order of the local coordinates of the center point. (3) For non-stretching features that do not have bottom faces and side faces, including chamfers and fillets, the order of the feature faces is determined by sorting the edges that define the chamfers or fillets. The edges are sorted according to the lexicographic order of the midpoint coordinates of the edges.

[0042] The list of machining feature instances is sorted by the following steps: (1) For feature instances with dependencies, the parent feature is placed before the child feature; (2) For feature instances without dependencies but intersecting, they are sorted in the order of creation; (3) For feature instances that have neither dependencies nor intersections, they are sorted in the lexicographical order of the coordinates of the center point of the bounding box.

[0043] Figure 7 is a training sample example, including a 3D CAD model and its graphical representation. The corresponding machining feature instances are labeled as [{'type'=STOCK,'faces'=[1,3,4,2]},{'type'=SLOT,'faces'=[6,5,7]}].

[0044] 2.2 The graph self-attention module, sequence self-attention module and sequence-graph cross-attention module require other input data, including virtual nodes, masks, graph in-degree, out-degree and shortest path information. These input data are calculated in the collate function that defines the dataset class.

[0045] In the graph self-attention module, when the number of nodes in the input graph is less than the maximum number of nodes, it is necessary to fill in the missing nodes and define a mask to mark the position of the filled nodes. The padded nodes are added after the original node list. The mask of each graph is defined as an N*N two-dimensional array, where N is the sum of the maximum number of nodes and the number of newly added nodes, and the masks of the rows and columns corresponding to the padded nodes are set to invalid values. The in-degree, out-degree and shortest path of each node are calculated, saved in the corresponding array, and filled to the maximum length. The node feature is defined as the feature information of the sampling point of each face as described in 1.3.

[0046] The input of the sequence self-attention module is the target annotation / prediction sequence, which is padded to the maximum length at the end and the padded position is marked by a mask. The mask of each sequence is defined as a one-dimensional array of length N, and the mask of the padded position is set to an invalid value.

[0047] In the sequence-graph cross-attention module, the mask of the graph nodes is one of the input data. The nodes of the graph are arranged in order from small to large node numbers to get the node sequence. The cross-attention mask of the graph is defined as a one-dimensional array of length N, and the mask of the node position is set to an invalid value.

[0048] 3. Negative log-likelihood loss is used as the loss function, and the value used for padding does not participate in the loss calculation. In the loss function, a loss weight W is defined for each sample, distinguishing between nodes representing feature types, nodes representing faces, and padded nodes. W is a one-dimensional vector of length N. The values ​​of the first C+1 items are α, the values ​​of items C+1 to C+n are β, and the remaining items are the weights of the padding items, which are 0. N is the number of graph nodes after padding, n is the number of original nodes in the sample, and α and β are hyperparameters. The loss function of the batch training sample is defined as: y t is the real node index value of the t-th position in the target sequence, p(y t ) is the tth position predicted to be y t The probability of . During training, the teacher forcing mechanism is used, and the real sequence is used as the input of the sequence self-attention module to predict the pointer embedding. The dataset is divided into training set, validation set and test set, and the accuracy is used as the performance evaluation indicator. The accuracy of the validation set is optimized by adjusting the hyperparameters in the network and training.

[0049] 4. Convert the unlabeled 3D CAD boundary representation model to be detected into a graph representation. In the inference mode, input the graph representation into the trained network model to predict the face sequence of the processing feature instance. Since there is no label information of the real sequence, take the currently predicted node sequence as the input of the sequence self-attention module. Generate the best sequence through beam search technology. At each prediction step, select the most likely nodes to construct the candidate sequence, and retain the first few sequences with the highest scores. Output the sequence with the highest score when the prediction stops.

Claims

1. A processing feature recognition method based on a graph encoder and a sequence decoder, characterized in that: The following steps are involved: Step 1. Construct a graph-oriented sequence prediction network model, with the input being the graph representation of the 3D CAD model and the output being the face sequence and type representing the machining feature instance; Step 2. Define the training sample data structure and preprocess the training data; Step 3. Define the loss function and evaluation index, train and optimize the sequence prediction network model through the preprocessed training data, and obtain the optimized sequence prediction network model; Step 4. Input the unlabeled 3D CAD model into the optimized sequence prediction network model to predict the face sequence and type of the processing feature instance in the inference mode.

2. The processing feature recognition method based on graph encoder and sequence decoder according to claim 1 is characterized in that: The input of the sequence prediction network model is a graph with node attributes, which corresponds to the boundary representation of the 3D CAD model. The nodes represent faces, and the edges represent the shared edges of adjacent faces. The attributes of the nodes represent the geometry of the faces. The output of the sequence prediction network model is an integer sequence including face ID, feature type and end mark; each continuous face ID represents a feature instance; the end mark indicates the end of the entire sequence; the feature type is used to separate face sequences of different feature instances, and at the same time indicates the type of the processing feature instance immediately before it.

3. The processing feature recognition method based on graph encoder and sequence decoder according to claim 2 is characterized in that: The sequence prediction network model consists of two parts: a graph encoder and a sequence decoder; The graph encoder consists of two parts: a geometric encoding module and a topological encoding module. The geometric encoding module is constructed using UVNetSurfaceEncoder, a surface encoder of UV-Net. The topological encoding module is constructed using the graph self-attention layer GraphormerLayer of the dgl library; The input graph first passes through the geometric encoding module to encode the face geometry represented by the node attributes to obtain the geometric embedding of the node; the topological encoding module then encodes the geometric embedding to obtain the semantic embedding of the node; The sequence decoder includes a sequence self-attention module, a sequence-graph cross-attention module and a pointer network PointerNet; the sequence self-attention module encodes the labeled sequence or the predicted sequence to obtain a sequence embedding; the sequence-graph cross-attention module calculates the attention coefficient between the sequence embedding and the graph node semantic embedding output by the graph encoder, and generates or updates the pointer vector according to the attention coefficient; the Pointer Net converts the pointer vector into a probability distribution on the graph node, and takes the node number with the largest probability to form an output sequence.

4. The processing feature recognition method based on graph encoder and sequence decoder according to claim 1 is characterized in that: In step 2, the training sample includes two parts: a graph representation and a face sequence annotation of a 3D CAD model; the preprocessing extracts face features and graph structure information from the input graph representation, and pads the graph nodes and face sequences to a set length.

5. The processing feature recognition method based on graph encoder and sequence decoder according to claim 4 is characterized in that: The step 2 also includes, for each 3D CAD model in the training data set, by sorting all processing feature instances of the 3D CAD model and all faces of each feature instance, constructing a unique sequence label for each training sample.

6. The processing feature recognition method based on graph encoder and sequence decoder according to claim 5 is characterized in that: The processing feature instances are sorted based on the dependency, creation order and spatial position of the feature instances; the faces are sorted based on whether they are bottom faces or side faces and the spatial position of the faces; The dependency relationship means that the definition of one processing feature instance refers to the boundary of another processing feature instance.

7. The processing feature recognition method based on graph encoder and sequence decoder according to claim 1 is characterized in that: In step 3, the loss function adopts negative log-likelihood loss, the padded nodes do not participate in the loss calculation, and the contribution of nodes representing feature types and nodes representing surfaces to the loss function is distinguished by defining loss weights for each training sample.

Citation Information

Cited By

  • Three-dimensional digital-analog file generation method and device, equipment, medium and program product

    CN119337539A

  • Manufacturing process strategy prediction method based on B-rep self-supervised learning

    CN119693178A