Mixed gas detection method based on parameter-feature transfer learning
Through a method based on parameter-feature transfer learning, the knowledge of the source domain data set is transferred to the target domain data set, which solves the problem of dependence on a large number of labeled data in the prior art, and realizes high-precision gas detection when the target domain data is insufficient.
Patent Information
- Application Number
- CN202411865944.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-04-08
AI Technical Summary
Existing mixed gas detection methods rely highly on large-scale labeled data, but in actual applications, there is often a lack of sufficient labeled data, resulting in poor detection results when the target domain data is insufficient.
Using a mixed gas detection method based on parameter-feature transfer learning, a mixed gas detection system is built, and a transfer learning method with parameter sharing and feature adaptability is used to transfer the knowledge learned from a large source domain data set to a small target domain data set, reducing the dependence on a large number of target domain annotation data.
In the case of insufficient data in the target domain, the accuracy and robustness of gas detection are significantly improved, the demand for a large number of experimental data of specific mixed gases is reduced, and the performance of the model on small sample data is improved.
Smart Images

Figure CN119782963A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of gas detection, and in particular to a mixed gas detection method based on parameter-feature transfer learning. Background Art
[0002] With the advancement of industrialization, industrial emissions have become one of the main sources of air pollution, especially in the chemical, steel, electricity, transportation and other industries. The large amount of harmful gases emitted by these industries not only seriously pollute the environment, but also pose a threat to human health. Therefore, it is of great significance to detect mixed polluted gases in industrial sites and other environments that are in close contact with humans to ensure personal safety and reduce losses.
[0003] At present, gas detection technology usually relies on an electronic nose system, which consists of a sensor array with a wide spectrum response capability and an advanced pattern recognition algorithm. Pattern recognition algorithms mainly include shallow machine learning algorithms and deep learning algorithms. Shallow machine learning algorithms, such as multi-layer perceptron (MLP) and support vector machine (SVM), are usually used to process sensor response data with fewer features and simple tasks. They can achieve fast gas detection and identification to a certain extent, but have certain limitations in processing complex data and extracting advanced features. In contrast, deep learning algorithms, such as convolutional neural networks (CNN) and long short-term memory networks (LSTM), have obvious advantages in feature extraction, but they are highly dependent on the quantity and quality of data, which is often difficult to meet in actual gas collection tasks. In addition, deep learning models are also insufficient in domain adaptability and usually require retraining, which increases time and computational costs.
[0004] Disadvantages of existing technologies: Existing mixed gas detection methods are highly dependent on large-scale labeled data, while in practical applications, detection tasks often lack sufficient labeled data. Summary of the invention
[0005] The present invention provides a mixed gas detection method based on parameter-feature transfer learning, which can not only ensure applicability when the amount of target gas data is small, but also achieve high-precision gas detection effect.
[0006] To achieve the above object, the present invention provides a mixed gas detection method based on parameter-feature transfer learning, comprising the following steps:
[0007] Step 1: construct a mixed gas detection system based on parameter-feature transfer learning, wherein the mixed gas detection system is provided with a gas signal acquisition module, the gas signal acquisition module is connected to a preprocessing module, and the preprocessing module is connected to a source domain gas detection model and a target domain gas detection model;
[0008] Step 2: The gas signal acquisition module acquires the source domain data set and the target domain data set, and passes them to the preprocessing module;
[0009] Step 3: The preprocessing module performs preprocessing operations on the source domain data set and the target domain data set respectively to obtain a source domain sample set and a target domain sample set, and passes the source domain sample set to the source domain gas detection model, and passes the target domain sample set to the target domain gas detection model;
[0010] Step 4: using the source domain sample set to train the source domain gas detection model to obtain optimal parameters of the source domain gas detection model;
[0011] Step 5: Migrate the optimal parameters to the target domain gas detection model through a parameter sharing transfer learning method, align the features of the source domain sample set and the target domain sample set using a feature adaptive transfer learning method, and then fine-tune the target domain gas detection model parameters;
[0012] Step 6: using the target domain sample set to train the fine-tuned target domain gas detection model to obtain a trained target domain gas detection model;
[0013] Step 7: The gas signal acquisition module acquires the mixed gas data to be detected, and passes the mixed gas data to be detected to the preprocessing module for preprocessing operations, obtains the data to be detected and passes it to the trained target domain gas detection model;
[0014] Step 8: The trained target domain gas detection model performs gas detection on the data to be detected and outputs the gas detection result.
[0015] Through the above design, the knowledge learned from the large source domain dataset is transferred to the small target domain dataset through the transfer learning method based on parameter sharing and feature adaptation, which can alleviate the problem of insufficient target domain data and reduce the dependence of the gas detection model on large-scale target domain labeled data, thereby improving the performance of the model on small sample data.
[0016] Preferably, in step 1, the source domain gas detection model and the target domain gas detection model have the same structure, and are both provided with an input layer, a convolution module, an LSTM module and an output layer connected in sequence;
[0017] The convolution module is provided with a first 4×4 convolution layer, a first dropout layer, a 3×3 convolution layer, a second dropout layer, a second 4×4 convolution layer and a third dropout layer connected in sequence, and the output ends of the first 4×4 convolution layer, the 3×3 convolution layer and the second 4×4 convolution layer are all built-in with a ReLU activation function;
[0018] The LSTM module is provided with a first long short-term memory network and a second long short-term memory network connected in sequence, and the hidden layer size of the first long short-term memory network and the second long short-term memory network is 128;
[0019] The output layer is provided with a flattening layer and a fully connected layer which are connected in sequence.
[0020] Through the above design, a specific network architecture and training strategy based on CNN-LSTM was constructed to capture the concentration variation law and specific gas components in the mixed gas, thereby improving the accuracy and robustness of the model.
[0021] Preferably, a Softmax activation function is built into the output end of the fully connected layer.
[0022] If the mixed gas concentration detection task, that is, the regression task, is performed, the output end of the fully connected layer does not contain the Softmax function; if the mixed gas classification detection task is performed, the output end of the fully connected layer contains the Softmax function.
[0023] Preferably, in step 3 and step 7, the preprocessing operation includes but is not limited to missing value processing, data normalization processing, and time series sliding window;
[0024] The data normalization process includes but is not limited to minimum-maximum normalization, Z-score normalization and decimal scaling normalization.
[0025] The formula for Z-score normalization is as follows:
[0026]
[0027] Among them, Z represents the original feature data, μ represents the mean of the original feature data, σ represents the standard deviation of the original feature data, and Z norm Represents the Z-score normalized value.
[0028] The data normalization process is used to eliminate the dimensional influence of the sensor response value, ensure that the model can effectively converge and improve the calculation efficiency.
[0029] Data preprocessing is a critical step in data analysis and deep learning. It involves cleaning, transforming, and preparing raw data to ensure the quality of the dataset and thus improve the performance and accuracy of the model.
[0030] Preferably, in step 5, the feature adaptive transfer learning method is to align the feature distributions of the source domain sample set and the target domain sample set by using the MMD method. The alignment is to map the source domain sample set and the target domain sample set to RKHS by using MMD, and to complete the alignment operation by reducing the MMD value. The expression is as follows:
[0031]
[0032] Among them, X S represents the source domain sample set, X T represents the target domain sample set, n S Represents the number of source domain samples, n T represents the number of samples in the target domain, represents the Gaussian kernel function, ‖·‖ represents the L2 norm, and i represents the i-th sample.
[0033] First, the source domain sample set and the target domain sample set are mapped to RKHS. Then, the mean embedding difference of the two distributions in this space is calculated. Through the optimization process, the MMD value is reduced, so that the distributions of the source domain and the target domain are closer, that is, the distance between them is reduced. This process helps the model better adapt to the target domain data, thereby improving its performance on the target domain.
[0034] Preferably, in step 5, the optimal parameters are all weights and bias parameters of the trained source domain gas detection model, and the migrated optimal parameters are fine-tuned in the target domain gas detection model to adapt it to the target domain sample set;
[0035] In the process of fine-tuning the optimal parameters, the weights of the 3×3 convolutional layer, the second 4×4 convolutional layer, and the weight matrix of the second long short-term memory network in the target domain gas detection model are frozen, and the weight W of the first 4×4 convolutional layer is not frozen. m,n,r,z And the weight matrix of the first long short-term memory network [W i ,W f ,W C ,W o ] T .
[0036] During the fine-tuning process, it is necessary to select the frozen layer according to the difference between the source domain data and the target domain data, and verify different frozen layer configurations to observe the performance of this configuration on the verification set. The fine-tuned target domain gas detection model can be trained more quickly on the target domain sample set.
[0037] The selection strategy of frozen layers is crucial in transfer learning, which directly affects the performance and training efficiency of the model. The present invention mainly selects frozen layers based on experience, and verifies the performance of different frozen layer configurations on the validation set through experiments.
[0038] Preferably, the parameter fine-tuning expression of the first 4×4 convolutional layer is as follows:
[0039]
[0040] Among them, Y p,q,rrepresents the value of the rth channel at the (p, q)th position in the output feature map of the first 4×4 convolutional layer, X represents the input feature map of the first 4×4 convolutional layer, b represents the bias, M×N represents the convolution kernel size, (m, n) represents the convolution kernel position, r represents the output channel, and z represents the input channel;
[0041] The parameter fine-tuning expression of the first long short-term memory network is as follows:
[0042] Sigmoid layer of input gate:
[0043] i t =σ(W i ·[h t-1 ,x t ]+b i )
[0044] Forget Gate:
[0045] f t =σ(W f ·[h t-1 ,x t ]+b f )
[0046] Tanh layer of input gate:
[0047]
[0048] Sigmoid layer of output gate:
[0049] o t =σ(W o ·[h t-1 ,x t ]+b o )
[0050] Among them, i t Represents the Sigmoid activation value of the input gate, f t Represents the Sigmoid activation value of the forget gate, represents the tanh activation value of the input gate, o t represents the Sigmoid activation value of the output gate, t represents the current time, h represents the hidden state, and x t represents the input feature map of the first long short-term memory network, σ represents the Sigmoid activation function, and tanh represents the tanh activation function;
[0051] The transfer learning process of the target domain gas detection model is expressed as follows:
[0052] θ T =θ S +Δθ
[0053] Among them, θ T represents the parameters of the target domain gas detection model, θ S represents the optimal parameters of the gas detection model in the source domain, and Δθ represents the parameter change after fine-tuning in the target domain.
[0054] Preferably, the gas detection result is a mixed gas concentration detection result, the fully connected layer outputs the mixed gas concentration detection result, and the mixed gas concentration detection result is a one-dimensional vector composed of mixed gas concentration values, and the number on each vector position in the one-dimensional vector corresponds to a gas concentration value in the mixed gas.
[0055] Preferably, the gas detection result is a mixed gas classification detection result, the fully connected layer outputs the mixed gas classification detection result through a Softmax activation function, and the mixed gas classification detection result is a classification label corresponding to one or more gas categories in the mixed gas.
[0056] Preferably, in step 6, during the training of the target domain gas detection model, the calculated MMD value is added to the loss function of the target domain gas detection model, the optimizer adopts Adam, the learning rate is set to 0.001, and the cosine annealing scheduling algorithm is combined for adjustment;
[0057] In the training of mixed gas concentration detection task, the reconstructed mean square error loss function is used; in the training of mixed gas classification detection task, the cross entropy loss function is used.
[0058] Beneficial effects of the present invention:
[0059] 1. Use transfer learning optimization algorithm model based on parameter sharing and feature adaptation: By pre-training the neural network on a large-scale general gas dataset, it is migrated to a small sample mixed gas dataset for model parameter fine-tuning and domain adaptation in the training phase, thereby significantly reducing the need for a large amount of specific mixed gas experimental data;
[0060] 2. Customized design of deep neural network: We developed a specific network architecture and training strategy based on CNN-LSTM to capture the concentration variation patterns and specific gas components in mixed gases, thereby improving the accuracy and robustness of the model;
[0061] 3. Comprehensive utilization of multi-source data sets: By experimenting with different carbon monoxide (CO) and ethylene (C2H4) mixed gas data sets and sulfur dioxide (SO2) and hydrogen sulfide (H2S) mixed gas data sets, the adaptability and generalization ability of the model in mixed gas detection tasks under different environments are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1It is a flowchart of the present invention;
[0063] Figure 2 This is a schematic diagram of parameter sharing transfer learning in the embodiment;
[0064] Figure 3 It is a schematic diagram of the gas detection model structure;
[0065] Figure 4 This is a schematic diagram of the feature adaptive transfer learning principle in the embodiment;
[0066] Figure 5 Schematic diagram of data preprocessing. DETAILED DESCRIPTION
[0067] The present invention is further described in detail below in conjunction with the accompanying drawings and specific examples. The following examples or drawings are used to illustrate the present invention, but are not used to limit the scope of the present invention.
[0068] like Figure 1 As shown: A mixed gas detection method based on parameter-feature transfer learning includes the following steps:
[0069] Step 1: construct a mixed gas detection system based on parameter-feature transfer learning, wherein the mixed gas detection system is provided with a gas signal acquisition module, the gas signal acquisition module is connected to a preprocessing module, and the preprocessing module is connected to a source domain gas detection model and a target domain gas detection model;
[0070] Step 2: The gas signal acquisition module acquires the source domain data set and the target domain data set, and passes them to the preprocessing module;
[0071] Step 3: The preprocessing module performs preprocessing operations on the source domain data set and the target domain data set respectively to obtain a source domain sample set and a target domain sample set, and passes the source domain sample set to the source domain gas detection model, and passes the target domain sample set to the target domain gas detection model;
[0072] Step 4: using the source domain sample set to train the source domain gas detection model to obtain optimal parameters of the source domain gas detection model;
[0073] Step 5: Migrate the optimal parameters to the target domain gas detection model through a parameter sharing transfer learning method, align the features of the source domain sample set and the target domain sample set using a feature adaptive transfer learning method, and then fine-tune the target domain gas detection model parameters;
[0074] Step 6: using the target domain sample set to train the fine-tuned target domain gas detection model to obtain a trained target domain gas detection model;
[0075] Step 7: The gas signal acquisition module acquires the mixed gas data to be detected, and passes the mixed gas data to be detected to the preprocessing module for preprocessing operations, obtains the data to be detected and passes it to the trained target domain gas detection model;
[0076] Step 8: The trained target domain gas detection model performs gas detection on the data to be detected and outputs the gas detection result.
[0077] Further, such as Figure 3 As shown, the source domain gas detection model and the target domain gas detection model have the same structure, and are both provided with an input layer, a convolution module, an LSTM module and an output layer connected in sequence;
[0078] The convolution module is provided with a first 4×4 convolution layer, a first dropout layer, a 3×3 convolution layer, a second dropout layer, a second 4×4 convolution layer and a third dropout layer connected in sequence, and the output ends of the first 4×4 convolution layer, the 3×3 convolution layer and the second 4×4 convolution layer are all built-in with a ReLU activation function;
[0079] The LSTM module is provided with a first long short-term memory network and a second long short-term memory network connected in sequence;
[0080] The output layer is provided with a flattening layer and a fully connected layer which are connected in sequence.
[0081] Furthermore, the gas detection result is a mixed gas concentration detection result, and the fully connected layer outputs the mixed gas concentration detection result. The mixed gas concentration detection result is a one-dimensional vector composed of mixed gas concentration values, and the number on each vector position in the one-dimensional vector corresponds to a gas concentration value in the mixed gas.
[0082] Furthermore, a Softmax activation function is built into the output end of the fully connected layer.
[0083] Furthermore, the gas detection result is a mixed gas classification detection result, and the fully connected layer outputs the mixed gas classification detection result through a Softmax activation function, and the mixed gas classification detection result is a classification label corresponding to one or more gas categories in the mixed gas.
[0084] Furthermore, in step 3 and step 7, the preprocessing operations include but are not limited to missing value processing, data normalization processing, and time series sliding window;
[0085] The data normalization process includes but is not limited to minimum-maximum normalization, Z-score normalization and decimal scaling normalization.
[0086] Further, such as Figure 4As shown, in step 5, the feature adaptive transfer learning method is to align the feature distributions of the source domain sample set and the target domain sample set by the MMD method. The alignment is to map the source domain sample set and the target domain sample set to RKHS by using MMD, and complete the alignment operation by reducing the MMD value. The expression is as follows:
[0087]
[0088] Among them, X S represents the source domain sample set, X T represents the target domain sample set, n S Represents the number of source domain samples, n T represents the number of samples in the target domain, represents the Gaussian kernel function, ‖·‖ represents the L2 norm, and i represents the i-th sample.
[0089] In step 6, during the training of the target domain gas detection model, the calculated MMD value is added to the loss function of the target domain gas detection model, the optimizer adopts Adam, the learning rate is set to 0.001, and the cosine annealing scheduling algorithm is combined for adjustment;
[0090] In the training of mixed gas concentration detection task, the reconstructed mean square error loss function is used; in the training of mixed gas classification detection task, the cross entropy loss function is used.
[0091] Further, such as Figure 2 As shown, in step 5, the optimal parameters are all weights and bias parameters of the trained source domain gas detection model, and the optimal parameters after migration are fine-tuned in the target domain gas detection model to adapt it to the target domain sample set;
[0092] In the process of fine-tuning the optimal parameters, the weights of the 3×3 convolutional layer, the second 4×4 convolutional layer, and the weight matrix of the second long short-term memory network in the target domain gas detection model are frozen, and the weight W of the first 4×4 convolutional layer is not frozen. m,n,r,z And the weight matrix of the first long short-term memory network [W i ,W f ,W C ,W o ] T .
[0093] Furthermore, the parameter fine-tuning expression of the first 4×4 convolutional layer is as follows:
[0094]
[0095] Among them, Y p,q,rrepresents the value of the rth channel at the (p, q)th position in the output feature map of the first 4×4 convolutional layer, X represents the input feature map of the first 4×4 convolutional layer, b represents the bias, M×N represents the convolution kernel size, (m, n) represents the convolution kernel position, r represents the output channel, and z represents the input channel;
[0096] The parameter fine-tuning expression of the first long short-term memory network is as follows:
[0097] Sigmoid layer of input gate:
[0098] i t =σ(W i ·[h t-1 ,x t ]+b i )
[0099] Forget Gate:
[0100] f t =σ(W f ·[h t-1 ,x t ]+b f )
[0101] Tanh layer of input gate:
[0102]
[0103] Sigmoid layer of output gate:
[0104] o t =σ(W o ·[h t-1 ,x t ]+b o )
[0105] Among them, i t Represents the Sigmoid activation value of the input gate, f t Represents the Sigmoid activation value of the forget gate, represents the tanh activation value of the input gate, o t represents the Sigmoid activation value of the output gate, t represents the current time, h represents the hidden state, and x t represents the input feature map of the first long short-term memory network, σ represents the Sigmoid activation function, and tanh represents the tanh activation function;
[0106] The transfer learning process of the target domain gas detection model is expressed as follows:
[0107] θ T =θ S +Δθ
[0108] Among them, θ T represents the parameters of the target domain gas detection model, θ S represents the optimal parameters of the gas detection model in the source domain, and Δθ represents the parameter change after fine-tuning in the target domain.
[0109] In this embodiment, the source domain data set contains two mixed gases, CO and C2H4, the number of processed samples exceeds 2000, and the training of the source domain gas detection model is performed on multiple gas concentration samples.
[0110] The target domain dataset contains two mixed gases, namely CO and C2H4 in target domain I, and SO2 and H2S in target domain II. The acquisition environments of the two target domains are different, and the number of processed samples is less than 700, including gas concentration data under different environmental conditions.
[0111] For the source domain, the source domain data has a total of 4178504 samples, and the sampling frequency is 100Hz. The present invention takes every 100 seconds as a sample and performs downsampling. Each sample contains 16 feature vectors, so the total number of samples is 233, and the size of each sample is 100×16. Since the concentration of the source domain is randomly released within a specific range, this may lead to an uneven distribution of concentration labels, with more samples for some labels and fewer samples for other labels, or even no samples. In order to enable the neural network to be trained effectively, this paper performs data enhancement on the source domain dataset. Specifically, the time sliding window method is used for data enhancement, such as Figure 5 As shown, the size of the sliding window is defined as 90 seconds and the sliding step is 1 second. After data enhancement, the total number of samples increased to 2563. After processing the sample data set, the relevant concentration labels are stored in a two-dimensional array, where the first column of the array represents the concentration of CO, and the concentration range is set to 0-600ppm; the second column represents the concentration of C2H4, and the concentration range is set to 0-20ppm. The size of the array is 233×2. The classification labels are divided into the following four categories: when both CO and C2H4 have no concentration, it is marked as 0; when CO has concentration and C2H4 has no concentration, it is marked as 1; when CO has no concentration and C2H4 has concentration, it is marked as 2; when both CO and C2H4 have concentration, it is marked as 3.
[0112] For the target domain I, there are 90 samples, each sample is sampled for 300 seconds and contains 8 feature vectors. In order to keep consistent with the shape of the source domain samples, the sampling time is downsampled, the time step is shortened to 90 seconds, and the 8 feature vectors are copied and concatenated to the last dimension, so that the number of feature vectors for each sample is increased to 16. Therefore, the size of each sample becomes 90×16. After completing the data preprocessing, a total of 90 samples are obtained in the target domain. The concentration labels of the target domain I include the concentration of C2H4 and the concentration of CO, which are stored in the first and second columns respectively, and the size of the label array is 90×2. At the same time, the classification labels are also processed accordingly according to the processing method of the source domain.
[0113] In the target domain II, the dataset has a total of 616 samples, each sample is sampled for 2400 seconds and contains 10 feature vectors. In order to better perform transfer learning, each sample is first expanded into a one-dimensional array, and then 1440 elements are randomly selected and reshaped into a 90×16 shape to align with the source domain samples. The concentration labels of the target domain II include the concentrations of SO2 and H2S, which are stored in the first and second columns of the array, respectively. The size of the label array is 616×2. At the same time, the classification labels are marked according to the following four categories: when both SO2 and H2S have no concentration, it is marked as 0; when SO2 has concentration and H2S has no concentration, it is marked as 1; when SO2 has no concentration and H2S has concentration, it is marked as 2; when both SO2 and H2S have concentration, it is marked as 3.
[0114] Next, the performance of the target domain gas detection model is verified:
[0115] In the gas concentration detection task, the evaluation indicators used are: mean square error (MSE), root mean square error (RMSE), mean absolute error (MAE) and determination coefficient (R 2 ), the expression is as follows:
[0116]
[0117] Where n represents the number of mixed gas samples, y i represents the true concentration value of a single gas in the i-th sample, and It represents the predicted concentration value of a single gas in the i-th sample by the model, SS res Represents the residual sum of squares, SS tot Represents the total sum of squares.
[0118] In the gas classification detection task, the evaluation indicators used are: Accuracy, Precision, Recall and F1 Score, which are expressed as follows:
[0119]
[0120] Among them, TP i Indicates the number of samples correctly predicted by the model as class i, FP i Indicates the number of samples that the model incorrectly predicts as class i, but does not actually belong to class i, FN i It indicates the number of samples that the model mistakenly did not predict as class i, but actually belong to class i.
[0121] The target domain gas detection model and a variety of comparison models were used to conduct multiple experiments and verifications on target domain I and target domain II, and the results are respectively included in Tables 1 and 2.
[0122] Table 1 Evaluation indicators of target domain I
[0123]
[0124] Among them, RF represents the random forest model, KNN represents the K nearest neighbor classification algorithm model, CNN represents the convolutional neural network model, LSTM represents the long short-term memory network model, CNN-LSTM(N) represents the gas detection model without transfer learning, CNN-LSTM(F) represents the gas detection model that performs transfer learning but only uses the initial weights of the source domain, and CNN-LSTM represents the target domain gas detection model.
[0125] Table 2 Evaluation metrics for target domain II
[0126]
[0127]
[0128] It can be seen from Table 1 and Table 2 that the present invention has 2 The value and accuracy of the comparison model show obvious advantages. This is mainly due to the transfer learning method of parameter sharing and feature adaptation adopted in the present invention, which can effectively reduce the dependence on high-quality and large amounts of data, while improving the wide applicability of the model. The comparison model failed to adopt the technical solution proposed by the present invention, resulting in obvious disadvantages in the above performance tests. This further proves the necessity of the technical solution defined in the present invention to achieve the expected technical effects and solve technical problems.
[0129] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A mixed gas detection method based on parameter-feature transfer learning, characterized in that: The following steps are involved: Step 1: construct a mixed gas detection system based on parameter-feature transfer learning, wherein the mixed gas detection system is provided with a gas signal acquisition module, the gas signal acquisition module is connected to a preprocessing module, and the preprocessing module is connected to a source domain gas detection model and a target domain gas detection model; Step 2: The gas signal acquisition module acquires the source domain data set and the target domain data set, and passes them to the preprocessing module; Step 3: The preprocessing module performs preprocessing operations on the source domain data set and the target domain data set respectively to obtain a source domain sample set and a target domain sample set, and passes the source domain sample set to the source domain gas detection model, and passes the target domain sample set to the target domain gas detection model; Step 4: using the source domain sample set to train the source domain gas detection model to obtain optimal parameters of the source domain gas detection model; Step 5: Migrate the optimal parameters to the target domain gas detection model through a parameter sharing transfer learning method, align the features of the source domain sample set and the target domain sample set using a feature adaptive transfer learning method, and then fine-tune the target domain gas detection model parameters; Step 6: using the target domain sample set to train the fine-tuned target domain gas detection model to obtain a trained target domain gas detection model; Step 7: The gas signal acquisition module acquires the mixed gas data to be detected, and passes the mixed gas data to be detected to the preprocessing module for preprocessing operations, obtains the data to be detected and passes it to the trained target domain gas detection model; Step 8: The trained target domain gas detection model performs gas detection on the data to be detected and outputs the gas detection result.
2. The mixed gas detection method based on parameter-feature transfer learning according to claim 1 is characterized in that: In the step 1, the source domain gas detection model and the target domain gas detection model have the same structure, and are both provided with an input layer, a convolution module, an LSTM module and an output layer connected in sequence; The convolution module is provided with a first 4×4 convolution layer, a first dropout layer, a 3×3 convolution layer, a second dropout layer, a second 4×4 convolution layer and a third dropout layer connected in sequence, and the output ends of the first 4×4 convolution layer, the 3×3 convolution layer and the second 4×4 convolution layer are all built-in with a ReLU activation function; The LSTM module is provided with a first long short-term memory network and a second long short-term memory network connected in sequence; The output layer is provided with a flattening layer and a fully connected layer which are connected in sequence.
3. The mixed gas detection method based on parameter-feature transfer learning according to claim 2 is characterized in that: The output end of the fully connected layer has a built-in Softmax activation function.
4. The mixed gas detection method based on parameter-feature transfer learning according to claim 1 is characterized in that: In step 3 and step 7, the preprocessing operations include but are not limited to missing value processing, data normalization processing, and time series sliding window; The data normalization process includes but is not limited to minimum-maximum normalization, Z-score normalization and decimal scaling normalization.
5. The mixed gas detection method based on parameter-feature transfer learning according to claim 1, characterized in that: In step 5, the feature adaptive transfer learning method is to align the feature distributions of the source domain sample set and the target domain sample set by using the maximum mean difference MMD method. The alignment is to map the source domain sample set and the target domain sample set to the reproducing kernel Hilbert space RKHS by using the maximum mean difference MMD, and complete the alignment operation by reducing the MMD value. The expression is as follows: Among them, X S represents the source domain sample set, X T represents the target domain sample set, n S Represents the number of source domain samples, n T represents the number of samples in the target domain, represents the Gaussian kernel function, ‖·‖ represents the L2 norm, and i represents the i-th sample.
6. The mixed gas detection method based on parameter-feature transfer learning according to claim 2 is characterized in that: In step 5, the optimal parameters are all weights and bias parameters of the trained source domain gas detection model, and the optimal parameters after migration are fine-tuned in the target domain gas detection model to adapt it to the target domain sample set; In the process of fine-tuning the optimal parameters, the weights of the 3×3 convolutional layer, the second 4×4 convolutional layer, and the weight matrix of the second long short-term memory network in the target domain gas detection model are frozen, and the weight W of the first 4×4 convolutional layer is not frozen. m,n,r,z And the weight matrix of the first long short-term memory network [W i ,W f ,W C ,W o ] T .
7. The mixed gas detection method based on parameter-feature transfer learning according to claim 6 is characterized in that: The parameter fine-tuning expression of the first 4×4 convolutional layer is as follows: Among them, Y p,q,r represents the value of the rth channel at the (p, q)th position in the output feature map of the first 4×4 convolutional layer, X represents the input feature map of the first 4×4 convolutional layer, b represents the bias, M×N represents the convolution kernel size, (m, n) represents the convolution kernel position, r represents the output channel, and z represents the input channel; The parameter fine-tuning expression of the first long short-term memory network is as follows: Sigmoid layer of input gate: i t =σ(W i ·[h t-1 ,x t ]+b i ) Forget Gate: f t =σ(W f ·[h t-1 ,x t ]+b f ) Tanh layer of the input gate: Sigmoid layer of output gate: the t =σ(W o ·[h t-1 ,x t ]+b o ) Among them, i t Represents the Sigmoid activation value of the input gate, f t Represents the Sigmoid activation value of the forget gate, represents the tanh activation value of the input gate, o t represents the Sigmoid activation value of the output gate, t represents the current time, h represents the hidden state, and x t represents the input feature map of the first long short-term memory network, σ represents the Sigmoid activation function, and tanh represents the tanh activation function; The transfer learning process of the target domain gas detection model is expressed as follows: i T =θ S +Δθ Among them, θ T represents the parameters of the target domain gas detection model, θ S represents the optimal parameters of the gas detection model in the source domain, and Δθ represents the parameter change after fine-tuning in the target domain.
8. The mixed gas detection method based on parameter-feature transfer learning according to claim 2 is characterized in that: The gas detection result is a mixed gas concentration detection result. The fully connected layer outputs the mixed gas concentration detection result. The mixed gas concentration detection result is a one-dimensional vector composed of mixed gas concentration values. The number on each vector position in the one-dimensional vector corresponds to a gas concentration value in the mixed gas.
9. The mixed gas detection method based on parameter-feature transfer learning according to claim 3 is characterized in that: The gas detection result is a mixed gas classification detection result. The fully connected layer outputs the mixed gas classification detection result through the Softmax activation function. The mixed gas classification detection result is a classification label corresponding to one or more gas categories in the mixed gas.
10. The mixed gas detection method based on parameter-feature transfer learning according to claim 5, characterized in that: In step 6, during the training of the target domain gas detection model, the calculated MMD value is added to the loss function of the target domain gas detection model, the optimizer adopts Adam, the learning rate is set to 0.001, and the cosine annealing scheduling algorithm is combined for adjustment; In the training of mixed gas concentration detection task, the reconstructed mean square error loss function is used; in the training of mixed gas classification detection task, the cross entropy loss function is used.
Citation Information
Cited By
Self-learning combustible explosion gas measurement method and system based on virtual mixed sample
CN122157885A
