Weighing sensor calibration method based on neural network

Through the improved Adam algorithm, the parameters of ELM neural network are optimized, and the problems of overfitting and high computing resource consumption in sensor calibration are solved, and the generalization ability and stability of the calibration model are improved, thereby achieving more accurate and efficient sensor calibration.

CN119223432AActive Publication Date: 2024-12-31XIAN TECH UNIV

Patent Information

Application Number
CN202410963802.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-18
Publication Date
2024-12-31
Estimated Expiration
2044-07-18

AI Technical Summary

Technical Problem

In the prior art, sensor calibration based on the extreme learning machine algorithm has overfitting problems and high computing resource consumption, resulting in poor performance on the test set, and the increased hyperparameters require complex adjustments, which increases the calculation cost of the algorithm. and time overhead, especially when dealing with large-scale datasets.

Method used

Through the improved Adam algorithm, the parameters of the ELM neural network are optimized, and the update formula of beta1 and beta2 parameters is designed, the learning rate and iteration number are dynamically adjusted, the weights and thresholds from the hidden layer to the output layer are optimized, and the algorithm oscillation and instability are reduced. Improve the generalization ability of calibration models.

Benefits of technology

The improved Adam algorithm improves the convergence performance and stability of the calibration model, enhances generalization capabilities, and enables the weighing sensor to maintain good calibration results under different conditions, and the output results are more accurate and stable, reducing the calculation time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119223432A_ABST
    Figure CN119223432A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of sensor calibration, in particular to a weighing sensor calibration method based on a neural network. The method comprises the following steps: firstly, carrying out normalization processing on obtained data of a weighing sensor; secondly, initializing parameters of ELM (Extreme Learning Model) and Adam; then, an Adam algorithm is used for optimizing the weight and the threshold value from an ELM hidden layer to an output layer, and the optimized weight and the optimized threshold value are stored; and finally, inputting test set data into the trained model, and after output is obtained, carrying out anti-normalization operation on the output so as to realize the calibration work of the weighing sensor. By means of the method, the convergence performance of the optimization process can be improved, the optimization process is more stable and reliable, the precision of the calibrated weighing sensor can reach about 0.02% F.S, the weighing sensor can keep a good calibration effect under different working conditions, and the method can be suitable for calibration of sensors of different types.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of sensor calibration, and is particularly applicable to a weighing sensor calibration method based on a neural network. Background Art

[0002] With the continuous innovation and improvement of smart sensor technology, the self-calibration function plays an increasingly important role in smart weighing sensors. As a way to achieve self-calibration of smart sensors, the neural network method has the advantages of strong nonlinear modeling ability, adaptability and flexibility, so it is widely used. The ELM (Extreme Learning Machine) algorithm can simplify the complexity of model parameter adjustment and can be used for self-calibration of smart sensors.

[0003] The patent document with publication number "CN 116432520A" discloses "an improved temperature compensation method based on extreme learning machine algorithm", which adopts the traditional ELM model. Due to the overfitting problem, the performance on the training set is good, but the performance on the test set is not ideal.

[0004] Since the ELM algorithm has the problem of overfitting, the Adam method can be used to update and optimize the parameters of the ELM. The patent document with the publication number "CN 112115638A" discloses a "transformer fault diagnosis method based on an improved Adam algorithm to optimize a neural network". It adds a step-size enlargement factor and a step-size reduction factor to the Adam algorithm to increase the adaptive ability of the step size, but introduces more hyperparameters and requires repeated adjustments to obtain the best performance, which increases the complexity of use.

[0005] The patent document with publication number "CN 113570414A" discloses "an electricity price prediction method based on an improved Adam algorithm to optimize a deep neural network". It introduces additional hyperparameters to update the iteration amount of each step of the Adam algorithm, but the calculation of the iteration amount involves more operations, which increases the complexity of the algorithm.

[0006] The problems with the above files are: first, there is an overfitting problem, with excellent performance on training data but unsatisfactory results on test sets. Second, there is a problem of high computing resource consumption. Increasing the number of hyperparameters of the algorithm will bring some adverse effects. Not only do these parameters need to be adjusted more finely to ensure the performance and stability of the algorithm, but the complexity of debugging and optimization is increased. At the same time, as the number of hyperparameters increases, the computational cost of the algorithm will also increase accordingly, especially when dealing with large-scale data sets or training complex models, which may lead to higher computing resource requirements and time overhead. Summary of the invention

