Electronic nose data generation method based on autoencoder and generative adversarial network
By using a Gaussian mixture embedding generative adversarial network model, combined with a discriminator and an auxiliary classifier, the problem of category error in electronic nose data generation was solved, feature extraction and recognition of new category data were achieved, and the accuracy of pattern recognition was improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG INSTITUTE OF QUALITY SCIENCES
- Filing Date
- 2025-05-07
- Publication Date
- 2026-06-02
AI Technical Summary
Existing electronic nose data generation methods struggle to effectively apply existing data features to new category recognition with limited samples, and the generated data may contain category errors, affecting pattern recognition accuracy.
A Gaussian mixture embedding generative adversarial network model based on autoencoder and generative adversarial network is adopted. The class features are modeled by Gaussian mixture distribution. The generator and encoder are trained by combining discriminator and auxiliary classifier. Class cross-entropy and conditional loss are added to ensure the accuracy of the generated data class.
It improves the generalization ability of electronic nose data generation, ensures the accuracy of generated data in the feature space, enhances the ability to extract and recognize features of new categories of data, and improves the accuracy of pattern recognition.
Smart Images

Figure CN120579042B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of electronic nose data processing, specifically relating to an electronic nose data generation method based on autoencoders and generative adversarial networks. Background Technology
[0002] Electronic nose data generation methods refer to methods that, when the amount of experimental sample data is limited, learn the features and distribution of electronic nose data through generative models, thereby generating data with similar features and the same category. This helps classification models distinguish electronic nose data of different categories of samples and improves the accuracy of sample classification.
[0003] Traditional electronic nose sampling is time-consuming and struggles to collect sufficient sample data, which negatively impacts the accuracy and generalization ability of subsequent pattern recognition. Data generation applications primarily include data augmentation and data transfer. Data augmentation generates data with similar category features based on existing objects or categories; data transfer generates sample data for a new object or category based on existing data. Therefore, this data generation method requires consistent sampling parameters, such as sampling time and rate, to ensure consistency in the response signal. Currently, electronic nose pattern recognition methods struggle to apply learned features from existing data to the recognition of new categories, requiring retraining with a sufficient number of samples each time a new category is identified. Research on electronic nose data generation methods is limited at present, with applications mainly focusing on image generation in computer vision, time-series signal generation from sensors, and EEG signal generation. Image generation focuses on image features, texture, and details; time-series generation often focuses on the decomposition and generation of fluctuating and oscillating time signals; and EEG signal generation emphasizes the decoding and effectiveness of the generated EEG signals. Common generation methods include variational autoencoders and their variants, generative adversarial networks (GANs), and diffusion models. However, these methods cannot fully consider the influence of the category characteristics of the electronic nose signal on the response signal and lack attention to the accuracy of the generated data category. For example, when the detection parameters remain unchanged and the differences between the detected sample categories are not significant (volatile odor components are similar), it is difficult to extract features for new categories. On the other hand, the generated data may contain incorrect categories, thus affecting the accuracy of electronic nose pattern recognition. Summary of the Invention
[0004] To address the shortcomings of existing technologies and achieve the goal of applying features learned from existing data to the recognition of new categories of odor signals, this invention adopts the following technical solution:
[0005] The electronic nose data generation method based on autoencoders and generative adversarial networks includes the following steps:
[0006] Step S101: Sample multiple odor objects to be amplified using sensors, and use the obtained odor response signals as sample data to construct an electronic nose dataset;
[0007] Step S102: Based on Gaussian mixture variational autoencoder and conditional generative adversarial network, construct a Gaussian mixture embedding generative adversarial network model, including encoder, Gaussian mixture model, generator, discriminator and auxiliary classifier;
[0008] Step S103: Train the Gaussian mixture embedding generative adversarial network model using the electronic nose dataset;
[0009] Sample data is encoded with features and corresponding category information by an encoder and a Gaussian mixture model, and then decoded by a generator to obtain generated data; the encoder and generator are fixed, and the generated data and the sample data are both input into a discriminator and an auxiliary classifier to train the discriminator and the auxiliary classifier; the discriminator and the auxiliary classifier are fixed to train the encoder and the generator.
[0010] Step S104: The data generation method based on transfer expands the data of new categories according to the existing data of different categories, and retrains the trained Gaussian mixture embedding generative adversarial network model with the new electronic nose dataset.
[0011] The new odor object to be migrated is sampled by the sensor, and the new sample data is added to the electronic nose dataset to obtain a new electronic nose dataset.
[0012] Add a Gaussian component to the Gaussian mixture model. Input the data of the new category into the Gaussian mixture embedding generative adversarial network model, and set the Gaussian component of the new category with the feature encoding of the new category output by the encoder.
[0013] The model is fine-tuned using new category data. Based on the new Gaussian components, sample data of the new category is sampled to obtain new feature codes and corresponding new category information. Then, the generator decodes the new generated data. The encoder and generator are fixed, and the new generated data and the sample data of the new category are input into the discriminator and the auxiliary classifier to train the discriminator and the auxiliary classifier. The discriminator and the auxiliary classifier are fixed to train the encoder and the generator.
[0014] Update the Gaussian components of the Gaussian mixture model to obtain feature encoding and type information, and decode the generated data through a new generator.
[0015] Further, in step S103, the discriminator and the auxiliary classifier are trained. When the training period is less than a set threshold, the discriminator and the auxiliary classifier are updated simultaneously, and the discriminator is updated to maximize the generative adversarial network loss. When the number of training periods is greater than or equal to the threshold, and the auxiliary classifier outputs a correct result with a probability greater than a preset confidence level, the corresponding generated data is mixed with the sample data, and the auxiliary classifier is updated to minimize the class cross-entropy loss.
[0016] In step S103, the encoder and generator are trained, the divergence loss of the sample data after passing through the encoder and Gaussian mixture model is calculated, the reconstruction loss of the sample data is calculated, and the conditional loss of the generated data re-input into the encoder for reconstruction is calculated. The total loss is constructed by the generative adversarial network loss, the class cross-entropy loss, the divergence loss, the reconstruction loss, and the conditional loss to update the encoder and generator.
[0017] In step S104, the discriminator and the auxiliary classifier are trained. When the training period is less than a set threshold, the discriminator is updated and updated to maximize the generative adversarial network loss. When the number of training periods is greater than or equal to the threshold, the discriminator and the auxiliary classifier are updated simultaneously and the discriminator is updated to maximize the new generative adversarial network loss. When the auxiliary classifier outputs a correct result and the probability of outputting the result is greater than the preset confidence level, the corresponding generated data is mixed with the sample data of the new category to minimize the new category cross-entropy loss and update the auxiliary classifier.
[0018] In step S104, the encoder and generator are trained, a new divergence loss is calculated for the sample data of the new category after passing through the encoder and Gaussian mixture model, a new reconstruction loss is calculated for the sample data of the new category, and a new conditional loss is calculated for the newly generated data to be re-input into the encoder for reconstruction. A new total loss is constructed using the new generative adversarial network loss, the new category cross-entropy loss, the new divergence loss, the new reconstruction loss, and the new conditional loss to update the encoder and generator.
[0019] Furthermore, in step S103, there is a pre-training process before the actual training. The pre-training of the encoder and generator is similar to that of an autoencoder, without the reparameterization operation of a variational autoencoder. Therefore, only the encoder... Participate in pre-training, Not participating in pre-training, The output feature encoding is decoded by the generator to obtain the output data. By directly aligning the output data with the input data using the L2 norm, the model acquires preliminary nonlinear feature extraction capabilities. The training set of the sample data... The data is input into the encoder to obtain feature codes. Each data has a feature code. The mean of the feature codes of each class is calculated as the mean of the corresponding Gaussian component. The standard deviation of the feature codes of each class is calculated as the standard deviation of the corresponding Gaussian component. The components of the Gaussian mixture model are initialized.
[0020] In step S104, the Gaussian mixture embedding generative adversarial network model is initialized, and a Gaussian component is added to the Gaussian mixture model. After the data of the new category is input into the Gaussian mixture embedding generative adversarial network model, the encoder outputs the mean and standard deviation of the feature distribution. The mean of the feature encoding of the new category is used as the mean of the Gaussian component of the new category, and the standard deviation of the feature encoding of the new category is used as the standard deviation of the Gaussian component of the new category, thus obtaining the new Gaussian component.
[0021] Furthermore, in step S103, the formula for generating the adversarial network loss function is as follows:
[0022]
[0023] in, This represents the loss function of the generative adversarial network; To show obedience The expected value of the distribution, where x represents the sample data. This represents the distribution of the sample data x; represents the generated data, z represents the feature encoding, and c represents the category information; This indicates the output of the discriminator; To show obedience The expected value of the distribution. Represents the relationship between sample data x and generated data The distribution of random interpolated data between them Indicates difference data. λ represents the distribution of the interpolated data; λ represents the weight. Indicates to The L2 norm result after differentiation;
[0024] In step S104, the formula for the new generative adversarial network loss function is as follows:
[0025]
[0026] in, To show obedience The expected value of the distribution. This represents sample data representing the new category. Sample data representing the new category Distribution; This indicates the first generated data. The feature encoding of the sample data representing the new category, Category information representing sample data of the new category; The function representing the discriminator; To show obedience The expected value of the distribution. Sample data representing the new category With the first generated data The distribution of random interpolated data between them This represents the difference data between the sample data for the new category. The interpolated data distribution represents the sample data of the new category; λ represents the weight. Indicates to The L2 norm result after differentiation.
[0027] Furthermore, in step S103, the formula for the category cross-entropy loss function is as follows:
[0028]
[0029] in, Indicates the generation of data The output of the corresponding auxiliary classifier C; This represents the category information for the k-th category, where K represents the total number of categories. This represents the number of generated data input into the auxiliary classifier C;
[0030] In step S104, the formula for the new category cross-entropy loss function is as follows:
[0031]
[0032] in, Indicates the first generated data The output of the corresponding auxiliary classifier C; This indicates the number of the first generated data points input into the auxiliary classifier C.
[0033] Furthermore, in step S103, the formula for the divergence loss function is as follows:
[0034]
[0035] in, This represents the KL divergence loss of the sample data x; L represents the dimension of the Gaussian components. The l-th dimension variable represents the mean of the characteristic distribution of the sample data x; The l-th dimension variable representing the standard deviation of the characteristic distribution of sample data x; The l-th dimension variable represents the mean of the Gaussian components to which the sample data x belongs; The l-th dimension variable represents the standard deviation of the Gaussian component to which the sample data x belongs;
[0036] In step S104, the formula for the new divergence loss function is as follows:
[0037]
[0038] in, Sample data representing the new category The KL divergence loss; L represents the dimension of the Gaussian component; Sample data representing the new category The l-th dimension variable is the mean of the characteristic distribution; Sample data representing the new category The l-th dimension variable is the standard deviation of the characteristic distribution. Sample data representing the new category The l-th dimension variable is the mean of the Gaussian components to which it belongs; The l-th dimension variable represents the standard deviation of the Gaussian component to which the sample data of the new category belongs.
[0039] Furthermore, in step S103, the formula for the reconstruction loss function is as follows:
[0040]
[0041] in, The expression represents the reconstruction loss of sample data x; m represents the number of Monte Carlo samples. In Monte Carlo sampling, the d-th dimension variable of the i-th sample data; In Monte Carlo sampling, let d represent the d-th dimension variable of the reconstructed data of the i-th sample data; v represents the maximum dimension of the sample data x.
[0042] In step S104, the formula for the new reconstruction loss function is as follows:
[0043]
[0044] in, Sample data representing the new category Reconstruction loss; Indicates the number of samples in the new category. Let d be the d-th dimension variable representing the sample data of the i-th new category; Let d be the d-th dimension variable representing the reconstructed data of the sample data of the i-th new category; Sample data representing the new category The maximum dimension.
[0045] Furthermore, in step S103, the formula for the conditional loss function is as follows:
[0046]
[0047] in, This represents the output of the h-th fully connected layer of the auxiliary classifier C. This represents the dimension of the h-th fully connected layer; This represents the mean of the sample data x; Let G be a function representing the generator, S1 be the training set of the electronic nose data, N1 be the number of training sets of the electronic nose data, z be the feature encoding, c be the category information, and L be the dimension of the feature encoding.
[0048] In step S104, the formula for the new conditional loss function is as follows:
[0049]
[0050] in, Sample data representing the new category The mean; The Gaussian components representing the new category of sample data are used; GMM stands for Gaussian Mixture Model. The feature encoding of the sample data representing the new category, The category information representing the sample data of the new category. S' represents the number of sample data for the new category, and S' represents the new electronic nose dataset.
[0051] Furthermore, in step S103, the formula for the total loss function is as follows:
[0052]
[0053] in, Represents the total loss function; The reconstruction loss function represents the sample data x; The KL divergence loss function represents the sample data x; This represents the loss function of the generative adversarial network; This represents the category cross-entropy loss function; Represents the conditional loss function; To show obedience The expected value of the distribution, where x represents the sample data. This represents the distribution of the sample data x; , and The corresponding loss weights are represented by E, G, and D.
[0054] In step S104, the formula for the new total loss function is as follows:
[0055]
[0056] in, This represents the new total loss function. Sample data representing the new category The reconstruction loss function Sample data representing the new category The KL divergence loss function, This represents the new generative adversarial network loss function. This represents the new category cross-entropy loss function. This represents the new conditional loss function. To show obedience The expected value of the distribution. This represents sample data representing the new category. Sample data representing the new category The distribution of .
[0057] Furthermore, in step S104, the sampling-based data generation method uses a trained Gaussian mixture embedding generative adversarial network model to augment the data; the sampling-based data generation method includes reconstruction sampling and prior sampling, where reconstruction sampling outputs generated data at a set multiple based on the number of input data, and prior sampling outputs generated data at a set number;
[0058] The reconstruction sampling method inputs the data to be amplified into a trained Gaussian mixture embedding generative adversarial network model. The encoder E outputs a feature distribution. The feature code is obtained from the feature distribution through Monte Carlo sampling. The feature distribution is inferred through the Gaussian mixture model to obtain the probability that the feature code belongs to each Gaussian component. The category corresponding to the Gaussian component with the highest probability is taken as the category information of the feature code. The obtained feature code and category information are input into the generator, and the decoded output is generated data to complete the data amplification.
[0059] The prior sampling method utilizes a trained Gaussian mixture embedding generative adversarial network model for data augmentation. First, the class information of the data to be augmented is sampled from the Gaussian mixture model of the trained Gaussian mixture embedding generative adversarial network model according to the probability of the class to which the Gaussian components belong. Then, the feature code corresponding to the class information is sampled from the corresponding Gaussian components. The feature code and class information are input into the generator, decoded, and output to generate data, thus completing the data augmentation.
[0060] The advantages and beneficial effects of this invention are as follows:
[0061] Compared to traditional conditional variational autoencoders, this invention's encoder structure retains only the real data input, capturing the mapping from data to the feature space. Different categories of data can be modeled in the same feature space. This allows feature learning based on existing data to aid in the extraction of features for new categories of data, even when detection parameters remain constant and the differences between detected sample categories are small (e.g., similar volatile odor components). A Gaussian mixture distribution is introduced into the feature space to fit the prior distribution, modeling each category of data through Gaussian components, enabling independent training of distributions between different categories. The generator structure learns the decoding process from the Gaussian mixture distribution to the real data distribution. In addition to the input feature encoding, category information is added to help the generator determine its Gaussian component within the Gaussian mixture distribution, avoiding the decoding of incorrectly classified generated data. This structural design effectively improves the model's generalization ability, enabling feature extraction and decoding based on existing data to generate data applicable to new categories, learning the feature distribution of new categories, and sampling generated data from this distribution.
[0062] This invention incorporates class loss and conditional loss into the total loss function. Class loss makes the model focus more on the accuracy of the generated data's class, preventing incorrect classes from affecting the accuracy of electronic nose pattern recognition. During training, generated data is continuously added to train the auxiliary classifier, gradually strengthening its recognition ability. Conditional loss forces the features obtained after encoding the generated data to be similar to the mean of the original feature distribution. This ensures the consistency of the re-encoded features, making the generated data similar to the input real data, and is a crucial component in ensuring the authenticity and validity of the generated data.
[0063] This invention comprehensively considers two application scenarios for data generation. From the perspective of model structure and loss function design, this invention can simultaneously meet the requirements of both generation applications, making this invention more widely applicable in electronic nose data generation. Attached Figure Description
[0064] Figure 1 This is a flowchart of GMEGAGAN model training and data generation in an embodiment of the present invention.
[0065] Figure 2 This is a visualization of real data in an embodiment of the present invention.
[0066] Figure 3 This is a visualization of the generated data in an embodiment of the present invention.
[0067] Figure 4 This is a manifold diagram of real data and generated data in the embodiments of the present invention.
[0068] Figure 5This is a t-SNE dimensionality reduction visualization diagram based on sampled generated data and real data in an embodiment of the present invention.
[0069] Figure 6 This is a visualization of the new type of data in an embodiment of the present invention.
[0070] Figure 7 This is a visualization of the new type of fine-tuning data in an embodiment of the present invention.
[0071] Figure 8 This is a visualization of the prior generated data in an embodiment of the present invention.
[0072] Figure 9 This is a visualization of the reconstructed sampling data in an embodiment of the present invention.
[0073] Figure 10 This is a distribution map of existing data after fine-tuning the new category in this embodiment of the invention.
[0074] Figure 11 This is a schematic diagram of the structure of the GMEGAAN model in an embodiment of the present invention.
[0075] Figure 12a This is a diagram of the model reasoning process in an embodiment of the present invention.
[0076] Figure 12b This is a diagram illustrating the model generation process in an embodiment of the present invention. Detailed Implementation
[0077] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.
[0078] Since there is a high correlation between electronic nose data and categories of different samples, this invention proposes an electronic nose data generation method based on autoencoders and generative adversarial networks. It assumes that the features of each class of samples follow a Gaussian distribution, and the overall features follow a Gaussian mixture distribution. The Gaussian mixture distribution is used to approximate the feature distribution of the real data. The Gaussian mixture embedding generative adversarial network built in this invention combines the category feature distribution of the learnable data, clusters it into a Gaussian mixture model, and generates corresponding data based on features and categories.
[0079] like Figure 1 As shown, this invention constructs a GMGAN model and, after pre-training and initialization, trains the neural network using an adversarial strategy to generate data based on sampling. After fine-tuning the existing model using new types of data, transfer learning can be performed. Specifically, it includes the following steps:
[0080] Step S101: Sample multiple odor objects to be amplified using sensors, and use the obtained odor response signals as samples to construct an electronic nose dataset S.
[0081] The number of sensors is s, the signal length is l, the number of sample categories is K, and the total number of samples is N. The electronic nose data is evenly divided into a training set S1 and a test set S2 in a 6:4 ratio, with N1 and N2 sets respectively, where N1 + N2 = N.
[0082] Step S102: Based on Gaussian mixture variational autoencoder and conditional generative adversarial network, construct the Gaussian mixture embedding generative adversarial network (GMEGAN) model. The GMEGAN model includes an encoder E, a Gaussian mixture model (GMM), a generator G, a discriminator D, and an auxiliary classifier C.
[0083] The specific structure of the GMEGAN model is as follows:
[0084] Encoder E consists of three one-dimensional convolutional layers and three fully connected layers, all using ReLU activation functions. The convolutional layer sizes are [1×5, 1×3, 1×3], with kernel numbers of [256, 128, 64] and strides of 2 for all layers. The output tensor size of the last convolutional layer is [b, 64, n]. l ], where n l Let be the length of the original signal after three convolutional layers, and b represent the batch size. The tensor is then reconstructed into a two-dimensional tensor with dimensions [b, 64×n]. l The first fully connected layer W3 has a size of [64×n]. l The feature encoding dimension is L. The dimensions of the second and third fully connected layers W1 and W2 are both [100, L]. W1 and W2 output the mean and standard deviation of the feature distribution, respectively. The two are connected in parallel and then connected after W3.
[0085] Gaussian mixture models (GMMs) contain K Gaussian components. and the weighting parameter π of the K Gaussian components k (k=1,2,…,K), each Gaussian component has dimension L, and weight parameters... .
[0086] The generator G consists of three fully connected layers connected in sequence, with ReLU activation function for each layer. Since the input is a combination of feature encoding and class vector, the dimension of the fully connected layers is [L+K, 256, 512, l*s].
[0087] The discriminator D consists of three fully connected layers connected sequentially, all with ReLU activation functions and dimensions of [l*s, 512, 256, 1]. After the last fully connected layer, there is an output layer that uses the sigmoid function. The sigmoid function restricts the output to the range [0,1], which serves as the basis for judging whether the result is true or false.
[0088] The auxiliary classifier C can be selected or designed according to actual needs. In this invention, a structure similar to the encoder E is chosen, consisting of three one-dimensional convolutional layers and two fully connected layers connected sequentially. The activation function for all layers is ReLU. The convolutional layer size is [1×5, 1×3, 1×3], the number of convolutional kernels is [256, 128, 64], and the convolutional stride is 2 for all layers. The dimension of the first fully connected layer is [64×n]. l The second fully connected layer has a dimension of [100, K], followed by an output layer. The output layer uses the softmax function, which transforms the output vector into probabilities for K categories.
[0089] Step S103: Train the Gaussian Mixture Embedding Generative Adversarial Network (GMEGAN) model using the electronic nose dataset S, including the following steps:
[0090] Step S201: Pre-training process: The pre-training of the encoder E and generator G in GMEGAN is similar to that of an autoencoder, without the reparameterization operation of a variational autoencoder. Therefore, only W1 in the encoder participates in pre-training, while W2 does not. The feature encoding output by W1 is decoded by the generator to obtain the output data. By using the L2 norm to directly align the output data with the input data, the model has a preliminary nonlinear feature extraction capability. The data in the training set S1 is input into the encoder to obtain feature encodings. Each data point has a feature encoding. Therefore, the mean of the feature encoding of each class is calculated as the mean of the corresponding Gaussian component, and the standard deviation of the feature encoding of each class is calculated as the standard deviation of the corresponding Gaussian component. The components of the Gaussian mixture model are initialized. Specifically, the mean of the feature encoding of one class is used as the mean of the corresponding Gaussian component of that class, and the standard deviation of the feature encoding of one class is used as the standard deviation of the corresponding Gaussian component of that class.
[0091] The formulas for calculating the mean and standard deviation of the feature codes are shown below:
[0092] (1)
[0093] in, The mean of all feature codes for the k-th category; The total number of sample data in the k-th category; Encode the features of the i-th sample data in the k-th category; The standard deviation of all feature codes for the k-th category.
[0094] Step S202: Training process:
[0095] Step S301: Preparation phase, training set The data contains K categories, and the data volume of each category is denoted as . The weight parameters of the Gaussian Mixture Model (GMM) are calculated and updated according to equation (2). The formula for calculating the weight parameters of the Gaussian Mixture Model (GMM) is as follows:
[0096] (2)
[0097] Where π is the set of weight parameters of the Gaussian Mixture Model (GMM). ; The weights of the Gaussian components to which the sample data x belongs; The Gaussian component to which the sample data x belongs; This provides the category information for sample data x.
[0098] Divide the training set S1 into n batches of data. Each batch of data include Each training data set is input once for one epoch.
[0099] Step S302: The feature distribution obtained by the encoder for each batch of data is represented in the form of mean and standard deviation, and is sampled from the feature distribution using Monte Carlo methods. Each feature is encoded and combined with supervised category labels, then randomly sampled from a Gaussian Mixture Model (GMM). Each feature is encoded and its corresponding category information; these 2 The feature codes and category information are concatenated and then input into the generator to decode and obtain the generated data.
[0100] That is, each After passing through encoder E, we can obtain... A feature distribution ,in , From each Randomly sample a feature encoding to obtain Known category labels Generator G pairs ( , The final result of decoding is , ;
[0101] Random sampling from Gaussian Mixture Model (GMM) Each feature is encoded and denoted as... Corresponding category information The generator is for each ( , Decoding finally yields... , .
[0102] Step S303: Fix encoder E and generator G, train discriminator D and auxiliary classifier C. Generator G inputs the generated data into discriminator D and auxiliary classifier C respectively, and discriminator D and auxiliary classifier C receive sample data; mark the generated data and sample data as False and True respectively, and maximize the value of the generated data by equation (3). Update discriminator D:
[0103] (3)
[0104] in, This represents the loss function of the generative adversarial network; To show obedience The expected value of the distribution, where x represents the sample data. This represents the distribution of the sample data x; represents the generated data, z represents the feature encoding, and c represents the category information; This indicates the output of the discriminator; To show obedience The expected value of the distribution. Represents the relationship between sample data x and generated data The distribution of random interpolated data between them Indicates difference data. λ represents the distribution of the interpolated data; λ represents the weight. Indicates to The L2 norm result after differentiation;
[0105] When the training period is less than a set threshold, the parameters of both the discriminator D and the auxiliary classifier C are updated simultaneously to maximize the generative adversarial network loss. The parameters of the discriminator D are updated in the following manner. When the number of training cycles is greater than or equal to the threshold, if the auxiliary classifier outputs the correct result and the probability of outputting the result is greater than the preset confidence level, the generated data corresponding to the result is mixed with the sample data, and the mixed data is used to train the auxiliary classifier C. The parameter is minimized according to equation (4). Update the parameters of the auxiliary classifier C:
[0106] (4)
[0107] in, Indicates the generation of data The output of the corresponding auxiliary classifier C; This represents the category information for the k-th category, where K represents the total number of categories. This represents the number of generated data input into the auxiliary classifier C;
[0108] Step S304: Fix the discriminator D and the auxiliary classifier C, train the encoder E and the generator G, and calculate the KL divergence loss of the feature encoding obtained by the encoder of the real data (i.e. the sample data) and the Gaussian mixture model according to Equation (5). :
[0109] (5)
[0110] in, This represents the KL divergence loss of the sample data x; L represents the dimension of the Gaussian components. The l-th dimension variable represents the mean of the characteristic distribution of the sample data x; The l-th dimension variable representing the standard deviation of the characteristic distribution of sample data x; The l-th dimension variable represents the mean of the Gaussian components to which the sample data x belongs; The l-th dimension variable represents the standard deviation of the Gaussian component to which the sample data x belongs;
[0111] The reconstruction loss between the feature codes generated by the Monte Carlo method and the corresponding sample data is calculated according to equation (6). :
[0112] (6)
[0113] in, The expression represents the reconstruction loss of sample data x; m represents the number of Monte Carlo samples. In Monte Carlo sampling, the d-th dimension variable of the i-th sample data; In Monte Carlo sampling, v represents the d-th dimension variable encoded by the i-th feature; v represents the maximum dimension of the sample data x.
[0114] The generated data is then re-input into encoder E to obtain the reconstructed feature distribution. Calculate according to formula (7) :
[0115] (7)
[0116] in, This represents the output of the h-th fully connected layer of the auxiliary classifier C. This represents the dimension of the h-th fully connected layer; This represents the mean of the sample data x; Let G be a function representing the generator, S1 be the training set of the electronic nose data, N1 be the number of training sets of the electronic nose data, z be the feature encoding, c be the category information, and L be the dimension of the feature encoding.
[0117] The loss function for constructing the GMGAN model is a weighted sum of the losses from each component, as shown in the following formula:
[0118] (8)
[0119] in, Represents the total loss function; The reconstruction loss function represents the sample data x; The KL divergence loss function represents the sample data x; This represents the loss function of the generative adversarial network; This represents the category cross-entropy loss function; Represents the conditional loss function; To show obedience The expected value of the distribution, where x represents the sample data. Let E represent the distribution of sample data x; let E represent the encoder, G represent the generator, and D represent the discriminator. , and This represents the corresponding loss weight, and .
[0120] The parameters of encoder E and generator G are updated using gradient descent.
[0121] Step S305: After training all training data for one epoch, calculate the mean KL loss of the Gaussian components corresponding to the feature distributions of all training data according to equation (9). The Gaussian components of the Gaussian mixture model are updated using the gradient backpropagation method:
[0122] (9)
[0123] Step S306: Repeat steps S302 to S305 for each cycle until the model converges or the total number of cycles is reached.
[0124] Step S104: The sampling-based data generation method uses a trained Gaussian mixture embedding generative adversarial network model to augment data; the transfer-based data generation method augments data for new categories based on existing data of different categories.
[0125] Sampling-based data generation methods aim to amplify existing data of different categories and generate generated data that conforms to the characteristics of the corresponding categories. Depending on the sampling method, they are divided into reconstruction sampling and prior sampling. Reconstruction sampling generates data based on the number of input data and outputs a set multiple of the generated data, while prior sampling generates data with a set number of output data.
[0126] The reconstruction sampling method inputs the data to be augmented into a trained Gaussian mixture embedding generative adversarial network model. The data to be augmented is obtained through electronic nose sampling, and the category information of the data belongs to the category information contained in the electronic nose dataset S. The encoder E of the model outputs a feature distribution. The feature code is obtained from the feature distribution through Monte Carlo sampling. The Gaussian mixture model (GMM) of the model is used to infer the feature distribution and obtain the probability of the feature code belonging to each Gaussian component. The category corresponding to the Gaussian component with the highest probability is taken as the category information to which the feature code belongs. The obtained feature code and category information are input into the generator G of the model. The generator G decodes and outputs the generated data, thus completing the data augmentation.
[0127] Specifically, the reconstruction sampling method will resample the test set. The data is input into the GMGEAN model, and the encoder E outputs the mean of the feature distribution. and standard deviation The first method obtains feature codes directly from the feature distribution through Monte Carlo sampling, while the second method uses Gaussian mixture models to infer the probability of belonging to each Gaussian component from the mean of the feature distribution. The component with the highest probability is taken as the class information and transformed into a one-hot vector. The prior sampling method first obtains class information from the Gaussian mixture model according to the probability of the component belonging to the class, and then samples the feature codes from the corresponding Gaussian components. The feature codes and class information are input into the generator for decoding and output to generate data.
[0128] The prior sampling method utilizes a trained Gaussian Mixture Embedding Generative Adversarial Network (GMM) model for data augmentation. First, the class information of the data to be augmented is obtained by sampling from the Gaussian Mixture Model (GMM) of the trained GMM model according to the probability of the class to which the Gaussian components belong. Then, the feature encoding corresponding to the class information is obtained by sampling from the corresponding Gaussian components. The feature encoding and class information are input into the generator G of the model, decoded, and output to generate data, thus completing the data augmentation.
[0129] Data transfer-based data generation methods aim to address the problem of augmenting new data categories from existing data of different categories. The model's encoder, trained on existing data, learns the mapping from real data to feature distributions, allowing it to map new class data into the feature space, forming new classes. Subsequent fine-tuning on the new class data ensures that subsequent generation better captures the mapping relationship between the distribution of the new class in the feature space and the distribution of the real data. The data transfer process includes the following steps:
[0130] Step S401: Use an electronic nose to sample a new odor object to be transferred, and add the new sample data obtained from the sampling to the electronic nose dataset S in step S101 to obtain the first electronic nose dataset S';
[0131] GMEGAN model initialization: a small number of samples from a new class (not belonging to any of the K classes), the number of samples... The number of class parameters for the model is set to K+1, using a training set containing data from K classes. After training is complete, the new category of data and the training set will be used together. Retrain the auxiliary classifier using data mixing. Add a Gaussian component to the Gaussian Mixture Model (GMM). ,Will When new categories of data are input into the GMGEGAN model, the encoder E outputs the mean of the feature distribution. and standard deviation The mean of the feature codes of the new category is used as the mean of the Gaussian components of the new category, and the standard deviation of the feature codes of the new category is used as the standard deviation of the Gaussian components of the new category; thus, the new Gaussian components are obtained. .
[0132] Step S402: Retrain the trained Gaussian mixture embedding generative adversarial network model using the first electronic nose dataset S';
[0133] Fine-tuning the model using new class data: A certain number of feature codes are obtained by randomly sampling from the new Gaussian components using prior sampling. and feature encoding Corresponding category information The generator is based on feature encoding and category information. (One-hot vector of the new category) Decode the first generated data.
[0134] The encoder E and generator G are fixed. Generator G inputs the first generated data into discriminator D and auxiliary classifier C respectively, and discriminator D and auxiliary classifier C receive new sample data. When the number of training epochs is less than a set threshold, only the parameters of discriminator D are updated, in order to maximize the loss of the first generative adversarial network. The parameters of the discriminator D are updated in the following manner; the first generative adversarial network loss... for:
[0135] (10)
[0136] in, To show obedience The expected value of the distribution. This represents sample data representing the new category. Sample data representing the new category Distribution; This indicates the first generated data. The feature encoding of the sample data representing the new category, Category information representing sample data of the new category; The function representing the discriminator; To show obedience The expected value of the distribution. Sample data representing the new category With the first generated data The distribution of random interpolated data between them This represents the difference data between the sample data for the new category. The interpolated data distribution representing the sample data of the new category; Indicates weight; Indicates to The L2 norm result after differentiation.
[0137] When the number of training epochs is greater than or equal to the threshold, the parameters of the discriminator D and the auxiliary classifier C are updated simultaneously to maximize the loss of the first generative adversarial network. The parameters of the discriminator D are updated in a certain way. When the auxiliary classifier outputs a correct result and the probability of outputting that result is greater than the preset confidence level, the generated data corresponding to that result is mixed with the sample data of the new category, and the mixed data is input into the auxiliary classifier C to minimize the first category cross-entropy loss. The parameters of the auxiliary classifier C are updated in the following manner, with the first class cross-entropy loss... for:
[0138] (11)
[0139] in, Indicates the first generated data The output of the corresponding auxiliary classifier C; This indicates the number of the first generated data points input into the auxiliary classifier C.
[0140] With discriminator D and auxiliary classifier C fixed, calculate the first KL divergence loss of the Gaussian mixture model (GMM):
[0141] (12)
[0142] in, Sample data representing the new category The KL divergence loss; L represents the dimension of the Gaussian component; Sample data representing the new category The l-th dimension variable is the mean of the characteristic distribution; Sample data representing the new category The l-th dimension variable is the standard deviation of the characteristic distribution. Sample data representing the new category The l-th dimension variable is the mean of the Gaussian components to which it belongs; The l-th dimension variable represents the standard deviation of the Gaussian component to which the sample data of the new category belongs.
[0143] Calculate the first reconstruction loss between the reconstructed data generated by the prior sampling method and the corresponding new class sample data. :
[0144] (13)
[0145] in, Sample data representing the new category The first reconstruction loss; This represents the number of samples in the prior sampling method. Let d represent the d-th dimension variable of the sample data of the i-th new category in the prior sampling; Let d represent the d-th dimension variable of the reconstructed data of the i-th new category sample data in the prior sampling. Sample data representing the new category The maximum dimension.
[0146] The first generated data is re-input into encoder E to obtain the reconstructed feature distribution. And calculate the first condition constraint. :
[0147] (14)
[0148] in, Sample data representing the new category The mean; The Gaussian components representing the new category of sample data are used; GMM stands for Gaussian Mixture Model. The feature encoding of the sample data representing the new category, The category information representing the sample data of the new category. S' represents the number of sample data for the new category, and S' represents the new electronic nose dataset.
[0149] Calculate the first total loss :
[0150] (15)
[0151] in, , and All are loss weights;
[0152] Based on the first total loss Update the parameters of encoder E and generator G using gradient descent.
[0153] After training is complete, calculate the mean of the first KL divergence loss of the Gaussian mixture model (GMM). The Gaussian components of the Gaussian Mixture Model (GMM) are updated using the gradient backpropagation method; the mean of the first KL divergence loss is... for;
[0154] (16)
[0155] Step S403: Based on the sampled data generation method, perform data transfer again on the trained Gaussian mixture embedding generative adversarial network model:
[0156] The Gaussian mixture model (GMM) is used to obtain new Gaussian components. The feature codes and corresponding category information are obtained from the new Gaussian components through prior sampling. The feature codes and category information are then input into the generator G obtained from the second training. The generator G decodes and outputs the generated data, thus completing the data transfer of the sample data for the new category.
[0157] In this invention example, a self-made electronic nose based on a MOS-type gas-sensitive sensor array is used as the experimental device, specifically divided into four subsystems: a main control module, a sampling module, a signal transmission module, and an industrial control computer. The main control module uses an STM32F103RCT6 microcontroller as the main control chip, responsible for controlling the electronic nose to receive commands, execute various functions, transmit data, and drive the opening and closing of the air pump and solenoid valve. The sampling module includes a 12-MOS-type gas-sensitive sensor array, a sampling circuit, and a 16-bit digital-to-analog converter chip AD7616. After analog-to-digital conversion via AD7616, the voltage of the voltage divider load is used as the response signal. The signal transmission module uses an ESP-01S wireless network connection module based on the ESP8266EX chip, supporting MQTT protocol firmware, STA / AP / STA+AP working modes, and Smart Config / AirKiss network configuration technology, meeting the basic requirements for data communication of the electronic nose. The industrial control computer is equipped with an MQTT server and a MySQL server, and has self-developed electronic nose visualization software installed, which can realize functions such as sending commands, receiving and visualizing data, saving and analyzing data, and deploying pattern recognition methods.
[0158] In this invention, rice wine was used as the experimental subject, as rice wines of different ages possess unique aroma characteristics. For five different ages of rice wine: 3 years, 5 years, 8 years, 10 years, and 20 years, 120 samples were prepared for each type and tested using an electronic nose, resulting in a total of 600 sample data. The sample preparation process was as follows: 20ml of rice wine sample was placed in a 250ml dedicated gas sample collection bottle and allowed to stand under headspace at 25℃ for 10 minutes. The sample testing process was as follows: the inlet and outlet of the electronic nose were connected to both ends of the collection bottle. The testing process consisted of three stages: pre-cleaning, sample injection, and cleaning, with times of 40s, 50s, and 180s respectively, and a testing time of 270s for each sample.
[0159] The process of generating and verifying electronic nose data is as follows:
[0160] 1. Data preprocessing: Sensor signals are recorded as follows: Where i represents the i-th time point and s represents the sensor number. The pre-cleaning phase signals of each sensor are considered as baseline signals, denoted as . A baseline removal method was used to eliminate signal differences in the electronic nose during the pre-cleaning stage. A maximum value of 3.3 was manually set, and the sensor signal was divided by this maximum value to normalize all data to the range (0,1). The specific calculation formula is shown below:
[0161]
[0162] in, This is the normalized sensor signal.
[0163] 2. Dataset partitioning: Divide the dataset into a training set and a training set in a 6:4 ratio. and test set The datasets contain 360 and 240 samples respectively. The training set is used to train the model, and the test set is used to test the improvement effect of the generated data on the classifier.
[0164] 3. GMGAN model pre-training and initialization of Gaussian mixture model: Set the batch size to 20 for the sample data, and train the set... The data is divided into 18 batches, with 100 pre-training epochs. In each epoch, training data is progressively input into the encoder E according to the batch number. The hidden layer vectors output by the encoder are treated as feature codes and fed into the generator G for decoding to obtain reconstructed data. The L2 norm loss between the reconstructed and generated data is calculated, and gradient descent is used to update the model parameters. After pre-training, the entire training set is input into the encoder, resulting in feature codes for 360 data points. The mean and variance of the feature codes for 72 data points in each category are calculated as the mean and variance of the corresponding Gaussian components.
[0165] 4. GMGEAN Model Training: Set the training epochs to 800, the threshold to 300, and the batch size to 20 samples. Then, use the training set... The data is divided into 18 batches, and in each period, the training data is gradually input into the model according to the batch number.
[0166] 4.1. With a fixed encoder and generator, for each batch of data, the encoder outputs a feature distribution (mean and variance). Monte Carlo sampling is used to obtain 20 feature codes from the feature distribution. The feature codes are concatenated with the corresponding categories of the data and input into the generator to obtain 20 generated data (reconstruction sampling). 20 feature codes and categories are randomly sampled from the Gaussian mixture model and also used by the generator to obtain 20 generated data (prior sampling). 40 generated data are marked as false and 20 real data are marked as true. The results are calculated using equation (8). When the training cycle exceeds the threshold, the data from the 20 generated data that have the correct output of the auxiliary classifier are mixed with the 20 real data to train the auxiliary classifier C, and the calculation is performed according to equation (9). ,Will and The parameters of the discriminator D and the auxiliary classifier C are updated using additive gradient descent.
[0167] 4.2. With the encoder and generator fixed, calculate the KL divergence loss of the 20 feature distributions and Gaussian mixture model according to equation (6). The reconstruction loss of the 20 generated data points and the input data is calculated according to equation (3). After re-inputting these 20 generated data into encoder E, the reconstructed feature distribution is obtained, and calculated according to equation (10). All 40 generated data points are marked as True and input into the discriminator D and the auxiliary classifier C. Calculations are performed according to equations (8) and (9) respectively. and According to equation (11), the loss of each part is weighted and summed, and the parameters of encoder E and generator G are updated by gradient descent.
[0168] 4.3 After each training cycle is completed, calculate the KL divergence loss of the feature distribution of the 360 data points and their corresponding Gaussian components according to equation (6). Gradient descent updates the Gaussian mixture model;
[0169] 5. Data generation based on sampling:
[0170] 5.1 Reconstruction Sampling Method: Input 360 rice wine data points from the training set into the GMGEAN model. The encoder E outputs the mean of the feature distribution. and variance 720 feature codes were obtained by Monte Carlo sampling from the feature distribution at a ratio of 2. The Gaussian mixture model was used to evaluate the mean of the feature distribution. The probability of belonging to each Gaussian component is obtained by inference. The component with the highest probability is taken as the category information. The 720 feature codes and the corresponding category information are input into the generator to obtain 720 generated data.
[0171] 5.2 The prior sampling method first samples the class information from the Gaussian mixture model according to the probability of the component's class, and then samples the feature code from the corresponding Gaussian component. The feature code and class information are input into the generator for decoding and output to generate data.
[0172] 6. Data generation based on migration:
[0173] Taking 3-year-old rice wine as a new category as an example, 5-year, 8-year, 10-year, and 20-year-old rice wines are existing data. The training data for each category is 72 samples. 20 samples from the 8-year-old rice wine samples are randomly selected as training data for initialization and fine-tuning of the model. First, the number of Gaussian mixture model components and the generator input dimension are set according to the total number of categories. The model is trained using the 4 categories of rice wine data. The 20 data points of 3-year-old rice wine are input into the model, and the mean and variance of the Gaussian components corresponding to the 3-year-old rice wine are initialized according to the mean of the feature distribution based on equation (12). Then, the model is fine-tuned using 3-year rice wine data: the encoder E and generator G are fixed, and 20 3-year rice wine data points are generated using prior sampling. The generated data and the real 3-year rice wine data are marked as False and True, respectively. The discriminator and auxiliary classifier are trained according to equations (8) and (9). The discriminator D and auxiliary classifier C are fixed, and the model loss is calculated according to equations (8) to (10). The encoder and generator are updated. After the above steps are completed, the 20 generated 3-year rice wine data points are input into the encoder to obtain the feature distribution. The KL loss between the 20 feature distributions and the corresponding Gaussian components of the 3-year rice wine is calculated according to equation (6). The parameters of the corresponding Gaussian components are updated. The above process is repeated until the model converges. Finally, it is only necessary to randomly sample the Gaussian components corresponding to the 3-year rice wine in the Gaussian mixture model to obtain the feature code. The feature code is concatenated with the category information and input into the decoder to obtain the generated data.
[0174] 7. Generate data quality assessment and auxiliary effects:
[0175] 7.1 Performance Test of Data Generation Method Based on Sampling: Real training sets and generated data were mixed at ratios of 1:1, 1:5, 1:10, and 1:20 to create hybrid training sets. Four classification models—SVM, LR, KNN, and ANN—were trained using these sets and the hybrid training sets, respectively. The average classification accuracy of these models in 10 tests on the rice wine test set was used to evaluate the effectiveness of the generated data in improving classification performance. The results are shown in Table 1. The table shows that with the addition of generated data, the classification accuracy of different models improved to some extent. When the ratio of real data to generated data was 1:10, each classifier achieved optimal performance. Specifically, SVM achieved an accuracy of 95%, an improvement of 5%; LR achieved an accuracy of 91.1%, an improvement of 2.8%; KNN achieved an accuracy of 88.3%, an improvement of 2.7%; and ANN achieved the highest prediction accuracy (98.3%), an improvement of 4.4% compared to the real data. As the proportion of generated data increased, the classification performance of the models initially increased and then decreased or remained unchanged. This may be because the mixing strategy used in our mixed dataset is relatively crude. After directly mixing the generated data with the real data, as the proportion of generated data increases, the influence of the real data on the classifier decreases, and the classifier takes more of the class boundaries of the generated data into account.
[0176] Table 1. Classification model prediction results
[0177]
[0178] Dimensionality reduction visualizations of the generated and real data were performed using PCA and t-SNE methods, respectively, with the results shown below. Figures 2 to 4 ,as well as Figure 5 As shown, the distribution of the generated data is highly similar to that of the real data. By adding generated data to the real data, gaps in the data distribution can be effectively filled. These gaps are caused by insufficient data and blur the boundaries between different categories. Therefore, generated data can help the classifier better identify different categories of data.
[0179] Figure 5 The image shows the results of t-SNE dimensionality reduction visualization of the same amount of real and generated data. The crosses represent real rice wine data, and the triangles represent generated rice wine data. As can be seen from the image, the low-dimensional manifolds of the generated and real data have a high correlation and similarity, and the generated data covers the blank areas between the real data. This indicates that the distribution of the generated data is consistent with the distribution of the real data, which can effectively supplement the incomplete data distribution caused by the limited number of samples. This helps the subsequent classification and regression models to identify the boundaries of the data and improve the model's fitting ability and stability.
[0180] 7.2 Performance Test of Transfer-Based Generation Method: Fifty feature codes were randomly sampled from the Gaussian components corresponding to 3-year-old Shaoxing wine. The generator was used to decode these codes to obtain the generated output. PCA was used to perform dimensionality reduction and visualization of the new class data and Gaussian component centers. The results are as follows: Figures 6 to 9 As shown, the distribution of the generated data scatter points and the real fine-tuned data are basically consistent and closely surround the center of the Gaussian component, which indicates that the data generated based on migration and the real data have similar characteristics.
[0181] Figure 10 The visualization shows the distribution of real data and generated data (reconstruction sampling and prior sampling) under the t-SNE dimensionality reduction method. It can be seen that the new category data can fill the blank areas in the real data manifold quite well and has a relatively clustered characteristic. After fine-tuning the generative model based on the existing data with a small amount of data, it can also achieve effective generation of new category sample data.
[0182] Real 3-year-old Shaoxing wine and generated 3-year-old Shaoxing wine were mixed in ratios of 1:1, 1:5, 1:10, and 1:20. Four classification models, namely SVM, LR, KNN, and ANN, were trained using these four mixed training sets. The remaining 100 3-year-old Shaoxing wine data were used as the test set, and the average of 10 tests was taken as the final accuracy. The classification accuracy results of these classification models for 3-year-old Shaoxing wine are shown in Table 2.
[0183] Table 2. Classification model prediction results
[0184]
[0185] As shown in the table, due to the limited training data, the classification accuracy of each model using only real data was relatively low. When the ratio of real data to generated data was 1:5, SVM, LR, and ANN classifiers achieved optimal performance, while KNN achieved the highest classification effect at a ratio of 1:10. This is likely because KNN is a nearest neighbor-based classification method, which performs poorly with a small training set. Adding generated data to the training set significantly improved KNN's accuracy. Furthermore, the classification performance of other classifiers also improved to some extent, indicating that transfer learning-based data generation methods can improve classification model accuracy by mixing generated data of new categories with training data, thus enhancing the model's ability to classify small amounts of new category data.
[0186] Figure 11 The diagram illustrates the structure of the GMGENAN model and its three stages: pre-training, training, and fine-tuning. Sampling-based data generation methods utilize only the first two stages, while transfer-based data generation methods use all stages. The red arrows in the diagram indicate the calculation of each loss function, the blue areas represent the data flow direction, and the green arrows distinguish between real data entering the discriminator and the auxiliary classifier.
[0187] Figure 12a , Figure 12b The reasoning and generation processes of the model are shown separately. Figure 12a Dashed lines represent training, and solid lines represent testing. During training, data x is input and encoded. The model encodes the output z and obtains the category c corresponding to x in a supervised manner. When x is input during testing, after the model encodes z, the GMM model needs to infer the possible c from z. Figure 12b The data generation process can be described in two ways: First, a category c is randomly selected based on prior sampling, and then feature codes z are sampled from a Gaussian distribution. Second, a reconstruction sampling method is linked to the inference process. z is randomly sampled from the feature distribution, and the Gaussian MM infers category c based on z. Finally, c and z are input together into the generator (the generator's function is...). x is obtained from ).
[0188] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. An electronic nose data generation method based on autoencoders and generative adversarial networks, characterized in that... Includes the following steps: Step S101: Sample multiple odor objects to be amplified using sensors, and use the obtained odor response signals as sample data to construct an electronic nose dataset; Step S102: Based on Gaussian mixture variational autoencoder and conditional generative adversarial network, construct a Gaussian mixture embedding generative adversarial network model, including encoder, Gaussian mixture model, generator, discriminator and auxiliary classifier; Step S103: Train the Gaussian mixture embedding generative adversarial network model using the electronic nose dataset; The sample data is encoded with features and corresponding category information by an encoder and a Gaussian mixture model, and then decoded by a generator to obtain generated data. The encoder and generator are fixed, and the generated data and the sample data are input into the discriminator and the auxiliary classifier to train the discriminator and the auxiliary classifier. Fixed discriminator and auxiliary classifier are used to train encoder and generator; The discriminator and auxiliary classifier are trained. When the training period is less than a set threshold, the discriminator and auxiliary classifier are updated simultaneously, and the discriminator is updated with the maximum generative adversarial network loss. When the number of training periods is greater than or equal to the threshold, and the auxiliary classifier outputs the correct result with a probability greater than the preset confidence level, the corresponding generated data is mixed with the sample data, and the auxiliary classifier is updated with the minimum class cross-entropy loss. Train the encoder and generator, calculate the divergence loss of the sample data after passing through the encoder and Gaussian mixture model, calculate the reconstruction loss of the sample data, and calculate the conditional loss of the generated data re-inputting into the encoder for reconstruction; construct the total loss to update the encoder and generator using the generative adversarial network loss, the class cross-entropy loss, the divergence loss, the reconstruction loss, and the conditional loss; Before training, there is a pre-training process. The sample data is input into the encoder to obtain feature codes. Each data has a feature code. The mean of the feature codes of each class is calculated as the mean of the corresponding Gaussian component. The standard deviation of the feature codes of each class is calculated as the standard deviation of the corresponding Gaussian component. The components of the Gaussian mixture model are initialized. Step S104: The data generation method based on transfer expands the data of new categories according to the existing data of different categories, and retrains the trained Gaussian mixture embedding generative adversarial network model with the new electronic nose dataset. The new odor object to be migrated is sampled by the sensor, and the new sample data is added to the electronic nose dataset to obtain a new electronic nose dataset. Add a Gaussian component to the Gaussian mixture model. Input the data of the new category into the Gaussian mixture embedding generative adversarial network model, and set the Gaussian component of the new category with the feature encoding of the new category output by the encoder. Based on the new Gaussian components, sample data of the new category is sampled to obtain new feature codes and corresponding new category information. Then, the generator decodes the data to obtain new generated data. The encoder and generator are fixed, and the new generated data and the sample data of the new category are input into the discriminator and the auxiliary classifier to train the discriminator and the auxiliary classifier. The discriminator and the auxiliary classifier are fixed to train the encoder and the generator. Update the Gaussian components of the Gaussian mixture model to obtain feature encoding and type information, and decode the generated data through a new generator. The discriminator and auxiliary classifier are trained. When the training epochs are less than a set threshold, the discriminator is updated by maximizing the generative adversarial network loss. When the number of training epochs is greater than or equal to the threshold, both the discriminator and the auxiliary classifier are updated simultaneously, and the discriminator is updated by maximizing the new generative adversarial network loss. When the auxiliary classifier outputs a correct result and the probability of outputting that result is greater than the preset confidence level, the corresponding generated data is mixed with the sample data of the new category to minimize the new category cross-entropy loss and update the auxiliary classifier. Train the encoder and generator, calculate the new divergence loss of the sample data of the new category after passing through the encoder and Gaussian mixture model, calculate the new reconstruction loss of the sample data of the new category, and calculate the new conditional loss of the newly generated data re-input into the encoder for reconstruction; construct a new total loss to update the encoder and generator through the new generative adversarial network loss, the new category cross-entropy loss, the new divergence loss, the new reconstruction loss and the new conditional loss; The Gaussian Mixture Embedding Generative Adversarial Network (GAN) model is initialized by adding a Gaussian component to the model. After the data of the new category is input into the GAN model, the encoder outputs the mean and standard deviation of the feature distribution. The mean of the feature encoding of the new category is used as the mean of the Gaussian component of the new category, and the standard deviation of the feature encoding of the new category is used as the standard deviation of the Gaussian component of the new category, thus obtaining the new Gaussian component.
2. The electronic nose data generation method based on autoencoders and generative adversarial networks according to claim 1, characterized in that: In step S103, the formula for generating the adversarial network loss function is as follows: , in, This represents the loss function of the generative adversarial network; To show obedience The expected value of the distribution, where x represents the sample data. This represents the distribution of the sample data x; represents the generated data, z represents the feature encoding, and c represents the category information; This indicates the output of the discriminator; To show obedience The expected value of the distribution. Represents the relationship between sample data x and generated data The distribution of random interpolated data between them Indicates difference data. λ represents the distribution of the interpolated data; λ represents the weight. Indicates to The L2 norm result after differentiation; In step S104, the formula for the new generative adversarial network loss function is as follows: , in, To show obedience The expected value of the distribution. This represents sample data representing the new category. Sample data representing the new category Distribution; This indicates the first generated data. The feature encoding of the sample data representing the new category, Category information representing sample data of the new category; The function representing the discriminator; To show obedience The expected value of the distribution. Sample data representing the new category With the first generated data The distribution of random interpolated data between them This represents the difference data between the sample data for the new category. The interpolated data distribution represents the sample data of the new category; λ represents the weight. Indicates to The L2 norm result after differentiation.
3. The electronic nose data generation method based on autoencoders and generative adversarial networks according to claim 1, characterized in that: In step S103, the formula for the category cross-entropy loss function is as follows: , in, Indicates the generation of data The output of the corresponding auxiliary classifier C; This represents the category information for the k-th category, where K represents the total number of categories. This represents the number of generated data input into the auxiliary classifier C; In step S104, the formula for the new category cross-entropy loss function is as follows: , in, Indicates the first generated data The output of the corresponding auxiliary classifier C; This indicates the number of the first generated data points input into the auxiliary classifier C.
4. The electronic nose data generation method based on autoencoders and generative adversarial networks according to claim 1, characterized in that: In step S103, the formula for the divergence loss function is as follows: , in, This represents the KL divergence loss of the sample data x; L represents the dimension of the Gaussian components. The l-th dimension variable represents the mean of the characteristic distribution of the sample data x; The l-th dimension variable representing the standard deviation of the characteristic distribution of sample data x; The l-th dimension variable represents the mean of the Gaussian components to which the sample data x belongs; The l-th dimension variable represents the standard deviation of the Gaussian component to which the sample data x belongs; In step S104, the formula for the new divergence loss function is as follows: , in, Sample data representing the new category The KL divergence loss; L represents the dimension of the Gaussian component; Sample data representing the new category The l-th dimension variable is the mean of the characteristic distribution; Sample data representing the new category The l-th dimension variable is the standard deviation of the characteristic distribution. Sample data representing the new category The l-th dimension variable is the mean of the Gaussian components to which it belongs; The l-th dimension variable represents the standard deviation of the Gaussian component to which the sample data of the new category belongs.
5. The electronic nose data generation method based on autoencoders and generative adversarial networks according to claim 1, characterized in that: In step S103, the formula for the reconstruction loss function is as follows: , in, The value represents the reconstruction loss of the sample data x; m represents the number of Monte Carlo samples. This represents the d-th dimension variable of the i-th sample data; Let d represent the d-th dimension variable of the reconstructed data of the i-th sample; v represents the maximum dimension of the sample data x. In step S104, the formula for the new reconstruction loss function is as follows: , in, Sample data representing the new category Reconstruction loss; This represents the number of samples in the prior sampling method. Let d be the d-th dimension variable representing the sample data of the i-th new category; Let d be the d-th dimension variable representing the reconstructed data of the sample data of the i-th new category; Sample data representing the new category The maximum dimension.
6. The electronic nose data generation method based on autoencoders and generative adversarial networks according to claim 1, characterized in that: In step S103, the formula for the conditional loss function is as follows: , in, This represents the output of the h-th fully connected layer of the auxiliary classifier C. This represents the dimension of the h-th fully connected layer; This represents the mean of the sample data x; Let G be a function representing the generator, S1 be the training set of the electronic nose data, N1 be the number of training sets of the electronic nose data, z be the feature encoding, c be the category information, and L be the dimension of the feature encoding. In step S104, the formula for the new conditional loss function is as follows: , in, Sample data representing the new category The mean; The Gaussian components representing the new category of sample data are used; GMM stands for Gaussian Mixture Model. The feature encoding of the sample data representing the new category, The category information representing the sample data of the new category. S' represents the number of sample data for the new category, and S' represents the new electronic nose dataset.
7. The electronic nose data generation method based on autoencoders and generative adversarial networks according to claim 1, characterized in that: In step S103, the formula for the total loss function is as follows: , in, Represents the total loss function; The reconstruction loss function represents the sample data x; The KL divergence loss function represents the sample data x; This represents the loss function of the generative adversarial network; This represents the category cross-entropy loss function; Represents the conditional loss function; To show obedience The expected value of the distribution, where x represents the sample data. This represents the distribution of the sample data x; , and The corresponding loss weights are represented by E, G, and D. In step S104, the formula for the new total loss function is as follows: , in, This represents the new total loss function. Sample data representing the new category The reconstruction loss function Sample data representing the new category The KL divergence loss function, This represents the new generative adversarial network loss function. This represents the new category cross-entropy loss function. This represents the new conditional loss function. To show obedience The expected value of the distribution. This represents sample data representing the new category. Sample data representing the new category The distribution of .
8. The electronic nose data generation method based on autoencoders and generative adversarial networks according to claim 1, characterized in that: In step S104, the sampling-based data generation method uses a trained Gaussian mixture embedding generative adversarial network model to augment data. The sampling-based data generation method includes reconstruction sampling and prior sampling. Reconstruction sampling outputs generated data at a set multiple based on the number of input data, while prior sampling outputs generated data at a set number. The reconstruction sampling method inputs the data to be amplified into a trained Gaussian mixture embedding generative adversarial network model. The encoder E outputs a feature distribution. The feature code is obtained from the feature distribution through Monte Carlo sampling. The feature distribution is inferred through the Gaussian mixture model to obtain the probability that the feature code belongs to each Gaussian component. The category corresponding to the Gaussian component with the highest probability is taken as the category information of the feature code. The obtained feature code and category information are input into the generator, and the decoded output is generated data to complete the data amplification. The prior sampling method utilizes a trained Gaussian mixture embedding generative adversarial network model for data augmentation. First, the class information of the data to be augmented is sampled from the Gaussian mixture model of the trained Gaussian mixture embedding generative adversarial network model according to the probability of the class to which the Gaussian components belong. Then, the feature code corresponding to the class information is sampled from the corresponding Gaussian components. The feature code and class information are input into the generator, decoded, and output to generate data, thus completing the data augmentation.