A tool wear value monitoring method based on an improved Swin-Transformer

By improving the Swin-Transformer model, replacing the MLP structure with residual blocks and reducing the number of stacked blocks, the problems of high computational complexity and large number of parameters in the existing model are solved, and more efficient tool wear monitoring is achieved.

CN117733649BActive Publication Date: 2026-03-17HUBEI UNIV OF AUTOMOTIVE TECH
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The existing Swin-Transformer model has problems such as high computational complexity, large number of parameters, and the need to improve monitoring accuracy and timeliness in tool wear monitoring tasks.

Method used

The MLP structure in the original model was replaced with residual blocks, and the number of stacked blocks in the model was reduced. At the same time, an improved Swin-Transformer model was used to monitor tool wear values, including signal data acquisition, model construction, training and monitoring.

Benefits of technology

It improves the monitoring accuracy and efficiency of the model, reduces the complexity of signal processing, shortens training and monitoring time, and reduces the number of model parameters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117733649B_ABST
    Figure CN117733649B_ABST
Patent Text Reader

Abstract

This invention discloses a tool wear monitoring method based on an improved Swin-Transformer, relating to the field of milling technology. It collects vibration signals, cutting force signals, and acoustic emission signals generated during CNC milling, preprocesses them, and combines these with tool wear values ​​to form a sample dataset. A tool wear monitoring model based on the improved Swin-Transformer is constructed. This model replaces the MLP structure in the original model with residual blocks and reduces the number of stacked blocks, achieving effective and accurate monitoring of tool wear values ​​under the same cutting parameters. This invention has the advantages of an end-to-end network model, small model parameters, high monitoring accuracy, and short monitoring time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of milling technology, specifically a method for monitoring tool wear values ​​based on an improved Swing-Transformer. Background Technology

[0002] During machining, tool wear is inevitable, negatively impacting product quality and production resource consumption. Therefore, effective tool wear monitoring is crucial. In recent years, many scholars have conducted extensive research in the field of Tool Condition Monitoring (TCM). Liu Hongqi et al. extracted features from machine tool spindle motor current signals to monitor tool wear. Tang Shengbing et al. addressed the low accuracy of fixed threshold-based methods due to variable machining parameters by proposing a milling tool breakage monitoring method. Li Bin et al. addressed the difficulty in extracting signal features from models by proposing a tool breakage monitoring method based on SAEs and K-means. Ma Haifeng et al. considered the overlapping of edge samples between classes caused by complex milling processes and proposed a cross-domain tool breakage monitoring method and system based on transfer learning, solving the problem of traditional transfer learning methods' difficulty in cross-domain monitoring. Wu Qiwen et al. addressed the applicability of tool wear monitoring models under multiple working conditions by proposing a tool breakage monitoring system and method based on a novel capsule network.

[0003] To improve the monitoring accuracy of the model under multiple working conditions, Liu Xianli et al. proposed a method for monitoring tool wear under varying working conditions based on VWCTransformer transfer learning. While the Transformer model integrates feature relationships between different locations in an image, its computational complexity increases dramatically with image size. The Swin-Transformer computes self-attention through non-overlapping moving windows and allows cross-window connections. This architecture not only reduces computational complexity but also provides modeling flexibility across various scales.

[0004] Regarding improvements to the Swin-Transformer model, Ye Mingliang et al. replaced the window multi-head self-attention mechanism with a KNN self-attention mechanism, improving the model's effectiveness and accuracy in flame detection. Li Junjie et al. used transfer learning to transfer the pre-trained Swin-Transformer model to the tomato pest and disease detection problem, shortening the model training time while improving the model's recognition accuracy. Li Zitong et al. replaced the multilayer perceptron structure in the Swin-Transformer with multi-scale window attention units, fully integrating multi-scale features of remote sensing images, thereby improving the model's prediction accuracy. However, these models have complex structures, a large number of parameters, and are all applied to image classification tasks. When applied to tool wear monitoring tasks, the monitoring accuracy and timeliness need to be improved. Summary of the Invention

