Methane concentration monitoring method based on deep learning

By constructing a deep residual network model using deep learning, the problem of insufficient detection accuracy of low-cost methane sensors is solved, enabling rapid and accurate methane concentration monitoring.

CN121211085BActive Publication Date: 2026-07-21HUNAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUNAN UNIV
Filing Date
2025-07-30
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing low-cost methane sensors struggle to effectively eliminate the nonlinear effects of multiple factors such as cross-gas, temperature, and humidity, resulting in insufficient detection accuracy.

Method used

A deep residual network model is constructed using deep learning methods. By collecting methane concentration and independent variable data across the entire temperature and humidity ranges, cross-features and nonlinear features are created. The model is then trained using training and testing sets to eliminate the influence of nonlinearity and improve detection accuracy.

Benefits of technology

This technology enables rapid and accurate detection of methane using a low-cost methane sensor, eliminating the nonlinear effects of cross-gas, temperature, and humidity, and improving detection accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121211085B_ABST
    Figure CN121211085B_ABST
Patent Text Reader

Abstract

The application discloses a kind of methane concentration monitoring methods based on deep learning, comprising the following steps: the methane concentration and independent variable data of monitoring area are collected, including input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, pressure;According to the methane concentration and independent variable data obtained, the predicted methane concentration of monitoring area is output using the preset deep residual network model.The methane concentration monitoring method based on deep learning of the application takes input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity and pressure as evaluation indexes, which have the highest correlation with methane concentration, and can be obtained by low-cost sensor, so inputting these index data into the preset deep residual network model can predict the methane concentration of monitoring area, with advantages such as rapid and accurate, solving the problem of low detection accuracy of low-cost methane sensor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of methane monitoring technology and relates to a methane concentration monitoring method based on deep learning. Background Technology

[0002] Currently, commonly used methane detection technologies mainly include catalytic combustion, semiconductor, electrochemical, and non-dispersive infrared (NDIR) methods. These methods each have advantages in terms of accuracy, response speed, and application scenarios, but they also suffer from varying degrees of high cost, high power consumption, or poor anti-interference capabilities. While high-precision sensors based on laser spectroscopy can achieve relatively stable quantitative detection, they are expensive and bulky, making them difficult to deploy widely in large-scale, low-cost scenarios. Although NDIR sensors are inexpensive, they are susceptible to interference from temperature, humidity, and other gases, resulting in unstable output signals that fail to meet the requirements for accurate monitoring.

[0003] To address the aforementioned issues, existing researchers have proposed a detection system and environmental correction method for atmospheric methane concentration. This method employs multiple linear regression and stepwise regression, using temperature, humidity, and air pressure as regression coefficients, and adding a concentration correction coefficient for parameter fitting. However, because the multiple linear regression and stepwise regression methods rely on the linear or approximately linear relationship between the variables and the target, they struggle to eliminate the nonlinear effects of multiple factors such as cross-gases, temperature, and humidity, thus hindering further improvements in the detection accuracy of low-cost methane sensors. Therefore, how to further improve the detection accuracy of low-cost methane sensors is a pressing technical problem that needs to be solved at present. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to overcome the shortcomings of the prior art and provide a methane concentration monitoring method based on deep learning, which aims to improve the detection accuracy of low-cost methane sensors.

[0005] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:

[0006] A deep learning-based method for monitoring methane concentration includes the following steps:

[0007] (1) Collect methane concentration and independent variable data for the entire temperature range and the entire humidity range of the monitoring area. The methane concentration and independent variable data include input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, and pressure.

[0008] (2) Based on the methane concentration and independent variable data obtained in step (1), the predicted methane concentration of the monitoring area is output using the preset deep residual network model.

[0009] The above-mentioned deep learning-based methane concentration monitoring method is further improved in step (2), where the method for constructing the preset deep residual network model includes the following steps:

[0010] S1. Collect methane concentration and independent variable data for all temperature and humidity ranges in different monitoring areas. The methane concentration and independent variable data include input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, pressure, and actual methane concentration.

[0011] S2. Check the dataset obtained in step S1 and fill in the missing values;

[0012] S3. Perform feature engineering on the dataset obtained in step S2, including creating cross features and non-linear features;

[0013] S4. Divide the dataset obtained in step S3 to obtain the training set and the test set;

[0014] S5. Train the deep residual network model using the training set from step S4.

[0015] S6. Evaluate the deep residual network model trained in step S5 using the training set and test set from step S4. If the evaluation is satisfactory, the preset deep residual network model is obtained.

