Processing accuracy prediction method based on attention residual twin network

By applying the machining accuracy prediction method based on attention residual twin network in CNC machining, the problem that traditional methods are difficult to analyze and model timing displacement sequence data is solved, and a higher level of accuracy prediction and intelligence is achieved.

CN116630728BActive Publication Date: 2025-05-09CHONGQING UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310577060.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-19
Publication Date
2025-05-09
Estimated Expiration
2043-05-19

AI Technical Summary

Technical Problem

In CNC machining, traditional methods are difficult to effectively analyze and model timing displacement sequence data, resulting in difficult prediction of processing accuracy and high defect rate.

Method used

The machining accuracy prediction method based on the attention residual twin network is adopted, and the timing displacement data is converted into two-dimensional grayscale image data through segmented aggregation approximation method and Gram angle field processing, and the attention mechanism of the channel attention module and residual module is constructed for training and prediction.

Benefits of technology

It improves the accuracy and intelligence level of CNC machining accuracy prediction, reduces the defective rate, and enhances the ability to explore the value information of CNC machining signal.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116630728B_ABST
    Figure CN116630728B_ABST
Patent Text Reader

Abstract

The present invention provides a processing accuracy prediction method based on an attention residual twin network, comprising the following steps: S1. Collecting time series displacement data, using piecewise aggregation approximation and Gram's angle field to process the time series displacement data, obtaining two-dimensional grayscale image data, and using the obtained grayscale image data as a sample data set; S2. Constructing an attention mechanism residual twin network, and adding a channel attention module and a residual block to the network; S3. Inputting the sample data set into the attention mechanism residual twin network for training; S4. Determining whether the attention mechanism residual twin network has been trained, if so, proceeding to step S5, if not, updating the parameters of the attention mechanism residual twin network learning model, and returning to step S3; S5. Inputting the data to be tested into the trained learning model for prediction and classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of part machining accuracy prediction, and in particular to a machining accuracy prediction method based on an attention residual twin network. Background Art

[0002] CNC machine tools are key equipment for high-precision machining of complex parts and have been widely used in aerospace, mold manufacturing, nuclear power and other fields. At present, people's increasing requirements for machining accuracy have also led to higher requirements for the quality and machining effect of CNC machines themselves. A variety of production data will be generated in CNC machining operations. These data reflect the machining quality of the product to a certain extent. Using efficient and accurate machining accuracy prediction methods to control the machining process and compensate for the errors of CNC machine tools before product testing can effectively improve machining performance and reduce the defective rate of parts in the next machining. Therefore, the research on CNC machining accuracy prediction methods is of great significance.

[0003] The data signal generated in CNC machining is a time series. The time series displacement sequence has the characteristics of large data volume, high dimension, periodicity, trend, etc. With the changes in working scenes, adjustments in machining conditions, and considerations of process indicators, it is becoming increasingly difficult to analyze and model the time series displacement sequence data generated in CNC machining using traditional methods.

[0004] Therefore, in order to solve the above technical problems, it is urgent to propose a new technical means. Summary of the invention

[0005] The present invention provides a processing accuracy prediction method based on an attention residual twin network, comprising the following steps:

[0006] S1. Collect the time series displacement data of the processed parts as a sample data set, reduce the dimension of the time series displacement data using the segmented aggregation approximation method, and then perform Gram angle field processing on the reduced-dimensional time series displacement data to increase the dimension, obtain a two-dimensional matrix of the time dimension and the displacement dimension, and convert the two-dimensional matrix into two-dimensional grayscale image data;

[0007] S2. Construct the residual twin network of the attention mechanism of the channel attention module and the residual module;

[0008] S3. Input the two-dimensional grayscale image data into the attention mechanism residual twin network for training;

[0009] S4. Determine whether the training of the attention mechanism residual twin network is completed. If so, proceed to step S5. If not, update the parameters of the attention mechanism residual twin network learning model and return to step S3.

[0010] S5. Convert the real-time collected time-series displacement data of the parts to be processed into two-dimensional grayscale image data through step S1, input the two-dimensional grayscale image data into the trained attention mechanism residual twin network for prediction and classification, and output the prediction results.

