A neural network-based weighing sensor calibration method

By optimizing the parameters of the ELM neural network using the improved Adam algorithm, the problems of overfitting and high computational resource consumption in weighing sensor calibration are solved, resulting in more efficient and stable calibration effects that are applicable to different types of sensors.

CN119223432BActive Publication Date: 2025-11-18XIAN TECH UNIV
View PDF 3 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In existing technologies, neural network-based techniques suffer from overfitting and high computational resource consumption in weighing sensor calibration, especially when dealing with large-scale datasets or training complex models, leading to increased computational resource requirements and time overhead.

Method used

An improved Adam algorithm is used to optimize the parameters of an extreme learning machine (ELM) neural network. By designing update formulas for beta1 and beta2, the parameter decay rate is dynamically adjusted, the weights and thresholds from the hidden layer to the output layer are optimized, the algorithm oscillations and instability are reduced, and the generalization ability of the calibration model is improved.

Benefits of technology

It improves the convergence performance of the optimization process, reduces algorithm oscillations and instabilities, enhances the calibration accuracy and stability of the weighing sensor under different conditions, reduces computation time, and is suitable for calibrating different types of sensors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119223432B_ABST
    Figure CN119223432B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of sensor calibration, and particularly to a kind of weighing sensor calibration method based on neural network.The method: first, the data of obtained weighing sensor is normalized;Second, the parameters of ELM and Adam are initialized;Then the weights and thresholds from ELM hidden layer to output layer are optimized using Adam algorithm, and the optimized weights and thresholds are saved;Finally, the test set data is input into the trained model, and after obtaining the output, the output is de-normalized to realize the calibration of weighing sensor.Through the method, the convergence performance of the optimization process can be improved, and the optimization process is more stable and reliable.The precision of the calibrated weighing sensor can reach about 0.02%F.S, and the weighing sensor can maintain good calibration effect under different working conditions, which can be applied to the calibration of different types of sensors.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of sensor calibration technology, and is particularly applicable to a weighing sensor calibration method based on neural networks. Background Technology

[0002] With the continuous innovation and improvement of intelligent sensor technology, self-calibration plays an increasingly important role in intelligent weighing sensors. Neural network methods, as a means to achieve self-calibration of intelligent sensors, possess advantages such as strong nonlinear modeling capabilities, adaptability, and flexibility, and are therefore widely used. The ELM (Extreme Learning Machine) algorithm can simplify model parameter tuning complexity and can be used for intelligent sensor self-calibration.

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

[0004] Because the ELM algorithm suffers from overfitting, the Adam method can be used to update and optimize its parameters. Patent document CN 112115638 A discloses a "Transformer Fault Diagnosis Method Based on Improved Adam Algorithm and Optimized Neural Network," which adds step size expansion and reduction factors to the Adam algorithm to increase its adaptive step size. However, this introduces many hyperparameters, requiring repeated adjustments to achieve optimal performance, thus increasing the complexity of its use.

[0005] The patent document with publication number "CN 113570414 A" discloses "Electricity Price Prediction Method Based on Improved Adam Algorithm for Optimizing Deep Neural Networks". It introduces additional hyperparameters to update the iteration amount of the Adam algorithm at each step. However, the calculation of the iteration amount involves more operations, which increases the complexity of the algorithm.

[0006] The aforementioned document has two main problems: First, it suffers from overfitting, performing exceptionally well on training data but poorly on the test set. Second, it consumes significant computational resources. Increasing the number of hyperparameters in the algorithm has several adverse effects. Not only does it require more precise tuning of these parameters to ensure the algorithm's performance and stability, increasing the complexity of debugging and optimization, but the computational cost also increases accordingly, especially when dealing with large-scale datasets or training complex models, potentially leading to higher computational resource requirements and time overhead. Summary of the Invention

[0007] To address the problems of overfitting and high computational resource consumption in existing technologies, which lead to higher computational resource requirements and time overhead when processing large-scale datasets or training complex models, this invention proposes a weighing sensor calibration method based on neural networks.

[0008] To achieve the objectives of this invention, the technical solution provided by this invention is as follows: A weighing sensor calibration method based on a neural network, comprising the following steps:

[0009] Step 1: Collect data, divide the data into training samples and test samples according to the 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 initially construct 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 using the improved Adam algorithm. The specific steps are as follows:

[0012] (a) Setting the basic parameters of the Adam algorithm;

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

[0014] (iii) Update 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 thresholds 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 three (a): the basic parameters include the learning rate Alpha, the 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 the iteration, and the epsilon is added to the denominator when calculating the second moment estimate of the gradient to prevent the denominator from being zero.

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

[0019]

[0020] Where epoch is the current iteration number, beta2 is obtained by calculating beta1 and then by equation (2):

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

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

[0023] (1) Calculate parameters beta1 and beta2 using the update formulas of the designed beta1 and beta2 parameters. beta1 is used to control the first moment estimation and beta2 is used to control the second 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 actual value. If the loss value is lower than the set fixed value, end the loop; if the loss value is greater than or equal to the set fixed value, proceed to the next step.

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

[0026] (4) Calculate the first and second moments of the weights;

[0027] (5) Calculate the first and second moments of the threshold;

[0028] (6) Dynamically adjust parameters beta1 and beta2 according to the current iteration number 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 formula for calculating the loss value in (2) is as follows:

[0031]

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

[0033] Furthermore, in (3), the formula for calculating the gradient of the hidden layer to the output layer weights and thresholds is as follows:

[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 weights, and db is the gradient of the threshold.

[0037] Furthermore, in step (4), the first and second moments of the weights are calculated according to the following formulas.

[0038]

[0039] in It is the first moment of the weights in the current iteration. It is the first moment of the weights from the previous iteration. It is the second moment of the weights in the current iteration. It is the second moment of the weights from the previous iteration.

[0040] Furthermore, in step (5), the first and second moments of the threshold are calculated according to the following formula.

[0041]

[0042] in It is the first moment of the weights in the current iteration. It is the first moment of the weights from the previous iteration. It is the second moment of the weights in the current iteration. It is the second moment of the weights from the previous iteration.

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

[0044]

[0045] LW j It is the weight of the current iteration, LW j-1 It is the weight from the previous iteration, B j It is the weight of the current iteration, B j-1 It is the weight from 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 gradients and the accumulation of momentum, thereby improving the convergence performance of the optimization process.

[0048] 2. The 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, the generalization ability of the calibration model can be improved, which can 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 it can be applied to the calibration of different types of sensors.

[0051] The parameters of the classic Adam algorithm are adjusted using a new parameter update formula, increasing the search space and improving search capability. An improved Adam algorithm is employed to optimize the weights and thresholds from the hidden to the output layer of the ELM neural network, thereby improving calibration efficiency and accuracy. The advantage of this method lies in leveraging the Adam algorithm's fast convergence and adaptive hyperparameter adjustment capabilities, thus accelerating the neural network training process and improving performance. Attached Figure Description

[0052] Figure 1 This is an overall flowchart of the present invention;

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

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

[0055] Figure 4 This is a graph showing the error results of applying the method of the present invention to the calibration of a weighing sensor. Detailed Implementation

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

[0057] See Figure 1 This invention provides a weighing sensor calibration method based on neural networks: First, the obtained weighing sensor data is normalized, including the true output value and temperature of the weighing sensor. The 1800 data points in the dataset are divided into a training set and a test set in a 7:3 ratio. Second, the parameters of ELM and Adam are initialized, including the activation function, number of nodes, learning rate, and number of iterations. Then, the Adam algorithm is used to optimize the weights and thresholds from the hidden layer to the output layer of ELM, and the optimized weights and thresholds are saved. Finally, the test set data is input into the trained model, and after obtaining the output, the output is denormalized to achieve the calibration of the weighing sensor.

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

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

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

[0061] Table 1 Experimental Data

[0062]

[0063] Next, the data was processed. First, the dataset was divided into training and testing sets in a 7:3 ratio. Then, the experimental data was normalized using the maximum-minimum method, as shown in the following formula:

[0064]

[0065] In the formula, x i For sample values, y i The values ​​are normalized, where 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 initially construct the ELM neural network for weighing sensor calibration.

[0067] The ELM neural network uses a 3-20-1 structure, meaning it has 3 nodes in the input layer, 20 nodes in the hidden layers, and 1 node in the output layer. The corresponding ELM neural network expression is:

[0068]

[0069] Among them (w) i b1) are the parameters of the i-th neuron in the hidden layer, W = (w1, w2, ..., w2) L ) and b = (b1, b2, ..., b L ) represents the parameters acting from 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 neurons. Here, the Sigmoid activation function is chosen, and its expression is:

[0070]

[0071] The ELM model approximates the training samples with zero error using a 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 weights are calculated using the following formula.

[0074]

[0075] in These are the output weights, where T is the target matrix of the training data, and H is the output weights. + It is the Moore–Penrose generalized inverse matrix of matrix H.

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

[0077] See Figure 2 The BAdam method of this invention is as follows: Before training begins, the learning rate Alpha, the maximum number of iterations numEpochs, and the parameter epsilon are set. During training, the first-order moment estimate beta1 and the second-order moment estimate beta2 are first calculated. Then, prediction is performed using the current weights and biases, and the loss value and gradient are calculated. If the loss value is lower than a preset threshold or the maximum number of iterations is reached, 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 training ends, the weights and biases at the point where the minimum loss value is reached are output as model parameters. The specific steps are described below:

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

[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 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 formulas for the beta1 and beta2 parameters in the Adam algorithm.

[0081] The classic Adam algorithm uses beta1 and beta2 of 0.9 and 0.999, respectively. Fixed parameter values ​​may not adequately adapt to changes in data, causing the algorithm to get stuck in local optima or fail to achieve optimal performance during optimization. Therefore, this invention designs an update formula for the beta1 and beta2 parameters, as shown in the equation:

[0082]

[0083] Where epoch is the current iteration number, beta2 is obtained by calculating beta1 and then using the following formula:

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

[0085] Step (3): Update according to the number of iterations. The update includes the following specific steps:

[0086] (1) Calculate parameters beta1 and beta2 using the designed formula. beta1 is used to control the first moment estimation, i.e. the moving average of the gradient; beta2 is used to control the second moment estimation, i.e. 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 actual value. In this step, the initial predicted values ​​are used to calculate the loss value according to the following formula.

[0088]

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

[0090] (3) Calculate the gradient from the hidden layer to the output layer weights and thresholds 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 weights, and db is the gradient of the threshold.

[0094] (4) Calculate the first moment and second moment of the weights according to the following formulas.

[0095]

[0096] in It is the first moment of the weights in the current iteration. It is the first moment of the weights from the previous iteration. It is the second moment of the weights in the current iteration. It is the second moment of the weights from the previous iteration.

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

[0098]

[0099] in It is the first moment of the weights in the current iteration. It is the first moment of the weights from the previous iteration. It is the second moment of the weights in the current iteration. It is the second moment of the weights from the previous iteration.

[0100] (6) The parameters beta1 and beta2 are dynamically adjusted according to the current iteration number to update the gradient of the basic neural network. Specifically, the weights and thresholds are updated according to the following formula.

[0101]

[0102] LW j It is the weight of the current iteration, LW j-1 It is the weight from the previous iteration, B j It is the weight of the current iteration, B j-1 It is the weight from 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 if the currently calculated loss value is lower than the set threshold, the algorithm will save the weight and threshold corresponding to the current lowest loss value as the optimal result, end the program, and terminate its operation.

[0105] If the algorithm has not completed the maximum number of iterations and the current loss value has not dropped below the set threshold, return to step (2) and start looping again to continue calculating the loss value, gradient, first moment and second moment of weights, first moment and second moment of threshold, thereby updating the weights 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] The optimized initial weights and thresholds are substituted into the ELM neural network for training and saved. The true value of the weighing sensor output and the normalized temperature are input into the neural network. Finally, the output result is inversely normalized to obtain the calibrated true value, and the sensor accuracy value is calculated according to the following formula.

[0108]

[0109] FS is the precision value. The true value after calibration is given, y is the standard weight value, and S is the true value. max This refers to the sensor's measurement range.

[0110] The performance of the ELM-LAdam method designed in this invention is compared with that of the traditional ELM algorithm. Table 2 shows the performance of each model. ELM is the method shown in CN 116432520 A, ELM-LAdam is the method shown in CN 112115638 A, and ELM-BAdam is the method of this patent.

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

[0112]