[0016] The aforementioned deep learning-based methane concentration monitoring method is further improved by creating cross features in step S3 using df_features. These cross features include: cross features derived from the product of input carbon dioxide concentration and gas temperature, gas humidity, and pressure, denoted as follows: , , Based on the cross-relationship between the input methane concentration and the product of gas temperature, gas humidity, and pressure, these are sequentially denoted as... , , ;

[0017] The The mathematical expression for the calculation is as follows:

[0018] ,

[0019] in, This represents the cross-feature of the input carbon dioxide concentration and gas temperature multiplied together. This represents the input carbon dioxide concentration. Represents gas temperature;

[0020] The The mathematical expression for the calculation is as follows:

[0021] ,

[0022] in, This represents the cross-feature of the input carbon dioxide concentration and gas humidity multiplied together. This represents the input carbon dioxide concentration. Represents gas humidity;

[0023] The The mathematical expression for the calculation is as follows:

[0024] ,

[0025] in, This represents the cross-feature of the input carbon dioxide concentration multiplied by the pressure. This represents the input carbon dioxide concentration. Represents pressure;

[0026] The The mathematical expression for the calculation is as follows:

[0027] ,

[0028] in, The cross-feature represents the product of the input methane concentration and the gas temperature. This represents the input methane carbon concentration. Represents gas temperature;

[0029] The The mathematical expression for the calculation is as follows:

[0030] ,

[0031] in, The cross-feature represents the product of the input methane carbon concentration and gas humidity. This represents the input methane concentration. Represents gas temperature;

[0032] The The mathematical expression for the calculation is as follows:

[0033] ,

[0034] in, The cross-feature representing the product of input methane concentration and pressure. This represents the input methane concentration. It represents pressure.

[0035] In a further improvement to the aforementioned deep learning-based methane concentration monitoring method, step S3 includes the following nonlinear features: nonlinear features created from the input carbon dioxide and input methane, denoted as follows: and ;

[0036] The and The mathematical expression for the calculation is as follows:

[0037] ,

[0038] ,

[0039] in, and These represent the nonlinear features created by inputting carbon dioxide and inputting methane, respectively. and These represent the input carbon dioxide and input methane concentrations, respectively.

[0040] In a further improvement to the aforementioned deep learning-based methane concentration monitoring method, in step S1, the temperature of the entire temperature range is 0–100°C, and the humidity of the entire humidity range is 0–100 RH; the input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, pressure, and actual methane concentration are obtained by sensors.

[0041] The above-mentioned deep learning-based methane concentration monitoring method is further improved by using the SimpleImputer tool in step S2 to process missing values ​​with a strategy defined as 'median', and then returning the processed dataset.

[0042] In a further improvement to the deep learning-based methane concentration monitoring method described above, the ratio of the training set to the test set in step S4 is 4:1.

[0043] The above-mentioned deep learning-based methane concentration monitoring method is further improved in step S5, which includes the following steps:

[0044] S5.1. Create advanced feature engineering for deep residual networks, including creating polynomial features, trigonometric function transformations, and cross ratio feature transformations for the input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, and pressure.

[0045] S5.2 Define the residual blocks and the main network structure;

[0046] S5.3 Use a random search method to find the optimal combination of hyperparameters;

[0047] S5.4. Train a deep residual network model using the optimal combination of hyperparameters.

[0048] The above-mentioned deep learning-based methane concentration monitoring method is further improved by using PolynomialFeatures in step S5.1 to create cubic polynomial features for the input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, and pressure.

[0049] The algorithm for the polynomial feature is as follows:

[0050] ,

[0051] in It is the original feature vector, containing One characteristic, , , These are elements in the feature vector, representing different input features. , , It is a power exponent, representing the power of each feature. It is the generated polynomial feature set;

[0052] The input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, and pressure are transformed using sine and cosine functions to obtain trigonometric function transformations; the algorithm for the trigonometric function transformations is as follows:

[0053]

[0054]

[0055] in, These are the original eigenvalues. It is a feature The mean, It is a feature standard deviation and These are new features resulting from the application of trigonometric function transformations;

[0056] A cross-ratio feature transformation is established for gas temperature and gas humidity, as well as for pressure and gas temperature, to capture the cross-composite effect; the algorithm for the cross-ratio feature transformation is as follows:

[0057] ,

[0058] ,

[0059] in, and These are two different original feature values. It is a small constant to prevent division by zero errors. and These are features Divide by features ratios and characteristics In the characteristics The ratio.

