Edge AI model training method and temperature drift compensation method based on edge AI model

CN122528981APending Publication Date: 2026-08-07安徽瑞控信光电技术股份有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610673041.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-15
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

[0003]本申请的目的是提供一种边缘AI模型训练方法和基于边缘AI模型的温漂补偿方法,旨在解决现有技术中模型体积大、芯片资源占用过高的技术问题

Benefits of technology

本申请的技术方案通过薄板样条径向基函数插值生成虚拟样本实现数据集增强,再结合贝叶斯优化寻优多层感知机超参数训练得到初始模型,同时依据资源约束指标剪除冗余神经元节点并对保留网络结构参数做浮点转定点量化的联合轻量化处理,能够在保证模型对幅值、相位与真实距离映射拟合精度的前提下,精简网络结构、压缩模型参数量与存储占用,有利于显著降低模型推理对主控芯片ROM、RAM及运算资源的消耗,精准适配位移传感器低资源主控芯片的边缘部署需求,实现高实时性、低资源占用的温漂补偿推理。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122528981A_ABST
    Figure CN122528981A_ABST
Patent Text Reader

Abstract

The application discloses an edge AI model training method and a temperature drift compensation method based on an edge AI model, and relates to the technical field of intelligent sensing measurement and embedded edge computing, wherein the edge AI model training method comprises the following steps: constructing a training data set of an artificial intelligence model; constructing a continuous interpolation surface by adopting a thin plate spline radial basis function interpolation, randomly sampling virtual samples on the continuous interpolation surface to enhance the training data set, and obtaining an enhanced training data set; determining hyperparameters of a multilayer perceptron model by adopting a Bayesian optimization, training the multilayer perceptron model based on the enhanced training data set, and obtaining an initial model; and performing joint quantization and structure pruning processing on the initial model to obtain a lightweight model suitable for a displacement sensor main control chip. The scheme is beneficial to significantly reducing the consumption of ROM, RAM and operation resources of a main control chip in model inference, and accurately adapting to the edge deployment requirements of a low-resource main control chip of a displacement sensor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of intelligent sensing and measurement and embedded edge computing technology, and in particular to an edge AI model training method and a temperature drift compensation method based on the edge AI model. Background Technology

[0002] Eddy current sensors (ECS) are widely used in precision displacement measurement due to their advantages such as compact structure, high sensitivity, wide frequency response range, non-contact continuous measurement capability, and outstanding resistance to oil contamination. However, the sensor output signal is highly sensitive to changes in ambient temperature. Even if the distance between the probe and the measured object remains fixed, temperature fluctuations will still cause significant temperature drift in the measurement output, introducing systematic errors and severely limiting the measurement accuracy under variable temperature conditions. Although existing temperature drift compensation methods have made improvements from the perspectives of model fitting, intelligent algorithms, hardware optimization, and multi-parameter fusion, which have improved the reliability of measurements in variable temperature environments to some extent, existing edge artificial intelligence (AI) models have complex structures and a large number of parameters. When directly deployed to the displacement sensor main control chip, they consume extremely high on-chip ROM and RAM storage and computing resources, resulting in a heavy chip resource load and making it difficult to adapt to the edge real-time inference deployment requirements of low-resource main control chips. Summary of the Invention

[0003] The purpose of this application is to provide a training method for edge AI models and a temperature drift compensation method based on edge AI models, aiming to solve the technical problems of large model size and excessive chip resource consumption in the prior art.

[0004] To achieve the above objectives, this application provides a method for compensating for temperature drift in a displacement sensor, comprising: Construct a training dataset for an artificial intelligence model; wherein the training dataset includes multiple sets of samples, each set of samples including training amplitude data, training phase data, and matching real distance data; A continuous interpolation surface is constructed using thin-plate spline radial basis function interpolation. Virtual samples are then randomly sampled on the continuous interpolation surface to enhance the training dataset, resulting in an enhanced training dataset. The hyperparameters of the multilayer perceptron model are determined by Bayesian optimization, and the multilayer perceptron model is trained based on the enhanced training dataset to obtain the initial model. The initial model is subjected to joint quantization and structural trimming to obtain a lightweight model adapted to the displacement sensor main control chip. The joint quantization and structure pruning process includes identifying and pruning redundant neuron nodes in the initial model according to preset resource constraint indicators; and converting the floating-point weights of the network parameters that retain the network structure in the initial model into fixed-point integer format.