[0007] In view of the problems of overfitting and high consumption of computing resources in the prior art, which lead to higher computing resource requirements and time overhead when processing large-scale data sets or training complex models, the present invention proposes a weighing sensor calibration method based on neural network.

[0008] To achieve the purpose of the present invention, the present invention provides the following technical solution: a weighing sensor calibration method based on neural network, comprising the following steps:

[0009] Step 1: Collect data, divide the data into training samples and test samples in proportion, and normalize them to obtain experimental data for the ELM algorithm;

[0010] Step 2: Initialize the relevant parameters of the ELM neural network and preliminarily build the ELM neural network for weighing sensor calibration;

[0011] Step 3: In the initially constructed ELM neural network, the relevant parameters of the ELM neural network are optimized by using the improved Adam algorithm. The specific steps are as follows:

[0012] (1) Set the basic parameters of the Adam algorithm;

[0013] (ii) Design the update formula for the beta1 and beta2 parameters in the Adam algorithm;

[0014] (iii) updating according to the number of iterations;

[0015] (iv) Use the improved Adam algorithm to update the weights and thresholds of the basic ELM neural network to obtain the optimal weight threshold of the output layer of the hidden layer;

[0016] Step 4: Use the obtained optimal parameters to calibrate the output of the weighing sensor.

[0017] Furthermore, in step 3 (a): the basic parameters include a learning rate Alpha, a maximum number of iterations numEpochs, and epsilon; the learning rate Alpha controls the step size of parameter updates, the maximum number of iterations numEpochs is used to terminate iterations, and the epsilon is added to the denominator when calculating the second-order moment estimate of the gradient to prevent the denominator from being zero.

[0018] Furthermore, in step 3 (ii): the update formula of the beta1 and beta2 parameters is:

[0019]

[0020] Among them, epoch is the current iteration number. After obtaining beta1, beta2 is obtained by formula (2):

[0021] beta2=1-beta1 2 (2)

[0022] Further, in step three (iii): the updating includes the following specific steps:

[0023] (1) Use the designed beta1 and beta2 parameter update formulas to calculate parameters beta1 and beta2. Beta1 is used to control the first-order moment estimation, and beta2 is used to control the second-order moment estimation.

[0024] (2) Calculate the predicted value based on the current weight and threshold, and calculate the loss value based on the predicted value and the true value. If the loss value is lower than the set fixed value, the loop ends; if the loss value is greater than or equal to the set fixed value, proceed to the next step;

[0025] (3) Calculate the gradient of weights and thresholds from the hidden layer to the output layer;

[0026] (4) Calculate the first-order moment and second-order moment of the weight;

[0027] (5) Calculate the first-order moment and second-order moment of the threshold;

[0028] (6) Dynamically adjust the parameters beta1 and beta2 according to the current number of iterations to update the gradient of the basic neural network;

[0029] (7) Determine whether the set number of iterations has been reached, save the weight and threshold corresponding to the current minimum loss value as the optimal result, and end the program. Otherwise, continue to loop from step (1).

[0030] Furthermore, the calculation formula of the loss value in (2) is:

[0031]

[0032] Where: y i is the actual observed value, y i ' is the predicted value, and n is the number of training samples.

[0033] Furthermore, in (3), the calculation formula for the gradient of the weight and threshold from the hidden layer to the output layer is:

[0034] error=y i -y i ' (4)

[0035]

[0036] Where error is the difference between the true value and the predicted value, dw is the gradient of the weight, and db is the gradient of the threshold.

[0037] Furthermore, in (4), the first-order moment and the second-order moment of the weight are calculated according to the following formulas:

[0038]

[0039] in is the first-order moment of the weight of the current iteration, is the first-order moment of the weight in the previous iteration, is the weighted second-order moment of the current iteration, is the second moment of the weight at the previous iteration.

