A pressure sensor temperature compensation algorithm based on two-stage robust optimization neural network

By using a two-stage robust optimization neural network, combined with slime mold optimization and gradient optimization algorithms, the problems of handling complex nonlinear relationships and noise effects in traditional pressure sensor temperature compensation algorithms are solved, achieving high-precision temperature compensation results.

CN122334368APending Publication Date: 2026-07-03ZHONGBEI SUNAC (XIAMEN) PERCEPTION TECHNOLOGY RESEARCH INSTITUTE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202512043175.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-31
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Traditional temperature compensation algorithms for pressure sensors have limited effectiveness in handling complex nonlinear relationships, are prone to getting trapped in local optima, and are affected by noise and outliers, resulting in low temperature compensation accuracy.

Method used

A two-stage robust optimization neural network was adopted, combining slime mold group optimization algorithm and gradient optimization algorithm. The robust regression loss function was used for global exploration and local fine-tuning to optimize the neural network parameters and construct a BP neural network model.

Benefits of technology

This improves the temperature compensation accuracy and stability of the pressure sensor, enhancing measurement accuracy and reliability in various application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122334368A_ABST
    Figure CN122334368A_ABST
Patent Text Reader

Abstract

This invention discloses a temperature compensation algorithm for pressure sensors based on a two-stage robust optimization neural network. In the global exploration stage, the weights and bias parameters of the neural network are encoded into optimization vectors, and the optimization algorithm iteratively searches these vectors in the solution space. In each search iteration, a neural network using robust regression as the loss function calculates the loss value corresponding to each optimization vector, and this loss value is mapped to the fitness of a slime mold individual, guiding the optimization algorithm to find the globally optimal parameter vector. In the local fine-tuning stage, the optimal parameter vector obtained in the global exploration stage is used as the initial parameters of the neural network, and a neural network with the same structure as in the global exploration stage, combined with a gradient optimization algorithm, is used to finely adjust the initial parameters to obtain the final temperature compensation model. This invention can achieve high-precision temperature compensation for pressure sensor measurements and improve the stability and reliability of pressure sensors in various application scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of pressure sensor measurement result optimization technology, specifically a pressure sensor temperature compensation algorithm based on a two-stage robust optimization neural network. Background Technology

[0002] Currently, pressure sensors are widely used in many fields such as industrial production and aerospace. Therefore, improving the measurement accuracy of pressure sensors through effective means is crucial. However, in complex environments, the measurement accuracy of pressure sensors is often affected by various factors. Due to the inherent properties of the pressure measuring materials used in pressure sensors, temperature changes in the measurement environment often lead to errors in the pressure measurement values. Therefore, temperature is one of the most common and significant factors affecting the measurement accuracy of pressure sensors. To improve the measurement accuracy of pressure sensors, temperature compensation must be applied to the measurement results.

[0003] For pressure sensor temperature compensation algorithms, traditional polynomial fitting methods have limited ability to handle the complex nonlinear relationship between pressure and temperature. While single neural network models are better at uncovering nonlinear relationships, they are prone to getting trapped in local optima and have slow convergence speeds. Furthermore, due to the influence of noise and outliers in the sensor measurement data, neural network models have limited learning effectiveness on target features, resulting in lower temperature compensation accuracy. Summary of the Invention

[0004] The purpose of this invention is to overcome the shortcomings of the prior art and propose a pressure sensor temperature compensation algorithm based on a two-stage robust optimization neural network. The robust regression method is introduced into the neural network and combined with the optimization algorithm to achieve high-precision temperature compensation of the pressure sensor measurement value and improve the stability and reliability of the pressure sensor in various application scenarios.

[0005] To achieve the above objectives, the technical solution specifically adopted by the present invention is as follows: A pressure sensor temperature compensation algorithm based on a two-stage robust optimization neural network includes the following steps: A neural network model is constructed, and a robust regression method is introduced as a loss function to measure the error between the neural network output and the true value. In the global exploration phase, a slime mold group optimization algorithm is used to perform a global search in the neural network parameter space. The fitness of the neural network parameter set corresponding to each slime mold individual is calculated through the loss function, and the slime mold position is iteratively updated to find the optimal parameter set. In the local fine-tuning stage, the optimal parameter set is used as the initial parameters of the neural network. The gradient optimization algorithm is adopted and the loss function is used to perform local fine-tuning of the neural network parameters, so as to obtain the final trained neural network model.