[0011] Further, in step S1, the two-dimensional grayscale image data is obtained by the following method:

[0012] Clean and filter the time series displacement data, and remove noise to obtain periodic time series displacement data;

[0013] The length of the time series displacement data is reduced by using the segmented aggregation approximation method. The segmented aggregation approximation dimensionality reduction process is as follows:

[0014] The time series displacement sequence of length L is divided into n segments on average, the mean of each time series displacement sequence segment is calculated, and the mean is used as the time domain feature value. The aggregated time domain feature value is then used to characterize the time series displacement data of length L. The mean calculation formula is:

[0015]

[0016] in, represents the characteristic value of the mth time-series displacement sequence in the time-series displacement sequence fragment, n represents that the time-series displacement sequence of length L is evenly divided into n segments, x k represents the kth time displacement sequence value in the mth segment;

[0017] The Gram angle field is used to upgrade the dimension of the time series displacement data after dimensionality reduction. The Gram angle field upgrade process is as follows:

[0018] First, the time series displacement data after dimension reduction is normalized. The normalization formula is:

[0019]

[0020] Among them, X represents the time series displacement sequence after dimension reduction, X i represents the value of the i-th time series displacement sequence in the time series displacement sequence after dimensionality reduction, S i represents the value of the i-th normalized time-series shift sequence, i represents the sequence number of the time-series shift sequence, and n represents the length of the time-series shift sequence;

[0021] Then, the normalized time-series displacement sequence is converted into polar coordinates. The polar coordinate conversion formula is:

[0022]

[0023] in, represents the polar angle, i represents the sequence number of the time series displacement, S represents the normalized time series displacement sequence, Si represents the i-th time series displacement sequence after normalization, r represents the polar axis, t represents the time corresponding to the time series displacement sequence S, and n is the number of time series displacement sequence data;

[0024] Finally, calculate the cosine of the sum of the polar angles using the formula:

[0025]

[0026] Among them, G represents a two-dimensional matrix of time dimension and displacement dimension, represents the polar angle corresponding to the i-th normalized time-series displacement sequence, represents the polar angle corresponding to the jth normalized time series displacement sequence, i and j are adjacent time series displacement data;

[0027] The two-dimensional matrix of the time dimension and the displacement dimension is converted into a two-dimensional grayscale image to obtain a two-dimensional grayscale image representing the time-series displacement sequence.

[0028] Furthermore, in step S2, the attention mechanism residual twin network is constructed according to the following method:

[0029] The attention mechanism residual twin network has two backbone extraction networks, both of which are composed of a channel attention module and a residual module. A fully connected layer is connected after the two backbone extraction networks. The channel attention module uses an effective channel attention module, and three residual modules are stacked after the effective channel attention module.

[0030] Further, in step S3, training is performed by the following method:

[0031] S31. The effective channel attention module convolves the input two-dimensional grayscale image and performs feature compression in the spatial dimension of the feature image. When performing feature compression, the number of channels is kept unchanged, and learning is performed in the channel dimension. The importance of each channel is weighted to obtain a feature matrix;

[0032] S32. The residual module performs deep feature extraction on the input feature matrix to obtain two sample feature vectors;

[0033] S33. Convert the two sample feature vectors into one dimension and subtract them to obtain a new vector, input the new vector into the fully connected layer, perform prediction and classification, and output the prediction result.

[0034] Furthermore, in step S3, the attention mechanism residual twin network uses the Contrastive loss function as the loss function:

[0035] Use the Contrastive loss function as the loss function, calculate the gradient of the loss function on the training parameters, perform backpropagation, and use the optimizer to update the weights;

[0036] The contrastive loss function is as follows:

[0037]

[0038] Among them, N represents the number of samples input into the network in pairs, E w Represents the Euclidean distance between the two sample features of the twin neural network. Y represents the label of whether the two samples match. Y=1 means that the two samples are similar or matched, Y=0 means they do not match, and m is the set distance threshold indicating dissimilarity.

