Machine tool feed shaft lead screw thermal error modeling and compensating method based on micro transfer learning

By deploying thermal imagers and displacement sensors on machine tools, a thermal error prediction network with a shared feature layer and a private adaptation layer is constructed. This solves the problems of information loss and low prediction accuracy in cross-machine tool thermal error modeling, and achieves efficient and real-time thermal error compensation.

CN121934476APending Publication Date: 2026-04-28SHAANXI IND VOCATIONAL & TECH COLLEGE
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHAANXI IND VOCATIONAL & TECH COLLEGE
Filing Date
2026-01-30
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Existing thermal error modeling methods rely on discrete sensors, resulting in information loss. They also have poor generalization ability in thermal image modeling, low prediction accuracy when migrating across machine tools, and high data acquisition costs for remodeling.

Method used

By employing a micro-transfer learning-based approach, thermal imagers and displacement sensors are deployed on both the source and target machine tools to construct a thermal error prediction network that includes a shared feature layer and a private adaptation layer. The model is trained on the source machine tool and fine-tuned on the target machine tool, achieving high-precision thermal error prediction and compensation across machine tools.

Benefits of technology

It achieves high-precision thermal error prediction across machine tools with small sample data, reduces data acquisition costs and modeling cycle, improves the robustness of thermal image feature extraction, prevents overfitting, and meets the real-time requirements of industrial control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121934476A_ABST
    Figure CN121934476A_ABST
Patent Text Reader

Abstract

The invention discloses a machine tool feed shaft lead screw thermal error modeling and compensating method based on micro transfer learning, and belongs to the technical field of machine tool precision control. The method comprises the following steps: firstly, respectively acquiring a lead screw thermal image and lead screw axial thermal error data on a source machine tool and a target machine tool; training a basic network architecture comprising a shared feature layer and a private adaptation layer by using source machine tool data; then, a target machine tool prediction model is constructed, shared feature layer parameters trained by a source machine tool are frozen and migrated, only a private adaptation layer is randomly initialized, and a small amount of target machine tool data is used for fine tuning training; and finally, inputting a thermal image acquired by the target machine tool in real time into the adapted model, outputting a thermal error prediction value, and sending the thermal error prediction value to a numerical control system for real-time position correction. According to the method, the problems of poor generalization ability of cross-machine-tool modeling and high data acquisition cost are effectively solved, and high-precision prediction and compensation of thermal errors under small samples are realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of precision control technology for CNC machine tools, and more specifically, to a method for modeling and compensating for thermal errors in the feed axis leadscrew of a machine tool based on micro-transfer learning. Background Technology

[0002] Thermal error of the machine tool feed axis lead screw is a major factor affecting machining accuracy, accounting for approximately 40%-70% of the total machining error of the machine tool. As the machine tool runs, the frictional heat generated by the lead screw, nut pair, bearings, and other components leads to axial thermal elongation, which seriously affects the machining dimensional accuracy.

[0003] Existing thermal error modeling methods are mainly divided into two categories: one is based on collecting discrete temperature data using contact temperature sensors (such as thermocouples). This method has problems such as cumbersome measurement point layout, easy omission of spatial temperature distribution information, and modeling relying on a large amount of measured data; the other is to use thermal images to obtain the global temperature distribution. However, existing methods directly input thermal images into a general network, resulting in poor model generalization ability and difficulty in adapting to different models of machine tools.

[0004] Transfer learning offers a framework for cross-machine tool modeling, but existing methods primarily target one-dimensional temperature sequence data, failing to fully leverage the spatiotemporal features of thermal images. Furthermore, even for the same model of machine tool, subtle differences in thermal characteristics exist due to assembly variations and operating conditions. Directly transferring the model results in a significant drop in prediction accuracy; re-collecting large amounts of data for modeling presents challenges of high cost and long development cycles. Therefore, there is an urgent need for a thermal error modeling and compensation method that can directly utilize thermal images and achieve rapid, high-precision adaptation across operating conditions and machine tools with minimal data. Summary of the Invention

