A tool wear state monitoring method and system based on a hybrid algorithm

By combining CNN and Transformer algorithms, a CNN-Transformer model is constructed, which solves the problems of low accuracy and low efficiency in tool wear prediction in existing technologies, and realizes efficient and accurate tool wear condition monitoring.

CN118237979BActive Publication Date: 2026-08-04HARBIN UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HARBIN UNIV OF SCI & TECH
Filing Date
2024-04-18
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

Existing technologies cannot effectively capture the time dependence of tool wear processes, resulting in low accuracy and efficiency in wear prediction, and existing methods increase hardware costs.

Method used

A tool wear monitoring method based on a CNN-Transformer hybrid algorithm is adopted. Local features are extracted through a three-layer 1D-CNN structure, and global dependencies are analyzed by combining the Transformer module to construct a CNN-Transformer model for tool wear monitoring.

Benefits of technology

It enables efficient and accurate real-time monitoring of tool wear without increasing hardware costs, thus improving prediction accuracy and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118237979B_ABST
    Figure CN118237979B_ABST
Patent Text Reader

Abstract

The application discloses a tool wear state monitoring method and system based on a hybrid algorithm, and on the basis of constructing a cutting data set, a CNN-Transformer model is constructed by combining a convolutional neural network capable of efficiently processing local features and a parallel computing Transform model for monitoring the tool wear state in the cutting process, so that the local and global features of the cutting force signal are simultaneously paid attention to and the network complexity is reduced; and the tool wear state can be monitored based on the cutting process physical signal, and the monitoring result is more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of metal cutting, and more particularly to a method and system for monitoring tool wear status based on a CNN-Tranformer hybrid algorithm for finishing difficult-to-machine materials in the aerospace field. Background Technology

[0002] The parts in the aerospace field have complex structures and require high machining accuracy and surface quality. They often use difficult-to-machine materials with excellent comprehensive properties such as high temperature resistance and corrosion resistance. This results in rapid tool wear, short tool life, and unstable tool life during the cutting process. The wear condition of the tool is an important factor affecting the quality of the workpiece.

[0003] Tool condition monitoring can monitor the wear status of tools in real time, promptly detect abnormal wear, and is crucial for reducing the risk of tool breakage. Simultaneously, it can predict the remaining tool life, providing a reference for production planning and avoiding production losses caused by sudden tool failure. Furthermore, it can maintain machining accuracy and maximize tool life by providing corrective measures for tool wear. Therefore, tool wear condition monitoring is of great significance in the milling of difficult-to-machine materials for aerospace applications with high precision and high quality requirements.

[0004] Many current methods for tool condition monitoring are based on artificial neural networks to learn tool wear-sensitive features. However, most of them lack simultaneous attention to the correlation between short-term and long-term time series, thus having certain limitations in capturing dynamic time dependencies.

[0005] Convolutional Neural Networks (CNNs) extract features from input information using operations such as convolutional and pooling layers. The increased depth and complexity of the network can make local feature extraction more accurate to some extent. However, the convolutional operation in CNNs is not very effective in extracting global features of tool cutting, which can easily lead to insufficient feature discrimination.

[0006] While Transformer-based target tracking algorithms can effectively capture global information during the cutting process, they are less efficient than CNNs in extracting local features. Furthermore, they require significantly more computational resources and time compared to CNN-based target tracking algorithms, placing higher demands on hardware and increasing the cost of tool monitoring. Consequently, users and manufacturers often abandon this monitoring method altogether. Additionally, for sequential data consisting of individual data points during the cutting process, such as raw cutting force sensor data, the sheer volume of time-series data and the low information capacity of individual data points make it difficult for Transformer models to establish effective connections between different time steps. Therefore, the accuracy and timeliness of tool monitoring during cutting are questionable.

[0007] Therefore, feature extraction methods are needed to convert time-series data consisting of single data points in a single milling data file into a time-series sequence composed of feature vectors, thereby reducing the amount of time-series data and providing better input to the Transformer model. Summary of the Invention