[0005] In one embodiment, based on preset resource constraint indicators, redundant neuron nodes in the initial model are identified and pruned, including: Calculate the gradient contribution of each neuron node to the output distance data; Neurons whose gradient contribution is below a preset threshold are removed.

[0006] In one embodiment, converting the floating-point weights of the network parameters that retain the network structure in the initial model to a fixed-point integer format includes: Obtain the bit width limitation parameter from the resource constraint index; Based on the bit width limitation parameter, the floating-point weights of the network parameters corresponding to the preserved network structure are mapped to the corresponding fixed-point integer format.

[0007] In one implementation, the process of determining the hyperparameters of the multilayer perceptron model via Bayesian optimization further includes: Remove abnormal data from the training dataset and the virtual samples; The training amplitude data and the training phase data are standardized to obtain a preprocessed dataset; The preprocessed dataset is divided into a training set, a validation set, and a test set according to a preset ratio.

[0008] In one implementation, the hyperparameters of the multilayer perceptron model are determined through Bayesian optimization, including: Define a hyperparameter search space, where hyperparameters include the number of model layers, the number of hidden layer neurons, the learning rate, the Dropout rate, the L1 regularization coefficient, the L2 regularization coefficient, and the batch normalization switch; Using the validation loss as the objective function, the Gaussian process surrogate model is used to iteratively recommend hyperparameter combinations, and the Gaussian process surrogate model is updated after each round of training. A multilayer perceptron model is constructed based on the determined hyperparameters. The training accuracy is monitored in real time according to the validation set, and the initial model is obtained after the accuracy is verified to meet the standard by the test set.

[0009] In one embodiment, the multilayer perceptron model is trained based on the enhanced training set to obtain an initial model, including: A multilayer perceptron model with a multilayer fully connected structure is constructed. The hidden layer adopts the ReLU activation function, the output layer adopts the linear activation function, the joint regularization of L1 regularization and L2 regularization is adopted, and the Nadam optimizer and Huber loss function are set. During training, an early stopping mechanism and a learning rate decay strategy are set, the maximum number of training rounds and batch size are set, and the model weights with the optimal validation loss are saved. The preprocessed dataset is trained multiple times to obtain multiple trained models. The model with the smallest test set error among the multiple trained models is selected as the initial model.

[0010] Furthermore, this application also provides a temperature drift compensation method for a displacement sensor, applied to the main control chip of the displacement sensor. The main control chip deploys an edge artificial intelligence model, which is obtained through the training method described above. The compensation method includes: Acquire real-time amplitude and phase data from the displacement sensor; Based on the real-time amplitude data and the real-time phase data, the measured distance and the ambient temperature of the displacement sensor are calculated simultaneously, and the distance value after temperature drift compensation is output.

[0011] In one embodiment, the main control chip deploys an edge artificial intelligence model, including: The lightweight model is converted to a new format to generate a model file that the main control chip can recognize. The converted model file is burned and stored in the designated storage area of ​​the main control chip; Complete the model deployment initialization, enabling the main control chip to load and be ready to call the lightweight model.

[0012] In one embodiment, simultaneously calculating the measured distance and the ambient temperature of the displacement sensor includes: The real-time amplitude data and the real-time phase data are input into the deployed lightweight model; The lightweight model is invoked to perform real-time edge inference operations. Relying on the model's built-in mapping relationship and operation logic, the initial measured distance parameters and the ambient temperature parameters of the displacement sensor are calculated simultaneously.

[0013] In one embodiment, outputting the distance value after temperature drift compensation includes: Based on the ambient temperature parameters, the initial measured distance parameters are corrected for errors using a preset temperature drift compensation rule; The validity of the corrected initial measured distance parameters is verified, and the compensated distance value is output.

