Method, system and storage medium for detecting light-weight mixed gas type and concentration

By using a lightweight feature fusion network and gas dynamic entropy mask undersampling technology, the problems of high computational load and insufficient accuracy in portable exhaled breath detection devices are solved, achieving efficient and accurate detection of mixed gas types and concentrations, suitable for devices with limited resources.

CN120600286BActive Publication Date: 2026-07-21TIANJIN UNIVERSITY OF TECHNOLOGY
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TIANJIN UNIVERSITY OF TECHNOLOGY
Filing Date
2025-06-11
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing technologies in portable exhaled breath detection devices suffer from problems such as high computational load, high parameter count, and insufficient detection accuracy and robustness, making it difficult to achieve rapid and accurate detection of mixed gas types and concentrations.

Method used

A lightweight feature fusion network is adopted, which combines a GRU network module, a lightweight extraction module, and an attention fusion module. The sensor array data is undersampled by a gas dynamic entropy mask to perform one-dimensional and two-dimensional feature extraction. Gas concentration regression and species classification are performed through regression and classification modules.

Benefits of technology

It achieves high-precision and robust prediction of mixed gas types and concentrations with low computational and parameter requirements, making it suitable for resource-constrained equipment and promoting the widespread adoption and application of portable exhaled gas detection devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120600286B_ABST
    Figure CN120600286B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of gas detection, and discloses a light-weight mixed gas type and concentration detection method and system and a storage medium, wherein sensor array data of mixed gases of different types and different concentrations is acquired; the sensor array data is input into a prediction unit based on a light-weight feature fusion network, one-dimensional features of the sensor array data of the mixed gases are extracted through a GRU network module, a light-weight extraction module extracts two-dimensional features of the sensor array data of the mixed gases, a multi-dimensional feature fusion of the one-dimensional features and the two-dimensional features is performed by an attention fusion module, the fused features are processed through a regression module and a classification module respectively, and gas concentration regression values and classification data of gas types are obtained; the collected sensor data is subjected to undersampling processing, the input data amount is reduced, the overall data amount during model training is reduced, and high-precision and strong-robustness mixed gas type and concentration prediction is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of gas detection technology, specifically to methods, systems, and storage media for detecting the type and concentration of lightweight mixed gases. Background Technology

[0002] Human exhaled breath contains a wealth of physiological information that can be used for disease diagnosis. Studies show that human cells release volatile organic compounds (VOCs) during biochemical reactions, and most VOCs are expelled from the body in the form of exhaled breath. When the body is in a sub-healthy state, cellular biochemical reactions are affected by disease, and the types and concentrations of released VOCs change accordingly. By detecting VOCs in human exhaled breath, early diagnosis of respiratory diseases, digestive diseases, metabolic diseases, and even cancer can be achieved.

[0003] Electrochemical technology based on gas sensors is a mature and widely used technique in the field of exhaled breath detection. However, the concentration of VOCs biomarkers in human exhaled breath is low, and the composition of exhaled breath is complex. Traditional gas sensors suffer from poor selectivity and insufficient accuracy due to the possibility of cross-responses between sensors in the array to multiple gases, thus limiting their effectiveness in practical applications.

[0004] With the popularization 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 a more accurate and reliable solution for exhaled breath detection.

[0005] In the field of life and health testing, the widespread application and popularization of exhaled breath testing requires testing equipment to be portable, fast, and suitable for home use. For many patients with chronic diseases, the ability to monitor their health status in real time is crucial. Portable exhaled breath testing devices allow patients to monitor their health in real time at home and keep track of their health status. For healthy individuals, portable exhaled breath analysis devices also provide an effective tool for daily health management, offering rapid health feedback at home.

[0006] However, the portability and speed of testing equipment require intelligent testing methods to not only possess high accuracy but also low computational load and a small number of parameters, enabling real-time and rapid testing on devices with limited computing resources. This method allows for the efficient application of portable exhaled breath testing devices without relying on cloud computing devices and servers.

[0007] Although detection methods based on machine learning algorithms such as SVM have lower computational and parameter requirements, they exhibit poor detection performance and robustness when handling complex gas mixtures. Detection methods based on time-series algorithms such as RNN and LSTM require data from longer time steps to achieve accurate predictions, resulting in high computational cost, low efficiency, and neglect of the spatial characteristics of sensor array data. While CNN-based algorithms possess strong feature extraction capabilities, the high accuracy requirements for detecting complex gas mixtures necessitate the use of deep CNN models, leading to a significant increase in model parameters and computational cost. Summary of the Invention