[0060] The above-mentioned deep learning-based methane concentration monitoring method is further improved in step S5.2, which defines the residual blocks and the main network structure as follows: defining the ResidualBlock class, constructing two linear layers, batch normalization and activation functions, and adding "skip connections" to directly add the input to the output; the main network AdvancedGasNetRegressor integrates multiple residual blocks with the standard layer, starting from the high-dimensional input layer, gradually reducing the dimensionality through multiple hidden layers, and selectively connecting residual blocks after each hidden layer, predicting the output through a single-node output layer.

[0061] The above-mentioned deep learning-based methane concentration monitoring method is further improved in step S5.3 by using a random search method to find the optimal hyperparameter combination, including: defining a search space containing network structure, activation function, regularization strength, residual connection settings and learning parameters, randomly sampling 10 configuration combinations; performing fast training and evaluation on each configuration, recording the validation loss, and selecting the hyperparameter combination with the best validation performance.

[0062] The above-mentioned deep learning-based methane concentration monitoring method is further improved in step S5.4, which involves training a deep residual network model using the optimal hyperparameter combination, including the following steps:

[0063] Step 5.4.1: Input the training data into the model in batches, and iterate through the entire training set in each batch;

[0064] Step 5.4.2: Perform forward propagation to calculate the predicted value for each batch, calculate the MSE loss, and perform backpropagation to calculate the gradient;

[0065] Step 5.4.3: Apply gradient clipping to prevent gradient explosion, and use the AdamW optimizer to update model parameters;

[0066] Step 5.4.4: After each training cycle, evaluate the model performance on the test set and generate a deep residual network after completing the predetermined early stopping plan;

[0067] The training loop algorithm for the deep residual network model is as follows:

[0068]

[0069]

[0070]

[0071]

[0072] in, It is the training dataset. These are the initial parameters. It is the set of parameters of the model at the t-th iteration. It is the maximum number of training cycles. It refers to the batch size. It's the learning rate. It is the weight decay coefficient. It is the gradient clipping threshold. Represents the residual network model. and These represent batch loss and validation set loss, respectively. and represent the input and true label of the i-th sample, respectively.

[0073] The above-mentioned deep learning-based methane concentration monitoring method is further improved in step S6 by using the training set and test set from step S4 to evaluate the deep residual network model trained in step S5, and using the coefficient of determination, root mean square error, and mean absolute error to assess the performance of the deep residual network model trained in step S5.

[0074] The above-mentioned deep learning-based methane concentration monitoring method is further improved, and the expression for the coefficient of determination is as follows:

[0075]

[0076] in, As the coefficient of determination, This represents the actual methane concentration value of the i-th sample in the training or test set. This represents the deep residual network prediction value for the i-th sample. This represents the average value of the samples in the training or test set.

[0077] The expression for the root mean square error is as follows:

[0078]

[0079] in, The root mean square error is N, where N represents the number of samples in the training or test set. This represents the actual methane concentration value of the i-th sample in the training or test set. The deep residual network prediction value represents the i-th sample;

[0080] The expression for the mean absolute error is as follows:

[0081]

[0082] in, The mean absolute error is N, where N represents the number of samples in the training or test set. This represents the actual methane concentration value of the i-th sample in the training or test set. This represents the deep residual network prediction value for the i-th sample.

[0083] The aforementioned deep learning-based methane concentration monitoring method can be further improved by adjusting the R-values ​​of the training and test sets. 2 Greater than 0.85, RMSE less than 1, and If the value is less than 0.75, the evaluation is considered satisfactory.

[0084] Compared with the prior art, the advantages of the present invention are as follows:

[0085] (1) This invention discloses a methane concentration monitoring method based on deep learning. The method includes the following steps: First, collect methane concentration and independent variable data for the entire temperature range and humidity range of the monitoring area, including input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, and pressure. These have the highest correlation with methane concentration and can be obtained by low-cost sensors. Therefore, these index data are used as evaluation indicators and input into a preset deep residual network model to predict the methane concentration in the monitoring area. This method has the advantages of being fast and accurate, and solves the problem of low detection accuracy of low-cost methane sensors.

