A Tool Remaining Life Prediction Method Based on Line Angle Attention and Contrast-Driven Aggregation

By employing line-angle attention and contrast-driven aggregation, the problem of feature selection and noise differentiation in traditional tool life prediction is solved, achieving high-precision prediction in complex cutting environments and improving the robustness and accuracy of the model.

CN121479121BActive Publication Date: 2026-04-03NANJING TECH UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-01-09
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing methods for predicting remaining tool life struggle to effectively filter key features when dealing with complex cutting environments. They are prone to gradient vanishing or information forgetting, and cannot capture long-distance temporal correlations. Furthermore, traditional feature aggregation methods have difficulty distinguishing between effective features and noise, resulting in insufficient prediction accuracy.

Method used

We employ a method based on line-angle attention and contrast-driven aggregation. We use Pearson correlation coefficient and grey relational analysis to screen key features, combine line-angle attention enhancement blocks to capture long-distance dependencies in time-series data, and enhance wear-sensitive information and suppress noise through a contrast-driven feature aggregation module to construct a deep learning model for prediction.

Benefits of technology

It significantly improves the prediction accuracy and model generalization ability under complex cutting conditions, can more accurately capture tool wear characteristics, reduce noise interference, and improve the accuracy and stability of prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121479121B_ABST
    Figure CN121479121B_ABST
Patent Text Reader

Abstract

This invention relates to the field of tool remaining life prediction technology, and discloses a tool remaining life prediction method based on line-angle attention and contrast-driven aggregation. The method includes: using raw data from multi-channel sensors during the tool cutting process to extract six statistical features: mean, standard deviation, median, absolute maximum, root mean square, and skewness; employing a dual feature dimensionality reduction strategy using Pearson correlation coefficient and grey relational analysis to screen key features strongly correlated with wear state and perform standardization; and constructing a deep learning architecture that integrates line-angle attention and contrast-driven feature aggregation. This enables the model to have a stronger ability to recognize feature patterns of "numerical jumps but consistent trends" during tool wear, solving the problem that traditional attention mechanisms easily lose key temporal correlations during nonlinear degradation, and significantly improving the modeling accuracy of non-stationary sensor data under complex cutting conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of tool remaining life prediction technology, specifically a tool remaining life prediction method based on line-angle attention and contrast-driven aggregation. Background Technology

[0002] In the field of machining, tool life prediction is a core component of achieving intelligent manufacturing and lean production, and its accuracy directly impacts machining quality, production efficiency, and equipment maintenance costs. Traditional prediction methods often rely on empirical formulas or single sensor data, which struggle to cope with the challenges posed by multi-source interference (such as vibration, acoustic emission, and sudden changes in cutting force) in complex cutting environments, resulting in significant prediction errors and failing to meet actual production needs. With the development of Industrial Internet of Things (IIoT) technology, multi-channel sensors can now collect dynamic data from the cutting process in real time, providing a rich information foundation for data-driven tool life prediction. However, how to extract effective features strongly correlated with tool wear from high-dimensional, noisy time-series data and construct accurate prediction models remains a critical problem that urgently needs to be solved.

[0003] Existing data-driven methods have significant limitations in feature processing and model building: On the one hand, sensor data during the cutting process contains a large amount of redundant information and noise, making it difficult for single feature selection methods to effectively screen key features, which can easily lead to a decline in the model's generalization ability; on the other hand, tool wear is a typical progressive degradation process, and its remaining life is strongly time-dependent on historical cutting conditions. Traditional models (such as recurrent neural networks) are prone to gradient vanishing or information forgetting when processing long-sequence data, making it difficult to capture long-distance temporal correlations. In addition, effective wear features are often masked by environmental interference, and existing feature aggregation methods are unable to specifically enhance sensitive features and suppress noise, further restricting the improvement of prediction accuracy. Summary of the Invention

[0004] To address the shortcomings of existing technologies, this invention provides a tool remaining life prediction method based on line-angle attention and contrast-driven aggregation. This method effectively captures long-distance dependencies in time-series data, effectively distinguishes effective foreground features from background noise, enhances the representation of wear-sensitive information, and ultimately outputs the remaining life value through a regression prediction head. This solves the problems in existing technologies where single feature selection methods are difficult to effectively screen key features, easily lead to a decrease in model generalization ability, and are prone to gradient vanishing or information forgetting when processing long-series data, making it difficult to capture long-distance time-series correlations.

[0005] To achieve the above objectives, the present invention provides the following technical solution: a tool remaining life prediction method based on line-angle attention and contrast-driven aggregation, which specifically includes the following steps:

[0006] S1. Obtain the raw data of multi-channel sensors for vibration, cutting force and acoustic emission during tool cutting from public datasets, and define them as datasets C1, C4 and C6. Clean the raw data, remove outliers and missing values, and retain the data of the effective cutting period.

[0007] S2. Extract six statistical features from the sensor data for each time window: mean, standard deviation, median, absolute maximum, root mean square, and skewness. Use a dual strategy of Pearson correlation coefficient and grey relational analysis to screen out key features that are strongly correlated with wear status and complete feature dimensionality reduction.

[0008] S3. Standardize the feature set after dimensionality reduction, scaling the feature values ​​to the [0,1] interval; construct the feature set into time series samples according to the set sequence length, with the input of each sample being the features of the first N time steps and the output being the remaining lifetime label of the Nth time step.