[0008] In view of the shortcomings of the existing technology, the purpose of this invention is to provide a method, system and storage medium for detecting the type and concentration of lightweight mixed gases.

[0009] To achieve the above objectives, the present invention provides the following technical solution: A lightweight method for detecting the type and concentration of mixed gases, acquiring sensor array data of mixed gases of different types and concentrations; The sensor array data is input into the prediction unit based on the 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 the gas concentration regression value and the gas type classification data. The prediction unit is trained using undersampled data based on a gas dynamic entropy mask.

[0010] In this invention, the preferred specific steps of the undersampling based on the gas dynamic entropy mask are as follows: A1. Given a gas sensor array with data length L and number of sensors S, first initialize an undersampling mask matrix P as an L×S matrix of all zeros: ; In the formula, For matrix row vector indices, Indexes for matrix column vectors; A2. Set the desired number of undersampling points to N, acquire gas sensor array data, and divide the array data length L into N equal intervals, each interval containing For each interval k, calculate the entropy value of the corresponding data segment for each data point. As adjusted standard deviation Basis:

[0011] in, Let be the probability density of the i-th data point within the k-th interval; A3. Based on entropy value Adaptive adjustment of standard deviation :

[0012] in, Using the baseline standard deviation as a benchmark, through dynamic adjustment, a smaller standard deviation can be used in the range with a large amount of information to ensure that the sampling points more concentratedly cover the key features; while a larger standard deviation is used in the range with a small amount of information to increase the diversity of sampling points. A4. Calculate the mean value of its center point. : ; A5. Using the mean and standard deviation Generate a normal distribution and randomly sample an index from it. As an undersampled point: ; A6. Generate an undersampling index for each interval k. This ensures that the selected indexes are evenly distributed across the entire data range, while introducing randomness through the indexes. Generate the undersampling mask matrix P:

[0013] This operation indicates that the selected location data is not obscured, thus preserving key feature information; A7. Repeat the above process X times, where X is the hyperparameter for data augmentation of the gas sensor array.

[0014] In this invention, preferably, after the sensor array data is undersampled using a gas dynamic entropy mask, labels are set based on the type and concentration of the gas, and the data is cleaned and normalized. The processed data is then divided into a training set and a test set based on five-fold cross-validation. The training set is used for the initial training of the prediction unit, and the test set is used for the initial testing of the prediction unit.

[0015] In this invention, preferably, the multidimensional feature fusion specifically includes the following steps: Initial weights are matched to the input features; A weighted concatenation method is used to fuse features. During the fusion process, a gating mechanism is used to dynamically adjust the weight value of each input feature according to the different input features.

[0016] In this invention, preferably, the joint self-weighted loss of the prediction unit is:

[0017] In the formula, These are the gas categories predicted by the model and the actual gas categories, respectively. The model predicts the gas concentration value, while the actual gas concentration value is... and The loss values ​​are for classification and regression tasks, respectively, and are obtained by optimizing the weights of each task's loss during training.

[0018] A system for detecting the type and concentration of lightweight mixed gases, including a data acquisition unit and a prediction unit. The acquisition unit includes several sensors for acquiring initial data and generating sensor array data; The prediction unit includes: A lightweight extraction module is used to extract two-dimensional features from sensor array data of mixed gases. The GRU network module is used to extract one-dimensional features from sensor array data of mixed gases. The attention fusion module is used to fuse the one-dimensional and two-dimensional features. The regression module performs gas concentration regression based on the fused features. The classification module classifies gas types based on the fused features.

[0019] In this invention, preferably, the lightweight extraction module includes a 3×3 convolutional layer, a regularization layer, a SiLU layer, and multiple lightweight convolutional units in sequence. The 3×3 convolutional 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 convolutional units are used to extract two-dimensional features and frequency domain features.

[0020] In this invention, preferably, the lightweight convolutional unit includes a 1×1 point convolutional layer, a 3×3 depth-separable convolutional layer, a multispectral attention layer, and a point convolutional layer. A residual linking layer is also provided between the input and output of the lightweight convolutional unit. The 1×1 point convolutional layer is used to change the number of channels in the input data, the 3×3 depth-separable convolutional layer is used to extract features, and the multispectral attention layer is used to impart channel attention to the feature map.