[0086] (2) The method for constructing the deep residual network model pre-defined in this invention uses input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, and pressure as input features, and the actual methane concentration as the real label to ensure significant differences in feature scales and optimize data reliability. More importantly, after checking and filling missing values, feature engineering is performed on the dataset, including creating cross features between input carbon dioxide concentration and input methane concentration and gas temperature, gas humidity, and pressure, respectively, and creating nonlinear features between input carbon dioxide concentration and input methane concentration. This can eliminate the nonlinear effects of multiple factors such as cross gas, temperature, and humidity. Then, the feature-engineered data is divided into training set and test set, and the deep residual network model is trained using the training set. The model is then evaluated using the test set and training set. Once the evaluation is qualified, a deep residual network model suitable for predicting methane concentration is obtained. Finally, the qualified deep residual network model can be used to quickly and accurately predict the methane concentration in the monitoring area. Attached Figure Description

[0087] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings.

[0088] Figure 1 This is a process flow diagram of methane concentration monitoring based on deep learning in Embodiment 1 of the present invention.

[0089] Figure 2 This is a learning rate curve of the deep residual network model in Embodiment 1 of the present invention.

[0090] Figure 3 This is a representation of the deep residual network model in Embodiment 1 of the present invention.

[0091] Figure 4 This is a verification diagram of the deep residual network model in Embodiment 1 of the present invention. Detailed Implementation

[0092] The present invention will be further described below with reference to the accompanying drawings and specific preferred embodiments, but this does not limit the scope of protection of the present invention.

[0093] Example 1

[0094] A deep learning-based method for monitoring methane concentration, such as Figure 1 As shown, it includes the following steps:

[0095] (1) Collect methane concentration and independent variable data for the entire temperature range and the entire humidity range of the monitoring area (in this embodiment, the monitoring area is the high temperature composting area). The methane concentration and independent variable data include input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, and pressure.

[0096] In step (1), the temperature range is 0 to 100°C and the humidity range is 0 to 100 RH%. The input values ​​of carbon dioxide concentration (low-cost carbon dioxide sensor), methane concentration (low-cost methane sensor), gas temperature, gas humidity, and pressure are obtained by commercially available low-cost sensors and transmitted via RS485. The system is set to return a signal every 5 seconds.

[0097] (2) Based on the methane concentration and independent variable data obtained in step (1), the predicted methane concentration of the monitoring area is output using the preset deep residual network model.

[0098] Tests showed that the predicted methane concentration in the monitored area, as output by the deep residual network model, was 10 ppm.

[0099] In addition, under set conditions with an accuracy of <1.5%FS, the actual methane concentration data of the monitoring area was collected using a greenhouse gas monitoring station calibrated by gas chromatography and containing a high-efficiency pretreatment unit, in which the collected methane concentration was 9 ppm.

[0100] Therefore, the method of the present invention can accurately predict the actual methane concentration in the monitoring area.

[0101] In this embodiment, step (2) involves the following steps in constructing the preset deep residual network model:

[0102] Step 1: Collect methane concentration and independent variable data for all temperature and humidity ranges in different monitoring areas. The methane concentration and independent variable data include input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, pressure, and actual methane concentration.

[0103] Step 1-1: Set up high-temperature composting equipment and collect data from the composting area (monitoring data). Specifically, use commercially available low-cost sensors to collect data such as input carbon dioxide concentration (low-cost carbon dioxide sensor), input methane concentration (low-cost methane sensor), gas temperature, gas humidity, and pressure. All data are transmitted via RS485 during the collection process, and the system is set to return a signal every 5 seconds.

[0104] Steps 1-2: Under set conditions with an accuracy of <1.5%FS, collect actual methane concentration data of the composting area using a greenhouse gas monitoring station calibrated by gas chromatography and containing a high-efficiency pretreatment unit.

[0105] In this invention, methane concentration and independent variable data for the entire temperature and humidity ranges of different monitoring areas can also be obtained from existing literature and databases.

[0106] Step 2: Check and fill in missing values ​​in the dataset obtained in Step 1, as follows:

[0107] Step 2-1: Use df.isnull().sum() to count the number of missing values ​​in each feature column to confirm the data quality.

[0108] Step 2-2: Instantiate a SimpleImputer object and specify strategy='median'. Choosing median padding can reduce the impact of outliers while maintaining the data distribution characteristics.

[0109] Steps 2-3: Confirm that all NaN values ​​have been successfully replaced by checking again, and the data cleaning process is complete.

[0110] Step 3: Perform feature engineering on the dataset obtained in Step 2, including creating cross features and non-linear features. The feature engineering creation process is as follows:

[0111] Step 3-1: Create a total of 6 cross features: 'input_CO2_temp', 'input_CO2_moisture', 'input_CO2_pressure', 'input_CH4_temp', 'input_CH4_moisture', and 'input_CH4_pressure'. Specifically:

[0112] We use `df_features` to create cross-features that multiply the input carbon dioxide concentration by the gas temperature, gas humidity, and pressure, respectively, and denot them as follows: , , Similarly, using `df_features`, we create cross-features that multiply the input methane concentration by the gas temperature, gas humidity, and pressure, denoted as follows: , , .

[0113] In this embodiment, The mathematical expression for the calculation is as follows:

[0114] ,

[0115] in, This represents the cross-feature of the input carbon dioxide concentration and gas temperature multiplied together. This represents the input carbon dioxide concentration. Represents gas temperature;

[0116] In this embodiment, The mathematical expression for the calculation is as follows:

[0117] ,

[0118] in, This represents the cross-feature of the input carbon dioxide concentration and gas humidity multiplied together. This represents the input carbon dioxide concentration. Represents gas humidity;

[0119] In this embodiment, The mathematical expression for the calculation is as follows:

[0120] ,

[0121] in, This represents the cross-feature of the input carbon dioxide concentration multiplied by the pressure. This represents the input carbon dioxide concentration. Represents pressure;

[0122] In this embodiment, The mathematical expression for the calculation is as follows:

[0123] ,

[0124] in, The cross-feature represents the product of the input methane concentration and the gas temperature. This represents the input methane carbon concentration. Represents gas temperature;

[0125] In this embodiment, The mathematical expression for the calculation is as follows:

[0126] ,

[0127] in, The cross-feature represents the product of the input methane carbon concentration and gas humidity. This represents the input methane concentration. Represents gas temperature;

[0128] In this embodiment, The mathematical expression for the calculation is as follows:

[0129] ,

[0130] in, The cross-feature representing the product of input methane concentration and pressure. This represents the input methane concentration. It represents pressure.

[0131] Step 3-2: Create two non-linear features, 'input_CO2_squared' and 'input_CH4_squared', specifically as follows:

[0132] The nonlinear features created by quadratically calculating the input carbon dioxide and methane concentrations are denoted as follows: and ;

[0133] In this embodiment, and The mathematical expression for the calculation is as follows:

[0134] ,

[0135] ,

[0136] in, and These represent the nonlinear features created by inputting carbon dioxide and inputting methane, respectively. and These represent the input carbon dioxide and input methane concentrations, respectively.

[0137] Step 4: Split the dataset from Step 3 to obtain the training set and the test set, specifically:

[0138] All data obtained from step 3 is divided into training and test sets in an 8:2 ratio. The training set is used to train the initial deep residual network model, while the test set is used to test the deep residual network model and will also be used to evaluate the deep residual network model after multiple iterations.

[0139] The training set is used to estimate the model's parameters so that the model can best fit the training data, guide feature importance calculation, fit the model, and adjust hyperparameters; the test set is used to evaluate the model's generalization ability and determine the degree of overfitting.

[0140] Step 5: Train the deep residual network model using the training set from Step 4. Specifically:

[0141] Step 5-1: Create advanced feature engineering for deep residual networks, including multinomial features, trigonometric function transformations, and cross-ratio feature transformations, specifically including:

[0142] Step 5-1-1: Use PolynomialFeatures to create cubic polynomial features for the input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, and pressure. The polynomial feature algorithm used is as follows:

[0143] ,

[0144] in It is the original feature vector, containing One characteristic, , , These are elements in the feature vector, representing different input features. , , It is a power exponent, representing the power of each feature. It is the generated polynomial feature set.

[0145] Step 5-1-2: Perform sine and cosine function transformations on the input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, and pressure. The algorithm used for the trigonometric function transformation is as follows:

[0146]

[0147]

[0148] in, These are the original eigenvalues. It is a feature The mean, It is a feature standard deviation and It is a new feature after applying trigonometric function transformation.

[0149] Step 5-1-3: Establish cross-ratio feature transformations for gas temperature and gas humidity, and pressure and gas temperature, to capture cross-composite effects. The algorithm used for the cross-ratio feature transformation is as follows:

[0150] ,

[0151] ,

[0152] in, and These are two different original feature values. It is a small constant to prevent division by zero errors. and These are features Divide by features ratios and characteristics In the characteristics The ratio.

[0153] Step 5-2: Define the residual blocks and the main network structure, specifically as follows:

[0154] Define the ResidualBlock class, construct two linear layers, batch normalization, and activation functions, and add "skip connections" to directly add the input to the output; the main network AdvancedGasNetRegressor integrates multiple residual blocks with the standard layer, starting from the high-dimensional input layer, gradually reducing the dimensionality through multiple hidden layers, and selectively connecting residual blocks after each hidden layer, finally predicting the output through a single-node output layer.