[0014] The above-mentioned technical solution of this application has at least the following beneficial technical effects: The technical solution of this application generates virtual samples through thin-plate spline radial basis function interpolation to achieve dataset augmentation. Then, it combines Bayesian optimization to optimize the hyperparameter training of the multilayer perceptron to obtain the initial model. At the same time, redundant neuron nodes are pruned according to resource constraints, and the remaining network structure parameters are subjected to joint lightweighting processing of floating-point to fixed-point quantization. Under the premise of ensuring the model's accuracy in fitting the amplitude, phase and true distance mapping, the network structure is simplified, the number of model parameters and storage occupation are compressed. This is conducive to significantly reducing the consumption of ROM, RAM and computing resources of the main control chip by the model inference, accurately adapting to the edge deployment requirements of low-resource main control chips of displacement sensors, and realizing high real-time performance and low resource consumption temperature drift compensation inference. Attached Figure Description

[0015] Figure 1 This is a flowchart illustrating an embodiment of the edge artificial intelligence model training method provided in this application; Figure 2 This is an algorithm flowchart of an embodiment of the edge artificial intelligence model training method provided in this application; Figure 3 This is a schematic flowchart of an embodiment of the temperature drift compensation method for displacement sensors provided in this application. Detailed Implementation

[0016] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to specific embodiments and accompanying drawings. It should be understood that these descriptions are merely exemplary and not intended to limit the scope of this application. Furthermore, descriptions of well-known structures and technologies are omitted in the following description to avoid unnecessarily obscuring the concepts of this application.

[0017] The embodiments described in this application are only some, not all, of the embodiments described herein. All other embodiments obtained by those skilled in the art based on the embodiments described herein without inventive effort are within the scope of protection of this application.

[0018] Eddy current sensors (ECS) are widely used in precision displacement measurement due to their advantages such as compact structure, high sensitivity, wide frequency response range, non-contact continuous measurement capability, and outstanding resistance to oil contamination. However, the sensor output signal is highly sensitive to changes in ambient temperature. Even if the distance between the probe and the measured object remains fixed, temperature fluctuations will still cause significant temperature drift in the measurement output, introducing systematic errors and severely limiting the measurement accuracy under variable temperature conditions. Although existing temperature drift compensation methods have made improvements from the perspectives of model fitting, intelligent algorithms, hardware optimization, and multi-parameter fusion, which have improved the reliability of measurements in variable temperature environments to some extent, existing edge artificial intelligence (AI) models have complex structures and a large number of parameters. When directly deployed to the displacement sensor main control chip, they consume extremely high on-chip ROM and RAM storage and computing resources, resulting in a heavy chip resource load and making it difficult to adapt to the edge real-time inference deployment requirements of low-resource main control chips.

[0019] To address the aforementioned technical issues, this application provides a temperature drift compensation method for displacement sensors. It utilizes thin-plate spline radial basis function interpolation to generate virtual samples for dataset augmentation. This is combined with Bayesian optimization to train the hyperparameters of a multilayer perceptron, resulting in an initial model. Simultaneously, redundant neurons are pruned based on resource constraints, and the remaining network structure parameters undergo a combined lightweighting process of floating-point to fixed-point quantization. This approach simplifies the network structure, reduces the number of model parameters and storage usage while maintaining the model's accuracy in fitting the amplitude, phase, and true distance mapping. This significantly reduces the consumption of ROM, RAM, and computing resources on the main control chip during model inference, precisely meeting the edge deployment requirements of low-resource main control chips for displacement sensors. Ultimately, it achieves high real-time performance and low resource consumption for temperature drift compensation inference.

[0020] In one implementation, please refer to Figure 1 The training method for this edge AI model includes the following steps: S1: Constructing the training dataset for the artificial intelligence model; the training dataset includes multiple sets of samples, each set including amplitude data, phase data, and matching real distance data for training. In step S1, a self-developed eddy current displacement sensor with dual-channel parallel measurement function (including amplitude and phase detection circuits, resolution ≥16bit) is used to conduct a fixed-distance temperature variation test (temperature range -40℃ to 100℃, with 10℃ as the smallest unit, distance in 0.1mm units covering the entire range, temperature variation time 10 minutes, and stable holding time 20 minutes). Multiple sets of samples containing amplitude data, phase data, and matching real distance data for training are collected. After manually matching the temperature information, they are integrated to form the training dataset. By obtaining real samples covering the entire range and a wide temperature range, a reliable data foundation that fits the actual application scenario is provided for model training.