[0006] Furthermore, the pressure sensor temperature compensation algorithm based on a two-stage robust optimized neural network specifically includes the following steps: Step 1: Measure temperature and pressure values ​​over a wide range of temperature and pressure, divide the data into training and testing sets, measure the true pressure values ​​after removing the influence of temperature, and normalize the raw data. Step 2: Construct a BP neural network model, generate an initial slime mold location vector as its parameter set, and import the training set data; Step 3: Use the slime mold group optimization algorithm to find the optimal model parameter set; Step 4: Import the optimal parameter set and training set data into the model, further fine-tune the optimal parameter set, then import the test set data, and output the final temperature compensation result.

[0007] Furthermore, the neural network is a BP neural network, comprising an input layer, at least one hidden layer, and an output layer, wherein the input layer has 2 nodes, the hidden layer has 10 neurons, and the output layer has 1 node.

[0008] This invention employs Log-Cosh loss as the loss function for neural networks. Compared to other robust regression methods, using the Log-Cosh loss function eliminates the need for setting a threshold, thus reducing the requirement for prior knowledge from the user. Furthermore, the Log-Cosh loss function is smooth and differentiable everywhere, making it highly suitable for integration with the backpropagation process of neural networks. Its calculation formula is as follows:

[0009] in, For the first The true value of each sample. For the first The predicted value for each sample, Batch size refers to the number of samples processed simultaneously during a single forward and backward propagation of the neural network. In the formula, It is the natural logarithm (base e). Let be a hyperbolic cosine function, defined as: .

[0010] Furthermore, the mathematical formula for optimizing the location of slime molds using the slime mold community optimization algorithm is as follows:

[0011] in, This represents the current iteration number. These are the original index values ​​for each slime mold individual; For the first A slime mold The new position after the next iteration; It is a random vector with the same dimension as the slime mold position vector, and each component is uniformly distributed in the interval [0,1]. and Let be the upper and lower bound vectors of the search space, with the same dimension as the slime mold position vector; It is a preset threshold that controls the probability of global search. Its practical meaning is the proportion of slime mold individuals assigned to global search out of the total slime mold population. For the first The position of the best individual in the population at the next iteration; These are the oscillation parameters; This represents the weight of the slime mold. and Two distinct and different species are randomly selected from the current population. The position vector of the slime mold individual; It is a uniform random number in the range [0,1]. This is the shrinkage parameter. For the first The switching probability of a slime mold at the current iteration number.

[0012] Furthermore, the working steps of the slime mold community optimization algorithm are as follows: S1. Initialize the individual slime mold locations and use them as the parameter set for the neural network; S2. Calculate and sort the fitness value of each slime mold individual's location based on the loss function calculation results of the neural network to determine the current optimal slime mold individual location. At the same time, an index array is created; S3. Calculation , , , Parameters; S4. Generate random numbers and with , A comparison is performed. Based on the comparison results, an update method is selected (the three update methods are, from top to bottom, global search update, local search update, and shrink update), and the position of the slime mold individual is updated, and then its fitness value is calculated; S5. Determine if the termination condition is met. If it is, output the optimal parameter set and fitness value. Otherwise, repeat steps S2 to S5 until the termination condition is met.

[0013] Furthermore, the gradient optimization algorithm is the Adaptive Moment Estimation Algorithm (Adam).

[0014] Furthermore, in both the global exploration stage and the local fine-tuning stage, the same robust regression loss function is used as the optimization objective to achieve coordinated progress in both stages under a unified optimization objective.

[0015] In the global exploration phase, the introduction of optimization algorithms such as slime mold optimization aims to improve the efficiency of neural network parameter set optimization. The introduction of a robust regression loss function reduces the impact of data noise and outliers on slime mold optimization, making the high-quality regions found by slime mold optimization robust regions that are insensitive to noise and outliers. Therefore, the optimal parameter set selected within these regions naturally excludes the influence of noise and outliers.

[0016] In the local fine-tuning phase, continuing to use the robust regression loss function ensures a synergistic and progressive relationship between the two phases under a unified optimization objective: global exploration provides a robust initial parameter set for local development, which in turn further optimizes the parameter set, thereby minimizing the impact of outliers and noise. Thus, the two phases together constitute a well-structured and clearly defined optimization process. Attached Figure Description

[0017] Other features, objects, and advantages of the present invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 This is a flowchart of a pressure sensor temperature compensation algorithm based on a two-stage robust optimization neural network, according to an embodiment of the present invention.