[0040] Furthermore, in (5), the first-order moment and the second-order moment of the threshold are calculated according to the following formula:

[0041]

[0042] in is the first-order moment of the weight of the current iteration, is the first-order moment of the weight in the previous iteration, is the weighted second-order moment of the current iteration, is the second moment of the weight at the previous iteration.

[0043] Furthermore, in (6), the weights and thresholds are updated according to the following formula:

[0044]

[0045] Among them LW j is the weight of the current iteration, LW j-1 is the weight of the previous iteration, B j is the weight of the current iteration, B j-1 is the weight of the previous iteration.

[0046] Compared with the prior art, the present invention has the following beneficial effects:

[0047] 1. By calculating beta1 and beta2, the decay rate of the parameters can be adjusted according to the actual situation of the optimization process, which helps to better control the estimation of the gradient and the accumulation of momentum, thereby improving the convergence performance of the optimization process.

[0048] 2. Beta1 and beta2 are dynamically adjusted according to the number of iterations, which can reduce the oscillation and instability of the algorithm on different problems, making the optimization process more stable and reliable.

[0049] 3. By using the improved Adam method to optimize the ELM neural network, it helps to improve the generalization ability of the calibration model and adapt to different input data distributions, so that the weighing sensor can maintain a good calibration effect under different working conditions.

[0050] 4. This method can calibrate the true value of the weighing sensor under environmental conditions, making the output result of the weighing sensor more accurate and stable, and can be applied to the calibration of different types of sensors.

[0051] The parameters of the classic Adam algorithm are adjusted through a new parameter update formula to expand the search space and improve the search capability. The weights and thresholds from the hidden layer to the output layer of the ELM neural network are optimized by using the improved Adam algorithm to improve the efficiency and accuracy of calibration. The advantage of this method is that it utilizes the fast convergence of the Adam algorithm and its ability to adaptively adjust hyperparameters, thereby accelerating the training process of the neural network and improving performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1 It is the overall flow chart of the present invention;

[0053] Figure 2 This is the flowchart of the BAdam algorithm;

[0054] Figure 3 The effect of improving the ELM-BAdam algorithm on weighing sensor calibration;

[0055] Figure 4 This is a diagram of error results when the method of the present invention is applied to the calibration of a weighing sensor. DETAILED DESCRIPTION

[0056] The present invention will be described in detail below with reference to the accompanying drawings and embodiments.

[0057] See also Figure 1 The present invention provides a weighing sensor calibration method based on neural network: first, the obtained weighing sensor data is normalized, including: the output true value and temperature of the weighing sensor, and the 1800 data in the data set are divided into a training set and a test set according to a ratio of 7:3; secondly, the parameters of ELM and Adam are initialized, including the activation function, the number of nodes, the learning rate, and the number of iterations; then, the Adam algorithm is used to optimize the weights and thresholds from the hidden layer to the output layer of the ELM, and the optimized weights and thresholds are saved; finally, the test set data is input into the trained model, and after the output is obtained, the output is denormalized to realize the calibration of the weighing sensor.

[0058] Embodiment: A weighing sensor calibration method based on neural network, the specific implementation steps are as follows:

[0059] Step 1: Collect data, divide the data into training samples and test samples in proportion, and normalize them to obtain experimental data for the ELM algorithm.

[0060] The weighing sensor used in this article is called XTW-1KG, with a range of 1KG. The standard weights measured are 30g, 50g, 100g, 150g, 500g, and 1000g, and the temperature is room temperature. The experimental data is shown in Table 1 below.

[0061] Table 1 Experimental data table

[0062]

[0063] Then, the data was processed by first dividing the data set into a training set and a test set according to a ratio of 7:3. Then the experimental data was normalized using the maximum and minimum, and the corresponding formula is as follows:

[0064]

[0065] In the formula, x i is the sample value, y i is the normalized value, max(X) is the minimum number in the data sequence, and min(X) is the maximum number in the data sequence.

[0066] Step 2: Initialize the relevant parameters of the ELM neural network and preliminarily build the ELM neural network for weighing sensor calibration.

[0067] The structure selected by the ELM neural network is 3-20-1, that is, the input layer has 3 nodes, the hidden layer has 20 nodes, and the output layer has 1 node. The corresponding ELM neural network expression is:

[0068]

[0069] Among them (w i ,b1) is the parameter of the i-th neuron in the hidden layer, W=(w1,w2,...,w L ) and b=(b1,b2,...,b L ) is the parameter acting on the input layer to the hidden layer. H is the output matrix of the hidden layer, and g(x) is the activation function of the hidden layer neural unit. Here, the Sigmoid activation function is selected, and its expression is

[0070]

[0071] The ELM model approximates the training sample with zero error through the formula:

[0072] Hβ=Y (13)

[0073] Where β is the output weight of the hidden layer neuron, and Y is the output weight of the output neuron. The output weight is obtained by the following formula

[0074]

[0075] in is the output weight, T is the target matrix of the training data, H + is the Moore–Penrose generalized inverse of the matrix H

[0076] Step 3: In the initially constructed ELM neural network, optimize the relevant parameters of the ELM neural network through the improved Adam algorithm.

[0077] See also Figure 2 , the BAdam method process of the present invention is as follows: before starting training, set the learning rate Alpha, the maximum number of iterations numEpochs and the parameter epsilon. During the training process, first calculate the first-order moment estimate beta1 and the second-order moment estimate beta2, and then use the current weights and bias values ​​for prediction, and calculate the loss value and gradient. If the loss value is lower than the preset threshold or reaches the maximum number of iterations, the training will terminate. In each iteration, the first-order and second-order moment estimates of the weights and biases are updated, and the weights and biases are updated accordingly. When the training is completed, the weights and biases when the minimum loss value is reached are output as model parameters. The specific steps are described as follows:

[0078] Step (1): First, set the basic parameters of the Adam algorithm, which are the learning rate Alpha, the maximum number of iterations numEpochs, and the parameter epsilon to avoid the denominator being zero.

[0079] The learning rate Alpha controls the step size of parameter updates to ensure that the model converges to the optimal solution quickly and stably during training; the maximum number of iterations numEpochs is used to terminate the iteration; epsilon is added to the denominator when calculating the second-order moment estimate of the gradient to prevent the denominator from being zero, thereby ensuring the stability of the algorithm.

[0080] Step (2): Design the update formula for beta1 and beta2 parameters in the Adam algorithm.

[0081] The beta1 and beta2 of the classic Adam algorithm are 0.9 and 0.999 respectively. The fixed parameter values ​​may not be able to fully adapt to the changes in data, causing the algorithm to fall into a local optimal solution or fail to achieve optimal performance during the optimization process. Therefore, the present invention designs an update formula for the beta1 and beta2 parameters, as shown in the formula:

[0082]

[0083] Among them, epoch is the current iteration number. After obtaining beta1, beta2 is obtained by the following formula:

[0084] beta2=1-beta1 2 (16)

[0085] Step (iii): Update according to the number of iterations, the update includes the following specific steps:

[0086] (1) Use the designed formula to calculate the parameters beta1 and beta2. Beta1 is used to control the first-order moment estimate, that is, the moving average of the gradient; beta2 is used to control the second-order moment estimate, that is, the moving average of the square of the gradient.

[0087] (2) Calculate the predicted value based on the current weight and threshold, and calculate the loss value based on the predicted value and the true value. In this step, use the initial predicted value outputs to calculate the loss value according to the following formula.

[0088]

[0089] Where: y i is the actual observed value, y i ' is the predicted value, and n is the number of training samples.

[0090] (3) Calculate the gradient of weights and thresholds from the hidden layer to the output layer according to the following formula.

[0091] error=y i -y i ' (18)

[0092]

[0093] Where error is the difference between the true value and the predicted value, dw is the gradient of the weight, and db is the gradient of the threshold

[0094] (4) Calculate the first-order moment and second-order moment of the weight according to the following formula.

[0095]

[0096] in is the first-order moment of the weight of the current iteration, is the first-order moment of the weight in the previous iteration, is the weighted second-order moment of the current iteration, is the second moment of the weight at the previous iteration.

[0097] (5) Calculate the first-order moment and second-order moment of the threshold according to the following formula.

[0098]