[0021] S2: A continuous interpolation surface is constructed using thin-plate spline radial basis function interpolation. Virtual samples are randomly sampled on this continuous interpolation surface to augment the training dataset, resulting in an augmented training dataset. In step S2, to address the issue of discrete training data and potentially insufficient data volume, a continuous and smooth interpolation surface is constructed using thin-plate spline radial basis function interpolation. Virtual samples are randomly sampled on this surface and added to the original training dataset to augment the data. This expands the training set size from a few hundred points to several thousand points, resulting in an augmented training dataset. By significantly increasing the number and coverage of samples, overfitting is effectively avoided, and the generalization ability and fitting accuracy of the model training are improved.

[0022] Furthermore, this method includes the following steps: removing outlier data from the training dataset and virtual samples; standardizing the amplitude and phase data used for training to obtain a preprocessed dataset; and dividing the preprocessed dataset into training, validation, and test sets according to a preset ratio. In this step, outlier data is first removed from the training dataset and virtual samples. Then, the amplitude and phase data used for training are standardized to eliminate dimensional differences, resulting in a preprocessed dataset. Finally, the preprocessed dataset is divided into training, validation, and test sets according to a preset ratio of 6:2:2. Through data purification, standardization, and scientific partitioning, data noise interference is reduced, ensuring the effectiveness of training, validation, and testing, and laying the foundation for accurate model training.

[0023] S3: Determine the hyperparameters of the multilayer perceptron model through Bayesian optimization, and train the multilayer perceptron model based on the enhanced training dataset to obtain the initial model. In step S3, the hyperparameters of the multilayer perceptron model (set to 3 layers) are determined through Bayesian optimization. The multilayer perceptron model is then trained based on the enhanced training dataset to obtain the initial model. Through scientific optimization of hyperparameters and sufficient training, the initial model is ensured to have good mapping and fitting capabilities between amplitude, phase, distance, and temperature, and the model size meets the requirements for subsequent edge deployment.

[0024] In one embodiment, determining the hyperparameters of the multilayer perceptron model through Bayesian optimization further includes the following specific steps: defining a hyperparameter search space, where hyperparameters include the number of model layers, the number of hidden layer neurons, the learning rate, the Dropout rate, the L1 regularization coefficient, the L2 regularization coefficient, and the batch normalization switch; using the validation loss as the objective function, iteratively recommending hyperparameter combinations using a Gaussian process surrogate model, updating the Gaussian process surrogate model after each training round; constructing the multilayer perceptron model based on the determined hyperparameters, monitoring the training accuracy in real time using the validation set, and obtaining the initial model after verifying the accuracy meets the standards using the test set. This embodiment ensures the training efficiency and accuracy of the initial model by accurately optimizing hyperparameters and dynamically monitoring them, avoiding resource waste caused by blindly tuning parameters.

[0025] In one embodiment, a multilayer perceptron model is trained based on the enhanced training set to obtain an initial model, including the following specific steps: constructing a multilayer perceptron model with a multilayer fully connected structure, using the ReLU activation function for the hidden layers and the linear activation function for the output layer, employing joint regularization of L1 and L2 regularization, and setting the Nadam optimizer and Huber loss function; setting an early stopping mechanism and learning rate decay strategy during training, setting the maximum number of training rounds and batch size, and saving the model weights with the optimal validation loss; performing multiple rounds of training on the preprocessed dataset to obtain multiple trained models, and selecting the model with the smallest test set error from the multiple trained models as the initial model. Specifically, a three-layer fully connected multilayer perceptron model is first constructed. The hidden layer uses the ReLU activation function, and the output layer uses the linear activation function. Joint regularization of L1 and L2 regularization is adopted. The Nadam optimizer (with gradient clipping enabled) and Huber loss function are set. During training, an early stopping mechanism (patience=25) and a learning rate decay strategy (patience=8) are set. The maximum number of training epochs is set to 200, and the batch size is 32. The model weights with the optimal validation loss are saved. The preprocessed dataset is then trained 20 times to obtain 20 trained models. The model with the smallest test set error (error between predicted value and ideal value ≤ 0.1%) is selected from multiple models as the initial model. By optimizing the model structure, training strategy and multi-model selection, the fitting accuracy, stability and robustness of the initial model are further improved.

