A small sample migration type interpretable feature recognition method for STEP parts
Patent Information
- Application Number
- CN202611142728.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-30
- Publication Date
- 2026-10-20
- Estimated Expiration
- 2046-07-30
AI Technical Summary
[0004]为了解决现有技术中STEP零件几何拓扑层级表达不足、易混淆加工特征小样本识别精度不高以及图神经网络识别结果缺乏可解释依据的问题,第一方面,本发明提出一种面向STEP零件的小样本迁移式可解释特征识别方法,包括如下步骤:
[0018]本发明通过将STEP数据解析为包含几何基元与拓扑结构的混合层级图,并关联可微的局部几何标架向量,丰富了零件几何细节与拓扑关联的表达。通过基于预测误差动态更新混淆概率矩阵,抽取易混淆特征类别构建元学习样本集,有利于提高模型对相似加工特征的区分能力。在训练阶段,根据节点嵌入对局部几何标架向量的响应程度生成几何稳定性权重系数,对参数梯度进行加权修正,降低局部几何扰动对模型更新稳定性的影响。进一步将待识别零件引发的参数梯度向量投影至任务适应主向量基,获得可度量的投影分量,为特征识别结果提供解释依据,提高识别过程的透明性和工程可用性。
Smart Images

Figure CN122676495B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of STEP part feature recognition, and in particular relates to a small-sample transferable interpretable feature recognition method for STEP parts. Background Technology
[0002] In the field of computer-aided design and manufacturing integration, automatic identification of machining features in 3D models is a crucial prerequisite for intelligent process planning. With the development of industrial standardization and digital manufacturing, the STEP format, with its rich geometric and topological information and good platform independence, has become a commonly used standard format for 3D product data exchange. In recent years, deep learning technologies such as graph neural networks have been gradually applied to STEP part feature recognition tasks, reducing the reliance of traditional rule-based methods on expert experience and manual feature enumeration to some extent. However, STEP data simultaneously contains low-level geometric primitives and high-level topological structures, with complex hierarchical and fusion relationships between them. Existing data graphing methods often struggle to fully express the mixed hierarchical features between geometric primitives and topological structures, and rarely consider the impact of changes in local geometry under different coordinate systems or orientations on the stability of model representation. Meanwhile, industrial parts widely exhibit similar morphological and boundary-similar machining features. Furthermore, the uneven distribution of different types of feature samples in actual production environments leads to misjudgments when faced with easily confused categories, affecting the model's generalization and discrimination capabilities in diverse machining scenarios.
[0003] Furthermore, the application of deep learning models in critical manufacturing scenarios faces the problem of insufficient interpretability. In scenarios with high requirements for machining process reliability, such as precision manufacturing and aerospace, feature recognition results often affect subsequent CNC programming, toolpath planning, and process parameter configuration. Existing graph neural network models mostly use feature classification results as output, making it difficult to clearly present the geometric and topological response relationships on which the model makes recognition judgments to process engineers. Once a recognition deviation occurs, engineers find it difficult to trace the correlation between changes in internal model parameters and input geometric and topological information in a timely manner, thus affecting the controllability and reliability of the intelligent process system. Therefore, it is necessary to propose a small-sample transfer-based interpretable feature recognition method for STEP parts, which improves the ability to distinguish easily confused machining features by integrating hierarchical information of geometric primitives and topological structures, and enhances the transparency and engineering usability of feature recognition results through a measurable interpretation mechanism. Summary of the Invention
[0004] To address the shortcomings of existing technologies, such as insufficient hierarchical representation of the geometric topology of STEP parts, low accuracy in identifying easily confused machining features in small samples, and lack of interpretable evidence for graph neural network recognition results, this invention proposes a small-sample transfer-based interpretable feature recognition method for STEP parts, comprising the following steps: The STEP data is acquired and parsed into a hybrid hierarchical graph containing geometric primitive nodes and topological structure nodes. Adjacent edges between topological structure nodes and subordinate edges between geometric primitive nodes and topological structure nodes are established based on entity connection relationships. Differentiable local geometric frame vectors are associated with the geometric primitive nodes. A meta-learning training task set is constructed. The confusion probability matrix is initialized based on the initial geometric topological similarity of the feature categories. After the meta-batch, the confusion probability matrix is updated according to the prediction error. Easily confused categories are extracted to form a support set and a query set. Meta-training is performed on the graph neural network model using the meta-learning training task set. During the inner loop update, the original update gradient of the graph neural network model parameters is calculated, and the geometric stability weight coefficient is determined based on the degree of response of the node embedding to the change of the local geometric frame vector. The original update gradient is then corrected using the geometric stability weight coefficient. For the part to be identified, the trained graph neural network model is used to perform forward inference on the part to be identified, and the output scalar corresponding to the predicted category is used as the backpropagation target. The gradient vector of the graph neural network model parameters caused by the part to be identified is calculated, and the gradient vector of the graph neural network model parameters is projected onto the task adaptation principal vector basis. The projected components are used as measurable interpretations. The task adaptation principal vector basis is obtained by principal component analysis processing of the set of parameter change vectors generated by each feature category in the inner loop. Specifically, the computation involves calculating the original update gradient of the graph neural network model parameters and determining the geometric stability weight coefficients based on the degree of response of the node embedding to changes in the local geometric frame vector. The gradient of the inner loop loss function with respect to the parameters of each layer of the graph neural network model is calculated using the backpropagation algorithm; Calculate the partial derivative matrix of the embedding features of the last layer nodes with respect to the local geometric frame vector of the input layer, and use the matrix as the Jacobian matrix; Calculate the Frobenius norm of the Jacobian matrix, and use the reciprocal of the norm plus 1 as the geometric stability weighting coefficient.
[0005] Optionally, the step of acquiring STEP data and parsing it into a hybrid hierarchical graph containing geometric primitive nodes and topological structure nodes, and establishing adjacency edges between topological structure nodes and dependent edges between geometric primitive nodes and topological structure nodes based on entity connection relationships, includes: Parse the STEP model file, extract the faces, boundaries and vertices from the entity configuration information as topological structure nodes, and extract the bottom parametric surface settings of cylindrical surfaces, planes and spheres as geometric primitive nodes; Adjacent edges between the topological structure nodes are established based on the enclosing relationship between faces and boundaries, and dependent edges between the geometric primitive nodes and the topological structure nodes are established based on the supporting relationship between geometric primitives and face entities.
[0006] Optionally, the step of associating the geometric primitive node with a differentiable local geometric frame vector includes: For the parametric surface equation corresponding to each geometric primitive node, several reference points are uniformly sampled within the parameter domain of the equation. At each reference point, the partial derivatives of the parametric surface with respect to the two independent parameterized directions are calculated and orthogonalized to obtain two orthogonal tangential basis vectors. The cross product of two tangential basis vectors is calculated to obtain the normal vector at the reference point. The tangential basis vector and the normal vector are combined to form a local geometric frame vector.
[0007] Optionally, the initialization of the confusion probability matrix based on the initial geometric topological similarity of the feature category includes: Extract typical part sub-images corresponding to each feature category, and use a graph matching algorithm to calculate the graph edit distance between sub-images of different categories; The inverse of the graph edit distance is converted into a similarity score. The similarity score is normalized using the Softmax function, and the normalized value is used as the initial confusion probability of the corresponding category pair in the confusion probability matrix. The confusion probabilities of the same category pairs on the diagonal of the confusion probability matrix are forcibly set to zero, and then renormalized row by row.
[0008] Optionally, updating the confusion probability matrix based on the prediction error after the meta-batch includes: In the query set prediction phase of each meta-batch, the statistical graph neural network model counts the number of incorrect samples that misclassify the true category A as the predicted category B. Calculate the misjudgment ratio of the number of erroneous samples to the number of query samples of true category A in the current meta-batch; Using the moving average algorithm, the misclassification rate of the current batch is weighted and fused with the historical confusion probability to update the probability values of the corresponding positions of the true category A and the predicted category B in the confusion probability matrix, and the updated confusion probability matrix is normalized row by row.
[0009] Optionally, the step of correcting the original update gradient using the geometric stability weight coefficient includes: The geometric stability weight coefficients are multiplied with the gradients of the parameters of each layer of the graph neural network model to generate a weighted update gradient.
[0010] Optionally, the task-adapted principal vector basis is obtained by principal component analysis of the set of parameter change vectors generated by each feature category in the inner loop, including: Record the parameter change vector of the graph neural network model caused by each feature category in the meta-training inner loop, and construct the parameter change matrix for each feature category; The parameter change matrix is centered, and the covariance matrix of the parameter change matrix is calculated. The covariance matrix is decomposed into eigenvalues, and the eigenvectors corresponding to the top k largest eigenvalues are extracted to form the task-adaptive principal vector basis, where k is determined according to the set cumulative variance contribution rate threshold.
[0011] On the other hand, the present invention also proposes a small-sample transfer-based interpretable feature recognition system for STEP parts, comprising the following modules: The module is used to acquire STEP data and parse it into a hybrid hierarchical graph containing geometric primitive nodes and topological structure nodes. It establishes adjacency edges between topological structure nodes and subordinate edges between geometric primitive nodes and topological structure nodes based on entity connection relationships, and associates differentiable local geometric frame vectors with the geometric primitive nodes. It constructs a meta-learning training task set, initializes the confusion probability matrix based on the initial geometric topological similarity of feature categories, updates the confusion probability matrix according to the prediction error after the meta-batch, and extracts easily confused categories to form a support set and a query set. The computation module is used to perform meta-training on the graph neural network model using the meta-learning training task set. During the inner loop update, it calculates the original update gradient of the graph neural network model parameters, determines the geometric stability weight coefficient based on the degree of response of the node embedding to the change of the local geometric frame vector, and uses the geometric stability weight coefficient to correct the original update gradient. The processing module is used to perform forward inference on the part to be identified using the trained graph neural network model, with the output scalar corresponding to the predicted category as the backpropagation target, calculate the gradient vector of the graph neural network model parameters caused by the part to be identified, and project the gradient vector of the graph neural network model parameters onto the task adaptation principal vector basis, with the projected components as a measurable interpretation. The task adaptation principal vector basis is obtained by principal component analysis processing of the set of parameter change vectors generated by each feature category in the inner loop. Specifically, the computation involves calculating the original update gradient of the graph neural network model parameters and determining the geometric stability weight coefficients based on the degree of response of the node embedding to changes in the local geometric frame vector. The gradient of the inner loop loss function with respect to the parameters of each layer of the graph neural network model is calculated using the backpropagation algorithm; Calculate the partial derivative matrix of the embedding features of the last layer nodes with respect to the local geometric frame vector of the input layer, and use the matrix as the Jacobian matrix; Calculate the Frobenius norm of the Jacobian matrix, and use the reciprocal of the norm plus 1 as the geometric stability weighting coefficient.
[0012] Preferably, the step of acquiring STEP data and parsing it into a hybrid hierarchical graph containing geometric primitive nodes and topological structure nodes, and establishing adjacency edges between topological structure nodes and dependent edges between geometric primitive nodes and topological structure nodes based on entity connection relationships, includes: Parse the STEP model file, extract the faces, boundaries and vertices from the entity configuration information as topological structure nodes, and extract the bottom parametric surface settings of cylindrical surfaces, planes and spheres as geometric primitive nodes; Adjacent edges between the topological structure nodes are established based on the enclosing relationship between faces and boundaries, and dependent edges between the geometric primitive nodes and the topological structure nodes are established based on the supporting relationship between geometric primitives and face entities.
[0013] Preferably, the local geometric frame vector associated with the geometric primitive node is differentiable, comprising: For the parametric surface equation corresponding to each geometric primitive node, several reference points are uniformly sampled within the parameter domain of the equation. At each reference point, the partial derivatives of the parametric surface with respect to the two independent parameterized directions are calculated and orthogonalized to obtain two orthogonal tangential basis vectors. The cross product of two tangential basis vectors is calculated to obtain the normal vector at the reference point. The tangential basis vector and the normal vector are combined to form a local geometric frame vector.
[0014] Preferably, the initialization of the confusion probability matrix based on the initial geometric topological similarity of the feature category includes: Extract typical part sub-images corresponding to each feature category, and use a graph matching algorithm to calculate the graph edit distance between sub-images of different categories; The inverse of the graph edit distance is converted into a similarity score. The similarity score is normalized using the Softmax function, and the normalized value is used as the initial confusion probability of the corresponding category pair in the confusion probability matrix. The confusion probabilities of the same category pairs on the diagonal of the confusion probability matrix are forcibly set to zero, and then renormalized row by row.
[0015] Preferably, updating the confusion probability matrix based on the prediction error after the meta-batch includes: In the query set prediction phase of each meta-batch, the statistical graph neural network model counts the number of incorrect samples that misclassify the true category A as the predicted category B. Calculate the misjudgment ratio of the number of erroneous samples to the number of query samples of true category A in the current meta-batch; Using the moving average algorithm, the misclassification rate of the current batch is weighted and fused with the historical confusion probability to update the probability values of the corresponding positions of the true category A and the predicted category B in the confusion probability matrix, and the updated confusion probability matrix is normalized row by row.
[0016] Preferably, the step of correcting the original update gradient using the geometric stability weight coefficient includes: The geometric stability weight coefficients are multiplied with the gradients of the parameters of each layer of the graph neural network model to generate a weighted update gradient.
[0017] Preferably, the task-adapted principal vector basis is obtained by principal component analysis of the set of parameter change vectors generated by each feature category in the inner loop, including: Record the parameter change vector of the graph neural network model caused by each feature category in the meta-training inner loop, and construct the parameter change matrix for each feature category; The parameter change matrix is centered, and the covariance matrix of the parameter change matrix is calculated. The covariance matrix is decomposed into eigenvalues, and the eigenvectors corresponding to the top k largest eigenvalues are extracted to form the task-adaptive principal vector basis, where k is determined according to the set cumulative variance contribution rate threshold.
[0018] This invention enriches the expression of part geometric details and topological relationships by parsing STEP data into a hybrid hierarchical graph containing geometric primitives and topological structures, and associating it with differentiable local geometric frame vectors. By dynamically updating the confusion probability matrix based on prediction errors and extracting easily confused feature categories to construct a meta-learning sample set, the model's ability to distinguish similar processing features is improved. During the training phase, geometric stability weight coefficients are generated based on the response of node embeddings to local geometric frame vectors, and parameter gradients are weighted and corrected to reduce the impact of local geometric perturbations on model update stability. Furthermore, the parameter gradient vectors induced by the part to be identified are projected onto the task-adaptive principal vector basis to obtain measurable projection components, providing an interpretive basis for feature recognition results and improving the transparency and engineering usability of the recognition process. Attached Figure Description
[0019] Figure 1 A flowchart of the first embodiment; Figure 2 A heatmap for visualizing the confusion probability matrix; Figure 3 This is a schematic diagram of the classification error rate change curve during batch iteration; Figure 4 This is a schematic diagram showing the decay relationship between the Jacobian matrix norm and the geometric stability weights. Detailed Implementation
[0020] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0021] In the first embodiment, the present invention proposes a small-sample transfer-based interpretable feature recognition method for STEP parts, such as... Figure 1 As shown, it includes the following steps: S1. Acquire STEP data and parse it into a hybrid hierarchical graph containing geometric primitive nodes and topological structure nodes. Establish adjacency edges between topological structure nodes and subordinate edges between geometric primitive nodes and topological structure nodes based on entity connection relationships. Associate differentiable local geometric frame vectors for the geometric primitive nodes. Construct a meta-learning training task set. Initialize the confusion probability matrix based on the initial geometric topological similarity of feature categories. Update the confusion probability matrix according to the prediction error after the meta-batch. Extract easily confused categories to form a support set and a query set.
[0022] The STEP model reading interface is invoked to read the 3D part model in STEP format and parse it into a BRep boundary representation data structure. Topological structure nodes are generated by traversing the faces, edges, and vertices. Parametric surfaces such as planes, cylinders, and spheres at the bottom layer of the faces are extracted to generate geometric primitive nodes, and the straight lines and curves at the bottom layer of the edges are encoded as topological edge attributes. A hybrid hierarchical graph is constructed, establishing adjacency edges between adjacent topological structure nodes based on shared edge relationships, and dependent edges based on the support relationship between geometric primitives and topological surfaces. Subsequently, the normal vector and primary and secondary tangent vectors of each geometric primitive node at the center point of the parameter domain are calculated and converted into floating-point tensors with the `requires_grad` attribute enabled, serving as differentiable local geometric frame vectors. The graph edit distance between sample graphs of different processing feature categories is calculated and initialized with reciprocal normalization to form the confusion probability matrix.
[0023] A meta-learning training task set is constructed. Following the N-way K-shot few-shot learning approach, several categories and a small number of samples from the processed feature category sample library are repeatedly extracted to form support sets and query sets, thereby obtaining multiple few-shot recognition tasks for training the model's rapid adaptation ability. This meta-learning is a "learning how to learn" training method that enables the model to accumulate rapid adaptation ability through multiple few-shot tasks, thus allowing it to complete effective recognition with less data when faced with new categories or a small number of samples.
[0024] After each meta-batch, a classification confusion matrix is calculated based on the true and predicted labels of the query or validation set, and the confusion probability matrix is updated using an exponential moving average. Finally, the multinomial function is called to sample easily confused category combinations according to the updated confusion probability distribution, and sample graphs are extracted from them to construct the support set and query set.
[0025] In an optional embodiment, the step of acquiring STEP data and parsing it into a hybrid hierarchical graph containing geometric primitive nodes and topological structure nodes, and establishing adjacency edges between topological structure nodes and dependent edges between geometric primitive nodes and topological structure nodes based on entity connection relationships, includes: Parse the STEP model file, extract the faces, boundaries and vertices from the entity configuration information as topological structure nodes, and extract the bottom parametric surface settings of cylindrical surfaces, planes and spheres as geometric primitive nodes; Adjacent edges between the topological structure nodes are established based on the enclosing relationship between faces and boundaries, and dependent edges between the geometric primitive nodes and the topological structure nodes are established based on the supporting relationship between geometric primitives and face entities.
[0026] By integrating an open-source geometry kernel engine, STEP model files in AP242 or AP203 format conforming to the ISO 10303 standard are read. A topology traversal tool is used to parse out a B-Rep model representing the product's solid shape. The extracted faces, boundaries, and vertices are uniformly encoded and assigned dimensional features to form a dimension of [dimensional value missing]. A 64x64 topological node matrix. It calls an internal interface to read the underlying geometric description of the geometric entities, extracting geometric parameters such as the radius *r* and axis direction vector of the cylinder, the normal vector and origin coordinates of the plane, and the center and radius of the sphere, converting them into a 64x64 matrix. A 32×32 geometric primitive node matrix. A directed adjacency matrix is used when constructing the edge relationships in the graph structure. This represents adjacent edges. If a boundary forms the outer boundary or inner loop of a specific face, it is assigned a value of 1 at the corresponding position in the matrix. An incidence matrix is used. This indicates a dependent edge. It iterates through the face entities in the STEP data structure and matches the underlying geometric support surface of that face entity. If a geometric primitive is the underlying support surface of the corresponding topological face, then... The corresponding element is assigned a value of 1. For example, when a planar parametric surface supports a polygonal topological surface, a subordinate edge is established between the two. The total number of nodes in the hybrid hierarchical graph is usually controlled within 200 to 1000 to improve the efficiency of feature transfer computation in the graph neural network.
[0027] In an optional embodiment, associating the geometric primitive node with a differentiable local geometric frame vector includes: For the parametric surface equation corresponding to each geometric primitive node, several reference points are uniformly sampled within the parameter domain of the equation. At each reference point, the partial derivatives of the parametric surface with respect to the two independent parameterized directions are calculated and orthogonalized to obtain two orthogonal tangential basis vectors. The cross product of two tangential basis vectors is calculated to obtain the normal vector at the reference point. The tangential basis vector and the normal vector are combined to form a local geometric frame vector.
[0028] For each underlying parametric surface extracted from the STEP file, a corresponding two-dimensional parametric surface equation S(u,v)=(x(u,v),y(u,v),z(u,v)) is established, with the parameter domain set to the normalized interval u,v∈[0,1]. A gridded equidistant sampling strategy is used to extract M×M reference points within the parameter domain. Preferably, the grid dimension M=4, meaning each parametric surface generates 16 discrete reference points, forming a point set. At each reference point... At this point, calculate the first-order partial derivative vector of the three-dimensional coordinates with respect to parameters u and v. and To reduce the impact of non-equidistant parameterization, the Schmidt orthogonalization method is used to process the two biased radii. Specifically, the first-order biased radii of the parametric surface along the direction of the first parameter are first normalized to obtain the first tangential basis vector. Then, remove the projection component along the first tangential basis vector from the first-order bias vector along the second parameter direction, and normalize the remaining vector to obtain the second tangential basis vector orthogonal to the first tangential basis vector. The unit outward normal vector N of the surface at that point is determined by calculating the cross product of two orthogonal tangential bases using the right-hand rule. The generated vector is then used to... , Combined with N in columns, they form a 3×3 rotation matrix. The local frame matrix is flattened into a local geometric frame vector and then appended to the node features. This operation constructs a continuously differentiable 3D frame in the geometric parameter domain, ensuring that the input node attributes maintain smooth gradient backpropagation as the underlying geometry deforms. This enables the end-to-end neural network model to identify local geometric perturbations caused by changes in the processing topography.
[0029] In an optional embodiment, the initialization of the confusion probability matrix based on the initial geometric topological similarity of the feature category includes: Extract typical part sub-images corresponding to each feature category, and use a graph matching algorithm to calculate the graph edit distance between sub-images of different categories; The inverse of the graph edit distance is converted into a similarity score. The similarity score is normalized using the Softmax function, and the normalized value is used as the initial confusion probability of the corresponding category pair in the confusion probability matrix. The confusion probabilities of the same category pairs on the diagonal of the confusion probability matrix are forcibly set to zero, and then renormalized row by row.
[0030] For the pre-defined C standard machining feature categories, such as through holes, countersunk holes, and rectangular grooves, the total number of categories is preferably set to C=24. Typical single-feature parts corresponding to each category are extracted from the standard CAD model library as templates and parsed into a topological hierarchy graph. For any category pair (i,j), the graph edit distance D(i,j) of that pair is calculated using an approximate bisection matching algorithm. During the calculation, the cost weights for node insertion, node deletion, and edge modification operations are all uniformly preset to a constant of 1.0 to measure the heterogeneity of the two machining features in the topological structure. After obtaining the graph edit distance matrix between all categories, a very small positive number is input. =10 -5 And calculate the reciprocal of the distance S(i,j) = 1 / (D(i,j) + () as the original similarity score.
[0031] To map the score to a reasonable probability distribution, a smoothing temperature parameter τ is introduced, preferably set to τ=0.5. Softmax normalization with temperature scaling is applied along the rows of the score matrix. For each row, the similarity score of each category in that row is divided by the temperature parameter τ and then exponentially normalized to ensure that the sum of the confusion probabilities of the predicted categories corresponding to the same true category is 1. After performing the above processing row by row for C categories, an initial confusion probability matrix of size C×C is obtained. To focus on the misclassification tendency between different categories and avoid invalid self-sampling, the diagonal elements are forcibly set to 0, i.e., all... =0, and then re-normalize by dividing by the sum of the row elements. This mechanism, by measuring the predefined prior geometric overlap, makes it easier for structurally similar features to be jointly sampled in the early stages of training, which helps to enhance the targeting and convergence speed of hard sample construction in meta-learning tasks.
[0032] In an optional embodiment, updating the confusion probability matrix based on the prediction error after the meta-batch includes: In the query set prediction phase of each meta-batch, the statistical graph neural network model counts the number of incorrect samples that misclassify the true category A as the predicted category B. Calculate the misjudgment ratio of the number of erroneous samples to the number of query samples of true category A in the current meta-batch; Using the moving average algorithm, the misclassification rate of the current batch is weighted and fused with the historical confusion probability to update the probability values of the corresponding positions of the true category A and the predicted category B in the confusion probability matrix, and the updated confusion probability matrix is normalized row by row.
[0033] In each meta-batch of the meta-learning outer loop, preferably, the size is set to include B=16 mutually independent N-way K-shot classification tasks. After evaluation, the sample prediction results of all query sets are collected, and a batch confusion matrix of size C×C is constructed, where This represents the number of samples in the current meta-batch whose true category is i but which are incorrectly predicted as category j. It is then converted into an empirical misclassification ratio matrix based on the number of query samples corresponding to each true category. A heatmap visualization of the confusion probability matrix is shown below. Figure 2 As shown. This counts the total number of test samples for the query set of the true category i appearing in the current batch. In a typical 5-way 5-shot configuration, each query set contains 15 samples. If the true category i appears in the current meta-batch... Next, then Calculate the current real-time empirical misjudgment ratio distribution .
[0034] To smooth the update trajectory and prevent drastic fluctuations caused by noise in single-batch data, a momentum decay factor α ∈ [0.85, 0.95] is set. In practical applications, an empirical value of α = 0.9 is preferred. The confusion probability matrix is updated using an exponential moving average method. The historical confusion probability of the corresponding category pair in the previous meta-batch is weighted and fused with the misclassification ratio obtained from the current meta-batch statistics, where the historical confusion probability accounts for α and the current misclassification ratio accounts for 1-α. The newly acquired batch misclassification ratio is then fused into the corresponding item of the confusion probability matrix at the previous time step. After numerical fusion, elements of the same type are constrained to 0, and the cumulative sum is calculated along each row direction. All elements of the matrix are divided by the sum of the corresponding rows to restore the probability distribution characteristics. This process is continuously corrected with training iterations, enabling the system to track the recognition blind spots exhibited by the model in the later stages of training. Specific intersection shapes that are difficult to extract and easily confused are sampled at high frequency to obtain a new meta-training task set. The trends of the original batch error and the smoothed error are as follows: Figure 3 As shown.
[0035] S2, the graph neural network model is meta-trained using the meta-learning training task set. During the inner loop update, the original update gradient of the graph neural network model parameters is calculated, and the geometric stability weight coefficient is determined based on the degree of response of the node embedding to the change of the local geometric frame vector. The original update gradient is corrected using the geometric stability weight coefficient.
[0036] A graph neural network model based on spatial graph convolution operators is constructed. The support set is input into the graph neural network model, and forward propagation is performed to obtain the node embedding feature vectors of each node. A fully connected classification layer outputs the class logistic value, and the cross-entropy loss function between this logistic value and the true label is calculated. The partial derivatives of the cross-entropy loss function with respect to all weight parameter matrices of the graph neural network model are calculated to obtain the original parameter gradients. The Jacobian matrix of the node embedding feature vectors with respect to the local geometric frame vector is calculated, and the Frobenius norm of the Jacobian matrix is solved. The Frobenius norm is added to a scalar of 1, and the reciprocal is taken to generate scalar geometric stability weight coefficients. These geometric stability weight coefficients are applied to the original parameter gradients of each layer, scaling the update magnitude of the original parameter gradients for each layer. The stochastic gradient descent (SGD) optimizer is invoked to update the specific task parameters of the graph neural network model in the inner loop according to the weighted parameter gradients.
[0037] In an optional embodiment, during the inner loop update, the original update gradient of the graph neural network model parameters is calculated, and a geometric stability weight coefficient is determined based on the degree of response of the node embedding to the change of the local geometric frame vector. The original update gradient is then corrected using the geometric stability weight coefficient, including: The gradient of the inner loop loss function with respect to the parameters of each layer of the graph neural network model is calculated using the backpropagation algorithm; Calculate the partial derivative matrix of the embedding features of the last layer nodes with respect to the local geometric frame vector of the input layer, and use the matrix as the Jacobian matrix; Calculate the Frobenius norm of the Jacobian matrix, take the reciprocal of the norm plus 1 as the geometric stability weight coefficient, and multiply the geometric stability weight coefficient with the gradient of the parameters of each layer of the graph neural network model to generate a weighted update gradient.
[0038] The graph neural network model includes an input layer, multiple graph convolutional hidden layers, a global pooling layer, and an output layer. The input layer receives a hybrid hierarchical graph containing geometric primitive nodes and topological structure nodes as input. This hybrid hierarchical graph contains node features composed of dimensional feature matrices and local geometric frame vectors. The multiple graph convolutional hidden layers aggregate neighborhood features along the adjacent and dependent edges of the hybrid hierarchical graph, updating the representation of each node. The global pooling layer aggregates the node representations into a graph-wide feature vector. The output layer maps the feature vector to classification prediction probabilities for each category through a fully connected operation and outputs the result.
[0039] In a graph neural network model based on a graph convolutional network architecture, preferably, it is configured to contain L=3 hidden layers with each layer having a feature dimension of 1. The model employs a multi-layered information aggregation structure with a resolution of 128. During the inner training loop, the model calculates the cross-entropy loss function on the current support set. It then invokes the automatic differentiation engine to perform backpropagation and solves for the weight parameters of the l-th layer network. The original updated gradient vector .
[0040] Perform a separate computational graph differentiation to extract the high-dimensional node embedding representation matrix from the output of the last hidden layer of the model. For the local geometric frame vector tensor corresponding to the geometric primitive node It consists of a flattened 3×3 matrix, and its first-order partial derivatives are solved to construct a dimension of . Jacobian matrix The Frobenius norm of the Jacobian matrix is calculated to quantify the overall sensitivity of network features to geometric perturbations in scalar form. The geometric stability weight coefficient w is then calculated using the reciprocal of the norm plus 1. This geometric stability weight coefficient is applied to the gradients of the original parameters of each layer, and the update magnitude of the gradients of the original parameters of each layer is scaled to obtain the weighted update gradient. Using a learning rate β, preferably set to β=0.01, parameter adaptation updates are performed. This stability correction mechanism allows for scaling and controlling the gradient update step size when the Jacobian matrix norm is too large, indicating that the model is in a region unstable to geometric input. This reduces the likelihood of classification boundary shifts due to subtle local topographic distortions. Figure 4 As shown, this illustrates the monotonically decreasing trend of the geometric stability weights as the Jacobian matrix norm increases.
[0041] S3. For the part to be identified, the trained graph neural network model is used to perform forward inference on the part to be identified. The output scalar corresponding to the predicted category is used as the backpropagation target. The gradient vector of the graph neural network model parameters caused by the part to be identified is calculated. The gradient vector of the graph neural network model parameters is projected onto the task adaptation principal vector basis. The projected component is used as a measurable interpretation. The task adaptation principal vector basis is obtained by principal component analysis processing of the set of parameter change vectors generated by each feature category in the inner loop.
[0042] After each inner loop update during the meta-training phase, the updated parameter matrix of the graph neural network model is subtracted from the initial parameter matrix and flattened into a one-dimensional parameter change vector. The parameter change vectors of all feature categories are then stacked row-wise to form a data matrix. The PCA (Principal Component Analysis) algorithm is called to perform dimensionality reduction decomposition on the data matrix, extracting the top principal component feature vectors with a cumulative variance contribution rate greater than 90% to form the task-adaptive principal vector basis. The hybrid hierarchical graph construction logic is reused to parse and construct a graph of the input part to be identified and feed it into the graph neural network model after meta-training convergence for forward inference. The scalar value corresponding to the predicted category with the largest activation value in the fully connected classification layer output is extracted as the objective function. The backpropagation function is called to calculate the partial derivative of this scalar value with respect to the graph neural network model parameters and flatten it into the graph neural network model parameter gradient vector. The dot product of the gradient vector of the graph neural network model parameters and the basis of the task adaptation master vector is calculated to obtain multiple scalar projection components. The top three projection components with the largest absolute values and their corresponding task adaptation master vector directions are extracted in descending order. Combined with the category parameter change vectors that contribute more to the task adaptation master vector directions, an importance interpretation index of the part to be identified with corresponding geometric topological features is generated.
[0043] In an optional embodiment, the task-adapted principal vector basis is obtained by principal component analysis of the set of parameter change vectors generated by each feature category in the inner loop, including: Record the parameter change vector of the graph neural network model caused by each feature category in the meta-training inner loop, and construct the parameter change matrix for each feature category; The parameter change matrix is centered, and the covariance matrix of the parameter change matrix is calculated. The covariance matrix is decomposed into eigenvalues, and the eigenvectors corresponding to the top k largest eigenvalues are extracted to form the task-adaptive principal vector basis, where k is determined according to the set cumulative variance contribution rate threshold.
[0044] For all trainable parameters of the graph neural network, assuming the total number of parameters has a dimension of D, for example, D=150,000, after the model completes the meta-learning phase, each independent processing feature category c∈{1,…,C} is extracted. During single-class customized fine-tuning, that is, after completing a set number of inner loop gradient descent operations on the support set dedicated to that category, the corresponding latest adapted parameters are obtained. And calculate the parameter relative to the global meta-initialization parameter. The difference is flattened and merged to obtain a one-dimensional parameter change vector. Stack the change vectors from all C categories row by row to create a dense parameter change matrix X of size C×D.
[0045] Calculate the empirical mean vector along the column direction of the parameter change matrix, and subtract the empirical mean vector from each parameter change vector to obtain the centered parameter change matrix; then calculate the covariance matrix based on the centered parameter change matrix. When the parameter dimension D is large, a centered matrix is used. The principal direction is extracted using an equivalent method of truncated singular value decomposition to avoid explicitly constructing a high-dimensional covariance matrix. Feature directions are extracted from the covariance matrix or its equivalent decomposition result to obtain all eigenvalues arranged in descending order. and the corresponding unit eigenvector A cumulative variance contribution rate threshold R is set, preferably within the range of R∈[0.95,0.99]. For example, R=0.95. The smallest positive integer k is calculated according to the cumulative sum ratio, and the top k feature vectors with the largest energy are extracted and concatenated into a task-adaptive principal vector basis matrix of dimension D×k. The instantaneous gradient vector generated during the part inference stage is mapped to this subspace through projection operations. The obtained k-dimensional projection coefficients can then be used to achieve a low-dimensional interpretation of the model's focus points, improving the interpretability of processing recognition features in industrial applications.
[0046] In the second embodiment, the present invention also proposes a small-sample transfer-based interpretable feature recognition system for STEP parts, comprising the following modules: The module is used to acquire STEP data and parse it into a hybrid hierarchical graph containing geometric primitive nodes and topological structure nodes. It establishes adjacency edges between topological structure nodes and subordinate edges between geometric primitive nodes and topological structure nodes based on entity connection relationships, and associates differentiable local geometric frame vectors with the geometric primitive nodes. It constructs a meta-learning training task set, initializes the confusion probability matrix based on the initial geometric topological similarity of feature categories, updates the confusion probability matrix according to the prediction error after the meta-batch, and extracts easily confused categories to form a support set and a query set. The computation module is used to perform meta-training on the graph neural network model using the meta-learning training task set. During the inner loop update, it calculates the original update gradient of the graph neural network model parameters, determines the geometric stability weight coefficient based on the degree of response of the node embedding to the change of the local geometric frame vector, and uses the geometric stability weight coefficient to correct the original update gradient. The processing module is used to perform forward inference on the part to be identified using a trained graph neural network model, with the output scalar corresponding to the predicted category as the backpropagation target, calculate the gradient vector of the graph neural network model parameters caused by the part to be identified, and project the gradient vector of the graph neural network model parameters onto the task-adaptive principal vector basis, with the projected components as a measurable interpretation. The task-adaptive principal vector basis is obtained by principal component analysis processing of the set of parameter change vectors generated by each feature category in the inner loop.
[0047] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0048] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A small-sample transfer-based interpretable feature recognition method for STEP parts, characterized in that, include: The STEP data is acquired and parsed into a hybrid hierarchical graph containing geometric primitive nodes and topological structure nodes. Adjacent edges between topological structure nodes and subordinate edges between geometric primitive nodes and topological structure nodes are established based on entity connection relationships. Differentiable local geometric frame vectors are associated with the geometric primitive nodes. A meta-learning training task set is constructed. The confusion probability matrix is initialized based on the initial geometric topological similarity of the feature categories. After the meta-batch, the confusion probability matrix is updated according to the prediction error. Easily confused categories are extracted to form a support set and a query set. After the meta-batch, the confusion probability matrix is updated based on the prediction error, including: In the query set prediction phase of each meta-batch, the statistical graph neural network model counts the number of incorrect samples that misclassify the true category A as the predicted category B. Calculate the misjudgment ratio of the number of erroneous samples to the number of query samples of true category A in the current meta-batch; Using the moving average algorithm, the misclassification ratio of the current batch is weighted and fused with the historical confusion probability to update the probability values of the corresponding positions of the true category A and the predicted category B in the confusion probability matrix, and the updated confusion probability matrix is normalized row by row. Meta-training is performed on the graph neural network model using the meta-learning training task set. During the inner loop update, the original update gradient of the graph neural network model parameters is calculated, and the geometric stability weight coefficient is determined based on the degree of response of the node embedding to the change of the local geometric frame vector. The original update gradient is then corrected using the geometric stability weight coefficient. For the part to be identified, the trained graph neural network model is used to perform forward inference on the part to be identified, and the output scalar corresponding to the predicted category is used as the backpropagation target. The gradient vector of the graph neural network model parameters caused by the part to be identified is calculated, and the gradient vector of the graph neural network model parameters is projected onto the task adaptation principal vector basis. The projected components are used as measurable interpretations. The task adaptation principal vector basis is obtained by principal component analysis processing of the set of parameter change vectors generated by each feature category in the inner loop. Specifically, the computation involves calculating the original update gradient of the graph neural network model parameters and determining the geometric stability weight coefficients based on the degree of response of the node embedding to changes in the local geometric frame vector. The gradient of the inner loop loss function with respect to the parameters of each layer of the graph neural network model is calculated using the backpropagation algorithm; Calculate the partial derivative matrix of the embedding features of the last layer nodes with respect to the local geometric frame vector of the input layer, and use the matrix as the Jacobian matrix; Calculate the Frobenius norm of the Jacobian matrix, and use the reciprocal of the norm plus 1 as the geometric stability weighting coefficient.
2. The method according to claim 1, characterized in that, The process of acquiring STEP data and parsing it into a hybrid hierarchical graph containing geometric primitive nodes and topological structure nodes, and establishing adjacency edges between topological structure nodes and dependent edges between geometric primitive nodes and topological structure nodes based on entity connection relationships, includes: Parse the STEP model file, extract the faces, boundaries and vertices from the entity configuration information as topological structure nodes, and extract the bottom parametric surface settings of cylindrical surfaces, planes and spheres as geometric primitive nodes; Adjacent edges between the topological structure nodes are established based on the enclosing relationship between faces and boundaries, and dependent edges between the geometric primitive nodes and the topological structure nodes are established based on the supporting relationship between geometric primitives and face entities.
3. The method according to claim 2, characterized in that, The local geometric frame vector associated with the geometric primitive node is differentiable, including: For the parametric surface equation corresponding to each geometric primitive node, several reference points are uniformly sampled within the parameter domain of the equation. At each reference point, the partial derivatives of the parametric surface with respect to the two independent parameterized directions are calculated and orthogonalized to obtain two orthogonal tangential basis vectors. The cross product of two tangential basis vectors is calculated to obtain the normal vector at the reference point. The tangential basis vector and the normal vector are combined to form a local geometric frame vector.
4. The method according to claim 1, characterized in that, The initialization of the confusion probability matrix based on the initial geometric topological similarity of the feature category includes: Extract typical part sub-images corresponding to each feature category, and use a graph matching algorithm to calculate the graph edit distance between sub-images of different categories; The inverse of the graph edit distance is converted into a similarity score. The similarity score is normalized using the Softmax function, and the normalized value is used as the initial confusion probability of the corresponding category pair in the confusion probability matrix. The confusion probabilities of the same category pairs on the diagonal of the confusion probability matrix are forcibly set to zero, and then renormalized row by row.
5. The method according to claim 4, characterized in that, The step of correcting the original update gradient using the geometric stability weight coefficient includes: The geometric stability weight coefficients are multiplied with the gradients of the parameters of each layer of the graph neural network model to generate a weighted update gradient.
6. The method according to claim 1, characterized in that, The task-adapted principal vector basis is obtained by principal component analysis of the set of parameter change vectors generated by each feature category in the inner loop, including: Record the parameter change vector of the graph neural network model caused by each feature category in the meta-training inner loop, and construct the parameter change matrix for each feature category; The parameter change matrix is centered, and the covariance matrix of the parameter change matrix is calculated. The covariance matrix is decomposed into eigenvalues, and the eigenvectors corresponding to the top k largest eigenvalues are extracted to form the task-adaptive principal vector basis, where k is determined according to the set cumulative variance contribution rate threshold.
7. A small-sample transfer-based interpretable feature recognition system for STEP parts, characterized in that, include: The module is used to acquire STEP data and parse it into a hybrid hierarchical graph containing geometric primitive nodes and topological structure nodes. It establishes adjacency edges between topological structure nodes and subordinate edges between geometric primitive nodes and topological structure nodes based on entity connection relationships, and associates differentiable local geometric frame vectors with the geometric primitive nodes. It constructs a meta-learning training task set, initializes the confusion probability matrix based on the initial geometric topological similarity of feature categories, updates the confusion probability matrix according to the prediction error after the meta-batch, and extracts easily confused categories to form a support set and a query set. After the meta-batch, the confusion probability matrix is updated based on the prediction error, including: In the query set prediction phase of each meta-batch, the statistical graph neural network model counts the number of incorrect samples that misclassify the true category A as the predicted category B. Calculate the misjudgment ratio of the number of erroneous samples to the number of query samples of true category A in the current meta-batch; Using the moving average algorithm, the misclassification ratio of the current batch is weighted and fused with the historical confusion probability to update the probability values of the corresponding positions of the true category A and the predicted category B in the confusion probability matrix, and the updated confusion probability matrix is normalized row by row. The computation module is used to perform meta-training on the graph neural network model using the meta-learning training task set. During the inner loop update, it calculates the original update gradient of the graph neural network model parameters, determines the geometric stability weight coefficient based on the degree of response of the node embedding to the change of the local geometric frame vector, and uses the geometric stability weight coefficient to correct the original update gradient. The processing module is used to perform forward inference on the part to be identified using the trained graph neural network model, with the output scalar corresponding to the predicted category as the backpropagation target, calculate the gradient vector of the graph neural network model parameters caused by the part to be identified, and project the gradient vector of the graph neural network model parameters onto the task adaptation principal vector basis, with the projected components as a measurable interpretation. The task adaptation principal vector basis is obtained by principal component analysis processing of the set of parameter change vectors generated by each feature category in the inner loop. Specifically, the computation involves calculating the original update gradient of the graph neural network model parameters and determining the geometric stability weight coefficients based on the degree of response of the node embedding to changes in the local geometric frame vector. The gradient of the inner loop loss function with respect to the parameters of each layer of the graph neural network model is calculated using the backpropagation algorithm; Calculate the partial derivative matrix of the embedding features of the last layer nodes with respect to the local geometric frame vector of the input layer, and use the matrix as the Jacobian matrix; Calculate the Frobenius norm of the Jacobian matrix, and use the reciprocal of the norm plus 1 as the geometric stability weighting coefficient.
8. The system according to claim 7, characterized in that, The process of acquiring STEP data and parsing it into a hybrid hierarchical graph containing geometric primitive nodes and topological structure nodes, and establishing adjacency edges between topological structure nodes and dependent edges between geometric primitive nodes and topological structure nodes based on entity connection relationships, includes: Parse the STEP model file, extract the faces, boundaries and vertices from the entity configuration information as topological structure nodes, and extract the bottom parametric surface settings of cylindrical surfaces, planes and spheres as geometric primitive nodes; Adjacent edges between the topological structure nodes are established based on the enclosing relationship between faces and boundaries, and dependent edges between the geometric primitive nodes and the topological structure nodes are established based on the supporting relationship between geometric primitives and face entities.
9. The system according to claim 7, characterized in that, The local geometric frame vector associated with the geometric primitive node is differentiable, including: For the parametric surface equation corresponding to each geometric primitive node, several reference points are uniformly sampled within the parameter domain of the equation. At each reference point, the partial derivatives of the parametric surface with respect to the two independent parameterized directions are calculated and orthogonalized to obtain two orthogonal tangential basis vectors. The cross product of two tangential basis vectors is calculated to obtain the normal vector at the reference point. The tangential basis vector and the normal vector are combined to form a local geometric frame vector.
Citation Information
Patent Citations
Three-dimensional model object recognition method and device based on machine learning and medium
CN122289659A
B-Rep model processing feature identification method and device
CN122346669A