[0021] In this invention, preferably, the multispectral attention layer is based on discrete cosine transform to extract the frequency domain features of the network and assign attention weights to the gas feature map.

[0022] Compared with the prior art, the beneficial effects of the present invention are: The method of the present invention reduces the amount of input data by undersampling the collected sensor data, thereby reducing the overall amount of data during model training, while achieving high-precision and robust prediction of mixed gas types and concentrations. The system of this invention employs a lightweight extraction module in conjunction with a GRU network module for multidimensional feature extraction, capturing features and correlation information in both temporal and spatial dimensions. This facilitates a more comprehensive understanding of gas information. Through the attention fusion module, the network model can comprehensively utilize spatial and temporal features, improving the accuracy of detecting mixed gas types and concentrations. Furthermore, the use of a lightweight extraction module reduces the overall computational load and number of parameters in the model, thereby improving prediction efficiency. At the same time, the reduced model parameters result in a smaller storage space requirement, making it no longer limited to specialized equipment and facilitating deployment on more widespread and convenient mobile devices, thus providing strong technical support for public health.

[0023] The system of this invention promotes the popularization and application of portable exhaled gas detection devices, enabling accurate and rapid gas identification and concentration prediction on devices 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. Attached Figure Description

[0024] Figure 1 This is a schematic diagram of the lightweight mixed gas type and concentration detection system described in this invention.

[0025] Figure 2 This is a schematic diagram of the lightweight convolutional unit described in this invention.

[0026] Figure 3 This is a schematic diagram of the structure of the GRU network module described in this invention.

[0027] Figure 4 This is a schematic diagram of the structure of the multispectral attention layer described in this invention.

[0028] Figure 5 This is a schematic diagram illustrating the proportional relationship between the response data of each gas sensor array and the response dataset of all gases, and the proportional relationship between gas concentration and the response dataset of the corresponding gas in a specific embodiment of the present invention.

[0029] Figure 6 This is a schematic diagram illustrating the data undersampling described in this invention. Detailed Implementation

[0030] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort 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 of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the 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 lightweight method for detecting the type and concentration of mixed gases. This method achieves high-precision and rapid detection and identification of gas types and concentrations in mixed gases while maintaining low model parameter count and low computational load. Specific steps include acquiring sensor array data of mixed gases of different types and concentrations; inputting the sensor array data into a prediction unit based on a lightweight feature fusion network; extracting one-dimensional features from the sensor array data of the mixed gases using a GRU network module; extracting two-dimensional features from the sensor array data of the mixed gases using a lightweight extraction module; fusing the one-dimensional and two-dimensional features using an attention fusion module; and processing the fused features through a regression module and a classification module to obtain gas concentration regression values ​​and gas type classification data. The prediction unit is trained using data undersampled based on a gas dynamic entropy mask.

[0033] Specifically, the prediction unit needs to be obtained through prior training. The training set used for training is based on undersampling of sensor array data acquired by gas sensors using gas dynamic entropy, and the corresponding gas type and concentration are recorded in the sensor array data acquired by the gas sensors. For each data point in the sensor array data, undersampling is performed using several gas dynamic entropy masks.

[0034] Specific steps for undersampling based on gas dynamic entropy mask: A1. Given a gas sensor array with data length L and number of sensors S, first initialize an undersampling mask matrix P as an L×S matrix of all zeros: ; In the formula, For matrix row vector indices, Indexes for matrix column vectors; A2. Set the desired number of undersampling points to N, acquire gas sensor array data, and divide the array data length L into N equal intervals, each interval containing For each interval k, calculate the entropy value of the corresponding data segment for each data point. As adjusted standard deviation Basis:

[0035] in, Let be the probability density of the i-th data point within the k-th interval; A3. Based on entropy value Adaptive adjustment of standard deviation :