[0026] S4: Perform joint quantization and structural pruning on the initial model to obtain a lightweight model adapted to the displacement sensor main control chip. Specifically, perform joint quantization and structural pruning on the initial model to obtain a lightweight model adapted to the displacement sensor main control chip (resource-constrained MCU). Through dual lightweighting processing, the model's footprint is reduced from 180KB to 90KB, a reduction of 50%, achieving a significant reduction in model size and ROM, RAM, and computing resource usage, meeting edge deployment requirements. The joint quantization and structural pruning process includes the following steps: S41: Based on preset resource constraint indicators, identify and remove redundant neuron nodes in the initial model; in one embodiment, S41 further includes the following specific steps: calculate the gradient contribution of each neuron node to the output distance data; remove neuron nodes with gradient contribution values ​​lower than a preset threshold. Specifically, based on preset sensor main control chip resource constraint indicators, calculate the gradient contribution of each neuron node to the output distance data, remove neuron nodes with gradient contribution values ​​lower than a preset threshold, and by accurately screening redundant nodes, simplify the network structure while ensuring model performance (error ≤ 0.1%), thereby reducing the model's demand for on-chip resources.

[0027] S42: Convert the floating-point weights of the network parameters that retain the network structure in the initial model to fixed-point integer format. In one embodiment, S42 further includes the following specific steps: obtaining the bit width limitation parameter in the resource constraint index; mapping the floating-point weights of the network parameters corresponding to the retained network structure to the corresponding fixed-point integer format based on the bit width limitation parameter. Specifically, the bit width limitation parameter in the resource constraint index is obtained, and the Float32 floating-point weights of the network parameters corresponding to the retained network structure in the initial model are mapped to unsigned int8 fixed-point integer format based on this parameter. Through parameter format conversion, the model storage occupation and runtime memory consumption are significantly reduced, adapting to the hardware characteristics of resource-constrained main control chips such as STM32, and improving inference speed.

[0028] The specific training process for this edge AI model is as follows: Please refer to... Figure 2First, the displacement sensor calibration data stored in Excel format is read to obtain the original samples containing amplitude, phase, and corresponding real distance. Then, a continuous interpolation surface is constructed using the thin-plate spline radial basis function (RBF) interpolation method. Virtual samples are randomly sampled on the surface and merged into the original dataset to achieve data augmentation and expand the sample size and coverage. Next, outlier detection is performed on the merged dataset and outlier data is removed. Then, the input features such as amplitude and phase are standardized to eliminate dimensional differences. Finally, the dataset is divided into training set, validation set, and test set according to a preset ratio to provide data support for model training and evaluation. After data preparation, the Bayesian optimization hyperparameter search process begins. First, the hyperparameter search space is defined and hyperparameters are randomly initialized, including the number of model layers, the number of hidden layer neurons, the learning rate, the dropout rate, the L1 / L2 regularization coefficients, and the batch normalization switch. Then, a multilayer perceptron (MLP) model is constructed based on the current hyperparameters. The model is trained using the training set and the validation loss is evaluated on the validation set. At the same time, a Gaussian process surrogate model is used to model the validation loss distribution and update the posterior distribution. It is then determined whether the maximum number of iterations has been reached. If not, a hyperparameter combination is recommended and updated using a collection function. The iterative process of building the model, training, evaluating, and updating the surrogate model is repeated until the iteration requirement is met. Finally, the optimal hyperparameters are output and the final MLP model is constructed. The MLP model built based on optimal hyperparameters employs an early stopping mechanism and a learning rate decay strategy during training. The Huber loss function is used as the objective function, and the Nadam optimizer is used to update the model weights. After training, the model weights with the optimal validation loss are saved. Subsequently, the model performance is evaluated on the test set, and metrics such as mean absolute error (MAE) and root mean square error (RMSE) are calculated and stored in an Excel file. Finally, the initial model after training is saved, completing the entire model training process and providing a basic model for subsequent joint quantization and structural pruning lightweight processing.