[0039] Further, in step S3, the sample data set is input into the attention residual twin network for training, and the learning rate uses the cosine annealing learning rate;

[0040] The cosine annealing formula is as follows:

[0041]

[0042] Among them, η t represents the learning rate, b represents the number of runs, Respectively represent the minimum and maximum values ​​of the learning rate, T cur Indicates the number of epoch executions, T b Indicates the total number of epochs in the b-th run.

[0043] Further, in step S4, when the prediction value obtained by inputting the two-dimensional grayscale image corresponding to the sample data set into the attention residual twin network reaches the preset accuracy requirement, the training of the attention residual twin network is completed.

[0044] Beneficial effects: The present invention discloses a machining accuracy prediction method based on the attention residual twin network, which transforms the CNC machining accuracy prediction problem into an image classification problem, uses deep learning as a powerful tool for extracting features of time-series displacement sequence data, and fully mines the valuable information in CNC machining signals, which will effectively improve the intelligence level and prediction accuracy of the CNC machining accuracy prediction process. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] The present invention will be further described below in conjunction with the accompanying drawings and embodiments:

[0046] Figure 1 is a flow chart of the present invention;

[0047] Figure 2 It is a diagram of the segmented aggregation approximate dimensionality reduction process;

[0048] Figure 3 This is the diagram of the two-dimensionalization process of the Gram angle field time series;

[0049] Figure 4 This is the structure diagram of the residual twin network based on channel attention;

[0050] Figure 5 is the effective channel attention module;

[0051] Figure 6 It is the residual block structure diagram. DETAILED DESCRIPTION

[0052] The present invention is further described below in conjunction with the accompanying drawings:

[0053] The present invention provides a processing accuracy prediction method based on an attention residual twin network, comprising the following steps:

[0054] S1. Collect the time series displacement data of the processed parts as a sample data set, reduce the dimension of the time series displacement data using the segmented aggregation approximation method, and then perform Gram angle field processing on the reduced-dimensional time series displacement data to increase the dimension, obtain a two-dimensional matrix of the time dimension and the displacement dimension, and convert the two-dimensional matrix into two-dimensional grayscale image data;

[0055] S2. Construct the residual twin network of the attention mechanism of the channel attention module and the residual module;

[0056] S3. Input the two-dimensional grayscale image data into the attention mechanism residual twin network for training;

[0057] S4. Determine whether the training of the attention mechanism residual twin network is completed. If so, proceed to step S5. If not, update the parameters of the attention mechanism residual twin network learning model and return to step S3.

[0058] S5. The real-time collected time series displacement data of the parts to be processed is converted into two-dimensional grayscale image data through step S1, and the two-dimensional grayscale image data is input into the trained attention mechanism residual twin network for prediction and classification, and the prediction result is output. Through the above method, deep learning can be used as a powerful tool for feature extraction of time series displacement sequence data, and the valuable information in CNC machining signals can be fully mined, which will effectively improve the intelligence level and prediction accuracy of the CNC machining precision prediction process.

[0059] In this embodiment, in step S1, the time series displacement data is a displacement data with a time sequence, and the displacement data of the CNC machining is collected by the eddy current displacement sensor, and the time series displacement data is cleaned and filtered, and the noise is removed to obtain the time series displacement data with periodicity;

[0060] The length of the time series displacement data is reduced using the segmented aggregation approximation method. The segmented aggregation approximation process is as follows: Figure 2 , segmented aggregation approximate dimensionality reduction is an existing technology, and the segmented aggregation approximate dimensionality reduction process is as follows:

[0061] The time series displacement sequence of a part with a length of L is divided into n segments on average, and the mean is calculated for each segment of the time series displacement sequence. The mean is used as the eigenvalue, and then the n eigenvalues ​​of the entire processing signal are aggregated to characterize the time series displacement sequence with a length of L. The mean calculation formula is:

[0062]

[0063] in, represents the characteristic value of the mth time-series displacement sequence in the time-series displacement sequence fragment, n represents that the time-series displacement sequence of length L is evenly divided into n segments, x k represents the kth time displacement sequence value in the mth segment;