[0036] in, Using the baseline standard deviation as a benchmark, through dynamic adjustment, a smaller standard deviation can be used in the range with a large amount of information to ensure that the sampling points more concentratedly cover the key features; while a larger standard deviation is used in the range with a small amount of information to increase the diversity of sampling points. A4. Calculate the mean value of its center point. : ; A5. Using the mean and standard deviation Generate a normal distribution and randomly sample an index from it. As an undersampled point: ; A6. Generate an undersampling index for each interval k. This ensures that the selected indexes are evenly distributed across the entire data range, while introducing randomness through the indexes. Generate undersampling mask matrix :

[0037] This ensures that the selected location data is not obscured, thus preserving key feature information; A7. Repeat the above process X times, where X is the hyperparameter for data augmentation of the gas sensor array.

[0038] After undersampling using a gas dynamic entropy mask, the sensor array data is labeled based on the gas type and concentration. Then, data cleaning and normalization are performed to eliminate differences in feature dimensions. Specifically, the concentration in the data and labels is subjected to minimum-maximum normalization.

[0039] In the formula, This is the original sensor array response data. This indicates the maximum value of the response data. This represents the minimum value of the response data. This represents the response data after normalization.

[0040] The processed data is divided into training and test sets based on five-fold cross-validation. The training set is used for the initial training of the prediction unit. The data from the training set is input into the prediction unit, and relevant parameters of the prediction unit are adjusted to construct relevant quantitative indicators. The prediction model within the prediction unit is iteratively trained and optimized until the prediction model fully converges. The data from the unlabeled test set is input into the trained prediction model to predict gas types and concentrations. The prediction performance of the prediction model is evaluated using quantitative indicators.

[0041] The prediction unit, which has been trained and tested, is used to predict the types and concentrations of multiple gases. The sensor array data collected by the sensors is input into the prediction unit and processed by the GRU network module and the lightweight extraction module. The GRU network module extracts one-dimensional features from the sensor array data of the mixed gas, and the lightweight extraction module extracts two-dimensional features from the sensor array data of the mixed gas. Then, the attention fusion module fuses the one-dimensional and two-dimensional features into multi-dimensional features. The fused features are then processed by the regression module and the classification module to obtain the gas concentration regression value and the gas type classification data.

[0042] In this embodiment, multidimensional feature fusion specifically includes the following steps: Initial weights are matched to the input features, and a gating mechanism is introduced to adaptively adjust the importance of each feature in the fusion process. The gating mechanism precisely controls the degree of feature fusion by dynamically adjusting the weight of each feature during the fusion process, ensuring that the model focuses on the most distinctive key feature information when performing feature fusion. The fusion process uses a weighted concatenation method to ensure that the overall performance of each feature can reflect its important role in the model to the greatest extent.