[0113] To evaluate the effectiveness of this invention in applying the improved Adam algorithm to an ELM neural network in symmetric weighing sensor calibration, Figure 3 The graph shows the effect of improving the ELM-BAdam algorithm for calibrating the weighing sensor. The horizontal axis represents the observation time, and the vertical axis represents the predicted value and the actual value of the improved ELM-BAdam algorithm. Figure 4 The graph shows the error results of applying the method of this invention to a weighing sensor. The horizontal axis represents the observation time, and the vertical axis represents the error between the predicted value and the actual value of the improved ELM-BAdam algorithm. Simulation results show that the improved ELM-BAdam neural network reduces errors in indicators such as root mean square error compared to the traditional ELM neural network. Particularly in the calibration process of weighing sensors, this algorithm can improve the sensor's accuracy, achieving a high standard of approximately 0.02% FS. Furthermore, the optimized algorithm significantly reduces computation time while maintaining high accuracy. Overall, the improved ELM-BAdam algorithm, with its efficient computation speed and accurate prediction capabilities, provides a scientific and systematic solution for sensor calibration and has broad application potential in related fields.

[0114] The above description is a specific illustration of the present invention, and not a limitation thereof. Those skilled in the art can make various equivalent technical solutions without departing from the scope of the present invention; therefore, all equivalent technical solutions should fall within the patent protection scope of the present invention.

Claims

1. A method for calibrating a weighing sensor based on a neural network, characterized in that, Includes the following steps: Step 1: Collect data, divide the data into training samples and test samples according to the proportion, and normalize them to obtain experimental data for the ELM algorithm; Step 2: Initialize the relevant parameters of the ELM neural network and initially construct 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 using the improved Adam algorithm. The specific steps are as follows: (a) Setting the basic parameters of the Adam algorithm; (ii) Design the update formulas for the beta1 and beta2 parameters in the Adam algorithm; (iii) Update 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 thresholds of the output layer of the hidden layer. Step 4: Calibrate the output of the weighing sensor using the obtained optimal parameters; In step three (iii), the update includes the following specific steps: (1) Calculate parameters beta1 and beta2 using the update formulas of the designed beta1 and beta2 parameters. beta1 is used to control the first moment estimation and beta2 is used to control the second 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 actual value. If the loss value is lower than the set fixed value, end the loop; if the loss value is greater than or equal to the set fixed value, proceed to the next step. (3) Calculate the gradient from the hidden layer to the weights and thresholds of the output layer; (4) Calculate the first and second moments of the weights; (5) Calculate the first and second moments of the threshold; (6) Dynamically adjust parameters beta1 and beta2 according to the current iteration number 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). The characteristic is that the formula for calculating the loss value in (2) is as follows: Where: y i It is the actual observed value, y i ' is the predicted value, and n is the number of training samples; Furthermore, in (3), the formula for calculating the gradient of the hidden layer to the output layer weights and thresholds is as follows: error=y i -and i ' (4) Where error is the difference between the true value and the predicted value, dw is the gradient of the weights, and db is the gradient of the threshold; In (4), the first moment and second moment of the weights are calculated according to the following formulas. in It is the first moment of the weights in the current iteration. It is the first moment of the weights from the previous iteration. It is the second moment of the weights in the current iteration. It is the second moment of the weights from the previous iteration; In step (5), the first moment and second moment of the threshold are calculated according to the following formula. in It is the first moment of the weights in the current iteration. It is the first moment of the weights from the previous iteration. It is the second moment of the weights in the current iteration. It is the second moment of the weights from the previous iteration.

2. The weighing sensor calibration method based on a neural network according to claim 1, characterized in that, In step three (a), the basic parameters include the learning rate Alpha, the 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 the iteration, and epsilon is added to the denominator when calculating the second moment estimate of the gradient to prevent the denominator from being zero.

3. The weighing sensor calibration method based on a neural network according to claim 1, characterized in that, In step three (two): the update formula for the beta1 and beta2 parameters is as follows: Where epoch is the current iteration number, beta2 is obtained by calculating beta1 and then by equation (2): beta2=1-beta1 2 (2)。 4. The weighing sensor calibration method based on a neural network according to claim 3, characterized in that, In step (5), the weights and thresholds are updated according to the following formula. LW j It is the weight of the current iteration, LW j-1 It is the weight from the previous iteration, B j It is the weight of the current iteration, B j-1 It is the weight from 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