[0155] Step 5-3: Use a random search method to find the optimal combination of hyperparameters.

[0156] Hyperparameter optimization employs a random search strategy. A search space is defined, comprising network structure (hidden layer configuration), activation functions (ReLU / LeakyReLU / SELU), regularization strength (dropout rate 0.2-0.4), residual connection settings, and learning parameters. Ten configuration combinations are randomly sampled. Each configuration undergoes rapid training and evaluation (20 epochs), and the validation loss is recorded. Finally, the hyperparameter combination with the best validation performance is selected for training the full model.

[0157] Step 5-4: Train the deep residual network model using the optimal hyperparameter combination, specifically:

[0158] Step 5-4-1: Input the training data into the model in batches, and iterate through the entire training set in batches.

[0159] Step 5-4-2: Perform forward propagation to calculate the predicted value for each batch, calculate the MSE loss, and perform backpropagation to calculate the gradient.

[0160] Step 5-4-3: Apply gradient clipping to prevent gradient explosion, and use the AdamW optimizer to update model parameters.

[0161] Step 5-4-4: After each training cycle, evaluate the model performance on the test set and generate a deep residual network after completing the predetermined early stopping plan.

[0162] In step 5-4, the deep residual network training loop algorithm used is as follows:

[0163]

[0164]

[0165]

[0166]

[0167] in, It is the training dataset. These are the initial parameters. It is the set of parameters of the model at the t-th iteration. It is the maximum number of training cycles. It refers to the batch size. It's the learning rate. It is the weight decay coefficient. It is the gradient clipping threshold. Represents the residual network model. and These represent batch loss and validation set loss, respectively. and represent the input and true label of the i-th sample, respectively.

[0168] Step 6: Evaluate the deep residual network model trained in Step S5 using the training and test sets from Step S4. The performance of the deep residual network model trained in Step S5 is assessed using the coefficient of determination, root mean square error, and mean absolute error. Specifically:

[0169] Step 6-1: Use the coefficient of determination Evaluate the performance of the deep residual network model constructed in step 5. The coefficient of determination (COP) represents the proportion of predicted methane concentration that can be explained by the actual methane concentration. The expression for ) is as follows:

[0170]

[0171] in, As the coefficient of determination, This represents the actual methane concentration value of the i-th sample in the training or test set. This represents the deep residual network prediction value for the i-th sample. This represents the average value of the samples in the training or test set. The value ranges from 0 to 1. The closer it is to 1, the more variation the model explains, meaning the better the fit.

[0172] Step 6-2: Evaluate the performance of the deep residual network model constructed in Step 5 using the root mean square error (RMSE). RMSE evaluates the model by comparing the deviation between the predicted methane concentration of the sample and the actual methane concentration of the sample. The expression for the root mean square error (RMSE) is as follows:

[0173]

[0174] in, The root mean square error is N, where N represents the number of samples in the training or test set. This represents the actual methane concentration value of the i-th sample in the training or test set. This represents the deep residual network prediction value for the i-th sample.

[0175] Step 6-3: Evaluate the performance of the deep residual network model constructed in Step 5 using the Mean Absolute Error (MAE). MAE evaluates the model by comparing the mean absolute error between the predicted methane concentration of the sample and the actual methane concentration of the sample. The expression for the Mean Absolute Error (MAE) is as follows:

[0176]

[0177] in, The mean absolute error is N, where N represents the number of samples in the training or test set. This represents the actual methane concentration value of the i-th sample in the training or test set. This represents the deep residual network prediction value for the i-th sample.

[0178] Step 7: When the R values ​​of the training set and the test set are... 2 Greater than 0.85, RMSE less than 1, and A value less than 0.75 is considered acceptable. After passing the evaluation, a deep residual network model is used for prediction.

[0179] Figure 2 This is a learning rate curve of the deep residual network model in Embodiment 1 of the present invention. Figure 2 As can be seen, both the training loss and the validation loss decreased rapidly and then stabilized, indicating that the model converged well and there was no obvious overfitting.

[0180] Figure 3 This is a representation of the deep residual network model in Embodiment 1 of the present invention. Figure 3 It can be seen that the predicted values ​​are generally close to the ideal fitting line, and R0 2 The value reached 0.8515, indicating that the model has a strong predictive ability for methane concentration.

[0181] Figure 4 This is a verification diagram of the deep residual network model in Embodiment 1 of the present invention. Figure 4 It can be seen that the predicted values ​​are highly consistent with the measured values ​​on the validation set, and R0 2 The value of 0.87 indicates that the model has good robustness and generalization ability.

