Attention and transfer learning-based method for predicting part machining surface roughness
By applying a method based on attention mechanism and transfer learning on CNC machine tools, combined with particle filtering algorithm, the problems of poor robustness and reduced performance in the existing technology are solved, and high-quality prediction of the surface roughness of CNC machine tools processing parts is achieved.
Patent Information
- Application Number
- PCT/CN2023/139760
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-09-06
- Filing Date
- 2023-12-19
- Publication Date
- 2025-03-13
AI Technical Summary
The prior art has problems such as low efficiency, poor robustness and reduced performance of predictive model over time when predicting the surface roughness of CNC machine parts.
Using an attention mechanism and transfer learning method, the fusion of multivariate signal characteristics and the transfer model are achieved by collecting key physical signals, constructing signal feature matrix, training prediction models and performing transfer learning, and combining the computer bed degradation trend of particle filtering algorithms, the fusion of multivariate signal characteristics and the transfer of prediction models are achieved.
It improves the robustness and accuracy of the prediction model, and is suitable for CNC machining surface roughness prediction of parts under long spans, improving processing quality and production efficiency.
Smart Images

Figure CN2023139760_13032025_PF_FP_ABST
Abstract
Description
Parts machining surface roughness prediction method based on attention and transfer learning
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on September 6, 2023, with application number 202311144250.8 and invention name “Parts machining surface roughness prediction method based on attention and transfer learning”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present invention relates to a method for predicting the surface roughness of parts during CNC machining, and in particular to a method for predicting the surface roughness of parts during CNC machining based on an attention mechanism and transfer learning. Background Art
[0003] CNC machining significantly impacts part assembly precision, fatigue strength, and corrosion resistance. Therefore, machine tool accuracy is a crucial metric for evaluating machine tool performance. Traditionally, offline surface roughness measurement has been required to ensure machining quality. However, these offline methods suffer from low efficiency and high measurement costs, leading to reduced machining efficiency. Therefore, methods for predicting CNC machining accuracy are crucial for improving both machining quality and production efficiency.
[0004] Roughness prediction methods primarily include those based on traditional data regression and those using artificial intelligence (AI). While traditional data regression-based machining accuracy prediction methods can generate explicit machining accuracy prediction models, they require re-establishing the regression equation when experimental conditions change. Consequently, these models lack robustness and are not universally applicable to grinding machine machining accuracy prediction. Some AI-based roughness prediction methods fail to consider the time-varying characteristics of the input signal, resulting in poor robustness.
[0005] Currently, some neural network models, based on the signal characteristics of multi-source input data, directly output the predicted type through a fully connected layer after processing such as convolution operations. However, due to the large dimensionality of sensor data signals, different signal types have different capabilities in representing features, resulting in a lack of analysis and fusion of signal characteristics. Furthermore, over the long service life of CNC machine tools, wear and aging of various components affect machining, reducing the accuracy of the precision prediction model. Consequently, the performance of the network prediction models developed in most research studies degrades over time.
[0006] Summary of the Invention
[0007] To address the issues presented in the prior art, this paper proposes a method for predicting surface roughness during CNC machining of parts based on an attention mechanism and transfer learning. This method overcomes the shortcomings of the aforementioned existing methods, enabling a prediction model to learn and integrate the signal features of multiple CNC machining parts. It also addresses the performance degradation of neural network prediction models over long timescales.
[0008] To achieve the above object, the technical solution of the present invention is as follows:
[0009] S1: Collect key physical signals that affect the evolution of surface roughness of CNC machine tool parts;
[0010] S2: After preprocessing and feature extraction of each key physical signal, the corresponding features are obtained, and the corresponding signal feature matrix is constructed according to the features corresponding to each key physical signal;
[0011] S3: Input each signal feature matrix into the machined surface roughness prediction model for training to obtain a trained machined surface roughness prediction model;
[0012] S4: Based on the measured degradation data of CNC machine tools, a single-exponential degradation model for machine tools is constructed. The degradation trend of the current CNC machine tools is determined using the single-exponential degradation model. In different degradation stages of the degradation trend, the network model of the trained surface roughness prediction model is migrated using a migration method based on the key physical signals of each degradation stage, thereby obtaining surface roughness prediction models for different degradation stages.
[0013] S5: Determine the degradation stage of the current CNC machine tool according to the machine tool single index degradation model, select the machining surface roughness prediction model of the current degradation stage, and then obtain the corresponding surface roughness prediction result.
[0014] In S2, the characteristics corresponding to each key physical signal include time domain signal characteristics and frequency domain signal characteristics.
[0015] The machined surface roughness prediction model includes a convolutional layer, a memory network layer, a random inactivation layer, a fully connected layer, a subpath random dropout block, an improved SE Context Gating attention mechanism block and a classification module;
[0016] Each signal feature matrix is input into the corresponding convolutional layer. The output of each convolutional layer is input into the classification module after passing through the corresponding first fully connected layer and subpath random dropout block. The output of all convolutional layers is input into the random dropout layer after passing through the corresponding memory network layer. The random dropout layer is connected to the improved SE Context Gating attention mechanism block through the second fully connected layer. The improved SE Context Gating attention mechanism block is connected to the classification module. The classification module outputs the prediction result of the machined surface roughness.
[0017] The improved SE Context Gating attention mechanism block includes a third fully connected layer and an activation layer. The input of the improved SE Context Gating attention mechanism block is used as the input of the third fully connected layer. The third fully connected layer is connected to the activation layer. The output of the activation layer is fused with the input of the improved SE Context Gating attention mechanism block, and the fused features are used as the output of the improved SE Context Gating attention mechanism block.
[0018] In S4, the formula of the machine tool single exponential degradation model is as follows: Y(t)=m t ·exp(n t ,t)+ε t
[0019] Where Y(t) is the degradation performance of the machine tool at time t, m t is the initial performance level of the machine tool at time t, n t represents the degradation rate of the machine tool at time t, ε t is Gaussian white noise.
[0020] In S4, based on the actual degradation data of the current CNC machine tool, the single exponential degradation observation equation is updated using the Monte Carlo particle filter method to obtain a single exponential degradation model of the machine tool.
[0021] The present invention uses a method for predicting the surface roughness of CNC machining parts based on the attention mechanism and transfer learning to perform convolution compression and time series feature extraction on CNC machining signals of parts; adopts the attention mechanism to learn and fuse multiple signal features; adopts an exponential degradation model to construct a state equation, and calculates the degradation trend of the tool machine through a particle filter algorithm; adopts a transfer learning method to improve the prediction performance of the prediction model, and achieves high-quality prediction of the surface roughness of CNC machining parts.
[0022] Compared with existing technologies and methods, the present invention has the following beneficial effects:
[0023] This paper incorporates the SE Context Gating mechanism into model training, feeding the concatenated features into SE Context Gating to obtain a fusion result of multiple features. By summing the fused features with the original features, it ensures that the original information of the original features is preserved and that the fused information of the original features contributes to the prediction results, allowing the model to learn more feature information.
[0024] The present invention further fuses the fused features with multiple input signal features and uses DropPath to randomly discard some samples in each batch size that is integrated into the network each time, thereby improving the robustness of the model.
[0025] The present invention calculates the degradation trend of machine tools through a particle filtering algorithm and improves the accuracy of the constructed neural network prediction model based on a transfer learning method of network layer freezing, making the prediction model applicable to machine tool processing accuracy prediction in various situations and solving the problem of neural network prediction performance degradation of machine tools after long-term service.
[0026] In summary, the present invention achieves multi-signal feature fusion and prediction model migration applicable to CNC machine tools, thereby realizing the prediction of surface roughness of CNC machined parts.
[0027] Figures in the specification
[0028] FIG1 is a schematic flow diagram of the method of the present invention.
[0029] FIG2 is a schematic diagram of the prediction model structure during the implementation of the method of the present invention.
[0030] FIG3 is a schematic diagram of the improved attention mechanism structure during the implementation of the method of the present invention.
[0031] FIG4 is a schematic diagram of a flow chart of particle filtering for solving degradation trend in the implementation of the present invention.
[0032] FIG5 is a schematic diagram of the transfer learning process during the implementation of the present invention. DETAILED DESCRIPTION
[0033] The present invention will be further described below with reference to the accompanying drawings and specific examples:
[0034] The embodiment of the present invention takes a surface forming grinder as an example for explanation, as shown in FIG1 , and specifically includes the following steps:
[0035] S1: Collect key physical signals that affect the evolution of surface roughness of CNC machine tool parts. Key physical signals include temperature signals and vibration signals during the machining process.
[0036] In this embodiment, the surface roughness evolution characteristics of parts processed by CNC machining are analyzed. With the help of OPC UA (Open Production Control and Unified Architecture) protocol and various sensors, an experimental environment platform is built in the actual factory production and manufacturing workshop based on the existing CNC machine tools, and the temperature signal, vibration signal, and motor power signal during the machining process are collected respectively. Tool wear is one of the important factors in the machine tool machining process, which will directly affect the roughness of the machined surface. When the tool is worn, the cutting force increases, resulting in changes in the motor power. The vibration at the grinding head includes grinding wheel vibration and motor vibration. Since the workpiece is fixed to the workpiece table by a fixture during machining, the vibration characteristics of the table also affect the machining accuracy of the parts. Temperature sensors are arranged on the outside of the front and rear bearings of the spindle, and the machine tool operating environment temperature and coolant temperature need to be measured. During the machining process, the deformation and displacement of the workpiece table will also affect the grinding results, and the vibration signal of the workpiece table is mainly collected.
[0037] S2: After preprocessing and feature extraction for each key physical signal, corresponding features are obtained. A corresponding signal feature matrix is constructed based on the features corresponding to each key physical signal and used as input to the prediction model. A signal feature matrix is obtained for each key physical signal category. Due to environmental factors and other issues, the collected raw data may contain noise, missing data, and data redundancy. Therefore, in this embodiment, a series of operations such as denoising, deduplication, and data padding are performed on the collected signal data. The distribution of the collected surface roughness data shows that samples with a roughness below 0.5 μm account for the majority, while samples with a roughness greater than 0.5 μm are relatively rare. Since most machining accuracy values are continuous and unique, directly predicting machining accuracy numerically is unrealistic. Therefore, the present invention discretizes the machining accuracy samples, transforming the machining accuracy prediction problem into an accuracy interval prediction problem. 0.1 μm is used as the discretization interval, and samples with a roughness greater than 0.5 μm are grouped together. Relevant time-domain and frequency-domain signal features are extracted, and a signal feature matrix is constructed as input to the prediction model.
[0038] Principal component analysis was used to screen features, removing signal features with strong correlation and low discrimination. Finally, the 18 signal features with the highest contribution rate were selected to form the feature matrix. A total of 1,000 sets of preprocessed sample data were collected, including 900 training sets and 100 test sets.
[0039] In S2, the characteristics corresponding to each key physical signal include time domain signal characteristics and frequency domain signal characteristics.
[0040] S3: Input each signal feature matrix into the machining surface roughness prediction model for training to obtain a trained machining surface roughness prediction model; since the scales of each signal data are different, the data is normalized in this embodiment to achieve the effect of accelerated training; the normalized current signal, temperature signal and vibration signal are input into the convolutional network model.
[0041] As shown in Figure 2, the surface roughness prediction model includes a convolutional layer, a memory network layer, a random dropout layer, a fully connected layer, a subpath random dropout block, an improved SE Context Gating attention mechanism block, and a classification module. The fully connected layer includes the first fully connected layer and the second fully connected layer.
[0042] Each signal feature matrix is input into the corresponding convolutional layer. The output of each convolutional layer passes through the corresponding first fully connected layer and subpath random dropout block before being input into the classification module. The output of all convolutional layers passes through the corresponding memory network layer and is input into the random dropout layer. The random dropout layer is connected to the improved SE Context Gating attention mechanism block through the second fully connected layer. The improved SE Context Gating attention mechanism block is connected to the classification module, which outputs the surface roughness prediction result. The convolutional layer is used to compress the signal feature matrix. To reduce signal information loss, pooling is not performed during the convolution process of the convolutional layer, only data compression is achieved. The long short-term memory network layer is used for preliminary feature extraction, and the random dropout layer is used to randomly drop some features to avoid overfitting caused by too many neurons. The subpath random dropout block is used to simulate the loss of some modalities, making the model more robust. The improved SE Context Gating attention mechanism block is used to suppress the activation of signal features with low contribution rates and perform feature fusion on the fused features again. Based on the SE structure of the attention mechanism, the present invention removes the first fully connected layer, that is, directly uses a fully connected layer to process the feature vector X in the attention channel. Assuming that the number of input signal channels is c, the sigmoid layer is used to obtain a 1×1×c feature vector, which retains more signal features while reducing the number of module parameters by c. 2 / r increases to c. The classification module is a SoftMax normalization layer, which is used to output the prediction results of the machined surface roughness. The distribution of the surface roughness prediction results in each probability interval is obtained through the fully connected layer. The final model prediction accuracy is 84%.
[0043] As shown in Figure 3, the improved SE Context Gating attention mechanism block includes a third fully connected layer and an activation layer. The input of the improved SE Context Gating attention mechanism block serves as the input of the third fully connected layer, which is connected to the activation layer. The output of the activation layer is fused with the input of the improved SE Context Gating attention mechanism block to form the fused features that serve as the output of the improved SE Context Gating attention mechanism block. In Figure 3, B (Batchsize) represents the number of samples per group, F represents the feature dimension, and r represents the compression ratio of the improved SE Context Gating attention mechanism block.
[0044] As a grinder ages, the established precision prediction model begins to degrade. Comparing the model's predictions with those of an experimental grinder after extended service reveals that the accuracy of the model is only about 40% after a significant time span from initial training. This indicates that grinder performance degrades over extended periods.
[0045] S4: Based on the measured degradation data of CNC machine tools (this data is part of the existing degradation data for current CNC machine tools), a single exponential degradation model for machine tools is constructed. This model is used to fit nonlinear, non-Gaussian machine tool degradation systems, ensuring that they conform to and track the degradation trend of the current CNC machine tools. The single exponential degradation model is used to determine the degradation trend of the current CNC machine tools and determine the timing for transfer learning. At different degradation stages of the degradation trend, the trained surface roughness prediction model is transferred using a network layer-by-layer frozen training migration method based on the key physical signals of each degradation stage, thereby obtaining surface roughness prediction models for different degradation stages. This addresses the performance degradation of machine tools after long-term service and improves the accuracy of the constructed neural network prediction model. Specifically, as shown in Figure 5, during the network layer-by-layer frozen migration process, a transfer learning rate needs to be set for each layer. Considering the multi-layer structure of the network model, the shallower the network knowledge, the more random it is, and the higher the retraining requirements. Therefore, as the number of network layers increases, the learning rate set for transfer learning decreases. The SGD optimization algorithm is used to update the parameters of transfer training; some network layers are frozen, that is, the network parameters of the corresponding layers are directly transferred, and the unfrozen network layers are trained using data after the performance degradation of the machine tool, and the deeper the network layer, the lower the learning rate set during the corresponding transfer learning. For example, the convolution layer and the memory layer are frozen, the learning rate of the convolution layer is set, the convolution layer is re-convolutionalized, and then the memory layer and the SCG fully connected layer are frozen and retrained in turn. The SGD optimization algorithm is used to update the parameters of transfer training. In this embodiment, freeze training is performed for different network layers, and the learning rate change base is set to 10 times, where the learning rate of the convolution layer is 0.005, the learning rate of the memory network layer is 0.05, and the learning rate of the attention mechanism layer is 0.5. The final migration model prediction result accuracy is 76.8%, and the average offset distance is about 0.26.
[0046] In S4, the formula of the machine tool single exponential degradation model is as follows: Y(t) = m t ·exp(n t ,t)+ε t
[0047] Where Y(t) is the degradation performance of the machine tool at time t, m t is the initial performance level of the machine tool at time t, n t represents the degradation rate of the machine tool at time t, ε t is Gaussian white noise, The mean is 0 and the variance is The observation equation parameters are regarded as the system state reflecting the current degradation trend.
[0048] In S4, based on the measured degradation data of the current CNC machine tool, as shown in Figure 4, the Monte Carlo particle filter method is used to update the single exponential degradation observation equation to obtain the single exponential degradation model of the machine tool, so that the single exponential degradation model can conform to and track the degradation trend of the current CNC machine tool.
[0049] S5: Determine the degradation stage of the current CNC machine tool according to the machine tool single index degradation model, select the machining surface roughness prediction model of the current degradation stage, and then obtain the corresponding surface roughness prediction result.
[0050] This embodiment selects vibration characteristics, temperature signal characteristics and current signal characteristics as characteristic signals that affect the formation of surface roughness based on the main physical factors affecting the roughness of the grinding process. Through the multi-factor sensor data acquisition method, the data information of the grinding process is collected and the data is pre-processed. The SE Context Gating attention mechanism is integrated into the model training and the mechanism is improved. The three original features extracted by the neural network are spliced in the dimension direction, and the spliced features are sent to the SE Context Gating attention mechanism to obtain the fusion result of the three features. By adding the fused features and the original features, it can be ensured that the original information of the original features is retained and that the information after the fusion of the original features is helpful for the prediction results. Through the fusion of multiple features, the model has the ability to learn the features of the three modal signals separately and fusedly, so that the model learns more feature information. In response to the problem of the degradation of the neural network prediction performance of the grinding machine after long-term service, the accuracy of the constructed neural network prediction model is improved by the transfer learning method of network layer freezing. Compared with existing methods, the machining accuracy prediction model of the present invention can learn and fuse multiple signal features, while preventing the prediction model from overfitting. It is suitable for result prediction over a long time span and provides a neural network model for part CNC machining accuracy prediction.
[0051] Finally, it should be noted that the above embodiments and explanations are intended only to illustrate the technical solutions of the present invention and are not intended to limit the present invention. It should be understood by those skilled in the art that modifications or equivalent substitutions to the technical solutions of the present invention may be made without departing from the spirit and scope of the technical solutions disclosed herein, and all such modifications or equivalent substitutions shall be encompassed within the scope of protection of the claims of the present invention.
Claims
1. A method for predicting surface roughness of parts processing based on attention and transfer learning, characterized in that: The following steps are involved: S1: Collect key physical signals that affect the evolution of surface roughness of CNC machine tool parts; S2: After preprocessing and feature extraction of each key physical signal, the corresponding features are obtained, and the corresponding signal feature matrix is constructed according to the features corresponding to each key physical signal; S3: inputting each signal feature matrix into a machined surface roughness prediction model for training to obtain a trained machined surface roughness prediction model; S4: A single exponential degradation model of the machine tool is constructed based on the measured degradation data of the CNC machine tool. The degradation trend of the current CNC machine tool is determined using the single exponential degradation model of the machine tool. In different degradation stages of the degradation trend, the network model of the trained surface roughness prediction model is migrated using the migration method according to the key physical signals of each degradation stage, so as to obtain the surface roughness prediction models of different degradation stages. S5: Determine the degradation stage of the current CNC machine tool according to the machine tool single exponential degradation model, select the machining surface roughness prediction model of the current degradation stage, and then obtain the corresponding surface roughness prediction result.
2. According to claim 1, a method for predicting surface roughness of parts processing based on attention and transfer learning is characterized in that: In S2, the characteristics corresponding to each key physical signal include time domain signal characteristics and frequency domain signal characteristics.
3. The method for predicting surface roughness of parts processing based on attention and transfer learning according to claim 1 is characterized in that: The machining surface roughness prediction model includes a convolution layer, a memory network layer, a random inactivation layer, a fully connected layer, a subpath random discarding block, an improved SE Context Gating attention mechanism block and a classification module; Each signal feature matrix is input into the corresponding convolution layer, and the output of each convolution layer is passed through the corresponding The first fully connected layer and the subpath random discard block are input into the classification module. The outputs of all convolutional layers are input into the random dropout layer after passing through the corresponding memory network layer. The random dropout layer is connected to the improved SE Context Gating attention mechanism block through the second fully connected layer. The improved SE Context Gating attention mechanism block is connected to the classification module, and the classification module outputs the prediction result of the machined surface roughness.
4. The method for predicting surface roughness of parts processing based on attention and transfer learning according to claim 1 is characterized in that: The improved SE Context Gating attention mechanism block includes a third fully connected layer and an activation layer. The input of the improved SE Context Gating attention mechanism block is used as the input of the third fully connected layer. The third fully connected layer is connected to the activation layer. The output of the activation layer is fused with the input of the improved SE Context Gating attention mechanism block to obtain the fused features as the output of the improved SE Context Gating attention mechanism block.
5. The method for predicting surface roughness of parts processing based on attention and transfer learning according to claim 1, characterized in that: In S4, the formula of the machine tool single exponential degradation model is as follows: Y(t)=m t ·exp(n t ,t)+ε t Where Y(t) is the degradation performance of the machine tool at time t, m t is the initial performance level of the machine tool at time t, n t represents the degradation rate of the machine tool at time t, ε t is Gaussian white noise.
6. The method for predicting surface roughness of parts processing based on attention and transfer learning according to claim 1, characterized in that: In S4, based on the actual measured degradation data of the current CNC machine tool, the single exponential degradation observation equation is updated by using the Monte Carlo particle filter method to obtain a single exponential degradation model of the machine tool.
Citation Information
Patent Citations
Surface roughness prediction method based on improved LSTM network
CN112069966A
Bearing cross-working-condition fault prediction method based on adversarial transfer learning
CN114722879A
Numerical control machining surface roughness prediction method and device
CN114897028A
Method and device for predicting residual service life of equipment
CN115659808A
Strip steel surface roughness detection method based on multi-feature fusion
CN115841468A
Cited By
Roughness optimization method for additive manufacturing flow channel of aerospace propulsion chamber
CN120406174A
A roughness optimization method for flow channel in additive manufacturing of aerospace propulsion chamber
CN120406174B