Machine tool thermal error modeling method fusing attention mechanism and residual network

By integrating an attention mechanism and residual network in the neural network model, the method addresses the challenge of poor precision in thermal error prediction, achieving accurate and versatile thermal error forecasting in machine tools.

CN119089760APending Publication Date: 2024-12-06BEIJING UNIV OF TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310665758.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-06
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

Existing machine learning methods for thermal error prediction in machine tools are unable to achieve high-precision predictions across multiple working conditions due to their time-varying, nonlinear, and coupled characteristics, leading to poor model accuracy and generalization.

Method used

Integrating an attention mechanism and a residual network in the neural network model to adjust weight ratios flexibly and improve information transmission, allowing for faster convergence and better performance, especially in deeper layers, thereby enhancing training efficiency and accuracy.

Benefits of technology

The integrated model significantly improves the precision and accuracy of thermal error prediction, effectively predicting the change trend of thermal errors in machine tools, with high versatility and universality across varying conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119089760A_ABST
    Figure CN119089760A_ABST
Patent Text Reader

Abstract

The invention discloses a machine tool thermal error modeling method fusing an attention mechanism and a residual network, and belongs to the field of thermal error diagnosis. The machine tool thermal error modeling method fusing the attention mechanism and the residual network comprises the steps of obtaining a sample thermal image of a machine tool and a sample thermal error corresponding to the sample thermal image; inputting the sample thermal image and the sample thermal error into a target model, and obtaining a target thermal error corresponding to the machine tool output by the target model; training a target model based on the target thermal error and the sample thermal error; wherein the target model is determined by fusing an attention mechanism and a residual network. According to the machine tool thermal error modeling method fusing the attention mechanism and the residual network, the training efficiency and the model precision of the target model are remarkably improved, so that the precision and the accuracy of the predicted target thermal error are improved, and the thermal error change trend of the machine tool can be effectively predicted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of thermal error diagnosis, and in particular, relates to a machine tool thermal error modeling method integrating an attention mechanism and a residual network. Background Art

[0002] Thermal errors in machine tools are very complex and difficult to predict due to their time-varying, nonlinear, and coupled characteristics. Advanced machine learning techniques such as deep learning, support vector machines, and random forests are mainly used to extract complex features and model high-dimensional data for thermal error prediction. However, these common methods cannot achieve high-precision predictions for multiple working conditions using the same model. Summary of the invention

[0003] The present application aims to solve at least one of the technical problems existing in the prior art. To this end, the present application proposes a machine tool thermal error modeling method that integrates an attention mechanism and a residual network, which significantly improves the training efficiency and model accuracy of the target model, thereby improving the precision and accuracy of the predicted target thermal error, and can effectively predict the change trend of the thermal error of the machine tool.

[0004] In a first aspect, the present application provides a method for modeling thermal errors of machine tools by integrating an attention mechanism and a residual network, the method comprising:

[0005] Acquire a sample thermal image of the machine tool and a sample thermal error corresponding to the sample thermal image;

[0006] Inputting the sample thermal image and the sample thermal error into a target model, and obtaining a target thermal error corresponding to the machine tool output by the target model;

[0007] training the target model based on the target thermal error and the sample thermal error;

[0008] Among them, the target model is determined by the fusion of attention mechanism and residual network.

[0009] According to the machine tool thermal error modeling method that integrates the attention mechanism and the residual network of the present application, by introducing the attention mechanism in the neural network, the weight ratio of each factor can be flexibly adjusted based on the actual situation, and the flexibility is high; by introducing the residual network, information can be transmitted more smoothly in the network, and it has better performance and faster convergence speed when the network layer is deeper, which significantly improves the training efficiency and model accuracy of the target model, thereby improving the precision and accuracy of the predicted target thermal error, and can effectively predict the change trend of the thermal error of the machine tool.

[0010] According to an implementation case of the present application, the target model includes a residual module, an attention weighting module and a prediction module, the attention weighting module is embedded in the residual module, the input of the prediction module is connected to the output of the residual module, the sample thermal image and the sample thermal error are input into the target model, and the target thermal error corresponding to the machine tool output by the target model is obtained, including:

[0011] Input the sample thermal image into the first convolution unit of the residual module to obtain a first feature map output by the first convolution unit;

[0012] Inputting the first feature map into the attention weighting module to obtain a weighted feature map output by the attention weighting module;

[0013] Inputting the weighted feature map into the dimension reduction convolution unit of the residual module to obtain a one-dimensional feature map output by the dimension reduction convolution unit;

[0014] The one-dimensional feature map is input into the prediction module to obtain the target thermal error output by the prediction module.

[0015] According to an implementation case of the present application, the attention weighting module includes a channel attention mechanism module and a spatial attention mechanism module, and the first feature map is input into the attention weighting module to obtain the weighted feature map output by the attention weighting module, including:

[0016] Inputting the first feature map into the channel attention mechanism module, obtaining a channel weight map output by the channel attention mechanism module, wherein the channel weight map includes a channel attention weight corresponding to a target channel;