[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, enabling the model to flexibly cope with diverse data patterns. Through the gating mechanism, the prediction unit can learn autonomously and focus on the features with the most information content and discriminative power, thereby improving the accuracy and robustness of the detection task and enhancing the adaptability of the prediction network to different gas sensor array data and various mixed gas conditions.

[0044] In this embodiment, the mean squared error loss function is used as the loss function for the regression module to handle regression problems. And using the cross-entropy loss function as the loss for the classification module to handle classification problems. , The objective function is a joint self-weighted loss that can be optimized through training of the loss weights for each task. The joint weighted loss is:

[0045] In the formula, These are the gas categories predicted by the model and the actual gas categories, respectively. The model predicts the gas concentration value, while the actual gas concentration value is... and The loss values ​​are for classification and regression tasks, respectively, and are obtained by optimizing the weights of each task's loss during training.

[0046] Another preferred embodiment of the present invention provides a system for detecting the type and concentration of lightweight mixed gases, including a data acquisition unit and a prediction unit. The acquisition unit includes several sensors for acquiring initial data and generating sensor array data; The prediction unit includes: A lightweight extraction module is used to extract two-dimensional features from sensor array data of mixed gases. The GRU network module is used to extract one-dimensional features from sensor array data of mixed gases. The attention fusion module is used to fuse the one-dimensional and two-dimensional features. The regression module 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 train the prediction unit. In this embodiment, the dataset used is the "Gas sensor array under dynamic gas mixtures" dataset, which was measured by Jordi Fonollosa et al. at the University of California, San Diego and is publicly available in the UCI database. This dataset includes 16 gas sensors, which are divided into four types: TGS-2600, TGS-2602, TGS-2610, and TGS-2620. Each type includes four sensors, which continuously sample methane at a concentration of 0-300 ppm (randomly varying) and ethylene at a concentration of 0-20 ppm (randomly varying) for 12 hours at a sampling frequency of 100 Hz.

[0048] Data cleaning was performed on the dataset, removing data where all gas concentrations were 0, and data indicating severe sensor drift or malfunction. To reduce redundancy, only the sensor array response data from the recovery section was used. The proportion of each gas data point in the total dataset is related to the concentration of each gas, for example... Figure 5 As shown, the concentration ratio of the mixed gas is expressed in the format of methane gas concentration - ethylene gas concentration. To facilitate training, reduce computational resource consumption, and decrease data volume, the masked data is cleaned. For example... Figure 6 As shown, the number of undersampling points in this embodiment is 16. After undersampling, the corresponding data of the original fully sampled sensor array with a length of (20000, 16) becomes (16, 16).

[0049] For each data point, several uniform masks can be randomly generated. Each data point after undersampling by the gas dynamic entropy mask is a representation of the corresponding type and concentration of gas, which can be regarded as a data augmentation method. In this embodiment, the number of uniform random masks generated for a single data point is 10,000.

[0050] Then, undersampling is performed on the gas sensor array data based on a gas dynamic entropy mask. The specific steps are as follows: A1. Let the data length of the gas sensor array be L, and the number of sensors be S. First, initialize an undersampling mask matrix P as an L×S matrix of all zeros:

[0051] A2. Set the desired number of undersampled points to N. Divide the data length L of the gas sensor array into N equal intervals, each interval containing... There are k data points. For each interval k, calculate the entropy value of its corresponding data segment. As adjusted standard deviation Basis:

[0052] in, Let be the probability density of the i-th data point within the k-th interval.

[0053] A3. Based on entropy value Adaptive adjustment of standard deviation :

[0054] in, The standard deviation is used as the baseline. This dynamic adjustment allows for the use of a smaller standard deviation in intervals with higher information content, ensuring that the sampling points more concentratedly cover key features; while a larger standard deviation is used in intervals with lower information content, increasing the diversity of sampling points.

[0055] A4. Calculate the mean value of its center 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 an undersampled point:

[0057] A6. Generate an undersampling index for each interval k. This ensures that the selected indexes are evenly distributed across the entire data range, while introducing randomness. Ultimately, through indexing... Generate the undersampling mask matrix P:

[0058] This operation ensures that the selected location data is not obscured, thus preserving key feature information.

[0059] A7. Repeat the above process X times, where X is the hyperparameter for enhancing gas data.

[0060] After undersampling, each masked undersampling data point is labeled based on its gas type and gas concentration. The label format used in this embodiment is shown in Table 1 below: Table 1.

[0061] The classification task corresponds to the prediction of gas types, while the regression task corresponds to the prediction of gas concentrations.

[0062] To eliminate differences in feature dimensions and improve model performance and robustness, the data is normalized. This example uses max-min normalization, which scales the data to between 0 and 1 through a linear transformation. The formula for max-min normalization is as follows:

[0063] in, This is the original sensor array response data. This indicates the maximum value of the response data. This represents the minimum value of the response data. This represents the response data after normalization.

[0064] To reduce reliance on specific training and validation sets and improve the stability and reliability of model evaluation, a five-fold cross-validation method is adopted, reserving 10% of the data for testing. The test set data includes methane gas, ethylene gas, and a mixture of methane and ethylene gas, each accounting for a certain percentage. The remaining data undergoes 50-fold cross-validation, with the specific steps as follows: B1. Shuffle the original dataset to ensure the randomness of the samples, and divide the dataset into five subsets of approximately the same size, with each subset being a fold.

[0065] B2. For each fold, use it as the validation set and the other four folds as the training set.

[0066] B3. The specific steps for training and validation at each fold are as follows: B4. Train the model using four training sets.

[0067] B5. Use the trained model to make predictions on the validation set data.

[0068] B6. Based on the prediction results and the true labels of the validation set, calculate the performance index of the model at this fold.

[0069] In this embodiment, after constructing the training set and the test set, a prediction network for 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 extract one-dimensional and two-dimensional features from the sensor array data, respectively. The attention fusion module concatenates the one-dimensional and two-dimensional features along 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 approach. The fused features are used as shared features and input into the regression module and the classification module respectively. The regression module performs the regression task, and the classification module performs the classification task. The classification module and the regression module each use two fully connected layers to converge features, and finally obtain the gas type classification result and the gas concentration regression result.

[0071] In this embodiment, the lightweight extraction module sequentially includes a 3×3 convolutional layer, a regularization layer, a SiLU layer, and multiple lightweight convolutional units. The 3×3 convolutional 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 convolutional units are 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 convolutional unit includes a 1×1 point convolutional layer, a 3×3 depthwise separable convolutional layer, a multispectral attention layer, a point convolutional layer, and residual connections. The 1×1 point convolutional layer is used to change the number of channels in the input data, the 3×3 depthwise separable convolutional layer is used to extract features, the multispectral attention layer is used to give channel attention to the feature map, and the point convolutional layer and residual connections are used to effectively alleviate the gradient vanishing problem, promote the flow of information and the effective transfer of features, thereby improving the training efficiency and performance of the model.

[0074] In this embodiment, the multispectral attention layer is based on discrete cosine transform to extract the frequency domain features of the network and assign 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; the mean squared error loss function is used as the loss for the regression problem.

[0076] In the problem of loss weight allocation in multi-task learning, this embodiment sets the weights as learnable parameters, transforming the traditional multi-task learning problem of manually adjusting the loss weights of each task into a multi-task learning problem of self-weighted loss for each task, where the classification task loss... Losses from the return mission Multi-task joint self-weighted loss formula They are respectively: = -

[0077] =

[0078] )]+[ + ) ] in, These are the gas categories predicted by the model and the actual gas categories, respectively. The model predicts the gas concentration value, while the actual gas concentration value is... , These are the learnable parameters for the loss of the classification task and the loss of the regression task, respectively.