[0018] Figure 2 This is a flowchart of the slime mold optimization algorithm in an embodiment of the present invention. Detailed Implementation

[0019] The present invention will now be described in detail with reference to specific embodiments. These embodiments will help those skilled in the art to further understand the present invention, but do not limit the invention in any way. It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other.

[0020] To address the limitations of traditional polynomial fitting in handling complex nonlinear relationships between pressure and temperature, the susceptibility of single neural networks to local optima and slow convergence, and the low accuracy of neural network temperature compensation due to noise and outliers in sensor measurement data, this invention provides a pressure sensor temperature compensation algorithm based on a two-stage robust optimization neural network, comprising the following steps: A neural network model is constructed, and a robust regression method is introduced as a loss function to measure the error between the neural network output and the true value. In the global exploration phase, a slime mold group optimization algorithm is used to perform a global search in the neural network parameter space. The fitness of the neural network parameter set corresponding to each slime mold individual is calculated through the loss function, and the slime mold position is iteratively updated to find the optimal parameter set. In the local fine-tuning stage, the optimal parameter set is used as the initial parameters of the neural network. The gradient optimization algorithm is adopted and the loss function is used to perform local fine-tuning of the neural network parameters, so as to obtain the final trained neural network model.

[0021] In one embodiment, such as Figure 1 As shown, a pressure sensor temperature compensation algorithm based on a two-stage robust optimization neural network includes the following steps: S1. Data acquisition and preprocessing: Measure temperature and pressure values ​​over a wide range of temperature and pressure, and simultaneously measure the true pressure values ​​after removing the influence of temperature. Divide the raw data into training and test sets and normalize them.

[0022] S2. Initialize neural network parameters: Construct a BP neural network model and initialize the individual slime mold positions as the parameter set of the neural network.

[0023] S3. Update slime mold locations using slime mold community optimization and robust regression: Import the training set sample data into the neural network model, and update the slime mold locations during forward propagation by introducing a slime mold community optimization algorithm and a robust regression loss function.

[0024] S4. Determine if the termination condition is met: If not, return to step 3 and continue execution; if met, output the optimal parameter set.

[0025] S5. Fine-tuning parameters: The optimal parameter set and training data are re-imported into the neural network. A robust regression loss function is introduced for forward propagation, and then the Adam optimization algorithm is used for backpropagation.

[0026] S6. Determine if the termination condition is met: If not, return to step 5 to continue execution; if met, output the final temperature compensation model.

[0027] S7. Input the test set data into the final temperature compensation model to obtain the final temperature compensation result.

[0028] A backpropagation (BP) neural network is a multi-layer feedforward neural network trained using the backpropagation algorithm. It calculates the output through forward propagation and adjusts the network weights layer by layer through backpropagation of the gradient error, thereby approximating and modeling complex nonlinear relationships. The BP neural network model used includes an input layer, hidden layers, and an output layer. In this invention, the BP neural network includes an input layer, at least one hidden layer, and an output layer, wherein the input layer has 2 nodes, the hidden layer has 10 neurons, and the output layer has 1 node. Its basic structure is as follows: Input vector: ; Hidden layer output: ; in, For the hidden layer One neuron, For the input layer There are 1 input node. The weights from the input layer to the hidden layer. For hidden layer bias, This is the activation function for the hidden layer. (Function) These are the elements in the input vector.

[0029] Output layer output: ; in, The weights from the hidden layer to the output layer. For output layer bias, This is the activation function for the output layer.

[0030] The workflow of the above BP neural network model is as follows: a. Import training data, propagate it forward through the neural network, and calculate the network output.

[0031] b. Calculate the error between the output value and the true value using the robust regression loss function.

[0032] c. Based on the error calculation results, the weights and biases are updated through backpropagation of the neural network.

[0033] d. Repeat the above steps until the error meets the convergence condition.

[0034] Robust regression, a type of regression method developed to address the sensitivity of traditional least squares to outliers, falls under the category of mathematical statistics. When outliers, noise, or non-Gaussian errors exist in the data, ordinary least squares estimation is prone to serious bias. Robust regression mitigates this impact by using loss functions or estimation criteria that are more tolerant of outliers. Robust regression maintains stable and reliable parameter estimates even in the presence of data contamination by assigning smaller weights to larger residuals or employing truncation mechanisms during fitting, ensuring that the model reflects the true patterns of the main data components. Robust regression encompasses various methods; this invention uses Log-Cosh loss as the neural network loss function. Compared to other robust regression methods, using the Log-Cosh loss function does not require setting a threshold, thus lowering the requirements for the user's prior knowledge. Furthermore, the Log-Cosh loss function is smooth and differentiable everywhere, making it highly suitable for integration with the backpropagation process of neural networks. Its calculation formula is:

[0035] in, For the first The true value of each sample. For the first The predicted value for each sample, Batch size refers to the number of samples processed simultaneously during a single forward and backward propagation of the neural network. In the formula, It is the natural logarithm (base e). Let be a hyperbolic cosine function, defined as: .

[0036] The slime mold swarm algorithm is a metaheuristic optimization algorithm inspired by the foraging behavior of slime molds in nature. This algorithm dynamically adjusts its search strategy in the solution space by simulating the positive and negative feedback mechanisms and adaptive morphological changes of slime molds. It is commonly used to solve complex combinatorial optimization problems in function optimization, engineering design, and machine learning, exhibiting good global search performance and convergence speed. The mathematical formula for optimizing slime mold positions using the slime mold swarm optimization algorithm is as follows:

[0037] in, This represents the current iteration number. These are the original index values ​​for each slime mold individual; For the first A slime mold The new position after the next iteration; It is a random vector with the same dimension as the slime mold position vector, and each component is uniformly distributed in the interval [0,1]. and Let be the upper and lower bound vectors of the search space, with the same dimension as the slime mold position vector; It is a preset threshold that controls the probability of global search. Its practical meaning is the proportion of slime mold individuals assigned to global search out of the total slime mold population. For the first The position of the best individual in the population at the next iteration; These are the oscillation parameters; This represents the weight of the slime mold. and Two distinct and different species are randomly selected from the current population. The position vector of the slime mold individual; It is a uniform random number in the range [0,1]. This is the shrinkage parameter. For the first The switching probability of a slime mold at the current iteration number.

[0038] like Figure 2 As shown, the working steps of the above slime mold group optimization algorithm are as follows: S1. Initialize the location of the slime mold and use it as the initial parameter set for the neural network model; S2. Calculate and sort the fitness value of each slime mold individual's location based on the error calculation results of the neural network to determine the current optimal slime mold individual location. Meanwhile, an index array is established; specifically: the parameter set and training set data are imported into the neural network model and forward propagation is performed; the loss degree and fitness of the parameter set are calculated using the robust regression loss function; the slime mold individuals are sorted according to their fitness, the optimal position is found, and an index array is established.

[0039] S3. Calculate the weight of individual slime molds. Shrinkage parameters , oscillation parameters Switching probability Parameters; S4. Generate random numbers and with , Compare and determine if the comparison result r is less than : like The location of slime mold is updated using a global search and update method.

[0040] like Continue to determine if r is less than : like The location of slime mold is updated using a local search and update method.

[0041] like The location of slime mold is updated using a shrinkage update method.

[0042] The updated location of the slime mold community was obtained.

[0043] S5. Determine if the termination condition is met. If it is, output the optimal parameter set and fitness value. Otherwise, repeat steps S2 to S5 until the termination condition is met.

[0044] In some embodiments, the gradient optimization algorithm is the Adaptive Moment Estimation Algorithm (Adam). Adam is an adaptive learning rate optimization algorithm that combines the advantages of the momentum method and the RMSProp algorithm. Its core principle is to achieve efficient convergence by dynamically adjusting the parameter learning rate. It is particularly suitable for non-convex optimization problems and features fast convergence and strong robustness.

[0045] It is worth noting that the same robust regression loss function is used as the optimization objective in both the global exploration stage and the local fine-tuning stage, so as to achieve coordinated progress in the two stages under a unified optimization objective. Specifically: Collaboration: Using the same robust regression loss function allows both the global exploration and local fine-tuning phases to optimize parameters around the same metric. In the global exploration phase, the fitness of the neural network parameter set corresponding to each slime mold individual is calculated using the loss function, finding the parameter set that performs well under that loss function. In the local fine-tuning phase, the parameters are further fine-tuned using this loss function as the target. Both phases cooperate based on the same optimization objective.