[0017] Input the first feature map into the spatial attention mechanism module, and obtain the spatial weight map output by the spatial attention mechanism module, wherein the spatial weight map includes the spatial attention weight corresponding to the target pixel position;

[0018] Based on the spatial weight map and the channel weight map, the weighted feature map is obtained.

[0019] According to an implementation case of the present application, inputting the first feature map into the channel attention mechanism module to obtain the channel weight map output by the channel attention mechanism module includes:

[0020] Performing a global average pooling operation on the first feature map to obtain an average value of each channel;

[0021] The average value of each channel is mapped into a vector having a size equal to the number of channels of the input feature map through a fully connected layer, and the vector is used to characterize the channel attention weight of the target channel.

[0022] According to an implementation case of the present application, inputting the first feature map into the spatial attention mechanism module to obtain the spatial weight map output by the spatial attention mechanism module includes:

[0023] Performing a global average pooling operation on the first feature map to obtain an average value of each pixel position;

[0024] The average value of each pixel position is mapped into a scalar of size 1 through a fully connected layer, and the scalar is used to represent the spatial attention weight of the target pixel position.

[0025] According to an implementation case of the present application, obtaining the weighted feature map based on the spatial weight map and the channel weight map includes:

[0026] Normalizing the spatial attention weight and the channel attention weight based on a sigmoid activation function;

[0027] The spatial weight map and the channel weight map are fused based on the normalized weights to obtain the weighted feature map.

[0028] According to an implementation case of the present application, there are multiple residual modules, and the multiple residual modules are cascaded in sequence, and the input of each residual module is connected to the output of the same residual module.

[0029] According to an implementation case of the present application, it also includes: setting the output of a target neuron among multiple neurons in the target model to 0, and the target neuron is randomly determined based on a Dropout regularization algorithm.

[0030] According to an implementation case of the present application, the acquiring of a sample thermal image of a machine tool and a sample thermal error corresponding to the sample thermal image includes:

[0031] Acquire sample thermal images corresponding to target parts in a machine tool under different working parameters, and sample thermal errors corresponding to the target parts under each of the parameters;

[0032] A sample thermal image and a sample thermal error corresponding to the sample thermal image are determined as a training sample, and a plurality of training samples are obtained.

[0033] In a second aspect, the present application provides a machine tool thermal error modeling device integrating an attention mechanism and a residual network, the device comprising:

[0034] A first processing module, used for acquiring a sample thermal image of a machine tool and a sample thermal error corresponding to the sample thermal image;

[0035] A second processing module is used to input the sample thermal image and the sample thermal error into a target model to obtain a target thermal error corresponding to the machine tool output by the target model;

[0036] A third processing module, configured to train the target model based on the target thermal error and the sample thermal error;

[0037] Among them, the target model is determined by the fusion of attention mechanism and residual network.

[0038] According to the machine tool thermal error modeling device that integrates the attention mechanism and the residual network of the present application, by introducing the attention mechanism in the neural network, the weight ratio of each factor can be flexibly adjusted based on the actual situation, and the flexibility is high; by introducing the residual network, information can be transmitted more smoothly in the network, and it has better performance and faster convergence speed when the network layer is deeper, which significantly improves the training efficiency and model accuracy of the target model, thereby improving the precision and accuracy of the predicted target thermal error, and can effectively predict the thermal error change trend of the machine tool.

[0039] In a third aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for modeling machine tool thermal errors integrating an attention mechanism and a residual network as described in the first aspect above is implemented.

[0040] In a fourth aspect, the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the machine tool thermal error modeling method that integrates the attention mechanism and the residual network as described in the first aspect above.

[0041] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the machine tool thermal error modeling method that integrates the attention mechanism and the residual network as described in the first aspect above.

[0042] The above one or more technical solutions in the embodiments of the present application have at least one of the following technical effects:

[0043] By introducing the attention mechanism into the neural network, the weight ratio of each factor can be flexibly adjusted based on the actual situation, with high flexibility; by introducing the residual network, information can be transmitted more smoothly in the network, with better performance and faster convergence speed when the network layer is deeper, significantly improving the training efficiency and model accuracy of the target model, thereby improving the precision and accuracy of the predicted target thermal error, and can effectively predict the thermal error change trend of the machine tool.

[0044] Furthermore, by connecting the input and output of the residual unit, information can be transmitted more smoothly in the network, effectively avoiding the gradual attenuation of information between network layers and solving the problem of network degradation.

[0045] Furthermore, by integrating the attention mechanism network layer into the neural network model, it is possible to automatically mine the thermal sensitive points of CNC machine tools and adjust the weights of each thermal sensitivity based on the input features, avoiding manual optimization of the measuring points and effectively improving the precision and accuracy of the extracted features, thereby helping to improve the accuracy of the prediction results.

[0046] Furthermore, by using the sample thermal images corresponding to the target parts in the machine tool under different working parameters and the sample thermal errors corresponding to the target parts under each parameter as training samples to train the target model, the same model can be used to predict thermal errors under multiple working conditions, with high versatility and universality, and high accuracy of the prediction results.

[0047] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:

[0049] Figure 1 It is one of the flow charts of the method for modeling thermal errors of machine tools integrating the attention mechanism and the residual network provided in the embodiment of the present application;

