Electronic nose humidity compensation method based on auto-encoder and domain adaptation
By using autoencoders and domain adaptation technology in the electronic nose system, we build a feature extractor model and a multi-task learning module, which solves the problem of reduced recognition accuracy of the electronic nose system under humidity changes and achieves higher recognition accuracy. And adaptability, suitable for gas analysis in changing environments.
Patent Information
- Application Number
- CN202410595811.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-14
- Publication Date
- 2024-08-23
AI Technical Summary
The accuracy and reliability of existing electronic nose systems in identifying odors decreases in environments with changing humidity. Especially in high-humidity environments, such as marine gas detection, food processing, or environmental monitoring, it is difficult to effectively compensate for the impact of humidity on the sensor.
An electronic nose humidity compensation method based on autoencoders and domain adaptation is adopted, through data preprocessing, feature extractor model construction and multi-task learning modules, including encoders, decoders and multi-task learning modules, combined with min-max normalization and Gradient inversion layer to achieve feature extraction from sensor data and robustness to humidity conditions.
Significantly improves the odor recognition accuracy and reliability of the electronic nose system in a humidity-changing environment, enhances the adaptability and scalability of the system, reduces dependence on high-cost sensors, optimizes data processing efficiency, and extends to other sensors in the system.
Smart Images

Figure CN118535967A
Abstract
Description
Technical Field
[0001] The invention relates to an electronic nose for gas identification and analysis, and in particular to an electronic nose humidity compensation method based on an autoencoder and domain adaptation. Background Art
[0002] An electronic nose is a device that simulates the human olfactory system and is designed to detect and identify a variety of odors. It simulates the olfactory receptors in the human nasal cavity through a series of gas sensors, and uses pattern recognition algorithms to analyze and identify the characteristics of different odors. Typically, an electronic nose system consists of a gas sensor array, a signal processing unit, and a pattern recognition algorithm. The gas sensor array is responsible for capturing gas samples and converting them into electrical signals. These sensors can be optimized for specific gases or odors, or they can be sensitive to multiple odors. The signal processing unit is responsible for processing the signals generated by the sensors, amplifying, filtering, and digitizing them for subsequent pattern recognition analysis. The pattern recognition algorithm analyzes and compares the processed signals, identifies the characteristic patterns of different odors, and matches them with pre-built odor models to ultimately determine the type of odor present in the sample.
[0003] Electronic nose systems play an important role in odor recognition and analysis. However, there are still some problems for electronic nose systems to cope with the challenges of different humidity environments. Existing pattern recognition algorithms are only applicable to conditions with constant humidity. Once the humidity of the target gas changes, the classification accuracy of the model may decrease, which in turn affects the accuracy and reliability of the electronic nose system. This problem is particularly prominent in high humidity environments, such as marine gas detection, food processing or environmental monitoring.
[0004] At present, some methods have been proposed to improve semiconductor gas sensors affected by humidity changes, including humidity compensation and sensor calibration. However, these methods are all for a single sensor, and the humidity compensation method of a single sensor is difficult to directly apply to the humidity compensation of an electronic nose. There is currently a lack of humidity compensation methods for an electronic nose system composed of multiple sensors. Therefore, a method for humidity compensation of the entire electronic nose is needed to improve the stability and accuracy of the electronic nose system in an environment with changing humidity. Summary of the invention
[0005] In order to solve the above technical problems, the present invention aims to provide an electronic nose humidity compensation method based on autoencoder and domain adaptation to address the performance problems of traditional electronic nose systems in humidity changing environments, thereby achieving more accurate and stable odor recognition.
[0006] The present invention provides an electronic nose humidity compensation method based on autoencoder and domain adaptation, comprising the following steps:
[0007] 1. Data preprocessing
[0008] Converting raw sensor data into a format suitable for processing by machine learning models involves the following aspects:
[0009] 1. Data collection: A certain amount of gas detection data under different environmental conditions is collected from the electronic nose system, wherein the different environmental conditions include different humidity conditions, and the data includes the original response value of the sensor, as well as the corresponding gas type label and humidity condition label, to form a data set;
[0010] 2. Data cleaning: Check the missing values or outliers in the data set and handle them accordingly: replace missing values with the average value of adjacent points and delete outliers;
[0011] 3. Data standardization: Since the response range of different sensors may be different, directly using this data may cause unstable model training or bias towards certain specific sensors. Therefore, the data needs to be standardized, and the methods used include minimum-maximum standardization or Z-score standardization.
[0012] Furthermore, the present invention uses a minimum-maximum normalization method to normalize all values in the data set to between 0 and 1, so as to make comparison and analysis easier. The minimum-maximum normalization formula is shown in formula (1):
[0013]
[0014] In the formula, G norm is the standardized value, G is the original data value, G min is the minimum value in the data set, G max is the maximum value in the data set.
[0015] (II) Feature Extractor Model Construction
[0016] The feature extractor model construction is the core part of the present invention, which involves the design of the autoencoder and the implementation of the domain adaptation mechanism. The autoencoder is an unsupervised learning model for learning effective representations of data (encoding) and then reconstructing data from these representations (decoding). In the present invention, the autoencoder is not only used for feature extraction, but also combines domain adaptation technology to improve the robustness of the model under different humidity conditions. The model includes an encoder, a decoder and a multi-task learning module, and the output of the encoder is connected to the input of the decoder and the multi-task learning module.
[0017] (1) Encoder
[0018] The encoder is composed of several convolutional layers and pooling layers, which are responsible for compressing high-dimensional sensor data into low-dimensional feature vectors;
[0019] Furthermore, the encoder of the present invention includes three convolutional layers and a maximum pooling layer, and the specific parameters are as follows:
[0020] The first convolution layer uses 8 11x3 kernels, the activation function is ELU, the padding is set to same, the output size is kept consistent with the input size, L2 regularization is used with a coefficient of 0.001, followed by batch normalization;
[0021] The first layer of maximum pooling: use a 2x2 pooling window and set padding to the same;
[0022] The second convolution layer uses 12 5x1 convolution kernels, the activation function is ELU, the padding is set to same, L2 regularization is used, the coefficient is 0.001, and batch normalization is followed;
[0023] Second layer of maximum pooling: use a 2x2 pooling window and set padding to the same;
[0024] The third convolution layer uses 24 3x1 convolution kernels, the activation function is ELU, the padding is set to same, L2 regularization is used, the coefficient is 0.001, and batch normalization is performed.
[0025] The third layer of maximum pooling: a 2x2 pooling window is used, and padding is set to same; the output is marked as encoded, indicating the encoded features.
[0026] The mathematical expression of the ELU activation function is shown in formula (2):
[0027]
[0028] Where X is the input value, α is the negative semi-axis slope of the ELU activation function, which controls the tilt of the linear part on the negative semi-axis, and e is the base of the natural logarithm.
[0029] (2) Decoder
[0030] The structure of the decoder is symmetrical to that of the encoder, and consists of several convolutional layers and upsampling layers, which are responsible for reconstructing the low-dimensional feature vector into an output of the same dimension as the original sensor data for calculating the reconstruction loss.
[0031] Furthermore, the decoder structure of the present invention includes a convolution layer and an upsampling layer, and the specific parameters are as follows:
[0032] The first convolution layer: uses 24 3x1 convolution kernels, the activation function is ELU, and the padding is set to the same;
[0033] The first layer upsampling: use 2x2 upsampling size;
[0034] The second convolution layer uses 12 5x1 convolution kernels, the activation function is ELU, and the padding is set to the same;
[0035] The second layer upsampling: uses 2x2 upsampling size;
[0036] The third convolution layer: uses 8 11x3 convolution kernels, the activation function is ELU, and the padding is set to the same;
[0037] The third layer upsampling: uses 2x2 upsampling size;
[0038] Output layer convolution: Use a 3x1 convolution kernel, Sigmoid activation function, and same padding. This layer generates the final reconstructed output, which has the same size as the original input. The mathematical expression of the Sigmoid activation function is shown in formula (3):
[0039]
[0040] Where X is the input value and e is the base of the natural logarithm.
[0041] (3) Multi-task learning module
[0042] Based on the autoencoder, the multi-task learning module adopted in the present invention includes a main task and an auxiliary task. The main task and the auxiliary task are performed in parallel, and the gas type classification and humidity condition prediction are performed simultaneously, which can not only improve the performance of the model, but also enable the model to improve its understanding and prediction ability of another task while learning one task.
[0043] The main task is to classify the gas type based on the encoded features. The goal of this task is to accurately identify the type of gas. The corresponding output layer is a fully connected layer, which uses the Softmax activation function to output the probability of each type of gas. The mathematical expression of the Softmax activation function is shown in formula (4):
[0044]
[0045] Where, X i is the i-th element in the input vector, and e is the base of the natural logarithm;
[0046] The auxiliary task is to predict the current humidity conditions, including three fully connected layers, which deal with the classification of humidity conditions. The activation function of the first two fully connected layers is ELU, and the activation function of the last fully connected layer is softmax.
[0047] Furthermore, in order to achieve the domain adaptation capability of the feature extractor model, a domain adaptation layer is designed: a gradient reversal layer is added to the input of the auxiliary task, which does not change the data during forward propagation, but reverses the gradient during backpropagation, that is, multiplies it by a negative scalar; this operation forces the model to learn not only the features that distinguish different humidity conditions, but also the general features that are insensitive to these conditions, extracting features unrelated to humidity from the sensor data, thereby enhancing the adaptability and generalization ability of the model in different environments.
[0048] (III) Feature Extractor Model Training and Optimization
[0049] The training process of the model involves multi-task learning, which includes reconstruction tasks, gas type classification tasks, and humidity condition classification tasks. The training process steps are as follows:
[0050] (1) Data division: divide the data into training set and test set;
[0051] (2) Model construction: Create a function to build the model, which accepts the input shape, number of categories, and number of humidity conditions as parameters, and builds a complete model containing an encoder, a decoder, and two classification tasks;
[0052] (3) Compiled model: The model is compiled using an optimizer, using a combined loss function that includes mean squared error (for the reconstruction task) and sparse categorical cross entropy (for the two classification tasks). This combined loss function enables the model to simultaneously learn to reconstruct the input data and make classification predictions;
[0053] (4) Model training: Input training data and corresponding labels to train the model, including reconstructed input data, gas type labels, and humidity condition labels. During the training process, the performance of the model is also monitored through the validation set to prevent overfitting.
[0054] (5) Optimization algorithm: Select a suitable optimization algorithm to adjust the model parameters and iteratively update the model weights to minimize the loss function;
[0055] 4. Classification model construction and evaluation
[0056] The classification model construction and evaluation process includes the following steps:
[0057] (1) Data loading and preprocessing: First, load the dataset, including data and gas category labels; preprocess the data, including reshaping the data to fit the model input and normalizing it to ensure that the minimum value of the data is 0 and the maximum value is 1;
[0058] (2) Feature extraction: Load the pre-trained feature extractor model and use this model to extract features from the pre-processed data to obtain a low-dimensional feature data set;
[0059] (3) Dataset division: Divide the extracted feature dataset into a training set and a test set;
[0060] (4) Model training: Use random forest classifier for model training;
[0061] (5) Model evaluation: Use the features and labels of the test set to evaluate the classification accuracy of the model;
[0062] (6) Humidity compensation verification: For data under other different humidity conditions, repeat the above steps of data loading and preprocessing, feature extraction and model evaluation; output the classification accuracy under different conditions.
[0063] (V) Performance evaluation
[0064] Performance evaluation was done by testing under various humidity conditions, including comparing the detection accuracy of the model before and after humidity changes, as well as the model's adaptability to unseen humidity conditions. Performance evaluation helped further optimize the model parameters and structure to ensure its effectiveness and reliability in practical applications.
[0065] Beneficial effects of the present invention:
[0066] 1. Improve detection accuracy and reliability: By combining autoencoders and domain adaptation technology, the present invention can effectively compensate for the impact of environmental humidity changes on electronic nose sensors, significantly improving the accuracy and reliability of gas detection. This is particularly important for application scenarios that require accurate gas analysis in a changing environment, such as environmental monitoring, industrial safety and other fields.
[0067] Second, enhance the adaptability of the system: The method of the present invention can not only identify the gas type, but also predict the environmental humidity conditions through a multi-task learning framework, so that the system can adapt to different environmental changes. This adaptability allows the electronic nose system to be deployed in a wider range of application environments without frequent manual adjustments or calibrations.
[0068] 3. Optimize resource utilization efficiency: Through intelligent data processing and feature learning, the present invention reduces the reliance on high-cost, high-precision sensors and reduces the overall cost of the system. At the same time, the use of autoencoders optimizes the data processing process and improves the efficiency and speed of data processing.
[0069] 4. Improve the scalability and flexibility of the system: The model structure of the present invention can be adjusted according to different application requirements, such as adding more sensor types or adjusting the layout of sensors to meet specific detection requirements. This flexibility and scalability facilitates future upgrades and optimizations of the system.
[0070] 5. Promote cross-domain application of technology: The technical solution of the present invention is not only applicable to electronic nose systems, but can also be extended to other types of sensor systems, such as electronic tongues, visual sensors, etc., providing new ideas and methods for solving similar problems in these systems.
[0071] 6. Environmental friendliness and social benefits: By providing more accurate environmental monitoring tools, the present invention helps to timely discover and deal with environmental pollution problems and protect public health and safety. In addition, accurate gas detection can also reduce energy waste and raw material loss in industrial production, with good environmental protection effects and economic benefits.
[0072] In summary, the present invention not only improves the performance and practicality of the electronic nose system through its innovative technical solution, but also provides valuable research results and application practices for related technical fields, and has broad promotion value and social significance. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] Figure 1 Schematic diagram of the feature extractor model of the present invention.
[0074] Figure 2 It is a schematic diagram of the encoder structure of the present invention.
[0075] Figure 3 It is a schematic diagram of the decoder structure of the present invention.
[0076] Figure 4 A schematic diagram of building a classification model for the present invention. DETAILED DESCRIPTION
[0077] This embodiment provides an electronic nose humidity compensation method based on an autoencoder and domain adaptation, comprising the following steps:
[0078] 1. Data preprocessing
[0079] Convert the raw sensor data into a format suitable for processing by the machine learning model. In this embodiment, data preprocessing includes the following aspects:
[0080] 1. Data collection: A certain amount of gas detection data under different environmental conditions is collected from the electronic nose system, wherein the different environmental conditions include different humidity conditions, and the data includes the original response value of the sensor, as well as the corresponding gas type label and humidity condition label, to form a data set;
[0081] 2. Data cleaning: Check the missing values or outliers in the data set and handle them accordingly: replace missing values with the average value of adjacent points and delete outliers;
[0082] 3. Data standardization: Since the response ranges of different sensors may be different, directly using these data may cause unstable model training or bias towards certain specific sensors. Therefore, the data needs to be standardized. This embodiment uses the minimum-maximum standardization method to normalize all values in the data set to between 0 and 1 for easier comparison and analysis. The minimum-maximum standardization formula is shown in formula (1):
[0083]
[0084] In the formula, G norm is the standardized value, G is the original data value, G min is the minimum value in the data set, G max is the maximum value in the data set.
[0085] (II) Feature Extractor Model Construction
[0086] The overall structure of the feature extractor model is shown in the attached figure. Figure 1 As shown, it includes an encoder, a decoder and a multi-task learning module, and the output end of the encoder is connected to the input end of the decoder and the multi-task learning module.
[0087] (1) Encoder
[0088] The encoder is composed of several convolutional layers and pooling layers, which are responsible for compressing high-dimensional sensor data into low-dimensional feature vectors. Figure 2 As shown, it includes three convolutional layers and a maximum pooling layer. The specific parameters are as follows:
[0089] The first convolution layer uses 8 11x3 kernels, the activation function is ELU, the padding is set to same, the output size is kept consistent with the input size, L2 regularization is used with a coefficient of 0.001, followed by batch normalization;
[0090] The first layer of maximum pooling: use a 2x2 pooling window and set padding to the same;
[0091] The second convolution layer uses 12 5x1 convolution kernels, the activation function is ELU, the padding is set to same, L2 regularization is used, the coefficient is 0.001, and batch normalization is followed;
[0092] Second layer of maximum pooling: use a 2x2 pooling window and set padding to the same;
[0093] The third convolution layer uses 24 3x1 convolution kernels, the activation function is ELU, the padding is set to same, L2 regularization is used, the coefficient is 0.001, and batch normalization is performed.
[0094] The third layer of maximum pooling: a 2x2 pooling window is used, and padding is set to same; the output is marked as encoded, indicating the encoded features.
[0095] The ELU (Exponential Linear Unit) activation function used in this embodiment introduces a nonlinear correction term in the negative region compared to RELU, which can avoid the "neuron death" problem in ReLU and enable the model to learn more complex data representations. The mathematical expression of the ELU activation function is shown in formula (2):
[0096]
[0097] Where X is the input value, α is the negative semi-axis slope of the ELU activation function, which is usually taken as 1. It controls the tilt of the linear part on the negative semi-axis, and e is the base of the natural logarithm.
[0098] (2) Decoder
[0099] The structure of the decoder is symmetrical to that of the encoder, and consists of several convolutional layers and upsampling layers, which are responsible for reconstructing the low-dimensional feature vector into an output with the same dimension as the original sensor data. The output of the decoder is a prediction of the original data, which is used to calculate the reconstruction loss. The decoder structure is shown in the attached figure. Figure 3 As shown, it includes convolutional layers and upsampling layers. The specific parameters are as follows:
[0100] The first convolution layer: uses 24 3x1 convolution kernels, the activation function is ELU, and the padding is set to the same;
[0101] The first layer upsampling: use 2x2 upsampling size;
[0102] The second convolution layer uses 12 5x1 convolution kernels, the activation function is ELU, and the padding is set to the same;
[0103] The second layer upsampling: uses 2x2 upsampling size;
[0104] The third convolution layer: uses 8 11x3 convolution kernels, the activation function is ELU, and the padding is set to the same;
[0105] The third layer upsampling: uses 2x2 upsampling size;
[0106] Output layer convolution: Use a 3x1 convolution kernel, Sigmoid activation function, and same padding. This layer generates the final reconstructed output, which has the same size as the original input. The mathematical expression of the Sigmoid activation function is shown in formula (3):
[0107]
[0108] Where X is the input value and e is the base of the natural logarithm.
[0109] This design ensures the symmetry of the encoder and decoder, while achieving feature extraction and reconstruction through a combination of convolutional layers and pooling / upsampling layers.
[0110] (3) Multi-task learning module
[0111] The multi-task learning module includes a main task and an auxiliary task, which are performed in parallel to classify gas types and predict humidity conditions at the same time. The main task is to classify gas types based on the encoded features. The goal of this task is to accurately identify the type of gas. The corresponding output layer is a fully connected layer with 8 neurons. The Softmax activation function is used to output the probability of each type of gas. The mathematical expression of the Softmax activation function is shown in formula (4):
[0112]
[0113] Where, the i-th element in the input vector, e is the base of the natural logarithm;
[0114] The auxiliary task is to predict the current humidity conditions, including three fully connected layers, which deal with the classification of humidity conditions. The number of neurons in the first fully connected layer is 100, the number of neurons in the second fully connected layer is 10, and the number of neurons in the output fully connected layer is 2. The activation functions of the first two fully connected layers are ELU, and the activation function of the last fully connected layer is softmax.
[0115] Furthermore, a gradient reversal layer is added to the input of the auxiliary task. This layer does not change the data during forward propagation, but reverses the gradient during back propagation, that is, multiplies it by a negative scalar, which is set to -2 in this embodiment. This operation forces the model to learn not only the features that distinguish different humidity conditions, but also the general features that are insensitive to these conditions, and extracts features that are not related to humidity from the sensor data, thereby enhancing the adaptability and generalization ability of the model in different environments.
[0116] (III) Feature Extractor Model Training and Optimization
[0117] The training of the model is an iterative process involving four steps: forward propagation, loss calculation, back propagation, and parameter update. In this embodiment, the training process places special emphasis on the performance under different humidity conditions to ensure the robustness and adaptability of the model. The training process of the model involves multi-task learning, including reconstruction tasks, gas type classification tasks, and humidity condition classification tasks. The training process steps are as follows:
[0118] (1) Data partitioning: Use the train_test_split function to divide the data into a training set and a test set, where the test set accounts for 30% of the total data. This partitioning helps to retain enough data for training while also being able to evaluate the performance of the model on unseen data.
[0119] (2) Model construction: Create the autoencoder_model function to build the model. The function accepts the input shape, number of categories, and number of humidity conditions as parameters and builds a complete model containing an encoder, a decoder, and two classification tasks.
[0120] (3) Compiled model: The model is compiled using the Adam optimizer and a combined loss function that includes mean square error (for reconstruction tasks) and sparse classification cross entropy (for two classification tasks). This combined loss function enables the model to learn to reconstruct input data and make classification predictions at the same time; by adjusting the weights of the three loss terms, reconstruction loss, gas classification loss, and humidity prediction loss, the model's learning focus on the three tasks is controlled to optimize the overall performance.
[0121] (4) Model training: Use the fit method to train the model, input the training data and corresponding labels, including the reconstructed input data, gas type labels, and humidity condition labels. During the training process, the performance of the model is also monitored through the validation set to prevent overfitting. The training is usually set to several cycles (epochs), each cycle contains several batches (batch size is 8), which helps the model to perform more frequent weight updates on small batches of data, thereby improving learning efficiency.
[0122] (5) Optimization algorithm: Select a suitable optimization algorithm to adjust the model parameters. Common optimization algorithms include SGD, Adam, etc. These algorithms iteratively update the weights of the model to minimize the loss function. This embodiment uses the Adam algorithm.
[0123] 4. Classification model construction and evaluation
[0124] The classification model construction and evaluation process is shown in the attached Figure 4 As shown, the following steps are included:
[0125] (1) Data loading and preprocessing: First, load the dataset, including data and gas category labels; preprocess the data, including reshaping the data to fit the model input and normalizing it to ensure that the minimum value of the data is 0 and the maximum value is 1;
[0126] (2) Feature extraction: Load the pre-trained feature extractor model and use this model to extract features from the pre-processed data to obtain a low-dimensional feature data set;
[0127] (3) Dataset division: The extracted feature dataset is divided into a training set and a test set, where the test set accounts for 30% of the total data;
[0128] (4) Model training: A random forest classifier is used for model training, and the number of trees in the random forest is set to 100.
[0129] (5) Model evaluation: Use the features and labels of the test set to evaluate the classification accuracy of the model. It has been verified that the classification accuracy of the test set here can reach more than 90%.
[0130] (6) Humidity compensation verification: For data under other different humidity conditions (such as low temperature and low humidity), repeat the above steps of data loading and preprocessing, feature extraction and model evaluation; output the classification accuracy under different conditions. It has been verified that if the method of the present invention is not used, the classification accuracy output here is about 30%. After using the method of the present invention, the classification accuracy output here can reach more than 68%.
[0131] (V) Performance evaluation
[0132] Performance evaluation is done by testing under various humidity conditions. This includes comparing the model's detection accuracy before and after humidity changes, as well as the model's ability to adapt to unseen humidity conditions. Performance evaluation helps further optimize the model parameters and structure to ensure its effectiveness and reliability in real-world applications.
[0133] (VI) Model application
[0134] The trained model is deployed in an electronic nose system for real-time monitoring and analysis of the gas composition in the environment. The system determines the gas type through features extracted by a humidity-insensitive feature extractor model to ensure high accuracy under different humidity conditions.
[0135] The electronic nose humidity compensation method of the present invention can be widely applied in many fields. The following are several specific application examples:
[0136] 1. Environmental Monitoring
[0137] When monitoring air quality in cities and industrial areas with variable humidity, the performance of traditional electronic nose systems may be affected by humidity, resulting in inaccurate data. The present invention uses humidity compensation technology to effectively adapt to humid or dry environments and maintain high detection accuracy. This enables the electronic nose system to accurately monitor harmful gases in the air, such as sulfur dioxide and nitrogen oxides, even in rainy or dry seasons, providing reliable data for environmental policy making.
[0138] 2. Industrial Safety
[0139] In high humidity environments such as chemical plants or oil refineries, traditional gas detection equipment may misreport or miss reports of harmful gas leaks due to humidity changes. The humidity-compensated electronic nose system of the present invention can work stably in these environments through humidity compensation technology, detect potential harmful gas leaks in a timely and accurate manner, improve workplace safety, and prevent accidents.
[0140] 3. Food Processing Monitoring
[0141] During food processing and storage, fluctuations in ambient humidity may affect the performance of gas sensors, thereby affecting the accuracy of food quality control. The humidity-compensated electronic nose system of the present invention can accurately monitor the concentration of gases such as ethylene under different humidity conditions, which can affect the ripening process of fruits and vegetables. By ensuring the accuracy of monitoring data, the ripening and storage process of food can be better controlled, the shelf life can be extended, and waste can be reduced.
[0142] 4. Indoor Air Quality
[0143] The humidity of indoor environment varies greatly, especially when using air conditioners and humidifiers. These changes may affect the accuracy of traditional air quality monitoring equipment. The humidity compensated electronic nose system of the present invention can operate stably under different humidity conditions through humidity compensation technology, accurately monitor harmful gases in indoor air, such as formaldehyde, VOCs, etc., and improve the safety and comfort of living and working environments.
[0144] These application examples demonstrate the ability of the present invention to maintain high accuracy and reliability under different humidity conditions, highlighting the importance and practical value of humidity compensation technology.
Claims
1. An electronic nose humidity compensation method based on autoencoder and domain adaptation, Features: The following steps are involved:
1. Data preprocessing Convert raw sensor data into a format suitable for processing by machine learning models; (II) Feature Extractor Model Construction The feature extractor model includes an encoder, a decoder, and a multi-task learning module, and the output of the encoder is connected to the input of the decoder and the multi-task learning module; (1) Encoder The encoder is composed of several convolutional layers and pooling layers, which are responsible for compressing high-dimensional sensor data into low-dimensional feature vectors; (2) Decoder The structure of the decoder is symmetrical to that of the encoder, and consists of several convolutional layers and upsampling layers, which are responsible for reconstructing the low-dimensional feature vector into an output of the same dimension as the original sensor data for calculating the reconstruction loss; (3) Multi-task learning module Based on the autoencoder, the multi-task learning module adopted includes the main task and the auxiliary task. The main task and the auxiliary task are carried out in parallel to classify the gas type and predict the humidity conditions at the same time; The main task is to classify the gas types based on the encoded features. The goal of this task is to accurately identify the types of gases. The corresponding output layer is a fully connected layer, which uses the Softmax activation function to output the probabilities of various types of gases. The mathematical expression of the Softmax activation function is shown in the following formula: Where, X i is the i-th element in the input vector, and e is the base of the natural logarithm; The auxiliary task is to predict the current humidity conditions, including three fully connected layers, which deal with the classification of humidity conditions. The activation function of the first two fully connected layers is ELU, and the activation function of the last fully connected layer is softmax; (III) Feature Extractor Model Training and Optimization The training process of the model involves multi-task learning, which includes reconstruction tasks, gas type classification tasks, and humidity condition classification tasks. The training process steps are as follows: (1) Data division: divide the data into training set and test set; (2) Model construction: Create a function to build the model, which accepts the input shape, number of categories, and number of humidity conditions as parameters, and builds a complete model containing an encoder, a decoder, and two classification tasks; (3) Compiling the model: The model is compiled using an optimizer and a combined loss function consisting of mean square error for the reconstruction task and sparse categorical cross entropy for the two classification tasks. This combined loss function enables the model to simultaneously learn to reconstruct the input data and make classification predictions. (4) Model training: Input training data and corresponding labels to train the model, including reconstructed input data, gas type labels, and humidity condition labels; During the training process, the performance of the model is also monitored through the validation set to prevent overfitting; (5) Optimization algorithm: Select an optimization algorithm to adjust the model parameters and iteratively update the model weights to minimize the loss function; 4. Classification model construction and evaluation The classification model construction and evaluation process includes the following steps: (1) Data loading and preprocessing: First, load the dataset, including data and gas category labels; preprocess the data, including reshaping the data to fit the model input and normalizing it to ensure that the minimum value of the data is 0 and the maximum value is 1; (2) Feature extraction: Load the pre-trained feature extractor model and use this model to extract features from the pre-processed data to obtain a low-dimensional feature data set; (3) Dataset division: Divide the extracted feature dataset into a training set and a test set; (4) Model training: Use random forest classifier for model training; (5) Model evaluation: Use the features and labels of the test set to evaluate the classification accuracy of the model; (6) Humidity compensation verification: Repeat the above steps of data loading and preprocessing, feature extraction, and model evaluation for data under other different humidity conditions; output the classification accuracy under different conditions; (V) Performance evaluation Performance evaluation was completed by testing under various humidity conditions, including comparing the model's detection accuracy before and after humidity changes, as well as the model's ability to adapt to unseen humidity conditions.
2. According to claim 1, a humidity compensation method for an electronic nose based on an autoencoder and domain adaptation, Features: The step (1) data preprocessing includes the following aspects: (1) Data collection: A certain amount of gas detection data under different environmental conditions is collected from the electronic nose system, wherein the different environmental conditions include different humidity conditions, and the data includes the original response value of the sensor, as well as the corresponding gas type label and humidity condition label, to form a data set; (2) Data cleaning: Check for missing values or outliers in the data set and perform corresponding processing: replace missing values with the average value of adjacent points and delete outliers; (3) Data standardization: Since different sensors may have different response ranges, directly using these data may cause unstable model training or bias towards certain specific sensors.
3. The electronic nose humidity compensation method based on autoencoder and domain adaptation according to claim 2, Features: The feature normalization in step (3) uses the minimum-maximum normalization method to normalize all values in the data set to between 0 and 1. The minimum-maximum normalization formula is shown as follows: In the formula, G norm is the standardized value, G is the original data value, G min is the minimum value in the data set, G max is the maximum value in the data set.
4. The electronic nose humidity compensation method based on autoencoder and domain adaptation according to claim 1, Features: In the step (ii) of constructing the feature extractor model, the encoder includes three convolutional layers and a maximum pooling layer, and the specific parameters are as follows: The first convolution layer uses 8 11x3 kernels, the activation function is ELU, the padding is set to same, the output size is kept consistent with the input size, L2 regularization is used with a coefficient of 0.001, followed by batch normalization; The first layer of maximum pooling: use a 2x2 pooling window and set padding to the same; The second convolution layer uses 12 5x1 convolution kernels, the activation function is ELU, the padding is set to same, L2 regularization is used, the coefficient is 0.001, and batch normalization is followed; Second layer of maximum pooling: use a 2x2 pooling window and set padding to the same; The third convolution layer uses 24 3x1 convolution kernels, the activation function is ELU, the padding is set to same, L2 regularization is used, the coefficient is 0.001, and batch normalization is performed. The third layer of maximum pooling: a 2x2 pooling window is used, and padding is set to the same; the output is marked as encoded, indicating the encoded features; The mathematical expression of the ELU activation function is shown below: Where X is the input value, α is the negative semi-axis slope of the ELU activation function, and e is the base of the natural logarithm.
5. The electronic nose humidity compensation method based on autoencoder and domain adaptation according to claim 1, Features: In the step (ii) of constructing the feature extractor model, the decoder structure includes a convolutional layer and an upsampling layer, and the specific parameters are as follows: The first convolution layer: uses 24 3x1 convolution kernels, the activation function is ELU, and the padding is set to the same; The first layer upsampling: use 2x2 upsampling size; The second convolution layer uses 12 5x1 convolution kernels, the activation function is ELU, and the padding is set to the same; The second layer upsampling: uses 2x2 upsampling size; The third convolution layer: uses 8 11x3 convolution kernels, the activation function is ELU, and the padding is set to the same; The third layer upsampling: uses 2x2 upsampling size; Output layer convolution: Use a 3x1 convolution kernel, the activation function is Sigmoid, and the padding is set to same. This layer generates the final reconstructed output, which has the same size as the original input; the mathematical expression of the Sigmoid activation function is shown in the following formula: Where X is the input value and e is the base of the natural logarithm.
6. The electronic nose humidity compensation method based on autoencoder and domain adaptation according to claim 1, Features: In the step (ii) of constructing the feature extractor model, in order to realize the domain adaptation capability of the feature extractor model, a domain adaptation layer is also added: a gradient reversal layer is added at the input end of the auxiliary task, which does not change the data during forward propagation, but reverses the gradient during back propagation, that is, multiplies it by a negative scalar.
Citation Information
Patent Citations
Optimization method of gas recognition neural network model and related equipment
CN114358283A
Electronic nose domain adaptive transfer learning method based on DANN-OS-ELM
CN116011514A
Multi-component gas detection method and device based on electronic nose system
CN117805317A