[0005] This invention aims to solve the problems of existing thermal error modeling methods relying on discrete sensors, resulting in information loss; poor generalization ability of existing thermal image modeling; low prediction accuracy due to differences in data distribution when migrating across machine tools; and high data acquisition costs for remodeling.

[0006] To solve the above problems, the technical solution adopted by the present invention is as follows:

[0007] A method for modeling and compensating thermal errors of machine tool feed axis leadscrews based on micro-transfer learning includes the following steps:

[0008] Step S1, Data Acquisition: Thermal imagers and displacement sensors are installed on both the source machine tool and the target machine tool to collect thermal images of the feed axis leadscrew under different working conditions and the corresponding leadscrew axial thermal error data, and to construct the source machine tool training set and the target machine tool fine-tuning set respectively.

[0009] Step S2, Source Machine Tool Model Training: Construct a basic network architecture for thermal error prediction, which includes a shared feature layer and a private adaptation layer connected in sequence; train the basic network architecture for thermal error prediction using the source machine tool training set to obtain a pre-trained model of the source machine tool with optimized parameters;

[0010] Step S3, Micro-transfer Learning Cross-Machine Tool Adaptation: Construct a target machine tool prediction model based on the thermal error prediction network architecture; fix and transfer the parameters of the shared feature layer in the source machine tool pre-trained model to the shared feature layer corresponding to the target machine tool prediction model, while randomly initializing the parameters of the private adaptation layer in the target machine tool prediction model; use the target machine tool fine-tuning set to fine-tune and train the target machine tool prediction model to obtain the adapted target machine tool prediction model;

[0011] Step S4, Real-time thermal error compensation: Input the real-time thermal image of the target machine tool into the adapted target machine tool prediction model, output the predicted thermal error value, and generate a compensation command based on the predicted thermal error value and send it to the machine tool CNC system to correct the position of the lead screw in real time.

[0012] Furthermore, in step S1, the thermal imager is installed on the side of the machine tool feed axis and its field of view completely covers the lead screw transmission system. The displacement sensor is an eddy current displacement sensor installed on the non-motor connection end of the lead screw. The specific process of data acquisition is as follows: the machine tool is controlled to run under different speed and load conditions, the thermal imager is used to capture thermal images of the lead screw, and the axial elongation of the lead screw is read simultaneously using the eddy current displacement sensor as the axial thermal error data of the lead screw.

[0013] Furthermore, in step S2, before inputting the thermal image into the thermal error prediction basic network architecture, the thermal image is first uniformly scaled to a size of 224×224 pixels; the shared feature layer adopts a three-level network structure, including a block rearrangement module, a position encoding and attention fusion module, and a residual connection and shape restoration module connected in sequence.

[0014] Furthermore, the block rearrangement module is used to perform block operations, dividing the input thermal image of size H×W into N square region units of size Δ, and rearranging the N square region units to obtain a rearranged feature map; the position encoding and attention fusion module adds position encoding to each square region unit in the rearranged feature map through a broadcast mechanism to form a position encoded feature map, and combines a local attention mechanism and an SE channel attention mechanism to enhance the features of the position encoded feature map.

[0015] Furthermore, the processing procedure of the residual connection and shape restoration module includes: introducing a 1×1 convolutional layer to perform channel alignment on the features output by the block rearrangement module to generate a residual convolutional feature representation; performing a residual connection between the residual convolutional feature representation and the feature map output by the position encoding and attention fusion module to obtain a residual feature map; and restoring the residual feature map to a feature representation of the original image size using a shape restoration function, which is then used as the output of the shared feature layer.

[0016] Furthermore, during the model training process in step S2, the mean square error between the lead screw axial thermal error data and the thermal error prediction value output by the model is used as the loss function. The Adam optimizer is used to perform full-parameter iterative optimization on the shared feature layer and the private adaptation layer until the prediction fitting rate of the model on the source machine tool validation set reaches a preset threshold.

[0017] Furthermore, the private adaptation layer is composed of a lightweight fully connected layer, and its parameter size is configured to be 5% to 10% of the parameter size of the shared feature layer; in step S3, the fine-tuning training process only uses the target machine tool fine-tuning set to update the weights of the private adaptation layer in the target machine tool prediction model, while the weights of the shared feature layer remain unchanged.