[0079] After determining the structure of the prediction unit and the loss function, we define accuracy and mean absolute error (MAE) as performance evaluation metrics for classification and regression tasks, respectively. We use parameters and floating-point operations per second (FLOPS) as metrics to evaluate model size and computational requirements. The specific formulas for accuracy and MAE are as follows: Accuracy = Number of correctly classified samples / Total number of samples MAE =

[0080] in, The actual concentration value on the label. This represents the concentration value predicted by the model.

[0081] In this embodiment, after the prediction model of the prediction unit is built, the preprocessed undersampled gas sensor array data and its corresponding gas type and concentration labels are input into the prediction network. In this embodiment, the Adam optimizer is selected, the model learning rate is defined as 0.001, and the learning rate of the learnable parameters in the self-weighted joint loss is defined as 0.01.

[0082] After training iterations, the loss of the prediction model gradually converges. The reserved test set data is then input into the trained network model. This test set data has also been undersampled to simulate the scenario in real-world applications where predictions are made using only a very small number of sensor array response data points; its length is only 12.

[0083] The trained prediction model was compared with existing CNN and Resnet18+CBAM algorithms. The training data of the CNN and Resnet18+CBAM algorithms were not undersampled, and the average data dimension of the sensor array used was (15000, 16). The lightweight feature fusion network was undersampled, and the data dimension was (16, 16).

[0084] Table 2 compares the accuracy, MAE, number of parameters (params), and number of floating-point operations per second (FLOPS) of the three models obtained by inputting the same set of sensor array data into the prediction unit, CNN algorithm, and Resnet18+CBAM algorithm, respectively.

[0085] Table 2.

[0086] As can be seen from the comparison of evaluation indicators in Table 2, the lightweight feature fusion network prediction model used in the prediction unit of this invention can achieve gas type identification and concentration prediction results that surpass those of other traditional models, even with significantly lower Params and FLOPS.

[0087] In some other preferred embodiments of the present invention, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, causes the processor to perform the steps of the method as described in the above embodiments.

