A method for offline calibration of hydrogen sensors based on deep learning
Offline calibration of hydrogen sensors through the neural network pattern recognition method based on deep learning solves the problem of unstable performance of traditional methods in low concentration environments, achieving higher recognition accuracy and speed, and enhancing the stability of the calibration system.
Patent Information
- Application Number
- CN202211336977.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-28
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2042-10-28
AI Technical Summary
The existing hydrogen sensors have unstable performance in low concentration environments, their output signals are not accurate enough, and are greatly affected by the temperature and humidity environment, making it difficult to accurately detect low concentration hydrogen.
The neural network pattern recognition method based on deep learning is adopted, and the hydrogen sensor is offline calibration through the extreme learning machine (ELM), and the neural network training is performed using the dual-mode hydrogen sensor output data to generate the output function of the calibration hydrogen sensor to predict the hydrogen concentration.
It improves the recognition accuracy and speed of hydrogen sensors in low concentration environments, enhances the stability of the calibration system, and can more accurately detect low concentration hydrogen.
Smart Images

Figure CN116720421B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of sensor calibration, and in particular relates to an off-line calibration method for a hydrogen sensor. Background Art
[0002] The core technologies of hydrogen sensors at this stage mainly include: catalytic combustion type, semiconductor type and other generation technologies, and they all produce relatively stable reactions under high concentration working conditions (1% to 4% concentration of hydrogen), but the performance of the current sensors is not stable enough under lower concentrations. The reason is that the reaction is not sufficient under low concentrations, and the changes in the sensitive elements to other environmental factors overshadow the changes in resistance caused by the reaction with the gas itself, making the output of the sensor under low concentration conditions not accurate and stable enough. For example, in a mixed combustible gas environment below 0.1%, the hydrogen sensitive element will also react with gases such as carbon monoxide, making it difficult to distinguish the actual content of the target gas from the output signal value, and the output of the hydrogen sensor will also have errors under different temperature and humidity environments. In the actual use of hydrogen energy, the low-concentration hydrogen leak detection plays a more critical role, which can gain longer processing time for the hydrogen safety plan.
[0003] Temperature sensors are sensors that sense temperature through heat-sensitive materials and convert it into usable output signals. According to the measurement method, they can be divided into two categories: contact and non-contact. According to the characteristics of sensor materials and electronic components, they can be divided into thermal resistors and thermocouples. At this stage, temperature sensor technology is already very complete and has stable performance.
[0004] A humidity sensor is a sensor device equipped with a humidity-sensitive element that can be used to measure humidity. Some sensors have on-site displays, while others do not.
[0005] Temperature and humidity sensors are widely used in various fields of production and life due to their small size and stable performance.
[0006] The current sensor calibration methods are:
[0007] 1. Average slope method
[0008] The calibration working straight line is a straight line with a slope of k passing through the coordinate origin (if a signal is generated at zero point, that is, zero point output; the entire output line can be moved so that the starting point starts from zero point), and its slope can be obtained according to the following steps.
[0009] The positive and negative strokes corresponding to each input level are averaged (positive stroke means starting from 0 value, increasing by 10% each time for measurement, until the full scale is 100%; reverse stroke means starting from the full scale, decreasing by 10% each time for measurement, until it is reduced to 0 value), and the measured average value of five positive and negative strokes is obtained, that is, the slope value obtained by using the linear equation y=kx+b and several measured average values, that is, k1, k2,…, k n Therefore, the k value of the sensor calibration working line is
[0010]
[0011] After substituting the k value, the linear calibration value corresponding to each input level can be obtained.
[0012] However, the average slope method has the disadvantage that it is not suitable for complex changing trends.
[0013] 2. Least Squares Method
[0014] When using the least squares method, the following two assumptions are usually made: all given values of the independent variable (x) are error-free, while the values of the variable y are error-free; there are actually several measurement points and several repeated measurements. The corresponding output value is y, and the general sample sampling y i The n-order polynomial fitting equation is used, as shown below:
[0015] y=h0+h2x+h3x 2 +h4x 3 +…h n x n ,(i=1,2,3,...n)
[0016] h i These are parameters that need to be calculated later.
[0017] Let the above polynomial be h(x),
[0018] Then the deviation between the calibration data obtained from the i-th measurement and the corresponding fitting line can be expressed as
[0019] Δ i =y i -h(x)
[0020] Because the error value Δ i There are positive and negative errors, so in order to facilitate unified calculation, the error Δ i Square to eliminate the influence of positive and negative values. Each measurement point has a larger or smaller error Δ i , so the total error value can be obtained by adding the squares of the errors of all measurement points, as shown in the following formula:
[0021]
[0022] The least squares method is to find a set of parameters that can minimize the above fitting equation. The fitting situation can be seen in Figure 1 shown.
[0023] Represent the polynomial h(x) in matrix form:
[0024] Y=X*h
[0025] X is an n×1 vector, h is an m×1 vector, and Y is the output vector corresponding to the sample.
[0026] The loss function is defined as is a constant coefficient. According to the least squares principle, the loss function L(h) is derived with respect to h to make it as small as possible. As shown in the following formula:
[0027]
[0028] Arrange the above formula to get:
[0029] θ=(X T X) -1 X T Y
[0030] Limitations of the least squares method:
[0031] 1) As shown in the above formula, the least squares method needs to calculate X T The inverse matrix of X may not exist. In this case, we cannot use the least squares method directly. We need to sort out the sample data and remove redundant features. T If the determinant of X is not 0, then continue using the least squares method.
[0032] 2) When the sample feature n is very large, calculate X T The inverse matrix of X is a very time-consuming task (inverting an n×n matrix), or even infeasible. At this time, iterative methods such as gradient descent can still be used. However, it is necessary to reduce the dimension of the feature through mapping processing such as principal component analysis before using the least squares method, which increases the computational complexity and is less efficient.
[0033] 3) If the fitting function is not linear, the least squares method cannot be used. It needs to be converted into a linear function through some techniques before it can be used, but this will also reduce the accuracy of the final fitting.
[0034] Compared with traditional least squares method, neural network learning method can efficiently extract information from nonlinear data, and the computational complexity is relatively smaller; this application adopts the pattern recognition method of extreme learning machine (ELM). Summary of the invention
[0035] The purpose of the present invention is to overcome the shortcomings of the average slope method that is not suitable for complex changing trends, and the shortcomings of the least squares method that is complicated in calculation, low in efficiency, and difficult to ensure accuracy, and to provide a hydrogen sensor offline calibration method using a neural network pattern recognition method to detect hydrogen concentration.
[0036] A deep learning-based offline calibration method for a hydrogen sensor comprises the following steps:
[0037] S1 collects the output data of the dual-mode hydrogen sensor;
[0038] S2 normalizes the collected data;
[0039] S3 inputs the normalized data into the extreme learning machine ELM for neural network training, and after reaching a certain accuracy and number of iterations, saves the network to obtain the output function of the calibrated hydrogen sensor;
[0040] S4 predicts the hydrogen concentration according to the obtained output function and outputs the result t.
[0041] Among them, the total number of output data of the dual-mode hydrogen sensor of S1 is N; the dimension is 3, and the three signals are the temperature signal of the temperature sensor, the humidity signal of the humidity sensor, and the voltage output signal of the output signal of the hydrogen sensor after passing through the acquisition board; a single set of input data is represented by a vector as x i =(x i1 ,x i2 ,x i3 ) T , where x i Represents the i-th signal among N signals.
[0042] Wherein, said S2 is,
[0043] The method used is the (0, 1) normalization method, which is to find the maximum value Max and the minimum value Min in each type of eigenvalue, and then use the difference between the maximum value and the minimum value as the base formula as follows:
[0044]
[0045] Wherein, the S3 is specifically:
[0046] The calibrated hydrogen gas concentration is used as the label value, and a single label value is represented by a vector yi =(y i1 );
[0047] Assuming the number of neurons in the hidden layer is L, which is less than the amount of data in the input signal, the hidden layer output of a single node is as follows:
[0048]
[0049] The hidden layer matrix H obtained by N input data and L hidden nodes is as follows:
[0050]
[0051] ω i : The i-th weight factor in the hidden layer matrix
[0052] b i : The i-th bias factor in the hidden layer matrix
[0053] β i : The weight value of the output of the i-th hidden layer node
[0054] G i : The calculation formula of the i-th term in the hidden layer, G i =ω i *x i +b i
[0055] X i : The i-th value in a set of data matrix X
[0056] Assume that the weight matrix from the hidden layer to the output layer is β, and the predicted target vector is T, then the output matrix is as follows:
[0057]
[0058] The ELM algorithm strategy is to fix the weight ω and threshold b from the input layer to the hidden layer, and find the least squares solution of the minimum norm of the weight matrix β from the hidden layer to the output layer, as shown below:
[0059]
[0060] t i : Actual target value
[0061] Introducing the regularization variable ξ i In order to reduce the structural risk, the final loss function Loss is obtained, as shown in the following formula:
[0062]
[0063] C is the coefficient for minimizing the structural risk, also known as the penalty factor, C ≥ 0
[0064] The Lagrange multiplier method is used to solve the maximum value problem of the above formula, as shown below:
[0065]
[0066] α i : Lagrangian operator of the i-th sample
[0067] N: Sample size
[0068] m: the number of hidden layer nodes
[0069] j: jth hidden node
[0070] After finishing, we can get:
[0071]
[0072] The required β is obtained from the following formula:
[0073]
[0074] Finally, the algorithm framework is completed, and the output function is as follows:
[0075]
[0076] The specific method for achieving a certain accuracy and number of iterations in S3 is as follows:
[0077] The normalized data is input into the extreme learning machine neural network, and the network finally outputs a single value, which is the predicted hydrogen concentration value y i ', and the actual hydrogen concentration value y i To make the mean square error loss function, the formula is as follows:
[0078]
[0079] The parameters in the model are continuously trained and adjusted by the gradient descent method, and the Loss value is made as small as possible until a minimum value is reached, and the prediction model performance is considered good at this time. The output prediction value at this time is used as an auxiliary for the sensor to detect the hydrogen concentration, and the model parameter state at this time is retained. If the difference between the sensor output value and the model prediction value is large, the model prediction value is used as the actual output value of the sensor to compensate for the original data distortion problem of the sensor.
[0080] The network with the best prediction performance and the output prediction value are obtained.
[0081] Wherein, the S4 is specifically:
[0082]
[0083] i: the i-th node in the hidden layer
[0084] x n : The nth node of the input data
[0085] m: number of nodes for input data
[0086] L: The number of nodes in the hidden layer
[0087] β i : The weight corresponding to the i-th node in the hidden layer
[0088] ω i : The weight corresponding to the i-th node in the hidden layer
[0089] b i : The bias value corresponding to the i-th node in the hidden layer.
[0090] Technical effects of the present invention:
[0091] Compared with the average slope method, the pattern recognition method based on neural network has better fitting.
[0092] Compared with the traditional least squares method, the pattern recognition method based on neural network has better versatility and has more advantages in recognition accuracy and speed. The calibration system formed by combining array sensors has more stable performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0093] The accompanying drawings generally illustrate various embodiments by way of example and not limitation, and together with the description and claims, serve to illustrate the embodiments of the invention. Where appropriate, the same reference numerals are used throughout the drawings to refer to the same or similar parts. Such embodiments are illustrative and are not intended to be exhaustive or exclusive embodiments of the present apparatus or method.
[0094] Figure 1 A schematic diagram of the algorithm training process of the present invention is shown;
[0095] Figure 2 A schematic diagram of a hydrogen sensor performance testing system constructed in the present invention is shown. DETAILED DESCRIPTION
[0096] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0097] (1) Gas collection scheme of dual-mode hydrogen sensor
[0098] The dual-mode hydrogen sensor is put into the hydrogen sensor performance test system. The system continuously releases gases of different concentrations. The specific range is: 10ppm (0.001%) ~ 10000ppm (1%), the concentration difference is 5ppm (0.0005%), and the duration is uniformly 10min (generally enough to ensure that the sensor is fully stable). The acquisition frequency of the host computer acquisition card is 10Hz. The 11988000 sets of data (sensor output and other eigenvalue data) collected are used as the data source for neural network learning.
[0099] (2) Scheme of calibrating dual-mode hydrogen sensor using neural network model
[0100] Training and learning are performed based on the collected output data of the dual-mode hydrogen sensor, such as Figure 1 As shown, firstly, the data is preprocessed. Since the output performance of the sensor is relatively stable, there will be no missing values. Therefore, it is only necessary to normalize the data. The method used is the (0, 1) normalization method. This method is to find the maximum (Max) and minimum (Min) values in each type of eigenvalue, and then use the difference between the maximum and minimum values as the base formula as follows:
[0101]
[0102] After this normalization process, the normalized value will be in the range of (0, 1), thus ensuring that different types of data can be treated equally by the model and eliminating unit errors.
[0103] The following table shows some of the collected raw data sets:
[0104]
[0105]
[0106] The following table shows the normalized data set:
[0107] temperature humidity Hydrogen concentration Output voltage 0.1 0.815358 0.840717 0.7547226 0.35 0.430169 0.571667 0.656563 0.7 0.723333 0.757384 0.863993 0.383333 0.430766 0.955541 0.816561 0.566666 0.850119 0.272316 0.510373 0.616666 0.584516 0.521097 0.922545 0.083333 0.507669 0.883966 0.544952
[0108] Then the normalized data is fed into the extreme learning machine neural network. The network finally outputs a single value, which is the predicted hydrogen concentration value y'. The mean square error loss function is compared with the actual hydrogen concentration value y. The formula is as follows:
[0109]
[0110] The parameters in the model are continuously trained and adjusted through the gradient descent method, and the Loss value is made as small as possible until it is trained to a minimum value. It can be determined that the prediction model performance at this time is good. The output prediction value at this time can be used as an auxiliary for the sensor to detect the hydrogen concentration. Therefore, the model parameter state at this time is retained. If the gap between the output value of the sensor and the model prediction value is large, the model prediction value can be used as the actual output value of the sensor to compensate for the original data distortion problem of the sensor.
[0111] The network with the best prediction performance and the output prediction value are obtained.
[0112] The following table shows some model calibration results
[0113]
[0114] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A hydrogen sensor offline calibration method based on deep learning, characterized in that: The following steps are involved: S1 collects the output data of the dual-mode hydrogen sensor; S2 normalizes the collected data; S3 inputs the normalized data into the extreme learning machine ELM for neural network training, and after reaching a certain accuracy and number of iterations, saves the network to obtain the output function of the calibrated hydrogen sensor; S4 predicts the hydrogen concentration according to the obtained output function and outputs the result t; The S3 is specifically: The calibrated hydrogen gas concentration is used as the label value, and a single label value is represented by a vector y i =(y i1 ); Assuming the number of neurons in the hidden layer is L, which is less than the amount of data in the input signal, the hidden layer output of a single node is as follows: The hidden layer matrix H obtained by N input data and L hidden nodes is as follows: ω i : The i-th weight factor in the hidden layer matrix b i : The i-th bias factor in the hidden layer matrix β i : The weight value of the output of the i-th hidden layer node G i : The calculation formula of the i-th term in the hidden layer, G i =ω i *x i +b i X i : The i-th value in a set of data matrix X Assume that the weight matrix from the hidden layer to the output layer is β, and the predicted target vector is T, then the output matrix is as follows: Hβ=T The ELM algorithm strategy is to fix the weight ω and threshold b from the input layer to the hidden layer, and find the least squares solution of the minimum norm of the weight matrix β from the hidden layer to the output layer, as shown in the following formula: t i : Actual target value Introducing the regularization variable ξ i In order to reduce the structural risk, the final loss function Loss is obtained, as shown in the following formula: C is the coefficient for minimizing the structural risk, also known as the penalty factor, C ≥ 0 The Lagrange multiplier method is used to solve the maximum value problem of the above formula, as shown below: α i : Lagrangian operator of the i-th sample N: Sample size m: the number of hidden layer nodes j: jth hidden node After finishing, we can get: The required β is obtained from the following formula: Finally, the algorithm framework is completed and the output function is as follows: The specific method for achieving a certain accuracy and number of iterations in S3 is as follows: The normalized data is input into the extreme learning machine neural network, and the network finally outputs a single value, which is the predicted hydrogen concentration value y i ', and the actual hydrogen concentration value y i To make the mean square error loss function, the formula is as follows: The parameters in the model are continuously trained and adjusted by the gradient descent method, and the Loss value is made as small as possible until a minimum value is reached, and the prediction model performance is considered good at this time. The output prediction value at this time is used as an auxiliary for the sensor to detect the hydrogen concentration, and the model parameter state at this time is retained. If the difference between the sensor output value and the model prediction value is large, the model prediction value is used as the actual output value of the sensor to compensate for the original data distortion problem of the sensor. Obtain the network with the best prediction performance and output prediction value; The S4 is specifically: i: the i-th node in the hidden layer x n : The nth node of the input data m: number of nodes for input data L: The number of nodes in the hidden layer β i : The weight corresponding to the i-th node in the hidden layer ω i : The weight corresponding to the i-th node in the hidden layer b i : The bias value corresponding to the i-th node in the hidden layer.
2. The method according to claim 1, characterized in that: The total number of output data of the dual-mode hydrogen sensor of S1 is N; the dimension is 3, and the three signals are the temperature signal of the temperature sensor, the humidity signal of the humidity sensor, and the voltage output signal of the output signal of the hydrogen sensor after passing through the acquisition board; a single set of input data is represented by a vector as x i =(x i1 ,x i2 ,x i3 ) T , where x i Represents the i-th signal among N signals.
3. The method according to claim 1, characterized in that The S2 is, The method used is the (0, 1) normalization method, which is to find the maximum value Max and the minimum value Min in each type of eigenvalue, and then use the difference between the maximum value and the minimum value as the base formula as follows:
Citation Information
Patent Citations
Crop transpiration prediction method based on improved extreme learning machine
CN106651012A
An optical dissolved oxygen sensor nonlinear temperature compensation method based on a neural network L-M algorithm
CN109816094A