Rapid hydrogen detection method based on 1DCNN and GRU

By using a combined model of 1DCNN and GRU in hydrogen detection, the robustness and generalization ability of the algorithm are enhanced, and the problems of long response time and low sensitivity of the existing hydrogen detection methods are solved, achieving fast, stable and accurate Hydrogen concentration prediction, suitable for real-time and cost-restricted hardware devices.

CN119167015AActive Publication Date: 2024-12-20UNIV OF ELECTRONICS SCI & TECH OF CHINA

Patent Information

Application Number
CN202411204708.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2024-12-20
Estimated Expiration
2044-08-30

AI Technical Summary

Technical Problem

The existing hydrogen detection methods have problems such as long response time, low sensitivity, poor selectivity or susceptibility to environmental factors. The autoencoder performs well on the training data but is difficult to generalize to unseen data, resulting in unstable results and Inconsistent.

Method used

Using the rapid hydrogen detection method based on 1DCNN and GRU, a hydrogen concentration prediction model is constructed, local features are captured using 1DCNN structure, the GRU layer and Dropout layer are set to enhance the robustness and generalization ability of the algorithm, and a specific loss function is designed to Equilibrium error sensitivity.

Benefits of technology

It realizes rapid prediction of hydrogen concentration with low structural complexity and high prediction accuracy. It is suitable for applications with low computational complexity, real-time and low cost, with good stability and consistency, and is suitable for hardware devices with limited real-time and cost. accomplish.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119167015A_ABST
    Figure CN119167015A_ABST
Patent Text Reader

Abstract

The invention discloses a rapid hydrogen detection method based on 1DCNN and GRU, and belongs to the technical field of gas detection based on a gas sensor, a response-recovery change curve is obtained through a hydrogen sensor, a resistance signal in a response initial stage is extracted, and the resistance signal and a corresponding real hydrogen concentration form a sample point; after normalization and drift compensation, the hydrogen is input to a hydrogen concentration prediction model for training, the hydrogen concentration prediction model is obtained by arranging a Dropout layer and a GRU layer in front of an output layer of the 1DCNN neural network model, and the trained hydrogen concentration prediction model is used for rapidly detecting hydrogen to be tested. According to the invention, rapid hydrogen concentration prediction with low structural complexity and high prediction precision can be realized, and the method is especially suitable for low-computational complexity, real-time and low-cost application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of gas detection based on gas sensors, and in particular relates to a rapid hydrogen detection method based on 1DCNN and GRU. Background Art

[0002] With the rapid development of hydrogen energy, the safety of hydrogen has received increasing attention. Hydrogen is flammable and explosive, and its leakage detection is crucial to ensuring industrial safety and the safety of people's lives and property. Traditional hydrogen detection methods, such as electrochemical sensors and metal oxide semiconductor sensors, have limitations such as long response time, low sensitivity, poor selectivity, or susceptibility to environmental factors.

[0003] In order to improve the speed and accuracy of hydrogen detection, the application of deep learning technology in the field of sensor signal processing has gradually increased in recent years. Using the initial stage of the response in the response-recovery curve of the gas sensor, the neural network can realize rapid gas detection. For example, the Chinese patent with application number CN 202310824091.X discloses a rapid hydrogen detection method based on an autoencoder (AEN) and a fully connected layer, which uses an autoencoder to extract feature values ​​and uses a fully connected layer to output prediction results. However, as an unsupervised learning model, the training process of the autoencoder requires more data and computing resources. In addition, the autoencoder performs well on the training data, but it may be difficult to generalize to unseen data, especially when a large amount of data is used in the training process. The verification result of the above method has a large confidence interval, and the relative error 95% confidence interval is [-2.92,3.03]. This is because when using the autoencoder for anomaly detection, the results may be unstable and inconsistent, and the ideal effect cannot be achieved. Therefore, it is necessary to seek a hydrogen rapid detection method with better stability and higher confidence.