[0009] S4. Construct a deep learning model that includes an initial projection layer, a line-angle attention enhancement block, a contrast-driven feature aggregation module, and a regression prediction head; the line-angle attention enhancement block captures long-distance dependencies in time-series data, the contrast-driven feature aggregation module enhances effective wear features and suppresses redundant noise, and the regression prediction head outputs the remaining lifetime prediction value;

[0010] S5. Merge datasets C1 and C6 as training data, and use dataset C4 as independent test data. Use mean squared error as the loss function, and train the model using AdamW optimizer and cosine annealing learning rate scheduling strategy. Prevent gradient explosion by gradient clipping, and save the model weights with the minimum training loss during the training process.

[0011] S6. Input the test set data into the trained model to obtain the remaining life prediction value; evaluate the model performance by mean absolute error and root mean square error, and verify the model's generalization ability under complex cutting conditions.

[0012] Furthermore, step S1 specifically includes the following process:

[0013] S11. Preprocess the acquired raw sensor data to eliminate the effects of noise, outliers and missing information;

[0014] S12. By setting a threshold based on the average value of no-load operation, identify and extract the time period when the signal is continuously higher than the threshold, and separate the effective cutting time period data that is only related to tool wear from the original data sequence containing non-effective cutting information such as entry, exit and idling.

[0015] Furthermore, step S2 specifically includes the following operational procedures:

[0016] S21. Divide the sensor time-series data of the effective cutting period into fixed time windows, each window containing N = Fs × window length data points, and process the sensor data sequence within the window. Perform calculations on six types of statistical characteristics;

[0017] S22. For the extracted high-dimensional feature matrix, key features are selected through the following two steps:

[0018] Pearson correlation coefficient screening: for features and wear labels Calculate the correlation coefficient :

[0019] ;

[0020] Where M is the number of samples, , They are respectively and The mean, retain Features;

[0021] Grey relational analysis filtering: filtering wear labels As a reference sequence The remaining features are comparison sequences. ,calculate:

[0022] Correlation coefficient: ;

[0023] Relevance: ;

[0024] reserve The features are used to complete feature dimensionality reduction.

[0025] Furthermore, step S3 specifically includes:

[0026] S31. Use the Min-Max normalization method to standardize all features and scale their values ​​to the range of [0,1].

[0027] S32. Define a sequence length. The model observes the past The features from each time step are used to predict the target for the next time step. The matrix is ​​slid across the standardized feature matrix with a step size of 1, using features from each time step. The window, within each window The rows of data constitute the input sequence of a sample. For each input sequence Assign a corresponding output label to it, this label is the first one. The remaining lifetime value corresponding to each time step.

[0028] Furthermore, the specific process of step S4 is as follows:

[0029] S41. Set a 1D convolutional layer as the initial projection layer. Its input channel number is consistent with the sensor feature dimension, and its output channel number is the dynamically adjusted high-dimensional feature channel number. Use the SAME Padding strategy with a convolutional kernel size of 3 to ensure that the temporal length remains unchanged. Map the original sensor features to the high-dimensional feature space through convolution operation to provide a foundation for subsequent feature processing.

[0030] S42, Construction The projection module maps high-dimensional features to queries through a linear layer. ,key ,value And split it into sub-features with a preset number of heads, for and L2 normalization is performed to eliminate feature scale differences and improve the stability of attention computation;

[0031] An attention computation module is constructed to capture global context features through matrix multiplication, and combine residual connections to alleviate gradient vanishing and generate global attention features. A 1D deep convolutional layer is added to extract local temporal features. The local features are added to the residuals of the global attention features to form a dual-scale enhanced feature of "global dependency + local detail". Finally, multi-head features are fused through a linear layer to output a unified-dimensional temporal feature.

[0032] S43. Construct a pseudo-mask generation module, calculate the feature temporal dimension variance, generate foreground and background masks through the sigmoid activation function, set foreground and background attention modules, amplify wear features and attenuate noise features through attention weights, construct local context grouping convolutional layers to extract local dependencies, set a gated fusion module, output weight coefficients through softmax, and adaptively weightedly fuse the "foreground enhancement + background suppression" features with local features.

[0033] S44. Set an adaptive average pooling layer to perform global average pooling on the aggregated temporal features, compressing the variable-length temporal features into a fixed-dimensional feature vector.

[0034] A fully connected network is constructed, with three fully connected layers set sequentially. The first fully connected layer maps the pooled feature vector to 48 dimensions, the second layer maps it to 24 dimensions, and the third layer outputs a 1-dimensional prediction value. The ReLU activation function is set between adjacent fully connected layers to introduce non-linear transformation.

[0035] Add dropout regularization layers between fully connected layers to suppress model overfitting;

[0036] Finally, the sigmoid activation function is set to normalize the predicted values ​​to the [0,1] interval, resulting in a prediction result consistent with the remaining lifetime label range.

[0037] Furthermore, step S5 includes the following processing flow:

[0038] S51. Standardize all data from C1, C4, and C6, and construct time series samples;

[0039] S52. The model is trained in a loop. Each iteration includes forward propagation, loss calculation, backpropagation and parameter update. After each training cycle, the model weights with the minimum training loss are saved.

