Transfer Learning Based Surface Roughness Prediction Integrating Tool Wear Under Variable Cutting Parameters

: The monitoring of surface quality in machining is of great practical significance for the reliability and life of high-value products such as rocket, spacecraft and aircraft, particularly for their assembly interfaces of these products. Surface roughness is an important metric to evaluate the surface quality. The current research of online surface roughness prediction has the following limitations. The effect of the varying tool wear on the surface roughness is rarely considered in machining. In addition, the deteriorating trend of surface roughness and tool wear is different under variable cutting parameters. Prediction models trained under one set of cutting parameters fail when cutting parameters change. This paper proposes a surface roughness prediction method considering the varying tool wear under variable cutting parameters. A stacked autoencoder and long short-term memory network (SAE-LSTM) is designed as the basic surface roughness prediction model that uses tool wear conditions and sensor signals as the input. The transfer learning strategy is applied on SAE-LSTM such that the surface roughness online prediction under variable cutting parameters can be realized. Machining experiments for the assembly interface (Ti6Al4V material) of the aircraft’s vertical tail are conducted and the monitoring data are used to validate the proposed method. Ablations studies are carried out to evaluate the key modules of the proposed model. The experimental results show that the proposed method outperforms other models and well track the true surface roughness over time.


Introduction
The surface quality has an important impact on the reliability and life of high-value products [1][2][3] such as rocket, spacecraft and aircraft, particularly for their assembly interfaces of these products since the surface quality of the assembly interface directly affects the final quality of the product. For example, the assembly interface of an aircraft connects adjacent large-scale aircraft components, e.g., wings, tails, and fuselages. The assembly interface is normally difficult-to-machine material and easy to causing tool wear, resulting in deterioration of surface quality [4]. Therefore, ensuring the surface quality of the assembly interface is of vital importance for the final quality of the aircraft. Surface integrity is regarded as a key factor in evaluating surface qualities. The typical surface integrity characteristics include surface topography (surface defects and surface roughness), microstructural alterations (plastic deformation, grain sizes, and white layer), and mechanical properties (microhardness and residual stress). Among these, surface roughness is regarded as the most typical and important parameter for evaluating surface integrity and the machining quality of products [5,6] since it has a significant influence on assembly accuracy, fatigue strength, corrosion resistance and contact stiffness of parts [7,8]. Therefore, it is essential to monitor the surface roughness during machining.
The surface roughness is typically monitored in an offline or online way. The offline way is based on contact measurement equipment, having the limitations of lengthy measurement time, additional requirements of a specific environment, and complexity of setup [9]. In contrast, the online methods avoid these shortcomings and attract increasing research [10][11][12]. Online methods aim to establish a mapping model (prediction model) between the surface roughness and online monitored data such as cutting parameters and sensor signals [13].
For online monitoring, the following shortcomings exists in current research. In practical machining, the surface roughness is varying. For example, as the tool wears, the contact angle between the tool and the workpiece changes, which causes the surface roughness of the workpiece to deteriorate [14]. However, the effect of tool wear on surface roughness has rarely been considered in current research [15,16]. In addition, the deteriorating trend of surface roughness and tool wear is different under variable cutting parameters. A prediction model trained with the monitoring data collected under one group of cutting parameters will fail to accurately predict the roughness when cutting parameter changes, while it is unrealistic to train prediction models spanning all possible cutting parameters. Therefore, integrating tool wear under variable cutting parameters is necessary for developing a surface roughness prediction model for practical use. It should be pointed out that our previous work [17] introduced the method and process of tool condition monitoring in detail. This paper focuses on the surface roughness prediction method. The construction and training of the surface roughness prediction model and the prediction process integrating tool wear will be described in detail. 1  Based on the above motivation, this paper presents a surface roughness prediction method integrating tool wear under variable cutting parameters. Transfer learning strategy is applied to tolerate different cutting parameters. The remainder of the paper is organized as follows. Section 2 reviews related works. In section 3, the framework of surface roughness prediction is firstly proposed.
Subsequently, the structure of the surface roughness prediction model, as well as its training strategy based on transfer learning, and the integration of tool wear prediction into the surface roughness prediction, are detailed. The experimental settings, the performance of the proposed method under variable cutting parameters are presented in Section 4. The conclusion and future work are given in Section 5.