[0004] The success of convolutional neural networks (CNNs) in image and signal recognition has inspired the exploration of applying them to fast detection algorithms. Compared with autoencoders, CNNs show more powerful feature extraction capabilities in image recognition and classification tasks. Through convolutional and pooling layers, CNNs can capture local features of images and achieve invariance to input changes while reducing the risk of overfitting. Currently, most research focuses on two-dimensional convolutional neural networks (2D-CNNs). 2D-CNNs perform well in processing data with rich spatial structures, but they have high computational complexity, a large number of parameters, large memory requirements, and strong dependence on spatial structure information.

[0005] In contrast, 1D-CNN can capture local patterns and long-distance dependencies in sequences at a lower computational cost and memory requirement when processing one-dimensional data such as time series, audio signals or text, showing higher flexibility and efficiency. Therefore, the present invention proposes a method for rapid hydrogen detection based on 1DCNN. Summary of the invention

[0006] In view of the technical problems existing in the above-mentioned prior art, the present invention provides a rapid hydrogen detection method based on 1DCNN and GRU, which can realize rapid prediction of hydrogen concentration with low structural complexity and high prediction accuracy, and is particularly suitable for applications with low computational complexity, real-time and low cost.

[0007] The technical solution adopted by the present invention is as follows:

[0008] A hydrogen rapid detection method based on 1DCNN and GRU, comprising the following steps:

[0009] S1. Perform hydrogen concentration test by using hydrogen sensor. Alternately pass hydrogen with known concentration and air into hydrogen sensor to obtain a set of response-recovery curves of resistance. Pass hydrogen with different concentrations to obtain raw data consisting of different real hydrogen concentrations and corresponding response-recovery curves.

[0010] S2. For each response-recovery change curve in the original data, the response starting point is obtained, and the resistance signal within T time after the response starting point is extracted; a real hydrogen concentration and the resistance signal within the corresponding T time form a sample point, and the sample set S is obtained by performing maximum and minimum normalization on the resistance signal and normalizing the real hydrogen concentration;

[0011] S3, performing drift compensation on each resistance signal in the sample set S to obtain a sample set S′;

[0012] S4, constructing a hydrogen concentration prediction model, taking the resistance signal in the sample set S′ as input and the actual hydrogen concentration as output, training the hydrogen concentration prediction model to obtain a trained hydrogen concentration prediction model;

[0013] The hydrogen concentration prediction model is obtained by setting a Dropout layer and a GRU layer before the output layer of the 1DCNN neural network model;

[0014] S5. Pass the hydrogen to be tested into the gas sensor, extract the resistance signal within T time from the response starting point in its response-recovery change curve, input it into the trained hydrogen concentration prediction model after normalization, and output the predicted concentration of the hydrogen to be tested.

[0015] Furthermore, the structure of the hydrogen concentration prediction model includes in sequence:

[0016] 1 input layer;

[0017] 1 fully connected layer;

[0018] At least one set of alternating 1 convolutional layer and 1 max pooling layer;

[0019] 1 Dropout layer;

[0020] 1 GRU layer;

[0021] 1 output layer.

[0022] Furthermore, the value of T in S2 is 6 to 10, and the corresponding number m of resistance signals is determined by the value of T according to the adopted sampling frequency.

[0023] Furthermore, the sample set S in S2 is S={(R1,Y1),(R2,Y2),...,(R N ,Y N )}; where N is the total number of sample points, determined according to the concentration range of hydrogen to be tested; R i =(r i (1) ,r i (2) ,...,r i (m) ),i=1,2,...,N is the resistance signal of the i-th sample point, r i (j) ,j=1,2,...,m,i=1,2,...,N is the resistance value of the jth resistance signal in the i-th sample point; Y i ,i=1,2,...,N is the actual hydrogen concentration of the i-th sample point.

[0024] Furthermore, the specific process of performing drift compensation on each resistance signal in the sample set S in S3 is:

[0025] S31, obtaining the first resistance value of each resistance signal in the sample set S And calculate all the first resistance values ​​r i (1) ,i=1,2,...,the average value of N

