Lightweight mixed gas type and concentration detection method and system and storage medium
Through lightweight feature fusion network and gas dynamic entropy mask undersampling technology, the problems of large computational complexity and insufficient accuracy in portable exhaled breath detection equipment are solved, and efficient and accurate detection of mixed gas types and concentrations is achieved, which is suitable for equipment with limited resources.
Patent Information
- Application Number
- CN202510777771.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-11
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-06-11
AI Technical Summary
Existing technologies in portable exhaled breath detection equipment have problems such as large computational complexity, high number of parameters, and insufficient detection accuracy and robustness, making it difficult to achieve fast and accurate detection of mixed gas types and concentrations.
A lightweight feature fusion network is used, combined with the GRU network module, lightweight extraction module and attention fusion module. The sensor array data is processed by gas dynamic entropy mask undersampling to perform one-dimensional and two-dimensional feature extraction, and gas concentration regression and type classification are performed through the regression module and classification module.
It achieves high-precision and robust prediction of mixed gas type and concentration with low computational complexity and low parameter count, which is suitable for equipment with limited resources and promotes the popularization and application of portable exhaled gas detection equipment.
Smart Images

Figure CN120600286A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of gas detection technology, and in particular to a method, system and storage medium for detecting the type and concentration of lightweight mixed gases. Background Art
[0002] Exhaled breath contains a wealth of physiological information that can be used for disease diagnosis. Research has shown that human cells release volatile organic compound (VOC) molecules during biochemical reactions, and most VOCs are excreted through exhaled breath. When the human body is in a subhealthy state, cellular biochemical reactions are affected by disease, and the types and concentrations of released VOCs change accordingly. By detecting VOCs in exhaled breath, early diagnosis of respiratory diseases, digestive diseases, metabolic diseases, and even cancer can be achieved.
[0003] Electrochemical gas sensor technology is a mature and widely used technology in the field of exhaled breath detection. However, the concentration of VOC markers in human exhaled breath is low, and the composition of exhaled breath is complex. Traditional gas sensors suffer from poor selectivity and accuracy due to the potential cross-response of individual sensors in the array to multiple gases, limiting their effectiveness in practical applications.
[0004] With the increasing popularity of deep learning technology, deep learning algorithms such as Support Vector Machine (SVM), Convolutional Neural Network (CNN), Recurrent Neural Network (RNN), and Long Short-Term Memory (LSTM) have been widely used in the detection of complex gas mixtures. These technologies can effectively improve the shortcomings of traditional algorithms in terms of gas selectivity and detection accuracy, providing more accurate and reliable solutions for exhaled breath detection.
[0005] In the field of life and health testing, the widespread application and adoption of exhaled breath testing requires testing equipment that is portable, rapid, and adaptable to the home. For many patients with chronic diseases, the ability to monitor their health in real time is crucial. Portable exhaled breath testing devices allow patients to monitor their health at home in real time, providing timely updates on their health status. For healthy individuals, portable exhaled breath analysis devices also provide an effective tool for daily health management, providing rapid health feedback at home.
[0006] However, the portability and rapidity of detection equipment require intelligent detection methods that are not only highly accurate but also require minimal computational effort and parameters to enable real-time, rapid detection on devices with limited computing resources. This approach enables the efficient use of portable exhaled breath detection equipment without relying on cloud computing devices and servers.
[0007] Although detection methods based on machine learning algorithms such as support vector machines (SVMs) have low computational and parameter requirements, they exhibit poor detection effectiveness and robustness when dealing with complex gas mixtures. Detection methods based on time series algorithms such as recurrent neural networks (RNNs) and long-range time-lapsed memory (LSTMs) require data from longer time steps to achieve accurate predictions, resulting in high computational complexity, low efficiency, and neglect of the spatial characteristics of sensor array data. While CNN-based algorithms possess strong feature extraction capabilities, they require high accuracy in complex gas mixture detection and require the use of deep CNN models, which significantly increases the number of model parameters and computational complexity. Summary of the Invention
[0008] In view of the shortcomings of the prior art, the present invention aims to provide a method, system and storage medium for detecting the type and concentration of lightweight mixed gas.
[0009] In order to achieve the above object, the present invention provides the following technical solutions: A method for detecting the type and concentration of lightweight mixed gases, and obtaining sensor array data of mixed gases of different types and concentrations; The sensor array data is input into a prediction unit based on a lightweight feature fusion network. The GRU network module extracts one-dimensional features of the sensor array data of the mixed gas. The lightweight extraction module extracts two-dimensional features of the sensor array data of the mixed gas. The attention fusion module performs multi-dimensional feature fusion on the one-dimensional and two-dimensional features. The fused features are processed by the regression module and the classification module respectively to obtain gas concentration regression values and gas type classification data. The prediction unit is obtained by training data based on under-sampling of gas dynamic entropy mask.
[0010] In the present invention, preferably, the specific steps of the undersampling based on gas dynamic entropy mask are: A1. Assume that the gas sensor array data length is L and the number of sensors is S. First, initialize an undersampling mask matrix P as an L×S all-zero matrix: ; Where, is the matrix row vector index, is the matrix column vector index; A2. Set the expected number of undersampling points to N, obtain the gas sensor array data, and divide the array data length L into N intervals, each interval contains data points, for each interval k, calculate the entropy value of the corresponding data segment , as the adjusted standard deviation Basis:
[0011] in, is the probability density of the i-th data point in the k-th interval; A3. According to entropy Adaptive adjustment of standard deviation :
[0012] in, As the benchmark standard deviation, through dynamic adjustment, a smaller standard deviation can be used in intervals with a larger amount of information to ensure that the sampling points cover key features more concentratedly; while a larger standard deviation can be used in intervals with a smaller amount of information to increase the diversity of sampling points; A4. Calculate the mean of its central point : ; A5. Using the mean and standard deviation Generate a normal distribution and randomly sample an index from it As undersampled points: ; A6. Generate an undersampling index for each interval k , ensuring that the selected indexes are evenly distributed across the entire data range, while introducing randomness through the index Generate the undersampling mask matrix P:
[0013] This operation indicates that the selected location data is not masked, thereby retaining key feature information; A7. Repeat the above process X times, where X is the hyperparameter for gas sensor array data enhancement.
[0014] In the present invention, preferably, the sensor array data is undersampled based on the gas dynamic entropy mask, labels are set based on the type and concentration of the gas, and data cleaning and normalization are performed. The processed data is divided into a training set and a test set based on a five-fold cross validation. The training set is used for the preliminary training of the prediction unit, and the test set is used for the preliminary testing of the prediction unit.
[0015] In the present invention, preferably, the multi-dimensional feature fusion specifically includes the steps of: Match initial weights to input features; The features are fused using a weighted splicing method. During the fusion process, based on the gating mechanism, the weight value of each input feature is dynamically adjusted according to the different input features.
[0016] In the present invention, preferably, the joint self-weighted loss of the prediction unit is:
[0017] Where, are respectively the gas category predicted by the model and the real gas category, is the gas concentration value predicted by the model and the actual gas concentration value, and They are classification task loss and regression task loss, respectively, which are obtained by optimizing the loss weights of each task through training.
[0018] Lightweight mixed gas type and concentration detection system, including acquisition unit and prediction unit, The acquisition unit includes a number of sensors for acquiring initial data and generating sensor array data; The prediction unit includes: Lightweight extraction module, used to extract the two-dimensional features of the sensor array data of the mixed gas, GRU network module is used to extract the one-dimensional features of the sensor array data of the mixed gas. The attention fusion module is used to fuse the one-dimensional features and the two-dimensional features. Regression module, which performs gas concentration regression based on the fused features; The classification module classifies gas types based on the fused features.
[0019] In the present invention, preferably, the lightweight extraction module includes a 3×3 convolution layer, a regularization layer, a SiLU layer, and multiple lightweight convolution units in sequence, the 3×3 convolution layer is used to extract features, the regularization layer is used to normalize the data after feature extraction, the SiLU layer is used to adjust the overall activation state of the lightweight extraction module, and the lightweight convolution unit is used to extract two-dimensional features and frequency domain features.
[0020] In the present invention, preferably, the lightweight convolution unit includes a 1×1 point convolution layer, a 3×3 depth-separable convolution layer, a multispectral attention layer and a point convolution layer, and a residual link layer is further provided between the input and output of the lightweight convolution unit. The 1×1 point convolution layer is used to change the number of channels of the input data, the 3×3 depth-separable convolution layer is used to extract features, and the multispectral attention layer is used to give attention to the feature map channels.
[0021] In the present invention, preferably, the multispectral attention layer extracts the frequency domain features of the network based on discrete cosine transform and assigns attention weights to the gas feature map.
[0022] Compared with the prior art, the present invention has the following beneficial effects: The method of the present invention reduces the amount of input data by undersampling the collected sensor data, thereby reducing the overall data volume during model training and achieving high-precision and strong robustness prediction of mixed gas type and concentration; The system of the present invention uses a lightweight extraction module in conjunction with a GRU network module to perform multi-dimensional feature extraction, capturing features and associated information in the time and space dimensions, which helps to more comprehensively understand gas information. Through the attention fusion module, the network model can comprehensively utilize spatial and temporal features to improve the accuracy of mixed gas type and concentration detection; and the use of a lightweight extraction module reduces the amount of calculation and parameters of the overall model, thereby improving prediction efficiency; at the same time, the model parameters are reduced, the storage space occupied is smaller, and it is no longer limited to professional equipment, which is convenient for deployment on more popular and convenient mobile devices, providing strong technical support for public health.
[0023] The system of the present invention promotes the popularization and application of portable exhaled gas detection equipment, and can achieve accurate and rapid gas identification and concentration prediction on equipment with limited resources. It is of great significance for the daily monitoring of patients with chronic diseases and the daily health management of healthy people. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 This is a schematic diagram of the structure of the system for detecting the type and concentration of lightweight mixed gas according to the present invention.
[0025] Figure 2 This is a schematic diagram of the structure of the lightweight convolution unit described in the present invention.
[0026] Figure 3 Schematic diagram of the structure of the GRU network module described in the present invention.
[0027] Figure 4 Schematic diagram of the structure of the multi-spectral attention layer described in the present invention.
[0028] Figure 5 Schematic diagram of the proportional relationship between the response data of each gas sensor array and the response data set of all gases, and the proportional relationship between the gas concentration and the response data set of the corresponding gas in a specific embodiment of the present invention.
[0029] Figure 6 Schematic diagram of data undersampling according to the present invention. DETAILED DESCRIPTION
[0030] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0031] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one skilled in the art to which this invention pertains. The terms used in this specification of the present invention are for the purpose of describing specific embodiments only and are not intended to limit the present invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0032] Please also see Figures 1 to 4 A preferred embodiment of the present invention provides a method for detecting the type and concentration of a lightweight mixed gas, which can quickly detect and identify the gas type and concentration in the mixed gas with high precision while maintaining a low number of model parameters and a low amount of calculation. The specific steps include obtaining sensor array data of mixed gases of different types and concentrations; the sensor array data is input into a prediction unit based on a lightweight feature fusion network, and the one-dimensional features of the sensor array data of the mixed gas are extracted through a GRU network module. The lightweight extraction module extracts the two-dimensional features of the sensor array data of the mixed gas. The attention fusion module performs multi-dimensional feature fusion on the one-dimensional features and the two-dimensional features. The fused features are processed by a regression module and a classification module respectively to obtain gas concentration regression values and gas type classification data; wherein the prediction unit is obtained by training data based on undersampling of gas dynamic entropy masks.
[0033] Specifically, the prediction unit is trained through preliminary training. The training data is obtained by undersampling the sensor array data obtained by the gas sensor based on the gas dynamic entropy. The corresponding gas types and concentrations are recorded for each sensor array data. Each data point in the sensor array data is undersampled using several gas dynamic entropy masks.
[0034] Specific steps of undersampling based on gas dynamic entropy mask: A1. Assume that the gas sensor array data length is L and the number of sensors is S. First, initialize an undersampling mask matrix P as an L×S all-zero matrix: ; Where, is the matrix row vector index, is the matrix column vector index; A2. Set the expected number of undersampling points to N, obtain the gas sensor array data, and divide the array data length L into N intervals, each interval contains data points, for each interval k, calculate the entropy value of the corresponding data segment , as the adjusted standard deviation Basis:
[0035] in, is the probability density of the i-th data point in the k-th interval; A3. According to entropy Adaptive adjustment of standard deviation :
[0036] in, As the benchmark standard deviation, through dynamic adjustment, a smaller standard deviation can be used in intervals with a larger amount of information to ensure that the sampling points cover key features more concentratedly; while a larger standard deviation can be used in intervals with a smaller amount of information to increase the diversity of sampling points; A4. Calculate the mean of its central point : ; A5. Using the mean and standard deviation Generate a normal distribution and randomly sample an index from it As undersampled points: ; A6. Generate an undersampling index for each interval k , ensuring that the selected indexes are evenly distributed across the entire data range, while introducing randomness through the index Generate undersampling mask matrix :
[0037] The selected position data is not masked, thus retaining the key feature information; A7. Repeat the above process X times, where X is the hyperparameter for gas sensor array data enhancement.
[0038] After the sensor array data is undersampled based on the gas dynamic entropy mask, labels are set based on the gas type and concentration. The data is then cleaned and normalized to eliminate differences in feature dimensions. Specifically, the concentrations in the data and labels are normalized to the maximum and minimum values:
[0039] Where, is the raw sensor array response data, Indicates the maximum value of the response data. Indicates the minimum value of the response data, Represents the normalized response data.
[0040] The processed data is divided into a training set and a test set based on five-fold cross-validation. The training set is used for preliminary training of the prediction unit. The training set data is input into the prediction unit. By adjusting the relevant parameters of the prediction unit and constructing relevant quantitative indicators, the prediction model within the prediction unit is iteratively optimized to achieve full convergence. The unlabeled test set data is input into the trained prediction model to predict gas types and concentrations, and the prediction performance of the prediction model is evaluated using quantitative indicators.
[0041] A trained and tested prediction unit is used to predict the gas types and concentrations of multiple gases. The sensor array data collected by the sensor is input into the prediction unit and processed by the GRU network module and the lightweight extraction module in the prediction unit respectively. The GRU network module extracts the one-dimensional features of the sensor array data of the mixed gas, and the lightweight extraction module extracts the two-dimensional features of the sensor array data of the mixed gas. The attention fusion module then performs multi-dimensional feature fusion on the one-dimensional and two-dimensional features. The fused features are processed by the regression module and the classification module respectively to obtain the gas concentration regression value and the gas type classification data.
[0042] In this embodiment, multi-dimensional feature fusion specifically includes the following steps: Match the initial weights of the input features and introduce a gating mechanism to adaptively adjust the importance of each feature in the fusion process; The gating mechanism dynamically adjusts the weight of each feature during the fusion process to precisely control the degree of feature fusion, ensuring that the model focuses on the most discernible key features during feature fusion. The fusion process uses a weighted splicing method to ensure that the combined performance of each feature maximizes its importance in the model.
[0043] During the fusion process, based on the gating mechanism, the weight value of each input feature is dynamically adjusted according to the different input features, so that the model can flexibly respond to diverse data patterns. Through the gating mechanism, the prediction unit can autonomously learn and focus on the most informative and discriminative features, thereby improving the accuracy and robustness of the detection task, and improving the adaptability of the prediction network to different gas sensor array data and various mixed gas situations.
[0044] In this embodiment, the mean square error loss function is used as the loss function of the regression module to process the regression problem. , and the cross entropy loss function is used as the classification module to handle the loss of classification problems , The joint self-weighted loss that can optimize the loss weights of each task through training is used as the target optimization function: , the joint self-weighted loss is:
[0045] Where, are respectively the gas category predicted by the model and the real gas category, is the gas concentration value predicted by the model and the actual gas concentration value, and They are classification task loss and regression task loss, respectively, which are obtained by optimizing the loss weights of each task through training.
[0046] Another preferred embodiment of the present invention provides a system for detecting the type and concentration of a lightweight mixed gas, including a collection unit and a prediction unit. The acquisition unit includes a number of sensors for acquiring initial data and generating sensor array data; The prediction unit includes: Lightweight extraction module, used to extract the two-dimensional features of the sensor array data of the mixed gas, GRU network module is used to extract the one-dimensional features of the sensor array data of the mixed gas. The attention fusion module is used to fuse the one-dimensional features and the two-dimensional features. Regression module, which performs gas concentration regression based on the fused features; The classification module classifies gas types based on the fused features.
[0047] In this embodiment, a training dataset is first prepared to perform preliminary training on the prediction unit. In this example, the dataset used is the "Gas sensor array under dynamic gas mixtures" dataset, measured by Jordi Fonollosa et al. at the University of California, San Diego and published in the UCI database. This dataset includes 16 gas sensors of four types: TGS-2600, TGS-2602, TGS-2610, and TGS-2620. Each type includes four sensors, and the samples were continuously sampled for 12 hours at a sampling frequency of 100 Hz for methane concentrations ranging from 0 to 300 ppm (randomly varying) and ethylene concentrations ranging from 0 to 20 ppm (randomly varying).
[0048] The data set is cleaned, and some data with all gas concentrations of 0, as well as data with serious sensor drift or failure, are deleted. At the same time, in order to reduce data redundancy, only the sensor array response data of the recovery segment is used. Among them, the proportion of each gas data in the total data set is related to the concentration of each gas data, such as Figure 5 As shown in the figure, the concentration ratio of the mixed gas is in the format of methane gas concentration - ethylene gas concentration. In order to facilitate training, reduce the loss of computing resources and reduce the amount of data, the masked data is cleaned. Figure 6 As shown, the number of under-sampling points in this embodiment is 16. After under-sampling, the corresponding data of the original full-sampling sensor array with a length of (20000, 16) becomes (16, 16).
[0049] Several uniform masks can be randomly generated for each data. Each data undersampled by the gas dynamic entropy mask is a representation of the corresponding type and concentration of gas, which can be regarded as a data enhancement method. In this embodiment, the number of uniform random masks generated for a single data is 10,000.
[0050] Then, the gas sensor array data is undersampled based on the gas dynamic entropy mask. The specific steps are as follows: A1. Assume that the gas sensor array data length is L and the number of sensors is S. First, initialize an undersampling mask matrix P as an L×S all-zero matrix:
[0051] A2. Set the expected number of undersampling points to N. Divide the gas sensor array data length L into N intervals, each interval contains data points. For each interval k, calculate the entropy value of the corresponding data segment , as the adjusted standard deviation Basis:
[0052] in, is the probability density of the i-th data point in the k-th interval.
[0053] A3. According to entropy Adaptive adjustment of standard deviation :
[0054] in, This dynamic adjustment allows us to use a smaller standard deviation in intervals with more information, ensuring that the sampling points more closely cover key features; while using a larger standard deviation in intervals with less information to increase the diversity of the sampling points.
[0055] A4. Calculate the mean of its central point and dynamic standard deviation :
[0056] A5. Using the mean and standard deviation Generate a normal distribution and randomly sample an index from it As undersampled points:
[0057] A6. Generate an undersampling index for each interval k , ensuring that the selected indexes are evenly distributed across the entire data range while introducing randomness. Generate the undersampling mask matrix P:
[0058] This operation indicates that the selected location data is not masked, thereby retaining key feature information.
[0059] A7. Repeat the above process X times, where X is the hyperparameter for gas data enhancement.
[0060] After undersampling, each masked undersampling data is assigned a label based on its gas type and gas concentration. The label format used in this embodiment is shown in Table 1 below: Table 1.
[0061] Among them, the classification task corresponds to the prediction of gas type, and the regression task corresponds to the prediction of gas concentration.
[0062] To eliminate the differences in feature dimensions and improve the performance and robustness of the model, the data is normalized. This example uses maximum and minimum normalization, which scales the data to between 0 and 1 through linear transformation. The formula for maximum and minimum normalization is as follows:
[0063] in, is the raw sensor array response data, Indicates the maximum value of the response data. Indicates the minimum value of the response data, Represents the normalized response data.
[0064] In order to reduce the dependence on specific training sets and validation sets and improve the stability and reliability of model evaluation, a five-fold cross-validation method was used, and 10% of the data was reserved for testing. The proportions of methane gas, ethylene gas, and methane-ethylene mixed gas in the test set data were 10% and 10% respectively. , and the remaining data were subjected to five-fold cross validation. The specific steps are as follows: B1. Shuffle the original dataset to ensure sample randomness, and divide the dataset into five subsets of similar size, where each small subset is a fold.
[0065] B2. For each fold, use it as a validation set and the other four folds as training sets.
[0066] B3. For each fold, the specific steps for training and validation are as follows: B4. Use four folds of the training set to train the model.
[0067] B5. Use the trained model to make predictions on the validation set data.
[0068] B6. Calculate the performance indicators of the model on this fold based on the prediction results and the true labels of the validation set.
[0069] In this embodiment, after constructing the training set and the test set, a prediction network of the prediction unit is built. The prediction unit includes a GRU network module, a lightweight extraction module, an attention fusion module, a regression module and a classification module. The GRU network module and the lightweight extraction module respectively extract the one-dimensional features and two-dimensional features of the sensor array data. The attention fusion module splices the one-dimensional features and the two-dimensional features in the feature dimension, and performs feature interaction and information fusion through 1×1 convolution to complete feature fusion.
[0070] Since the gas type classification task and the gas concentration regression task are strongly correlated tasks, this embodiment adopts a hard sharing method. The fused features are input into the regression module and the classification module respectively as shared features. The regression module performs the regression task, and the classification module performs the classification task. The classification module and the regression module respectively use two fully connected layers for feature aggregation. Finally, the gas type classification result and the gas concentration regression result are obtained.
[0071] In this embodiment, the lightweight extraction module includes a 3×3 convolution layer, a regularization layer, a SiLU layer and multiple lightweight convolution units in sequence. The 3×3 convolution layer is used to extract features, the regularization layer is used to normalize the data after feature extraction, the SiLU layer is used to adjust the overall activation state of the lightweight extraction module, and the lightweight convolution unit is used to extract two-dimensional features and frequency domain features.
[0072] Specifically, the SiLU layer uses the SiLU activation function: ,
[0073] In this embodiment, the lightweight convolution unit includes a 1×1 point convolution layer, a 3×3 depth-separable convolution layer, a multispectral attention layer, a point convolution layer and a residual link. The 1×1 point convolution layer is used to change the number of channels of the input data, the 3×3 depth-separable convolution layer is used to extract features, the multispectral attention layer is used to give feature map channel attention, and the point convolution layer and the residual link are used to effectively alleviate the gradient vanishing problem, promote the flow of information and the effective transmission of features, thereby improving the training efficiency and performance of the model.
[0074] In this embodiment, the multispectral attention layer extracts the frequency domain features of the network based on discrete cosine transform and assigns attention weights to the gas feature map.
[0075] In this embodiment, after obtaining the classification results of gas types and the regression results of gas concentrations, the cross entropy loss function is used as the loss for the classification problem; and the mean square error loss function is used as the loss for the regression problem.
[0076] In the problem of loss weight distribution in multi-task learning, this embodiment sets the weight as a learnable parameter, transforming the traditional multi-task learning problem of manually adjusting the loss weight of each task into a multi-task learning problem with self-weighted loss of each task, where the classification task loss is , regression task loss , Multi-task joint self-weighted loss formula They are: = -
[0077] =
[0078] )]+[ + ) ] in, are respectively the gas category predicted by the model and the real gas category, is the gas concentration value predicted by the model and the actual gas concentration value, , are the learnable parameters for classification task loss and regression task loss, respectively.
[0079] After determining the prediction unit structure and loss function, we define the success rate (Accuracy) and mean absolute error (MAE) as performance evaluation indicators for classification and regression tasks. We use the number of parameters (Params) and floating point operations per second (FLOPS) as evaluation indicators for model scale and computing requirements. The specific formulas for Accuracy and MAE are as follows: Accuracy = number of correctly classified samples / total number of samples MAE =
[0080] in, is the actual concentration value on the label, is the concentration value predicted by the model.
[0081] In this embodiment, after the prediction model of the prediction unit is established, the preprocessed undersampled gas sensor array data and its corresponding gas type and concentration labels are input into the prediction network. In this example, the Adam optimizer is used, and the model learning rate is defined as 0.001. The learning rate of the learnable parameters in the self-weighted joint loss is also defined as 0.01.
[0082] After the prediction model has been trained iteratively, the loss gradually approaches convergence. The reserved test data set is then fed into the trained network model. The test data set is also undersampled to simulate the actual application scenario where predictions are made based on only a very small sample of sensor array response data. The data length is only 12.
[0083] The trained prediction model was compared with the existing CNN algorithm and Resnet18+CBAM algorithm. The training set data of the CNN algorithm and Resnet18+CBAM algorithm were not undersampled, and the average data dimension of the sensor array used was (15000, 16). The lightweight feature fusion network had a data dimension of (16, 16) because the training data was undersampled.
[0084] By inputting the same set of sensor array data into the prediction unit, CNN algorithm, and Resnet18+CBAM algorithm, the accuracy, MAE, parameters (Parameters, Params), and floating point operations per second (FLOPS) of the three models are compared, as shown in Table 2.
[0085] Table 2.
[0086] From the comparison of the evaluation indicators in Table 2, it can be seen that the lightweight feature fusion network prediction model adopted by the prediction unit of the present invention can obtain gas type identification and concentration prediction results that exceed other traditional models while the Params and FLOPS are much smaller than those of other traditional models.
[0087] In some other preferred embodiments of the present invention, a computer-readable storage medium is provided, storing a computer program. When the computer program is executed by a processor, the processor executes the steps of the method described in the above embodiment.
[0088] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0089] The above description is a detailed description of the preferred embodiments of the present invention, but the embodiments are not intended to limit the scope of the patent application of the present invention. Any equivalent changes or modifications completed under the technical spirit suggested by the present invention should fall within the patent scope covered by the present invention.
Claims
1. A method for detecting the type and concentration of a lightweight mixed gas, characterized in that: Including steps: The prediction unit is used to process the sensor array data of the mixed gas to obtain the gas concentration regression value and the classification data of the gas type; The prediction unit is obtained by training data based on under-sampling of gas dynamic entropy mask; The specific steps of the gas dynamic entropy mask undersampling are as follows: A1. Assume that the data length of the gas sensor array is L and the number of sensors is S. First, initialize an undersampling mask matrix P as an L×S all-zero matrix. ; Where, is the matrix row vector index, is the matrix column vector index; A2. Set the expected number of undersampling points to N, obtain the gas sensor array data, and divide the gas sensor array data length L into N intervals, each interval contains data points, for each interval k, calculate the entropy value of the corresponding data segment , as the adjusted standard deviation Basis: ; in, is the probability density of the i-th data point in the k-th interval, is the number of samples in each interval; A3. According to entropy Adaptive adjustment of standard deviation : ; in, is the benchmark standard deviation; A4. Calculate the mean of its center point : ; A5. Using the mean and standard deviation Generate a normal distribution and randomly sample an index from it As undersampled points: ; in, is the set of integers {..., -2, -1, 0, 1, 2, ...}; A6. Generate an undersampling index for each interval k , while introducing randomness, through the index Generate the undersampling mask matrix P: ; A7. Repeat the above A1-A6 process X times, where X is the hyperparameter for gas sensor array data enhancement.
2. The method for detecting the type and concentration of a lightweight mixed gas according to claim 1, characterized in that: The sensor array data is input into a prediction unit, and the prediction unit performs a prediction step including: The GRU network module extracts the one-dimensional features of the sensor array data of the mixed gas. The lightweight extraction module extracts the two-dimensional features of the sensor array data of the mixed gas. The attention fusion module performs multi-dimensional feature fusion on the one-dimensional features and the two-dimensional features. The fused features are processed by the regression module and the classification module respectively to obtain the gas concentration regression value and gas type classification data.
3. The method for detecting the type and concentration of a lightweight mixed gas according to claim 1, characterized in that: After under-sampling based on the gas dynamic entropy mask, the sensor array data is labeled based on the type and concentration of the gas, and data cleaning and normalization are performed. The processed data is divided into a training set and a test set based on five-fold cross-validation. The training set is used for the preliminary training of the prediction unit, and the test set is used for the preliminary testing of the prediction unit.
4. The method for detecting the type and concentration of a lightweight mixed gas according to claim 2, wherein: The multi-dimensional feature fusion specifically includes the following steps: Match initial weights to input features; The features are fused using a weighted splicing method. During the fusion process, based on the gating mechanism, the weight value of each input feature is dynamically adjusted according to the different input features.
5. The method for detecting the type and concentration of a lightweight mixed gas according to claim 1, wherein: The joint self-weighted loss of the prediction unit is: Where, are respectively the gas category predicted by the model and the real gas category, is the gas concentration value predicted by the model and the actual gas concentration value, and They are classification task loss and regression task loss, respectively, which are obtained by optimizing the loss weights of each task through training, and softmax is the probability distribution activation function.
6. A system for detecting the type and concentration of a lightweight mixed gas, for implementing the method for detecting the type and concentration of a lightweight mixed gas according to any one of claims 1 to 5, characterized in that: Including acquisition unit and prediction unit, The acquisition unit includes a number of sensors for acquiring initial data and generating sensor array data; The prediction unit includes: Lightweight extraction module, used to extract the two-dimensional features of the sensor array data of the mixed gas, GRU network module is used to extract the one-dimensional features of the sensor array data of the mixed gas. The attention fusion module is used to fuse the one-dimensional features and the two-dimensional features. Regression module, which performs gas concentration regression based on the fused features; The classification module classifies gas types based on the fused features.
7. The system for detecting the type and concentration of lightweight mixed gas according to claim 6, characterized in that: The lightweight extraction module includes a 3×3 convolution layer, a regularization layer, a SiLU layer and multiple lightweight convolution units in sequence. The 3×3 convolution layer is used to extract features, the regularization layer is used to normalize the data after feature extraction, the SiLU layer is used to adjust the overall activation state of the lightweight extraction module, and the lightweight convolution unit is used to extract two-dimensional features and frequency domain features.
8. The system for detecting the type and concentration of lightweight mixed gas according to claim 7, characterized in that: The lightweight convolution unit includes a 1×1 point convolution layer, a 3×3 depth-separable convolution layer, a multispectral attention layer and a point convolution layer. A residual link layer is also provided between the input and output of the lightweight convolution unit. The 1×1 point convolution layer is used to change the number of channels of the input data, the 3×3 depth-separable convolution layer is used to extract features, and the multispectral attention layer is used to give attention to the feature map channels.
9. The system for detecting the type and concentration of lightweight mixed gas according to claim 8, characterized in that: The multispectral attention layer extracts the frequency domain features of the network based on discrete cosine transform and assigns attention weights to the gas data.
10. A storage medium, characterized in that: A computer program is stored, and when the computer program is executed by a processor, the processor is caused to perform the steps of the method for detecting the type and concentration of the lightweight mixed gas as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Self-adaptive pre-fusion detection method for gas sensor array
CN116340882A
Array sensor adaptive parameter detection method based on deep learning and MASK operator
CN116467671A
Mixed gas detection system and method, electronic equipment and medium
CN117192035A
Real-time nuclear magnetic image sequence reconstruction method and system and medium
CN117635743A
Method and system for detecting harmful gas in multi-component mixed gas
CN118298409A