Related Works
According to whether the surface roughness is directly measured or not, the surface roughness monitoring methods can be divided into indirect sensor-based and direct sensor-based.

Surface roughness prediction with indirect sensors
This class of methods attempts to establish a mapping between the surface roughness and the indirect sensor signals (such as vibration, cutting force, current, acoustic, etc.) monitored during the machining process. Commonly used prediction methods include the polynomial regression models and artificial intelligence models.

2.1.1Polynomial regression model
Wang et al. established a polynomial regression model for surface roughness prediction considering the factors of tool geometry and cutting force for Ti6A14V. The model has high applicability and accuracy for the prediction of milling surface roughness [18].
However, it only considers the combination of several groups of discrete cutting parameters and does not take into account the prediction of surface roughness at different times in machining. Using sensor data can reflect the surface roughness changes caused by time-varying factors in machining. Some researchers considered the cutting force, vibration, and cutting energy consumption to realize the surface roughness prediction during the cutting process through polynomial regression analysis [19][20][21]. In the turning process of Inconel 718, Deshpande used the polynomial regression analysis method to combine cutting parameters data and cutting force, vibration, etc. multi-sensor data in the cutting process to predict surface roughness [22].
The above-mentioned research adopts regression models to accurately reflect the surface roughness trend under certain conditions, and its applicability is relatively high. However, they only consider the sensor data during cutting and do not take into account the time-varying factors that machining equipment accuracy degradation during the machining process such as tool wear.

2.1.2Artificial intelligence model
The following researches on surface roughness prediction are based on the information of a single sensor. Guo and Wu took the specified time-frequency domain features of the vibration signal of the cutting process as input and used the long short-term memory network (LSTM), convolutional neural network (CNN), and other neural network technologies to predict surface roughness [23,24]. Huang proposed an online modeling and surface roughness monitoring system based on gray theory and bilateral bestfitting method by monitoring the cutting force signal in the cutting process [25]. Gerardo used a combination of incremental modeling and simulated annealing to model cutting forces and cutting parameters to predict surface roughness in milling machining [26]. In addition, particle swarm optimization-support vector machine (PSO-SVM) [27], differential evolution algorithm (DE) [28], singular spectrum analysis, and related principal component analysis (G-SSA) [29] are also used to predict the surface roughness based on the vibration signals in the cutting process.
The following researches on surface roughness prediction are based on the information of multi-sensor. Sun et al, designed a surface roughness prediction model that includes an embedded neural network and an output neural network, which can predict surface roughness more accurately than a single neural network [30]. Kumar considered the cutting parameters and sensor signals as control variables and predicted the surface roughness by response surface methodology (RSM) and artificial neural network (ANN) respectively. The results showed that the prediction accuracy of adding sensor signals is better than that of only considering cutting parameters [31].
The above-mentioned research on surface roughness prediction based on sensor data and intelligent algorithms all realized online prediction. The factors of varying tool wear and variable cutting parameters directly influence the prediction of surface roughness. However, the current research is rarely considered.

Surface roughness prediction with direct sensors
The surface roughness prediction method with the direct sensor is to predict the surface roughness through the visual image of the machined surface.
The research method mainly includes predicting the surface roughness according to the reconstructed surface topography or predicting the surface roughness according to the image feature of the machined surface. Liu proposed a new surface roughness measurement method based on a color distribution statistical matrix (CDSM) [32]. Prabhakar proposed a hybrid transform method that combines Fast Fourier Transform (FFT), Discrete Wavelet Transform (DWT), and Discrete Shearlet Transform (DST) to achieve the purpose of surface roughness prediction [33]. Tootooni used the algebraic graph theory image processing method to convert surface images into unweighted undirected network graphs and used estimated graph theory invariant Fiedler number (λ2) as a discriminator of surface roughness [34]. Chiou proposed a surface texture model based on visual data for real-time remote automatic detection of surface quality [35]. Jeyapoovan used CCD cameras and multi-color light sources to obtain images of machined surfaces with different surface roughness values [36]. Shahabi proposed a method of surface roughness measurement using the 2-D profile extracted from an edge image of the workpiece surface [37].
Surface roughness prediction with direct sensors can directly obtain surface roughness through workpiece surface images.
However, illumination, cutting fluid, and dust in the practical cutting environment will interfere with the effect of image processing, thereby affecting the effect of prediction.