[0026] S32, calculating the first resistance value r of the resistance signal of the i-th sample point i (1) ,i=1,2,...,N and the average value The difference Res i , i=1,2,...,N, then calculate the resistance signal R of the i-th sample point i=(r i (1) ,r i (2) ,...,r i (m) ),i=1,2,...,N and Res i ,i=1,2,...,N, as the resistance signal of the i-th sample point after drift compensation

[0027] S33, traverse all sample points in the sample set S, repeat the process of S32, complete the drift compensation of all resistance signals in the sample set S, and obtain the sample set S′.

[0028] Furthermore, the loss function of the hydrogen concentration prediction model is:

[0029]

[0030] In the formula, δ lower and δ upper Respectively represent the preset low error threshold and high error threshold; represents the predicted hydrogen concentration at the i-th sample point.

[0031] Furthermore, δ lower The value range is 0.0001~0.001, δ upper The value range is 0.01~0.1.

[0032] Furthermore, the feature vector of the input layer includes m features; the feature vector of the convolution layer includes 100 to 130 features; the feature vector of the maximum pooling layer includes 1 to 2 features; the probability of random discarding neurons in the Dropout layer is 0.1 to 0.3; and the feature vector of the GRU layer includes 1 to 64 features.

[0033] The beneficial effects of the present invention are:

[0034] The present invention proposes a hydrogen rapid detection method based on 1DCNN and GRU, and constructs a hydrogen concentration prediction model by setting a GRU layer and a Dropout layer at a specific position of the 1DCNN structure; wherein the 1DCNN structure can be used to capture local features, such as the frequency mode in the sensor output curve, and is more efficient when processing resistance signal time series data, with fewer parameters and lower training costs; setting a GRU layer before the output layer can capture dynamic changes and long-term dependencies in the resistance signal time series data, and can make up for the limitations of one-dimensional time series signals and two-dimensional images, and enhance the robustness and generalization ability of the algorithm; and setting a Dropout layer before the GRU layer pays more attention to the regularization of input data, which helps to reduce the mutual dependence between input features, prevents the network from being overly dependent on certain specific features, forces the network to learn more robust feature representations, and improves the generalization ability of the model; and setting the Dropout layer after the convolution layer helps to reduce the overload of the GRU layer and reduce the complexity and computational burden of subsequent layers;

[0035] In addition, since the hydrogen sensor itself has tiny disturbances, resulting in test errors such as jump points in the original data, it is necessary to balance the sensitivity of the hydrogen concentration prediction model to the error within the error range between the actual hydrogen concentration of the sample point and the predicted hydrogen concentration. Specifically: when the error is too small or too large, more attention is paid to reducing the square of the error to avoid the tiny disturbance of the hydrogen sensor input causing drastic changes in the output and excessive influence of the extreme predicted value on the loss function; and when the error is within a reasonable range, it is hoped that the model will pay more attention to reducing the absolute value of the error; and then for the original data obtained by the hydrogen sensor, the present invention specifically designs the loss function of the hydrogen concentration prediction model to avoid the influence of the test error on feature extraction;

[0036] Furthermore, the hydrogen concentration prediction model proposed in the present invention has the characteristics of strong feature extraction capability, low structural complexity and high prediction accuracy, and can realize fast, stable and accurate hydrogen leak detection; in the hardware implementation of the algorithm, the computational complexity of the present invention is low, the parameters are relatively few, and it is suitable for implementation on real-time and cost-constrained hardware devices such as mobile devices and embedded systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 It is a schematic diagram of extracting the resistance signal within T time from the response starting point according to the response-recovery change curve in Example 1;

[0038] Figure 2 A schematic diagram of the structure of the hydrogen concentration prediction model constructed in Example 1;

[0039] Figure 3 is a curve showing the mean absolute error (MAE) of hydrogen concentration prediction in Example 1 as a function of training batches;

[0040] Figure 4 This is a distribution diagram of the relative error of the predicted hydrogen concentration after ten-fold cross validation in Example 1 as the training batch changes. DETAILED DESCRIPTION

[0041] In order to better understand the purpose and function of the present invention, the present invention is described in more detail below in conjunction with the accompanying drawings. In the following specific embodiments, many specific details are set forth to provide a thorough understanding of embodiments of the present invention. However, those skilled in the art will appreciate that embodiments of the present invention may be implemented without these specific details.