[0018] Furthermore, the target machine tool data in the target machine tool fine-tuning set consists of 50 to 100 groups; in step S3, a small learning rate is configured during the fine-tuning training process, with the initial learning rate set to 1e-5, and the learning rate is dynamically adjusted using a cosine annealing algorithm; at the same time, an early stopping strategy is set, and fine-tuning is stopped when the root mean square error of the prediction model on the target machine tool test data is less than or equal to a set accuracy threshold.

[0019] Furthermore, the specific execution process of step S4 includes:

[0020] Calculate the axial compensation correction amount: Calculate the axial compensation correction amount based on the direction of the lead screw movement and the thermal error prediction value output by the target machine tool prediction model;

[0021] Issuing compensation instructions: The axial compensation correction amount is written into the dedicated compensation register of the CNC system through the secondary development interface of the machine tool CNC system; the CNC system automatically calls the value of the dedicated compensation register to correct the feed axis coordinate during interpolation calculation.

[0022] Furthermore, the method of the present invention also includes system closed-loop optimization and maintenance: monthly periodic collection of new thermal images of the target machine tool and corresponding lead screw axial thermal error data to incrementally fine-tune the private adaptation layer; every 3 months, adding new thermal images of the source machine tool and corresponding lead screw axial thermal error data to the source machine tool training set to incrementally train the shared feature layer; establishing a mapping library between machine tool models and private adaptation layer parameters, and when a new machine tool of the same series is connected, directly calling the private adaptation layer parameters of similar models of machine tools in the mapping library as the initial values ​​of the private adaptation layer of the new machine tool.

[0023] Compared with the prior art, the beneficial effects of the present invention are:

[0024] (1) Achieving high-precision cross-machine tool migration with small sample sizes: This invention adopts a network architecture that separates the shared feature layer and the private adaptation layer. It uses sufficient data from the source machine tool to train general features. When migrating to the target machine tool, by fixing the parameters of the shared feature layer and only re-initializing and fine-tuning the private adaptation layer, only a small amount of target machine tool data is needed to complete the model adaptation. This not only solves the model failure problem caused by the difference in thermal characteristics across machine tools, but also significantly reduces the data acquisition cost and modeling cycle of the target machine tool.

[0025] (2) Improve the robustness of thermal image feature extraction: This invention designs a three-level network structure of "block rearrangement - position encoding and attention fusion - residual connection and shape restoration" in the shared feature layer. Through block rearrangement and attention mechanism, it can effectively extract local and global key physical information reflecting the thermal state of the lead screw in the thermal image, avoid feature loss when the traditional convolutional network processes fine-grained heat distribution, and significantly improve the prediction accuracy of the model under different working conditions.

[0026] (3) Preventing overfitting and ensuring transfer efficiency: The present invention designs the private adaptation layer as a lightweight fully connected layer, with its parameter scale being only 5%-10% of that of the shared feature layer, and fine-tunes it with a small learning rate and an early stopping strategy. This design not only ensures that the model can quickly adapt to the unique distribution of the target machine tool, but also effectively prevents overfitting under training with small sample data (such as 50-100 sets), thus ensuring the generalization ability of the model.

[0027] (4) Strong real-time performance, meeting the needs of industrial control: This invention directly outputs the predicted value of thermal error through the prediction model and directly operates the dedicated compensation register through the secondary development interface of the CNC system, realizing millisecond-level prediction and compensation response, effectively solving the compensation lag problem caused by calculation and communication delay in the traditional method.

[0028] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, embodiments of the present invention are described below in detail with reference to the accompanying drawings. Attached Figure Description

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

[0030] Figure 1 This is a schematic diagram of the overall process of the method provided in the embodiment of the present invention, which shows the closed-loop process of data acquisition, model building, migration adaptation and compensation execution;

[0031] Figure 2 This is a schematic diagram of the layout of the data acquisition device in an embodiment of the present invention, showing the installation positions of the thermal imager and the displacement sensor on the machine tool feed axis;

[0032] Figure 3 This is a schematic diagram of the basic network architecture for thermal error prediction in an embodiment of the present invention, which shows in detail the three-level network structure of "block rearrangement - position encoding and attention fusion - residual connection and shape recovery" in the shared feature layer;

