Sheet part nc machining quality prediction method based on multi-task transfer learning
By employing a multi-task transfer learning method, a shared layer network and a dynamically distributed adaptive task-specific layer network are constructed. This solves the problem of accurately predicting multiple machining features of thin plate parts, achieves high-precision parallel output of multiple quality indicators, adapts to complex machining features and working condition changes, and improves the control capability of CNC machining quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- XIDIAN UNIV
- Filing Date
- 2023-05-24
- Publication Date
- 2026-07-24
AI Technical Summary
Existing technologies struggle to accurately predict multiple machining features in CNC machining of thin sheet metal parts, especially when machining features are complex and operating conditions vary. Traditional methods exhibit poor generalization performance, leading to decreased prediction accuracy and low modeling efficiency.
A multi-task transfer learning approach is adopted. By constructing a shared layer network for multi-task feature extraction and a dynamically distributed adaptive task-specific layer network, combined with the Wasserstein distance selection dataset, multiple quality indicators of thin plate parts are output in parallel, achieving accurate prediction of cross-processing features.
It achieves high-precision prediction of multiple quality indicators for thin plate parts, improves the reliability of migration effect and modeling efficiency, adapts to complex processing features and working condition changes, and enhances the control capability of CNC machining quality.
Smart Images

Figure CN116520772B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of CNC machining technology for thin plate parts, specifically relating to a method for predicting the quality of CNC machining of thin plate parts based on multi-task transfer learning. Background Technology
[0002] Numerical control (NC) machining refers to the automated machining of parts with complex features and high precision, where a control system issues commands to enable the cutting tool to perform various required movements. It uses numbers and letters to represent the workpiece's shape, dimensions, and other technical and process requirements. NC machining can solve the problem of automating the machining of parts with complex features and high precision. The deformation error in NC machining is a major indicator of machining quality; predicting it in advance can better control machining deformation, improve the part's pass rate, and reduce material waste. With the development of industries such as aerospace, automotive manufacturing, and radar communications, the requirements for thin-plate parts are constantly evolving towards higher pass rates and higher precision. However, the complex machining features of thin-plate parts, with each feature having multiple quality indicators, make efficient and accurate prediction of their NC machining quality even more challenging. Traditional quality prediction methods are often based on machine learning and deep learning. The limitations of these methods lie in the fact that the data used to build the model has a uniform distribution and only predicts a single quality indicator. However, in actual NC machining processes, the complex machining features of thin-plate parts and the changing machining conditions, along with the multiple quality indicators for each machining feature, lead to a decline in the accuracy and low modeling efficiency of traditional quality prediction methods with poor generalization performance.
[0003] In their paper "Prediction and Optimization of Part Machining Quality Based on Machine Learning" (Information Technology, May 2021), Su Xin et al. used a planar crack antenna as the research object. They used the XGBoost machine learning algorithm to predict the CNC machining quality of multiple machining features of the part, and used a genetic algorithm to optimize the prediction results. This method uses the XGBoost algorithm to build a prediction model for the same machining feature, that is, machining features with the same data distribution. It verified the relationship between machining process parameters and machining quality and achieved good prediction results. However, this method still has shortcomings. XGBoost has a good modeling effect when the data has the same distribution. However, in the actual machining process, due to the complexity of the machining features and the changes in the machining conditions, the distribution of the recorded data changes, which causes a serious decline in the prediction performance of XGBoost. In their paper "Adaptive Transfer Method of Digital Twin Model for Machining Field" (Journal of Shanghai Jiao Tong University, January 2022), Shen Hui et al. used drilling selection as the research object and used a one-dimensional convolutional neural network to study the adaptive transfer method of digital twin to achieve prediction of drilling quality under different process parameters. However, it only achieved single-task learning and did not involve multi-task joint transfer learning, which is not suitable for multi-task joint transfer scenarios. Summary of the Invention
[0004] In order to overcome the shortcomings of the prior art, the present invention aims to provide a method for predicting the quality of CNC machining of thin plate parts based on multi-task transfer learning, which realizes quality prediction under unknown working conditions and parallel output of prediction results of multiple quality indicators. The results of parallel output of multiple quality indicators have high accuracy and high reliability of the transfer effect of quality prediction.
[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0006] A method for predicting the machining quality of thin plate parts based on multi-task transfer learning includes the following steps:
[0007] Step 1) Data Acquisition and Processing of CNC Machining: For the acquired dataset, relevant instruments are used to collect cutting force time-series data, machining process parameters, and machining quality data. During the data processing, time-domain indices are extracted from the X, Y, and Z-axis cutting force signal data of each machining feature on the workpiece, including mean, maximum, peak-to-peak value, standard deviation, root mean square, skewness index, kurtosis index, peak value index, and pulse index. These are then combined with the three cutting elements—rotation speed, depth of cut, and feed rate—to form a 30-dimensional data feature. For rectangular and crack machining features, there are two quality indices: machining quality errors for length and width. For circular hole machining features, there are two quality indices: machining quality errors for two mutually perpendicular radii. The data features of each machining feature are combined with the corresponding two quality indices to form the original machining feature dataset set D, which contains nine machining feature datasets.
[0008] Step 2) Preprocess each dataset in the original processing feature dataset set D: For the original processing feature dataset set D, based on the method of combining quartiles and box plots, calculate the statistics of each dataset in the original processing feature dataset set D, identify outliers in each dataset in the original processing feature dataset set D based on the statistics, and then delete the outliers in each dataset in the original processing feature dataset set D to obtain the preprocessed processing feature dataset set D′;
[0009] Step 3) Select two datasets with small distribution differences from the preprocessed feature dataset set D′ for transfer learning: For the preprocessed feature dataset set D′, randomly select one dataset as the source domain and the rest as the target domain, and calculate the Wasserstein distance (WD) between them as the distribution similarity between the two datasets; then, using other datasets as the source domain, traverse the preprocessed feature dataset set D′ to obtain a distribution similarity set; calculate the median of the distribution similarity set, use it as a threshold, and select the datasets with values less than the threshold as the source and target domains for constructing the multi-task transfer learning model R;
[0010] Step 4) Divide the selected source domain and target domain datasets into training and testing sets: For the selected source domain dataset, use all of its data as the training set for training the multi-task transfer learning model R; For the selected target domain dataset, divide it into training and testing sets in a 7:3 ratio, where 70% of the target domain data is used to train the multi-task transfer learning model R and 30% of the data is used to test the training effect of the multi-task transfer learning model R.
[0011] Step 5) Construct a shared layer network E based on multi-task feature extraction: For the training sets of the selected source and target domains, input 30-dimensional data features consisting of cutting force and three elements. Based on the multi-task learning MMoE model, construct multiple parallel expert networks to perform deep feature extraction on the input data in parallel. Then, construct a gate network based on the linear transformation matrix and the activation function Softmax, filter out the deep features specific to each task, and complete the construction of the shared layer network E for multi-task feature extraction.
[0012] Step 6) Construct a task-specific layer network L based on dynamic distribution adaptation: For the deep features of each task in the source and target domains extracted by the shared layer network E, construct a tower network based on linear layers to perform parallel quality regression prediction for multiple tasks and calculate the regression loss; at the same time, perform dynamic domain adaptation for each task, including marginal domain adaptation and conditional domain adaptation. Calculate the marginal distribution loss based on the multi-kernel maximum mean difference (MK-MMD) and the conditional distribution loss based on the conditional maximum mean difference (CMMD). Then, dynamically adjust the weights between the two distribution losses using a distribution dynamic factor. Finally, sum the regression loss, marginal distribution loss, and conditional distribution loss for each task to calculate the total loss for each task, thus completing the construction of the task-specific layer network L based on dynamic distribution adaptation.
[0013] Step 7) Dynamically adjust the weights of the total loss for each task to complete the construction of the multi-task transfer learning model R: For the loss of each task obtained from the task-specific layer network L based on dynamic distribution adaptation, calculate the dynamic weight factor for each task, and use the task dynamic factor to adjust the weights among multiple tasks. Sum the losses of all tasks to calculate the total loss of the multi-task transfer learning model R, and then update the multi-task transfer learning model R in reverse according to the total loss of the multi-task transfer learning model R to complete the training of the multi-task transfer learning model R and obtain the final prediction model; test the performance of the multi-task transfer learning model and perform hyperparameter tuning to complete the construction of the multi-task transfer learning model R.
[0014] Compared with existing technologies, the technical advantages of this invention are:
[0015] The parallel output of multiple quality indicators results in high accuracy: By constructing a shared layer network for multi-task feature extraction, and utilizing expert networks and gate networks to extract deep features from the source and target domains, it is ensured that each task can extract its own unique deep features, providing good feature preparation for transfer learning under multiple tasks. At the same time, it ensures that the multi-task transfer learning model R can accurately predict multiple quality indicators of the processed features. The total loss of each task is connected through task dynamic factors to obtain the total loss of the multi-task transfer learning model R, avoiding the excessive dominance of the total loss of one task, so that the total loss of all tasks can be well reduced during training, ensuring that each quality indicator of the processed features can achieve its best prediction result.
[0016] The transfer learning effect of quality prediction is highly reliable: By using the Wasserstein distance (WD) to select source and target domains with similar data distributions among multiple machining features of thin sheet parts, negative transfer caused by blindly selecting datasets is effectively avoided; by constructing a task-specific layer network based on dynamic distribution adaptation, the domain adaptation of marginal and conditional distributions in transfer learning is considered simultaneously, and the weights between the two are adjusted using a distribution dynamic factor to make them closer to the true distribution of the dataset, which effectively improves the effect of transfer learning. This enables multiple quality predictions of thin sheet parts from the source domain (labeled machining features) to the target domain (unlabeled machining features) across machining features, providing reliable quality prediction results for thin sheet parts in actual CNC machining. Attached Figure Description
[0017] Figure 1 This is the overall flowchart of the present invention.
[0018] Figure 2 This is the network architecture of the multi-task transfer learning model in this embodiment of the invention. (Taking 2 tasks as an example, if the number of tasks in the model is more than 2, the corresponding number of task-specific layers and gate networks can be added to predict more quality metrics.)
[0019] Figure 3 This is a specific network structure in an embodiment of the present invention.
[0020] Figure 4 This is a graph of the rectangular membership function in an embodiment of the present invention.
[0021] Figure 5 This is a graph showing the actual and predicted values of Task 1 (Quality Index 1) in the target domain (rectangle 5.2×5.2) of this embodiment of the invention.
[0022] Figure 6 This is a graph showing the actual and predicted values of Task 2 (Quality Index 2) in the target domain (rectangle 5.2×5.2) of this embodiment of the invention. Detailed Implementation
[0023] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0024] Example: In existing CNC machining, it is difficult to predict the quality of machining features with different data distributions on the workpiece across machining features, especially when the machining features have multiple quality indicators. A planar slotted antenna is a typical thin-plate part, possessing superior properties such as lightweight, high strength, compact structure, and light weight. During CNC milling, the planar slotted antenna exhibits a high material removal rate, but its low stiffness makes it prone to deformation, ultimately leading to reduced machining accuracy, unstable machining processes, and resulting in decreased machining quality and waste of raw materials. This embodiment addresses the challenges of predicting multiple processing quality indicators and cross-processing feature quality in existing flat panel slotted antenna manufacturing processes. It proposes a CNC machining quality prediction method based on multi-task transfer learning for thin-plate parts. The flat panel slotted antenna is used as the processing object, consisting of multiple thin-walled cavities with different slotting methods. Generally, it has two types of processing features: rectangles, slots, and circular holes. Specifically, there are nine processing features (all in mm): rectangle 8.6×8.6, rectangle 5.2×5.2, rectangle 13.0×13.0, slot 3.0×8.1, slot 1.0×8.1, circular hole 1d6.0, circular hole 2d6.0, circular hole 3d6.0, and circular hole 4d6.0. On the surface of the flat plate, there are four rectangular closed grooves, one rectangular crack, and four identical circular through holes arranged independently along the length of the rectangular plate. The middle of the rectangular groove is open, the length of the crack is parallel to the length of the plate, and the four circular through holes are placed in one rectangular groove. During CNC machining, the rectangular grooves, cracks, and circular holes are milled in that order.
[0025] See Figure 1 A method for predicting the machining quality of thin plate parts based on multi-task transfer learning includes the following steps:
[0026] Step 1) Collection and organization of CNC machining data:
[0027] Step 1a) Data Collection: The CNC machine tool's tool parameters are a solid end mill, diameter 1, material carbide; the machining features are: rectangle, crack, and round hole; the machining process parameters are: spindle speed, depth of cut, and feed rate. The CNC machine tool performs milling in the order of rectangle, crack, and round hole. The cutting force timing data of the machining process is collected using a Model 9527Ad Kistler force gauge. The process parameter data of the flat plate crack antenna is collected using the CNC machine tool's MDC module. The machining quality data of the machining features rectangle, crack, and round hole of the flat plate crack antenna are collected using a coordinate measuring machine. The multiple machining quality indicators of the machining feature rectangle refer to the two machining errors of the length and width of the rectangular closed groove. The data of the crack refers to the two machining errors of the crack length and width. The data of the round hole refers to the machining errors of the two radii in the mutually perpendicular directions of the round hole. The machining error is the difference between the designed size and the actual size of the machining feature.
[0028] Step 1b) Dataset Organization: Extract the data of nine different sizes of machining features of the planar slot antenna (rectangular, slotted, and circular holes) and correlate them one by one with the cutting force time-series signal, process parameters (rotation speed, depth of cut, and feed). Extract time-domain indices from the X, Y, and Z axes of the cutting force time-series signals of the corresponding machining features, including: mean, maximum, peak-to-peak value, standard deviation, root mean square, skewness index, kurtosis index, peak value index, and impulse index, so that each machining feature contains 30-dimensional data features. Combine the data features of each machining feature with two corresponding quality indices to form the original machining feature dataset set D containing the nine machining feature datasets.
[0029] In the acquisition of CNC machining data, this invention addresses nine datasets representing three machining features of a planar slotted antenna component. Based on the type and dimensions of the machining features, the acquired machining process data, process parameters, and corresponding quality data are mapped to form an original machining feature dataset set D, thus achieving the division of datasets corresponding to each machining feature. During data processing, the cutting force data from the acquired CNC machining process is effectively used to characterize the process state using its time-domain indicators, providing a link between the machining state and quality indicators for the subsequent construction of the multi-task transfer learning model R.
[0030] Step 2) Preprocess each dataset in the original processing feature dataset set D:
[0031] Step 2a) Calculate the statistics of the original processing feature dataset set D: For each dataset in the original processing feature dataset set D, calculate the statistics, including the upper quartile, median, lower quartile, and interquartile range;
[0032] Step 2b) Identify outliers in the original processing feature dataset set D: Based on equation (1), identify outliers for the two quality indicators of each dataset in the original processing feature dataset set D:
[0033]
[0034] Where Outlier represents the outlier of each quality indicator. As can be seen from equation (1), the outlier is located outside the interval [QL-1.5×IQR,QU+1.5×IQR]; QU represents the upper quartile of each quality indicator, QL represents the upper quartile of each quality indicator, and IQR represents the interquartile range of each quality indicator, i.e., IQR=QU-QL;
[0035] Step 2c) Delete outliers from the original processing feature dataset set D: Delete the data corresponding to the outliers detected in step 2b) to obtain the preprocessed processing feature dataset set D′;
[0036] This invention utilizes quartiles and box plots to detect outliers in the original processing feature dataset. Since quartiles and box plots can intuitively examine the data distribution (mean, dispersion) and identify outliers, the quality of the original processing feature dataset D can be improved after step 2), providing a good data foundation for the accurate prediction of the subsequent multi-task transfer learning model R, and avoiding the decrease in accuracy caused by fitting outliers in the multi-task transfer learning model R.
[0037] Step 3) Select two datasets with small distribution differences from the preprocessed feature dataset set D′ for transfer processing:
[0038] Step 3a) Calculate the data distribution similarity between the preprocessed feature datasets D′: Randomly select any dataset from the processed features as the source domain, and successively use the other data as the target domains. Calculate the first-order Wasserstein distance (WD) as the similarity between the two datasets using their data features. The first-order Wasserstein distance (WD) is defined on the metric space (M,ρ), and its calculation formula is shown in equation (2):
[0039]
[0040] Where P is the probability distribution of the source domain data and Q is the probability distribution of the target domain data; a Let a be a data point in the source domain and b be a data point in the target domain; M is a set consisting of {a, b}, and ρ represents the distance function between two data points in set M, such as Euclidean distance. Let Γ represent the joint probability distribution, with marginal distributions P and Q; Γ is the joint distribution of all pairs of ...
[0041] Step 3b) Calculate the threshold and select the dataset: According to formula (2), traverse the set of preprocessed feature datasets D′ to obtain the similarity set O. Calculate the median V of the similarity set O and use it as the threshold. Select the datasets with similarity lower than the threshold V as the source domain and target domain. After calculation, this embodiment selects the combination of rectangle 8.6×8.6 as the source domain and rectangle 5.2×5.2 as the target domain as an example. The data in the target domain does not contain real labels (real values of multiple quality indicators).
[0042] This invention utilizes the Wasserstein distance (WD) to select two data sets with low distribution similarity for transfer learning. Since the Wasserstein distance (WD) can still quantitatively calculate the distance between two data distributions even when there is little or no overlap, after step 3), the distance between the distributions of any two datasets in the preprocessed feature dataset set D′ can be quantitatively calculated. From this, the datasets with small distribution differences are selected for transfer learning, thereby effectively avoiding negative transfer and improving the prediction accuracy of the multi-task transfer learning model R.
[0043] Step 4) Divide the selected source and target domain datasets into training and test sets:
[0044] Step 4a) Splitting the source domain dataset: For the selected source domain dataset, which is a rectangle of 8.6×8.6, all its data is used as the training set and input into the multi-task transfer learning model R for training;
[0045] Step 4b) Target domain dataset partitioning: For the selected target domain dataset rectangle of 5.2×5.2, it is partitioned in a 7:3 ratio. 70% of the data is used as the training set and input into the multi-task transfer learning model together with the source domain training set for training; 30% of the data is used as the test set to test the performance of the multi-task transfer learning model R.
[0046] This invention divides the datasets of the source domain and the target domain into training and test sets. Since the divided training set can be used to train the multi-task transfer learning model R and fit the relationship between feature data and quality index data; the divided test set can be used to measure the performance of the multi-task transfer learning model R and optimize hyperparameters, after step 4), it can prepare for the subsequent training, performance evaluation and hyperparameter selection of the multi-task transfer learning model R.
[0047] Step 5) Construct a shared layer network E based on multi-task feature extraction:
[0048] Step 5a) Construct multiple parallel expert networks: Refer to Figure 2 and Figure 3An expert network based on a convolutional network architecture is constructed. The network structure sequence is: convolutional layer 1, activation function, pooling layer 1, convolutional layer 2, activation function, pooling layer 2. This single expert network is then copied n times to form n parallel expert networks, which perform deep feature extraction on the feature data input from the source and target domains. (Refer to...) Figure 3 In this embodiment, the specific structure of the expert network is as follows: a one-dimensional convolutional layer 1 (in_channel=1, out_channel=2, kernel_size=2, stride=2, padding=1), an activation function (ReLU), a one-dimensional max pooling layer 1 (stride=2, kernel_size=2), a one-dimensional convolutional layer 2 (in_channel=2, out_channel=4, kernel_size=2, stride=2, padding=1), an activation function (ReLU), and a one-dimensional max pooling layer 2 (stride=2, kernel_size=2); the number of these layers is set to 6, that is, 6 expert networks are used to perform deep feature extraction on the input feature data of the source domain dataset rectangle 8.6×8.6 and the target domain dataset rectangle 5.2×5.2.
[0049] Step 5b) Construct the gate network: Refer to Figure 2 and Figure 3 A gate network based on a linear transformation matrix and the activation function Softmax is constructed. The input data of the source and target domains are multiplied with the matrix to perform a linear transformation. Then, the matrix output is multiplied and summed with the deep features output by each expert network in a weighted manner to obtain the deep features specific to each task. The number of gate networks is consistent with the number of tasks. The calculation process of the shared layer network E for multi-task feature extraction is shown in equations (3) and (4).
[0050]
[0051]
[0052] Where x represents the data features input to the multi-task transfer learning model R, namely the time-domain index data of cutting force and the process parameter data characterizing the CNC machining state, which is represented as x in the source domain. s For the target domain, it is represented as x t k∈{1,2,...,K} represents the k-th task, K is the total number of tasks in the multi-task transfer learning model R, and n represents the number of expert networks. Let f represent the linear transformation matrix corresponding to the k-th task, with dimensions (n, d), where d is the dimension of the input data features; f represents the mapping function of a single expert network; g k F represents the mapping function of the k-th gate network; k(x) represents the deep data feature specific to the k-th task, which is represented in the source domain as: The target domain is represented as
[0053] In this embodiment, the number of tasks is 2, i.e., K is set to 2; the number of expert networks is 6, i.e., n is set to 6; and the dimension of the linear transformation matrix of the gate network is (6,30), i.e., (n,d) is set to (6,30).
[0054] This invention constructs a shared layer network E for multi-task feature extraction. Since the shared layer network E utilizes multiple parallel expert networks to simultaneously extract input data features and simultaneously uses gate networks to select the deep features extracted by them, it forms deep features specific to each task. This effectively ensures that each quality prediction task can utilize its own unique feature information as well as feature information related to other tasks. Therefore, after processing in step 5), the specific and diverse deep features contained in each task are input into the task-specific layer network L for implementing quality prediction and dynamic domain adaptation. This not only enables each task to achieve its own high-precision quality prediction, but also makes the deep features of each task better represent its own data distribution when performing dynamic domain adaptation, thereby better aligning the data distribution of the corresponding tasks in the source and target domains.
[0055] Step 6) Construct a task-specific layer network L based on dynamic distribution and adaptation:
[0056] Step 6a) Construct the tower network: Refer to Figure 2 and Figure 3 For each task in the source and target domains extracted by the shared layer network E, a tower network based on a linear layer network is constructed. The network structure is as follows: linear layer 1, batch normalization layer, activation function, dropout layer, and linear layer 2, with the number of layers matching the number of tasks. (Refer to...) Figure 3 For this embodiment, the specific structure of the tower network is as follows: linear layer 1 (8×4), batch normalization layer (4), activation function (ReLU), dropout layer (0.4), and linear layer 2 (4×1);
[0057] Step 6b) Perform quality regression prediction for multiple tasks and calculate the regression prediction loss: Based on the deep features of multiple tasks in the source domain extracted by the shared layer network E, the tower network uses them to perform regression prediction for multiple tasks, and calculates the regression prediction loss for the prediction results of the source domain using the mean squared loss function (MSE); the calculation process of the tower network prediction for the kth regression task is shown in equations (5) and (6):
[0058]
[0059]
[0060] Where v k The mapping function representing the k-th tower network; This represents the predicted label for the k-th task in the source domain; The true label of the k-th task in the source domain is represented by MSE; the mean squared loss function is represented by MSE. This represents the regression prediction loss for the k-th task; the prediction results for all K regression tasks are the prediction results of the task-specific layer network L.
[0061] Step 6c) Perform dynamic domain adaptation for multiple tasks and calculate distribution loss: For the deep features of multiple tasks in the input source and target domains, perform edge domain adaptation and calculate edge distribution loss using multi-kernel maximum mean difference (MK-MMD). Multi-kernel maximum mean difference uses the maximum mean difference (MMD) of multiple single kernels to calculate the difference between the two data distributions, and then sums them up; The calculation process of edge domain adaptation for the k-th task can be represented by equation (7):
[0062]
[0063] Where h∈H represents the type of kernel function, H={h G (u,e),h P (u,e),...} represents the set of kernel function types, where h G (u,e) indicates that the data u and e are mapped using a Gaussian kernel function, h. P (u,e) represents mapping data u and e using a polynomial kernel function; MMD represents the maximum mean difference. This represents the deep features of the k-th task in the target domain; This represents the marginal distribution loss of the k-th task in the source and target domains;
[0064] For the predicted labels of all tasks obtained from the source and target domains in step 6b), based on fuzzy set theory, the predicted labels are discretized into three fuzzy classes using a rectangular distribution membership function. The fuzzy boundaries of these classes are the upper quartile, median, and lower quartile of the predicted labels, respectively. Figure 4 As shown; based on the three fuzzy class labels, the conditional maximum mean difference (CMMD) is used to align the conditional distributions of the deep features of multiple tasks in the source and target domains, and the conditional distribution loss is calculated; the calculation process of the edge domain adaptation of the k-th task can be represented by equation (8):
[0065]
[0066] in and These represent the deep features of the k-th task in the source and target domains after discretization using the rectangular distribution membership function, respectively; CMMD represents the conditional maximum mean difference. This represents the conditional distribution loss of the k-th task in both the source and target domains;
[0067] For each task's marginal distribution loss and conditional distribution loss, the weights between them are adjusted using a dynamic distribution factor so that they can more accurately describe the true distribution of the dataset; the calculation and update process of the dynamic distribution factor for the k-th task is shown in equation (9):
[0068]
[0069] in This represents the edge distribution distance of the k-th task; Let represent the conditional distribution distance of the k-th task; the calculation process for both is shown in equation (10):
[0070]
[0071] Step 6d) Calculate the total loss for each task: Refer to Figure 2 Based on the losses of each part of each task obtained in steps 6a) to 6c), sum them to obtain the total loss of each task; the calculation process of the total loss of the kth task is shown in equation (11):
[0072]
[0073] Loss k λ represents the total loss of the k-th task; λ represents the weight of the dynamic adaptive loss, which is a hyperparameter, and λ is set to be the same for each task.
[0074] This invention constructs a task-specific layer network L based on dynamic distribution adaptation. Since the task-specific layer network L performs quality prediction and dynamic domain adaptation for each task simultaneously, quality prediction for each task in the source domain ensures that the multi-task transfer learning model R fits the relationship between the input features and quality indicators of the source domain, thereby enabling the multi-task transfer learning model R to learn the knowledge of the source domain. Dynamic domain adaptation for the source and target domains aligns the marginal and conditional distributions of the source domain with the target domain, allowing the target domain to better learn the distribution knowledge of the source domain. Furthermore, the dynamic distribution factor can dynamically adjust the relative weights of the marginal and conditional distributions, making them more consistent with the actual data distribution of the source and target domains. Therefore, after step 6), the multi-task transfer learning model R can not only learn reliable source domain knowledge but also transfer the source domain knowledge to multiple tasks in the target domain, ensuring that each task can obtain accurate quality prediction results and improving the reliability of the predictions made by the multi-task transfer learning model R.
[0075] Step 7) Dynamically adjust the weights of the total loss for each task to complete the construction of the multi-task transfer learning model R:
[0076] Step 7a) Calculate the dynamic weight factor for each task: For the total loss of each task obtained in step 6), the dynamic weight factor is used to dynamically adjust it to avoid the phenomenon that tasks with excessive losses play a dominant role; the calculation process of the dynamic weight factor for the kth task is shown in equation (12):
[0077]
[0078] Where w k γ represents the weight factor for the k-th task, indicating the weight of each task in the total loss; γ represents the temperature controlling the softness of the weight dynamic factor, which is a hyperparameter; exp is an exponential function; δ represents the current iteration number of the multi-task transfer learning model R; ε k (δ-1) represents the relative decrease rate of the total loss of the k-th task in the (δ-1)-th iteration, and its calculation process is shown in equation (13):
[0079]
[0080] Where ε k (δ-1) is calculated starting from the 3rd iteration of the multi-task transfer learning model R; when δ = 1, ε k Set to 1, then ε will no longer be calculated. k (δ-1);
[0081] Step 7b) Calculate the total loss of the multi-task transfer learning model R: Combine the total loss of the k-th task obtained in step 6d) with the corresponding dynamic weight factor of the k-th task in step 7a) to obtain the total loss of model R, and use it to train and back-update model R; the calculation process of the total loss of model R can be expressed by equation (14):
[0082]
[0083] Step 7c) Test the performance of the multi-task transfer learning model R and perform hyperparameter tuning: In each iteration of the multi-task transfer learning model R, after training with the training sets of the source and target domains, input the test set of the target domain into the multi-task transfer learning model R. Use two performance evaluation metrics: mean absolute error (MAE) and root mean square error (RMSE) to evaluate the predicted values of multiple quality metrics of the target domain test set, and tune the hyperparameters of the multi-task transfer learning model R based on the evaluation results. The specific hyperparameters affecting the multi-task transfer learning model R and their traversal list include: batch size [32, 64, 128], learning rate, and other parameters. rate) [0.0001, 0.001, 0.01], adaptive component weight (λ) [0.5, 1, 2, 4, 8], temperature (γ) [1, 2, 4, 8] affecting the dynamic factor of weights; use a for loop to iterate through the above combinations of hyperparameters, construct a multi-task transfer learning model corresponding to each combination, compare the mean absolute error and root mean square error of the target domain test set under each model, select the hyperparameter combination corresponding to the model with the highest accuracy, and achieve the tuning of the multi-task transfer learning model R;
[0084] After iterating through the data, the optimal combination of hyperparameters for the multi-task transfer learning model R in this embodiment is as follows: batch size: 32, learning rate: 0.001, adaptive component weight (λ): 2, and temperature (γ) affecting the dynamic factors of the weights: 2.
[0085] This invention dynamically adjusts the weights of the total loss for each task to construct a multi-task transfer learning model R. During the training of the multi-task transfer learning model R, it's inevitable that one task's training loss will become excessively large, dominating the model's training and resulting in good training performance for that task while other tasks perform poorly. Introducing a dynamic weight factor ensures a dynamic balance in the proportion of training loss for each task, allowing each task in the multi-task transfer learning model R to reach its optimal state. Hyperparameter tuning based on the performance test results of the multi-task transfer learning model R ensures that the selection of each hyperparameter is optimal, enabling the model to better fit the relationship between features and multiple quality indicators and possess strong generalization ability. Therefore, after step 7), not only does the multi-task transfer learning model R achieve optimal predictions for multiple tasks in the target domain, but the optimal hyperparameters also ensure the best overall prediction performance, guaranteeing high reliability of the prediction results.
[0086] The technical effects of this embodiment will be explained below with reference to simulation experiments:
[0087] Simulation conditions and content:
[0088] 1) Simulation conditions: This embodiment uses a 12th Gen Intel(R) Core(TM) i5-12500H 2.5GHz processor, PyCharm (Community Edition) version: 11.0.15+10-b2043.56 amd64, Python 3.9.12 as the compilation language, and Anaconda version: conda 4.12.0 as the compilation environment;
[0089] 2) Simulation content: Based on nine processing features of planar slotted antennas, a dataset combination with similar data distribution is selected: source domain (rectangle 8.6×8.6) and target domain (rectangle 5.2×5.2). A multi-task transfer learning prediction model based on the two is constructed to realize the transfer of data distribution knowledge from the source domain (rectangle 8.6×8.6) to the target domain (rectangle 5.2×5.2). The prediction results, performance evaluation indicators, and prediction visualizations for multiple tasks (quality indicators) in the target domain test set are output.
[0090] Experimental Results and Analysis:
[0091] 1) Performance evaluation metrics for multi-task transfer learning model R:
[0092] This embodiment obtains the target domain (rectangle 5.2×5.2) of the multi-task transfer learning model R through simulation. See Table 1, which is a table of performance evaluation metrics for the two tasks of the multi-task transfer learning model obtained for the test set of the target domain (rectangle 5.2×5.2) in this embodiment:
[0093] Table 1
[0094]
[0095] As can be seen from Table 1, both performance evaluation metrics of the target domain (rectangle) test set in this embodiment are low, indicating that the multi-task transfer learning model R has good prediction effect and high accuracy.
[0096] 2) Visualization of the prediction results:
[0097] The prediction curve in this embodiment can also be visualized. The curves of the true and predicted values for the target domain (rectangle 5.2×5.2) test set task 1 (rectangle length error) are shown below. Figure 5 As shown, the curves of the true and predicted values for Task 2 (rectangular width error) are as follows: Figure 6 As shown, Figure 5 and Figure 6The horizontal axis represents the workpiece number, and the vertical axis represents the processing error of the corresponding task in the target domain. The predicted curves in the figure are all dashed lines, while the actual data curves for the processed parts are all solid lines. From the predicted curves of the two tasks in the target domain test set, it can be seen that the predicted curves are very close to the actual curves, and the trends are the same. The overall average absolute error and mean square error of the two tasks are within a reasonable range. In summary, the predicted curves of the two tasks in the target domain (rectangle 5.2×5.2) of this embodiment are quite close to the actual curves, and the prediction effect is good.
[0098] In summary, this invention discloses a method for predicting the CNC machining quality of thin plate parts based on multi-task transfer learning. It solves the problems of predicting multiple machining features across data distributions and predicting multiple quality indicators in parallel for thin plate parts. The implementation steps include: collecting and organizing the dataset; preprocessing the organized dataset; selecting source and target domains with similar data distributions; dividing the source and target domains into training and test sets; constructing a shared layer network for multi-task feature extraction; constructing a task-specific layer network based on dynamic adaptation; outputting the prediction results of multiple tasks on the target domain test set; performing model optimization; and completing the construction of the multi-task transfer learning model. This invention combines multi-task learning and transfer learning to predict multiple quality indicators of thin plate parts across data distributions, obtaining high-precision prediction results for the target domain. The entire scheme is rigorous and complete, with high modeling efficiency and prediction accuracy, effectively improving modeling efficiency for predicting multiple quality indicators of thin plate parts.
Claims
1. A method for predicting the machining quality of thin plate parts using multi-task transfer learning, characterized in that, Includes the following steps: Step 1) Forming a set of original machining feature datasets for CNC machining. Original processing feature dataset set It includes 30-dimensional data features composed of cutting force and three cutting elements. Specifically, the 30-dimensional data features are: extracting time-series features from the X, Y, and Z direction cutting force signal data of each machining feature on the workpiece, including mean, maximum, peak-to-peak value, standard deviation, root mean square, skewness index, kurtosis index, peak value index, and pulse index, and combining them with the three cutting elements: rotational speed, depth of cut, and feed. Step 2) Set the original processing feature dataset Each dataset within the dataset undergoes preprocessing; Step 3) Select the set of preprocessed feature datasets. Transferring data between two datasets whose distribution differences are less than a threshold; For the preprocessed feature dataset set First, take any one of them as the source domain and the rest as the target domain, and calculate the Wasserstein distance between them in turn. The distribution similarity of the dataset is used as the source domain; then, using other domains as source domains, the entire set of preprocessed and post-processed feature datasets is traversed. A set of distribution similarities is obtained; the median of the distribution similarity set is calculated and used as a threshold; and the datasets with similarities less than the threshold are selected as the source and target domains for building the model. Step 4) Divide the selected source and target domain datasets into training and test sets; Step 5) Construct a shared layer network for multi-task feature extraction For the selected source and target domain training sets, 30-dimensional data features consisting of cutting force and three cutting elements are input. Based on the multi-task learning MMoE model, multiple expert networks composed of convolutional layers are used to extract deep features of the input data in parallel. Then, a gate network composed of softmax layers is used to filter the features important to each task, obtaining the specific deep features for each task, and completing the shared layer network for multi-task feature extraction. The construction; Step 6) Construct a task-specific layer network based on dynamic distribution and adaptation. For shared layer networks The deep features extracted from each task in the source and target domains are used to perform parallel quality regression predictions for multiple tasks based on a dynamically distributed adaptive DDAN model and a tower network composed of linear layers, calculating the regression loss. Simultaneously, marginal distribution adaptation and conditional distribution adaptation are performed for each task. The distribution loss of the two adaptive modules is calculated based on the multi-kernel maximum mean difference (MK-MMD) and conditional maximum mean difference (CMMD). Then, the weights between the two distribution losses are dynamically adjusted using a distribution dynamic factor. Finally, the regression loss, marginal distribution loss, and conditional distribution loss for each task are summed to obtain the total loss for each task, completing the task-specific layer network based on dynamic distribution adaptation. The construction; Step 7) Dynamically adjust the weights of the total loss for each task to complete the multi-task transfer learning model. Construction; for task-specific layer networks based on dynamic distribution and adaptation The loss for each task is obtained, and the weights among multiple tasks are adjusted using a task dynamic factor. The sum of the losses for all tasks is then used to obtain a multi-task transfer learning model. The total loss is then calculated based on the multi-task transfer learning model. The total loss is used to back-update the multi-task transfer learning model. Complete the multi-task transfer learning model The prediction model is obtained through training; then, it is evaluated using a test set in the target domain; finally, the hyperparameters of the prediction model are tuned based on the evaluation results to complete the task transfer learning model. Build.
2. The method according to claim 1, characterized in that, Step 1) specifically involves: for rectangular and crack processing features, there are two quality indicators, namely the processing quality errors of length and width; for circular hole processing features, there are two quality indicators, namely the processing quality errors of two mutually perpendicular radii; and the data features of each processing feature are combined with the corresponding two quality indicators to ultimately form an original processing feature dataset set containing 9 processing feature datasets. .
3. The method according to claim 1, characterized in that, Step 2) specifically involves: targeting the original processing feature dataset set. Combining quartile analysis and box plots on the original processing feature dataset set Outliers in two quality metrics of each dataset are detected and removed to obtain a preprocessed feature dataset. .
4. The method according to claim 1, characterized in that, Step 4) specifically involves: using all data from the selected source domain dataset as the training set for the multi-task transfer learning model. Training was performed on the target domain dataset; for the selected target domain dataset, it was divided into training and testing sets in a 7:3 ratio, with 70% of the target domain data used for the multi-task transfer learning model. 30% of the training data was used to test the multi-task transfer learning model. The training effect.