[0029] Furthermore, this application also provides a temperature drift compensation method for a displacement sensor, applied to the main control chip of the displacement sensor. The technical solution of this embodiment, by deploying a lightweight model on the main control chip of the displacement sensor itself, can overcome the inherent defects of traditional temperature calibration, insufficient accuracy of polynomial fitting compensation, and the need for additional temperature sensors to collect ambient temperature. It can directly rely on the sensor's real-time amplitude and phase data to complete the calculation and analysis, simultaneously calculating the measured distance and the ambient temperature, and outputting the temperature drift compensated distance value. This helps to break free from the constraints of existing AI compensation schemes that rely on a host computer to run model inference, eliminating the need for a host computer to participate in the compensation calculation, achieving autonomous temperature drift compensation at the sensor end. This improves the accuracy and real-time response of temperature drift compensation, adapts to application scenarios where multiple sensors work together, simplifies the system architecture, and reduces hardware costs.

[0030] Deploying an edge AI model on a main control chip involves the following steps: converting the lightweight model to a format that the main control chip can recognize; burning and storing the converted model file to a designated storage area of ​​the main control chip; and completing the model deployment initialization so that the main control chip can load and be ready to call the lightweight model. Specifically, using TinyMaix as the deployment framework, the lightweight model is first converted from Keras format to tflite format (quantization is completed simultaneously), then to tmdl format, and finally to a C language header file that the main control chip can recognize (model information is encapsulated as a constant array in hexadecimal byte stream). The converted model header file and TinyMaix core source code files (tm_model.c, tm_layers.c, tm_ops.c, etc.) are then added to the sensor lower-level machine project and compilation options are configured. The model file is burned and stored in the specified storage area of ​​the main control chip. Finally, the model deployment initialization is completed, enabling the main control chip to load and stand by to call the lightweight model. Through a standardized and highly adaptable deployment process, the lightweight model is ensured to stand by stably on the resource-constrained main control chip, eliminating the dependence on the host computer.

[0031] In one embodiment, the edge AI model is obtained through the training method described above, and the compensation method includes the following steps: M1: Acquires real-time amplitude and phase data from the displacement sensor. Specifically, through the sensor's dual-channel parallel amplitude and phase detection circuit, it acquires real-time amplitude and phase data (resolution ≥ 16 bits) from the displacement sensor. By accurately acquiring the core input data, it provides a high-quality, high-resolution basis for subsequent temperature drift compensation inference, ensuring compensation accuracy.

[0032] M2: Based on real-time amplitude and phase data, it simultaneously calculates the measured distance and the ambient temperature of the displacement sensor, and outputs the distance value after temperature drift compensation. Specifically, based on real-time amplitude and phase data, it simultaneously calculates the measured distance and ambient temperature through a deployed lightweight model. After error correction and validity verification, it outputs the distance value after temperature drift compensation. Through real-time calculation at the edge, it achieves autonomous and efficient temperature drift compensation without the need for an additional temperature sensor, and is compatible with multi-sensor joint systems.

[0033] In one embodiment, the simultaneous calculation of the measured distance and the ambient temperature of the displacement sensor includes the following specific steps: inputting real-time amplitude data and real-time phase data into a deployed lightweight model; calling the lightweight model to perform real-time edge inference operations, and relying on the model's built-in mapping relationships and operational logic, simultaneously calculating the initial measured distance parameters and the ambient temperature parameters of the displacement sensor. Specifically, the real-time amplitude data and real-time phase data are input into the deployed lightweight model, the inference API provided by TinyMaix is ​​called to load model parameters, and forward calculations at each level are executed sequentially. Relying on the model's built-in mapping relationships and operational logic between amplitude, phase, distance, and temperature, the initial measured distance parameters and the ambient temperature parameters of the displacement sensor are simultaneously calculated. Through accurate model inference, the synchronous acquisition of distance and temperature parameters is achieved without the need for an additional temperature sensor to collect ambient temperature, providing core data support for temperature drift compensation.