[0005] To address the shortcomings of existing technologies, the present invention aims to provide a tool wear monitoring method based on an improved Swin-Transformer. This method replaces the MLP structure in the original model with residual blocks and reduces the number of stacked blocks in the model, thereby improving the monitoring accuracy and efficiency. Compared with the original model, the improved Swin-Transformer model achieves improved monitoring accuracy and efficiency on the validation dataset.

[0006] To achieve the above objectives, the technical solution adopted by this invention is: a tool wear value monitoring method based on an improved Swin-Transformer, comprising the following steps:

[0007] Step S1. Signal data acquisition;

[0008] Step S2. Construct a tool wear monitoring model based on the improved Swin-Transformer;

[0009] Step S3. Model training;

[0010] Step S4. Use the trained model to predict and monitor tool wear values.

[0011] Based on the above technical solution, in step S1, the signal data includes vibration signals, cutting force signals, and acoustic emission signals generated under the same cutting parameters during CNC machine tool milling.

[0012] Based on the above technical solution, in step S1, the collected signals are separated by removing the signal data from the tool feed and retraction processes and taking the signal data from the stable machining stage. Then, Z-score standardization is performed on each signal. The standardized 7-channel signal data forms the input of the model and is combined with the corresponding wear value to form a dataset.

[0013] Based on the above technical solution, in step S2, the model consists of a partitioning module, four stages, and an output module connected in series. The partitioning module converts the input 7-channel signal data into non-overlapping feature image blocks of W / 4×H / 4×48 so that the model can obtain global information of the signal data. The four stages are used to construct feature maps of different sizes. Except for the first stage, which passes through a linear embedding layer, the other three stages first pass through a Patch Merging layer for downsampling, and then repeatedly stack two Swin Transformer Resblock modules.

[0014] Based on the above technical solution, the Swing Transformer Resblock module consists of a normalization layer, a window multi-head self-attention module, a residual block, and a sliding window multi-head self-attention module. The normalization layer (LayerNorm) reduces the model's dependence on data; the window multi-head self-attention structure (W-MSA) reduces computational complexity by calculating self-attention in non-overlapping local windows and fusing prior knowledge of feature map locality; the residual block (Resblock) improves model monitoring accuracy; and the sliding window multi-head self-attention module (SW-MSA) maintains computational efficiency by moving the window towards the lower right corner while enabling pixel interaction between different windows to better fuse information from the entire cutting process signal.

[0015] Based on the above technical solution, the residual block consists of two one-dimensional convolutional layers with 3 kernels and 1 padding, one Gelu activation function, one Dropout layer, and one residual connection. The output of the first one-dimensional convolutional layer is sequentially processed by the Gelu activation function and the Dropout layer before being input into the second one-dimensional convolutional layer. The output of the second one-dimensional convolutional layer is added to the output of the first one-dimensional convolutional layer to obtain the output of the residual block. The data dimension and feature map size of the input to the residual block are consistent with the output. The one-dimensional convolutional layer (Conv) is used to further mine hidden information in the feature image. The Gelu activation function is used to enhance the non-linear segmentation capability of the model. The Dropout layer prevents overfitting of the model through regularization. The residual connection prevents the gradient vanishing problem caused by excessively deep network layers.

[0016] Based on the above technical solution, the calculation process for two consecutive Swing Transformer Resblocks is as follows:

[0017]

[0018]

[0019]

[0020]

[0021] In the formula, and These represent the output characteristics of the sliding window multi-head self-attention module and the residual block in the l-th Swing Transformer Resblock module, respectively.

[0022] Based on the above technical solution, the output module consists of three consecutive linear regression layers. In the first two linear regression layers, the number of output neurons in each linear regression layer is half the number of corresponding input neurons; the number of output neurons in the third linear regression layer is 1.

[0023] Based on the above technical solution, in step S3, 80% of the dataset is selected as the training set and 20% as the test set. Mean squared error is used as the training loss, and the Adam optimization algorithm is employed for model training. First, the network model is trained using the training set. Then, the trained network model is evaluated on the test set. The testing process uses mean squared error and regression coefficients as standards to evaluate the model's generalization ability. The regression coefficient R... 2 The expression is:

[0024]