[0050] Figure 2 This is the second flow chart of the method for modeling thermal errors of machine tools integrating the attention mechanism and the residual network provided in the embodiment of the present application;

[0051] Figure 3 This is the third flow chart of the method for modeling thermal errors of machine tools integrating the attention mechanism and the residual network provided in the embodiment of the present application;

[0052] Figure 4 This is the fourth flow chart of the method for modeling thermal errors of machine tools integrating the attention mechanism and the residual network provided in the embodiment of the present application;

[0053] Figure 5 This is the fifth flow chart of the method for modeling thermal errors of machine tools integrating the attention mechanism and the residual network provided in the embodiment of the present application;

[0054] Figure 6 It is a structural schematic diagram of a machine tool thermal error modeling device integrating an attention mechanism and a residual network provided in an embodiment of the present application;

[0055] Figure 7 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0056] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0057] The terms "first", "second", etc. in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0058] In combination with the accompanying drawings, the machine tool thermal error modeling method integrating the attention mechanism and the residual network, the machine tool thermal error modeling device integrating the attention mechanism and the residual network, the electronic device and the readable storage medium provided in the embodiments of the present application are described in detail through specific embodiments and their application scenarios.

[0059] Among them, the machine tool thermal error modeling method integrating the attention mechanism and the residual network can be applied to the terminal, and can be specifically executed by the hardware or software in the terminal.

[0060] The terminal includes, but is not limited to, a portable communication device such as a mobile phone or tablet computer with a touch-sensitive surface (e.g., a touch screen display and / or a touch pad). It should also be understood that in some embodiments, the terminal may not be a portable communication device, but a desktop computer with a touch-sensitive surface (e.g., a touch screen display and / or a touch pad).

[0061] In the following various embodiments, a terminal including a display and a touch-sensitive surface is described. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, a mouse and a joystick.

[0062] The embodiment of the present application provides a method for modeling thermal errors of machine tools that integrates an attention mechanism and a residual network. The execution subject of the method for modeling thermal errors of machine tools that integrates an attention mechanism and a residual network can be an electronic device or a functional module or functional entity in the electronic device that can implement the method for modeling thermal errors of machine tools that integrates an attention mechanism and a residual network. The electronic devices mentioned in the embodiment of the present application include but are not limited to mobile phones, tablet computers, computers, cameras, and wearable devices. The method for modeling thermal errors of machine tools that integrates an attention mechanism and a residual network provided in the embodiment of the present application is described below using an electronic device as an example of the execution subject.

[0063] like Figure 1 As shown, the machine tool thermal error modeling method integrating the attention mechanism and the residual network includes: step 110, step 120 and step 130.

[0064] Step 110, obtaining a sample thermal image of the machine tool and a sample thermal error corresponding to the sample thermal image;

[0065] In this step, the sample thermal image is a thermal image of the machine tool itself or its components under the target working condition data.

[0066] The target operating condition data may be any operating condition data.

[0067] The machine tool may be a CNC machine tool or any other type of machine tool, and this application does not limit this.

[0068] The sample thermal error is the actual thermal error corresponding to the sample thermal image.

[0069] Step 120: Input the sample thermal image and the sample thermal error into the target model to obtain the target thermal error corresponding to the machine tool output by the target model;

[0070] In this step, the target model is a neural network model.

[0071] The target thermal error is the predicted thermal error value predicted by the target model based on the input data.

[0072] By inputting sample thermal images and sample thermal errors into the target model, the model parameters of the target model can be effectively trained.

[0073] Step 130: train a target model based on the target thermal error and the sample thermal error; wherein the target model is determined by fusion of the attention mechanism and the residual network.

[0074] In this step, the loss function of the target model can be trained based on the target thermal error and the sample thermal error until the target model can output accurate prediction values.

[0075] Residual Network (ResNet) is a classic neural network that is the backbone of computer vision tasks and includes multiple residual modules.

[0076] By adding a residual network to a deep neural network, the training depth can be made more efficient and the model accuracy can be effectively improved.

[0077] The attention mechanism includes at least one of a spatial attention mechanism and a channel attention mechanism.

[0078] By introducing the attention mechanism, the weight of each factor can be flexibly adjusted based on actual conditions. It is highly flexible and helps to improve the accuracy and precision of the model.

[0079] The sample thermal image and the sample thermal error are pre-acquired sample data. The method for acquiring the sample data and the structure of the target model will be specifically described below and will not be elaborated here.

[0080] In the subsequent application process, it is only necessary to input the target thermal image of the machine tool to be tested into the target model, and the corresponding predicted thermal error can be predicted by the target model.

[0081] During the research and development process, the inventors discovered that in the related technologies, there are methods that use advanced machine learning technologies such as deep learning, support vector machines and random forests to extract complex features and model high-dimensional data; and use deep learning algorithms, such as convolutional neural networks, recursive neural networks and autoencoders, to perform thermal error prediction by learning the nonlinear relationship between input features and output targets; but due to the differences in the topological structures of different neural networks, different neural networks have great differences in accuracy, versatility and robustness during the modeling process. For existing neural networks, as the number of layers increases, the training error of the model increases, and the test error of the model also increases accordingly, which makes it difficult to update the network parameters and the model accuracy and generalization ability are poor.