[0033] Figure 4 This is a schematic diagram of the architecture for micro-transfer learning cross-machine tool adaptation in an embodiment of the present invention, illustrating the training strategy of fixing the parameters of the shared feature layer and fine-tuning the private adaptation layer;

[0034] Figure 5 This is a block diagram of the execution logic for real-time thermal error compensation in an embodiment of the present invention;

[0035] Figure 6 This is a diagram showing the actual installation scene of the data acquisition equipment at the experimental site in an embodiment of the present invention;

[0036] Figure 7 These are thermal imaging comparison images of the same lead screw collected at different time points in this embodiment of the invention, showing the significant thermal differences of the lead screw as the running time increases;

[0037] Figure 8 This is a schematic diagram of the error convergence curve during the training process of the source machine tool model in this embodiment of the invention;

[0038] Figure 9 This is an interface diagram showing the test results of the time consumption for thermal error prediction of a single thermal image in an embodiment of the present invention. Detailed Implementation

[0039] 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 some embodiments of the present invention, but not all embodiments.

[0040] Please refer to Figure 1 This invention provides a method for modeling and compensating thermal errors of machine tool feed axis leadscrews based on micro-transfer learning. The method mainly includes steps such as data acquisition, source machine tool model training, micro-transfer learning cross-machine tool adaptation, real-time thermal error compensation, and system closed-loop optimization.

[0041] Step S1, Data Acquisition

[0042] This step aims to build a dataset for model training and fine-tuning. The experimental subjects include source machine tools (to provide sufficient data for basic training) and target machine tools (with limited data, to be adapted).

[0043] Hardware layout: such as Figure 2 and Figure 6 As shown, data acquisition devices are arranged on both the source and target machine tools:

[0044] Thermal imager: Select a thermal imager with a resolution of ≥320×240 pixels and thermal sensitivity of ≤0.06℃ (FLIR E5 is used in this embodiment), install it on the side of the machine tool feed axis (e.g., at a distance of 1.5m), adjust the field of view to completely cover the lead screw drive system, and use it to acquire thermal images of the lead screw in a non-contact manner.

[0045] Displacement sensor: An eddy current displacement sensor with a resolution ≤1μm is selected (K-9000 with a resolution of 0.5μm is used in this embodiment), and is installed at the non-motor connection end (floating end) of the lead screw to measure the axial elongation of the lead screw under thermal deformation. This measured value is the axial thermal error data of the lead screw.

[0046] Acquisition process: The machine tool is controlled to operate under different speeds (e.g., alternating between high and low speeds) and load conditions. Thermal images of the lead screw are captured using a thermal imager. Figure 7 As shown in the figure, this image displays thermal images of the same leadscrew acquired at different time points. It is evident that the temperature distribution and thermal characteristics of the leadscrew surface exhibit significant differences as the machine tool's operating time increases. These thermal images, rich in spatiotemporal features, form the basis for subsequent modeling. Simultaneously, eddy current displacement sensors are used to synchronously read the corresponding axial thermal error data of the leadscrew.

[0047] Source machine tool training set: The source machine tool collects one set of data every 20 seconds, for a total of 1080 sets, covering a variety of working conditions.

[0048] Target machine tool fine-tuning set: Only a small amount of data is collected for the target machine tool (e.g., 50-100 sets, 80 sets in this embodiment).

[0049] Step S2: Source machine tool model training

[0050] like Figure 3 As shown, a basic network architecture for thermal error prediction is constructed, which includes a shared feature layer and a private adaptation layer connected in sequence.

[0051] 1. Data preprocessing:

[0052] Since the pixel values ​​of thermal images contain key physical temperature information, in order to avoid changing the physical scale and introducing noise through conventional normalization (such as subtracting the mean and dividing the variance), this embodiment only uniformly scales the input thermal image to a size of 224×224 pixels, and then directly inputs it into the network.

[0053] 2. Network architecture details:

[0054] The shared feature layer adopts a three-level network structure of "block rearrangement - position encoding and attention fusion - residual connection and shape recovery":

[0055] (1) Block rearrangement module:

[0056] Input image The block operation is performed to form a block of size Δ. The square regions (patches) are then rearranged. The formula is as follows:

[0057]

[0058]

[0059] in:

[0060] X is the input thermal image;

[0061] B represents the batch size;

[0062] C represents the number of image channels;

[0063] H is the image height, and W is the image width;

[0064] It is a block function;

[0065] Δ is the side length of the partitioned region;

[0066] N is the total number of region units after partitioning;

[0067] This represents the feature representation after block division;

[0068] This is the rearranged feature map.

[0069] (2) Location encoding and attention fusion module:

[0070] To preserve spatial location information, a location code P is added to each patch using a broadcast mechanism, forming a location-coded feature map:

[0071]

[0072] in:

[0073] This is the position encoding matrix;

[0074] This is the feature map after adding positional encoding.

[0075] Subsequently, the local attention mechanism and the SE channel attention mechanism were combined to... Feature enhancement is performed to obtain attention-enhanced feature maps. .

[0076] (3) Residual connection and shape restoration module:

[0077] 1×1 convolution is introduced to achieve channel alignment, and residual connections are used to avoid degradation of deep networks, ultimately restoring the original image size.

[0078] First, a 1×1 convolutional layer is used. Generate residual convolutional feature representations :

[0079]

[0080] right Obtain by performing block operations :

[0081]

[0082] Residual feature maps are obtained by performing residual connections. :

[0083]

[0084] Finally, the shape recovery function is used. Obtain the output feature map of the shared feature layer :

[0085]

[0086] in:

[0087] A 1×1 convolutional layer with input channel C to output dimension dim;

[0088] This is a residual feature map after block division;

[0089] This is the shape restoration function (i.e., the inverse operation of block division).

[0090] 3. Model training:

[0091] The network was trained using the source machine tool training set. The mean square error (MSE) between the lead screw axial thermal error data and the model's output thermal error predictions was used as the loss function.

[0092]

[0093] in:

[0094] y i This represents the actual axial thermal error data of the lead screw for the i-th sample.

[0095] The predicted thermal error value output by the model for the i-th sample;

[0096] n is the number of samples in the batch being calculated.

[0097] The Adam optimizer is used to perform full-parameter iterative optimization of the shared feature layer and the private adaptation layer. In this embodiment, the training batch size is set to 8, the number of input channels C=3, the total number of rounds is 75, the initial learning rate is 0.0001, and cosine annealing is used for dynamic adjustment. The final model achieves a prediction fit rate R² ≥ 97% on the source machine tool, and the error descent curve is shown below. Figure 8 As shown.

[0098] Step S3: Micro-transfer learning for cross-machine tool adaptation

[0099] like Figure 4 As shown, a target machine tool prediction model is constructed based on the above architecture. To address the issue of insufficient cross-machine tool data, a micro-migration strategy is adopted:

[0100] 1. Parameter transfer and freezing: Freeze all parameters of the shared feature layer in the source machine tool pre-trained model and transfer them directly to the shared feature layer of the target machine tool prediction model.

[0101] 2. Private Layer Initialization: The private adaptation layer consists of a lightweight fully connected layer, and its parameter size is configured to be 5% to 10% of the shared feature layer parameter size. During migration, the parameters of the private adaptation layer in the target machine tool prediction model are randomly initialized.

[0102] 3. Fine-tuning training: Using the collected 80 sets of target machine tools for fine-tuning, only the weights of the private adaptation layer are updated, while the weights of the shared feature layer remain unchanged.

[0103] Optimization strategy: Use a small learning rate (initially set to 1e-5) and dynamically adjust it in conjunction with the cosine annealing algorithm.

[0104] Early stopping strategy: Monitor the root mean square error (RMSE) of the model on the target machine tool test data. When the RMSE ≤ 8μm (set accuracy threshold), stop fine-tuning. It can usually be completed in 10-20 epochs, with a training time of about 74-78 seconds.

[0105] Verification: After migration, the predicted RMSE of the target machine tool model decreased to 6.8 μm, and the fitting rate R²=95.3%, which meets the accuracy requirements.

[0106] Step S4: Real-time thermal error compensation