[0099] in is the first-order moment of the weight of the current iteration, is the first-order moment of the weight in the previous iteration, is the weighted second-order moment of the current iteration, is the second moment of the weight at the previous iteration.

[0100] (6) The current number of iterations dynamically adjusts the parameters beta1 and beta2 to perform gradient updates on the basic neural network. Specifically, the weights and thresholds are updated according to the following formula.

[0101]

[0102] Among them LW j is the weight of the current iteration, LW j-1 is the weight of the previous iteration, B j is the weight of the current iteration, B j-1 is the weight of the previous iteration.

[0103] (7) Determine whether the set number of iterations has been reached, save the weight and threshold corresponding to the current minimum loss value as the optimal result, and end the program; otherwise, continue the loop.

[0104] If the algorithm has reached the preset number of iterations, or the currently calculated loss value is lower than the set threshold, the algorithm will output the weight and threshold corresponding to the current lowest loss value as the optimal result, end the program, and terminate the run.

[0105] If the algorithm has not completed the maximum number of iterations and the current loss value has not dropped below the set threshold, then return to step (2) and recycle to continue calculating the loss value, gradient, first-order moment, second-order moment of the weight, first-order moment, second-order moment of the threshold, and update the weight and threshold until the optimal result is obtained.

[0106] Step 4: Use the obtained optimal parameters to calibrate the output of the weighing sensor.

[0107] Substitute the optimized initial weights and thresholds into the ELM neural network training and save them. Normalize the true value and temperature of the weighing sensor output and input them into the neural network. Finally, denormalize the output result to obtain the calibrated true value, and calculate the accuracy value of the sensor according to the following formula.

[0108]

[0109] FS is the precision value, is the true value after calibration, y is the standard weight value, S max is the measuring range of the sensor.

[0110] The ELM-LAdam method designed in the present invention is compared with the traditional ELM algorithm, and the performance of each model is shown in Table 2 below, wherein ELM is the method of comparative document 1 (CN 116432520 A), ELM-LAdam is the method shown in comparative document 2 (CN112115638 A), and ELM-BAdam is the method of this patent.

[0111] Table 2 is a comparison table of the indicators of the method of the present invention and other methods

[0112]

[0113] In order to evaluate the effect of applying the improved Adam algorithm to the ELM neural network in the calibration of the weighing sensor, Figure 3 This is the effect diagram of the improved ELM-BAdam algorithm on the calibration of the weighing sensor. The horizontal axis represents the observation time, and the vertical axis represents the predicted value and the true value of the improved ELM-BAdam algorithm. Figure 4 This is the error result diagram of the method of the present invention applied to the weighing sensor. The horizontal axis represents the observation time, and the vertical axis represents the error between the predicted value and the true value of the improved ELM-BAdam algorithm. The simulation results show that the improved ELM-BAdam neural network has lower indicators such as the root mean square error than the traditional ELM neural network. Especially in the calibration process of the weighing sensor, the algorithm can improve the accuracy of the sensor and reach a high standard of about 0.02% FS. In addition, the optimized algorithm significantly reduces the calculation time while maintaining high accuracy. Overall, the improved ELM-BAdam algorithm, with its efficient computing speed and accurate prediction ability, provides a scientific and systematic solution for sensor calibration, and has the potential for wide application in related fields.

[0114] The above is an explanation of the specific implementation of the present invention, rather than a limitation of the present invention. Those skilled in the relevant technical field can also make various equivalent technical solutions without departing from the scope of the present invention, so all equivalent technical solutions should be included in the patent protection scope of the present invention.

Claims

1. A weighing sensor calibration method based on neural network, characterized in that: The following steps are involved: Step 1: Collect data, divide the data into training samples and test samples in proportion, and normalize them to obtain experimental data for the ELM algorithm; Step 2: Initialize the relevant parameters of the ELM neural network and preliminarily build the ELM neural network for weighing sensor calibration; Step 3: In the initially constructed ELM neural network, the relevant parameters of the ELM neural network are optimized by using the improved Adam algorithm. The specific steps are as follows: (1) Set the basic parameters of the Adam algorithm; (ii) Design the update formula for the beta1 and beta2 parameters in the Adam algorithm; (iii) updating according to the number of iterations; (iv) Use the improved Adam algorithm to update the weights and thresholds of the basic ELM neural network to obtain the optimal weight threshold of the output layer of the hidden layer; Step 4: Use the obtained optimal parameters to calibrate the output of the weighing sensor.