[0008] The technical problem this invention aims to solve is: addressing the issue that existing technologies cannot dynamically capture time dependence, resulting in low accuracy and efficiency in tool wear prediction. This invention provides a tool wear state monitoring method and system based on a CNN-Tranformer hybrid algorithm, reducing network complexity and thus enabling efficient, accurate, and real-time monitoring of tool wear state without increasing hardware costs.

[0009] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:

[0010] On the one hand, this application provides a tool wear condition monitoring method based on a hybrid algorithm, characterized by the following steps:

[0011] Obtain the true value of the tool flank wear, and simultaneously collect the cutting force signal corresponding to each true value of wear to construct a cutting dataset;

[0012] The cutting force signal is input into the CNN-Transformer model, which includes a three-layer 1D-CNN structure for feature extraction and a Transformer module for wear prediction.

[0013] The three-layer 1D-CNN structure extracts tool wear-sensitive features from the input cutting force signal as local features;

[0014] The Transformer module analyzes the global dependencies between the extracted local features and obtains the tool wear prediction value based on the global dependencies.

[0015] In the above technical solution, for the same cutting parameters, the actual value of the flank wear of multiple tools during each wear process is collected.

[0016] In the above technical solution, the specific process of obtaining the true value of the tool flank wear includes: using an industrial camera to photograph the tool flank wear condition, and collecting the maximum value of the flank wear at different cutting distances for each tool in the initial wear, normal wear and rapid wear stages.

[0017] In the above technical solution, the cutting force signal includes cutting forces in three directions.

[0018] In the above technical solution, the processing of cutting force signals by the CNN-Transformer model includes the CNN-Transformer model training process:

[0019] The cutting force signal and cutting dataset are input into the CNN-Transformer model for iterative training. After each iteration, the predicted wear value and the actual wear value are substituted into the loss function between them to calculate the loss, and the weight threshold of the CNN-Transformer model is updated and optimized until the model converges; thus, the optimal CNN-Transformer model is obtained.

[0020] In the above technical solution, the CNN-Transformer model processes the cutting force signal through the following steps:

[0021] Based on the input cutting force signal, the three-layer 1D-CNN structure sequentially convolves the cutting force signal through the 1D-CNN convolution kernels of each layer. The convolution kernels are set to slide upwards in a one-dimensional time series with a certain stride to extract local features of the cutting force signal. Then, batch normalization (BN) uses the mean and standard deviation of the mini-batch to adjust the output of the deep neural network training samples. The local features output by the previous layer are combined along the feature dimension to generate a new time series, which is then used as the input of the next one-dimensional convolutional neural network layer.

[0022] In the above technical solution, the CNN-Transformer model processes the cutting force signal through the following steps:

[0023] The local features output from the last layer of the three-layer 1D-CNN structure are processed by two multi-layer networks and then sequentially passed through a third network to obtain the prediction result. The two multi-layer networks have identical structures, each including a multi-head attention mechanism layer, a residual connection and batch normalization layer, a feedforward network layer, and another residual connection and batch normalization layer. The multi-head attention mechanism includes Matmul, Score, SoftMax, and Matmul modules, used to fit the input features using a similarity matrix. The residual connection and batch normalization layer compresses the input data to highlight sensitive features while reducing the model parameter size. The feedforward neural network layer consists of two fully connected layers; the first layer uses ReLU as its activation function, while the second layer does not use an activation function, introducing non-linear modeling capabilities to the model. The third network includes an averaging layer, a fully connected layer, a batch normalization and linear rectified function layer, and another fully connected layer. The fully connected layer, where each node is connected to all nodes in the previous layer, integrates the previously extracted features, performs a linear transformation on the input data to obtain the output, and inputs the extracted features back into the fully connected layer to achieve the mapping between features and tool wear values.

[0024] In the above technical solution, the loss function is minimized by the Adam optimizer, and L2 regularization is introduced to obtain the following formula for the loss function between the predicted and actual tool wear values:

[0025]

[0026] In the formula, n is the signal length; y is the predicted value of tool flank wear; i λ is the actual value of the tool's flank wear; λ is the regularization factor; w is the weight vector.