[0107] like Figure 5 As shown, the adapted target machine tool prediction model is deployed, and real-time compensation is performed:

[0108] 1. Prediction: Input the real-time thermal images of the target machine tool into the model, and the model outputs the current predicted thermal error value. For example... Figure 9 As shown, the prediction time for a single image is ≤610 milliseconds, which meets the real-time requirements.

[0109] 2. Calculate the compensation amount: Calculate the axial compensation correction amount based on the direction of the lead screw movement and the predicted thermal error value.

[0110] 3. Command Issuance: The system interfaces with the machine tool's CNC system via Ethernet. The calculated axial compensation correction is written into the CNC system's dedicated compensation register (e.g., G36 register).

[0111] 4. Execution Correction: When the CNC system executes machining code (G code) to perform interpolation calculations, it will automatically read the value of this register and correct the feed axis coordinates.

[0112] Machining verification: A cylindrical workpiece with a diameter of 50mm was machined on the target machine tool. Before compensation, the roundness error of the workpiece was 26.7μm, and after compensation, the roundness error was reduced to 8.2μm, a reduction of approximately 68%.

[0113] To ensure long-term operational accuracy, we have also established a closed-loop optimization and maintenance mechanism for the system:

[0114] 1. Incremental fine-tuning of the private layer: Collect approximately 20 sets of new data on the target machine tool each month and perform incremental fine-tuning on the private adaptation layer.

[0115] 2. Shared layer extended training: Every 3 months, new working conditions (such as different loads) encountered by the source machine tool are added to the training set to incrementally train the shared feature layer.

[0116] 3. Parameter Mapping Library: Establish a mapping library of "Machine Tool Model - Private Adaptor Layer Parameters". When a new machine tool of the same series is connected, the optimal private adapter layer parameters of similar models in the library can be directly called as the initial values, which can further reduce the amount of fine-tuning data to 50 sets.

[0117] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for modeling and compensating thermal errors of machine tool feed axis leadscrews based on micro-transfer learning, characterized in that, Includes the following steps: Step S1, Data Acquisition: Thermal imagers and displacement sensors are installed on both the source machine tool and the target machine tool to collect thermal images of the feed axis leadscrew under different working conditions and the corresponding leadscrew axial thermal error data, and to construct the source machine tool training set and the target machine tool fine-tuning set respectively. Step S2, Source Machine Tool Model Training: Construct a basic network architecture for thermal error prediction, which includes a shared feature layer and a private adaptation layer connected in sequence; train the basic network architecture for thermal error prediction using the source machine tool training set to obtain a pre-trained model of the source machine tool with optimized parameters; Step S3, Micro-transfer Learning Cross-Machine Tool Adaptation: Construct a target machine tool prediction model based on the thermal error prediction network architecture; fix and transfer the parameters of the shared feature layer in the source machine tool pre-trained model to the shared feature layer corresponding to the target machine tool prediction model, while randomly initializing the parameters of the private adaptation layer in the target machine tool prediction model; use the target machine tool fine-tuning set to fine-tune and train the target machine tool prediction model to obtain the adapted target machine tool prediction model; Step S4, Real-time thermal error compensation: Input the real-time thermal image of the target machine tool into the adapted target machine tool prediction model, output the predicted thermal error value, and generate a compensation command based on the predicted thermal error value and send it to the machine tool CNC system to correct the position of the lead screw in real time.

2. The method for modeling and compensating thermal errors of machine tool feed axis leadscrews based on micro-transfer learning according to claim 1, characterized in that, In step S1, the thermal imager is installed on the side of the machine tool feed axis and its field of view completely covers the lead screw transmission system. The displacement sensor is an eddy current displacement sensor installed on the non-motor connection end of the lead screw. The specific process of data acquisition is as follows: the machine tool is controlled to run under different speed and load conditions, the thermal imager is used to capture thermal images of the lead screw, and the axial elongation of the lead screw is read simultaneously using the eddy current displacement sensor as the axial thermal error data of the lead screw.