[0040] Furthermore, step S6 includes the following processing flow:

[0041] S61. Load the trained optimal model weights and set the model to evaluation mode;

[0042] S62. Load the C4 test set and perform the same preprocessing and sequence construction as the training data.

[0043] S63. Input the test data into the model to obtain the predicted value of the remaining lifespan;

[0044] S64. Calculate and output metrics such as MAE and RMSE to verify the model's generalization ability under complex working conditions.

[0045] Compared with existing technologies, this invention provides a tool remaining life prediction method based on line-angle attention and contrast-driven aggregation, which has the following advantages:

[0046] 1. The line-angle attention enhancement block in this invention achieves a breakthrough innovation in temporal feature modeling. Its core advantage lies in breaking the limitation of traditional attention mechanisms that rely solely on "distance metrics" to capture temporal correlations, and innovatively introducing "angle features" into the calculation logic of attention weights. Traditional attention mechanisms (such as self-attention) mainly allocate weights by calculating the Euclidean distance or dot product of feature vectors at different time steps. Essentially, this is based on "linear distance" to judge the strength of feature correlation. When processing temporal data of nonlinear degradation processes such as tool wear, this approach easily overlooks the implicit correlations of feature vectors in high-dimensional space due to directional differences. For example, vibration signals at different cutting stages may differ significantly in numerical value (far apart), but point to similar wear states (similar angles) in feature space. The line-angle attention enhancement block achieves innovation through dual-channel parallel computation: on the one hand, it retains the linear distance metric based on the difference in feature vector magnitudes to capture explicit numerical correlations; on the other hand, it innovatively introduces the cosine value of the angle between feature vectors as an angle feature metric to specifically capture implicit correlations with consistent directions in high-dimensional space. By dynamically fusing these two metrics to generate attention weights, this module can accurately capture short-term dependencies between adjacent time steps and effectively uncover long-distance temporal correlations that are far apart but physically related. This innovative design enables the model to better recognize the characteristic patterns of "numerical jumps but consistent trends" during tool wear, solving the problem that traditional attention mechanisms are prone to losing key temporal correlations during nonlinear degradation, and significantly improving the modeling accuracy of non-stationary sensor data under complex cutting conditions.

[0047] 2. The contrast-driven feature aggregation module in this invention achieves a mechanism innovation in feature enhancement and noise suppression. Its core breakthrough lies in introducing the idea of ​​"contrastive learning" into the temporal feature aggregation process. It innovatively uses a "feature-prototype" bidirectional comparison mechanism to actively distinguish effective features related to tool wear from redundant noise caused by environmental interference. Traditional feature aggregation methods (such as convolution, pooling, or simple concatenation) mostly use indiscriminate weighting or statistical aggregation, which essentially processes the input features holistically. They cannot specifically enhance sensitive features closely related to wear status, nor can they suppress noise signals such as random vibration and temperature drift in the cutting environment. For example, sudden mechanical vibration during the cutting process may form a significant feature numerically, but it is actually unrelated to tool wear. Traditional methods treat it the same as the real wear features, leading to model learning bias. The innovation of the contrast-driven feature aggregation module lies in its two-stage contrast logic: First, by constructing a "wear prototype feature library" (typical feature templates extracted from historical wear data), the input features are compared with prototype features to quantify the "wear correlation" of each feature; second, a "noise prototype" (typical interference patterns extracted from the data through unsupervised learning) is innovatively introduced to conduct a reverse comparison and remove redundant information that is highly similar to the noise prototype. Through this bidirectional comparison, the module can dynamically assign higher weights to effective features while adaptively suppressing noise features, achieving "targeted enhancement" rather than "overall processing." This design solves the inherent defect of traditional aggregation methods that "treat effective features and noise indiscriminately," and is particularly suitable for scenarios such as tool cutting where effective signals are often masked by strong noise. This allows the model to focus more on the essential characteristics of wear degradation, significantly improving the robustness of feature representation under complex working conditions. Attached Figure Description

[0048] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0049] Figure 1 The overall flowchart of a tool remaining life prediction method based on line angle attention and contrast-driven aggregation provided by the present invention;

[0050] Figure 2 This is an architectural diagram of the line-corner attention enhancement block provided by the present invention;

[0051] Figure 3 This is an architecture diagram of the comparison-driven feature aggregation module provided by the present invention;

[0052] Figure 4 This is a schematic diagram of the training loss curve of the tool remaining life prediction model by the method of the present invention;

[0053] Figure 5 This is a schematic diagram of the MAE curve trained by the method of the present invention for predicting the remaining tool life.

[0054] Figure 6 This is a schematic diagram showing the comparison between the actual and predicted values ​​of the tool remaining life prediction model using the method of the present invention.

[0055] Figure 7 The residual image of the training set;

[0056] Figure 8 This is a comparison chart of the predictive effects of the present invention and existing technologies based on two evaluation indicators. Detailed Implementation