[0182] The results above show that in this invention, input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, and pressure are used as input features, and the actual methane concentration is used as the true label. This ensures significant differences in feature scales and optimizes data reliability. More importantly, after checking and filling missing values, feature engineering is performed on the dataset. This includes creating cross-features between input carbon dioxide concentration and input methane concentration and gas temperature, gas humidity, and pressure, respectively, as well as creating nonlinear features between input carbon dioxide concentration and input methane concentration. This eliminates the nonlinear effects of multiple factors such as cross-gas, temperature, and humidity. The feature-engineered data is then divided into training and testing sets. A deep residual network model is trained using the training set, and then evaluated using the testing and training sets. Once the evaluation is successful, a deep residual network model suitable for predicting methane concentration is obtained. Finally, by inputting the methane concentration and independent variable data of the monitoring area as evaluation indicators into the evaluated deep residual network model, the true methane concentration of the monitoring area can be predicted quickly and accurately, solving the problem of low detection accuracy of low-cost methane sensors.

[0183] The above embodiments are merely preferred embodiments of the present invention, and the scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.

Claims

1. A method for monitoring methane concentration based on deep learning, characterized in that, Includes the following steps: (1) Collect methane concentration and independent variable data for the entire temperature range and the entire humidity range of the monitoring area. The methane concentration and independent variable data include input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, and pressure. (2) Based on the methane concentration and independent variable data obtained in step (1), the predicted methane concentration of the monitoring area is output using a preset deep residual network model; the construction method of the preset deep residual network model includes the following steps: S1. Collect methane concentration and independent variable data for all temperature and humidity ranges in different monitoring areas. The methane concentration and independent variable data include input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, pressure, and actual methane concentration. S2. Check the dataset obtained in step S1 and fill in the missing values; S3. Perform feature engineering on the dataset obtained in step S2, including creating cross features and non-linear features; S4. Divide the dataset obtained in step S3 to obtain the training set and the test set; S5. Train the deep residual network model using the training set from step S4. S6. Use the training set and test set from step S4 to evaluate the deep residual network model trained in step S5. If the evaluation is qualified, the preset deep residual network model is obtained. In step S3, cross features are created using df_features; the cross features include: cross features obtained by multiplying the input carbon dioxide concentration with gas temperature, gas humidity, and pressure, denoted as follows: , , Based on the cross-relationship between the input methane concentration and the product of gas temperature, gas humidity, and pressure, these are sequentially denoted as... , , ; The The mathematical expression for the calculation is as follows: , in, This represents the cross-feature of the input carbon dioxide concentration and gas temperature multiplied together. This represents the input carbon dioxide concentration. Represents gas temperature; The The mathematical expression for the calculation is as follows: , in, This represents the cross-feature of the input carbon dioxide concentration and gas humidity multiplied together. This represents the input carbon dioxide concentration. Represents gas humidity; The The mathematical expression for the calculation is as follows: , in, This represents the cross-feature of the input carbon dioxide concentration multiplied by the pressure. This represents the input carbon dioxide concentration. Represents pressure; The The mathematical expression for the calculation is as follows: , in, The cross-feature represents the product of the input methane concentration and the gas temperature. This represents the input methane carbon concentration. Represents gas temperature; The The mathematical expression for the calculation is as follows: , in, The cross-feature represents the product of the input methane carbon concentration and gas humidity. This represents the input methane concentration. Represents gas temperature; The The mathematical expression for the calculation is as follows: , in, The cross-feature representing the product of input methane concentration and pressure. This represents the input methane concentration. Represents pressure; In step S3, the nonlinear feature includes: a nonlinear feature created by the input carbon dioxide and the input methane, denoted as follows: and ; The and The mathematical expression for the calculation is as follows: , , in, and These represent the nonlinear features created by inputting carbon dioxide and inputting methane, respectively. and These represent the input carbon dioxide and input methane concentrations, respectively.

2. The deep learning-based methane concentration monitoring method according to claim 1, characterized in that, In step S1, the temperature of the full temperature range is 0–100°C, and the humidity of the full humidity range is 0–100 RH%; the input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, pressure, and actual methane concentration are obtained by sensors. In step S2, the SimpleImputer tool is used to process missing values, with the strategy defined as 'median'. After completion, the processed dataset is returned. In step S4, the ratio of the training set to the test set is 4:

1.

3. The methane concentration monitoring method based on deep learning according to claim 2, characterized in that, Step S5 includes the following steps: S5.

