Mixed gas classification and identification method based on wavelet transform and VIT neural network
The gas data characteristics are extracted through wavelet transformation and classified identification combined with ViT neural network, which solves the problem of difficult to identify multiple mixed gases in the prior art, and achieves high-precision and high-efficiency gas classification and recognition.
Patent Information
- Application Number
- CN202411736595.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-04-11
AI Technical Summary
The prior art is difficult to effectively identify multiple mixed gases, a single sensor cannot achieve high-precision classification due to cross-sensitivity problems, and traditional LSTM networks are inefficient when processing long-term series data.
Wavelet transformation is used to convert gas sensor data into wavelet coefficient diagrams, and classification and identification is used by ViT neural network. Wavelet transform extracts the characteristics of gas data, while ViT network uses image processing technology to perform high-precision classification.
The classification and recognition accuracy of mixed gases is improved, the problem of converting gas data into image data is solved, and the speed and efficiency of gas type recognition are significantly improved.
Smart Images

Figure CN119807806A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a mixed gas classification and recognition method based on wavelet transform (WT) and vision self-attention (ViT) neural network. Background Art
[0002] In daily life, various gases exist in our environment. When toxic gases such as carbon monoxide and nitrogen dioxide leak into the air, they will harm human health. Therefore, it is very important to monitor environmental gases. Usually, for a single harmful gas, a single gas sensor can be used for monitoring. However, when the number of gas types increases, a single sensor will not be able to effectively identify multiple gases due to cross-sensitivity constraints. At this time, the sensor array is used to collect gas response signals to achieve mixed gas classification and identification. The accuracy of gas classification and identification is mainly affected by its corresponding algorithm. Therefore, optimizing the gas identification algorithm is of great significance for high-precision gas classification and identification.
[0003] Gas data is time series data, so LSTM (Long Short-Term Memory) time recurrent neural network is usually used to complete the task of gas classification. Although LSTM network takes into account the time correlation of gas data, it is still insufficient when the gas data is too long. It cannot fully consider the before and after correlation of gas data, and the training time is too long, resulting in low work efficiency.
[0004] ViT neural network is widely used in the field of computer vision, and performs very well in tasks such as image classification and image segmentation. The performance of the Transformer module in the field of natural language processing even exceeds that of LSTM. However, ViT neural network is used for image processing, so it is necessary to solve how to convert gas data into image data.
[0005] Wavelet transform is often used in the field of signal processing. Wavelet transform not only has strong anti-interference ability, but also can extract the characteristics of non-stationary signals very well. It can also adjust the scale parameters and translation parameters to make the extracted features meet our needs. The wavelet coefficient map converted by wavelet transform can cover most of the original gas data characteristics. Summary of the invention
[0006] The purpose of the present invention is to propose a mixed gas classification and recognition method based on wavelet transform and ViT neural network to improve the classification and recognition accuracy of mixed gases.
[0007] In order to achieve the above object, the present invention adopts the following technical scheme:
[0008] The mixed gas classification and recognition method based on wavelet transform and ViT neural network includes the following steps:
[0009] Step 1. Obtain a data set of responses of the gas sensor array to the gas to be tested at the same temperature and humidity, wherein the acquired sensor response data includes responses of the sensor array to mixed VOC gases at multiple different concentration ratios;
[0010] Step 2. Perform wavelet transform on the sensor response data obtained in step 1, sample the obtained wavelet coefficients at equal intervals, and fill the pixel map with the sampled coefficients to form a wavelet coefficient map, obtain the gas response feature data set, and construct a training set and a test set;
[0011] Step 2.1. Perform wavelet transform on the gas sensor response data to obtain wavelet coefficients;
[0012] Specifically: ;
[0013] in, is the wavelet coefficient, is the gas response data, is the wavelet function;
[0014] Step 2.2. Perform equal-interval sampling on the wavelet coefficients obtained after wavelet transform processing to obtain a one-dimensional wavelet coefficient matrix after equal-interval sampling;
[0015] Step 3. Send the training set data into the ViT network for training, and save the classification model with the best effect;
[0016] Step 3.1. Input the wavelet coefficient map into the encoder part of the ViT model, which adopts a stacked 6-encoder module structure;
[0017] Step 3.2. Re-encode the position by splitting the wavelet coefficient image and using the learnable one-dimensional position embedding as the input of the position encoding;
[0018] Step 3.3. Divide the output of the position encoding into 8 attention modules, obtain the value of each attention module, and concatenate them;
[0019] Step 3.4. Make residual connections between the outputs of multiple attention blocks and the outputs of position encoding;
[0020] Step 3.5. The wavelet coefficient image after residual connection is sent to the feedforward neural network, and finally layer normalization is performed to obtain the characteristic information of the gas;
[0021] Step 3.6. Pass the obtained gas feature vector into the fully connected neural network to train the classification model; use the cross entropy loss function to optimize the model and save the classification model with the best effect.
[0022] Step 4. Load the best classification model, pass the gas data to be classified in the validation set into the model to determine the characteristic information of the gas and output the predicted gas category.
[0023] Furthermore, the step 1 is specifically as follows:
[0024] Step 1.1. First, n commercial sensors are assembled into a gas sensor array; where n is the number of sensors;
[0025] Step 1.2. In a standard temperature and humidity environment, use an acrylic plate with holes on both sides to completely cover the gas sensor array. The two holes are connected to the gas source and the exhaust channel respectively.
[0026] Among them, the standard temperature environment is a temperature environment of 22°C, and the standard humidity environment is a relative humidity environment of 50%RH;
[0027] Step 1.3. Use the MFC system to pass mixed gases with different concentration ratios to measure the sensor array response data set.
[0028] Furthermore, in step 2: the coefficients in the one-dimensional wavelet coefficient matrix are sequentially filled into a 32x32 pixel image to form a wavelet coefficient image; and the wavelet coefficient image data set is used to construct a training set and a test set in a ratio of 8:2.
[0029] Two indicators are used to evaluate the model performance, namely accuracy and F1-score; the formulas for accuracy and F1-score are:
[0030]
[0031]
[0032]
[0033]
[0034] accuracy is the accuracy rate; precision is the precision rate; recall is the recall rate; TP, TN, FP, and FN are the positive samples predicted by the model as positive, the negative samples predicted by the model as negative, the positive samples predicted by the model as negative, and the negative samples predicted by the model as positive.
[0035] The present invention has the following advantages:
[0036] As described above, the present invention relates to a mixed gas classification and identification method based on wavelet transform and ViT neural network. The method can transform gas data into wavelet coefficient images through wavelet transform, and use the neural network in the ViT visual field to solve the gas classification and identification problem. Since gas data is time series data, it is necessary to perform wavelet transform on the gas data to extract its wavelet coefficients, and fill the pixel map with wavelet coefficients by extracting wavelet coefficients at equal intervals to form a wavelet coefficient map. The wavelet coefficient map is sent to ViT, and the network performs classification and identification after fully learning the gas characteristics. In order to solve the problem of mixed gas classification and identification accuracy, a new neural network method is provided to improve the mixed gas classification and identification accuracy; in addition, in order to solve the problem of how to transform gas data into image data, the present invention proposes a wavelet transform method to solve the problem of transforming gas data into image data. This method achieves good classification and identification accuracy, greatly improves the speed of gas type identification, and provides technical support for the development and application of gas identification. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 This is a flow chart of the mixed gas classification and identification method based on wavelet transform and ViT neural network of the present invention.
[0038] Figure 2 This is the time-voltage diagram of a gas sensor's response to ethanol gas.
[0039] Figure 3 Schematic diagram of wavelet coefficients.
[0040] Figure 4 Schematic diagram of DWViT neural network. DETAILED DESCRIPTION
[0041] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific implementation modes.
[0042] like Figure 1 As shown, this embodiment describes a mixed gas classification and identification method based on wavelet transform and ViT neural network, and the mixed gas classification and identification method includes the following steps:
[0043] Step 1: Obtain a data set of responses of the gas sensor array to the gas to be tested at the same temperature and humidity. The acquired sensor response data includes the responses of the sensor array to mixed VOC gases at a plurality of different concentration ratios.
[0044] Step 1.1. First, n commercial sensors are assembled into a gas sensor array; where n is the number of sensors.
[0045] Step 1.2. In a standard temperature and humidity environment, use an acrylic plate with holes on both sides to completely cover the gas sensor array. The two holes are connected to the gas source and the exhaust channel respectively.
[0046] The standard temperature environment is 22°C, and the standard humidity environment is 50%RH.
[0047] Step 1.3. Use the MFC system to pass mixed gases with different concentration ratios to measure the sensor array response data set.
[0048] Step 2: Perform wavelet transform on the sensor response data obtained in step 1, sample the obtained wavelet coefficients at equal intervals, and fill the pixel map with the sampled coefficients to form a wavelet coefficient map, obtain the gas response feature data set, and construct the training set and test set. Step 2 is specifically as follows:
[0049] Step 2.1. Perform wavelet transform on the gas sensor response data to obtain wavelet coefficients.
[0050] The specific formula is: ;in, is the wavelet coefficient, is the gas response data, is the wavelet function.
[0051] Step 2.2. Perform equal-interval sampling on the wavelet coefficients obtained after wavelet transform processing to obtain a one-dimensional wavelet coefficient matrix after equal-interval sampling.
[0052] Step 2.3. Fill the coefficients in the one-dimensional wavelet coefficient matrix into the 32x32 pixel image in sequence to form a wavelet coefficient image.
[0053] Step 2.4. Use the wavelet coefficient image dataset in a ratio of 8:2 to construct a training set and a test set.
[0054] Step 3. Send the training set data to the ViT network for training, and save the classification model with the best effect. Step 3 is as follows:
[0055] Step 3.1. The wavelet coefficient map obtained in step 2 is input into the encoder part of the ViT model, which adopts a stacked 6-encoder module structure.
[0056] Step 3.2. Re-encode the position by splitting the wavelet coefficient image and use the learnable one-dimensional position embedding as the input of the position encoding.
[0057] Step 3.3. Divide the output after position encoding into 8 attention modules, get the value of each attention module, and concatenate them.
[0058] Step 3.4. Make residual connections between the outputs of multiple attention blocks and the outputs of position encoding.
[0059] Step 3.5. The wavelet coefficient image after residual connection is sent to the feedforward neural network, and finally layer normalization is performed to obtain the characteristic information of the gas.
[0060] Step 3.6. Pass the obtained gas feature vector into the fully connected neural network to train the classification model; use the cross entropy loss function to optimize the model and save the classification model with the best effect.
[0061] Step 4: Load the classification model and pass the gas data to be classified into the model for gas classification and identification. Step 4 is specifically as follows:
[0062] Load the classification model saved in step 3.6, input the gas data to be classified into the model, determine the characteristic information of the gas, and output the predicted gas category.
[0063] In this invention, two indicators are used to evaluate the model performance, namely accuracy and F1-score; the formulas of accuracy and F1-score are:
[0064]
[0065]
[0066]
[0067]
[0068] accuracy is the accuracy rate; precision is the precision rate; recall is the recall rate; TP, TN, FP, and FN are the positive samples predicted by the model as positive, the negative samples predicted by the model as negative, the positive samples predicted by the model as negative, and the negative samples predicted by the model as positive.
[0069] Table 1 Comparison of prediction performance between the method of the present invention and the classical method
[0070]
[0071] Table 1 compares the experimental prediction results of the classification method proposed by the present invention and the common classical classification methods, further proving the superiority of the present invention in multi-component gas classification.
[0072] In summary, the above are only preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention.
[0073] All equivalent substitutions and obvious modifications made by any technician familiar with the art under the guidance of this specification fall within the substantive scope of this specification and should be protected by the present invention.
Claims
1. A mixed gas classification and recognition method based on wavelet transform and VIT neural network, characterized in that: The steps include: Step 1. Obtain a data set of responses of the gas sensor array to the gas to be tested at the same temperature and humidity, wherein the acquired sensor response data includes responses of the sensor array to mixed VOC gases at multiple different concentration ratios; Step 2. Perform wavelet transform on the sensor response data obtained in step 1, sample the obtained wavelet coefficients at equal intervals, and fill the pixel map with the sampled coefficients to form a wavelet coefficient map, obtain the gas response feature data set, and construct a training set and a test set; Step 2.
1. Perform wavelet transform on the gas sensor response data to obtain wavelet coefficients; ; in, is the wavelet coefficient, is the gas response data, is the wavelet function; Step 2.
2. Perform equal-interval sampling on the wavelet coefficients obtained after wavelet transform processing to obtain a one-dimensional wavelet coefficient matrix after equal-interval sampling; Step 3. Send the training set data into the ViT network for training, and save the classification model with the best effect; Step 3.
1. Input the wavelet coefficient map into the encoder part of the ViT model, which adopts a stacked 6-encoder module structure; Step 3.
2. Re-encode the position by splitting the wavelet coefficient image and using the learnable one-dimensional position embedding as the input of the position encoding; Step 3.
3. Divide the output of the position encoding into 8 attention modules, obtain the value of each attention module, and concatenate them; Step 3.
4. Make residual connections between the outputs of multiple attention blocks and the outputs of position encoding; Step 3.
5. The wavelet coefficient image after residual connection is sent to the feedforward neural network, and finally layer normalization is performed to obtain the characteristic information of the gas; Step 3.
6. The obtained gas feature vector is passed into the fully connected neural network to train the classification model; the model is optimized using the cross entropy loss function, and the classification model with the best effect is saved; Step 4. Load the best classification model, pass the gas data to be classified into the model to determine the characteristic information of the gas and output the predicted gas category.
2. The mixed gas identification method according to claim 1, characterized in that: The step 1 is specifically as follows: Step 1.
1. First, n commercial sensors are assembled into a gas sensor array; where n is the number of sensors; Step 1.
2. In a standard temperature and humidity environment, use an acrylic plate with holes on both sides to completely cover the gas sensor array. The two holes are connected to the gas source and the exhaust channel respectively. Among them, the standard temperature environment is a temperature environment of 22°C, and the standard humidity environment is a relative humidity environment of 50%RH; Step 1.
3. Use the MFC system to pass mixed gases with different concentration ratios to measure the sensor array response data set.
3. The mixed gas classification and identification method according to claim 1, characterized in that: In step 2: The coefficients in the one-dimensional wavelet coefficient matrix are sequentially filled into the 32x32 pixel image to form a wavelet coefficient image; the wavelet coefficient image data set is used to construct the training set and the test set in a ratio of 8:2.