[0027] On the other hand, the present invention also protects a tool wear condition monitoring system based on a hybrid algorithm, characterized by comprising:

[0028] Signal acquisition module: configured to acquire the cutting force signal of the tool to be monitored;

[0029] Feature extraction module: configured to use a three-layer 1D-CNN structure of CNN-Transformer model for preprocessing to extract tool-sensitive features;

[0030] Prediction module: configured to input the tool-sensitive features into the Transformer module of the trained optimal CNN-Transformer model to obtain the tool wear prediction value.

[0031] In the above technical solution, each layer of the three-layer 1D-CNN structure includes a convolutional layer, a BN&ReLU layer, and a Dropout layer; the sequence length N after convolution by the convolutional kernels of the convolutional layers can be calculated as follows:

[0032]

[0033] Where W is the length of the one-dimensional time series input, K is the kernel size, P is the number of padding loops, and S is the stride.

[0034] In the above technical solution, the cutting force signal is convolved sequentially by the 1D-CNN convolution kernels of each layer; the convolution kernels are set to slide upwards in a one-dimensional time series with a certain step size, thereby extracting local features of the cutting force signal; then, batch normalization (BN) uses the mean and standard deviation of a small batch to adjust the output of the deep neural network training samples; the local features output by the previous layer are combined along the feature dimension to generate a new time series and serve as the input of the next one-dimensional convolutional neural network layer.

[0035] In the above technical solution, the Transformer module consists of three parts: the first and second parts have the same structure, including a multi-head attention mechanism layer, a residual connection and batch normalization layer, a feedforward network layer and a residual connection and batch normalization layer; the third part includes an averaging layer, a fully connected layer, a batch normalization and linear rectified function layer, and a fully connected layer.

[0036] In another aspect, the present invention also protects a readable storage medium having a computer program stored thereon, characterized in that the program, when executed by a processor, implements the steps of a CNN-Tranformer-based tool wear condition monitoring method.

[0037] In another aspect, the present invention also protects a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the program to implement the steps of a CNN-Tranformer-based tool wear condition monitoring method.

[0038] Compared with the prior art, the present invention has the following main advantages:

[0039] This invention, through cutting tool wear monitoring, reveals a need to better utilize local and global feature information to improve model prediction performance while reducing the computational complexity of neural networks, in order to achieve cost-effective, efficient, and accurate wear monitoring. Existing technologies addressing these needs have not yet been disclosed.

[0040] This invention, based on the construction of a cutting dataset, focuses on both the local and global features of the cutting force signal and reduces network complexity. It combines a convolutional neural network that efficiently processes local features with a parallelizable Transformer model to construct a CNN-Transformer model for monitoring tool wear during the cutting process. This method can monitor tool wear based on the physical signals of the cutting process, resulting in more accurate monitoring results.

[0041] This invention uses a three-layer 1D-CNN structure to efficiently extract tool wear-sensitive features from cutting force signals.

[0042] This invention uses a transformer structure based on a multi-head attention mechanism, combined with a residual network to eliminate the overfitting problem caused by deep networks, thus predicting tool wear values ​​more accurately and reliably. Attached Figure Description

[0043] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 This is a schematic diagram of the tool wear condition monitoring method and system based on CNN-Tranformer of the present invention.

[0045] Figure 2 This is a structural diagram of the CNN-Tranformer model of the present invention.

[0046] Figure 3 This is a one-dimensional convolutional neural network (1D-CNN) used in a certain embodiment of the present invention. Detailed Implementation

[0047] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0048] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0049] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0050] In the description of this application, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly used when the product of this application is in use. They are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation on this application. In addition, the terms "first," "second," and "third," etc., are only used to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0051] Furthermore, terms such as "horizontal," "vertical," and "sag" do not imply that components must be absolutely horizontal or suspended, but rather that they can be slightly tilted. For example, "horizontal" simply means that its direction is more horizontal relative to "vertical," and does not mean that the structure must be completely horizontal, but can be slightly tilted.