2. A neural network based weighing sensor calibration method according to claim 1, characterized in that: In step three (a), the basic parameters include a learning rate Alpha, a maximum number of iterations numEpochs, and epsilon; the learning rate Alpha controls the step size of parameter updates, the maximum number of iterations numEpochs is used to terminate iterations, and the epsilon is added to the denominator when calculating the second-order moment estimate of the gradient to prevent the denominator from being zero.

3. A neural network-based weighing sensor calibration method according to claim 1, characterized in that: In step 3 (ii): the update formula of the beta1 and beta2 parameters is Among them, epoch is the current iteration number. After obtaining beta1, beta2 is obtained by formula (2): beta2=1-beta1 2 (2)。 4. A neural network-based weighing sensor calibration method according to claim 1, characterized in that: In step three (iii), the updating includes the following specific steps: (1) Use the designed beta1 and beta2 parameter update formulas to calculate parameters beta1 and beta2. Beta1 is used to control the first-order moment estimation, and beta2 is used to control the second-order moment estimation. (2) Calculate the predicted value based on the current weight and threshold, and calculate the loss value based on the predicted value and the true value. If the loss value is lower than the set fixed value, the loop ends; if the loss value is greater than or equal to the set fixed value, proceed to the next step; (3) Calculate the gradient of weights and thresholds from the hidden layer to the output layer; (4) Calculate the first-order moment and second-order moment of the weight; (5) Calculate the first-order moment and second-order moment of the threshold; (6) Dynamically adjust the parameters beta1 and beta2 according to the current number of iterations to update the gradient of the basic neural network; (7) Determine whether the set number of iterations has been reached, save the weight and threshold corresponding to the current minimum loss value as the optimal result, and end the program. Otherwise, continue to loop from step (1).

5. A neural network-based weighing sensor calibration method according to any of claims 1 to 4, characterized in that: The calculation formula of the loss value in (2) is: Where: y i is the actual observed value, y i ' is the predicted value, and n is the number of training samples. Furthermore, in (3), the calculation formula for the gradient of the weight and threshold from the hidden layer to the output layer is: error=and i -and i ' (4) Where error is the difference between the true value and the predicted value, dw is the gradient of the weight, and db is the gradient of the threshold.

6. A neural network-based weighing sensor calibration method according to claim 5, characterized in that: In (4), the first-order moment and the second-order moment of the weight are calculated according to the following formulas: in is the first-order moment of the weight of the current iteration, is the first-order moment of the weight in the previous iteration, is the weighted second-order moment of the current iteration, is the second moment of the weight at the previous iteration.

7. A neural network-based weighing sensor calibration method according to claim 6, characterized in that: In (5), the first-order moment and second-order moment of the threshold are calculated according to the following formula: in is the first-order moment of the weight of the current iteration, is the first-order moment of the weight in the previous iteration, is the weighted second-order moment of the current iteration, is the second moment of the weight at the previous iteration.

8. A neural network-based weighing sensor calibration method according to claim 7, characterized in that: In (5), the weights and thresholds are updated according to the following formula: Among them LW j is the weight of the current iteration, LW j-1 is the weight of the previous iteration, B j is the weight of the current iteration, B j-1 is the weight of the previous iteration.

Citation Information

Patent Citations

  • Transformer fault diagnosis method for optimizing neural network based on improved Adam algorithm

    CN112115638A

  • Real-time electricity price prediction method based on improved Adam algorithm optimization deep neural network

    CN113570414A

  • Improved temperature compensation method based on extreme learning machine algorithm

    CN116432520A

  • BP neural network based temperature gain compensation method applied to electronic scale

    CN108332837A

  • Method for optimizing neural network model in combination with gradient algorithm and evolutionary algorithm

    CN114912368A

Cited By

  • Weighing sensor calibration method based on ELM neural network

    CN120685184A