CNN-LSTM cutter wear prediction method fusing attention mechanism
Through the CNN-LSTM model with fusion attention mechanism and combined with signal processing technology, the problem of tool wear prediction in the prior art requires manual extraction of features, achieving higher prediction accuracy and real-time performance.
Patent Information
- Application Number
- CN202411901912.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-03-25
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, tool wear prediction methods require manual extraction of features, which is time-consuming and labor-intensive, and have poor prediction results.
A CNN-LSTM tool wear prediction method with a fusion attention mechanism is proposed. By collecting three-way cutting force and three-way vibration signals during the cutting process, combining the interquartile distance method and wavelet threshold method for signal processing, the CNN-LSTM model is constructed and an attention mechanism is introduced to extract the spatial and timing characteristics of the signal.
This method can effectively reduce the interference of outliers and noise on the model and improve prediction accuracy. It has higher prediction accuracy than CNN or CNN-LSTM models alone.
Smart Images

Figure CN119681714A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of mechanical processing, and in particular to a CNN-LSTM tool wear prediction method integrating an attention mechanism. Background Art
[0002] The tool is one of the important main parts of CNC machine tools. During the cutting process, force and thermal load act on the tool at the same time, which makes the tool easy to wear. The wear amount gradually increases with time, and eventually leads to tool failure. The wear state of the tool directly affects the surface quality and production efficiency of the workpiece. If the worn or damaged tool is not discovered and replaced in time, it will not only affect the surface quality of the workpiece, but also threaten the normal operation of the equipment and the life safety of the operator. Therefore, it is necessary to establish an effective tool wear prediction method to detect tool wear failure in time.
[0003] The degree of tool wear is usually judged subjectively by humans based on information such as vibration during cutting and machine tool load. There is no reliable basis for judgment and it lacks accuracy. With the development of sensor technology and artificial intelligence, it is now possible to install sensors on existing machine tools to monitor signals such as force, vibration, acoustic emission and current generated during the processing process, and use intelligent models to predict the degree of tool wear, which has better real-time performance and avoids manual judgment of the degree of tool wear based on experience.
[0004] At present, most of the research on tool wear prediction uses machine learning algorithms or deep learning algorithms to predict tool wear by constructing a nonlinear mapping model between tool wear and monitoring signals during the cutting process. However, most machine learning algorithms only have a shallow network structure and require manual extraction of tool wear characteristics, which is time-consuming and labor-intensive. They are also prone to losing or ignoring the intrinsic time information of the cutting signal, so the prediction effect is not good.
[0005] Compared with the machine learning model, the tool wear prediction model based on deep learning can overcome the problem that machine learning requires manual extraction of tool wear characteristics and has better prediction performance. Summary of the invention
[0006] The purpose of the present invention is to propose a CNN-LSTM tool wear prediction method integrating attention mechanism in view of the shortcomings of the prior art, which mainly solves the problems that the tool wear prediction method based on machine learning needs to rely on manual feature extraction and is time-consuming and labor-intensive.
[0007] To achieve the above purpose, the technical solution of the present invention is as follows: A CNN-LSTM tool wear prediction method integrating attention mechanism proposed in the present invention adopts the following steps:
[0008] S1: Collect three-dimensional cutting force and three-dimensional vibration signals during the cutting process, and obtain the tool wear after each cutting is completed.
[0009] S2: The interquartile range method is used to detect abnormal signals. After the abnormal values of the signal data are detected, the abnormal values are removed from the normal data, and then one-dimensional linear interpolation is used to fill in the removed abnormal values.
[0010] S3: Use the wavelet threshold method to reduce the noise of the signal and determine the optimal wavelet parameter combination to improve the noise reduction effect. The configurable parameters include threshold criterion, threshold function, wavelet basis and decomposition scale.
[0011] Under the conditions of the same wavelet basis and decomposition scale, the denoising effects of different threshold criteria and threshold functions are compared, and the appropriate threshold criteria and threshold function are selected. Then, the selected threshold criteria and threshold function are used as wavelet denoising parameters, and the denoising effects of different wavelet bases and decomposition scales are compared to select the appropriate wavelet basis and decomposition scale, and then determine the best wavelet parameter combination.
[0012] S4: Build a CNN-LSTM model with integrated attention mechanism.
[0013] S4.1: This model consists of CNN structure, LSTM structure, attention mechanism structure, and fully connected layer.
[0014] S4.2: The CNN structure has four convolution units, each of which consists of a convolution layer and a pooling layer. A one-dimensional convolutional neural network (CNN) is used to convolve the signal. The convolution kernel size is 3, the step size is 1, and the convolution kernel moves in a single direction, sliding from left to right to compress the input information. A RELU activation function is added after the convolution layer, and a maximum pooling layer is selected. The pooling kernel of the pooling layer is 3 and the step size is 2.
[0015] S4.3: Add an LSTM structure after the CNN structure and use the long short-term neural network (LSTM) to extract the temporal features of the signal. The number of input channels of the LSTM structure is the number of outputs of the last convolutional layer, and the number of neurons in the hidden layer is 32.
[0016] S4.4: Add an attention mechanism structure after the LSTM layer to increase the weight of key features, strengthen the model's learning of distinctive features, and make the model more focused on the parts of the input sequence that are more important to the current task.
[0017] S4.5: Add a fully connected layer after the attention mechanism structure with 32 input channels and 1 output channel to predict tool wear.
[0018] S5: In order to verify the effectiveness of the model proposed in the present invention, the CNN-LSTM model with integrated attention mechanism proposed in the present invention is compared with the CNN model and the CNN-LSTM model. Four performance indicators are used to evaluate the model, including mean absolute error (MAE), root mean square error (RMSE), mean absolute percentage error (MAPE) and determination coefficient (R 2 ), the calculation formulas of these four performance indicators are as follows:
[0019]
[0020]
[0021]
[0022]
[0023] Where: N is the number of cutting times; is the predicted value; x i is the true value; is the average of the true values.
[0024] The beneficial effects of the present invention are as follows:
[0025] The present invention adopts the interquartile range method to detect outliers. After detecting the outliers in the signal data, the outliers are removed from the normal data, and then one-dimensional linear interpolation is used to fill in the removed outliers, which can reduce the interference of the outliers on the model.
[0026] The present invention adopts the wavelet threshold method to perform noise reduction processing on the signal and selects the best wavelet parameter combination, which can reduce the interference of signal noise on the model.
[0027] The present invention constructs a CNN-LSTM tool wear prediction model integrating the attention mechanism. The CNN structure extracts signal spatial features, the LSTM structure extracts signal temporal features, and the attention mechanism structure enhances the weights of key features. Compared with a single CNN model and a CNN-LSTM model, the model has higher prediction accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 is a flow chart of the method of the present invention;
[0029] Figure 2 This is the principle diagram of the interquartile range method;
[0030] Figure 3 This is the principle diagram of the wavelet threshold method;
[0031] Figure 4 This is the structure diagram of the CNN-LSTM model that integrates the attention mechanism;
[0032] Figure 5 is the signal before removing outliers;
[0033] Figure 6 is the signal after removing outliers;
[0034] Figure 7 This is a schematic diagram for comparing SNR evaluation indicators;
[0035] Figure 8 This is a schematic diagram of the comparison of NCC evaluation indicators;
[0036] Fig. 9 This is a schematic diagram of the comparison of RMSE evaluation indicators;
[0037] Fig.10 is the signal before noise reduction;
[0038] Fig.11 is the signal after noise reduction;
[0039] Fig.12 This is the tool wear prediction result of the CNN model;
[0040] Fig.13 This is the tool wear prediction result of the CNN-LSTM model;
[0041] Fig.14 Tool wear prediction results of the CNN-LSTM model integrating the attention mechanism. DETAILED DESCRIPTION
[0042] In order to explain the technical content and effects of the present invention in detail, the following description and explanation are given in conjunction with the drawings and examples. It should be understood that the embodiments described herein are only used to illustrate and explain the present invention and are not used to limit the present invention.
[0043] like Figure 1 In the present invention, a CNN-LSTM tool wear prediction method integrating attention mechanism is provided. The method mainly predicts tool wear by collecting tool vibration signals and cutting force signals. The specific steps are as follows:
[0044] S1: Use a tool to process the workpiece on a CNC machine tool, collect the X, Y, and Z cutting force and vibration signal data when the tool processes the workpiece, and measure and record the tool wear after each cutting.
[0045] S2: Figure 2The interquartile range method is used to detect outliers in the collected cutting force and vibration signals. The interquartile range (IQR) is the difference between the upper quartile (Q3) and the lower quartile (Q1), that is, Q3-Q1. Data points that are less than the lower quartile minus 1.5 times the interquartile range or greater than the upper quartile plus 1.5 times the interquartile range are defined as outliers. Points that exceed the upper or lower limit are defined as outliers. The detected outliers are removed from the normal data, and then one-dimensional linear interpolation is used to fill in the deleted outliers. The interpolation formula is as follows:
[0046]
[0047] Where: y1 and y2 are the values of the known points; x1 and x2 are the horizontal coordinates of the known points; x is the horizontal coordinate of the unknown point; y is the value of the unknown point.
[0048] S3: Figure 3 , the signal is denoised by wavelet threshold denoising, and the input signal is decomposed into three layers of wavelets to obtain approximate wavelet coefficients (CA1~3) and detail wavelet coefficients (CD1~3). The approximate wavelet coefficients are the low-frequency part of the signal, and the detail wavelet coefficients are the high-frequency part of the signal. The signal noise is mainly distributed in the high-frequency area. The detail wavelet coefficients are threshold-shrinked, and finally the shrunken signal is reconstructed to obtain the denoised signal. In order to test the effect of wavelet threshold denoising, the signal-to-noise ratio (SNR), waveform similarity coefficient (NCC) and root mean square error (RMSE) are used to compare and analyze the denoising results. The definitions of SNR, NCC and RMSE are:
[0049]
[0050]
[0051]
[0052] In the formula: P s is the signal power; P n is the noise power; x is the original signal; is the reconstructed signal; N is the signal length.
[0053] Selecting appropriate wavelet parameters is the key to improving the noise reduction effect. The configurable parameters include threshold criterion, threshold function, wavelet basis and decomposition scale.
[0054] First, select the threshold criterion and threshold function. In wavelet analysis, sqtwolog, rigrsure and minimaxi threshold criteria are often used. Commonly used threshold functions include soft threshold function and hard threshold function.
[0055] The soft threshold function expression is as follows:
[0056]
[0057] The hard threshold function expression is as follows:
[0058]
[0059] Where: jk is the wavelet coefficient; λ is the threshold.
[0060] Since the soft threshold function and hard threshold function are simple in principle and easy to calculate, they are widely used. The denoising effects of different threshold criteria and threshold functions are compared under the same wavelet basis and decomposition scale. By comparing the evaluation index values, the appropriate threshold criterion and threshold function are selected.
[0061] The selected threshold criterion and threshold function are used as wavelet denoising parameters, and the denoising effects of different wavelet bases and decomposition scales are compared to select the appropriate wavelet base and decomposition scale. The commonly used wavelet bases are db2-10 wavelet, coif1-5 wavelet and sym2-8 wavelet. The larger the decomposition scale, the stronger the ability to separate noise. However, too large a decomposition scale will cause distortion of the reconstructed signal, and repeated experiments on the decomposition scale are required.
[0062] S4: Construct a CNN-LSTM model integrating attention mechanism, such as Figure 4 shown.
[0063] S4.1: The model consists of CNN structure, LSTM structure, attention mechanism structure and fully connected layer.
[0064] S4.2: The CNN structure has four convolution units, each of which consists of a convolution layer and a pooling layer. One-dimensional convolution is used to convolve the signal. The convolution kernel size is 3 and the step size is 1. The convolution kernel slides in a single direction from left to right in sequence with a moving step of 1. By setting a reasonable step size, the input information can be compressed.
[0065] For multi-layer networks, an activation function is needed to map the input data to a nonlinear feature space, which enables the network model to have better expression ability during training. The RELU function is a nonlinear function with flexible and simple characteristics. The RELU activation function is added after the convolution layer. The expression of the RELU activation function is as follows:
[0066]
[0067] When the input is greater than 0, the original value is returned. When the input is less than or equal to 0, the value 0 is returned. Its function is to set all negative values to 0 and keep positive values unchanged. The model's ability to handle nonlinearity is guaranteed without eliminating neurons. The RELU function has the advantages of saving computational costs and sparse representation capabilities. It simplifies the model and accelerates the learning speed of the model, which is beneficial to network optimization, can avoid the problem of gradient disappearance, and is suitable for training deeper networks.
[0068] The pooling layer uses the maximum pooling layer with a pooling kernel of 3 and a step size of 2. It moves to the right in sequence and then takes the maximum value of each step. After each pooling operation, the number of parameters will be reduced, which can reduce the amount of network calculations, improve the training speed of the model, and to a certain extent alleviate the overfitting of the convolutional neural network. At the same time, it improves the robustness of the extracted features. A pooling layer will be added after the convolution layer of the CNN structure.
[0069] S4.3: After extracting the spatial features of the signal, the CNN structure also needs to extract the temporal features of the signal. LSTM is a special recurrent neural network that has a good effect on feature extraction of data in terms of time series characteristics and can avoid long-term dependency problems. Therefore, an LSTM structure is added after the CNN structure. The number of input channels is the number of outputs of the last convolutional layer, and the number of neurons in the hidden layer is 32.
[0070] S4.4: Construct an attention mechanism structure after the LSTM structure to enhance the weights of key features so that the features extracted from each signal can play a positive role in prediction.
[0071] S4.5: Add a fully connected layer after the attention mechanism structure with 32 input channels and 1 output channel to predict tool wear.
[0072] S5: In order to verify the effectiveness of the model proposed in the present invention, the CNN-LSTM model with integrated attention mechanism proposed in the present invention is compared with the CNN model and the CNN-LSTM model. Four performance indicators are used to evaluate the model, including mean absolute error (MAE), root mean square error (RMSE), mean absolute percentage error (MAPE) and determination coefficient (R 2 ), the calculation formulas of these four performance indicators are as follows:
[0073]
[0074]
[0075]
[0076]
[0077] Where: N is the number of cutting times; is the predicted value; x i is the true value; is the average of the true values.
[0078] Embodiment: Predicting tool wear. The effectiveness and feasibility of the present invention are verified by predicting tool wear.
[0079] 1. Build a cutting signal data acquisition platform, conduct high-speed milling experiments with carbide tools, collect cutting force and vibration signals during the milling process, and measure the wear width of the tool flank after each cutting. A total of 90 sets of experimental data were collected.
[0080] This experiment was carried out on a Dalian three-axis CNC milling machine, the machine model is VDL-1000E; the milling experiment cutter disc is FMR04-100-B32-RD16-06, with a diameter of 100mm; the tool is a WIDIA carbide tool with a diameter of 16mm, and the tool coating is TiAlN; the cutter disc has a total of six tool installation positions, and this experiment has a total of three tools installed, and the installation method is symmetrical. The experiment collects two signals, cutting force and vibration, and each signal collects three channel data in the (x, y, z) direction; the cutting force signal is collected by Kister9139AA piezoelectric dynamometer and 5167A charge amplifier, and the vibration signal is collected by PCB acceleration sensor and PXI NI data acquisition box, with a sampling frequency of 10kHz. After each cutting process is completed, the milling cutter is removed and offline measurement is performed on the tool wear measurement platform to record the wear of the three tools. During the entire milling process, each wear amount corresponds to a set of multi-sensor signal data.
[0081] 2. Outlier processing: The interquartile range method is used to detect outliers on the collected cutting force and vibration signals, and the detected outliers are removed from the normal data. Then one-dimensional linear interpolation is used to fill in the deleted outliers to reduce the impact of outliers on the overall data. The data before and after processing are as follows: Figure 5 , 6 shown.
[0082] 3. Wavelet threshold method for noise reduction: Using the wavelet threshold method for noise reduction, selecting appropriate wavelet parameters is the key to improving the noise reduction effect. The parameters that can be set include threshold criteria, threshold function, wavelet basis, and decomposition scale. Under the conditions of the same wavelet basis and decomposition scale, the noise reduction effects of different threshold criteria and threshold functions are compared. The comparison of noise reduction indicators is shown in Table 1:
[0083] Table 1 Comparison of denoising effects of different threshold criteria and threshold functions
[0084] It can be seen that the rigrsure threshold criterion and the hard threshold function have the best denoising effect, with the largest SNR and NCC values and the smallest RMSE value. Therefore, the rigrsure threshold criterion and the hard threshold function are selected as wavelet denoising parameters.
[0085] The selected rigrsure threshold criterion and hard threshold function are used as wavelet denoising parameters, and the denoising effects of different wavelet bases and decomposition scales are compared to select the appropriate wavelet base and decomposition scale. In the process of repeated experiments, it is found that the best denoising effect is achieved when the decomposition scale is 3 under the same wavelet base. Therefore, the denoising effects of various wavelet bases are compared when the decomposition scale is 3. The denoising evaluation indicators are as follows: Figure 7 , 8 As shown in Figure 9, the denoising results show that the sym4 wavelet base has the largest SNR and NCC values, and the smallest RMSE value, indicating that the sym4 wavelet base has the best denoising effect. At the same time, the denoised signal is most similar to the original signal waveform, and the original characteristics of the signal are retained while filtering the signal. Therefore, the rigrsure threshold criterion, hard threshold function, sym4 wavelet base and decomposition scale 3 are selected as wavelet denoising parameters. The signals before and after denoising are shown in Figure 9. Fig.10 , 11 shown.
[0086] 4. Tool wear prediction: In the milling experiment, a total of 90 milling data were recorded. After every two cuts, the next cutting data was selected as the test set. The remaining data was used to train the tool wear prediction model. The average wear of the three blade flanks of the milling cutter was selected as the tool wear. The data was input into the CNN-LSTM model with the fusion attention mechanism to predict the tool wear. The CNN model, CNN-LSTM model and the proposed CNN-LSTM model with the fusion attention mechanism were selected for comparative analysis. The prediction results of the three models are as follows: Fig.12 , 13 As shown in Figure 14, the prediction evaluation index calculations of the three models are shown in Table 2:
[0087] Table 2 Tool wear prediction evaluation index
[0088] As shown in Table 2, the prediction results of the CNN-LSTM model with the integrated attention mechanism have the smallest MAE, RMSE and MAPE values, and the largest R 2The value indicates that the error value of the prediction result of this method is the smallest. It can be seen from the prediction results that the prediction accuracy of the multi-network structure model is higher than that of the single network. The use of different types of networks to extract features in multiple dimensions can mine deeper information and has stronger expression ability, which further verifies that the CNN-LSTM model integrating the attention mechanism is more superior in tool wear prediction.
[0089] The interquartile range method is used to detect outliers in the collected cutting force and vibration signals, and the detected outliers are removed from the normal data. Then one-dimensional linear interpolation is used to fill the deleted outliers, which can effectively reduce the impact of signal outliers on the model prediction results; the wavelet threshold method is used to reduce the noise of the signal and determine the optimal wavelet parameter combination, which can effectively reduce the impact of noise on the overall quality of the signal; the CNN-LSTM model with integrated attention mechanism has a good effect on the prediction of tool wear. Compared with the CNN model and CNN-LSTM model, it has smaller error and better prediction effect.
[0090] The present invention predicts tool wear, so as to timely discover and replace worn or damaged tools in actual processing, improve the surface quality of workpieces, and ensure the normal operation of equipment and the life safety of operators. It provides certain technical support and can provide a certain theoretical basis for the prediction of tool wear for CNC machine tools.
[0091] Finally, it should be pointed out that the above embodiments are only used as examples to illustrate the technical solutions of the present invention, and are not intended to limit the present invention. Although the present invention has been described in detail according to the preferred embodiments, those skilled in the art should understand that appropriate adjustments can be made to the technical solutions of the present invention or equivalent alternatives can be adopted without violating the core principles and scope of the technical solutions of the present invention.
Claims
1. A CNN-LSTM tool wear prediction method integrating attention mechanism, the method comprising the following steps: S1: using sensors to collect three-dimensional cutting force and three-dimensional vibration signals during the tool cutting process, and obtaining the tool wear amount after each cutting is completed; S2: The interquartile range method is used to detect abnormal signals. After the abnormal values of the signal data are detected, the abnormal values are removed from the normal data, and one-dimensional linear interpolation is used to fill in the deleted abnormal values. The interpolation formula is as follows; Where: y1 and y2 are the values of the known points; x1 and x2 are the horizontal coordinates of the known points; x is the horizontal coordinate of the unknown point; y is the value of the unknown point. S3: Use the wavelet threshold method to reduce the noise of the signal and determine the wavelet parameter combination; S4: Construct a CNN-LSTM model integrating attention mechanism to predict tool wear; S5: In order to verify the effectiveness of the CNN-LSTM model with integrated attention mechanism, the CNN-LSTM model with integrated attention mechanism is compared with the CNN model and the CNN-LSTM model. The mean absolute error (MAE), root mean square error (RMSE), mean absolute percentage error (MAPE) and determination coefficient (R 2 ) to evaluate the prediction effect of the model.
2. According to claim 1, a CNN-LSTM tool wear prediction method integrating attention mechanism is characterized in that: The wavelet threshold method is used to reduce the noise of the signal. The determined wavelet parameter combination is: rigrsure threshold, hard threshold function, sym4 wavelet basis and decomposition scale 3.
3. According to the CNN-LSTM tool wear prediction method integrating attention mechanism in claim 1, it is characterized by: The CNN-LSTM model integrating the attention mechanism is composed of a CNN structure, an LSTM structure, an attention mechanism structure, and a fully connected layer. The CNN structure is used to extract the spatial features of the signal, and the LSTM structure is used to extract the temporal features of the signal. The attention mechanism structure is used to increase the weight of the key features, and finally a fully connected layer is connected to predict the tool wear.
4. According to claim 3, a CNN-LSTM tool wear prediction method integrating attention mechanism is characterized in that: The CNN structure has four convolution units, each of which consists of a convolution layer and a pooling layer. A one-dimensional convolutional neural network is used to convolve the signal with a convolution kernel size of 3 and a step size of 1. A RELU activation function is added after the convolution layer, and a maximum pooling layer is used with a pooling kernel of 3 and a step size of 2.
Citation Information
Patent Citations
Milling tool wear monitoring method based on wavelet noise reduction and attention mechanism fused GRU network
CN114619292A
Aviation numerical control machine tool cutter health monitoring method based on OPC UA
CN116372665A
Double-channel tool wear prediction method based on convolution and attention mechanism
CN117260387A
Prediction method for tool remaining life of numerical control machine tool based on hybrid neural model
US20240061396A1