[0082] In the present application, by adding residual connections in the neural network, information can be transmitted more smoothly in the network. When the network has deeper layers, it has better performance and faster convergence speed, avoids the gradual attenuation of information between network layers, reduces the problem of deep neural network degradation caused by problems such as gradient vanishing and gradient explosion, reduces the training error and test error of the model, and effectively improves the accuracy and generalization ability of the target model.

[0083] According to the machine tool thermal error modeling method that integrates the attention mechanism and the residual network provided in the embodiment of the present application, by introducing the attention mechanism in the neural network, the weight ratio of each factor can be flexibly adjusted based on the actual situation, and the flexibility is high; by introducing the residual network, information can be transmitted more smoothly in the network, and it has better performance and faster convergence speed when the network layer is deeper, which significantly improves the training efficiency and model accuracy of the target model, thereby improving the precision and accuracy of the predicted target thermal error, and can effectively predict the thermal error change trend of the machine tool.

[0084] The following describes the method of constructing the target model through a specific embodiment.

[0085] In some embodiments, the target model may include a residual module, an attention weighting module and a prediction module, the attention weighting module is embedded in the residual module, and the input of the prediction module is connected to the output of the residual module; step 120 may include:

[0086] Input the sample thermal image to the first convolution unit of the residual module to obtain a first feature map output by the first convolution unit;

[0087] Inputting the first feature map into the attention weighting module, and obtaining a weighted feature map output by the attention weighting module;

[0088] Input the weighted feature map to the dimension reduction convolution unit of the residual module to obtain a one-dimensional feature map output by the dimension reduction convolution unit;

[0089] The one-dimensional feature map is input into the prediction module to obtain the target thermal error output by the prediction module.

[0090] In this embodiment, the target model may include a residual module, an attention weighting module, and a prediction module.

[0091] Among them, BottleNeck is the core part of the residual module.

[0092] like Figure 2 As shown, each residual module may include: two or three convolutional layers. In some embodiments, each residual module may also include an identity mapping.

[0093] The identity mapping is used to connect the input and output of the residual network, so that information can be transmitted quickly in the network.

[0094] The residual module can be one-level or multi-level.

[0095] In some embodiments, the residual module may include: 1x1 convolution, 3x3 convolution and 1x1 convolution; wherein the last 1x1 convolution is used to reduce the feature dimension, that is, a dimensionality reduction convolution unit.

[0096] The first convolution unit may include a 1x1 convolution and a 3x3 convolution connected sequentially.

[0097] The attention weighted module (AttentionBlock) is embedded in the residual module of the same level, such as embedded in the output end of conv3 in the residual module.

[0098] The attention weighting module is used to assign weights based on the importance of the input feature map.

[0099] In this embodiment, the first convolution unit converts the input sample thermal image into a high-dimensional feature vector, namely, the first feature map, through multi-layer nonlinear transformation, which can effectively solve problems such as network degradation and gradient explosion, and extract relevant features of machine tool thermal errors.

[0100] The first feature map is then input into the attention weighting module, which performs weight assignment to obtain a weighted feature map.

[0101] The weighted feature map is input into the dimensionality reduction convolution unit, which reduces it through a 1x1 convolution layer to obtain a one-dimensional feature map, effectively reducing the amount of data to improve the subsequent calculation rate.

[0102] The prediction module is used to predict the corresponding thermal error based on the input thermal features.

[0103] The prediction module can be any type of neural network, and this application does not limit it.

[0104] In some embodiments, the target model can be constructed using an Adam (adaptive momentum, Adam) adaptive momentum stochastic optimization algorithm, and the model training process can be improved by controlling hyperparameters and adjusting the learning rate to predict thermal errors during machine tool operation.

[0105] In some embodiments, the method may further include: setting the output of a target neuron among multiple neurons in the target model to 0, where the target neuron is randomly determined based on a Dropout regularization algorithm.

[0106] In this embodiment, the number of target neurons may be one or more.

[0107] In this application, by introducing the Dropout regularization method to randomly set the outputs of some neurons to 0, the information of the main axis thermal image can be mapped to more neurons, which increases the representation ability of the model, reduces the overfitting phenomenon, and improves the robustness and generalization ability of the model.

[0108] According to the machine tool thermal error modeling method that integrates the attention mechanism and the residual network provided in the embodiment of the present application, the sample thermal image is processed by raising and lowering the feature dimension through the residual module, which can reduce the number of parameters and the amount of data, and can effectively and intuitively perform data training after dimensionality reduction.

[0109] In some embodiments, there may be multiple residual modules, and the multiple residual modules are cascaded in sequence, and the input of each residual module is connected to the output of the same residual module.

[0110] In this embodiment, continuing with the above embodiment as an example, for example, at level i, the output weighted feature map of the attention weighted module is reduced in dimension by a dimensionality reduction convolution unit Block2 to generate output i; then the output i is added element-by-element to the output of level i+1, where the output of level i+1 has passed through a one-dimensional upsampling layer, and the obtained tensor is passed to the one-dimensional upsampling layer of the previous layer; i represents the level of the residual network block, where i=1, 2, ..., n.