Summary and analysis
In summary, surface roughness prediction methods with direct sensors are grossly affected by illumination, cutting fluid, and dust, while for prediction methods with indirect sensors, the following two practical issues are not considered in the current research.
(1) The tool wears gradually overtime during the machining process, which will affect the surface roughness.

The proposed method of surface roughness prediction considering tool wear
The overall framework and the working mechanism of the surface roughness prediction are presented in Section 3.1, followed by the structure of the basic roughness prediction model SAE-LSTM in Section 3.2. The training strategy based on transfer learning for addressing the problem of the variable cutting parameters is detailed in Section 3.3 and how the tool wear prediction is integrated into the surface roughness prediction is elaborated in Section 3.4.

Overall framework and working mechanism of the proposed surface roughness prediction
Before the detail of the proposed framework of surface roughness prediction, some specific terminologies used in the framework are introduced, as given in Table 1. The framework is shown in Fig.1, including three parts: pre-training for surface roughness prediction model under source domain, transfer learning for modules of the source domain model, predicting surface roughness with target domain data. The surface roughness prediction effects are shown in Fig 1(d). The surface roughness prediction under variable cutting parameters can be achieved by the transfer learning. As shown in Fig.1(a), a basic surface roughness prediction model (known as source domain model) is firstly trained on the labeled source domain data. The input of the training data is sensor data such as vibration signal, a current signal, etc., and the output is the ground truth labels: the surface roughness values measured offline by a contact device under the source domain. After this step, the basic surface roughness prediction model has the ability to predict the surface roughness in real-time using the online monitoring data.
Next, as given in Fig.1(b), the transfer learning strategy is applied for modules of the source domain model, which details given in Section 3.3. After applying transfer learning, a surface roughness prediction model (known as target domain model) is obtained, which is able to predict the surface roughness value under the target domain.  The surface roughness prediction results with and without transfer learning is shown in Fig.1