[0057] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0058] Please refer to Figures 1-8 This illustration demonstrates a specific implementation of this embodiment. This embodiment designs a network comprising dual feature dimensionality reduction, a line-angle attention enhancement block, and a contrast-driven feature aggregation module. This model effectively solves the technical challenges of traditional methods under complex cutting conditions, such as severe feature redundancy and noise interference, insufficient capture of long-term dependencies, and weak generalization ability. It can accurately extract key features strongly correlated with tool wear, efficiently capture long-distance temporal correlations during cutting, and specifically enhance effective wear information while suppressing redundant noise. Experimental verification shows that the model's mean absolute error (MAE) and root mean square error (RMSE) on public datasets (training on C1 and C6, testing on C4) are significantly better than existing methods. It successfully achieves high-precision prediction of tool remaining life under complex cutting environments, providing technical support for intelligent control of machining processes, optimization of equipment maintenance costs, and improvement of production efficiency.

[0059] Please refer to Figure 1 This embodiment proposes a tool remaining life prediction method based on line-angle attention and contrast-driven aggregation, which includes the following steps:

[0060] S1. Obtain raw data from multiple channels of sensors, such as vibration, cutting force, and acoustic emission, during the cutting process from public datasets. Clean the raw data, remove outliers and missing values, and retain data from the effective cutting time period.

[0061] In a preferred embodiment, step S1 specifically includes:

[0062] S11. Obtain raw data from multi-channel sensors such as vibration, cutting force, and acoustic emission during the tool cutting process from a public dataset; the public dataset is an open dataset provided by the New York Predictive and Health Management Institute (PHM) in the 2010 High-Speed ​​CNC Machine Tool Health Prediction Competition.

[0063] S12. Preprocess the acquired raw sensor data to eliminate the effects of noise, outliers and missing information;

[0064] S13. By setting a threshold based on the average value of no-load operation, identify and extract the time period when the signal is continuously higher than the threshold, and separate the effective cutting time period data that is only related to tool wear from the original data sequence containing non-effective cutting information such as entry, exit and idling.

[0065] S2. Extract six statistical features from the sensor data for each time window: mean, standard deviation, median, absolute maximum, root mean square, and skewness. Use a dual strategy of Pearson correlation coefficient and grey relational analysis to screen out key features that are strongly correlated with wear status and complete feature dimensionality reduction.

[0066] In a preferred embodiment, step S2 specifically includes:

[0067] S21. Divide the sensor time-series data of the effective cutting period into fixed time windows, each window containing N = Fs × window length data points (Fs is the sampling frequency). Then, process the sensor data sequence within each window... Calculate the following 6 statistical characteristics:

[0068] Mean: ;

[0069] Standard deviation: ;

[0070] Median: After sorting, if For odd numbers, take the middle value; for even numbers, take the average of the two middle values.

[0071] Absolute maximum value: ;

[0072] Root mean square: ;

[0073] Skewness: .

[0074] S22. For the extracted high-dimensional feature matrix, key features are selected through the following two steps:

[0075] Pearson correlation coefficient screening: for features and wear labels Calculate the correlation coefficient :

[0076] ;

[0077] Where M is the number of samples, , They are respectively and The mean, retain Features;

[0078] Grey relational analysis filtering: filtering wear labels As a reference sequence The remaining features are comparison sequences. ,calculate:

[0079] Correlation coefficient: ;

[0080] The resolution coefficient;

[0081] Relevance: ;

[0082] reserve The features are used to complete feature dimensionality reduction.

[0083] S3. Standardize the dimensionality-reduced feature set, scaling the feature values ​​to the [0,1] interval; construct time series samples from the feature set according to the set sequence length, with the input of each sample being the previous... The features at the i-th time step are output as the i-th time step. The remaining lifetime label for each time step;

[0084] In a preferred embodiment, step S3 specifically includes:

[0085] S31. In order to eliminate the influence of different units and numerical ranges between different features, the Min-Max normalization method is used to standardize all features and scale their values ​​to the range of [0,1].

[0086] S32. Define a sequence length. The model observes the past The features from each time step are used to predict the target for the next time step. The matrix is ​​traversed with a step size of 1 across the entire standardized feature matrix, using a step size of [size missing]. The window. Within each window... The rows of data constitute the input sequence of a sample. For each input sequence (It contains data from time step t to t+T-1), assign it a corresponding output label, this label is the first... The remaining lifetime (RUL) value corresponding to the last time step (t+T-1 of the window).

[0087] S4. Construct a deep learning model that includes an initial projection layer, a line-angle attention enhancement block, a contrast-driven feature aggregation module, and a regression prediction head; the line-angle attention enhancement block captures long-distance dependencies in time-series data, the contrast-driven feature aggregation module enhances effective wear features and suppresses redundant noise, and the regression prediction head outputs the remaining lifetime prediction value;

[0088] The remaining life is linked by a "numerical-trend dual-dimensional mapping," which directly reflects the degree of wear and the rate of evolution, thus affecting the accuracy of life prediction. The linear distance corresponds to the Euclidean distance of the feature vectors. When wear intensifies, the numerical amplitude of statistical features such as peak cutting force and vibration intensity will change significantly. The linear distance of the feature vectors at different time steps is positively correlated with the wear rate. The larger the distance, the greater the increase in wear and the faster the remaining life is shortened. The angle difference corresponds to the cosine angle of the feature vectors. Tool wear follows fixed physical laws. Even if there are instantaneous fluctuations in the data, the direction of the feature vectors (the relative change ratio of each statistical feature) remains stable. The smaller the angle difference, the more consistent the wear trend and the more stable the remaining life prediction. When the angle difference changes abruptly, it often corresponds to abnormal wear (such as tool chipping), and the remaining life will be shortened sharply, which can capture the end-of-life signal in advance.