[0111] After passing through the highest 1D upsampling layer, the tensor is fed into the output 1D convolutional layer to generate the final output.

[0112] According to the machine tool thermal error modeling method that integrates the attention mechanism and the residual network provided in the embodiment of the present application, by connecting the input and output of the residual unit, information can be transmitted more smoothly in the network, effectively avoiding the gradual attenuation of information between network layers and solving the problem of network degradation.

[0113] In some embodiments, the residual module may include: a convolutional network layer, a BatchNormalization layer, a ChannelAttention layer, a SpatialAttention layer and a function activation layer cascaded in sequence; the ChannelAttention layer includes a global average pooling layer, a fully connected layer and a Sigmoid activation function, and the SpatialAttention layer includes an adaptive average pooling layer and a fully connected layer.

[0114] like Figure 3 As shown, in some embodiments, the attention weighting module may include a spatial attention mechanism module and a channel attention mechanism module, inputting the first feature map into the attention weighting module, and obtaining the weighted feature map output by the attention weighting module may include:

[0115] Input the first feature map into the channel attention mechanism module, and obtain the channel weight map output by the channel attention mechanism module, where the channel weight map includes the channel attention weight corresponding to the target channel;

[0116] Input the first feature map into the spatial attention mechanism module, and obtain the spatial weight map output by the spatial attention mechanism module, where the spatial weight map includes the spatial attention weight corresponding to the target pixel position;

[0117] Based on the spatial weight map and the channel weight map, a weighted feature map is obtained.

[0118] In this embodiment, the spatial attention mechanism module is used to determine the spatial attention weight based on the input feature map.

[0119] The channel attention mechanism module is used to determine the channel attention weights based on the input feature map.

[0120] The target pixel position may be any pixel position in the first feature map.

[0121] The target channel can be any channel in the input channels.

[0122] Figure 4 An attention mechanism network structure is illustrated. In some embodiments, a channel attention mechanism module and a spatial attention mechanism module are connected sequentially.

[0123] In some embodiments, inputting the first feature map into the spatial attention mechanism module, and obtaining the spatial weight map output by the spatial attention mechanism module may include:

[0124] Perform a global average pooling operation on the first feature map to obtain the average value of each pixel position;

[0125] The average value of each pixel position is mapped into a scalar of size 1 through a fully connected layer, and the scalar is used to represent the spatial attention weight of the target pixel position.

[0126] In this embodiment, the spatial attention mechanism module performs a global average pooling operation on the first input feature map to obtain an average value at each pixel position;

[0127] The average value of each pixel position is then mapped into a scalar of size 1 through a fully connected layer, indicating the importance of that position.

[0128] In some embodiments, inputting the first feature map into the channel attention mechanism module, and obtaining the channel weight map output by the channel attention mechanism module may include:

[0129] Perform a global average pooling operation on the first feature map to obtain the average value of each channel;

[0130] The average value of each channel is mapped into a vector with the same size as the number of channels of the input feature map through a fully connected layer. The vector is used to represent the channel attention weight of the target channel.

[0131] In this embodiment, the channel attention mechanism module first performs a global average pooling operation on the first feature map of the input to obtain the average value of each channel;

[0132] The average value of each channel is then mapped into a vector with the same size as the number of channels in the input feature map through a fully connected layer, indicating the importance of each channel.

[0133] After obtaining the spatial attention weights and channel attention weights, the spatial attention weights and channel attention weights are fused to obtain a weighted feature map.

[0134] In some embodiments, obtaining a weighted feature map based on the spatial weight map and the channel weight map may include:

[0135] The spatial attention weights and channel attention weights are normalized based on the sigmoid activation function;

[0136] The spatial weight map and the channel weight map are fused based on the normalized weights to obtain a weighted feature map.

[0137] In this embodiment, the sigmoid activation function is used to compress the values ​​of the spatial attention weight and the channel attention weight to between 0 and 1 to obtain normalized weight values ​​respectively, and the normalized weight values ​​are weightedly combined to obtain a re-weighted feature map, i.e., a weighted feature map.

[0138] Finally, the reweighted feature map is passed through a 1x1 convolutional layer (i.e., dimensionality reduction convolution unit) to update the feature map to obtain a one-dimensional feature map.

[0139] The inventors have determined through multiple experiments that by introducing an attention mechanism network layer, high-quality image processing can be achieved even in thermal images of machine tool spindles with more noise. While ensuring the feature extraction effect, manual optimization of measuring points is avoided.

[0140] According to the machine tool thermal error modeling method that integrates the attention mechanism and the residual network provided in the embodiment of the present application, by integrating the attention mechanism network layer into the neural network model, it is possible to automatically mine the thermal sensitive points of the CNC machine tool and adjust the weights corresponding to each thermal sensitivity based on the input features, thereby avoiding manual optimization of the measuring points and effectively improving the precision and accuracy of the extracted features, thereby helping to improve the accuracy of the prediction results.