[0052] In the description of this application, it should also be noted that, unless otherwise expressly specified and limited, the terms "set up," "install," "connect," and "link" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.

[0053] In this application, unless otherwise expressly specified and limited, "above" or "below" the second feature can include direct contact between the first and second features, or contact between the first and second features through another feature between them. Furthermore, "above," "over," and "on top" of the second feature includes the first feature being directly above or diagonally above the second feature, or simply indicates that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature includes the first feature being directly below or diagonally below the second feature, or simply indicates that the first feature is at a lower horizontal level than the second feature.

[0054] The features and performance of this application will be further described in detail below with reference to the embodiments.

[0055] Example 1

[0056] like Figure 1-3This application provides a tool wear state monitoring method based on CNN-Transformer, including acquiring the cutting force signal of the tool to be monitored, and using a CNN-Transformer model to obtain the tool wear prediction value; wherein the three-layer 1D-CNN structure focuses on efficient processing of local information, and the Transformer structure focuses on parallel computation of global information, to obtain the tool wear prediction value, thereby realizing online real-time monitoring of tool wear; the steps are as follows:

[0057] To acquire the cutting force signal of the tool to be monitored, 1D-CNN first processes the input signal and extracts local features. Then, Transformer further analyzes the global dependencies between these features and synthesizes the prediction results to achieve online real-time monitoring of tool wear. Combining 1D-CNN and Transformer can take advantage of their strengths in processing local and global information, thereby improving the accuracy of tool wear prediction.

[0058] The process involves acquiring the cutting force signal of the tool to be monitored, and preprocessing it using a three-layer 1D-CNN model to extract tool-sensitive features; specifically:

[0059] Using the same cutting parameters, the true value of the flank wear (VB) of multiple tools during each wear process is collected, and the corresponding cutting force signal is also collected to construct a cutting dataset. The cutting force signal is then input into a three-layer 1D-CNN model to extract tool wear-sensitive features.

[0060] The three-layer 1D-CNN model specifically includes: each layer includes a convolutional layer, a BN&ReLU layer and a Dropout layer, wherein the convolutional kernel size K=5, the number of padding loops P=2, and the stride S=2; the number of convolutional kernels in the first layer of the model is F=32; the number of kernels in the second layer of the model is F=64; and the number of kernels in the third layer of the model is F=128.

[0061] The length N of the sequence after convolution by the convolution kernel can be calculated as follows:

[0062]

[0063] Where W is the length of the one-dimensional time series input, K is the kernel size, P is the number of padding loops, and S is the stride;

[0064] The activation function in the BN&ReLU layer is the ReLU function, expressed as follows:

[0065]

[0066] Where x is the independent variable;

[0067] In the BN&ReLU layer, batch normalized BN can prevent gradient vanishing and exploding, and allow the ReLU function to better perform feature selection.

[0068] The Dropout layer can further prevent overfitting, with a probability p = 0.2;

[0069] The method for obtaining the trained optimal Transformer model is as follows:

[0070] Constructing the Transformer model: The Transformer model consists of three parts: The first and second parts have the same structure, including a multi-head attention mechanism layer, a residual connection and batch normalization layer, a feedforward network layer and a residual connection and batch normalization layer; the third part includes an averaging layer, a fully connected layer, a batch normalization and linear rectified function layer, and a fully connected layer.

[0071] The multi-head attention mechanism includes Matmul, Score, SoftMax, and Matmul, and the model principle is based on equations (3) to (6):