[0025] In the formula, n is the number of samples in the dataset, and y i It is the actual value. It is a predicted value. It is the average of the actual values.

[0026] Based on the above technical solution, in step S4, when the real-time detection signal collected by the sensor reaches a certain length, the collected signal is truncated at equal steps and input into the trained model to predict the wear value. The predicted value is then compared with the tool wear threshold to determine whether the tool is worn dull and to remind the staff to replace the tool in time.

[0027] The beneficial effects of this invention are as follows:

[0028] This invention adopts an end-to-end data-driven approach, using the raw signal as input without requiring preprocessing, effectively reducing the complexity of signal processing. Furthermore, it replaces the MLP sub-module in the original SwingTransformer block module with the Resblock module, and reduces the number of layers in the SwingTransformer Resblock module in stage 3 from 6 to 2, shortening the model training and monitoring time, while also reducing the number of model parameters, further improving the model's monitoring accuracy and efficiency. Attached Figure Description

[0029] Figure 1 This is a flowchart of the tool wear value monitoring method based on the improved Swin-Transformer in this invention;

[0030] Figure 2 This is a structural diagram of the tool wear monitoring model based on the improved Swin-Transformer in this invention;

[0031] Figure 3 This is a structural diagram of the Swin-Transformer Resblock module in this invention;

[0032] Figure 4 This is a structural diagram of the residual block in this invention;

[0033] Figure 5 This is a flowchart of the online tool wear monitoring based on the improved Swing-Transformer in this invention;

[0034] Figure 6 This is a schematic diagram illustrating the training loss of the improved Swin-Transform model in this invention;

[0035] Figure 7 This is a schematic diagram illustrating the training loss of the Swin-Transform model in this invention;

[0036] Figure 8 A diagram illustrating the prediction error of the improved Swin-Transformer model;

[0037] Figure 9 This is a schematic diagram illustrating the prediction error of the Swin-Transformer model. Detailed Implementation

[0038] The embodiments of the present invention are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout.

[0039] The following description, in conjunction with the accompanying drawings, further illustrates specific embodiments of the present invention, making the technical solution and its beneficial effects clearer and more explicit. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain the present invention, but should not be construed as limiting the invention.

[0040] See Figure 1 As shown, this embodiment of the invention provides a method for monitoring tool wear values ​​based on an improved Swin-Transformer, including the following steps:

[0041] Step 1: Data Acquisition; Collect vibration signals, cutting force signals, and acoustic emission signals generated during CNC milling operations under the same cutting parameters; Remove the signals from the feed and retraction processes, retaining only the signals from the stable machining phase, and then standardize each signal separately. The standardized 7-channel signal data forms the model input, combined with the corresponding wear values ​​to create a dataset. First, train the network model using the training set, and then evaluate and test the trained network model on the test set.

[0042] Step 2: Improve the construction of the tool wear monitoring model for Swin-Transformer; the improved Swin-Transformer model consists of a patch partition module, four stages, and three linear regression modules connected in series. For example... Figures 2-4 As shown, the partitioning module converts the input 7-channel signal data into non-overlapping feature image patches of W / 4×H / 4×48 so that the model can obtain global information of the signal data; the four stages are used to construct feature maps of different sizes. Except for the first stage, which first passes through a linear embedding layer, the other three stages first pass through a patch merging layer for downsampling, and then repeatedly stack two Swin Transformer Resblock modules.

[0043] The Swin-Transformer Resblock module consists of a normalization layer (Layer Norm), a windowed multi-head self-attention (W-MSA) module, a residual block (Resblock), and a sliding windowed multi-head self-attention (SW-MSA) module. The normalization layer (Layer Norm) reduces the model's dependence on data. The windowed multi-head self-attention (W-MSA) structure reduces computational complexity by calculating self-attention in non-overlapping local windows, fusing prior knowledge of feature map locality. The residual block (Resblock) improves the model's monitoring accuracy. The sliding windowed multi-head self-attention (SW-MSA) module maintains computational efficiency by moving the window towards the lower right corner, while simultaneously enabling pixel interaction between different windows to better fuse information from the entire cutting process.