3. The method for modeling and compensating thermal errors of machine tool feed axis leadscrews based on micro-transfer learning according to claim 1, characterized in that, In step S2, before inputting the thermal image into the thermal error prediction basic network architecture, the thermal image is first uniformly scaled to a size of 224×224 pixels; the shared feature layer adopts a three-level network structure, including a block rearrangement module, a position encoding and attention fusion module, and a residual connection and shape restoration module connected in sequence.

4. The method for modeling and compensating thermal errors of machine tool feed axis leadscrews based on micro-transfer learning according to claim 3, characterized in that, The block rearrangement module is used to perform block operations, dividing the input thermal image of size H×W into N square region units of size Δ, and rearranging the N square region units to obtain a rearranged feature map; the position encoding and attention fusion module adds position encoding to each square region unit in the rearranged feature map through a broadcast mechanism to form a position encoded feature map, and combines a local attention mechanism and an SE channel attention mechanism to enhance the features of the position encoded feature map.

5. The method for modeling and compensating thermal errors of machine tool feed axis leadscrews based on micro-transfer learning according to claim 4, characterized in that, The processing steps of the residual connection and shape restoration module include: introducing a 1×1 convolutional layer to perform channel alignment on the features output by the block rearrangement module to generate a residual convolutional feature representation; performing a residual connection between the residual convolutional feature representation and the feature map output by the position encoding and attention fusion module to obtain a residual feature map; and restoring the residual feature map to the feature representation of the original image size using a shape restoration function, which is then used as the output of the shared feature layer.

6. The method for modeling and compensating thermal errors of machine tool feed axis leadscrews based on micro-transfer learning according to claim 1, characterized in that, During the model training process in step S2, the mean square error between the lead screw axial thermal error data and the thermal error prediction value output by the model is used as the loss function. The Adam optimizer is used to perform full-parameter iterative optimization on the shared feature layer and the private adaptation layer until the prediction fitting rate of the model on the source machine tool validation set reaches a preset threshold.

7. The method for modeling and compensating thermal errors of machine tool feed axis leadscrews based on micro-transfer learning according to claim 1, characterized in that, The private adaptation layer consists of a lightweight fully connected layer, and its parameter size is configured to be 5% to 10% of the parameter size of the shared feature layer. In step S3, the fine-tuning training process only uses the target machine tool fine-tuning set to update the weights of the private adaptation layer in the target machine tool prediction model, while the weights of the shared feature layer remain unchanged.

8. The method for modeling and compensating thermal errors of machine tool feed axis leadscrews based on micro-transfer learning according to claim 1, characterized in that, The target machine tool data in the target machine tool fine-tuning set consists of 50 to 100 groups; in step S3, a small learning rate is configured during the fine-tuning training process, with the initial learning rate set to 1e-5, and the learning rate is dynamically adjusted using a cosine annealing algorithm; at the same time, an early stopping strategy is set, and fine-tuning is stopped when the root mean square error of the prediction model on the target machine tool test data is less than or equal to the set accuracy threshold.

9. The method for modeling and compensating thermal errors of machine tool feed axis leadscrews based on micro-transfer learning according to claim 1, characterized in that, The specific execution process of step S4 includes: Calculate the axial compensation correction amount: Calculate the axial compensation correction amount based on the direction of the lead screw movement and the thermal error prediction value output by the target machine tool prediction model; Issuing compensation instructions: The axial compensation correction amount is written into the dedicated compensation register of the CNC system through the secondary development interface of the machine tool CNC system; the CNC system automatically calls the value of the dedicated compensation register to correct the feed axis coordinate during interpolation calculation.

10. The method for modeling and compensating thermal errors of machine tool feed axis leadscrews based on micro-transfer learning according to claim 1, characterized in that, It also includes system closed-loop optimization and maintenance: monthly collection of new thermal images of the target machine tool and corresponding lead screw axial thermal error data to incrementally fine-tune the private adaptation layer; every 3 months, adding new thermal images of the source machine tool and corresponding lead screw axial thermal error data to the source machine tool training set to incrementally train the shared feature layer; establishing a mapping library between machine tool models and private adaptation layer parameters, and when a new machine tool of the same series is connected, directly calling the private adaptation layer parameters of similar models in the mapping library as the initial value of the new machine tool's private adaptation layer.