Basic model of surface roughness prediction based on SAE-LSTM
The basic model of surface roughness prediction is based on SAE-LSTM and its structure is shown in Fig.2 (b). The basic prediction model includes four parts: input data, feature extraction module, prediction module, and output module.
SAE is an unsupervised deep learning network widely used for data dimensional reduction and feature extraction. Research indicates that SAE has good performance on extracting time series features [38]. The structure of SAE in this paper is shown in Fig.   2 (a), including "Encoder" and "Decoder". "Encoder" consists of three convolutional layers (Conv) and three maxpooling layers (MP). "Decoder" includes three convolutional layers (Conv) and three upsampling layers (US). It should be pointed out that the SAE is firstly trained and then only the "Encoder" of the trained SAE is taken out as the feature extraction module. In the prediction module, the "Flatten" and "Repeat Vector" layers are used to adjust the data dimension to fit the LSTM layer. Subsequently, a threelayer LSTM is used to predict the surface roughness. Finally, the dense layer is used to output the predicted value.
The training data of the SAE-LSTM is as follow. The input data is composed of four types of sensor data that are acquired during machining, i.e., tool wear (VB), acoustic (Pa), vibration (V) and spindle current(C

Transfer learning strategy based on the multi-stage model training process
In order to realize the surface roughness prediction under variable cutting parameters, a transfer learning strategy based on four-stage model training process is proposed. As shown in Fig. 3, the first two stages are the pre-training stage, and the latter two stages are the fine-tuning stage. Then the error between distribution difference and zero is back propagated to optimize the parameters of the SAE-LSTM model.
Through this way, the feature extraction module of the SAE-LSTM is suitable for the target domain data, i.e., the feature extraction ability of the SAE-LSTM for the source domain data is transferred to the target domain. To deal with the obvious changes in the surface roughness caused by different cutting parameters, the SAE-LSTM was adjusted to a single input in the fourth stage and fine-tuned through a small amount of labeled data in the target domain.

Optimization objective of multi-stage transfer learning
The pre-training and fine-tuning process include two loss functions, L1 and L2. These two loss functions are based on mean absolute error (MAE). When the model is a single input (such as Fig.4 and Fig.5(b)), the loss is L1, and when the model is with structure of double input (Fig. 5(a)), the loss is L1+L2. The L2 is obtained by calculating the MAE between the 2 D and the zero-valued label.
The multi-stage transfer learning is detailed below. The schematic diagrams of each stage are given, as shown in Fig. 4 and  Fig. 4 (a) shows the schematic diagram of pre-training SAE. The source domain data is used as the SAE input. The purpose is to train the SAE by source domain data such that the encoder has the ability to extract features from the input data. The SAE is optimized by minimizing the loss L1, in which the "Os" is the output of SAE under the source domain and the and "Is" is the input of SAE under the source domain (Reminder that SAE is an unsupervised model). The schematic diagram of pre-training SAE-LSTM is shown in Fig. 4(b), which uses the source domain data to train the surface roughness prediction model (SAE-LSTM). The SAE-LSTM is optimized by minimizing the loss L1, in which the "Os" and "Ls" are the output of SAE-LSTM under source domain and the ground truth, i.e., the label data of source domain respectively.
After the pre-training process shown in Fig.4, SAE-LSTM is able to predict the surface roughness of the source domain. As shown in Fig. 5, the source domain model is transferred to predict the surface roughness of the target domain by fine-tuning the feature extraction module and the prediction module respectively.  However, due to the large difference in surface roughness under different cutting parameters, the SAE-LSTM prediction module still has the risk of prediction error. Therefore, as shown in Fig.5 (b), a very small amount of label data of the target domain is used to fine-tune the prediction module, thereby improving the predictive ability of the SAE-LSTM in the target domain. The SAE-LSTM is optimized by minimizing the loss L1. In which, "Ot" and "Lt" respectively represents the output of SAE-LSTM under target domain and the label data of target domain.

Surface roughness prediction integrating tool wear
As presented previously, it is necessary to consider tool wear in surface roughness prediction. Two consecutive steps are involved. Firstly, the time series of tool wear values and sensor data prior to time step t are used to predict the tool wear value at time t, VB t . Subsequently, the time series of sensor data along with VBt are used to predict the surface roughness at time t, Ra t . Eqs  (V1x, V1y, V1z, V2x, V2y, V2z), and three-phase current signal of spindle controller (Cu, Cv, Cw). Eq. (5) is the mapping between the input and output for surface roughness prediction.
Ra t ,Râ t+1 ,…,Râ t+m-1 represents the predicted surface roughness value sequence at time t. Where m represents the number of predicted surface roughness.  Fig. 6 illustrates the two consecutive steps mentioned above when taking k=1 and m=1 for instance. At time t, the tool wear value of target domain VB t T is predicted by the tool wear prediction model FVB using the data acquired at t-1. Next, VB t T along with the sensor signal collected at time t are used as the input of the surface roughness prediction model FRa to predict the surface roughness at time t, Râ t T . The above process iterates with time such that the surface roughness integrating tool wear is predicted.
The effect of surface roughness predictions scheme is evaluated by the metric Root Mean Square Error (RMSE), calculated with Eq.
(7), where, n is the number of samples, t y is the surface roughness value measured offline by a contact instrument, which is regarded as the ground truth, andˆt y is the predicted surface roughness value, respectively.  Fig. 7 shows data preparation of the two consecutive steps as well as the process of surface roughness prediction in target domain. In Fig. 7(a), the time lap steps k=5, m=1. For the input X of tool wear prediction model, based on our previous research [17], it is found that the Standard Deviation (Std) and Root Mean Square (RMS) features extracted from the raw signal have good monotonicity and can well predict tool wear. Therefore these two features are selected for each sensor data (Pa, V, C) and combine with the tool wear (VB). The data format is shown in Fig. 7(a) and the data dimension is (5,21).

Fig. 7
Data preparation for surface roughness prediction Fig. 7(b) shows the process of generating data for surface roughness prediction integrating tool wear in target domain. The relationship of the surface roughness prediction model is Eq. (5). The time lap steps k=5, m=1. One second interval of the raw sensor data is selected as the X of the surface roughness prediction model. In addition, in order to combine with the sensor data, the tool wear value is copied to the same size as the single sensor data. As shown in Fig.7 (b), based on the sampling frequency (see Section 4.1), the dimension of the input data of the target domain is (50000,11). Fig. 8 shows the vertical tail of the aircraft and the assembly interface of vertical tail, where the assembly interface connects the vertical tails and rear fuselages of aircraft [41]. The assembly interface consists of eight sub assembly interfaces and the material is Ti6Al4V. The finish machining operation for the assembly interfaces is usually performed to guarantee the final assembly quality.

Experimental setup
In this paper, one sample workpiece of the sub assembly interfaces was used to carry out the machining experiment of milling plane, and the method proposed in the above section is verified by collecting the data in the machining process.
The experimental setup is shown in Fig. 9 The DTX850 CNC milling machine was used in the experiment to machining the sample workpiece (as shown in Fig. 9(c)). The cut tool is a face milling cutter with a diameter of 50mm, and the milling inserts model is APMT1604R0.8. The machining experiments are conducted under three groups of cutting parameters, shown in Table 2.
For each group of cutting parameters, three cutting tools are used for machining. Each tool is considered unusable after machining 168 cutting segments, and the tool wear value exceeds 0.3mm. Thus 168 cutting times is regarded as a run-to-fail experiment of a new tool. One cut segment represents the machining length along the short side of the assembly interface. During machining, the three-axies vibration signal on the spindle and spindle box, the current single of the spindle controller, and the acoustic signal are collected by a data acquisition instrument at 10 kHz. After each cutting segment is finished, a portable microscope Dino-Lite AM7115MZT is used to measure the tool wear value (VB) and the instrument ISR-C300 is used to measure the surface roughness (Ra).

Experimental data preparation
To verify the proposed framework for surface roughness prediction integrating tool wear under variable cutting parameters, six transfer tasks T1-T6 are designed, as shown in Table 3. In the column "Direction of transfer task", "P1→P2" means that the model trained under the cutting parameter of group P1 (source domain) is transferred to predict the surface roughness under the cutting parameters of the group P2 (target domain). As shown in Table 3, the data of the corresponding tool numbers are given in the training data and the test data. "Tool-A" and "Tool-B" respectively represent the first tool and the second tool during the test stage.
According to the transfer learning strategy detailed in Section 3.3.1, the number of samples used in the four stages during the training process are given in Table 4

Model parameter setting
The hyper-parameters settings of the tool wear prediction model and the surface roughness prediction model are given below.

Optimal parameters selection for the surface roughness prediction model
During the training process, it is found that the following two parameters have a large effect on the performance of the surface roughness prediction model: (1) the number of labeled samples of the target domain that is used for fine-tuning at the 4 th stage of the transfer learning, and (2) the time lag steps k in Eqs (4)-(5), i.e., the length of historical data that is used as the input of the prediction model. Therefore, it is necessary to analyze these two parameters and select the optimal ones.
(1) Prediction effect using different numbers of fine-tuning samples Transfer task T1 is taken as an example. The prediction performance is investigated by adjusting the number of fine-tuning samples to observe the RMSE of the prediction results, as shown in Fig. 10. It can be seen that the RMSE significantly reduced with the increase of the number of fine-tuning samples. When the number of fine-tuning samples reaching ten, keeping increasing this number has a very slight effect on reducing RMSE. Similar conclusions are found in transfer tasks T2-T6. Given that in practice, it is difficult to obtain the labeled data from the target domain, therefore, ten samples are used to fine-tune the surface roughness prediction model.  to point out that the surface roughness is measured by the contact portable measuring instrument, and the measurement data are susceptible to random factors of the machined surface texture, which causes the surface roughness to fluctuate rather than monotonically increasing. But the overall trend of the measured roughness values is going up with cut numbers.
The comparison of the four models in all six transfer tasks is quantified by computing the RMSE, as given in Table 5 and visualized in Fig.12. The proposed method outperforms all the other three models especially the "Without TL" model in all six transfer tasks. This indicates that adopting transfer learning well addresses the problem of surface roughness prediction under variable cutting parameters. In addition, in the six transfer tasks, the maximum RMSE of the proposed method is 0.089μm, which is 33.6% of the RMSE of the best model in literature [42]. The results in the literature can meet the actual industrial needs. Therefore, the prediction effect of the proposed method is acceptable from the industrial point of view.  According to the results in Fig. 13~14 and Table 5, it can be concluded that the proposed method can better predict the surface roughness in the machining process under variable cutting parameter conditions.

Fig. 13
The prediction effect of different models on CT2-2 under T1 task For the perspectives, currently, the method proposed in this paper still needs a small amount of label data to fine-tune the target domain model, which will be addressed in the future. The method is only verified through one part of the assembly interface of vertical tail, while in practice, the machining process contains multiple assembly interfaces and the experimental condition will be different. It is necessary to further verify the method in-site.