[0064] The Gram angle field is used to upgrade the dimension of the time series displacement data after dimensionality reduction. The Gram angle field upgrade process is as follows: Figure 3 The Gram angular field dimension-upgrading process is an existing technology, and the Gram angular field dimension-upgrading process is as follows:

[0065] First, the time series displacement data after dimension reduction is normalized. The normalization formula is:

[0066]

[0067] Where i represents the sequence number of the time series displacement, X represents the time series displacement sequence after dimensionality reduction, X={X1,X2,X3,……,X n}, X i represents the value of the ith time series displacement sequence in the time series displacement sequence after dimension reduction, S represents the normalized time series displacement sequence, S = {S1, S2, S3, ..., S n},S i represents the value of the i-th normalized time series displacement sequence, and n represents the dimension of the time series displacement sequence, that is, the number of time series displacement sequences

[0068] Then, the normalized time-series displacement sequence is converted into polar coordinates. The polar coordinate conversion formula is:

[0069]

[0070] in, represents the polar angle, i represents the sequence number of the time series displacement, S represents the normalized time series displacement sequence, S irepresents the i-th time series displacement sequence after normalization, r represents the polar axis, t represents the time corresponding to the time series displacement sequence S, and n is the number of time series displacement sequence data;

[0071] Finally, calculate the cosine of the sum of the polar angles using the formula:

[0072]

[0073] Among them, G represents a two-dimensional matrix of time dimension and displacement dimension, represents the polar angle corresponding to the i-th normalized time-series displacement sequence, represents the polar angle corresponding to the jth normalized time series displacement sequence, i and j are adjacent time series displacement data;

[0074] The two-dimensional matrix of the time dimension and the displacement dimension is converted into a two-dimensional grayscale image to obtain a two-dimensional grayscale image representing the time series displacement sequence, wherein the method of converting the two-dimensional matrix into a grayscale image adopts the commonly used existing technology, for example, using matlab for conversion, and the conversion method is not described here. Through the above method, while reducing the data dimension, the original time series displacement sequence information in the data can be maintained, the amount of calculation and the use of storage space can be reduced, and the correlation of the one-dimensional time series displacement sequence can be better retained in the two-dimensional space, and the main features that affect the precision of numerical control machining can be better learned by neural network.

[0075] In this embodiment, in step S2, the attention mechanism residual twin network is constructed according to the following method:

[0076] The attention mechanism residual twin network consists of two backbone extraction networks and a fully connected layer. The specific structure is as follows Figure 4 ,,The backbone extraction network is composed of a channel attention module and a residual module. The channel attention module uses an effective channel attention module. Three residual blocks are stacked after the effective channel attention module to form a residual module. A residual block consists of a residual part and a shortcut branch part. The residual part consists of three convolutional layers. The RELU activation function is used between the three convolutional layers. The number of convolution kernels in the first convolutional layer is a, and the size is 1×1. The first convolutional layer is used to compress the channel dimension. The number of convolution kernels in the second convolutional layer is a, and the size is 3×3. The second convolutional layer is used for feature extraction. The number of convolution kernels in the third convolutional layer is 4a, and the size is 1×1. The third convolutional layer is used to restore the channel dimension. Through the above method, the receptive field can be increased, the overall information of the image can be obtained, the feature extraction ability can be improved, and the learning difficulty of the model can be reduced.

[0077] In this embodiment, in step S3, the attention mechanism residual twin network is trained by the following method:

[0078] S31. The effective channel attention module obtains the aggregated features of the feature map through global average pooling, and then generates channel weights through one-dimensional convolution with a convolution kernel size of k. The one-dimensional convolution is followed by a Sigmoid activation function, and the result is multiplied by the original feature map to assign different weights to each channel to obtain a feature matrix, wherein the convolution kernel size k is determined according to the accuracy of the predicted classification, and the size of the convolution kernel when the classification accuracy is the highest is used as the scale of the convolution kernel of the final effective channel attention module; for example, when the convolution kernel size is 3, the prediction classification accuracy is 95%, and when the convolution kernel size is 7, the prediction classification accuracy is 98%, then the convolution kernel size in the effective channel attention module is 7, and the one-dimensional convolution kernel size used in the effective channel attention module is usually 7;