[0042] Example 1

[0043] This embodiment provides a method for rapid hydrogen detection based on 1DCNN and GRU, which specifically includes the following steps:

[0044] S1. Perform hydrogen concentration test by using hydrogen sensor. Alternately pass hydrogen with known concentration and air into hydrogen sensor to obtain a set of response-recovery curves of resistance. Pass hydrogen with different concentrations to obtain raw data consisting of different real hydrogen concentrations and corresponding response-recovery curves.

[0045] S2. For each response-recovery change curve in the original data, use Figure 1 The method shown in the figure obtains the response starting point and extracts the resistance signal within T time after the response starting point, and the number of resistance signals contained in T time is m; a real hydrogen concentration and the resistance signal within the corresponding T time form a sample point, and the resistance signal is normalized to the maximum and minimum, and the real hydrogen concentration is normalized to obtain a sample set S consisting of N sample points = {(R1, Y1), (R2, Y2), ..., (R N ,Y N )};

[0046] Among them, N = 300 is the total number of sample points; R i =(r i (1) ,r i (2) ,...,r i (m) ),i=1,2,...,N is the resistance signal of the i-th sample point, r i (j) ,j=1,2,...,m,i=1,2,...,N is the resistance value of the jth resistance signal in the i-th sample point; Y i ,i=1,2,...,N is the actual hydrogen concentration of the i-th sample point;

[0047] In this embodiment, T is 8 and m is 40;

[0048] S3, drift compensation is performed on each resistance signal in the sample set S to obtain a sample set S′. The specific process is as follows:

[0049] S31, obtaining the first resistance value r of each resistance signal in the sample set S i (1) , i=1,2,...,N, and calculate all the first resistance values ​​r i (1) ,i=1,2,...,the average value of N

[0050] S32, calculating the first resistance value r of the resistance signal of the i-th sample point i (1) ,i=1,2,...,N and the average value The difference Res i , i=1,2,...,N, then calculate the resistance signal R of the i-th sample point i =(r i (1) ,r i (2) ,...,r i (m) ),i=1,2,...,N and Res i ,i=1,2,...,N, as the resistance signal of the i-th sample point after drift compensation

[0051] S33, traverse all sample points in the sample set S, repeat the process of S32, complete the drift compensation of all resistance signals in the sample set S, and obtain the sample set S′;

[0052] S4. Construct a hydrogen concentration prediction model with the following structure: Figure 2 As shown, including in order:

[0053] 1 input layer, the number of neurons is 40;

[0054] 1 fully connected layer with 64 neurons;

[0055] Two sets of alternating 1 convolution layer and 1 max pooling layer; the first set has 112 convolution kernels, 1 kernel size, and 2 max pooling windows; the second set has 128 convolution kernels, 1 kernel size, and 2 max pooling windows;

[0056] 1 Dropout layer, with a random dropout probability of 0.2;

[0057] 1 GRU layer, the number of neurons is 48;

[0058] 1 output layer, the number of neurons is 1;

[0059] Among them, the activation function of the convolution layer is the ReLU function, and the convolution kernel size is 1;

[0060] The loss function of the hydrogen concentration prediction model is:

[0061]

[0062] In the formula, δ lower =0.005 and δ upper =0.05 represents the preset low error threshold and high error threshold respectively; represents the predicted hydrogen concentration of the i-th sample point;

[0063] Since the hydrogen sensor itself has tiny disturbances, the raw data has test errors such as jump points. It is necessary to balance the sensitivity of the hydrogen concentration prediction model to the error within the error range between the actual hydrogen concentration of the sample point and the predicted hydrogen concentration. Specifically: when the error is too small or too large, more attention is paid to reducing the square of the error to avoid the tiny disturbance of the hydrogen sensor input causing drastic changes in the output and excessive influence of the extreme predicted value on the loss function; when the error is within a reasonable range, it is hoped that the model will pay more attention to reducing the absolute value of the error; and then for the raw data obtained by the hydrogen sensor, this embodiment specifically designs the loss function of the above hydrogen concentration prediction model to avoid the influence of the test error on feature extraction;