[0088] If the aforementioned functions are implemented as 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 this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0089] The above description is a detailed description of the preferred embodiments of the present invention. However, the embodiments are not intended to limit the scope of the patent application of the present invention. All equivalent changes or modifications made under the technical spirit of 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 lightweight mixed gases, characterized in that, Including the following steps: The sensor array data of the mixed gas is processed by the prediction unit to obtain the gas concentration regression value and the gas type classification data; The prediction unit is trained using undersampled data based on a gas dynamic entropy mask. The specific steps of undersampling based on gas dynamic entropy mask are as follows: A1. Given a gas sensor array with data length L and number of sensors S, first initialize an undersampling mask matrix P as an L×S matrix of all zeros. ; In the formula, For matrix row vector indices, Indexes for matrix column vectors; A2. Set the desired number of undersampling points to N, acquire gas sensor array data, and divide the length L of the gas sensor array data into N equal intervals, each interval containing For each interval k, calculate the entropy value of the corresponding data segment for each data point. As adjusted standard deviation Basis: ; in, Let be the probability density of the i-th data point within the k-th interval. The number of samples within each interval; A3. Based on entropy value Adaptive adjustment of standard deviation : ; in, The baseline standard deviation; A4. Calculate the mean value of its center point. : ; A5. Using the mean and standard deviation Generate a normal distribution and randomly sample an index from it. As an undersampled point: ; in, Let the integer be the set of integers {..., -2, -1, 0, 1, 2, ...}; A6. Generate an undersampling index for each interval k. At the same time, randomness is introduced through indexing. Generate the undersampling mask matrix P: ; A7. Repeat the above A1-A6 process X times, where X is the hyperparameter for data augmentation of the gas sensor array; In the sensor array data input prediction unit, the prediction unit performs the following prediction steps: The GRU network module extracts one-dimensional features from the sensor array data of the mixed gas. The lightweight extraction module extracts two-dimensional features from sensor array data of mixed gases. 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 the gas concentration regression value and the gas type classification data; The lightweight extraction module sequentially includes a 3×3 convolutional layer, a regularization layer, a SiLU layer, and multiple lightweight convolutional units. The 3×3 convolutional 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, the lightweight convolutional units are used to extract two-dimensional features and frequency domain features, and the multispectral attention layer is based on discrete cosine transform to extract the frequency domain features of the network and assign attention weights to the gas data.

2. The method for detecting the type and concentration of lightweight mixed gas according to claim 1, characterized in that, After undersampling using a gas dynamic entropy mask, the sensor array data is labeled based on the type and concentration of the gas, and then cleaned and normalized. The processed data is then divided into a training set and a test set based on five-fold cross-validation. The training set is used for the initial training of the prediction unit, and the test set is used for the initial testing of the prediction unit.

3. The method for detecting the type and concentration of lightweight mixed gas according to claim 2, characterized in that, The multidimensional feature fusion specifically includes the following steps: Initial weights are matched to the input features; A weighted concatenation method is used to fuse features. During the fusion process, a gating mechanism is used to dynamically adjust the weight value of each input feature according to the different input features.

4. The method for detecting the type and concentration of lightweight mixed gas according to claim 1, characterized in that, The joint self-weighted loss of the prediction unit is: In the formula, These are the gas categories predicted by the model and the actual gas categories, respectively. The model predicts the gas concentration value, while the actual gas concentration value is... and The loss functions are for classification and regression tasks, respectively, and are obtained by optimizing the weights of each task's loss function during training. Softmax is the activation function for the probability distribution.

5. A system for detecting the type and concentration of lightweight mixed gases, used to implement the method for detecting the type and concentration of lightweight mixed gases according to any one of claims 1-4, characterized in that, Includes acquisition unit and prediction unit, The acquisition unit includes several sensors for acquiring initial data and generating sensor array data; The prediction unit includes: A lightweight extraction module is used to extract two-dimensional features from sensor array data of mixed gases. The GRU network module is used to extract one-dimensional features from sensor array data of mixed gases. The attention fusion module is used to fuse the one-dimensional and two-dimensional features. The regression module performs gas concentration regression based on the fused features. The classification module classifies gas types based on the fused features.

6. The system for detecting the type and concentration of lightweight mixed gases according to claim 5, characterized in that, The lightweight convolutional unit includes a 1×1 point convolutional layer, a 3×3 depth-separable convolutional layer, a multispectral attention layer, and a point convolutional layer. A residual linking layer is also provided between the input and output of the lightweight convolutional unit. The 1×1 point convolutional layer is used to change the number of channels in the input data, the 3×3 depth-separable convolutional layer is used to extract features, and the multispectral attention layer is used to give attention to the channels of the feature map.

7. A storage medium, characterized in that, The device contains a computer program that, when executed by a processor, causes the processor to perform the steps of the method for detecting the type and concentration of a lightweight mixed gas as described in any one of claims 1-6.