[0141] The following describes how to obtain training samples.

[0142] like Figure 5 As shown, in some embodiments, step 110 may also include:

[0143] Obtain sample thermal images corresponding to target parts in the machine tool under different working parameters, and sample thermal errors corresponding to the target parts under each parameter;

[0144] A sample thermal image and a sample thermal error corresponding to the sample thermal image are determined as a training sample, and a plurality of training samples are obtained.

[0145] In this embodiment, the working parameters are working condition parameters.

[0146] Target components include but are not limited to: the machine tool itself and the core components of the machine tool.

[0147] For example, core components may include: spindle, lead screw pair and other key components.

[0148] It is understandable that the thermal sensitivity at different locations in the machine tool may be different depending on the working parameters.

[0149] In the present application, a thermal image corresponding to any component of a machine tool under any working parameters and a thermal error of the component under the working parameters are obtained, and the thermal image and thermal error corresponding to the same target component under the same working parameters are used as a training sample, so that multiple training samples can be obtained.

[0150] For example, in the actual implementation process, thermal modal analysis can be performed on the machine tool and its key components such as the spindle and the screw pair under different parameters to obtain the approximate temperature distribution and thermal sensitive points; the thermal error data and corresponding thermal images of the thermal sensitive points of the machine tool under different working conditions can be collected, and the data can be preprocessed and divided into data set samples to obtain training samples.

[0151] In the actual training process, the training samples are input into the target model for training and weight update, thermal images are recognized, and the nonlinear relationship between thermal images and thermal errors is mined to predict and evaluate thermal errors.

[0152] The inventors also discovered during the research and development process that in the related technology, there is a method that measures the temperature variables and spindle thermal deformation of CNC machine tools under different working conditions, uses three inferences under the Bayesian evidence framework to train the least squares support vector machine model, and simultaneously identifies and optimizes the parameters to derive the optimal parameters corresponding to different working conditions. However, this method establishes optimal models for different working condition data respectively, and cannot achieve high-precision prediction of multiple working conditions through the same model.

[0153] In the present application, the target model is trained by using the sample thermal images corresponding to the target parts in the machine tool under different working parameters and the sample thermal errors corresponding to the target parts under each parameter as training samples. There is no need to establish optimal models for different working condition data respectively. The same model can be used to predict thermal errors under multiple working conditions. It has high versatility and universality, and the prediction results are more accurate.

[0154] In some embodiments, the target model can use at least one of mean squared error (MSE), mean absolute error (MAE) and modified determination coefficient to quantitatively evaluate the performance of the prediction model and obtain a quantitative value; and optimize the target model based on the quantitative value; the optimization effect is good.

[0155] According to the machine tool thermal error modeling method that integrates the attention mechanism and the residual network provided in the embodiment of the present application, by using the sample thermal images corresponding to the target parts in the machine tool under different working parameters and the sample thermal errors corresponding to the target parts under each parameter as training samples to train the target model, the same model can be used to predict thermal errors under multiple working conditions, with high versatility and universality, and high accuracy of the prediction results.

[0156] The embodiment of the present application provides a method for modeling a thermal error of a machine tool that integrates an attention mechanism and a residual network, and the execution subject can be a machine tool thermal error modeling device that integrates an attention mechanism and a residual network. In the embodiment of the present application, the machine tool thermal error modeling method that integrates an attention mechanism and a residual network is executed by a machine tool thermal error modeling device that integrates an attention mechanism and a residual network as an example to illustrate the machine tool thermal error modeling device that integrates an attention mechanism and a residual network provided in the embodiment of the present application.

[0157] An embodiment of the present application also provides a machine tool thermal error modeling device that integrates an attention mechanism and a residual network.

[0158] like Figure 6 As shown, the machine tool thermal error modeling device integrating the attention mechanism and the residual network includes: a first processing module 610, a second processing module 620 and a third processing module 630.

[0159] A first processing module 610 is used to obtain a sample thermal image of a machine tool and a sample thermal error corresponding to the sample thermal image;

[0160] The second processing module 620 is used to input the sample thermal image and the sample thermal error into the target model, and obtain the target thermal error corresponding to the machine tool output by the target model;

[0161] A third processing module 630 is used to train a target model based on the target thermal error and the sample thermal error;

[0162] Among them, the target model is determined by the fusion of attention mechanism and residual network.

[0163] According to the machine tool thermal error modeling device that integrates the attention mechanism and the residual network provided in the embodiment of the present application, by introducing the attention mechanism in the neural network, the weight ratio of each factor can be flexibly adjusted based on the actual situation, and the flexibility is high; by introducing the residual network, information can be transmitted more smoothly in the network, and it has better performance and faster convergence speed when the network layer is deeper, which significantly improves the training efficiency and model accuracy of the target model, thereby improving the precision and accuracy of the predicted target thermal error, and can effectively predict the thermal error change trend of the machine tool.

[0164] In some embodiments, the target model includes a residual module, an attention weighting module and a prediction module, the attention weighting module is embedded in the residual module, and the second processing module 620 can also be used for:

[0165] Input the sample thermal image to the first convolution unit of the residual module to obtain a first feature map output by the first convolution unit;