[0064] S5, taking the resistance signal in the sample set S′ as input and the actual hydrogen concentration as output, training the hydrogen concentration prediction model to obtain a trained hydrogen concentration prediction model;

[0065] S6. Pass the hydrogen to be tested into the gas sensor, extract the resistance signal within T time from the response starting point in its response-recovery change curve, input it into the trained hydrogen concentration prediction model after normalization, and output the predicted concentration of the hydrogen to be tested.

[0066] In this embodiment, the Adam optimizer is used to optimize the back propagation of the hydrogen concentration prediction model. The optimal parameters for training the hydrogen concentration prediction model are shown in Table 1.

[0067] Table 1

[0068]

[0069] Figure 3The curve of the average absolute error of hydrogen concentration prediction changing with the training batches shows that after 250 batches of training, the hydrogen concentration prediction model training is completed; Figure 4 is the distribution diagram of the relative error of hydrogen concentration prediction after ten-fold cross validation as the training batch changes. Figure 4 It can be seen that the relative error value does not change much between different training batches, and the error values ​​of different batches are roughly consistent, indicating that the hydrogen rapid detection method based on 1DCNN and GRU provided in this embodiment has good stability and consistency, the error is concentrated within 1%, and the uncertainty of model prediction is small.

[0070] In practical applications, the hydrogen concentration in the environment can be predicted using the resistance signal of the hydrogen sensor within 8 seconds after the start of the response. In order to verify the advancedness of the hydrogen rapid detection method based on 1DCNN and GRU provided in this embodiment, the prediction effects of the hydrogen detection method using only the 1DCNN model, the 1DCNN+Dropout+GRU model, and the 1DCNN+Dropout+GRU+specific loss function model are compared. Specifically:

[0071] The hydrogen detection method using only the 1DCNN model, that is, adjusting the hydrogen concentration prediction model in this embodiment to the 1DCNN network, has an average relative error of 0.73%. Through error analysis, it can be seen that the 95% confidence interval of the relative error is [-0.70343, 0.30707];

[0072] The hydrogen detection method using the 1DCNN+Dropout+GRU model is obtained by adjusting the loss function of the hydrogen concentration prediction model in this embodiment to the mean square error (MSE). The average relative error during prediction is only 0.36%. Through error analysis, it can be seen that the 95% confidence interval of the relative error is [-0.03571, 0.22582];

[0073] The hydrogen detection method using the model of 1DCNN+Dropout+GRU+specific loss function, that is, the hydrogen rapid detection method based on 1DCNN and GRU proposed in this embodiment, further reduces the average relative error during prediction to 0.30%. Through error analysis, it can be seen that the 95% confidence interval of the relative error is [-0.00231, 7.09473E-4].

[0074] From the above analysis, it can be seen that the hydrogen concentration prediction model constructed by setting the GRU layer and the Dropout layer at specific positions of the 1DCNN structure can achieve faster, more stable and accurate hydrogen detection under the loss function specifically designed in this embodiment, and has low structural and computational complexity and relatively few parameters, which is suitable for implementation on real-time and cost-constrained hardware devices such as mobile devices and embedded systems.

[0075] The above embodiments are only used to illustrate the technical method of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical method of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical method of the present invention.

Claims