[0044] The residual block consists of two one-dimensional convolutional layers (Conv) with 3 kernels and 1 padding, one Gelu activation function, one Dropout layer, and one residual connection. The output of the first Conv layer is sequentially fed into the second Conv layer through Gelu and Dropout calculations. The output of the second Conv layer is then added to the output of the first Conv layer to obtain the output of the residual block. The input data dimension and feature map size of the residual block are consistent with the output. The one-dimensional convolutional layers (Conv) are used to further mine hidden information in the feature image. The Gelu activation function is used to enhance the non-linear segmentation capability of the model. The Dropout layer prevents overfitting through regularization. The residual connection prevents the gradient vanishing problem caused by excessively deep network layers. The calculation process of two consecutive Swin Transformer Resblocks is as follows:

[0045]

[0046]

[0047]

[0048]

[0049] In the formula, and These represent the output characteristics of the (S)W-MSA module and the Resblock module in the l-th Swing Transformer Resblock, respectively.

[0050] The output module consists of three consecutive linear regression layers. In the first two linear regression layers, the number of output neurons in each linear regression layer is half the number of corresponding input neurons; the number of output neurons in the third linear regression layer is 1.

[0051] The input 7-channel data is first downsampled through a patching partitioning layer, which expands the feature dimension from 7 to 48 and reduces the feature map size from 224 to 56 to obtain the first feature image;

[0052] The first feature extraction layer includes one linear embedding layer and two Swin-Transformer Resblock modules. The first feature image will first pass through the linear embedding layer to change the dimension, expanding the feature dimension from 48 to 96, while keeping the feature image size unchanged. Then, it will pass through two consecutive Swin-Transformer Resblock modules for upsampling to obtain the second feature image.

[0053] The second feature extraction layer includes one patch merging layer and two Swin-Transformer Resblock modules. The second feature image is first downsampled through the patch merging layer, which expands the feature dimension from 96 to 192 and reduces the feature map size from 56 to 28. Then it is upsampled through two consecutive Swin-Transformer Resblock modules to obtain the third feature image.

[0054] The third feature extraction layer includes one patch merging layer and two Swin-Transformer Resblock modules. The third feature image is first downsampled through the patch merging layer, which expands the feature dimension from 192 to 384 and reduces the feature map size from 28 to 14. Then it is upsampled through two consecutive Swin-Transformer Resblock modules to obtain the fourth feature image.

[0055] The fourth feature extraction layer includes one patch merging layer and two Swin-Transformer Resblock modules. The fourth feature image is first downsampled through the patch merging layer, which expands the feature dimension from 384 to 768 and reduces the feature map size from 14 to 7. Then, it is upsampled through two consecutive Swin-Transformer Resblock modules to obtain the fourth feature image.

[0056] Step 3: Model Training; Select 80% of the dataset as the training set and 20% as the test set, using mean squared error (MSE) as the training loss, and employ the Adam optimization algorithm for model training. First, train the network model using the training set. Then, evaluate the trained network model on the test set. The testing process uses mean squared error and regression coefficients as standards to evaluate the model's generalization ability. The regression coefficient R... 2 The expression is:

[0057]

[0058] In the formula, n is the number of datasets, and y i It is the actual value. It is a predicted value. It is the average of the actual values.

[0059] Step 4: Use the model established in Steps 2 and 3 to predict and monitor wear values. When the real-time detection signal collected by the sensor reaches a certain length, the collected signal is truncated at equal steps and input into the trained model for wear value prediction. The predicted value is then compared with the tool wear threshold to determine whether the tool is worn dull and to remind the operator to replace the tool in time. The monitoring process is as follows: Figure 5 As shown.

[0060] The present invention will be further described below through specific embodiments.

[0061] A method for monitoring tool wear values ​​based on an improved Swin-Transformer includes the following steps:

[0062] Step 1: Sample data acquisition and preprocessing:

[0063] To better illustrate the performance of this invention, the dataset from the PHM Association's 2010 tool remaining life prediction competition was used for experiments. The main equipment used in the experiments included a Roders Tech RFM760 milling machine, a Kistler three-component force gauge, a Kistler three-axis accelerometer, a Kistler acoustic emission sensor, a Kistler charge amplifier, an NIDAQ PCI1200 data acquisition card, a LEICA MZ12 wear measurement device, and a ball-end mill. The experimental parameters were set as follows: spindle speed (RPM) 10400, feed rate (mm / min) 1555, radial depth of cut (mm) 0.125, axial depth of cut (mm) 0.2, climb milling, dry cutting cooling, and HRC52 stainless steel.

[0064] A triaxial force sensor was installed between the workpiece and the worktable. Vibration and acoustic emission signal sensors were installed on the workpiece. The signal sampling frequency was 50kHz. Each pass aimed to complete a 108mm end milling. After each pass, the tool face wear value was measured using a LEICAMZ 12 microscope. Each tool was passed 315 times, resulting in 315 tool wear values. A total of 6 tools were used in the experiment, and data from three tools with known wear values ​​(C1, C4, and C6) were selected. Each sample included a 7-dimensional signal and the flank wear value of the three cutting edges. To prevent interference between different cutting edge wear values, only the maximum value of the three cutting edge wear values ​​was retained.

[0065] After removing the feed and retraction portions of the time-domain signal data from each sample, a tensor of (50176,7) was obtained through secondary sampling. The dataset was then divided into two mutually exclusive training and testing sets in an 8:2 ratio, with 756 samples in the training set and 189 samples in the testing set. The experiment used a Windows 11 system, a 12th generation Intel i7-12700H CPU, and an NVIDIA 3060 graphics card.

[0066] Step 2: Improve the tool wear monitoring model of Swin-Transformer

[0067] The improved Swin-Transformer model consists of a Patch Partition module, four stages, and three linear regression modules connected in series. The four stages are used to construct feature maps of different sizes. Except for the first stage, which first passes through a linear embedding layer, the other three stages first pass through a Patch Merging layer for downsampling, and then repeatedly stack two Swin Transformer Resblock modules.

[0068] The Swin-Transformer Resblock module consists of a normalization layer (Layer Norm), a window multi-head self-attention module (W-MSA), a residual block (Resblock), and a sliding window multi-head self-attention module (SW-MSA).

[0069] The residual block consists of two one-dimensional convolutional layers (Conv) with 3 kernels and 1 padding, one Gelu activation function, one Dropout layer, and one residual connection. The output of the first Conv layer is fed into the second Conv layer through Gelu and Dropout in sequence. The output of the second Conv layer is added to the output of the first Conv layer to obtain the output of the residual block. The data dimension and feature map size of the input to the residual block are the same as those of the output.

[0070] The output module consists of three consecutive linear regression layers. In the first two linear regression layers, the number of output neurons in each linear regression layer is half the number of corresponding input neurons; the number of output neurons in the third linear regression layer is 1.

[0071] Step 3: Model Training

[0072] 80% of the dataset was selected as the training set and 20% as the test set. Mean squared error (MSE) was used as the training loss, and the Adam optimization algorithm was employed for model training. First, the network model was trained using the training set. Then, the trained network model was evaluated on the test set. The generalization ability of the model was assessed using mean squared error, mean absolute error (MAE), and regression coefficient (R²).

[0073] The parameter settings for model training are shown in Table 1.

[0074] Table 1 Model training parameters

[0075]

[0076] The training loss of the Swin-Transformer model and the improved Swin-Transformer model is as follows: Figure 6 and Figure 7 As shown.

[0077] The test set was input into the trained network model for generalization performance evaluation. The test results for the improved Swin-Transformer model and the standard Swin-Transformer model are shown in the table below. Figure 8 and Figure 9 As shown in the figure, the comparison results show that the improved Swin-Transformer model has higher monitoring accuracy than the original Swin-Transformer model on all datasets.

[0078] Table 2 Test results for different models

[0079]

[0080] Table 3 shows the parameter count, training time, and testing time per batch (30 samples) for the improved Swin-Transformer model compared to the original Swin-Transformer model. The comparison results show that the improved Swin-Transformer model has fewer parameters and shorter training and testing times. Therefore, the effectiveness of this invention is demonstrated.

