Electronic nose data generation method based on auto-encoder and generative adversarial network
By constructing a Gaussian hybrid embedding generation adversarial network model and combining category information, the accuracy of new category recognition in electronic nose data generation is solved, and the category accuracy and recognition accuracy of generated data are improved.
Patent Information
- Application Number
- CN202510578778.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-07
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2045-05-07
AI Technical Summary
Existing electronic nose data generation methods are difficult to accurately identify new categories of data when the number of samples is limited, and category errors may occur in generated data, affecting the accuracy of pattern recognition.
Using a method based on autoencoder and generative adversarial network, a Gaussian hybrid embedded generative adversarial network model is constructed. Through training and fine-tuning, the generator learns the decoding process from Gaussian hybrid distribution to real data distribution, and combines category information to ensure the category accuracy of the generated data.
It improves the generalization ability of the model, can effectively extract new category data features, and the generated data is similar to the real data, and improves the accuracy of electronic nose pattern recognition.
Smart Images

Figure CN120579042A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of electronic nose data processing, and in particular relates to an electronic nose data generation method based on an autoencoder and a generative adversarial network. Background Art
[0002] The electronic nose data generation method refers to learning the characteristics and distribution of electronic nose data through a generative model-based method when the amount of experimental sample data is limited, thereby generating data with similar characteristics and the same category, and then assisting the classification model to distinguish the electronic nose data of samples of different categories, thereby improving the accuracy of sample classification.
[0003] Traditional electronic nose sampling requires a high time cost, making it difficult to collect sufficient sample data. This limited sample size can affect the accuracy and generalization of subsequent pattern recognition. Data generation applications primarily include data augmentation and data migration. Data augmentation generates data with similar categorical characteristics based on existing objects or categories. Data migration generates sample data for a new object or category based on existing data. Therefore, these data generation methods must be based on identical sampling parameters, such as sampling time and rate, to ensure consistency in the response signal form. Current electronic nose pattern recognition methods struggle to apply features learned from existing data to the recognition of new categories. Each new category requires retraining with sufficient sample data. Currently, research on electronic nose data generation methods is limited, and their applications primarily focus on image generation for computer vision, sensor time series signal generation, and EEG signal generation. Image generation focuses on image features, texture, and detail, while time series generation often focuses on the decomposition and generation of time signals with fluctuations and oscillations. EEG signal generation emphasizes the decoding and validity of the generated EEG signals. Common generative methods include variational autoencoders and their variants, generative adversarial networks, and diffusion models. However, these methods fail to fully consider the impact of the categorical characteristics of electronic nose signals on the response signal and lack attention to the accuracy of the generated data. For example, when detection parameters remain unchanged and the categories of the test samples are not very different (such as similar volatile odor components), it is difficult to extract features from new categories of data. Furthermore, the generated data may contain incorrect categories, which affects the accuracy of electronic nose pattern recognition. Summary of the Invention
[0004] To address the shortcomings of the existing technology and achieve the purpose of applying the features learned from existing data to the recognition of new categories of odor signals, the present invention adopts the following technical solutions:
[0005] The electronic nose data generation method based on autoencoder and generative adversarial network includes the following steps:
[0006] Step S101: sampling multiple odor objects to be amplified using a sensor, using the obtained odor response signals as sample data, and constructing an electronic nose data set;
[0007] Step S102: Based on the Gaussian mixture variational autoencoder and the conditional generative adversarial network, a Gaussian mixture embedding generative adversarial network model is constructed, including an encoder, a Gaussian mixture model, a generator, a discriminator, and an auxiliary classifier;
[0008] Step S103: training the Gaussian mixture embedding generative adversarial network model using the electronic nose dataset;
[0009] The sample data is passed through an encoder and a Gaussian mixture model to obtain feature encoding and corresponding category information, 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; the discriminator and the auxiliary classifier are fixed to train the encoder and the generator;
[0010] Step S104: Based on the migration data generation method, the new category of data is amplified according to the existing data of different categories, and the trained Gaussian mixture embedding generative adversarial network model is retrained using the new electronic nose dataset;
[0011] Sampling a new odor object to be subjected to data migration through a sensor, and adding the new sample data to the electronic nose dataset to obtain a new electronic nose dataset;
[0012] Add a new Gaussian component to the Gaussian mixture model, input the new category of data into the Gaussian mixture embedding generative adversarial network model, and set the new category of Gaussian components with the feature encoding of the new category output by the encoder;
[0013] Fine-tune the model using the new category data. Based on the new Gaussian component, sample the new category sample data to obtain a new feature code and the corresponding new category information. Then decode it through the generator to obtain new generated data. Fix the encoder and generator. Input the new generated data and the new category sample data into the discriminator and auxiliary classifier to train the discriminator and auxiliary classifier. Fix the discriminator and auxiliary classifier to train the encoder and generator.
[0014] Update the Gaussian components of the Gaussian mixture model to obtain feature encoding and type information, and decode the generated data through the new generator.
[0015] Furthermore, in step S103, the discriminator and the auxiliary classifier are trained. When the training cycle is less than a set threshold, the discriminator and the auxiliary classifier are updated simultaneously, and the discriminator is updated by maximizing the generative adversarial network loss. When the number of training cycles is greater than or equal to the threshold, and the auxiliary classifier outputs a correct result and the probability of outputting the result is greater than a preset confidence level, the corresponding generated data is mixed with the sample data, and the auxiliary classifier is updated by minimizing the category 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 the 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 category 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 cycle is less than a set threshold, the discriminator is updated and updated by maximizing the generative adversarial network loss. When the number of training cycles is greater than or equal to the threshold, 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 the result is greater than a preset confidence level, the corresponding generated data is mixed with 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, the new divergence loss of the sample data of the new category after passing through the encoder and the Gaussian mixture model is calculated, the new reconstruction loss of the sample data of the new category is calculated, and the new conditional loss of the new generated data re-input into the encoder for reconstruction is calculated; 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, a new total loss is constructed to update the encoder and generator.
[0019] Furthermore, in step S103, there is a pre-training process before training. The pre-training of the encoder and the generator is similar to that of the autoencoder, without the re-parameterization operation of the variational autoencoder. Participate in pre-training, No pre-training. The output feature code 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 the initial nonlinear feature extraction capability. The data is input into the encoder to obtain feature coding. Each data has a feature coding. The mean of the feature coding of each class is calculated as the mean of the corresponding Gaussian component. The standard deviation of the feature coding 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 new Gaussian component is added to the Gaussian mixture model. After the new category of data is input into the Gaussian mixture embedding generative adversarial network model, the encoder outputs the mean and standard deviation of the feature distribution, and 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 to obtain a new Gaussian component.
[0021] Furthermore, in step S103, the formula for generating the adversarial network loss function is as follows:
[0022]
[0023] in, represents the loss function of the generative adversarial network; Express obedience The expected value of the distribution, x represents the sample data, Represents the distribution of sample data x; Represents generated data, z represents feature encoding, and c represents category information; Represents the discriminator output result; Express obedience The expected value of the distribution, Represents sample data x and generated data Random interpolation data distribution between Represents difference data, represents the interpolation data distribution; λ represents the weight; Express The L2 norm result after derivation;
[0024] In step S104, the formula of the new generative adversarial network loss function is as follows:
[0025]
[0026] in, Express obedience The expected value of the distribution, Represents sample data of the new category, Sample data representing new categories distribution of represents the first generated data, Represents the feature encoding of sample data of new categories, Represents the category information of the sample data of the new category; represents the function of the discriminator; Express obedience The expected value of the distribution, Sample data representing new categories With the first generated data Random interpolation data distribution between Represents the difference data of the sample data of the new category, represents the interpolated data distribution of the sample data of the new category; λ represents the weight; Express The L2 norm result after derivation.
[0027] Furthermore, in step S103, the formula of the category cross entropy loss function is as follows:
[0028]
[0029] in, Indicates generated data The output of the corresponding auxiliary classifier C; Represents the category information of the kth category, K represents the total number of categories, represents the number of generated data input to the auxiliary classifier C;
[0030] In step S104, the formula of 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; represents the number of first generated data input to the auxiliary classifier C.
[0033] Furthermore, in step S103, the formula of the divergence loss function is as follows:
[0034]
[0035] in, Represents the KL divergence loss of sample data x; L represents the dimension of the Gaussian component; The l-th dimension variable representing the mean of the characteristic distribution of 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 representing the mean of the Gaussian component to which the sample data x belongs; The l-th dimension variable representing the standard deviation of the Gaussian component to which the sample data x belongs;
[0036] In step S104, the formula of the new divergence loss function is as follows:
[0037]
[0038] in, Sample data representing new categories KL divergence loss; L represents the dimension of the Gaussian component; Sample data representing new categories The l-th dimension variable of the mean of the characteristic distribution; Sample data representing new categories The l-th dimension variable of the standard deviation of the characteristic distribution; Sample data representing new categories The l-th dimension variable of the mean of the Gaussian component to which ; The l-th dimension variable representing 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 reconstructing the loss function is as follows:
[0040]
[0041] in, Represents the reconstruction loss of sample data x; m represents the number of Monte Carlo samples, Represents the d-th dimension variable of the i-th sample data in Monte Carlo sampling; Indicates the d-th dimension variable of the reconstructed data of the i-th sample data in Monte Carlo sampling; v represents the maximum dimension of the sample data x;
[0042] In step S104, the formula of the new reconstruction loss function is as follows:
[0043]
[0044] in, Sample data representing new categories The reconstruction loss; represents the number of new category samples, The d-th dimension variable representing the sample data of the i-th new category; The d-th dimension variable representing the reconstructed data of the sample data of the i-th new category; Sample data representing new categories The maximum dimension of .
[0045] Furthermore, in step S103, the formula of the conditional loss function is as follows:
[0046]
[0047] in, represents the output of the hth fully connected layer of the auxiliary classifier C, represents the dimension of the hth fully connected layer; represents the mean of sample data x; represents the function of the generator G, S1 represents the training set of electronic nose data, N1 represents the number of electronic nose data training sets, z represents feature encoding, c represents category information, and L represents the dimension of feature encoding;
[0048] In step S104, the formula of the new conditional loss function is as follows:
[0049]
[0050] in, Sample data representing new categories The mean of Indicates the Gaussian component to which the sample data of the new category belongs, GMM represents the Gaussian mixture model, Represents the feature encoding of sample data of new categories, Indicates the category information of the sample data of the new category, represents the number of sample data of the new category, and S' represents the new electronic nose dataset.
[0051] Furthermore, in step S103, the formula of the total loss function is as follows:
[0052]
[0053] in, represents the total loss function; Represents the reconstruction loss function of sample data x; Represents the KL divergence loss function of sample data x; represents the loss function of the generative adversarial network; represents the category cross entropy loss function; represents the conditional loss function; Express obedience The expected value of the distribution, x represents the sample data, Represents the distribution of sample data x; 、 and Represents the corresponding loss weight, E represents the encoder, G represents the generator, and D represents the discriminator;
[0054] In step S104, the formula of the new total loss function is as follows:
[0055]
[0056] in, represents the new total loss function, Sample data representing new categories The reconstruction loss function is Sample data representing new categories The KL divergence loss function, represents the new generative adversarial network loss function, represents the new category cross entropy loss function, represents the new conditional loss function, Express obedience The expected value of the distribution, Represents sample data of the new category, Sample data representing new categories distribution.
[0057] Furthermore, in step S104, data amplification is performed using a trained Gaussian mixture embedding generative adversarial network model based on a sampling data generation method; the sampling data generation method includes reconstruction sampling and prior sampling, wherein the reconstruction sampling outputs generated data of a set multiple based on the number of input data, and the prior sampling outputs a set number of generated data;
[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, obtains a feature code from the feature distribution through Monte Carlo sampling, and infers the feature distribution through a 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 to which the feature code belongs. The obtained feature code and category information are input into the generator, and the generated data is decoded and output to complete the data amplification;
[0059] The prior sampling method uses the trained Gaussian mixture embedding generative adversarial network model to perform data augmentation. First, the category 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 category to which the Gaussian component belongs. Then, the feature code corresponding to the category information is sampled from the corresponding Gaussian component. The feature code and category information are input into the generator, and the generated data is decoded and output to complete the data augmentation.
[0060] The advantages and beneficial effects of the present invention are:
[0061] Compared to traditional conditional variational autoencoders, the encoder structure of the present invention only retains real data input and captures the mapping of data to feature space. Different categories of data can be modeled in the same feature space. This allows feature learning based on existing data to help extract features of new categories of data when the detection parameters remain unchanged and the detection sample categories are not very different (volatile odor components are similar). A Gaussian mixture distribution is introduced into the feature space to fit the prior distribution, and each category of data is modeled by a Gaussian component, allowing independent training of distributions between different categories. The generator structure learns the decoding process from the Gaussian mixture distribution to the real data distribution. Based on the input feature encoding, category information is added to help the generator determine the Gaussian component to which it belongs in the Gaussian mixture distribution, avoiding decoding generated data of the wrong category. This structural design effectively improves the generalization ability of the model. Based on the feature extraction and decoding of existing data, data that can be applied to new categories is generated, the feature distribution of the new category is learned, and generated data is sampled from this distribution.
[0062] The present invention incorporates category loss and conditional loss into the total loss function. The category loss allows the model to focus more on the category accuracy of the generated data, preventing incorrect categories in the generated data from affecting the accuracy of the electronic nose's pattern recognition. Generated data is continuously added to train auxiliary classifiers during the training process, gradually strengthening the classifier's recognition ability. The conditional loss forces the features obtained after the generated data is encoded by the encoder to be similar to the mean of the original feature distribution. This ensures the consistency of the features of the re-encoded generated data, making the generated data similar to the real input data. This is an important component in ensuring the authenticity and validity of the generated data.
[0063] The present invention comprehensively considers two application scenarios of data generation. From the perspective of model structure and loss function design, the present invention can simultaneously meet the requirements of two generation applications, making the present invention have a wider scope of application in electronic nose data generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 1 is a flowchart of GMEGAN model training and data generation in an embodiment of the present invention.
[0065] Figure 2 It is a visualization diagram of real data in an embodiment of the present invention.
[0066] Figure 3 It is a visualization diagram of the generated data in the embodiment of the present invention.
[0067] Figure 4 It is a manifold diagram of real data and generated data in an embodiment of the present invention.
[0068] Figure 5This is a t-SNE dimensionality reduction visualization diagram of the generated data and real data based on sampling in an embodiment of the present invention.
[0069] Figure 6 It is a visualization diagram of the new type of data in the embodiment of the present invention.
[0070] Figure 7 is a visualization diagram of the new type of fine-tuning data in an embodiment of the present invention.
[0071] Figure 8 It is a visualization diagram of the a priori generated data in an embodiment of the present invention.
[0072] Figure 9 It is a visualization diagram of the reconstructed sampling data in an embodiment of the present invention.
[0073] Figure 10 This is a distribution diagram of existing data after fine-tuning of the new category in an embodiment of the present invention.
[0074] Figure 11 Schematic diagram of the structure of the GMEGAN model in an embodiment of the present invention.
[0075] Figure 12a It is a diagram of the model reasoning process in an embodiment of the present invention.
[0076] Figure 12b 1 is a diagram of the model generation process in an embodiment of the present invention. DETAILED DESCRIPTION
[0077] The following describes the specific embodiments of the present invention in detail with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only used to illustrate and explain the present invention and are not intended to limit the present invention.
[0078] Since there is a high correlation between the electronic nose data and categories of different samples, the present invention proposes an electronic nose data generation method based on an autoencoder and a generative adversarial network. It is assumed that the sample features of each category of samples are Gaussian distributed and the overall features are 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 constructed by the present invention combines the category feature distribution of the learnable data, clusters it into a Gaussian mixture model, and generates corresponding data according to the features and categories.
[0079] like Figure 1 As shown, the present invention constructs a GMEGAN model and, after pre-training and initialization, uses an adversarial strategy to train a neural network to generate data based on sampling. After fine-tuning the existing model using new data, migration generation can be performed. Specifically, the steps include:
[0080] Step S101: Sampling multiple odor objects for data amplification through sensors, using 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 training set S1 and test set S2 in a ratio of 6:4, with the numbers N1 and N2 respectively, where N1+N2=N.
[0082] Step S102: Based on the Gaussian mixture variational autoencoder and the conditional generative adversarial network, a Gaussian mixture embedding generative adversarial network GMEGAN model is constructed. 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 GMEGAN model structure is as follows:
[0084] The encoder E consists of three one-dimensional convolutional layers and three fully connected layers. The activation function is ReLU. The convolutional layer size is [1×5, 1×3, 1×3], the number of convolution kernels is [256, 128, 64], and the convolution step size is 2. The output tensor size of the last convolution layer is [b, 64,n l ], where n l is the length of the original signal after three layers of convolution, b represents the number of batches of data (batch size), and the tensor is reshaped into a two-dimensional tensor with a specific size of [b, 64×n l The first fully connected layer W3 has a size of [64×n l , 100], the feature encoding dimension is L, the second and third fully connected layers W1 and W2 are both of size [100, L], W1 and W2 output the mean and standard deviation of the feature distribution respectively, and the two are connected in parallel after W3.
[0085] Gaussian mixture model GMM contains K Gaussian components and the weight parameters π of the K Gaussian components k (k=1,2,…,K), the dimension of each Gaussian component is L, and the weight parameter is .
[0086] The generator G consists of three fully connected layers connected in sequence, and the activation function is ReLU. Because the input is the feature code and the category vector, the dimension of the fully connected layer is [L+K, 256, 512, l*s].
[0087] The discriminator D consists of three fully connected layers connected in sequence. The activation function is ReLU, and the dimensions are [l*s, 512, 256, 1]. The last fully connected layer is followed by an output layer. The output layer uses the sigmoid function. The sigmoid function limits the output to between [0, 1], which serves as the basis for judging 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 selected, which consists of three one-dimensional convolutional layers and two fully connected layers connected in sequence. The activation function is ReLU, the convolutional layer size is [1×5, 1×3, 1×3], the number of convolution kernels is [256, 128, 64], and the convolution step size is 2. The dimension of the first fully connected layer is [64×n l ,100], the dimension of the second fully connected layer is [100, K], followed by the output layer, which uses the softmax function to convert the output vector into the probability of K categories.
[0089] Step S103: Training 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 GMEGAN's encoder E and generator G is similar to that of the autoencoder, without the re-parameterization operation of the variational autoencoder. Therefore, only W1 in the encoder participates in the pre-training, and W2 does not participate in the pre-training. The feature code 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 preliminary nonlinear feature extraction capabilities. The data in the training set S1 is input into the encoder to obtain the feature code. Each data has a feature code, so the mean of the feature code of each class is calculated as the mean of the corresponding Gaussian component, and the standard deviation of the feature code 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 code of a category is used as the mean of the Gaussian component of the corresponding category, and the standard deviation of the feature code of a category is used as the standard deviation of the Gaussian component of the corresponding category;
[0091] The formulas for calculating the mean and standard deviation of feature encoding are as follows:
[0092] (1)
[0093] in, is the mean of all feature codes for the kth category; is the total number of sample data of the kth category; Encode the features of the i-th sample data in the k-th category; The standard deviation of all feature encodings for the k-th class.
[0094] Step S202: Training process:
[0095] Step S301: Preparation stage, training set Contains K categories of data, and the amount of data in each category is recorded as , calculate and update the weight parameters of each Gaussian mixture model GMM according to formula (2). The formula for calculating the weight parameters of each Gaussian mixture model GMM is as follows:
[0096] (2)
[0097] Among them, π is the set of weight parameters of the Gaussian mixture model GMM, ; is the weight of the Gaussian component to which the sample data x belongs; is the Gaussian component to which the sample data x belongs; is the category information of the sample data x.
[0098] Divide the training set S1 into n batches of data , each batch of data include training data, all batch data are input once as a cycle (epoch);
[0099] Step S302: The feature distribution of each batch of data obtained by the encoder is expressed in the form of mean and standard deviation, and is sampled from the feature distribution by Monte Carlo. Feature encoding and supervised category labels are then randomly sampled from the Gaussian mixture model GMM Feature codes and corresponding category information; these 2 The feature codes and category information are connected and input into the generator for decoding to obtain the generated data.
[0100] That is, each After passing through encoder E, we can get Feature distribution ,in , ; From each Randomly sample a feature code to get , known category labels , the generator G is ( , ) decoding finally gets , ;
[0101] Random sampling from a Gaussian mixture model GMM The feature code is recorded as , the corresponding category information , the generator for each ( , ) is decoded and finally obtained , .
[0102] Step S303: Fix the encoder E and generator G, train the discriminator D and auxiliary classifier C, the generator G inputs the generated data to the discriminator D and auxiliary classifier C respectively, and the discriminator D and auxiliary classifier C will receive the sample data; mark the generated data and sample data as False and True respectively, and maximize the formula (3) Update the discriminator D:
[0103] (3)
[0104] in, represents the loss function of the generative adversarial network; Express obedience The expected value of the distribution, x represents the sample data, Represents the distribution of sample data x; Represents generated data, z represents feature encoding, and c represents category information; Represents the discriminator output result; Express obedience The expected value of the distribution, Represents sample data x and generated data Random interpolation data distribution between Represents difference data, represents the interpolation data distribution; λ represents the weight; Express The L2 norm result after derivation;
[0105] When the training cycle is less than the set threshold, the parameters of the discriminator D and the auxiliary classifier C are updated simultaneously to maximize the loss of the generated adversarial network. Update the parameters of the discriminator D in this way. 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. According to formula (4), minimize Update the auxiliary classifier C parameters:
[0106] (4)
[0107] in, Indicates generated data The output of the corresponding auxiliary classifier C; Represents the category information of the kth category, K represents the total number of categories, represents the number of generated data input to the auxiliary classifier C;
[0108] Step S304: Fixed the discriminator D and the auxiliary classifier C to train the encoder E and the generator G. According to formula (5), the KL divergence loss between the feature encoding of the real data (i.e., sample data) obtained by the encoder and the Gaussian mixture model is calculated. :
[0109] (5)
[0110] in, Represents the KL divergence loss of sample data x; L represents the dimension of the Gaussian component; The l-th dimension variable representing the mean of the characteristic distribution of 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 representing the mean of the Gaussian component to which the sample data x belongs; The l-th dimension variable representing the standard deviation of the Gaussian component to which the sample data x belongs;
[0111] According to formula (6), the reconstruction loss between the feature encoding generated by the Monte Carlo method and the corresponding sample data is calculated :
[0112] (6)
[0113] in, Represents the reconstruction loss of sample data x; m represents the number of Monte Carlo samples, Represents the d-th dimension variable of the i-th sample data in Monte Carlo sampling; represents the d-th dimension variable of the i-th feature encoding in Monte Carlo sampling; v represents the maximum dimension of the sample data x;
[0114] After re-inputting the generated data into the encoder E, the reconstructed feature distribution is obtained , calculated according to formula (7) :
[0115] (7)
[0116] in, represents the output of the hth fully connected layer of the auxiliary classifier C, represents the dimension of the hth fully connected layer; represents the mean of sample data x; represents the function of the generator G, S1 represents the training set of electronic nose data, N1 represents the number of electronic nose data training sets, z represents feature encoding, c represents category information, and L represents the dimension of feature encoding;
[0117] The loss function of the GMEGAN model is constructed by weighted summing the losses of each part. The formula is as follows:
[0118] (8)
[0119] in, represents the total loss function; Represents the reconstruction loss function of sample data x; Represents the KL divergence loss function of sample data x; represents the loss function of the generative adversarial network; represents the category cross entropy loss function; represents the conditional loss function; Express obedience The expected value of the distribution, x represents the sample data, Represents the distribution of sample data x; E represents the encoder, G represents the generator, and D represents the discriminator. 、 and represents the corresponding loss weight, and .
[0120] Update the parameters of the encoder E and generator G by gradient descent.
[0121] Step S305: After all training data have been trained for one cycle, the KL loss mean of the Gaussian components corresponding to the feature distribution of all training set data is calculated according to formula (9): , update the Gaussian components of the Gaussian mixture model through the gradient backpropagation method:
[0122] (9)
[0123] Step S306: Repeat steps S302 to S305 in each cycle until the model converges or the total number of cycles is reached.
[0124] Step S104: Based on the sampling data generation method, the trained Gaussian mixture embedding generative adversarial network model is used to perform data amplification; based on the migration data generation method, new categories of data are amplified according to the existing data of different categories.
[0125] The data generation method based on sampling aims to solve the problem of amplifying existing data of different categories and generate generated data that meets the characteristics of the corresponding categories. According to the different sampling methods, it is divided into reconstruction sampling and prior sampling. Reconstruction sampling is to generate data based on the output of set multiples of the input data quantity, and prior sampling is to generate data with a set output quantity.
[0126] The reconstruction sampling method inputs the data to be amplified into a trained Gaussian mixture embedding generative adversarial network model, where the data to be amplified is obtained by 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, and a feature code is obtained from the feature distribution through Monte Carlo sampling. The feature distribution is inferred through the Gaussian mixture model GMM of the 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 to which the feature code belongs. The obtained feature code and category information are input into the generator G of the model, and the generator G decodes and outputs the generated data to complete the data amplification;
[0127] Specifically, the reconstruction sampling method converts the test set Data is input into the GMEGAN model, and the encoder E outputs the mean of the feature distribution and standard deviation The feature code is directly obtained from the feature distribution through Monte Carlo sampling. The Gaussian mixture model infers the mean of the feature distribution to obtain the probability of belonging to each Gaussian component. The component with the highest probability is taken as the category information and converted into a one-hot vector. The prior sampling method first samples the category information from the Gaussian mixture model according to the probability of the component belonging to the class, and then samples the corresponding Gaussian component to obtain the feature code. The feature code and category information are input into the generator, and the decoded output is the generated data.
[0128] The prior sampling method uses the trained Gaussian mixture embedding generative adversarial network model to perform data augmentation. First, the category information of the data to be augmented is obtained from the Gaussian mixture model GMM of the trained Gaussian mixture embedding generative adversarial network model according to the probability of the category to which the Gaussian component belongs. Then, the feature code corresponding to the category information is sampled from the corresponding Gaussian component; the feature code and category information are input into the generator G of the model, and the decoded output generates the data to complete the data augmentation.
[0129] The migration-based data generation method aims to solve the problem of amplifying new categories of data based on existing data of different categories. The model's encoder learns the mapping from real data to feature distribution through training on existing data. It can map new class data into the feature space, forming new classes in the feature space. After fine-tuning training on the new class data, subsequent generation can better capture the mapping relationship between the distribution of new classes in the feature space and the distribution of real data. The data migration process includes the following steps:
[0130] Step S401: using an electronic nose to sample a new odor object to be migrated, and adding the sampled new sample data to the electronic nose dataset S in step S101 to obtain a first electronic nose dataset S';
[0131] GMEGAN model initialization: a small number of sample data of a new category (not belonging to the K categories), the number of samples The model category number parameter is set to K+1, and the training set contains K categories of data. After the training is completed, the new category data and training set Data mixing retrains the auxiliary classifier. Add a new Gaussian component to the Gaussian mixture model GMM ,Will The data of a new category is input into the GMEGAN model, and the encoder E outputs the mean of the feature distribution and standard deviation , take the mean of the feature encoding of the new category as the mean of the Gaussian component of the new category, and take the standard deviation of the feature encoding of the new category as the standard deviation of the Gaussian component of the new category; get the new Gaussian component .
[0132] Step S402: retraining the trained Gaussian mixture embedding generative adversarial network model using the first electronic nose dataset S';
[0133] Fine-tune the model using new category data: Use prior sampling to randomly sample a certain number of feature codes from the new Gaussian components and feature coding Corresponding category information , the generator is based on feature encoding and category information (One-hot vector of the new category) decoding outputs the first generated data.
[0134] The encoder E and generator G are fixed. The generator G inputs the first generated data into the discriminator D and the auxiliary classifier C respectively, and the discriminator D and the auxiliary classifier C receive new sample data. When the number of training cycles is less than the set threshold, only the parameters of the discriminator D are updated to maximize the loss of the first generative adversarial network. Update the parameters of the discriminator D in the following way; the first generative adversarial network loss for:
[0135] (10)
[0136] in, Express obedience The expected value of the distribution, Represents sample data of the new category, Sample data representing new categories distribution of represents the first generated data, Represents the feature encoding of sample data of new categories, Represents the category information of the sample data of the new category; represents the function of the discriminator; Express obedience The expected value of the distribution, Sample data representing new categories With the first generated data Random interpolation data distribution between Represents the difference data of the sample data of the new category, Interpolated data distribution representing sample data of new categories; represents weight; Express The L2 norm result after derivation.
[0137] When the number of training cycles 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 first generative adversarial network loss Update the parameters of the discriminator D in this way. When 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 of the new category, and the mixed data is input into the auxiliary classifier C to minimize the cross entropy loss of the first category. Update the parameters of the auxiliary classifier C in the way of the first category cross entropy loss for:
[0138] (11)
[0139] in, Indicates the first generated data The output of the corresponding auxiliary classifier C; represents the number of first generated data input to the auxiliary classifier C.
[0140] Fixed the discriminator D and auxiliary classifier C, and calculated the first KL divergence loss of the Gaussian mixture model GMM:
[0141] (12)
[0142] in, Sample data representing new categories KL divergence loss; L represents the dimension of the Gaussian component; Sample data representing new categories The l-th dimension variable of the mean of the characteristic distribution; Sample data representing new categories The l-th dimension variable of the standard deviation of the characteristic distribution; Sample data representing new categories The l-th dimension variable of the mean of the Gaussian component to which ; The l-th dimension variable representing 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 category sample data :
[0144] (13)
[0145] in, Sample data representing new categories The first reconstruction loss; represents the number of samples of the prior sampling method, Represents the d-th dimension variable of the sample data of the i-th new category in the prior sampling; Represents the d-th dimension variable of the reconstructed data of the sample data of the i-th new category in the prior sampling; Sample data representing new categories The maximum dimension of .
[0146] Re-input the first generated data into the encoder E to obtain the reconstructed feature distribution , and calculate the first constraint :
[0147] (14)
[0148] in, Sample data representing new categories The mean of Indicates the Gaussian component to which the sample data of the new category belongs, GMM represents the Gaussian mixture model, Represents the feature encoding of sample data of new categories, Indicates the category information of the sample data of the new category, represents the number of sample data of 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 the encoder E and generator G by gradient descent;
[0153] After training is completed, calculate the first KL divergence loss mean of the Gaussian mixture model GMM , and update the Gaussian component of the Gaussian mixture model GMM by the gradient back propagation method; the first KL divergence loss mean for;
[0154] (16)
[0155] Step S403: Based on the sampling data generation method, data migration is performed again on the trained Gaussian mixture embedding generative adversarial network model:
[0156] The newly added Gaussian components are obtained from the obtained Gaussian mixture model GMM, and the feature coding and corresponding category information are obtained from the newly added Gaussian components through the prior sampling method. The feature coding and category information are input into the generator G obtained by the second training. The generator G decodes and outputs the generated data to complete the data migration of the sample data of the new category.
[0157] In this example, a self-made electronic nose based on a MOS gas sensor array was used as the experimental device. It is specifically divided into four subsystems: a main control module, a sampling module, a signal transmission module, and an industrial computer. The main control module uses an STM32F103RCT6 single-chip microcontroller as the main control chip, responsible for controlling the electronic nose's reception of commands, execution of various functions, data transmission, and the opening and closing of the air pump and solenoid valve. The sampling module includes an array of 12 MOS gas sensors, a sampling circuit, and a 16-bit AD7616 digital-to-analog converter chip. After completing analog-to-digital conversion, the AD7616 uses the voltage of the divided load as the response signal. The signal transmission module uses the ESP-01S wireless network connection module based on the ESP8266EX chip, with firmware supporting the MQTT protocol, STA / AP / STA+AP operating modes, and Smart Config / AirKiss network configuration technology, meeting the basic requirements for electronic nose data communication. An MQTT server and a MySQL server are deployed on the industrial computer, and independently developed electronic nose visualization software is installed, which can realize functions such as command sending, data reception and visualization, data storage and analysis, and pattern recognition method deployment.
[0158] In the examples of the present invention, yellow rice wine was used as the experimental subject. Yellow rice wine of different ages has unique aroma characteristics. For five types of yellow rice wine with different ages: 3 years, 5 years, 8 years, 10 years, and 20 years, 120 samples of each sample were prepared and tested using an electronic nose, totaling 600 sample data. The sample preparation process is as follows: Take 20ml of yellow rice wine sample and place it in a 250ml special gas sample collection bottle. Let it stand at 25℃ for 10 minutes. The sample detection process is as follows: Connect the air inlet and outlet of the electronic nose to the two ends of the collection bottle. The detection process is divided into three stages: pre-cleaning, sampling, and cleaning, with a time of 40s, 50s, and 180s respectively. The detection time for each sample is 270s.
[0159] The process of electronic nose data generation and verification is as follows:
[0160] 1. Data preprocessing: sensor signals are recorded as , where i represents the i-th moment and s represents the serial number of the sensor. The pre-cleaning stage signal of each sensor is regarded as the baseline signal, which is recorded as The baseline removal method was used to remove the signal differences of the electronic nose during the pre-cleaning phase. The maximum value was manually set to 3.3, and the sensor signal was divided by the maximum value to normalize all data to between (0, 1). The specific calculation formula is as follows:
[0161]
[0162] in, is the normalized sensor signal.
[0163] 2. Dataset division: Divide the data set into training sets in an average ratio of 6:4 and test set , containing 360 and 240 sample data 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. GMEGAN model pre-training and initialization of Gaussian mixture model: set the sample data of batch size to 20, and The data was divided into 18 batches, and the pre-training epoch was set to 100. In each epoch, the training data was progressively fed into the encoder E according to the number of batches. The hidden layer vectors output by the encoder were 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 was calculated, and the model parameters were updated using gradient descent. After pre-training, the entire training set was fed into the encoder, generating feature codes for 360 data points. The mean and variance of the feature codes for the 72 data points in each category were calculated as the mean and variance of the corresponding Gaussian components.
[0165] 4. GMEGAN model training: Set the training cycle to 800, the threshold to 300, the batch size to 20 sample data, and the training set The data is divided into 18 batches, and the training data is gradually input into the model according to the batch number in each cycle.
[0166] 4.1. Fixed encoder and generator. For each batch of data, after passing through the encoder, the feature distribution (mean and variance) is output. Monte Carlo sampling is performed from the feature distribution to obtain 20 feature codes. The feature codes and the categories corresponding to the data are spliced and input into the generator to obtain 20 generated data (reconstructed sampling). 20 feature codes and categories are randomly sampled from the Gaussian mixture model and passed through 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 formula (8) is used to calculate When the training cycle exceeds the threshold, the auxiliary classifier C is trained by mixing the 20 generated data with the correct output of the auxiliary classifier and the 20 real data. According to formula (9), ,Will and Additive gradient descent updates the parameters of the discriminator D and auxiliary classifier C.
[0167] 4.2. Fixed encoder and generator, calculate the KL divergence loss of 20 feature distributions and Gaussian mixture model according to formula (6) , according to formula (3), the reconstruction loss of the 20 generated data and input data of the reconstruction sample is calculated , after re-inputting these 20 generated data into the encoder E, the reconstructed feature distribution is obtained and calculated according to formula (10) , mark all 40 generated data as True and input them into the discriminator D and the auxiliary classifier C, and calculate them according to formulas (8) and (9) respectively and , perform weighted summation of the losses of each part according to formula (11), and update the parameters of the encoder E and generator G by gradient descent.
[0168] 4.3. After each training cycle is completed, the KL divergence loss of the feature distribution of 360 data and the corresponding Gaussian components is calculated according to formula (6): , gradient descent updates the Gaussian mixture model;
[0169] 5. Data generation based on sampling:
[0170] 5.1. Reconstruction Sampling Method Input the 360 rice wine data of the training set into the GMEGAN model, and the encoder E outputs the mean of the feature distribution and variance , 720 feature codes are obtained from the feature distribution by Monte Carlo sampling at a ratio of 2, and the Gaussian mixture model is used to calculate the mean of the feature distribution Inference is performed to obtain the probability of belonging to each Gaussian component, and the component with the highest probability is taken as the category information to which it belongs. The 720 feature codes and the corresponding category information are input into the generator to obtain 720 generated data.
[0171] 5.2. Prior Sampling Method: First, we sample the Gaussian mixture model based on the probability of the component belonging to the class to obtain the category information, and then sample the corresponding Gaussian components to obtain the feature code. The feature code and category information are input into the generator to decode and output the generated data.
[0172] 6. Data generation based on migration:
[0173] Taking 3-year-old rice wine as a new category, the existing data for 5-, 8-, 10-, and 20-year-old rice wines is 72 samples per category. 20 samples of the 8-year-old rice wine are randomly selected as training data for initializing and fine-tuning 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 data from 4 categories of rice wine. The 20 data points for 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 according to Equation (12). Then, the model is fine-tuned using the 3-year-old rice wine data: the encoder E and generator G are fixed, and 20 3-year-old rice wine data are generated using a priori sampling. The generated data and the real 3-year-old 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), and the encoder and generator are updated. After the above steps are completed, the 20 generated 3-year-old rice wine data are input into the encoder to obtain the feature distribution. The KL loss between the 20 feature distributions and the Gaussian components corresponding to the 3-year-old rice wine is calculated according to equation (6), and 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-old rice wine in the Gaussian mixture model to obtain the feature code, and then concatenate the feature code with the category information and input it into the decoder to obtain the generated data.
[0174] 7. Generate data quality evaluation and auxiliary effects:
[0175] 7.1. Effectiveness Testing of Sampling-Based Data Generation Methods: The real training set and generated data were mixed to create mixed training sets at ratios of 1:1, 1:5, 1:10, and 1:20. Four classification models, SVM, LR, KNN, and ANN, were trained using these training and mixed training sets. The effectiveness of generated data in improving classification performance was evaluated by averaging the classification accuracy of these models across 10 runs on the rice wine test set. The results are shown in Table 1. The table shows that the inclusion of generated data significantly improved the classification accuracy of the various classification models. When the ratio of real data to generated data was 1:10, each classifier achieved optimal performance. The SVM achieved an accuracy of 95%, a 5% improvement; the LR achieved an accuracy of 91.1%, a 2.8% improvement; the KNN achieved an accuracy of 88.3%, a 2.7% improvement; and the ANN achieved the highest prediction accuracy (98.3%), a 4.4% improvement over the real data. As the proportion of generated data increased, the classification performance of the models initially increased, then decreased, or remained constant. This may be because the mixing strategy used in our mixed dataset is relatively rough. 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 more category boundaries of the generated data are taken into account by the classifier.
[0176] Table 1 Classification model prediction results
[0177]
[0178] PCA and t-SNE dimensionality reduction methods are used to visualize the generated data and real data respectively. The results are as follows: Figures 2 to 4 ,as well as Figure 5 As shown in the figure, the distribution of generated data is highly similar to real data. By adding generated data to real data, we can effectively fill in the gaps in the data distribution. These gaps are caused by insufficient data, which blurs the boundaries between different categories. Therefore, generated data can help classifiers better identify data of different categories.
[0179] Figure 5 This is the effect of t-SNE dimensionality reduction visualization of the same amount of real data and generated data. The cross symbol represents the real rice wine data, and the triangle symbol represents the generated rice wine data. It can be seen from the figure that the low-dimensional manifolds of the generated data and the real data have a high correlation and similarity, and cover the blank area between the real data. This shows 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, and help the subsequent classification model and regression model to identify the boundaries of the data, and improve the fitting ability and stability of the model.
[0180] 7.2. Test of the effect of the transfer-based generation method: Randomly sample 50 feature codes from the Gaussian components corresponding to 3-year-old rice wine, use the generator to decode to get the generated output, and use PCA to reduce the dimension of the new class data and the center of the Gaussian components and visualize the results. Figures 6 to 9 As shown, we can see that the distribution of the generated data scatter points and the real fine-tuning data are basically consistent and closely surround the center of the Gaussian component, which shows that the data generated based on migration and the real data have similar characteristics.
[0181] Figure 10 The visualization distribution of real data and generated data (reconstructed sampling and prior sampling) under the t-SNE dimensionality reduction method is shown. It can be seen that the new category data can relatively well fill the blank areas in the real data manifold and has a relatively clustered characteristic. After using a small amount of data to fine-tune the generative model based on existing data, it can also effectively generate new category sample data.
[0182] The real three-year-old rice wine and the generated three-year-old rice wine were mixed in the ratios of 1:1, 1:5, 1:10, and 1:20. The four mixed training sets were used to train the four classification models of SVM, LR, KNN, and ANN respectively. The remaining 100 three-year-old rice wine data were used as the test set, and the average value of 10 tests was taken as the final accuracy. The classification accuracy results of these classification models for three-year-old rice wine are shown in Table 2.
[0183] Table 2 Classification model prediction results
[0184]
[0185] As can be seen from the table, the classification accuracy of each model is relatively low when using only real data due to the limited training data. When the ratio of real data to generated data is 1:5, the SVM, LR, and ANN classifiers achieve optimal performance, and when the ratio is 1:10, the KNN classification effect is the highest. This may be because KNN is a nearest neighbor classification method, which performs poorly when the training data is small. When generated data is added to the training set, KNN accuracy is significantly improved. In addition, the classification performance of other classifiers has also improved to a certain extent, indicating that transfer-based data generation methods can improve the accuracy of classification models by mixing generated data of new categories with training data, thereby improving the model's ability to classify small amounts of new categories.
[0186] Figure 11 The diagram shows the architecture of the GMEGAN model and its three stages: pre-training, training, and fine-tuning. Sampling-based data generation methods only use the first two stages, while transfer-based methods use all stages. The red arrows in the figure indicate the calculation of the model's various loss functions, the blue area indicates the direction of data flow, and the green arrows distinguish between real data entering the discriminator and the auxiliary classifier.
[0187] Figure 12a 、 Figure 12b The inference and generation processes of the model are shown respectively. Figure 12a The dotted line represents training and the solid line represents testing. During training, input data x and encode the input data x , the model encodes the output z, and at the same time obtains the category c corresponding to x in a supervised way; when testing, input x, and after the model encodes z, the GMM model is needed to infer z to obtain the possible c. Figure 12b Represents the data generation process. Based on the prior sampling method, the category c is first randomly selected, and then the feature code z is sampled from the Gaussian distribution; the reconstruction sampling method is connected to the inference process. By randomly sampling z from the feature distribution, GMM infers the category c based on z, and finally inputs c and z together into the generator (the function of the generator is ) to get x.
[0188] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein. However, these modifications or replacements 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. The electronic nose data generation method based on autoencoder and generative adversarial network is characterized by The steps include: Step S101: sampling multiple odor objects to be amplified using a sensor, using the obtained odor response signals as sample data, and constructing an electronic nose data set; Step S102: Based on the Gaussian mixture variational autoencoder and the conditional generative adversarial network, a Gaussian mixture embedding generative adversarial network model is constructed, including an encoder, a Gaussian mixture model, a generator, a discriminator, and an auxiliary classifier; Step S103: training the Gaussian mixture embedding generative adversarial network model using the electronic nose dataset; The sample data is passed through an encoder and a Gaussian mixture model to obtain feature encoding and corresponding category information, 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; Fix the discriminator and auxiliary classifier to train the encoder and generator; Step S104: Based on the migration data generation method, the new category of data is amplified according to the existing data of different categories, and the trained Gaussian mixture embedding generative adversarial network model is retrained using the new electronic nose dataset; Sampling a new odor object to be subjected to data migration through a sensor, and adding the new sample data to the electronic nose dataset to obtain a new electronic nose dataset; Add a new Gaussian component to the Gaussian mixture model, input the new category of data into the Gaussian mixture embedding generative adversarial network model, and set the new category of Gaussian components with the feature encoding of the new category output by the encoder; Based on the new Gaussian component, sample data of the new category is sampled to obtain a new feature code and corresponding new category information, and then decoded by the generator to obtain new generated data. The encoder and the 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 the new generator.
2. The electronic nose data generation method based on an autoencoder and a generative adversarial network according to claim 1, characterized in that: In step S103, the discriminator and the auxiliary classifier are trained. When the training cycle is less than a set threshold, the discriminator and the auxiliary classifier are updated simultaneously, and the discriminator is updated by maximizing the generative adversarial network loss. When the number of training cycles is greater than or equal to the threshold, and the auxiliary classifier outputs a correct result and the probability of outputting the result is greater than a preset confidence level, the corresponding generated data is mixed with the sample data, and the auxiliary classifier is updated by minimizing the category cross entropy loss. In step S103, the encoder and generator are trained, the divergence loss of the sample data after passing through the encoder and the 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 category cross entropy loss, the divergence loss, the reconstruction loss and the conditional loss to update the encoder and generator; In step S104, the discriminator and the auxiliary classifier are trained. When the training cycle is less than a set threshold, the discriminator is updated and updated by maximizing the generative adversarial network loss. When the number of training cycles is greater than or equal to the threshold, 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 the result is greater than a preset confidence level, the corresponding generated data is mixed with sample data of the new category to minimize the new category cross entropy loss and update the auxiliary classifier. In step S104, the encoder and generator are trained, the new divergence loss of the sample data of the new category after passing through the encoder and the Gaussian mixture model is calculated, the new reconstruction loss of the sample data of the new category is calculated, and the new conditional loss of the new generated data re-input into the encoder for reconstruction is calculated; 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, a new total loss is constructed to update the encoder and generator.
3. The electronic nose data generation method based on an autoencoder and a generative adversarial network according to claim 2, characterized in that: In step S103, a pre-training process is performed before training. The sample data is input into an encoder to obtain a feature code. Each data has a feature code. The mean of the feature code of each class is calculated as the mean of the corresponding Gaussian component. The standard deviation of the feature code of each class is calculated as the standard deviation of the corresponding Gaussian component. Each component of the Gaussian mixture model is initialized. In step S104, the Gaussian mixture embedding generative adversarial network model is initialized, and a new Gaussian component is added to the Gaussian mixture model. After the new category of data is input into the Gaussian mixture embedding generative adversarial network model, the encoder outputs the mean and standard deviation of the feature distribution, and 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 to obtain a new Gaussian component.
4. The electronic nose data generation method based on an autoencoder and a generative adversarial network according to claim 2, characterized in that: In step S103, the formula for generating the adversarial network loss function is as follows: , in, represents the loss function of the generative adversarial network; Express obedience The expected value of the distribution, x represents the sample data, Represents the distribution of sample data x; Represents generated data, z represents feature encoding, and c represents category information; Represents the discriminator output result; Express obedience The expected value of the distribution, Represents sample data x and generated data Random interpolation data distribution between Represents difference data, represents the interpolation data distribution; λ represents the weight; Express The L2 norm result after derivation; In step S104, the formula of the new generative adversarial network loss function is as follows: , in, Express obedience The expected value of the distribution, Represents sample data of the new category, Sample data representing new categories distribution of represents the first generated data, Represents the feature encoding of sample data of new categories, Represents the category information of the sample data of the new category; represents the function of the discriminator; Express obedience The expected value of the distribution, Sample data representing new categories With the first generated data Random interpolation data distribution between Represents the difference data of the sample data of the new category, represents the interpolated data distribution of the sample data of the new category; λ represents the weight; Express The L2 norm result after derivation.
5. The electronic nose data generation method based on an autoencoder and a generative adversarial network according to claim 2, characterized in that: In step S103, the formula of the category cross entropy loss function is as follows: , in, Indicates generated data The output of the corresponding auxiliary classifier C; Represents the category information of the kth category, K represents the total number of categories, represents the number of generated data input to the auxiliary classifier C; In step S104, the formula of the new category cross entropy loss function is as follows: , in, Indicates the first generated data The output of the corresponding auxiliary classifier C; represents the number of first generated data input to the auxiliary classifier C.
6. The electronic nose data generation method based on an autoencoder and a generative adversarial network according to claim 2, characterized in that: In step S103, the formula of the divergence loss function is as follows: , in, Represents the KL divergence loss of sample data x; L represents the dimension of the Gaussian component; The l-th dimension variable representing the mean of the characteristic distribution of 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 representing the mean of the Gaussian component to which the sample data x belongs; The l-th dimension variable representing the standard deviation of the Gaussian component to which the sample data x belongs; In step S104, the formula of the new divergence loss function is as follows: , in, Sample data representing new categories KL divergence loss; L represents the dimension of the Gaussian component; Sample data representing new categories The l-th dimension variable of the mean of the characteristic distribution; Sample data representing new categories The l-th dimension variable of the standard deviation of the characteristic distribution; Sample data representing new categories The l-th dimension variable of the mean of the Gaussian component to which ; The l-th dimension variable representing the standard deviation of the Gaussian component to which the sample data of the new category belongs.
7. The electronic nose data generation method based on an autoencoder and a generative adversarial network according to claim 2, characterized in that: In step S103, the formula for reconstructing the loss function is as follows: , in, Represents the reconstruction loss of sample data x; m represents the number of Monte Carlo sampling, Represents the d-th dimension variable of the i-th sample data; represents 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 of the new reconstruction loss function is as follows: , in, Sample data representing new categories The reconstruction loss; represents the number of samples of the prior sampling method, The d-th dimension variable representing the sample data of the i-th new category; The d-th dimension variable representing the reconstructed data of the sample data of the i-th new category; Sample data representing new categories The maximum dimension of .
8. The electronic nose data generation method based on an autoencoder and a generative adversarial network according to claim 2, characterized in that: In step S103, the formula of the conditional loss function is as follows: , in, represents the output of the hth fully connected layer of the auxiliary classifier C, represents the dimension of the hth fully connected layer; represents the mean of sample data x; represents the function of the generator G, S1 represents the training set of electronic nose data, N1 represents the number of electronic nose data training sets, z represents feature encoding, c represents category information, and L represents the dimension of feature encoding; In step S104, the formula of the new conditional loss function is as follows: , in, Sample data representing new categories The mean of Indicates the Gaussian component to which the sample data of the new category belongs, GMM represents the Gaussian mixture model, Represents the feature encoding of sample data of new categories, Indicates the category information of the sample data of the new category, represents the number of sample data of the new category, and S' represents the new electronic nose dataset.
9. The electronic nose data generation method based on an autoencoder and a generative adversarial network according to claim 2, characterized in that: In step S103, the formula of the total loss function is as follows: , in, represents the total loss function; Represents the reconstruction loss function of sample data x; Represents the KL divergence loss function of sample data x; represents the loss function of the generative adversarial network; represents the category cross entropy loss function; represents the conditional loss function; Express obedience The expected value of the distribution, x represents the sample data, Represents the distribution of sample data x; 、 and Represents the corresponding loss weight, E represents the encoder, G represents the generator, and D represents the discriminator; In step S104, the formula of the new total loss function is as follows: , in, represents the new total loss function, Sample data representing new categories The reconstruction loss function is Sample data representing new categories The KL divergence loss function, represents the new generative adversarial network loss function, represents the new category cross entropy loss function, represents the new conditional loss function, Express obedience The expected value of the distribution, Represents sample data of the new category, Sample data representing new categories distribution.
10. The electronic nose data generation method based on autoencoder and generative adversarial network according to claim 1, characterized in that: In step S104, data amplification is performed using a trained Gaussian mixture embedding generative adversarial network model based on a sampling data generation method; the sampling data generation method includes reconstruction sampling and prior sampling, wherein the reconstruction sampling outputs generated data of a set multiple based on the number of input data, and the prior sampling outputs a set number of generated data; 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, obtains a feature code from the feature distribution through Monte Carlo sampling, and infers the feature distribution through a 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 to which the feature code belongs. The obtained feature code and category information are input into the generator, and the generated data is decoded and output to complete the data amplification; The prior sampling method uses the trained Gaussian mixture embedding generative adversarial network model to perform data augmentation. First, the category 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 category to which the Gaussian component belongs. Then, the feature code corresponding to the category information is sampled from the corresponding Gaussian component. The feature code and category information are input into the generator, and the generated data is decoded and output to complete the data augmentation.
Citation Information
Patent Citations
Chromosome classification method and device based on generative adversarial network
CN108763874A
Gas sensor array model calibration method for data augmentation based on conditional generative adversarial network
CN112462001A
Small sample classification method based on double-adversarial variational auto-encoder
CN114120041A
Electronic nose gas type identification method based on semi-supervised multiple adversarial network
CN114139587A
Image augmentation model training method and image classification method based on variational auto-encoder and generative adversarial network
CN114386534A