1. A fast hydrogen detection method based on 1DCNN and GRU, It is characterized in that The following steps are involved: S1. Perform hydrogen concentration test through hydrogen sensor, alternately pass hydrogen with known concentration and air into hydrogen sensor, and obtain a set of response-recovery change curves of resistance; Different concentrations of hydrogen are introduced to obtain raw data consisting of different real hydrogen concentrations and corresponding response-recovery change curves; S2. For each response-recovery change curve in the original data, the response starting point is obtained, and the resistance signal within T time after the response starting point is extracted; a real hydrogen concentration and the resistance signal within the corresponding T time form a sample point, and the sample set S is obtained by performing maximum and minimum normalization on the resistance signal and normalizing the real hydrogen concentration; S3, performing drift compensation on each resistance signal in the sample set S to obtain a sample set S′; S4, constructing a hydrogen concentration prediction model, taking the resistance signal in the sample set S′ as input and the actual hydrogen concentration as output, training the hydrogen concentration prediction model to obtain a trained hydrogen concentration prediction model; The hydrogen concentration prediction model is obtained by setting a Dropout layer and a GRU layer before the output layer of the 1DCNN neural network model; S5. Pass the hydrogen to be tested into the gas sensor, extract the resistance signal within T time from the response starting point in its response-recovery change curve, input it into the trained hydrogen concentration prediction model after normalization, and output the predicted concentration of the hydrogen to be tested.

2. According to the hydrogen rapid detection method based on 1DCNN and GRU according to claim 1, It is characterized in that The structure of the hydrogen concentration prediction model includes the following steps in order: 1 input layer; 1 fully connected layer; At least one set of alternating 1 convolutional layer and 1 max pooling layer; 1 Dropout layer; 1 GRU layer; 1 output layer.

3. According to the hydrogen rapid detection method based on 1DCNN and GRU according to claim 2, It is characterized in that The value of T in S2 is 6 to 10. According to the adopted sampling frequency, the value of T determines the corresponding number m of resistance signals.

4. According to the hydrogen rapid detection method based on 1DCNN and GRU according to claim 3, It is characterized in that The sample set S in S2 is 1 ,Y 1 ),(R 2 ,Y 2 ),...,(R N ,Y N )}; where N is the total number of sample points, which is determined according to the concentration range of hydrogen to be tested; is the resistance signal of the i-th sample point, is the resistance value of the jth resistance signal in the i-th sample point; Y i ,i=1,2,...,N is the actual hydrogen concentration of the i-th sample point.

5. According to the hydrogen rapid detection method based on 1DCNN and GRU according to claim 4, It is characterized in that The specific process of drift compensation for each resistance signal in the sample set S in S3 is: S31, obtaining the first resistance value of each resistance signal in the sample set S And calculate all the first resistor values The average S32, calculating the first resistance value of the resistance signal of the i-th sample point With the average The difference Res i ,i=1,2,...,N, then calculate the resistance signal of the i-th sample point With Res i ,i=1,2,...,N, as the resistance signal of the i-th sample point after drift compensation S33, traverse all sample points in the sample set S, repeat the process of S32, complete the drift compensation of all resistance signals in the sample set S, and obtain the sample set S′.

6. According to the hydrogen rapid detection method based on 1DCNN and GRU according to claim 5, It is characterized in that The loss function of the hydrogen concentration prediction model is: In the formula, δ lower and δ upper Respectively represent the preset low error threshold and high error threshold; represents the predicted hydrogen concentration at the i-th sample point.

7. According to the hydrogen rapid detection method based on 1DCNN and GRU according to claim 6, It is characterized in that δ lower The value range is 0.0001~0.001, δ upper The value range is 0.01~0.

1.

8. According to the hydrogen rapid detection method based on 1DCNN and GRU according to claim 3, It is characterized in that The number of features included in the feature vector of the input layer is m; the number of features included in the feature vector of the convolution layer is 100-130; the number of features included in the feature vector of the maximum pooling layer is 1-2; the probability of random discarding neurons in the Dropout layer is 0.1-0.3; the number of features included in the feature vector of the GRU layer is 1-64.

Citation Information

Patent Citations

  • Cutting tool wear monitoring method based on multiscale deep convolutional recurrent neural network

    CN110509109A

  • Underwater target recognition method based on GRU and one-dimensional CNN neural network fusion

    CN110807365A

  • Sensor array neural network method for predicting concentration of mixed gas

    CN115860056A

  • Gas concentration drift compensation method based on neural network

    CN117763283A

  • Automobile tail gas concentration testing system based on neural network

    WO2023221228A1

Cited By

  • Method for rapidly detecting concentration of mixed gas based on Mamba

    CN120685851A

  • Hydrogen detection method, device, equipment and medium

    CN122487455A