[0034] In one embodiment, outputting the distance value after temperature drift compensation includes the following specific steps: based on the ambient temperature parameter, the initial measured distance parameter is corrected for error using a preset temperature drift compensation rule; the validity of the corrected initial measured distance parameter is verified, and the compensated distance value is output. Specifically, based on the calculated ambient temperature parameter, the initial measured distance parameter is corrected for error using a preset temperature drift compensation rule (eliminating the influence of temperature on distance measurement), and the validity of the corrected initial measured distance parameter is verified, and the compensated distance value is output. Through targeted error correction and validity verification, the accuracy (error ≤ 0.1%) and reliability of the final output distance value are ensured, improving the measurement accuracy of the sensor in a variable temperature environment of -40℃ to 100℃.

[0035] This application aims to protect an edge AI model training method and a temperature drift compensation method based on the edge AI model. The technical solution generates virtual samples through thin-plate spline radial basis function interpolation to achieve dataset augmentation. Then, it combines Bayesian optimization to optimize the hyperparameters of the multilayer perceptron to obtain the initial model. At the same time, redundant neuron nodes are pruned according to resource constraints, and the remaining network structure parameters are subjected to joint lightweighting processing of floating-point to fixed-point quantization. While ensuring the model's accuracy in fitting the amplitude, phase and true distance mapping, it simplifies the network structure, compresses the number of model parameters and storage occupation, which is conducive to significantly reducing the consumption of ROM, RAM and computing resources of the main control chip by the model inference. It accurately adapts to the edge deployment requirements of low-resource main control chips of displacement sensors and realizes high real-time performance and low resource consumption temperature drift compensation inference. Furthermore, by deploying the lightweight model on the displacement sensor's own main control chip, it can overcome the inherent shortcomings of traditional temperature calibration, polynomial fitting compensation which lacks accuracy and requires additional temperature sensors to collect ambient temperature. It can directly rely on the sensor's real-time amplitude and phase data to complete the calculation and analysis, simultaneously calculating the measured distance and the ambient temperature, and outputting the distance value after temperature drift compensation. This helps to break free from the constraints of existing AI compensation schemes that rely on host computers to run model inference. Without the need for host computers to participate in compensation calculations, it can achieve autonomous temperature drift compensation at the sensor end, which not only improves the accuracy of temperature drift compensation and the real-time response, but also adapts to application scenarios where multiple sensors work together, simplifies the system architecture, and reduces hardware costs.

[0036] It should be understood that the specific embodiments described above are merely illustrative or explanatory of the principles of this application and do not constitute a limitation thereof. Therefore, any modifications, equivalent substitutions, improvements, etc., made without departing from the spirit and scope of this application should be included within the protection scope of this application. Furthermore, the appended claims are intended to cover all variations and modifications falling within the scope and boundaries of the appended claims, or equivalent forms of such scope and boundaries.

Claims

1. A training method for an edge artificial intelligence model, characterized in that, include: Construct a training dataset for an artificial intelligence model; wherein the training dataset includes multiple sets of samples, each set of samples including training amplitude data, training phase data, and matching real distance data; A continuous interpolation surface is constructed using thin-plate spline radial basis function interpolation. Virtual samples are then randomly sampled on the continuous interpolation surface to enhance the training dataset, resulting in an enhanced training dataset. The hyperparameters of the multilayer perceptron model are determined by Bayesian optimization, and the multilayer perceptron model is trained based on the enhanced training dataset to obtain the initial model. The initial model is subjected to joint quantization and structural trimming to obtain a lightweight model adapted to the displacement sensor main control chip. The joint quantization and structure pruning process includes identifying and pruning redundant neuron nodes in the initial model according to preset resource constraint indicators; and converting the floating-point weights of the network parameters that retain the network structure in the initial model into fixed-point integer format.

