Ultra-precision turning profile error prediction method and system with serial attention mechanism
By using a deep learning model with a serial attention mechanism, the long-distance temporal dependency of cutting force signals is captured and a global context association is established on a two-dimensional plane. This solves the problems of accuracy and interpretability in contour error prediction in ultra-precision turning, and achieves high-precision contour error prediction and online compensation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HARBIN INST OF TECH
- Filing Date
- 2026-05-11
- Publication Date
- 2026-07-07
AI Technical Summary
Existing technologies struggle to effectively capture the long-distance temporal dependence of cutting force signals and the two-dimensional spatial error distribution in ultra-precision turning, resulting in insufficient accuracy in contour error prediction and a lack of physical interpretability and generalization ability in the model.
A serial attention mechanism is adopted to capture the long-distance temporal dependence of cutting force signals through the first deep learning prediction model, and to establish global context association on the two-dimensional plane by using the second deep learning prediction model, and to perform contour error prediction by combining multi-physics field features.
It achieves high-precision contour error prediction, improves the model's generalization ability and physical interpretability, and supports process optimization and online error compensation.
Smart Images

Figure CN122164928B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of ultra-precision machining and intelligent manufacturing technology, specifically to an ultra-precision turning contour error prediction method and system based on a serial attention mechanism. Background Technology
[0002] Ultra-precision turning is a key process for manufacturing high-end products such as optical components and microstructured functional surfaces. Machining contour errors directly affect the functional performance of the products; therefore, achieving high-precision prediction of contour errors is a prerequisite for process optimization and online error compensation.
[0003] Existing theoretical modeling methods rely heavily on analytical models based on machine tool stiffness and cutting force theories, making it difficult to characterize complex nonlinear and dynamic factors in the machining process, such as multi-axis coupling effects and time-varying cutting conditions. This results in limited prediction accuracy, especially when dealing with complex microstructure surfaces where errors increase significantly. Single data-driven methods directly use process parameters to predict contour errors through deep learning models, exhibiting significant limitations: time-series models struggle to effectively capture long-distance temporal dependencies spanning thousands of sampling points, such as tool wear accumulation and thermal deformation, and suffer from point-by-point amplification of prediction errors; while spatial models excel at processing two-dimensional image data, they cannot fully integrate cutting force temporal information with strong dynamic characteristics. Current technologies generally directly map process parameters to contour errors, neglecting the bridging role of cutting force as a key physical intermediate variable. This leads to a lack of physical interpretability, insufficient generalization ability, and difficulty adapting to contour error prediction needs in different machining scenarios. Existing methods also face bottlenecks in simultaneously processing long-term dynamic signals and two-dimensional spatial error distributions in ultra-precision turning, failing to establish high-precision mapping models with clear physical relationships between process parameters, dynamic cutting forces, and contour errors. Summary of the Invention
[0004] The purpose of this invention is to provide a method and system for predicting ultra-precision turning contour errors using a serial attention mechanism. This method effectively captures the long-distance temporal dependencies of cutting force signals and establishes global contextual associations on a two-dimensional plane, thereby achieving high-precision prediction of ultra-precision turning contour errors and improving the model's generalization ability and physical interpretability.
[0005] In a first aspect, the present invention provides a method for predicting ultra-precision turning contour errors using a serial attention mechanism, comprising the following steps:
[0006] S1. Obtain multi-physics field features; the features include process and spatiotemporal position features, kinematic dynamic features and microstructure geometric gradient features, and all the features correspond to the spatiotemporal position of the tool tip relative to the workpiece;
[0007] S2. Organize the features obtained in S1 into a one-dimensional time sequence and input it into the first deep learning prediction model. The first deep learning prediction model adopts a time prediction architecture based on the Prob sparse self-attention mechanism to capture the long-distance time-series dependency of the cutting force signal and output the predicted value of the three-dimensional dynamic cutting force in the future preset time period.
[0008] S3. The features obtained in S1 are sampled into a multi-channel two-dimensional spatial feature map according to the mapping relationship with the position of the machining surface. The predicted value of the three-dimensional dynamic cutting force obtained in S2 is added to the two-dimensional spatial feature map as an additional feature channel. The fused two-dimensional feature map is input into the second deep learning prediction model. The second deep learning prediction model adopts a spatial prediction architecture based on the cross attention mechanism to establish global context association on the two-dimensional plane and output a two-dimensional machining surface contour error distribution map.
[0009] Secondly, the present invention also provides an ultra-precision turning contour error prediction system based on a serial attention mechanism, for implementing the above method, comprising:
[0010] The data acquisition and preprocessing module is used to acquire multi-physics field features; the features include process and spatiotemporal position features, kinematic dynamic features and microstructure geometric gradient features, and all of the features correspond to the spatiotemporal position of the tool tip relative to the workpiece;
[0011] The timing cutting force prediction module has the first deep learning prediction model built in, which is used to organize the features obtained by S1 into a one-dimensional timing sequence and input it into the first deep learning prediction model. The first deep learning prediction model adopts a timing prediction architecture based on the Prob sparse self-attention mechanism, which is used to capture the long-distance timing dependency of the cutting force signal and output the three-dimensional dynamic cutting force prediction value within a preset time period in the future.
[0012] The spatial contour error prediction module incorporates the second deep learning prediction model, which samples the features into a multi-channel two-dimensional spatial feature map based on the mapping relationship with the position of the machining surface. The predicted three-dimensional dynamic cutting force value obtained by S2 is added to the two-dimensional spatial feature map as an additional feature channel. The fused two-dimensional feature map is then input into the second deep learning prediction model. The second deep learning prediction model adopts a spatial prediction architecture based on a cross-attention mechanism, which is used to establish global context association on the two-dimensional plane and output a two-dimensional machining surface contour error distribution map.
[0013] As can be seen from the above, the ultra-precision turning contour error prediction method and system provided in this application, through a series attention mechanism, first uses a temporal model to predict the cutting force, and then uses a spatial model to predict the contour error. This effectively integrates temporal and spatial information, solving the problem in the prior art that it is difficult to simultaneously process long-term dynamic signals and two-dimensional spatial error distributions. It has the advantages of effectively capturing the long-distance temporal dependence of the cutting force signal and establishing a global context association on the two-dimensional plane, thereby achieving high-precision prediction of ultra-precision turning contour errors and improving the model's generalization ability and physical interpretability. Attached Figure Description
[0014] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0015] Figure 1 This is a flowchart illustrating an ultra-precision turning contour error prediction method based on a series attention mechanism according to an embodiment of the present invention.
[0016] Figure 2 This is a structural framework diagram of the first deep learning prediction model according to an embodiment of the present invention;
[0017] Figure 3 This is a structural framework diagram of the second deep learning prediction model according to an embodiment of the present invention;
[0018] Figure 4 This is a schematic diagram of the structure of an ultra-precision turning contour error prediction system based on a series attention mechanism according to an embodiment of the present invention. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] Traditional methods for predicting contour errors in ultra-precision turning suffer from limited accuracy when dealing with complex nonlinear and time-varying factors in the machining process. Theoretical modeling methods rely on simplification assumptions and struggle to accurately characterize complex factors such as dynamic cutting forces and multi-axis coupling effects. Single data-driven methods, such as time-series models, fail to effectively capture long-term temporal dependencies and suffer from error accumulation, while spatial models struggle to effectively integrate cutting force information with strong temporal dynamic characteristics. Furthermore, these methods often neglect the crucial intermediate physical variable of cutting force, resulting in unclear physical meaning of the model, limited generalization ability, and difficulty in further improving prediction accuracy.
[0021] In this regard, such as Figure 1 As shown, this application proposes a method for predicting ultra-precision turning contour errors using a serial attention mechanism, comprising the following steps:
[0022] S1. Obtain multi-physics field features; the features include process and spatiotemporal position features, kinematic dynamic features and microstructure geometric gradient features, and all features correspond to the spatiotemporal position of the tool tip relative to the workpiece;
[0023] S2. Organize the features obtained in S1 into a one-dimensional time series. The input is fed into the first deep learning prediction model, which employs a temporal prediction architecture based on the Prob sparse self-attention mechanism to capture the long-distance temporal dependencies of the cutting force signal and outputs the predicted values of the three-dimensional dynamic cutting force within a preset future time period. ;
[0024] S3. The features obtained in S1 are sampled into a multi-channel two-dimensional spatial feature map based on their mapping relationship with the machined surface position. The predicted three-dimensional dynamic cutting force value obtained in S2 is added to the two-dimensional spatial feature map as an additional feature channel. The fused two-dimensional feature map is then input into the second deep learning prediction model. The second deep learning prediction model adopts a spatial prediction architecture based on a cross-attention mechanism to establish global contextual relationships on the two-dimensional plane and output a two-dimensional machining surface contour error distribution map. This result can be directly used for offline process optimization: evaluating and correcting process parameters; and for online intelligent compensation: serving as a feedforward signal input to the CNC system to achieve real-time error compensation.
[0025] This method decomposes the complex contour error prediction into two sub-tasks: temporal cutting force prediction and spatial contour error prediction. It uses the predicted cutting force as a physical bridge, effectively solving the limitations of the single model in the existing technology in processing long-term dynamic signals and two-dimensional spatial error distribution.
[0026] Among them, multi-physics field features refer to a set of features that can comprehensively characterize the physical process of ultra-precision turning. These features include process and spatiotemporal position features, kinematic dynamic features, and microstructure geometric gradient features, all of which correspond to the spatiotemporal position of the tool tip relative to the workpiece.
[0027] The first deep learning prediction model refers to a model used to process one-dimensional time series, capture the long-distance temporal dependence of cutting force signals, and output three-dimensional dynamic cutting force prediction values.
[0028] The Prob sparse self-attention mechanism is an efficient attention mechanism for processing long sequence data. It filters key time points through probability distribution, thereby reducing computational complexity.
[0029] The second deep learning prediction model refers to a model used to process multi-channel two-dimensional spatial feature maps, establish global contextual relationships, and output a two-dimensional machining surface contour error distribution map.
[0030] Cross-attention mechanism refers to an attention mechanism that can capture global contextual dependencies in a two-dimensional space (e.g., the feed direction-processing angle plane).
[0031] The fused two-dimensional feature map is the temporal cutting force predicted by the first deep learning prediction model. Compared with the original features obtained in step S1, based on their spatial coordinates on the machined surface The data is then uniformly resampled and organized into a multi-channel two-dimensional feature map. This step completes the crucial transformation from a "temporal flow" to a "spatial field".
[0032] Contour error refers to the low-frequency deviation at the microstructure scale between the actual morphology and the theoretically designed morphology of a microstructured surface (such as a sine wave or mesh surface) produced by ultra-precision turning.
[0033] This application decomposes the task of predicting ultra-precision turning contour errors into time-series cutting force prediction and spatial contour error prediction, and uses the predicted cutting force as a physical bridge, effectively solving the limitations of traditional methods in handling complex nonlinear, time-varying factors, and long-series dynamic signals and two-dimensional spatial error distributions. This method can establish a high-precision mapping model with physical interpretability, thus providing a reliable predictive basis for process optimization and online error compensation in ultra-precision turning.
[0034] In one optional implementation, in step S1, the process and spatiotemporal position features include the number of machining revolutions, the tool circumferential angle, the radial feed displacement, and the cutting axis displacement; the kinematic dynamic features include the instantaneous linear velocity and instantaneous linear acceleration of the cutting axis; wherein, the instantaneous linear acceleration is used to indirectly characterize the influence of the servo motor force; the microstructure geometric gradient features include the surface circumferential gradient and surface radial gradient calculated in real time according to the preset mathematical model of the microstructure surface to be processed.
[0035] Among them, the ultra-precision machine tool body has at least one rotary axis (such as C (axis) and two linear axes (such as) X , Z (Axis), used to perform microstructure turning.
[0036] Specifically, number of processing rounds N This refers to the number of revolutions the workpiece has completed during the turning process, which can be obtained in real time through counters or encoder signals in the machine tool's CNC system. This rotational motion is... C Axis drive, N Counting and C Related to the axis rotation angle. Tool circumferential direction angle. θ This refers to the instantaneous angular position of the tool tip within the workpiece's plane of rotation, which can be measured in real time using a high-precision rotary encoder or angle sensor. θ and C The rotation angle of the axis directly corresponds to this, and is a key parameter describing the position of the tool relative to the workpiece circumferential direction. Radial feed displacement. r Radial feed refers to the instantaneous position of the tool along the radial direction of the workpiece, which can be precisely measured using the machine tool's CNC system, linear scale, or displacement sensor. In ultra-precision turning, radial feed is typically... X Driven by a radial linear axis. r and X The position values of the axes correspond. Cutting axis displacement (when machining end faces / planes), the main motion is the tool along... X Radial feed of the cutting axis, the displacement of the cutting axis at this time is denoted as... X When machining a cylindrical surface, the main motion is the movement of the tool along... Z The cutting axis is fed axially, and the displacement of the cutting axis at this time is denoted as... Z ( ) refers to the instantaneous position of the tool along the workpiece axis, which can be accurately measured by the machine tool's CNC system, linear scale, or displacement sensor.
[0037] Instantaneous linear velocity of the cutting axis v This refers to the instantaneous cutting speed of the tool tip relative to the workpiece. It can be obtained in real time by performing a first-order differential on the displacement signal of the tool or workpiece, or through a dedicated speed sensor. Instantaneous linear acceleration of the cutting axis. aThis refers to the instantaneous acceleration of the tool tip relative to the workpiece. This characteristic reflects the dynamic response and inertial effects of the machine tool's moving parts during cutting. Changes in instantaneous linear acceleration are closely related to the force generated by the servo motor driving the cutting axis, and therefore can indirectly characterize the influence of the servo motor force. The servo motor force is part of the machine tool's dynamic characteristics; its fluctuations can cause machine tool vibration, which in turn affects the cutting force and the quality of the machined surface. Instantaneous linear acceleration can be measured in real time by performing a first-order derivative of the velocity signal or using a high-precision accelerometer.
[0038] The acquisition of the geometric gradient features of microstructures depends on a pre-defined mathematical model of the microstructure surface to be processed. This model is a precise description of the geometry of the target microstructure surface, such as the equation of a sinusoidal surface. Real-time calculation means that during machining, based on the current position of the tool tip, the mathematical model dynamically calculates the surface geometry at that position, ensuring that the model can capture the instantaneous influence of the microstructure surface geometry on the cutting force. Among these features is the surface circumferential gradient. This refers to the circumferential direction of the workpiece (i.e.) C In the direction of shaft rotation, the surface to be machined Rate of change of height or shape, radial gradient of surface This refers to the radial direction of the workpiece (i.e.) X On the axis feed direction, the surface to be machined The rate of change of height or shape.
[0039] Through the above technical solutions, this application significantly improves the accuracy and robustness of the ultra-precision turning contour error prediction method by clearly defining the specific components of multi-physics field features. Specifically, by using the number of machining revolutions, tool circumferential angle, radial feed displacement, and cutting axis displacement as process and spatiotemporal position features, it can comprehensively capture the macroscopic geometric and temporal context information of the cutting process, providing a foundation for the model to understand the periodic changes and spatial distribution of cutting forces. Simultaneously, by introducing the instantaneous linear velocity and instantaneous linear acceleration of the cutting axis as kinematic dynamic features, especially by using instantaneous linear acceleration to indirectly characterize the influence of servo motor forces, the model can gain a deeper understanding of the dynamic response and inertial effects of machine tool moving parts, thereby effectively predicting cutting force fluctuations caused by machine tool vibration or the dynamic characteristics of the control system. Furthermore, by using the surface circumferential gradient and surface radial gradient, calculated in real time based on a preset mathematical model of the microstructure surface to be machined, as microstructure geometric gradient features, it directly reflects the changing trend of the workpiece surface micro-geometry. This precise gradient information is a key factor affecting the contact state between the tool and the workpiece and the magnitude of the cutting force. These specific and comprehensive feature inputs enable the first and second deep learning prediction models to learn more accurately the complex nonlinear relationships between cutting conditions, machine tool dynamics, workpiece geometry and cutting force and contour errors, thereby significantly improving the prediction accuracy and reliability of ultra-precision turning contour errors.
[0040] In one alternative implementation, such as Figure 2 As shown, the first deep learning prediction model is built on an improved Informer model, which includes a cascaded input feature organization module, an encoder module, a decoder module, and a first output module.
[0041] The input feature organization module is used to divide the features in a one-dimensional time series into temporal features and value features. The temporal features are converted into dense vectors through the embedding layer and then input into the encoder module, while the value features are directly input into the encoder module.
[0042] The encoder module consists of multiple identical stacked layers. Each layer contains two multi-head probabilistic sparse self-attention modules and a forward propagation module, which are used to efficiently model and process long sequences of cutting force signals through the Prob sparse attention mechanism.
[0043] The decoder module consists of multiple identical stacked layers. Each layer contains two masked multi-head probabilistic sparse self-attention modules, a multi-head attention module that interacts with the encoder module output, and a forward propagation module. It is used to ensure that the prediction does not depend on future information and to generate the entire future cutting force sequence at once using a masking mechanism.
[0044] The first output module is used to receive the output of the decoder module and process the output through a fully connected layer to obtain the cutting force sequence within a preset time period in the future.
[0045] Specifically, the first deep learning prediction model is designed based on an improved Informer model, a deep learning architecture specifically optimized for long-sequence time series prediction tasks. Its core lies in effectively reducing the computational complexity and memory consumption of the traditional Transformer model when processing long sequences through techniques such as Prob sparse self-attention and self-attention distillation. The improved Informer model means that it is optimized for the specific needs of ultra-precision turning, such as adjusting the network structure, the implementation details of the attention mechanism, or the loss function, to better adapt to the characteristics of the cutting force signal. This cascaded modular structure ensures the orderly processing of the data flow, from feature preparation to final prediction.
[0046] The input feature organization module is a crucial step in data preprocessing. In time series prediction tasks, time information (such as timestamps, periodic features, relative time, etc.) and actual observed values (such as cutting force magnitude) have different properties and representation requirements. This module divides the features in a one-dimensional time series into time features and value features. Time features (e.g., including the number of machining cycles) N Circumferential angle θ and radial position r Features (such as cutting axis displacement X / Z, instantaneous linear velocity of the cutting axis, etc.) are usually discrete or periodic. Transforming them into high-dimensional dense vectors through embedding layers can better capture their semantic information and patterns, making them more effectively processed by deep learning models. v Instantaneous linear acceleration a Surface circumferential gradient and surface radial gradient (etc.) directly represent physical quantities and can be directly input. This separation helps the model learn the relationship between time patterns and numerical patterns more effectively.
[0047] The encoder module is a core component of the Informer model, responsible for extracting high-level features and contextual information from the input one-dimensional temporal sequence. This module consists of multiple identical stacked layers, each containing two multi-head probabilistic sparse self-attention mechanisms and a forward propagation module. The prob sparse self-attention mechanism is a major innovation of the Informer model; it significantly reduces the computational complexity of self-attention mechanisms by selectively focusing on a few important query-key pairs, rather than all possible pairs, enabling it to efficiently handle long sequence data. The multi-head attention mechanism allows the model to learn information from different representation subspaces, enhancing its expressive power. The forward propagation module typically contains non-linear activation functions to increase the model's non-linear mapping capabilities.
[0048] The decoder module is responsible for generating a sequence of predicted future cutting forces based on the features extracted by the encoder and known historical information. This module also consists of multiple identical stacked layers, each containing two masked multi-head probabilistic sparse self-attention modules, a multi-head attention module that interacts with the encoder module output, and a forward propagation module. The masked multi-head probabilistic sparse self-attention modules ensure that when predicting the cutting force at the current time step, the model can only access information from the current and previous time steps, avoiding information leakage. The multi-head attention module that interacts with the encoder module output allows the decoder to utilize the global context information captured by the encoder, thereby improving prediction accuracy. A significant feature of the Informer model is its ability to generate the entire future sequence at once, rather than predicting point by point, which greatly improves prediction efficiency.
[0049] The first output module is the final stage of the model. It converts the internal representation generated by the decoder module into interpretable cutting force predictions. This module receives the output from the decoder module and processes it through a fully connected layer to obtain the cutting force sequence for a predetermined future time period. A fully connected layer (or dense layer) is a standard neural network layer that maps high-dimensional features to the desired output dimension, i.e., the three-dimensional dynamic cutting force sequence for the predetermined future time period. Through the nonlinear transformation of the fully connected layer, the model can finely adjust the prediction results to more closely approximate the actual cutting force changes.
[0050] By specifically constructing the first deep learning prediction model as an improved Informer model and refining its internal input feature organization module, encoder module, decoder module, and first output module, this application can efficiently and accurately process long-sequence cutting force data generated during ultra-precision turning. The input feature organization module effectively separates and processes temporal and value features, enabling the model to better understand time-series data. The encoder module utilizes the Prob sparse attention mechanism to significantly reduce the computational complexity when processing long sequences, while ensuring effective capture of long-distance temporal dependencies in the cutting force signal. The decoder module avoids future information leakage through a masking mechanism and can generate the entire future cutting force sequence at once, greatly improving prediction efficiency and real-time performance. This refined model structure makes the predicted three-dimensional dynamic cutting force values more stable and reliable, providing high-quality input for subsequent contour error prediction, thereby improving the overall accuracy and practicality of contour error prediction.
[0051] Furthermore, process feature sequences and cutting force sequences synchronously collected during historical machining processes were used as the training dataset. A combination of L1 Loss and R... 2 The composite loss function of the coefficients optimizes the consistency of the predicted trend while ensuring a small absolute error.
[0052] In one alternative implementation, the first deep learning prediction model establishes and trains corresponding sub-models for planar turning and cylindrical turning respectively, and automatically calls the corresponding sub-model according to the machining trajectory during actual prediction.
[0053] The first deep learning prediction model establishes and trains corresponding sub-models for planar turning and cylindrical turning conditions respectively. Specifically, planar turning typically refers to the cutting process where the tool performs cutting on the plane of the workpiece. Its characteristics include relatively stable cutting depth and width within a certain range, and the cutting force signal may exhibit relatively regular periodic or quasi-periodic changes. Cylindrical turning, on the other hand, involves helical cutting along the cylindrical surface of the workpiece. Its cutting depth and width may vary with the radial position of the tool, resulting in more complex dynamic characteristics and spatial distribution of the cutting force signal. To address these differences, this application independently designs and optimizes sub-models of the first deep learning prediction model for each specific machining condition (such as planar turning and cylindrical turning). This means that each sub-model will be trained using cutting data collected under the corresponding condition, enabling it to more accurately learn and capture the unique physical laws and temporal dependencies of that condition, thereby improving the professionalism and accuracy of the predictions.
[0054] During actual prediction, the system automatically calls the corresponding sub-model based on the machining trajectory. Machining trajectory information can be obtained from CNC machine tool program instructions, real-time sensor data (such as tool position sensors and encoders), or preset machining task parameters. For example, the system can determine whether the current or upcoming machining is planar turning or cylindrical turning based on the G-code or M-code defined in the CNC program. Once the machining condition is identified, a scheduling module or control logic will automatically load and activate a pre-trained sub-model that matches the condition. This automatic calling mechanism ensures that at any given moment, the prediction system can use the model most suitable for the current machining environment to predict cutting forces, avoiding the need for manual intervention and guaranteeing the real-time performance and accuracy of the prediction.
[0055] By establishing and training corresponding sub-models for planar turning and cylindrical turning respectively, this application enables each sub-model to focus on learning the dynamic characteristics of cutting forces under specific conditions, thereby significantly improving the accuracy of cutting force prediction. During actual prediction, the corresponding sub-model is automatically invoked based on the machining trajectory, ensuring that the most suitable model is always used for prediction in different machining scenarios, avoiding the problem of insufficient generalization ability of a single model under complex and variable conditions. This strategy allows the first deep learning prediction model to more accurately capture long-distance temporal dependencies under different turning conditions, providing a more reliable and refined three-dimensional dynamic cutting force input for subsequent contour error spatial prediction, ultimately improving the overall prediction accuracy of ultra-precision turning contour errors.
[0056] In one alternative implementation, such as Figure 3 As shown, the second deep learning prediction model is built on an improved CCNet model, which includes a cascaded backbone network, a recurrent cross-attention module, and a second output module.
[0057] The backbone network is used for feature extraction from the input two-dimensional feature map.
[0058] The cyclic cross-attention module is used to alternately perform attention weight calculation and feature aggregation in the horizontal and vertical directions to capture long-range contextual dependencies on the two-dimensional processing plane;
[0059] The second output module is used to reduce the number of channels to 1 through a convolutional layer and output a contour error prediction matrix corresponding to the spatial size of the input two-dimensional feature map. The contour error prediction matrix is the final contour error distribution map.
[0060] Specifically, the second deep learning prediction model is built upon an improved CCNet model, aiming to leverage CCNet's advantages in processing two-dimensional spatial data, particularly its ability to efficiently capture long-range dependencies, thereby enhancing the accuracy and robustness of contour error prediction. The improved CCNet model means that the original CCNet has been optimized and adjusted for the ultra-precision turning contour error prediction task. This includes adjusting the network depth, number of channels, activation functions, or the specific implementation of attention mechanisms to better adapt to the data characteristics and prediction objectives of this domain. This model can be implemented by modifying the layer structure of the original CCNet, the attention calculation method, or by introducing additional auxiliary modules.
[0061] The model comprises a cascaded backbone network, a recurrent cross-junction attention module, and a second output module. This modular design enables the model to process information in stages: first, basic feature extraction is performed; then, the attention mechanism enhances contextual understanding; and finally, prediction results are generated, thereby improving the model's efficiency and interpretability.
[0062] The backbone network is a fundamental component of deep learning models, and its main function is to automatically learn and extract useful, high-level feature representations from the raw input data. For the input two-dimensional feature map, the backbone network gradually transforms low-level features (such as edges and textures) into high-level semantic features through a series of convolutional layers, pooling layers, and activation functions. These features are crucial for subsequent contour error prediction.
[0063] The recurrent cross-attention module is a core innovation of CCNet. It captures global contextual information through two independent cross-attention operations. The first operation computes attention weights and aggregates features in the horizontal direction, while the second operation is performed in the vertical direction. This alternating operation allows each pixel to effectively aggregate information from all pixels in its row and column, thereby indirectly capturing long-range dependencies across the entire two-dimensional plane without requiring global computation like fully self-attention, significantly reducing computational complexity. This module typically contains two branches: one for horizontal attention computation and the other for vertical attention computation. Each branch generates query, key, and value features through convolution operations, then computes the attention map and performs feature aggregation. The recurrent mechanism means that the cross-attention operation can be repeated multiple times to further enhance the ability to capture long-range dependencies.
[0064] The second output module is the model's final prediction layer. Its main function is to convert the high-dimensional feature representation processed by the backbone network and the recurrent cross-attention module into a single-channel contour error prediction matrix that matches the spatial size of the input two-dimensional feature map. Each element of this matrix represents the predicted contour error value at the corresponding location on the processing surface. This module typically consists of one or more convolutional layers; for example, a 1x1 convolutional kernel can be used to reduce the number of channels in the input feature map from N (N>1) to 1. After the convolutional layers, activation functions can be added or not, depending on the needs. The final output matrix size should be consistent with the spatial size of the input two-dimensional feature map to ensure that each prediction value accurately corresponds to a location on the processing surface.
[0065] By constructing a second deep learning prediction model based on an improved CCNet model and employing a cascaded architecture of a backbone network, a recurrent cross-attention module, and a second output module, this application achieves efficient and accurate prediction of surface contour errors in ultra-precision turning. Specifically, the backbone network effectively extracts multi-level semantic information from a two-dimensional spatial feature map that integrates multi-physics features and dynamic cutting forces. Building upon this, the recurrent cross-attention module overcomes the limitations of the limited receptive field of traditional convolutional networks and avoids the enormous computational overhead of fully self-attention mechanisms by alternately calculating attention weights and aggregating features in the horizontal and vertical directions, thus efficiently capturing long-range contextual dependencies on the two-dimensional machining plane. This means the model can fully understand the interactions between different regions on the machining surface; for example, how cutting forces or microstructural changes in one region affect the contour error in a distant region, thereby establishing a more comprehensive global correlation. Finally, the second output module transforms this rich contextual information into a refined contour error prediction matrix, i.e., the final contour error distribution map. This structure enables the model to significantly improve the accuracy of contour error prediction and the ability to capture changes in complex machined surfaces while ensuring computational efficiency, providing a more reliable basis for the optimization and control of ultra-precision turning processes.
[0066] In one optional implementation, the second deep learning prediction model further includes a differentiable Gaussian blur layer, which is placed after the second output module to perform Gaussian blur processing on the contour error prediction matrix output by the second output module in order to filter out high-frequency noise in the prediction results.
[0067] When training the second deep learning prediction model, the cutting force collected or predicted in the historical processing and the corresponding true contour error distribution map are used as supervision signals. The loss function is constructed with the goal of minimizing the error between the predicted contour error after processing by a differentiable Gaussian blur layer and the true contour error. The parameters of the differentiable Gaussian blur layer participate in the backpropagation and update of the loss function.
[0068] Specifically, a differentiable Gaussian blur layer is a special processing module whose core capability lies in performing a Gaussian blur operation on the input image data while maintaining the differentiability of the operation. This means that during the training of the neural network, forward and backward propagation calculations performed through this layer can proceed smoothly, and gradients can be effectively backpropagated, allowing the model to adjust its internal parameters through optimization algorithms. This layer is typically implemented using a series of differentiable convolutional kernels, whose weights can be designed to simulate Gaussian functions or learned during training. Its main function is to smooth the original contour error prediction matrix output by the second output module. In ultra-precision machining, the predicted contour error often needs to reflect the macroscopic and mesoscopic surface morphology, while the model may generate some small, sharp fluctuations, i.e., high-frequency noise, during the learning process. Gaussian blurring can effectively attenuate these high-frequency components, making the prediction results smoother and more consistent with the continuity and smoothness characteristics of actual physical surfaces.
[0069] Placing the differentiable Gaussian blur layer after the second output module ensures that the initial contour error prediction matrix is smoothed immediately after the model outputs it. This arrangement allows the subsequent loss function calculation to directly apply to the smoothed prediction values, thereby guiding the model to learn and generate inherently smoother, less noisy feature representations during training, rather than simply performing post-processing at the final output.
[0070] When training the second deep learning prediction model, the cutting force and corresponding real contour error distribution map collected or predicted in historical machining are used as supervision signals. This means that during the learning process, the model receives actual input conditions (cutting force, etc.) and corresponding real surface contour errors as references. By comparing the model's prediction results with these real data, the model can continuously adjust its internal parameters to improve prediction accuracy.
[0071] To achieve more accurate and robust predictions, this application constructs a loss function for training with the objective of minimizing the error between the predicted contour error after processing by the differentiable Gaussian blur layer and the true contour error. This loss function design means that during optimization, the model no longer simply pursues a match between the original predicted value and the true value, but rather a match between the predicted value after Gaussian blur processing and the true value. This effectively encourages the model to learn to predict contour error distributions that are physically more reasonable and smoother.
[0072] Furthermore, the parameters of the differentiable Gaussian blur layer participate in the backpropagation and update of the loss function. This means that the Gaussian blur layer is not a fixed, unlearnable post-processing step, but rather an integral part of the overall model learning process. If the parameters of the Gaussian blur layer are learnable (e.g., the variance of the Gaussian kernel), these parameters will also be adjusted according to the gradient of the loss function during training, allowing the blurring operation itself to adapt to the data characteristics and achieve optimal smoothing. Even if the Gaussian kernel is fixed, its differentiability ensures that the gradient can penetrate this layer and be effectively backpropagated to the preceding network layers, thereby guiding the entire model to learn and generate intermediate features more suitable for blurring, ultimately outputting more accurate and stable contour error predictions.
[0073] By integrating a differentiable Gaussian blur layer into the architecture of the second deep learning prediction model and allowing its parameters to participate in the training process, the high-frequency noise and artifacts in the original prediction results can be effectively addressed. This approach allows the model's optimization objective during training to directly focus on generating a smoother and more physically meaningful contour error distribution. Specifically, since the loss function is calculated based on the Gaussian-blurred prediction values, the model is guided to learn internal feature representations that produce smooth outputs, thus avoiding overfitting to noise in the training data or artifacts generated by the model itself. This not only significantly improves the accuracy and stability of ultra-precision turning contour error prediction, making the prediction results closer to the actual surface morphology, but also avoids additional post-processing steps that may result in information loss by considering smoothness during the training phase, thereby ensuring end-to-end optimization and efficiency of the prediction process. Ultimately, this approach provides a more reliable and instructive contour error distribution map, providing a solid data foundation for the optimization and control of ultra-precision machining processes.
[0074] In one alternative implementation, the backbone network uses ResNet-50 and desampling is performed in its first convolutional layer to preserve high-frequency detail information.
[0075] Specifically, the backbone network is the core component in a deep learning model responsible for extracting basic features from the input data. Using ResNet-50 as the backbone network leverages its architectural advantages in deep residual learning. ResNet-50 is a 50-layer convolutional neural network that effectively solves the vanishing and exploding gradient problems in deep network training by introducing residual connections, enabling it to learn more complex and richer feature representations. Its powerful feature extraction capabilities make it perform well in visual tasks such as image recognition and object detection, providing high-quality feature input for subsequent attention mechanisms. Meanwhile, downsampling operations are typically implemented by increasing the stride of the convolutional kernel or using pooling layers, aiming to reduce the spatial size of the feature map, thereby reducing computation and expanding the receptive field. However, while reducing size, this operation inevitably loses some spatial detail information, especially high-frequency information. In this implementation, the downsampling operation in the first convolutional layer of ResNet-50 is omitted; specifically, the stride of this convolutional layer is set to 1, and pooling is not performed immediately after this layer. This approach aims to ensure that the original spatial resolution of the input 2D feature map is fully preserved in the initial stage of feature extraction, avoiding the loss of subtle geometric information crucial to ultra-precision turning contour errors due to premature downsampling. High-frequency detail information refers to the rapidly changing parts of an image or feature map, corresponding to the edges, textures, and fine structures of an object. In ultra-precision turning contour error prediction, this high-frequency detail information directly reflects the minute undulations, scratches, tool marks, and other irregularities on the machined surface, and is a key element constituting the final contour error distribution. By canceling the downsampling operation of the first convolutional layer, the model can preserve these high-frequency details to the maximum extent, allowing the subsequent recurrent cross-attention module to perform contextual learning on a more refined feature map, thereby more accurately capturing and predicting extremely small contour errors on the machined surface.
[0076] Through the above technical solution, the backbone network of the second deep learning prediction model adopts ResNet-50, and the downsampling operation in its first convolutional layer is removed. This effectively solves the problem of potential loss of high-frequency detail information in the initial feature extraction stage. Specifically, ResNet-50, as a powerful feature extractor, can extract rich and discriminative features from multi-channel two-dimensional spatial feature maps. Simultaneously, by removing the downsampling operation in the first convolutional layer, the original spatial resolution and all high-frequency detail information of the input two-dimensional feature map are fully preserved in the early stages of feature extraction, avoiding a decrease in prediction accuracy due to information loss. This allows the subsequent recurrent cross-attention module to establish global contextual relationships on a more refined and comprehensive feature representation, thereby more accurately capturing extremely small contour errors on ultra-precision machined surfaces, significantly improving the prediction accuracy and detail restoration capability of the machining surface contour error distribution map.
[0077] In addition, such as Figure 4 As shown, this application proposes an ultra-precision turning contour error prediction system based on a serial attention mechanism. The system includes a data acquisition and preprocessing module, a time-series cutting force prediction module, and a spatial contour error prediction module.
[0078] Specifically, the data acquisition and preprocessing module is used to acquire multi-physics field features. These features include process and spatiotemporal position features, kinematic dynamic features, and microstructure geometric gradient features, all of which correspond to the spatiotemporal position of the tool tip relative to the workpiece. This module uses a sensor array, such as force sensors, displacement sensors, and encoders, to acquire raw data in real time during the ultra-precision turning process, such as cutting force, tool position, and spindle speed. Subsequently, the acquired raw data undergoes preprocessing operations such as data cleaning, synchronization, and normalization to eliminate noise, calibrate timestamps, and unify data scales. For example, based on the real-time position of the tool and the geometric information of the workpiece, the spatiotemporal position of the tool tip relative to the workpiece is accurately calculated, and the required process and spatiotemporal position features, kinematic dynamic features, and microstructure geometric gradient features are extracted based on this. The precise correspondence between the acquisition of these features and the spatiotemporal position of the tool tip relative to the workpiece ensures the temporal and spatial consistency and accuracy of the subsequent model input data.
[0079] The time-series cutting force prediction module incorporates a first deep learning prediction model. This model organizes the features acquired in S1 into a one-dimensional time-series sequence and inputs it into the first deep learning prediction model. The first deep learning prediction model employs a time-series prediction architecture based on a Prob sparse self-attention mechanism. This architecture captures the long-range temporal dependencies of the cutting force signal and outputs predicted values of the three-dimensional dynamic cutting force within a preset future time period. Internally, this module integrates a time-series prediction architecture based on a Prob sparse self-attention mechanism, such as one built on an improved Informer model (as described above). This architecture efficiently processes long-series data, effectively capturing the long-range temporal dependencies in the cutting force signal through a probabilistic sparse self-attention mechanism, thereby outputting a three-dimensional dynamic cutting force sequence within a preset future time period.
[0080] The spatial contour error prediction module incorporates a second deep learning prediction model. This model samples the features into a multi-channel two-dimensional spatial feature map based on the mapping relationship with the machined surface position. The three-dimensional dynamic cutting force predicted by S2 is added as an additional feature channel to the two-dimensional spatial feature map. The fused two-dimensional feature map is then input to the second deep learning prediction model, which employs a spatial prediction architecture based on a cross-attention mechanism. This architecture establishes a global context association on the two-dimensional plane and outputs a two-dimensional machining surface contour error distribution map. This module samples the features provided by the data acquisition and preprocessing module into a multi-channel two-dimensional spatial feature map based on the mapping relationship with the machined surface position. Simultaneously, the three-dimensional dynamic cutting force output by the time-series cutting force prediction module is used as an additional feature channel and fused with the two-dimensional spatial feature map. The fused two-dimensional feature map is then input to the built-in second deep learning prediction model. This model employs a spatial prediction architecture based on a cross-attention mechanism, such as a model built on an improved CCNet (as described above), which can establish a global context association on the two-dimensional plane, thereby outputting a detailed machining surface contour error distribution map.
[0081] In one alternative implementation, the timing cutting force prediction module is configured to automatically call sub-models independently trained for planar turning or cylindrical turning conditions based on the machining trajectory, so as to output three-dimensional dynamic cutting force prediction values.
[0082] Specifically, the sub-models trained independently for planar turning or cylindrical turning are two common basic working conditions in ultra-precision turning. Planar turning and cylindrical turning differ significantly in cutting geometry, cutting parameters, and the relative motion between the tool and workpiece, resulting in different characteristics of the cutting force signals. Independently trained sub-models refer to training and optimizing the first deep learning prediction model specifically for each particular working condition using the cutting force data and multiphysics feature data collected under that condition. This independent training allows each sub-model to more accurately capture the dynamic characteristics of the cutting force under its corresponding working condition, thereby improving prediction accuracy. These sub-models can be specific weight sets or parameter configurations of the first deep learning prediction model (employing a temporal prediction architecture based on a Prob sparse self-attention mechanism).
[0083] Through the above technical solution, the timing-based cutting force prediction module can intelligently select and apply sub-models optimized for specific working conditions based on the type of actual machining trajectory. This method of automatically calling independently trained sub-models based on the machining trajectory effectively solves the problem that a single model cannot adequately cover the accuracy of cutting force prediction under different complex turning conditions. Specifically, for planar turning, the system calls a sub-model specifically trained for planar turning, which can more accurately capture the changing patterns of cutting forces during planar cutting; while for cylindrical turning, it calls a sub-model optimized for cylindrical turning, thereby accurately predicting the dynamic cutting forces unique to cylindrical cutting. This adaptive prediction strategy significantly improves the accuracy and robustness of three-dimensional dynamic cutting force prediction, providing a more reliable input for subsequent spatial contour error prediction, and thus improving the overall accuracy and applicability of the entire ultra-precision turning contour error prediction system.
[0084] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A method for predicting ultra-precision turning contour errors using a serial attention mechanism, characterized in that, Includes the following steps: S1. Obtain multi-physics field features; the features include process and spatiotemporal position features, kinematic dynamic features and microstructure geometric gradient features, and all the features correspond to the spatiotemporal position of the tool tip relative to the workpiece; S2. Organize the features obtained in S1 into a one-dimensional time sequence and input it into the first deep learning prediction model. The first deep learning prediction model adopts a time prediction architecture based on the Prob sparse self-attention mechanism to capture the long-distance time-series dependency of the cutting force signal and output the predicted value of the three-dimensional dynamic cutting force in the future preset time period. S3. The features obtained in S1 are sampled into a multi-channel two-dimensional spatial feature map according to the mapping relationship with the position of the machining surface. The predicted value of the three-dimensional dynamic cutting force obtained in S2 is added to the two-dimensional spatial feature map as an additional feature channel. The fused two-dimensional feature map is input into the second deep learning prediction model. The second deep learning prediction model adopts a spatial prediction architecture based on the cross attention mechanism to establish global context association on the two-dimensional plane and output a two-dimensional machining surface contour error distribution map.
2. The method according to claim 1, characterized in that, In S1, the process and spatiotemporal position features include the number of machining revolutions, the tool circumferential angle, the radial feed displacement, and the cutting axis displacement; The kinematic dynamic characteristics include the instantaneous linear velocity and instantaneous linear acceleration of the cutting axis; wherein, the instantaneous linear acceleration is used to indirectly characterize the influence of the servo motor force; The microstructure geometric gradient features include the circumferential gradient and radial gradient of the surface, which are calculated in real time based on a preset mathematical model of the microstructure surface to be processed.
3. The method according to claim 1, characterized in that, The first deep learning prediction model is built on an improved Informer model and includes an input feature organization module, an encoder module, a decoder module and a first output module that are cascaded in sequence. The input feature organization module is used to divide the features in the one-dimensional time series into time features and value features; The temporal features are converted into dense vectors through an embedding layer and then input into the encoder module, while the value features are directly input into the encoder module. The encoder module is composed of multiple identical layers stacked together. Each layer contains two multi-head probabilistic sparse self-attention modules and a forward propagation module, which are used to efficiently model and process long-sequence cutting force signals through the Prob sparse attention mechanism. The decoder module consists of multiple identical layers stacked together. Each layer contains two masked multi-head probabilistic sparse self-attention modules, a multi-head attention module that interacts with the output of the encoder module, and a forward propagation module. It is used to ensure that the prediction does not depend on future information by using a masking mechanism and to generate the entire future cutting force sequence at once. The first output module is used to receive the output result of the decoder module, and process the output result through a fully connected layer to obtain the cutting force sequence within a future preset time period.
4. The method according to claim 3, characterized in that, The first deep learning prediction model establishes and trains corresponding sub-models for planar turning and cylindrical turning respectively, and automatically calls the corresponding sub-model according to the machining trajectory during actual prediction.
5. The method according to claim 1, characterized in that, The second deep learning prediction model is built on an improved CCNet model, which includes a backbone network, a recurrent cross-attention module, and a second output module that are cascaded in sequence. The backbone network is used for feature extraction from the input two-dimensional feature map; The cyclic cross-attention module is used to alternately perform attention weight calculation and feature aggregation in the horizontal and vertical directions to capture long-range contextual dependencies on the two-dimensional processing plane. The second output module is used to reduce the number of channels to 1 through a convolutional layer and output a contour error prediction matrix corresponding to the spatial size of the input two-dimensional feature map; the contour error prediction matrix is the final contour error distribution map.
6. The method according to claim 5, characterized in that, The second deep learning prediction model also includes a differentiable Gaussian blur layer, which is set after the second output module to perform Gaussian blur processing on the contour error prediction matrix output by the second output module in order to filter out high-frequency noise in the prediction results. During training, the second deep learning prediction model uses the cutting force collected or predicted in historical processing and the corresponding true contour error distribution map as supervision signals. The loss function is constructed with the goal of minimizing the error between the predicted contour error value after processing by the differentiable Gaussian blur layer and the true contour error. The parameters of the differentiable Gaussian blur layer participate in the backpropagation and update of the loss function.
7. The method according to claim 5, characterized in that, The backbone network uses ResNet-50, and downsampling is disabled in its first convolutional layer to preserve high-frequency detail information.
8. A system for predicting ultra-precision turning contour errors based on a serial attention mechanism, used to implement the method as described in any one of claims 1 to 7, characterized in that, include: The data acquisition and preprocessing module is used to acquire multi-physics field features; the features include process and spatiotemporal position features, kinematic dynamic features and microstructure geometric gradient features, and all of the features correspond to the spatiotemporal position of the tool tip relative to the workpiece; The timing cutting force prediction module has the first deep learning prediction model built in, which is used to organize the features obtained by S1 into a one-dimensional timing sequence and input it into the first deep learning prediction model. The first deep learning prediction model adopts a timing prediction architecture based on the Prob sparse self-attention mechanism, which is used to capture the long-distance timing dependency of the cutting force signal and output the three-dimensional dynamic cutting force prediction value within a preset time period in the future. The spatial contour error prediction module incorporates the second deep learning prediction model, which samples the features into a multi-channel two-dimensional spatial feature map based on the mapping relationship with the position of the machining surface. The predicted three-dimensional dynamic cutting force value obtained by S2 is added to the two-dimensional spatial feature map as an additional feature channel. The fused two-dimensional feature map is then input into the second deep learning prediction model. The second deep learning prediction model adopts a spatial prediction architecture based on a cross-attention mechanism, which is used to establish global context association on the two-dimensional plane and output a two-dimensional machining surface contour error distribution map.
9. The system according to claim 8, characterized in that, The timing cutting force prediction module is configured to automatically call sub-models independently trained for planar turning or cylindrical turning conditions based on the machining trajectory, so as to output three-dimensional dynamic cutting force prediction values.