[0081] Table 3. Parameter count and computation time for different models

[0082]

[0083] In actual monitoring, when the real-time detection signal collected by the sensor reaches a certain level, the collected signal is truncated at equal steps and input into the trained model for prediction. The current predicted value is compared with the tool wear threshold to determine whether the wear value has reached the threshold. If the wear threshold is reached, the staff is reminded to replace the tool in time.

[0084] In the description of this specification, references to terms such as "an embodiment," "preferred," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. Illustrative expressions of the above terms in this specification do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0085] This invention is not limited to the embodiments described above. Those skilled in the art can make various improvements and modifications without departing from the principles of this invention, and these improvements and modifications are also considered within the scope of protection of this invention. Contents not described in detail in this specification are prior art known to those skilled in the art.

Claims

1. A tool wear value monitoring method based on an improved Swin-Transformer, characterized in that, The method comprises the following steps: Step S1. Signal data acquisition; Step S2. Constructing a tool wear value monitoring model based on an improved Swin-Transformer; Step S3. Model training; Step S4. Tool wear value prediction and monitoring using the trained model; In step S2, the model is composed of a partition module, four stages and an output module in series; the four stages are used to construct feature maps of different sizes; except that the first stage is first passed through a linear embedding layer, the other three stages are first passed through a Patch Merging layer for down-sampling, and then repeatedly stack two Swin Transformer Resblock modules; In step S3, 80% of the data set is selected as the training set and 20% as the test set, the mean square error is used as the training loss, and the Adam optimization algorithm is used for model training; first, the network model is trained using the training set, and then the trained network model is evaluated and tested on the test set, and the mean square error and the regression coefficient are used as the standard to evaluate the generalization ability of the model; the expression of the regression coefficient R 2 is: wherein, is the number of samples in the data set, is the true value, is the predicted value, is the mean of the actual values.

2. The improved Swin-Transformer-based tool wear value monitoring method of claim 1, wherein: In step S1, the signal data includes vibration signals, cutting force signals and acoustic emission signals generated under the same cutting parameters during numerical control milling processing.

3. The improved Swin-Transformer-based tool wear value monitoring method of claim 2, wherein: In step S1, the collected signals are removed during the feeding and retracting processes, and the signal data in the stable processing stage is taken, then each type of signal is subjected to Z-score standardization processing; the standardized 7-channel signal data forms the input of the model, and the corresponding wear value is combined to form a data set.

4. The improved Swin-Transformer-based tool wear value monitoring method of claim 1, wherein: The Swin Transformer Resblock module is composed of a normalization layer, a window multi-head self-attention module, a residual block and a sliding window multi-head self-attention module.

5. The improved Swin-Transformer-based tool wear value monitoring method of claim 4, wherein: The residual block is composed of two one-dimensional convolution layers with a convolution kernel of 3 and padding of 1, a Gelu activation function, a Dropout layer and a residual connection; the output of the first one-dimensional convolution layer is sequentially input into the second one-dimensional convolution layer through the Gelu activation function and the Dropout layer, and the output of the second one-dimensional convolution layer is added to the output of the first one-dimensional convolution layer to obtain the output of the residual block; and the data dimension and feature map size of the residual block input are consistent with the output.

6. The improved Swin-Transformer-based tool wear value monitoring method of claim 4, wherein: The calculation process of two consecutive Swin Transformer Resblocks is as follows: In the formula, and They represent the first l Output characteristics of the sliding window multi-head self-attention module and residual block in the SwinTransformer Resblock module.

7. The improved Swin-Transformer-based tool wear value monitoring method of claim 1, wherein: The output module is composed of three consecutive linear regression layers; in the first two linear regression layers, the number of output neurons of each linear regression layer is half of the number of corresponding input neurons; and the number of output neurons of the third linear regression layer is 1.

8. The improved Swin-Transformer-based tool wear value monitoring method of claim 1, wherein: In step S4, when the real-time detection signal collected by the sensor reaches a certain length, the collected signal is equally stepped and input into the trained model for wear value prediction, and the predicted value is compared with the tool wear threshold to determine whether the tool is worn dull and to remind the staff to replace the tool in time.