[0166] Inputting the first feature map into the attention weighting module, and obtaining a weighted feature map output by the attention weighting module;

[0167] Input the weighted feature map to the dimension reduction convolution unit of the residual module to obtain a one-dimensional feature map output by the dimension reduction convolution unit;

[0168] The one-dimensional feature map is input into the prediction module to obtain the target thermal error output by the prediction module.

[0169] In some embodiments, the attention weighting module includes a spatial attention mechanism module and a channel attention mechanism module, and the second processing module 620 can also be used to:

[0170] Input the first feature map into the channel attention mechanism module, and obtain the channel weight map output by the channel attention mechanism module, where the channel weight map includes the channel attention weight corresponding to the target channel;

[0171] Input the first feature map into the spatial attention mechanism module, and obtain the spatial weight map output by the spatial attention mechanism module, where the spatial weight map includes the spatial attention weight corresponding to the target pixel position;

[0172] Based on the spatial weight map and the channel weight map, a weighted feature map is obtained.

[0173] In some embodiments, the second processing module 620 may also be used to:

[0174] Perform a global average pooling operation on the first feature map to obtain the average value of each channel;

[0175] The average value of each channel is mapped into a vector with the same size as the number of channels of the input feature map through a fully connected layer. The vector is used to represent the channel attention weight of the target channel.

[0176] In some embodiments, the second processing module 620 may also be used to:

[0177] Perform a global average pooling operation on the first feature map to obtain the average value of each pixel position;

[0178] The average value of each pixel position is mapped into a scalar of size 1 through a fully connected layer, and the scalar is used to represent the spatial attention weight of the target pixel position.

[0179] In some embodiments, the second processing module 620 may also be used to:

[0180] The spatial attention weights and channel attention weights are normalized based on the sigmoid activation function;

[0181] The spatial weight map and the channel weight map are fused based on the normalized weights to obtain a weighted feature map.

[0182] In some embodiments, the apparatus may further include:

[0183] The third processing module is used to set the output of a target neuron among multiple neurons in the target model to 0, and the target neuron is randomly determined based on a Dropout regularization algorithm.

[0184] In some embodiments, the first processing module 610 may also be used to:

[0185] Obtain sample thermal images corresponding to target parts in the machine tool under different working parameters, and sample thermal errors corresponding to the target parts under each parameter;

[0186] A sample thermal image and a sample thermal error corresponding to the sample thermal image are determined as a training sample, and a plurality of training samples are obtained.

[0187] The machine tool thermal error modeling device integrating the attention mechanism and the residual network in the embodiment of the present application can be an electronic device, or a component in an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmentedreality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personaldigital assistant, PDA), etc., and can also be a server, a network attached storage (Network AttachedStorage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0188] The machine tool thermal error modeling device integrating the attention mechanism and the residual network in the embodiment of the present application can be a device having an operating system. The operating system can be an Android operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0189] The machine tool thermal error modeling device provided by the embodiment of the present application that integrates the attention mechanism and the residual network can achieve Figures 1 to 5 To avoid repetition, the various processes implemented by the method embodiment are not described here.

[0190] In some embodiments, Figure 7 As shown, an embodiment of the present application also provides an electronic device 700, including a processor 701, a memory 702, and a computer program stored in the memory 702 and executable on the processor 701. When the program is executed by the processor 701, each process of the embodiment of the machine tool thermal error modeling method integrating the attention mechanism and the residual network is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.

[0191] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0192] An embodiment of the present application also provides a machine tool thermal error modeling system that integrates an attention mechanism and a residual network, including: a machine tool, an image sensor, and a machine tool thermal error modeling device that integrates an attention mechanism and a residual network as described in any of the above embodiments.

[0193] Among them, the image sensor is used to collect sample thermal images corresponding to the machine tool.

[0194] In some embodiments, the image sensor may be an infrared thermal imager.

[0195] The machine tool thermal error modeling device integrating the attention mechanism and the residual network is electrically connected to the image sensor, and is used to obtain the sample thermal image captured by the image sensor. The machine tool thermal error modeling device integrating the attention mechanism and the residual network is used to execute the machine tool thermal error modeling method integrating the attention mechanism and the residual network as described in any of the above embodiments.

[0196] According to the machine tool thermal error modeling system that integrates the attention mechanism and the residual network provided in the embodiment of the present application, by introducing the attention mechanism in the neural network, the weight ratio of each factor can be flexibly adjusted based on the actual situation, and the flexibility is high; by introducing the residual network, information can be transmitted more smoothly in the network, and it has better performance and faster convergence speed when the network layer is deeper, which significantly improves the training efficiency and model accuracy of the target model, thereby improving the precision and accuracy of the predicted target thermal error, and can effectively predict the thermal error change trend of the machine tool.

[0197] An embodiment of the present application also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned machine tool thermal error modeling method embodiment that integrates the attention mechanism and the residual network are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0198] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0199] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the above-mentioned machine tool thermal error modeling method that integrates the attention mechanism and the residual network.