2. The training method for the edge artificial intelligence model according to claim 1, characterized in that, Based on preset resource constraint indicators, redundant neuron nodes in the initial model are identified and pruned, including: Calculate the gradient contribution of each neuron node to the output distance data; Neurons whose gradient contribution is below a preset threshold are removed.

3. The training method for the edge artificial intelligence model according to claim 1, characterized in that, Converting the floating-point weights of the network parameters in the initial model, which retain the network structure, to fixed-point integer format includes: Obtain the bit width limitation parameter from the resource constraint index; Based on the bit width limitation parameter, the floating-point weights of the network parameters corresponding to the preserved network structure are mapped to the corresponding fixed-point integer format.

4. The training method for the edge artificial intelligence model according to claim 1, characterized in that, Before determining the hyperparameters of the multilayer perceptron model through Bayesian optimization, the following steps are also included: Remove abnormal data from the training dataset and the virtual samples; The training amplitude data and the training phase data are standardized to obtain a preprocessed dataset; The preprocessed dataset is divided into a training set, a validation set, and a test set according to a preset ratio.

5. The training method for the edge artificial intelligence model according to claim 4, characterized in that, The hyperparameters of the multilayer perceptron model are determined through Bayesian optimization, including: Define a hyperparameter search space, where hyperparameters include the number of model layers, the number of hidden layer neurons, the learning rate, the Dropout rate, the L1 regularization coefficient, the L2 regularization coefficient, and the batch normalization switch; Using the validation loss as the objective function, the Gaussian process surrogate model is used to iteratively recommend hyperparameter combinations, and the Gaussian process surrogate model is updated after each round of training. A multilayer perceptron model is constructed based on the determined hyperparameters. The training accuracy is monitored in real time according to the validation set, and the initial model is obtained after the accuracy is verified to meet the standard by the test set.

6. The training method for the edge artificial intelligence model according to claim 5, characterized in that, The multilayer perceptron model is trained based on the enhanced training set to obtain an initial model, including: A multilayer perceptron model with a multilayer fully connected structure is constructed. The hidden layer adopts the ReLU activation function, the output layer adopts the linear activation function, the joint regularization of L1 regularization and L2 regularization is adopted, and the Nadam optimizer and Huber loss function are set. During training, an early stopping mechanism and a learning rate decay strategy are set, the maximum number of training rounds and batch size are set, and the model weights with the optimal validation loss are saved. The preprocessed dataset is trained multiple times to obtain multiple trained models. The model with the smallest test set error among the multiple trained models is selected as the initial model.

7. A method for compensating for temperature drift in a displacement sensor, characterized in that, The main control chip applied to the displacement sensor, wherein the main control chip deploys an edge artificial intelligence model, the edge artificial intelligence model being obtained through the training method of any one of claims 1-6, and the compensation method comprising: Acquire real-time amplitude and phase data from the displacement sensor; Based on the real-time amplitude data and the real-time phase data, the measured distance and the ambient temperature of the displacement sensor are calculated simultaneously, and the distance value after temperature drift compensation is output.

8. The temperature drift compensation method for a displacement sensor according to claim 7, characterized in that, The main control chip deploys an edge artificial intelligence model, including: The lightweight model is converted to a new format to generate a model file that the main control chip can recognize. The converted model file is burned and stored in the designated storage area of ​​the main control chip; Complete the model deployment initialization, enabling the main control chip to load and be ready to call the lightweight model.

9. The method for compensating for temperature drift of a displacement sensor according to claim 7, characterized in that, Synchronous calculation of the measured distance and the ambient temperature of the displacement sensor, including: The real-time amplitude data and the real-time phase data are input into the deployed lightweight model; The lightweight model is invoked to perform real-time edge inference operations. Relying on the model's built-in mapping relationship and operation logic, the initial measured distance parameters and the ambient temperature parameters of the displacement sensor are calculated simultaneously.

10. The method for compensating for temperature drift of a displacement sensor according to claim 9, characterized in that, Output the distance value after temperature drift compensation, including: Based on the ambient temperature parameters, the initial measured distance parameters are corrected for errors using a preset temperature drift compensation rule; The validity of the corrected initial measured distance parameters is verified, and the compensated distance value is output.