[0089] Compared to existing technologies, line-angle attention captures short-term numerical correlations (wear increments between adjacent time steps) through dual-scale association, while angular features capture long-term trend correlations (wear patterns across time steps), solving the problem of long-term time-series dependency loss in traditional attention. High-dimensional feature decoupling: L2 normalization eliminates scale differences, angular features focus on direction rather than numerical values, filtering meaningless noise, and linear distance retains effective signals, achieving precise separation of noise and effective features. Combining physical meaning with data-driven approaches: feature design aligns with the physical mechanism of wear, avoiding the weak generalization ability of purely data-driven models, maintaining high accuracy under different cutting conditions (such as differences between the C4 test set and training set). Local-global feature fusion: 1D deep convolution is added to extract local instantaneous features (such as sudden changes in cutting force peaks), which are fused with global "distance + angle" feature residuals, capturing both the overall wear evolution and identifying key wear nodes, improving the accuracy of prediction details.

[0090] Based on the "Eigenvector Space Mapping Theory," the distance and angle of high-dimensional eigenvectors can completely characterize the statistical characteristics and trends of the original data. Linear distance corresponds to the amplitude difference of the signal (L2 norm), and angle corresponds to the trend consistency of the signal (cosine similarity). The sensor signal changes caused by tool wear are essentially a combination of "gradual amplitude growth" and "trend stability." The dual-feature design of line-angle attention perfectly matches this signal characteristic, making the feature representation closer to the physical essence. Tool wear follows a three-stage dynamic law of "initial rapid break-in → mid-term stable wear → late-stage accelerated wear." During the break-in stage, the sensor data fluctuates greatly, but the wear trend (angle feature) gradually stabilizes. The introduction of angle weight can avoid prediction deviations caused by data fluctuations. During the stable wear stage, the linear distance and angle feature change synergistically to accurately quantify the wear rate. During the accelerated wear stage, the linear distance increases sharply, while the angle feature maintains consistency. The model can quickly identify the critical state of the end of the tool's life.

[0091] The Q, K, V normalization design of line angle attention is based on the "gradient stability theory": L2 normalization makes the scale of Q and K vectors uniform, avoiding gradient explosion caused by numerical differences during training. The coefficient design of attention calculation formula is based on the feature balance principle. The contribution of dual features is dynamically optimized through backpropagation to achieve the best fusion effect and improve the convergence stability of the model. Compared with the existing single feature selection method, it greatly improves the generalization ability of the model.

[0092] As a preferred embodiment, such as Figure 2 , Figure 3 As shown, step S4 specifically includes:

[0093] S41. Set a 1D convolutional layer as the initial projection layer. Its input channel count matches the sensor feature dimension, and its output channel count is a dynamically adjusted high-dimensional feature channel count (ensuring it is divisible by the number of multi-head attention heads). Use a SAME Padding strategy with a kernel size of 3 to ensure the temporal length remains constant. The following convolutional operations map the original sensor features to a high-dimensional feature space, providing a foundation for subsequent feature processing:

[0094] ;