[0079] S32. The residual module performs deep feature extraction on the input feature matrix to obtain two sample feature vectors;

[0080] S33. Use the flatten function to convert the two sample feature vectors into one dimension, subtract them to obtain a new vector, input the new vector into the fully connected layer for prediction and classification, and output the prediction result;

[0081] The loss function used by the attention mechanism residual twin network is the Contrastive loss function. The Contrastiveloss function formula is as follows:

[0082]

[0083] Among them, N represents the number of samples input into the network in pairs, E w Represents the Euclidean distance between two one-dimensional sample features of the twin neural network. Y represents the label of whether the two samples match. Y=1 represents that the two samples are similar or matched, and Y=0 represents mismatch. m is the set distance threshold indicating dissimilarity. The value of m is adjusted according to the specific task and takes the optimal value suitable for the task goal. The value of m can be determined by cross-validation and other technologies. In actual use, a larger threshold can be selected first, and then adjusted according to the performance of the model on the validation set to obtain the best performance.

[0084] The attention residual Siamese network uses cosine annealing as the learning rate;

[0085] The cosine annealing formula is as follows:

[0086]

[0087] Among them, η t represents the learning rate, b represents the number of runs, Respectively represent the minimum and maximum values ​​of the learning rate, T curIndicates the number of epoch executions, T b Represents the total number of epochs in the b-th run. Through the above method, accurate prediction can be made through the attention residual twin network.

[0088] In this embodiment, in step S4, when the prediction result obtained by inputting the two-dimensional grayscale image corresponding to the sample data set into the attention residual twin network reaches the preset accuracy requirement, the attention residual twin network training is completed, and the preset accuracy requirement is set according to the pass rate requirement.

[0089] In this embodiment, in step S5, the data to be tested is input into the trained attention residual twin network, and the two feature vectors obtained after the effective channel attention module and the residual module are one-dimensionalized and subtracted to obtain a new vector, and the new vector is input into the fully connected layer to obtain the qualified classification result. Through the above method, the problem of NC machining accuracy prediction can be transformed into an image classification problem, and deep learning can be used as a powerful tool for feature extraction of time series displacement sequence data to fully explore the value information in NC machining signals, which will effectively improve the intelligence level and prediction accuracy of the NC machining accuracy prediction process.

[0090] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution of the present invention, which should be included in the scope of the claims of the present invention.

Claims

1. A processing accuracy prediction method based on an attention residual twin network, characterized by: The following steps are involved: S1. Collect the time series displacement data of the processed parts as a sample data set, reduce the dimension of the time series displacement data using the segmented aggregation approximation method, and then perform Gram angle field processing on the reduced-dimensional time series displacement data to increase the dimension, obtain a two-dimensional matrix of the time dimension and the displacement dimension, and convert the two-dimensional matrix into two-dimensional grayscale image data; S2. Construct the residual twin network of the attention mechanism of the channel attention module and the residual module; S3. Input the two-dimensional grayscale image data into the attention mechanism residual twin network for training; S4. Determine whether the training of the attention mechanism residual twin network is completed. If so, proceed to step S5. If not, update the parameters of the attention mechanism residual twin network learning model and return to step S3. S5. Convert the real-time collected time-series displacement data of the part to be processed into two-dimensional grayscale image data through step S1, input the two-dimensional grayscale image data into the trained attention mechanism residual twin network for prediction and classification, and output the prediction result; In step S2, the attention mechanism residual twin network is constructed according to the following method: The attention mechanism residual twin network has two trunk extraction networks, both of which are composed of a channel attention module and a residual module. A fully connected layer is connected after the two trunk extraction networks. The channel attention module uses an effective channel attention module, and three residual modules are stacked after the effective channel attention module. In step S3, training is performed by the following method: S31. The effective channel attention module convolves the input two-dimensional grayscale image and performs feature compression in the spatial dimension of the feature image. When performing feature compression, the number of channels is kept unchanged, and learning is performed in the channel dimension. The importance of each channel is weighted to obtain a feature matrix; S32. The residual module performs deep feature extraction on the input feature matrix to obtain two sample feature vectors; S33. Convert the two sample feature vectors into one dimension and subtract them to obtain a new vector, input the new vector into the fully connected layer, perform prediction and classification, and output the prediction result.