1. Create advanced feature engineering for deep residual networks, including creating polynomial features, trigonometric function transformations, and cross ratio feature transformations for the input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, and pressure. S5.2 Define the residual blocks and the main network structure; S5.3 Use a random search method to find the optimal combination of hyperparameters; S5.

4. Train a deep residual network model using the optimal combination of hyperparameters.

4. The methane concentration monitoring method based on deep learning according to claim 3, characterized in that, In step S5.1, PolynomialFeatures are used to create cubic polynomial features for the input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, and pressure. The algorithm for the polynomial feature is as follows: , in It is the original feature vector, containing One characteristic, , , These are elements in the feature vector, representing different input features. , , It is the power exponent, representing the power of each feature. It is the generated polynomial feature set; The input carbon dioxide concentration, input methane concentration, gas temperature, gas humidity, and pressure are transformed using sine and cosine functions to obtain trigonometric function transformations; the algorithm for the trigonometric function transformations is as follows: , , in, These are the original eigenvalues. It is a feature The mean, It is a feature standard deviation and These are new features resulting from the application of trigonometric function transformations; A cross-ratio feature transformation is established for gas temperature and gas humidity, as well as for pressure and gas temperature, to capture the cross-composite effect; the algorithm for the cross-ratio feature transformation is as follows: , , in, and These are two different original feature values. It is a small constant to prevent division by zero errors. and These are features Divide by features ratios and characteristics In the characteristics The ratio; In step S5.2, defining the residual blocks and the main network structure includes: defining the ResidualBlock class, constructing two linear layers, batch normalization and activation functions, and adding "skip connections" to directly add the input to the output; the main network AdvancedGasNetRegressor integrates multiple residual blocks with standard layers, starting from the high-dimensional input layer, gradually reducing the dimensionality through multiple hidden layers, selectively connecting residual blocks after each hidden layer, and predicting the output through a single-node output layer; In step S5.3, a random search method is used to find the optimal combination of hyperparameters, including: defining a search space containing network structure, activation function, regularization strength, residual connection settings and learning parameters, randomly sampling 10 configuration combinations; performing fast training and evaluation on each configuration, recording the validation loss, and selecting the hyperparameter combination with the best validation performance. Step S5.4 involves training a deep residual network model using the optimal hyperparameter combination, including the following steps: Step 5.4.1: Input the training data into the model in batches, and iterate through the entire training set in each batch; Step 5.4.2: Perform forward propagation to calculate the predicted value for each batch, calculate the MSE loss, and perform backpropagation to calculate the gradient; Step 5.4.3: Apply gradient clipping to prevent gradient explosion, and use the AdamW optimizer to update model parameters; Step 5.4.4: After each training cycle, evaluate the model performance on the test set and generate a deep residual network after completing the predetermined early stopping plan; The training loop algorithm for the deep residual network model is as follows: , , , , in, It is the training dataset. These are the initial parameters. It is the set of parameters of the model at the t-th iteration. It is the maximum number of training cycles. It refers to the batch size. It's the learning rate. It is the weight decay coefficient. It is the gradient clipping threshold. Represents the residual network model. and These represent batch loss and validation set loss, respectively. and represent the input and true label of the i-th sample, respectively.

5. The methane concentration monitoring method based on deep learning according to claim 4, characterized in that, In step S6, the training set and test set from step S4 are used to evaluate the deep residual network model trained in step S5, and the performance of the deep residual network model trained in step S5 is evaluated by the coefficient of determination, root mean square error, and mean absolute error.

6. The methane concentration monitoring method based on deep learning according to claim 5, characterized in that, The expression for the coefficient of determination is as follows: , in, As the coefficient of determination, This represents the actual methane concentration value of the i-th sample in the training or test set. This represents the deep residual network prediction value for the i-th sample. It represents the average value of the samples in the training or test set; The expression for the root mean square error is as follows: , in, The root mean square error is N, where N represents the number of samples in the training or test set. This represents the actual methane concentration value of the i-th sample in the training or test set. The deep residual network prediction value represents the i-th sample; The expression for the mean absolute error is as follows: , in, The mean absolute error is N, where N represents the number of samples in the training or test set. This represents the actual methane concentration value of the i-th sample in the training or test set. This represents the deep residual network prediction value for the i-th sample.

7. The methane concentration monitoring method based on deep learning according to claim 6, characterized in that, When the training set and the test set R 2 Greater than 0.85, RMSE less than 1, and If the value is less than 0.75, the evaluation is considered satisfactory.