[0072] MultiHead(Q,K,V)=concat(head1,head2,...,head n W O (3)

[0073] head i =Attention(Q) i ,K i V i (4)

[0074]

[0075]

[0076] In the formula, Q, K, and V represent the three weight matrices for query, key, and value, respectively; X is the input matrix; i is the index of the attention heads, satisfying 1≤i≤n, and n is the number of heads in the multi-head attention mechanism, where n=4; W i Q W i K and W i V Let be the trainable parameter matrices of the i-th head, and satisfy . d is a dimension and d k =d v =d model / n;

[0077] The residual connections and batch normalization layers can improve the stability of deep network training and prevent model overfitting.

[0078] The feedforward neural network (FFN) layer enhances the model's representational power; the model consists of two fully connected layers, with the first layer using ReLU activation and the second layer not using an activation function; the FFN calculation formula is as follows:

[0079] FFN(x)=max(0,XW1+b1)W2+b2 (7)

[0080] Where X is the input feature, W1 and W2 are the weights of the first and second layers, and b1 and b2 are the biases of the first and second layers;

[0081] The third part includes two Linear layers used in conjunction with BN & ReLU layers to prevent vanishing and exploding gradients and improve the accuracy of object detection; the fully connected layer (Linear layer) performs a linear transformation on the input data to obtain the output; the fully connected layer has 3 layers, and the output can be represented as:

[0082]

[0083] In the formula, w k and b k These are the feature weight parameter matrix and bias vector of the fully connected layer, respectively. The parameters are updated through backpropagation. i-1 The input feature vector is i, where i is the index and k is the layer number.

[0084] By minimizing the loss function of the Adam optimizer and introducing L2 regularization, the formula for the loss function between the predicted and actual tool wear values ​​can be obtained as follows:

[0085]

[0086] In the formula, m is the signal length; y is the predicted value of tool flank wear; i λ is the actual value of tool flank wear; λ is the regularization factor; w is the weight vector;

[0087] The training process of the CNN-Transformer model specifically includes: inputting the cutting force signal into the model for iterative training; after each iteration, substituting the predicted wear value and the actual wear value into equation (9) to calculate the loss function loss, and updating and optimizing the weight threshold of the CNN-Transformer model until the model converges; and obtaining the optimal CNN-Transformer model.

[0088] Model convergence refers to the loss function value stabilizing and no longer decreasing.

[0089] Example 2

[0090] like Figure 1-3 To address the problem of low prediction accuracy and efficiency caused by the inability of existing tool wear condition monitoring methods to simultaneously and efficiently capture local and global features, this embodiment provides a CNN-Tranformer-based tool wear condition monitoring method that can efficiently and accurately monitor tool wear condition in real time. The method includes the following steps:

[0091] The cutting force signal of the tool to be monitored is acquired, and the tool wear prediction value is obtained by using a CNN-Transformer model. The three-layer 1D-CNN structure focuses on the efficient processing of local information, while the Transformer structure focuses on the parallel computation of global information to obtain the tool wear prediction value, thereby realizing online real-time monitoring of tool wear.

[0092] The process involves acquiring the cutting force signal of the tool to be monitored, and preprocessing it using a three-layer 1D-CNN model to extract tool-sensitive features; specifically:

[0093] Using the same cutting parameters, the true value of the flank wear (VB) of multiple tools during each wear process is collected, and the corresponding cutting force signal is also collected to construct a cutting dataset. The cutting force signal is then input into a three-layer 1D-CNN model to extract tool wear-sensitive features.

[0094] Preferably, the cutting parameters are a cutting speed of 131.88 m / min, a feed per tooth of 0.02 mm / z, an axial depth of cut of 20 mm, and a radial depth of cut of 0.1 mm. The multiple cutting tools are three solid carbide end mills, and the workpiece material is titanium alloy Ti-6Al-4V. The specific process for obtaining the true value of the tool flank wear includes:

[0095] The wear condition of the tool back face was captured by a Daheng M231 industrial camera, which includes a CCD industrial camera, focusing lens, adjustable LED aperture, camera bracket and power supply. The maximum value VB of the back face wear at different cutting distances of each tool was collected.

[0096] The cutting force signal includes cutting forces in three directions: Fx, Fy, and Fz. The specific equipment for acquiring the cutting force signal includes a hardware system and a software system. The hardware system specifically includes a KISTLER 9139A triaxial piezoelectric force gauge and a DH5922 data acquisition box. The software system specifically refers to Kistler's DynoWare 3.2.2.0-1.0 software. The cutting force signal acquisition frequency is 10kHz. A cutting data set is constructed, with each of the cutting force signal segments Fx, Fy, and Fz corresponding to a tool wear value VB, totaling 60 sets of cutting data.

[0097] Preferably, a three-layer 1D-CNN model is used to extract features from the cutting force signal. This reduces the amount of time-series data while introducing a multi-dimensional semantic space, converting the vector of the input cutting force signal into queries and keys. This efficiently captures important correlations in the time series during the cutting process, learning short-term correlations and local features of the time series. Specifically, the three-layer 1D-CNN model includes: each layer comprising a convolutional layer, a BN&ReLU layer, and a Dropout layer, where the convolutional kernel size K=7, the number of padding loops P=3, and the stride S=2; the number of convolutional kernels in the first layer is F=32; in the second layer, F=64; and in the third layer, F=128.

[0098] The convolution kernel slides upwards along a one-dimensional time series with a certain stride, thereby extracting local features of the cutting force signal. The length N of the convolved sequence can be calculated as follows:

[0099]

[0100] The activation function in the BN&ReLU layer is the ReLU function, which enhances the nonlinear characteristics of the network. The expression is as follows:

[0101]

[0102] In the BN&ReLU layer, Batch Normalized BN uses the mean and standard deviation of mini-batches to adjust the output of the deep neural network training samples. Through normalization, the distribution of features in each layer of the network is stabilized as much as possible, which can speed up the convergence speed, effectively alleviate overfitting, prevent gradient vanishing and exploding, and allow the ReLU function to better perform feature selection.

[0103] The Dropout layer further prevents overfitting. With a probability of p in the Dropout layer, the probability of each neuron connecting to subsequent neurons is 1-p. This means the architecture randomly disables the activation function with probability p, and the Dropout layer has p = 0.2. Since neurons are randomly selected, co-adaptation is avoided, resulting in meaningful features independent of other neurons. All local features are combined along the feature dimension to generate a new time series, which serves as the input to the next one-dimensional convolutional neural network layer.

[0104] The method for obtaining the trained optimal Transformer model is as follows:

[0105] Preferably, the Transformer model is a model that utilizes a multi-head attention mechanism to improve model training speed and quality. It can effectively capture global information in the input data and has excellent parallel processing capabilities. The model consists of three parts: the first and second parts have the same structure, including a multi-head attention mechanism layer, a residual connection and batch normalization layer, a feedforward network layer, and a residual connection and batch normalization layer; the third part includes an averaging layer, a fully connected layer, a batch normalization and linear rectified function layer, and a fully connected layer.

[0106] The multi-head attention mechanism can effectively solve the attention bias problem that may exist in a single self-attention mechanism. It includes Matmul, Score, SoftMax and Matmul. The model principle is based on equations (3) to (6):

[0107] MultiHead(Q,K,V)=concat(head1,head2,...,head n W O (3)

[0108] head i =Attention(Q) i ,K i V i (4)

[0109]

[0110]

[0111] In the formula, Q, K, and V represent the three weight matrices for query, key, and value, respectively; X is the input matrix; i is the index of the attention heads, satisfying 1≤i≤n, and n is the number of heads in the multi-head attention mechanism, which is n=4 in this paper. W i Q W i K and Wi V Let be the trainable parameter matrices of the i-th head, and satisfy . d is a dimension and d k =d v =d model / n.

[0112] The input feature matrix X undergoes a linear transformation as shown in equation (6) above, resulting in a parameter matrix generated by matrix multiplication. The resulting trainable parameter matrices Q, K, and V are then input into a multi-head attention mechanism to enhance the model's fitting ability. Q and K are processed by MatMul to generate a similarity matrix. Each element of the similarity matrix is ​​divided by d. k The square root of the result is then normalized using the Softmax function, making each value a weight coefficient greater than 0 and less than 1.

[0113] The residual connections and batch normalization layers can compress the input data size by half while ensuring full utilization of information, further highlighting sensitive features. At the same time, they can also reduce the model parameter size, solve the phenomenon that the network accuracy tends to saturate as the depth increases, and minimize the overall network error through the skip connection residual structure, improve the stability of the deep network training process, and prevent model overfitting.

[0114] The feedforward neural network (FFN) layer introduces non-linear modeling capabilities and enhances the model's representational power. The model consists of two fully connected layers (MLP: Multilayer Perceptron). The first layer uses ReLU as its activation function, while the second layer does not use an activation function. The calculation formula is as follows:

[0115] FFN(x)=max(0,XW1+b1)W2+b2 (7)

[0116] The third part includes two Linear layers used in conjunction with BN & ReLU layers to prevent vanishing and exploding gradients and improve the accuracy of object detection. The fully connected layer (Linear layer) integrates the extracted features, where each node is connected to all nodes in the previous layer. Its key feature is that it performs a linear transformation on the input data to obtain the output. The extracted features are input into the fully connected layer to map the features to tool wear values. The fully connected layer has three layers, and each neuron in the network is connected to all neurons in the previous layer. The output can be represented as:

[0117]

[0118] In the formula, w k and b kThese are the feature weight parameter matrix and bias vector of the fully connected layer, respectively. The parameters are updated through backpropagation. i-1 This is the input feature vector.

[0119] By using the loss function minimized by the Adam optimizer and introducing L2 regularization, the loss function formula between the predicted and actual tool wear values ​​can be obtained as follows:

[0120]

[0121] In the formula, n is the signal length; y is the predicted value of tool flank wear; i λ is the actual value of the tool's flank wear; λ is the regularization factor; w is the weight vector.

[0122] The training parameters of the Transformer model specifically include: a maximum number of iterations of 500, a number of layers of 2, a Dropout ratio of 0.2, and a learning rate of 0.0001. The model training process specifically includes: inputting the cutting force signal into the model for iterative training; after each iteration, substituting the predicted wear value and the true value into equation (9) to calculate the loss function, and updating and optimizing the weight thresholds of the CNN-Transformer model until the model converges. Model convergence specifically refers to the loss function value stabilizing and no longer decreasing.

[0123] Example 3

[0124] like Figure 1-3 This embodiment provides a tool wear condition monitoring system based on CNN-Tranformer, including:

[0125] Signal acquisition module: configured to acquire the cutting force signal of the tool to be monitored;

[0126] Feature extraction module: configured to use a three-layer 1D-CNN model for preprocessing to extract tool-sensitive features;

[0127] Prediction module: configured to input the tool-sensitive features into the trained optimal Transformer model to obtain the tool wear prediction value.

[0128] The implementation of the specific modules in this embodiment refers to the steps of the tool wear state monitoring method based on CNN-Tranformer described in Embodiment 1, and will not be described in detail here.

[0129] Example 4

[0130] This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps of the tool wear condition monitoring method based on CNN-Tranformer described in Embodiment 1.

[0131] Example 5

[0132] This embodiment provides a computer-readable storage medium storing a computer program, characterized in that, when executed by a processor, the program implements the steps of the CNN-Tranformer-based tool wear condition monitoring method described in Embodiment 1.

[0133] The embodiments described above are some, but not all, of the embodiments of this application. The detailed description of the embodiments of this application is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

Claims

1. A method for monitoring the state of tool wear based on a hybrid algorithm, characterized in that Includes the following steps: The true value of tool flank wear is obtained, and the cutting force signal corresponding to each true value of wear is collected to construct a cutting dataset; the true value of tool flank wear is the maximum value of flank wear in the initial wear, normal wear and rapid wear stages of each tool under different cutting distances; the cutting force signal includes cutting force in the x, y and z directions. The cutting force signal is input into the CNN-Transformer model, which includes a three-layer 1D-CNN structure for feature extraction and a Transformer module for wear prediction. The three-layer 1D-CNN structure extracts tool wear-sensitive features from the input cutting force signal as local features; The Transformer module analyzes the global dependencies between the extracted local features and obtains the tool wear prediction value based on the global dependencies.

2. The hybrid algorithm based tool wear state monitoring method according to claim 1, characterized in that The specific process for obtaining the true value of tool flank wear includes: using an industrial camera to photograph the tool flank wear condition, and collecting the maximum value of flank wear at different cutting distances for each tool during the initial wear, normal wear, and rapid wear stages.

3. The hybrid algorithm based tool wear state monitoring method according to claim 1, characterized in that The processing of cutting force signals by the CNN-Transformer model includes the CNN-Transformer model training process: The cutting force signal and cutting dataset are input into the CNN-Transformer model for iterative training. After each iteration, the predicted wear value and the actual wear value are substituted into the loss function between them to calculate the loss, and the weight threshold of the CNN-Transformer model is updated and optimized until the model converges; thus, the optimal CNN-Transformer model is obtained.

4. The hybrid algorithm based tool wear state monitoring method according to claim 1, characterized in that The CNN-Transformer model processes the cutting force signal through the following steps: Based on the input cutting force signal, the three-layer 1D-CNN structure sequentially convolves the cutting force signal through the 1D-CNN convolution kernels of each layer; the convolution kernels are set to slide upwards in a one-dimensional time series with a certain step size, thereby extracting local features of the cutting force signal; Subsequently, Batch Normalization (BN) uses the mean and standard deviation of mini-batches to adjust the output of the deep neural network training samples; the local features of the previous layer's output are combined along the feature dimension to generate a new time series, which is then used as the input to the next one-dimensional convolutional neural network layer.

5. The hybrid algorithm based tool wear state monitoring method according to claim 1, characterized in that The CNN-Transformer model processes the cutting force signal through the following steps: The local features output from the last layer of the three-layer 1D-CNN structure are processed by two multi-layer networks and then sequentially passed through a third network to obtain the prediction result. The two multi-layer networks have identical structures, each including a multi-head attention mechanism layer, a residual connection and batch normalization layer, a feedforward network layer, and another residual connection and batch normalization layer. The multi-head attention mechanism includes Matmul, Score, SoftMax, and Matmul modules, used to fit the input features using a similarity matrix. The residual connection and batch normalization layer compresses the input data to highlight sensitive features while reducing the model parameter size. The feedforward network layer consists of two fully connected layers; the first layer uses ReLU as its activation function, while the second layer does not use an activation function, introducing non-linear modeling capabilities to the model. The third network includes an averaging layer, a fully connected layer, a batch normalization and linear rectified function layer, and another fully connected layer. The fully connected layer, where each node is connected to all nodes in the previous layer, integrates the previously extracted features, performs a linear transformation on the input data to obtain the output, and inputs the extracted features back into the fully connected layer to achieve the mapping between features and tool wear values.

6. The hybrid algorithm based tool wear state monitoring method according to claim 1, characterized in that By minimizing the loss function of the Adam optimizer and introducing L2 regularization, the formula for the loss function between the predicted and actual tool wear values ​​is as follows: ; wherein n is the signal length; is the tool flank wear prediction value; is the tool flank wear actual value; λ is the regularization factor; is the weight vector.

7. A tool wear state monitoring system based on a hybrid algorithm, characterized by include: Signal acquisition module: configured to acquire the cutting force signal of the tool to be monitored; Feature extraction module: configured to use a three-layer 1D-CNN structure of CNN-Transformer model for preprocessing to extract tool-sensitive features; Prediction module: configured to input the tool-sensitive features into the Transformer module of the trained optimal CNN-Transformer model to obtain the tool wear prediction value.

8. The hybrid algorithm based tool wear monitoring system according to claim 7, characterized in that The three-layer 1D-CNN structure includes a convolution layer, a BN&ReLU layer, and a Dropout layer in each layer; the convolution layer has a convolution kernel N This can be calculated as follows: ; wherein, W is the length of the input one-dimensional time series, K is the size of the convolution kernel, P is the number of padding circles, S is the step.

9. The hybrid algorithm based tool wear monitoring system according to claim 7, wherein The Transformer module consists of three parts: the first and second parts have the same structure, including a multi-head attention mechanism layer, a residual connection and batch normalization layer, a feedforward network layer and a residual connection and batch normalization layer; the third part includes an averaging layer, a fully connected layer, a batch normalization and linear rectified function layer, and a fully connected layer.