2. The processing accuracy prediction method based on the attention residual twin network according to claim 1 is characterized in that: In step S1, two-dimensional grayscale image data is obtained by the following method: Clean and filter the time series displacement data, and remove noise to obtain periodic time series displacement data; The length of the time series displacement data is reduced by using the segmented aggregation approximation method. The segmented aggregation approximation dimensionality reduction process is as follows: The time series displacement sequence of length L is divided into n segments on average, the mean of each time series displacement sequence segment is calculated, and the mean is used as the time domain feature value. The aggregated time domain feature value is then used to characterize the time series displacement data of length L. The mean calculation formula is: in, represents the characteristic value of the mth time-series displacement sequence in the time-series displacement sequence fragment, n represents that the time-series displacement sequence of length L is evenly divided into n segments, x k represents the kth time displacement sequence value in the mth segment; The Gram angle field is used to upgrade the dimension of the time series displacement data after dimensionality reduction. The Gram angle field upgrade process is as follows: First, the time series displacement data after dimension reduction is normalized. The normalization formula is: Among them, X represents the time series displacement sequence after dimension reduction, X i represents the value of the i-th time series displacement sequence in the time series displacement sequence after dimensionality reduction, S i represents the value of the i-th normalized time-series shift sequence, i represents the sequence number of the time-series shift sequence, and n represents the length of the time-series shift sequence; Then, the normalized time displacement sequence is converted into polar coordinate form. The polar coordinate conversion formula is: in, represents the polar angle, i represents the sequence number of the time series displacement, S represents the normalized time series displacement sequence, S i represents the i-th time series displacement sequence after normalization, r represents the polar axis, t represents the time corresponding to the time series displacement sequence S, and n is the number of time series displacement sequence data; Finally, calculate the cosine of the sum of the polar angles using the formula: Among them, G represents a two-dimensional matrix of time dimension and displacement dimension, represents the polar angle corresponding to the i-th normalized time-series displacement sequence, represents the polar angle corresponding to the jth normalized time series displacement sequence, i and j are adjacent time series displacement data; The two-dimensional matrix of the time dimension and the displacement dimension is converted into a two-dimensional grayscale image to obtain a two-dimensional grayscale image representing the time-series displacement sequence.

3. The processing accuracy prediction method based on the attention residual twin network according to claim 1 is characterized in that: In step S3, the attention mechanism residual twin network uses the Contrastive loss function as the loss function: Use Contrastiveloss as the loss function, calculate the gradient of the loss function on the training parameters, perform backpropagation, and use the optimizer to update the weights; The contrastive loss function is as follows: Among them, N represents the number of samples input into the network in pairs, E w Represents the Euclidean distance between the two sample features of the twin neural network. Y represents the label of whether the two samples match. Y=1 means that the two samples are similar or matched, Y=0 means they do not match, and m is the set distance threshold indicating dissimilarity.

4. The processing accuracy prediction method based on the attention residual twin network according to claim 1 is characterized in that: In step S3, the sample data set is input into the attention residual twin network for training, and the learning rate uses the cosine annealing learning rate; The cosine annealing formula is as follows: Among them, η t represents the learning rate, b represents the number of runs, Respectively represent the minimum and maximum values ​​of the learning rate, T cur Indicates the number of epoch executions, T b Indicates the total number of epochs in the b-th run.

5. The processing accuracy prediction method based on the attention residual twin network according to claim 1 is characterized in that: In step S4, when the prediction value obtained by inputting the two-dimensional grayscale image corresponding to the sample data set into the attention residual twin network reaches the preset accuracy requirement, the training of the attention residual twin network is completed.