[0095] in, For input sensor features ( For batch size, For feature dimension, (time length) For convolution kernel weights, For bias terms, These are the high-dimensional features after projection;

[0096] S42, Construction The projection module maps high-dimensional features to queries through a linear layer. ,key ,value It is also broken down into sub-features with a preset number of heads, supporting parallel computation of multi-head attention: After splitting ( For the number of attention heads, (For single-head dimension). and L2 normalization is performed to eliminate feature scale differences and improve the stability of attention computation;

[0097] ;

[0098] ;

[0099] An attention computation module is constructed, which captures global context features through matrix multiplication and combines residual connections to alleviate gradient vanishing, thereby generating global attention features:

[0100] ;

[0101] ;

[0102] A 1D deep convolutional layer is added to extract local temporal features. The local features are added to the residuals of the global attention features to form a dual-scale enhanced feature of "global dependency + local detail". Finally, multi-head features are fused through a linear layer to output a unified-dimensional temporal feature.

[0103] In this application, the design innovates in three dimensions: feature normalization, attention calculation method, and multi-scale feature fusion. It solves the problems of scale sensitivity, insufficient long dependency capture, and fragmentation of multi-scale information in the traditional attention mechanism in time series data processing. Compared with existing methods (such as traditional self-attention, CNN attention, etc.), it has significant advantages in the representation accuracy, computational stability and multi-scale correlation capture ability of time series features, and provides a more efficient feature modeling scheme for time series-related tasks such as tool remaining life prediction.

[0104] S43. Construct a pseudo-mask generation module, calculate the temporal dimension variance of features, and generate a foreground mask (wear-related feature region) and a background mask (noise region) using the sigmoid activation function:

[0105] ;

[0106] in For variance calculation, These are the mean and standard deviation of the variance, respectively. To prevent zero constant.

[0107] Set up foreground and background attention modules to amplify wear features and attenuate noise features through attention weights:

[0108] ;

[0109] ;

[0110] This represents the attention weight.

[0111] A local context grouping convolutional layer is constructed to extract local dependencies. A gated fusion module is set up, and the weight coefficients are output through softmax to adaptively weight and fuse the "foreground enhancement + background suppression" features with local features.

[0112] ;

[0113] in For gating weights, Local contextual features;

[0114] In this application, the design achieves innovation in three dimensions: objectivity of mask generation, targeted feature enhancement, and complementarity of multi-scale fusion. It solves the problems of "confusion between effective features and noise, and fragmentation of multi-scale information" in traditional feature aggregation methods. Compared with existing methods (such as ordinary convolution aggregation, simple attention weighting, etc.), it has significant advantages in the robustness of feature representation, the accuracy of noise suppression, and the ability to capture multi-scale correlations. It provides a more efficient feature aggregation scheme for tasks that rely on effective feature extraction, such as tool life prediction.

[0115] S44. Set up an adaptive average pooling layer to perform global average pooling on the aggregated temporal features, compressing the variable-length temporal features into a fixed-dimensional feature vector.

[0116] A fully connected network is constructed, with three fully connected layers set sequentially. The first fully connected layer maps the pooled feature vector to 48 dimensions, the second layer maps it to 24 dimensions, and the third layer outputs a 1-dimensional prediction value. The ReLU activation function is set between adjacent fully connected layers to introduce non-linear transformation.

[0117] Dropout regularization layers (with dropout probabilities set to 0.2 and 0.1 respectively) are added between fully connected layers to suppress model overfitting;

[0118] Finally, the sigmoid activation function is set to normalize the predicted values ​​to the [0,1] interval, resulting in a prediction result consistent with the remaining lifetime label range.

[0119] S5. Merge datasets C1 and C6 as training data, and use dataset C4 as independent test data. Use mean squared error (MSE) as the loss function, and train the model using AdamW optimizer and cosine annealing learning rate scheduling strategy. Prevent gradient explosion by gradient clipping, and save the model weights with the minimum training loss during the training process.

[0120] In a preferred embodiment, step S5 specifically includes:

[0121] S51. Merge the features and labels of the C1 and C6 datasets as training data, use the C4 dataset as independent test data, standardize all data, and construct time series samples.

[0122] S52. Loss function: Mean squared error (MSE) is used.

[0123] Optimizer: The AdamW optimizer is used, and weight decay is set to prevent overfitting;

[0124] Learning rate scheduling: A cosine annealing learning rate scheduling strategy is adopted;

[0125] Gradient clipping: Gradient clipping is performed after backpropagation to prevent gradient explosion;

[0126] S53. The model is trained in a loop. Each iteration includes forward propagation, loss calculation, backpropagation and parameter update. After each training cycle, the model weights with the minimum training loss are saved.

[0127] S6. Input the test set data into the trained model to obtain the remaining life prediction value; evaluate the model performance by mean absolute error (MAE) and root mean square error (RMSE) to verify the model's generalization ability under complex cutting conditions.

[0128] In a preferred embodiment, step S6 specifically includes:

[0129] S61. Load the trained optimal model weights and set the model to evaluation mode;

[0130] S62. Load the C4 test set and perform the same preprocessing and sequence construction as the training data.

[0131] S63. Input the test data into the model to obtain the predicted value of the remaining lifespan;

[0132] S64. Calculate and output metrics such as MAE and RMSE to verify the model's generalization ability under complex working conditions.

[0133] In addition, in this embodiment, to verify the tool remaining life prediction method based on line angle attention and contrast-driven aggregation proposed in this invention, the following experimental examples were also conducted:

[0134] This method was implemented on the open dataset of the 2010 High-Speed ​​CNC Machine Tool Health Prediction Competition by the New York Society for Predictive and Health Management. 315 passes were performed on six tools, and vibration signals, cutting force signals, and acoustic emission signals generated by the milling cutters during machining were collected. This invention uses datasets C1, C4, and C6 as the dataset.

[0135] As an explanation, Figure 4 and Figure 5 The diagram shows the training loss curve and training MAE curve of the model of this invention. This experiment is based on the PHM 2010 public dataset and selects multi-channel sensor data of three cutting conditions, C1, C4 and C6. First, the original data is cleaned to remove outliers and missing values. Six statistical features are extracted according to the time window: mean, standard deviation, median, absolute maximum, root mean square and skewness. Then, the feature dimensionality is reduced by a dual strategy of Pearson correlation coefficient and grey relational analysis. After that, Min-Max normalization is used to shrink the feature values ​​to the [0,1] interval, and the sequence length T=10 is set to construct time series samples. The C1 and C6 condition data are merged into the training set, and the C4 condition data is used as the test set.

[0136] In terms of model construction, a 1D convolutional layer is used as the initial projection layer (64 output channels, 3 convolutional kernels, SAME Padding, ReLU activation). It integrates a line-angle attention enhancement block (which generates QKV through a fully connected layer, calculates attention weights by combining linear distance and angular features, and then supplements local features through a 1D convolution, with an output dimension of 128) and a contrast-driven feature aggregation module (which generates a pseudo-mask to enhance effective foreground features and suppress background noise, and then gates and fuses the output with a dimension of 64 through a fully connected layer). Finally, an adaptive average pooling layer and a 3-layer fully connected network (64→48→24→1, with ReLU activation in the first two layers and Sigmoid activation in the output layer, and a dropout probability of 0.2 between layers) are used as the regression prediction head.

[0137] During training, the MSE loss function and AdamW optimizer (initial learning rate 0.001, weight decay 0.0001) were used. , ), combined with a cosine annealing learning rate scheduling strategy ( , The minimum learning rate is 0.00001, and the maximum gradient norm is set to 1.0 for gradient clipping. The model is trained for 500 rounds with a batch size of 32, and the model weights with the minimum training loss are saved.

[0138] During the evaluation phase, the optimal model is loaded to predict the test set, and the model's generalization ability under complex cutting conditions is verified by mean absolute error (MAE) and root mean square error (RMSE).

[0139] Depend on Figure 4 As can be seen, the model of this invention continuously improves its fit to the training data, the loss function converges quickly, and it can gradually learn the patterns in the data.

[0140] Depend on Figure 5 It can be seen that the model of this invention reflects the average level of the absolute error between the model's predicted values ​​and the true values. Its rapid decrease and eventual stabilization further verify that the model's prediction accuracy on the training set continuously improves, and that the accuracy remains stable in the later stages of training, indicating that the model performs well on the training set. Figure 6 As can be seen, in the comparison curve between the actual value and the predicted value, the overall trend of the model prediction curve is highly consistent with the actual remaining life curve, which can accurately capture the degradation law of the remaining tool life. This further verifies that the model of the present invention has high accuracy in predicting the remaining tool life, and exhibits good performance under complex cutting conditions. It can provide reliable technical support for the intelligent management of the entire tool life cycle.

[0141] Figure 7 The residual plot shows that the residuals are randomly distributed around the 0 baseline with no obvious trend, indicating that the model error is unbiased, the prediction is relatively stable, and the overall performance is healthy.

[0142] Figure 8 Comparing this invention with existing technologies, it is evident that this invention significantly improves the tool life prediction performance, demonstrating its technical advantages and innovation. Therefore, the wear identification method proposed in this invention is reliable.

[0143] In summary, the tool remaining life prediction model proposed in this invention integrates a line-angle attention enhancement block and a contrast-driven feature aggregation module to construct a solution for accurate prediction of remaining life from multi-channel sensor data feature extraction. In the data processing stage, the model employs a dual feature dimensionality reduction strategy of "Pearson correlation coefficient + grey relational analysis" to effectively filter key wear features. In terms of model architecture, the line-angle attention mechanism breaks through the limitation of traditional attention relying solely on distance, capturing the implicit temporal correlation of tool wear in high-dimensional space through angle features. The contrast-driven feature aggregation module specifically enhances effective wear information and suppresses redundant noise; the synergy of both significantly improves the accuracy and robustness of feature representation. During the training phase, multiple tool datasets (C1 and C6 are trained together, C4 is tested independently) and optimization strategies such as cosine annealing learning rate scheduling and gradient pruning are used to ensure the model's generalization ability in complex cutting environments. Experimental results show that the model's prediction curve on the test set is highly consistent with the actual remaining life, fully verifying its comprehensive innovation and breakthrough in feature extraction, temporal modeling and generalization capabilities. It provides efficient and reliable technical support for the intelligent management of the entire life cycle of cutting tools in machining processes, and has important engineering application value and industrialization prospects.

[0144] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for predicting remaining tool life based on line-angle attention and contrast-driven aggregation, characterized in that, Includes the following steps: S1. Obtain the raw data of multi-channel sensors for vibration, cutting force and acoustic emission during tool cutting from public datasets, and define them as datasets C1, C4 and C6. Clean the raw data, remove outliers and missing values, and retain the data of the effective cutting period. S2. Extract six statistical features from the sensor data for each time window: mean, standard deviation, median, absolute maximum, root mean square, and skewness. Use a dual strategy of Pearson correlation coefficient and grey relational analysis to screen out key features that are strongly correlated with wear status and complete feature dimensionality reduction. S3. Standardize the feature set after dimensionality reduction, scaling the feature values ​​to the [0,1] interval; construct the feature set into time series samples according to the set sequence length, with the input of each sample being the features of the first N time steps and the output being the remaining lifetime label of the Nth time step. S4. Construct a deep learning model comprising an initial projection layer, a line-angle attention enhancement block, a contrast-driven feature aggregation module, and a regression prediction head. The line-angle attention enhancement block captures short-term numerical correlations through dual-scale association, while linear distance captures short-term numerical correlations and angular features capture long-term trend correlations. The contrast-driven feature aggregation module actively distinguishes effective features related to tool wear from redundant noise caused by environmental interference through a "feature-prototype" bidirectional comparison mechanism. Its specific steps are as follows: First, by constructing a wear prototype feature library, the input features are compared with prototype features to quantify the wear correlation of each feature. Second, a noisy prototype is introduced, and a reverse comparison is performed to remove redundant information highly similar to the noisy prototype. The line-angle attention enhancement block captures long-distance dependencies in time-series data, the contrast-driven feature aggregation module enhances effective wear features and suppresses redundant noise, and the regression prediction head outputs the remaining life prediction value. S5. Merge datasets C1 and C6 as training data, and use dataset C4 as independent test data. Use mean squared error as the loss function, and train the model using AdamW optimizer and cosine annealing learning rate scheduling strategy. Prevent gradient explosion by gradient clipping, and save the model weights with the minimum training loss during the training process. S6. Input the test set data into the trained model to obtain the remaining life prediction value; evaluate the model performance by mean absolute error and root mean square error, and verify the model's generalization ability under complex cutting conditions.

2. The tool remaining life prediction method based on line-angle attention and contrast-driven aggregation according to claim 1, characterized in that, Step S1 specifically includes the following process: S11. Preprocess the acquired raw sensor data to eliminate the effects of noise, outliers and missing information; S12. By setting a threshold based on the average value of no-load operation, identify and extract the time period when the signal is continuously higher than the threshold, and separate the effective cutting time period data that is only related to tool wear from the original data sequence containing non-effective cutting information such as entry, exit and idling.

3. The tool remaining life prediction method based on line-angle attention and contrast-driven aggregation according to claim 1, characterized in that, Step S2 specifically includes the following operation process: S21. Divide the sensor time-series data of the effective cutting period into fixed time windows, each window containing N = Fs × window length data points, and process the sensor data sequence within the window. Perform calculations on six types of statistical characteristics; S22. For the extracted high-dimensional feature matrix, key features are selected through the following two steps: Pearson correlation coefficient screening: for features and wear labels Calculate the correlation coefficient : ; Where M is the number of samples, , They are respectively and The mean, retain Features; Grey relational analysis filtering: filtering wear labels As a reference sequence The remaining features are comparison sequences. ,calculate: Correlation coefficient: ; Relevance: ; reserve The features are used to complete feature dimensionality reduction.

4. The tool remaining life prediction method based on line-angle attention and contrast-driven aggregation according to claim 1, characterized in that, Step S3 specifically includes: S31. Use the Min-Max normalization method to standardize all features and scale their values ​​to the range of [0,1]. S32. Define a sequence length. The model observes the past The features from each time step are used to predict the target for the next time step. The feature matrix is ​​slid across a size of 1 step over the entire standardized feature matrix. The window, within each window The rows of data constitute the input sequence of a sample. For each input sequence Assign a corresponding output label to it, this label is the first one. The remaining lifetime value corresponding to each time step.

5. The tool remaining life prediction method based on line-angle attention and contrast-driven aggregation according to claim 1, characterized in that, The specific process for step S4 is as follows: S41. Set a 1D convolutional layer as the initial projection layer. Its input channel number is consistent with the sensor feature dimension, and its output channel number is the dynamically adjusted high-dimensional feature channel number. Use the SAME Padding strategy with a convolutional kernel size of 3 to ensure that the temporal length remains unchanged. Map the original sensor features to the high-dimensional feature space through convolution operation to provide a foundation for subsequent feature processing. S42, Construction The projection module maps high-dimensional features to queries through a linear layer. ,key ,value And split it into sub-features with a preset number of heads, for and L2 normalization is performed to eliminate feature scale differences and improve the stability of attention computation; An attention computation module is constructed to capture global context features through matrix multiplication, and combine residual connections to alleviate gradient vanishing and generate global attention features. A 1D deep convolutional layer is added to extract local temporal features. The local features are added to the residuals of the global attention features to form a dual-scale enhanced feature of "global dependency + local detail". Finally, multi-head features are fused through a linear layer to output a unified-dimensional temporal feature. S43. Construct a pseudo-mask generation module, calculate the feature temporal dimension variance, generate foreground and background masks through the sigmoid activation function, set foreground and background attention modules, amplify wear features and attenuate noise features through attention weights, construct local context grouping convolutional layers to extract local dependencies, set a gated fusion module, output weight coefficients through softmax, and adaptively weightedly fuse "foreground enhancement + background suppression" features with local features. S44. Set an adaptive average pooling layer to perform global average pooling on the aggregated temporal features, compressing the variable-length temporal features into a fixed-dimensional feature vector. A fully connected network is constructed, with three fully connected layers set sequentially. The first fully connected layer maps the pooled feature vector to 48 dimensions, the second layer maps it to 24 dimensions, and the third layer outputs a 1-dimensional prediction value. The ReLU activation function is set between adjacent fully connected layers to introduce non-linear transformation. Add dropout regularization layers between fully connected layers to suppress model overfitting; Finally, the sigmoid activation function is set to normalize the predicted values ​​to the [0,1] interval, resulting in a prediction result consistent with the remaining lifetime label range.

6. The tool remaining life prediction method based on line-angle attention and contrast-driven aggregation according to claim 1, characterized in that, Step S5 includes the following processing flow: S51. Standardize all data from C1, C4, and C6, and construct time series samples; S52. The model is trained in a loop. Each iteration includes forward propagation, loss calculation, backpropagation and parameter update. After each training cycle, the model weights with the minimum training loss are saved.

7. The tool remaining life prediction method based on line-angle attention and contrast-driven aggregation according to claim 1, characterized in that, Step S6 includes the following processing flow: S61. Load the trained optimal model weights and set the model to evaluation mode; S62. Load the C4 test set and perform the same preprocessing and sequence construction as the training data. S63. Input the test data into the model to obtain the predicted value of the remaining lifespan; S64. Calculate and output the MAE and RMSE indices to verify the model's generalization ability under complex working conditions.

Citation Information

Patent Citations

  • Numerical control machine tool cutter remaining service life prediction method and system and application

    CN113560955A

  • Numerical control machine tool machining cutter state real-time prediction method

    CN114952422A