[0046] Progression: The global exploration stage first searches within a large parameter space at a macro level, providing a relatively good initial parameter set for subsequent local fine-tuning; the local fine-tuning stage, based on the global exploration, optimizes the parameters more meticulously, further reducing the value of the loss function. The two stages are performed sequentially, gradually improving the performance of the neural network model, presenting a progressive relationship.

[0047] In summary, by using the same robust regression loss function as the optimization objective in both stages, this invention ensures the consistency and coherence of the entire algorithm during the optimization process. This helps to increase the likelihood of the algorithm finding the global optimum or a solution close to the global optimum, thereby enabling the finally trained neural network model to output results more accurately in the pressure sensor temperature compensation task, thus improving the accuracy and robustness of temperature compensation.

[0048] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely preferred examples and are not intended to limit the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of the present invention is defined by the appended claims and their equivalents.

Claims

1. A pressure sensor temperature compensation algorithm based on a two-stage robust optimization neural network, characterized in that: Includes the following steps: A neural network model is constructed, and a robust regression method is introduced as a loss function to measure the error between the neural network output and the true value. In the global exploration phase, a slime mold group optimization algorithm is used to perform a global search in the neural network parameter space. The fitness of the neural network parameter set corresponding to each slime mold individual is calculated through the loss function, and the slime mold position is iteratively updated to find the optimal parameter set. In the local fine-tuning stage, the optimal parameter set is used as the initial parameters of the neural network. The gradient optimization algorithm is adopted and the loss function is used to perform local fine-tuning of the neural network parameters, so as to obtain the final trained neural network model.

2. The pressure sensor temperature compensation algorithm based on a two-stage robust optimized neural network as described in claim 1, characterized in that: The neural network is a BP neural network, which includes an input layer, at least one hidden layer, and an output layer, wherein the input layer has 2 nodes, the hidden layer has 10 neurons, and the output layer has 1 node.

3. The pressure sensor temperature compensation algorithm based on a two-stage robust optimized neural network as described in claim 1, characterized in that: The robust regression method is the Log-Cosh loss function, and its calculation formula is as follows: ; in, For the first The true value of each sample For the first The predicted value for each sample, Batch size refers to the number of samples processed simultaneously during a single forward and backward propagation of the neural network. In the formula, It is the natural logarithm (base e). Let be a hyperbolic cosine function, defined as: 。 4. The pressure sensor temperature compensation algorithm based on a two-stage robust optimized neural network as described in claim 1, characterized in that: The mathematical formula for optimizing the location of slime molds using the slime mold community optimization algorithm is as follows: ; in, This represents the current iteration number. These are the original index values ​​for each slime mold individual; For the first A slime mold The new position after the next iteration; It is a random vector with the same dimension as the slime mold position vector, and each component is uniformly distributed in the interval [0,1]. and Let be the upper and lower bound vectors of the search space, with the same dimension as the slime mold position vector; It is a preset threshold that controls the probability of global search. Its practical meaning is the proportion of slime mold individuals assigned to global search out of the total slime mold population. For the first The position of the best individual in the population at the next iteration; These are the oscillation parameters; Weight of slime mold; and Two distinct and different species are randomly selected from the current population. The position vector of the slime mold individual; A uniformly random number within the range [0,1]; For contraction parameters; For the first The switching probability of a slime mold at the current iteration number.

5. The pressure sensor temperature compensation algorithm based on a two-stage robust optimized neural network as described in claim 4, characterized in that: The working steps of the slime mold community optimization algorithm are as follows: S1. Initialize the individual slime mold locations and use them as the parameter set for the neural network; S2. Calculate and sort the fitness value of each slime mold individual's location based on the loss function calculation results of the neural network to determine the current optimal slime mold individual location. At the same time, an index array is created; S3. Calculation , , , Parameters; S4. Generate random numbers and with , Compare the results; select the update method based on the comparison results, update the position of the slime mold individual, and then calculate its fitness value; S5. Determine if the termination condition is met. If it is, output the optimal parameter set and fitness value. Otherwise, repeat steps S2 to S5 until the termination condition is met.

6. The pressure sensor temperature compensation algorithm based on a two-stage robust optimized neural network as described in claim 1, characterized in that: The gradient optimization algorithm is the Adaptive Moment Estimation Algorithm (Adam).

7. The pressure sensor temperature compensation algorithm based on a two-stage robust optimized neural network as described in claim 1, characterized in that: In both the global exploration phase and the local fine-tuning phase, the same robust regression loss function is used as the optimization objective to achieve coordinated progress in both phases under a unified optimization objective.