[0200] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0201] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned embodiment of the machine tool thermal error modeling method that integrates the attention mechanism and the residual network, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0202] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0203] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0204] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0205] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

[0206] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0207] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present application, and that the scope of the present application is defined by the claims and their equivalents.

Claims

1. A machine tool thermal error modeling method integrating attention mechanism and residual network, characterized in that: include: Acquire a sample thermal image of the machine tool and a sample thermal error corresponding to the sample thermal image; Inputting the sample thermal image and the sample thermal error into a target model, and obtaining a target thermal error corresponding to the machine tool output by the target model; training the target model based on the target thermal error and the sample thermal error; Among them, the target model is determined by the fusion of attention mechanism and residual network.

2. The machine tool thermal error modeling method integrating the attention mechanism and the residual network according to claim 1 is characterized in that: The target model includes a residual module, an attention weighting module and a prediction module, wherein the attention weighting module is embedded in the residual module, the input of the prediction module is connected to the output of the residual module, and the sample thermal image and the sample thermal error are input into the target model to obtain the target thermal error corresponding to the machine tool output by the target model, including: Input the sample thermal image into the first convolution unit of the residual module to obtain a first feature map output by the first convolution unit; Inputting the first feature map into the attention weighting module to obtain a weighted feature map output by the attention weighting module; Inputting the weighted feature map into the dimension reduction convolution unit of the residual module to obtain a one-dimensional feature map output by the dimension reduction convolution unit; The one-dimensional feature map is input into the prediction module to obtain the target thermal error output by the prediction module.

3. The machine tool thermal error modeling method integrating the attention mechanism and the residual network according to claim 2 is characterized in that: The attention weighting module includes a channel attention mechanism module and a spatial attention mechanism module, and the first feature map is input into the attention weighting module to obtain the weighted feature map output by the attention weighting module, including: Inputting the first feature map into the channel attention mechanism module, obtaining a channel weight map output by the channel attention mechanism module, wherein the channel weight map includes a channel attention weight corresponding to a target channel; Input the first feature map into the spatial attention mechanism module, and obtain the spatial weight map output by the spatial attention mechanism module, wherein the spatial weight map includes the spatial attention weight corresponding to the target pixel position; Based on the spatial weight map and the channel weight map, the weighted feature map is obtained.

4. The machine tool thermal error modeling method integrating the attention mechanism and the residual network according to claim 3 is characterized in that: The step of inputting the first feature map into the channel attention mechanism module and obtaining the channel weight map output by the channel attention mechanism module includes: Performing a global average pooling operation on the first feature map to obtain an average value of each channel; The average value of each channel is mapped into a vector having a size equal to the number of channels of the input feature map through a fully connected layer, and the vector is used to characterize the channel attention weight of the target channel.

5. The machine tool thermal error modeling method integrating attention mechanism and residual network according to claim 3 is characterized in that: The step of inputting the first feature map into the spatial attention mechanism module and obtaining the spatial weight map output by the spatial attention mechanism module includes: Performing a global average pooling operation on the first feature map to obtain an average value of each pixel position; The average value of each pixel position is mapped into a scalar of size 1 through a fully connected layer, and the scalar is used to represent the spatial attention weight of the target pixel position.

6. The machine tool thermal error modeling method integrating the attention mechanism and the residual network according to claim 3 is characterized in that: The acquiring the weighted feature map based on the spatial weight map and the channel weight map comprises: Normalizing the spatial attention weight and the channel attention weight based on a sigmoid activation function; The spatial weight map and the channel weight map are fused based on the normalized weights to obtain the weighted feature map.

7. The machine tool thermal error modeling method integrating attention mechanism and residual network according to claim 2 is characterized in that: There are multiple residual modules, and the multiple residual modules are cascaded in sequence, and the input of each residual module is connected to the output of the same residual module.

8. The machine tool thermal error modeling method integrating the attention mechanism and the residual network according to any one of claims 1 to 7, characterized in that: Also includes: The output of a target neuron among the multiple neurons in the target model is set to 0, and the target neuron is randomly determined based on a Dropout regularization algorithm.

9. The machine tool thermal error modeling method integrating the attention mechanism and the residual network according to any one of claims 1 to 7, characterized in that: The acquiring of a sample thermal image of a machine tool and a sample thermal error corresponding to the sample thermal image comprises: Acquire sample thermal images corresponding to target parts in a machine tool under different working parameters, and sample thermal errors corresponding to the target parts under each of the parameters; A sample thermal image and a sample thermal error corresponding to the sample thermal image are determined as a training sample, and a plurality of training samples are obtained.

10. A machine tool thermal error modeling device integrating attention mechanism and residual network, characterized in that: include: A first processing module, used for acquiring a sample thermal image of a machine tool and a sample thermal error corresponding to the sample thermal image; A second processing module is used to input the sample thermal image and the sample thermal error into a target model to obtain a target thermal error corresponding to the machine tool output by the target model; A third processing module, configured to train the target model based on the target thermal error and the sample thermal error; Among them, the target model is determined by the fusion of attention mechanism and residual network.

Citation Information

Cited By

  • Machine tool spindle thermal error prediction method and system based on regional division thermal image

    CN120802832A