An electronic nose drift compensation method and system driven by a diffusion-resistant migration mechanism

The electronic nose drift compensation method driven by diffusion-adversarial migration mechanism solves the problems of gas recognition accuracy and stability caused by sensor drift, realizes cross-domain feature alignment and drift compensation, and improves the long-term stability and recognition accuracy of the electronic nose system.

CN121479535BActive Publication Date: 2026-04-03CHINA UNIV OF MINING & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-01-09
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

During long-term use, the distribution of gas response signals caused by sensor drift in electronic noses can affect the generalization performance and stability of the model, making it difficult to achieve effective transfer and feature extraction, especially in the absence of labeled target domain samples.

Method used

A diffusion adversarial transfer mechanism is adopted. By introducing a diffusion process noise mechanism in the feature modeling stage and combining it with adversarial training, a cross-domain adversarial transfer module is constructed to achieve feature space alignment and improve the accuracy of gas identification and drift compensation.

Benefits of technology

It effectively solves the drift problem caused by sensor aging and environmental fluctuations, improves the accuracy and stability of gas identification, and enhances the model's cross-domain generalization ability and robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121479535B_ABST
    Figure CN121479535B_ABST
Patent Text Reader

Abstract

An electronic nose drift compensation method and system driven by a diffusion adversarial transfer mechanism is disclosed. The method includes: constructing source and target domain datasets, which are preprocessed to obtain an input signal matrix; constructing a diffusion feature extractor module containing temporal embedding, noise injection, and residual diffusion units; forming a cross-domain adversarial transfer module with both adversarial and statistical alignment capabilities; constructing a task classifier module with a two-layer fully connected network as the core and connected to a Softmax output layer; building a drift compensation model and jointly optimizing the parameters of each module through a multi-task loss function to obtain a high-precision electronic nose drift adaptive compensation model; and performing online drift compensation. The system consists of a data acquisition module, a data preprocessing module, a diffusion feature extraction module, and a task classifier module connected sequentially, with the adversarial transfer module connected to the diffusion feature extraction module. This invention significantly improves the stability and recognition accuracy of the electronic nose under long-term drift, short-term drift, and instrument variation scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the interdisciplinary field of artificial intelligence and gas sensor signal processing, specifically relating to an electronic nose drift compensation method and system driven by a diffusion-countercurrent migration mechanism. Background Technology

[0002] Electronic noses (E-nose), as intelligent detection devices that mimic the human olfactory system, have demonstrated significant value in various fields, including environmental monitoring, food safety, medical diagnosis, industrial process control, and military defense. They respond to complex gas mixtures through arrays of multiple gas sensors and utilize pattern recognition algorithms to identify and quantify gas components, thus overcoming the limitations of traditional chemical analysis instruments in terms of real-time performance, portability, and cost. In the food industry, electronic noses can distinguish the odor characteristics of agricultural products at different stages of maturity or under different storage conditions; in medicine, they can be used to detect disease markers in exhaled breath, such as for the early diagnosis of lung cancer, diabetes, or liver dysfunction; in environmental protection, electronic noses can be used for online monitoring of harmful gases or volatile organic compounds; and in industrial production, they enable odor quality control and process optimization. However, one of the biggest challenges facing electronic noses in practical applications is sensor drift. Gas sensors commonly suffer from drift during long-term operation. This phenomenon causes significant changes in the distribution of response signals for the same gas at different times, in different environments, or under different operating conditions. This leads to a distribution shift between the source and target domains, severely impacting the model's generalization performance and long-term stability. Traditional supervised learning methods typically rely on a large number of labeled samples for training. However, in the field of gas sensors, target domain samples often lack labels, and the feature shift caused by drift makes it difficult to directly transfer the model for application, resulting in a sharp drop in recognition accuracy. This, in turn, severely restricts the stability and practical application of electronic noses. This drift mainly stems from factors such as sensor material aging, unstable surface adsorption / desorption, changes in environmental temperature and humidity, circuit noise interference, and gas cross-response. For example, metal-oxide-semiconductor (MOS) sensors exposed to oxidation or high humidity environments for extended periods experience surface active site decay, leading to a decrease in sensitivity.

[0003] Under conditions of distribution shift and label loss caused by gas sensor drift, how to achieve effective transfer of source domain knowledge, robust feature extraction, and adaptive alignment of inter-domain distributions to ensure the long-term stability and generalization ability of gas recognition models is a pressing technical problem. To address this challenge, early researchers have made tireless explorations at both the hardware and algorithm levels. At the hardware level, the most direct method is periodic physical recalibration, but this is not only costly and time-consuming, but also unsuitable for large-scale network deployments. To mitigate the impact of drift, researchers have proposed various compensation and adaptive strategies at the algorithm level. Early methods mainly relied on feature selection and signal preprocessing, such as principal component analysis (PCA), to remove time-related noise; however, these linear methods cannot effectively cope with complex nonlinear drift. Subsequently, machine learning and transfer learning techniques were introduced, learning domain-invariant features between the source and target domains to achieve cross-time and cross-device recognition generalization. In particular, the introduction of deep neural networks enables models to automatically extract high-level spatiotemporal features, thus exhibiting stronger robustness in multi-domain drift compensation tasks. Meanwhile, adversarial domain adaptation and semi-supervised self-training have become mainstream approaches, used to achieve feature distribution alignment and knowledge transfer in situations with a large number of unlabeled target domain samples. Therefore, there is an urgent need to provide an electronic nose drift compensation method and system driven by a diffusion adversarial transfer mechanism. Summary of the Invention

[0004] To address the problems existing in the prior art, this invention provides an electronic nose drift compensation system and method driven by a diffusion adversarial migration mechanism. This method is simple to implement and achieves ideal compensation results. By introducing a diffusion process noise mechanism during the feature modeling stage and combining it with adversarial training to achieve feature space alignment, it effectively improves the accuracy of gas recognition and the precision of drift compensation. It effectively solves the drift problem caused by sensor aging, environmental fluctuations, and instrument differences during long-term use of electronic nose systems. The system has a simple structure and a high degree of intelligence; it can process electronic nose signals in real time and output a stable response and recognition result after drift compensation.

[0005] To achieve the above-mentioned objectives, this invention provides an electronic nose drift compensation method driven by a diffusion-resistant migration mechanism, comprising the following steps:

[0006] Step 1: Construct the source domain dataset and the target domain dataset, and obtain the input signal matrix after preprocessing;

[0007] Step 2: Through a multi-step feature transformation and noise injection process, a diffusion feature extractor module containing time embedding, noise injection, and residual diffusion units is constructed;

[0008] Step 3: First, build an adversarial architecture for the gradient inversion layer and the domain discriminator; then embed the maximum mean difference constraint unit and variance consistency constraint unit based on the RBF kernel to form a cross-domain adversarial transfer module that has both adversarial and statistical alignment capabilities.

[0009] Step 4: Using a two-layer fully connected network as the core, connect to the Softmax output layer to build a task classifier module;

[0010] Step 5: Build a drift compensation model and jointly optimize the parameters of each module through a multi-task loss function to obtain an adaptive compensation model for electronic nose drift.

[0011] Step 6: Place the electronic nose system in the gas environment to be tested, collect the gas response signal, and obtain the real-time input signal after preprocessing; input the real-time input signal into the electronic nose drift adaptive compensation model, perform drift compensation through the built-in domain invariant feature learning and drift compensation mechanism, and output the stable response signal after drift compensation and the gas recognition accuracy.

[0012] As a preferred embodiment, the process of obtaining the input signal matrix in step one is as follows:

[0013] S11: Collect gas response signals from the electronic nose system under different times, environments, or devices to construct source domain datasets. and target domain dataset ;in, , For data sample pairs with real labels, For gas response signals, for Corresponding tags; , These are unlabeled real gas response signal samples;

[0014] S12: For the source domain dataset and target domain dataset The gas response signals from each channel are preprocessed to obtain an input signal matrix with a unified data scale and mean. .

[0015] As a preferred embodiment, in step S12 of step one, during the preprocessing of the gas response signal, the raw data of each channel are processed according to formula (1). Perform z-score standardization to obtain standardized data. ;

[0016] (1);

[0017] In the formula, This is the average of all data in the current channel; This represents the standard deviation of all data in the current channel.

[0018] As a preferred embodiment, in step S12 of step one, during the preprocessing of the gas response signal, the raw data of each channel are processed according to formula (2). Perform normalization to obtain normalized data. ;

[0019] (2);

[0020] In the formula, The minimum value of the data in the current channel; This represents the maximum value of all data in the current channel.

[0021] In order to obtain enhanced feature representations, the diffusion feature extraction module operates as follows in step two:

[0022] S21: Generate time step embedding vectors; randomly sample time steps. Learnable temporal embedding vectors are generated by mapping according to formula (3). ;

[0023] (3);

[0024] In the formula, , This represents the total number of time steps. For time embedding functions;

[0025] S22: Input signal latent space projection and feature fusion; according to formula (4), the input signal is... Perform a linear mapping projection onto the latent space, while simultaneously fusing the temporal embedding vectors. The initial representation in the latent space is obtained. ;

[0026] (4);

[0027] In the formula, The input weight matrix; For input bias terms; The weight matrix is ​​embedded in time;

[0028] S23: Enhanced features of multi-layer residual nonlinear transformation; employing... Initial representation of latent space by layer residual diffusion unit Perform nonlinear transformations to extract higher-order features layer by layer; obtain the first-order features through the following process. Latent space representation of layers First, apply formula (5) to the first... Latent space representation of layers Perform linear transformation, layer normalization and Activation operation to obtain intermediate activation value Then, according to formula (6), the intermediate activation value is... Perform a quadratic linear transformation and fuse the features from the previous layer through residual connections to obtain the th layer. Latent space representation of layers ;

[0029] (5);

[0030] (6);

[0031] In the formula, For activation function, For layer normalization operation; For the first The weight matrix of the first linear transformation in the layer. For the first The bias term of the first linear transformation in the layer; For the first The weight matrix of the second linear transformation in the layer; For the first The bias term of the second linear transformation in the layer;

[0032] S24: Forward diffusion injection of Gaussian noise; according to formula (7) based on the preset diffusion noise scheduling parameters. For the raw data Gradually add standard Gaussian noise , generate the first Noisy data samples of the step ;

[0033] (7);

[0034] In the formula, ;

[0035] S25: Output diffusion feature vector; according to formula (8), the vector will be processed... High-order features extracted by layered neural networks Input and output projection layers generate diffused feature vectors that include noise scale information. ;

[0036] (8);

[0037] In the formula, This is the weight matrix of the output layer; This is the bias term for the output layer.

[0038] To effectively reduce inter-domain differences, the adversarial migration module operates as follows in step three:

[0039] S31: Build an adversarial training framework and introduce a gradient inversion layer; in the diffusion feature extraction module and domain discriminator... Gradient reversal layers are inserted between inputs to construct an adversarial training architecture; during forward propagation, the gradient reversal layers diffuse the source domain features of the input. and target domain diffusion characteristics Performing an identity mapping does not change the eigenvalues; during backpropagation, the gradient reversal layer will counteract the loss. The gradient multiplied by the negative coefficient The gradient inversion layer forces the diffusion feature extraction module to learn domain-invariant features, while simultaneously training the domain discriminator. Distinguish the domain to which the features belong; where, the domain adversarial loss is obtained according to formula (9). ;

[0040] (9);

[0041] In the formula, ; This represents the expectation for samples in the source domain; This represents the expectation for samples in the target domain; The discrimination result of the domain discriminator on the source domain features; The discrimination result of the domain discriminator on the target domain features;

[0042] S32: Add statistical distribution alignment constraints to reduce inter-domain differences; based on adversarial training, introduce maximum mean difference constraints and variance consistency constraints; for the maximum mean difference constraint, construct the maximum mean difference constraint loss using the RBF kernel according to formula (10). Through mapping function Source domain diffusion characteristics and target domain diffusion characteristics Mapping to the regenerated Hilbert space aligns the mean distributions of the two types of features; for variance consistency constraints, the variance consistency constraint loss is constructed according to formula (11). By constraining the dimensionality and variance of features in the source and target domains using the L1 norm, we can maintain consistency of intra-class variance and feature aggregation, and avoid the dispersion of feature distribution between domains.

[0043] (10);

[0044] In the formula, The mean of the source domain features in the regenerated Hilbert space; The mean of the target domain features in the regenerated Hilbert space; The mapping function that maps features to the regenerated Hilbert space;

[0045] (11);

[0046] In the formula, The variance of the source domain diffusion characteristics; The variance of the diffusion characteristics of the target domain;

[0047] S33: Calculate domain alignment metrics to aid in model convergence assessment; after each training round, calculate two types of key domain alignment metrics and record the mean difference. Differences in covariance matrix This is used to quantify inter-domain distribution differences and assist in determining the model's convergence state; among which, , These are the mean values ​​of the feature vectors in the source and target domains, respectively. , These are the covariance matrices of the eigenvectors of the source and target domains, respectively.

[0048] To ensure classification accuracy, the task classifier module operates as follows in step four:

[0049] S41: Calculate the source domain feature classification score; extract the source domain diffusion features from the diffusion feature extraction module. Input Task Classifier The classification score is obtained according to formula (12). ;

[0050] (12);

[0051] In the formula, These are the parameters for the task classifier module;

[0052] S42: Probability distribution of generated gas categories; classification score Perform the Softmax activation operation and map the scores to the probability distributions of various gas categories according to formula (13). ;

[0053] (13);

[0054] S43: Calculate the task classification loss; based on the true labels of the source domain samples. With the predicted probability distribution Based on the differences, the task classification loss is calculated using cross-entropy loss according to formula (14). ;

[0055] (14);

[0056] In the formula, This indicates a set of labeled samples from the source domain. Take the expected value;

[0057] S44: Jointly optimize model parameters to minimize task classification loss. For the objective, the parameters of the task classifier module are adjusted according to formula (15). Parameters of the diffusion feature extraction module Perform joint optimization;

[0058] (15).

[0059] To improve the accuracy of drift compensation, the process of obtaining a high-precision electronic nose drift adaptive compensation model in step five is as follows:

[0060] S51: Construct a drift compensation model; integrate the diffusion feature extraction module, the adversarial transfer module, and the task classifier module in series to form a complete drift compensation model; after the gas response signal generates a diffusion feature vector through the diffusion feature extraction module, it is input into the adversarial transfer module to achieve inter-domain feature alignment, and input into the task classifier module to complete gas category prediction.

[0061] S52: Construct the total loss function for multiple tasks; integrate the loss terms of each module according to formula (16) to construct the total loss function. This achieves synergistic optimization of classification performance and drift compensation effect;

[0062] (16);

[0063] In the formula, Losses due to domain confrontation Weighting coefficients; Maximum mean difference constrained loss Weighting coefficients; Loss due to variance consistency constraints Weighting coefficients;

[0064] S53: Modular joint optimization of model parameters; training the drift compensation model using the training set, based on the total loss function. Differential joint optimization is performed on the parameters of the diffusion feature extraction module, the adversarial transfer module, and the task classifier module;

[0065] Domain discriminator in the adversarial migration module Minimize domain adversarial loss and variance consistency constraint loss This ensures that the adversarial transfer module accurately distinguishes between source and target domain features, providing effective supervision for adversarial training; and for the diffusion feature extraction module, it maximizes the domain adversarial loss. At the same time, minimize the task classification loss. Maximum mean difference constraint loss Variance consistency constraint loss This enables the diffusion feature extraction module to learn domain-invariant features that are effective for gas classification tasks and have strong robustness to domain shifts; for the task classifier module, the minimum task classification loss is achieved. This improves the accuracy of the task classifier module in classifying gas categories in the source domain data, and at the same time works with the diffusion feature extraction module to complete parameter co-optimization.

[0066] This invention proposes a transfer learning framework that integrates diffusion features with a semi-supervised adversarial mechanism. First, by collecting gas response signals under different times, environments, or devices, source and target domain datasets are constructed, enhancing data diversity and coverage, which helps the model learn more robust features. z-score normalization or Min-Max normalization eliminates dimensional differences between different channels, making the model training process more stable and accelerating convergence. Next, by stacking residual diffusion modules and combining them with a time-step embedding mechanism, the model can learn feature transformation patterns under different drift levels during training, effectively extracting deep features from the signal. This results in stronger cross-domain generalization ability when facing unknown target domain data. Furthermore, by integrating temporal information, the ability to capture complex gas response patterns is significantly enhanced. Simultaneously, by simulating multi-scale noise injection and denoising mechanisms during the diffusion process, the model becomes more robust to noise and small perturbations in the input signal. Thus, this invention can extract deep features that are insensitive to noise, interference, and distribution shifts, significantly improving feature robustness. Furthermore, by employing an adversarial training framework and constraints such as maximum mean difference and variance consistency, the feature distributions of the source and target domains can be more effectively aligned, reducing inter-domain differences caused by sensor drift. This significantly improves the accuracy of downstream tasks such as gas classification in drift scenarios, and experiments demonstrate that its performance outperforms traditional feature extraction methods. Simultaneously, the synergistic effect of adversarial training and statistical constraints makes feature distribution alignment more stable and effective, enhancing the model's generalization ability in new environments. Then, by using a classifier function and a softmax activation function, probability prediction of gas categories can be directly performed based on diffusion features. End-to-end model training is achieved by jointly optimizing the classifier and feature extraction modules through task classification loss. Finally, by jointly optimizing the diffusion feature extraction module, adversarial transfer module, and task classifier module through a multi-task loss function, the entire model can work collaboratively to optimize drift compensation and gas recognition performance. The trained adaptive compensation model can dynamically adjust according to real-time input signals, effectively compensating for sensor drift in the electronic nose and maintaining the accuracy and stability of gas recognition. Therefore, it can be directly applied to online drift compensation operations for electronic noses. This invention effectively alleviates the problem of cross-domain recognition performance degradation caused by gas sensor drift, and provides a new solution for the long-term stable operation of electronic nose systems.

[0067] This method is simple to implement and has an ideal compensation effect. By introducing a diffusion process noise mechanism in the feature modeling stage and combining it with adversarial training to achieve feature space alignment, it effectively improves the accuracy of gas recognition and the precision of drift compensation. It can effectively solve the drift problem caused by sensor aging, environmental fluctuations and instrument differences in the long-term use of electronic nose systems.

[0068] The present invention also provides an electronic nose drift compensation system driven by a diffusion adversarial migration mechanism, including a data acquisition module, a data preprocessing module, a diffusion feature extraction module, an adversarial migration module, a task classifier module, and a joint optimization module;

[0069] The data acquisition module is used to acquire the gas response signal of the gas to be tested;

[0070] The data preprocessing module is connected to the data acquisition module and is used to preprocess the gas response signal;

[0071] The diffusion feature extraction module is connected to the data preprocessing module and is used to perform time step embedding, latent space projection, multi-layer residual nonlinear transformation and forward diffusion Gaussian noise injection on the preprocessed gas response signal, and finally map it into a diffusion feature representation that integrates noise intensity and time information.

[0072] The adversarial transfer module is connected to the diffusion feature extraction module and is used to force the diffusion feature extraction module to extract domain-invariant features through adversarial training mediated by the gradient inversion layer. At the same time, it combines the maximum mean difference constraint and variance consistency constraint of the RBF kernel to achieve the distribution alignment of the source domain and target domain features.

[0073] The task classifier module is connected to the diffusion feature extraction module. It is used to calculate the classification score based on the extracted domain-invariant diffusion features, generate the gas category probability distribution, output the gas identification result, and optimize the model parameters through cross-entropy loss.

[0074] The joint optimization module is connected to the diffusion feature extraction module, the adversarial transfer module, and the task classifier module, respectively. It is used to construct a total loss function that integrates classification loss, adversarial loss, mean difference constraint loss, and variance consistency constraint loss. Differentiated joint optimization is performed on the parameters of each module to ensure the synergistic improvement of model classification accuracy and drift compensation effect.

[0075] As a preferred embodiment, the data preprocessing module preprocesses the gas response signal through z-score normalization or standardization.

[0076] In this invention, the data acquisition module facilitates the acquisition of gas response signals and their transmission to the diffusion feature extraction module. This module also enables the automated extraction of depth feature representations from the gas response signals that are insensitive to distribution shifts. The adversarial transfer module, through the synergistic effect of adversarial training and statistical constraints, forces the diffusion feature extraction module to extract domain-invariant features, effectively reducing inter-domain differences caused by sensor drift. Furthermore, aligning the feature distributions of the source and target domains ensures the stability of the transfer effect. The task classifier module outputs stable response signals and high recognition accuracy, avoiding errors in feature transformation. Finally, the joint optimization module synchronizes the parameter updates of the diffusion feature extraction module, adversarial transfer module, and task classifier module, avoiding performance bottlenecks caused by local optimization.

[0077] The system has a simple structure and a high degree of intelligence. It can process electronic nose signals in real time and output stable response and recognition results after drift compensation. It can be directly applied to industrial monitoring, environmental monitoring and other scenarios. Attached Figure Description

[0078] Figure 1 This is a flowchart of the compensation method in this invention;

[0079] Figure 2 This is a flowchart of diffusion feature extraction in this invention;

[0080] Figure 3 This is a structural diagram of the residual diffusion block in this invention;

[0081] Figure 4 This is a comparison diagram of the characteristic changes at different diffusion time steps in this invention;

[0082] (a) is a trend chart of the characteristic mean; (b) is a distribution chart of the standard deviation; (c) is a comparison chart of cosine similarity; (d) is a joint distribution chart of mean and standard deviation.

[0083] Figure 5 This is a block diagram of the compensation system in this invention. Detailed Implementation

[0084] The invention will now be further described with reference to the accompanying drawings.

[0085] like Figures 1 to 4 As shown, this invention provides an electronic nose drift compensation method driven by a diffusion-resistant migration mechanism, comprising the following steps:

[0086] Step 1: Construct the source domain dataset and the target domain dataset, and obtain the input signal matrix after preprocessing;

[0087] As a preferred option, the process of obtaining the input signal matrix is ​​as follows:

[0088] S11: Collect gas response signals from the electronic nose system under different times, environments, or devices to construct source domain datasets. and target domain dataset ;in, , For data sample pairs with real labels, For gas response signals, for Corresponding tags; , These are unlabeled real gas response signal samples;

[0089] S12: For the source domain dataset and target domain dataset The gas response signals from each channel are preprocessed to obtain an input signal matrix with a unified data scale and mean. .

[0090] As a preferred option, during the preprocessing of the gas response signal, the raw data of each channel are processed according to formula (1). Perform z-score standardization to obtain standardized data. ;

[0091] (1);

[0092] In the formula, This is the average of all data in the current channel; This represents the standard deviation of all data in the current channel.

[0093] As another preferred option, during the preprocessing of the gas response signal, the raw data of each channel are processed according to formula (2). Perform normalization to obtain normalized data. ;

[0094] (2);

[0095] In the formula, The minimum value of the data in the current channel; This represents the maximum value of all data in the current channel.

[0096] Step 2: Through a multi-step feature transformation and noise injection process, a diffusion feature extractor module containing time embedding, noise injection, and residual diffusion units is constructed;

[0097] In order to obtain enhanced feature representations, the diffusion feature extraction module works as follows:

[0098] S21: Generate time step embedding vectors; randomly sample time steps. Learnable temporal embedding vectors are generated by mapping according to formula (3). ;

[0099] (3);

[0100] In the formula, , This represents the total number of time steps. For time embedding functions;

[0101] S22: Input signal latent space projection and feature fusion; according to formula (4), the input signal is... Perform a linear mapping projection onto the latent space, while simultaneously fusing the temporal embedding vectors. The initial representation in the latent space is obtained. ;

[0102] (4);

[0103] In the formula, The input weight matrix; For input bias terms; The weight matrix is ​​embedded in time;

[0104] S23: Enhanced features of multi-layer residual nonlinear transformation; employing... Initial representation of latent space by layer residual diffusion unit Perform nonlinear transformations to extract higher-order features layer by layer; obtain the first-order features through the following process. Latent space representation of layers First, apply formula (5) to the first... Latent space representation of layers Perform linear transformation, layer normalization and Activation operation to obtain intermediate activation value Then, according to formula (6), the intermediate activation value is... Perform a quadratic linear transformation and fuse the features from the previous layer through residual connections to obtain the th layer. Latent space representation of layers ;

[0105] (5);

[0106] (6);

[0107] In the formula, For activation function, For layer normalization operation; For the first The weight matrix of the first linear transformation in the layer. For the first The bias term of the first linear transformation in the layer; For the first The weight matrix of the second linear transformation in the layer; For the first The bias term of the second linear transformation in the layer;

[0108] S24: Forward diffusion injection of Gaussian noise; according to formula (7) based on the preset diffusion noise scheduling parameters. For the raw data Gradually add standard Gaussian noise , generate the first Noisy data samples of the step ;

[0109] (7);

[0110] In the formula, ;

[0111] S25: Output diffusion feature vector; according to formula (8), the vector will be processed... High-order features extracted by layered neural networks Input and output projection layers generate diffused feature vectors that include noise scale information. ;

[0112] (8);

[0113] In the formula, This is the weight matrix of the output layer; This is the bias term for the output layer.

[0114] Step 3: First, build an adversarial architecture between the gradient inversion layer (GRL) and the domain discriminator. The gradient inversion layer forces the diffusion feature extraction module to learn domain-invariant features. Then, embed the maximum mean difference (MMD) constraint unit and variance consistency constraint unit based on the RBF kernel (Radial Basis Function Kernel) to align the mean distribution of features in the source domain and the target domain, and maintain the consistency of their dimensional variance, thus forming a cross-domain adversarial transfer module with both adversarial and statistical alignment capabilities.

[0115] To effectively reduce inter-domain differences, the adversarial migration module works as follows:

[0116] S31: Build an adversarial training framework and introduce a gradient inversion layer; in the diffusion feature extraction module and domain discriminator... Gradient reversal layers are inserted between inputs to construct an adversarial training architecture; during forward propagation, the gradient reversal layers diffuse the source domain features of the input. and target domain diffusion characteristics Performing an identity mapping does not change the eigenvalues; during backpropagation, the gradient reversal layer will counteract the loss. The gradient multiplied by the negative coefficient The gradient inversion layer forces the diffusion feature extraction module to learn domain-invariant features, while simultaneously training the domain discriminator. Distinguish the domain to which the features belong; where, the domain adversarial loss is obtained according to formula (9). ;

[0117] (9);

[0118] In the formula, ; This represents the expectation for samples in the source domain; This represents the expectation for samples in the target domain; The discrimination result of the domain discriminator on the source domain features; The discrimination result of the domain discriminator on the target domain features;

[0119] S32: Add statistical distribution alignment constraints to reduce inter-domain differences; based on adversarial training, introduce maximum mean difference constraints and variance consistency constraints; for the maximum mean difference constraint, construct the maximum mean difference constraint loss using the RBF kernel (optionally with median bandwidth adaptive form) according to formula (10). Through mapping function Source domain diffusion characteristics and target domain diffusion characteristics Mapping to the regenerated Hilbert space aligns the mean distributions of the two types of features; for variance consistency constraints, the variance consistency constraint loss is constructed according to formula (11). By constraining the dimensionality and variance of features in the source and target domains using the L1 norm, we can maintain consistency of intra-class variance and feature aggregation, and avoid the dispersion of feature distribution between domains.

[0120] (10);

[0121] In the formula, The mean of the source domain features in the regenerated Hilbert space; The mean of the target domain features in the regenerated Hilbert space; The mapping function that maps features to the regenerated Hilbert space;

[0122] (11);

[0123] In the formula, The variance of the source domain diffusion characteristics; The variance of the diffusion characteristics of the target domain;

[0124] S33: Calculate domain alignment metrics to aid in model convergence assessment; after each training round, calculate two types of key domain alignment metrics and record the mean difference. Differences in covariance matrix This is used to quantify inter-domain distribution differences and assist in determining the model's convergence state; among which, , These are the mean values ​​of the feature vectors in the source and target domains, respectively. , These are the covariance matrices of the eigenvectors of the source and target domains, respectively.

[0125] Step 4: Using a two-layer fully connected network as the core, connect to the Softmax output layer to build a task classifier module;

[0126] To ensure classification accuracy, the task classifier module operates as follows:

[0127] S41: Calculate the source domain feature classification score; extract the source domain diffusion features from the diffusion feature extraction module. Input Task Classifier The classification score is obtained according to formula (12). ;

[0128] (12);

[0129] In the formula, These are the parameters for the task classifier module;

[0130] S42: Probability distribution of generated gas categories; classification score Perform the Softmax activation operation and map the scores to the probability distributions of various gas categories according to formula (13). ;

[0131] (13);

[0132] S43: Calculate the task classification loss; based on the true labels of the source domain samples. With the predicted probability distribution Based on the differences, the task classification loss is calculated using cross-entropy loss according to formula (14). ;

[0133] (14);

[0134] In the formula, This indicates a set of labeled samples from the source domain. Take the expected value;

[0135] S44: Jointly optimize model parameters to minimize task classification loss. For the objective, the parameters of the task classifier module are adjusted according to formula (15). Parameters of the diffusion feature extraction module Perform joint optimization;

[0136] (15).

[0137] Step 5: Build a drift compensation model and jointly optimize the parameters of each module through a multi-task loss function to obtain a high-precision electronic nose drift adaptive compensation model;

[0138] To improve the accuracy of drift compensation, the process of obtaining a high-precision electronic nose drift adaptive compensation model is as follows:

[0139] S51: Construct a drift compensation model; integrate the diffusion feature extraction module, the adversarial transfer module, and the task classifier module in series to form a complete drift compensation model; after the gas response signal generates a diffusion feature vector through the diffusion feature extraction module, it is input into the adversarial transfer module to achieve inter-domain feature alignment, and input into the task classifier module to complete gas category prediction.

[0140] S52: Construct the total loss function for multiple tasks; integrate the loss terms of each module according to formula (16) to construct the total loss function. This achieves synergistic optimization of classification performance and drift compensation effect;

[0141] (16);

[0142] In the formula, Losses due to domain confrontation Weighting coefficients; Maximum mean difference constrained loss Weighting coefficients; Loss due to variance consistency constraints Weighting coefficients;

[0143] S53: Modular joint optimization of model parameters; training the drift compensation model using the training set, based on the total loss function. Differential joint optimization is performed on the parameters of the diffusion feature extraction module, the adversarial transfer module, and the task classifier module;

[0144] Domain discriminator in the adversarial migration module Minimize domain adversarial loss and variance consistency constraint loss This ensures that the adversarial transfer module accurately distinguishes between source and target domain features, providing effective supervision for adversarial training; and for the diffusion feature extraction module, it maximizes the domain adversarial loss. At the same time, minimize the task classification loss. Maximum mean difference constraint loss Variance consistency constraint loss This enables the diffusion feature extraction module to learn domain-invariant features that are effective for gas classification tasks and have strong robustness to domain shifts; for the task classifier module, the minimum task classification loss is achieved. This improves the accuracy of the task classifier module in classifying gas categories in the source domain data, and at the same time works with the diffusion feature extraction module to complete parameter co-optimization.

[0145] Step 6: Place the electronic nose system in the gas environment to be tested, collect the gas response signal, and obtain the real-time input signal after preprocessing; input the real-time input signal into the electronic nose drift adaptive compensation model, perform drift compensation through the built-in domain invariant feature learning and drift compensation mechanism, and output the stable response signal after drift compensation and the gas recognition accuracy.

[0146] Experimental verification:

[0147] 1. Experimental Environment and Parameter Configuration: Software Environment: Python 3.9 + PyTorch 2.0; Hardware Environment: Intel i7 CPU, RTX3060Ti GPU; Model Parameters: Diffusion Steps T=1000, Diffusion Layers L=6, Batch Size=64; Adversarial Weights: =0.5; =0.1.

[0148] Example 1: Analysis of the variation and robustness of features extracted by the diffusion feature extraction module at different time steps;

[0149] time step Perform distributed sampling, that is, perform distributed sampling on the same input sample. Samples were taken at values ​​of 100, 200, 300, ..., 900 respectively, as follows: Figure 4 This demonstrates the changes in the feature distribution of the same input sample at different diffusion time steps. From Figure 4 As shown in subgraph a, the feature mean fluctuates somewhat with time step, but the overall amplitude is limited, indicating that the diffusion feature extraction module maintains relatively stable control over the feature mean under different noise levels, without extreme drift. Figure 4 In subgraph b, the feature standard deviation generally shows an upward trend with increasing time steps, although there are significant fluctuations at some time steps. This indicates that as noise increases, the feature distribution becomes more dispersed, and the diffusion feature extraction module can detect changes in noise intensity, resulting in more diverse feature representations. Figure 4As can be seen in subgraph c, the cosine similarity is high (>0.92) at most time steps, indicating that even under greater noise, the features extracted by the diffusion feature extraction module are still strongly correlated with the original features, and the features have good robustness. However, the similarity decreases at some time steps (such as t=800), indicating that the feature expression will change significantly under extreme noise. Figure 4 Subplot d shows that at different time steps, the feature mean and standard deviation are distributed within a certain range, and no outliers are found. The uniform color distribution indicates that the feature representation of the diffusion feature extraction module is diverse and continuous under different noise levels. These results demonstrate that the diffusion feature extraction module can effectively improve the generalization ability and transfer robustness of features.

[0150] Example 2: Long-term and short-term drift scenarios;

[0151] Dataset: A gas sensor array drift dataset consisting of 13,910 samples measured by Vergara et al. over three years. For ease of processing, the dataset is divided into ten batches based on the time span of all gas samples measured over the three years. This invention sets up two different scenario modes for the dataset to simulate long-term and short-term drift scenarios, as detailed in Table 1.

[0152] Table 1: Experimental setup (evaluation protocol) for long-term and short-term drift on dataset A

[0153]

[0154] Data preprocessing: Since the 16 sensors in the dataset (such as TGS2600 / TGS2610) have different sensitivity ranges, the eight features extracted by each sensor (steady-state / transient features) vary by orders of magnitude, and the data collection spans 36 months (10 batches), sensor drift leads to inconsistent data distribution across different batches. Data standardization helps prevent features with large numerical ranges from dominating model training, reduces distribution differences over time, and improves the model's generalization ability across batches. Therefore, Z-score standardization is used to convert the original data into a normal distribution with a mean of 0 and a standard deviation of 1.

[0155] Parameter settings: For dataset A, the input feature dimension is 128. After batch standardization, it is fed into the diffusion feature extraction module. The diffusion feature extraction module includes flattening, linear layer, time step embedding, 6-layer residual block and output projection. The output of the diffusion feature extraction module is added to the output of the residual projection layer to obtain the final features. Finally, it is fed into the task classifier module and the adversarial transfer module to perform task discrimination and domain adversarial, respectively. The task classifier module and the adversarial transfer module both use two-layer fully connected networks with RuLU activation and Dropout in between.

[0156] Experimental Results: The ultimate goal of the proposed method is to improve the accuracy of gas classification. Therefore, the effectiveness of the method is mainly evaluated based on classification accuracy. To demonstrate the superiority of the proposed method on dataset A, a series of comparative experiments were designed with methods such as SVM, SVM (PCA), ELM, and 1D-CNN. Furthermore, the results were compared with existing methods such as DRCA, TDACNN, EMAD, SAD-CNN, and MPC-CNN to verify the effectiveness of the model and the reliability of the data. Referring to Table 2, in setting 1, DP-SAD achieved the highest accuracy of 87.18% on dataset A. Compared with existing methods, EMAD achieved the highest accuracy of 86.33%, but this is still lower than the accuracy achieved by DP-SAD. Furthermore, the results in Table 3 show that in setting 2, DP-SAD achieved the highest accuracy of 92.26% compared to the benchmark method.

[0157] Table 2: Comparison of model results on dataset A (Set 1), unit: %

[0158]

[0159] Table 3: Comparison of model results on dataset A (Set 2), unit: %

[0160]

[0161] Example 3: Instrument drift scenario;

[0162] Dataset: A dual-gas sensor array dataset was used. This dataset records experimental data from five replicates of an 8-sensor array. In practical applications, the specific test time for each unit typically focuses on the sensor's response when exposed to a specific gas. Therefore, this invention extracted the first 30 seconds of the response from this dataset for experimental verification. Due to the relatively short data collection time, long-term drift is unlikely to be considered. The main observation point is the offset variation between identical devices in the dataset.

[0163] To demonstrate the performance of the model in this invention in handling instrument offset phenomena, two experimental scenarios were designed:

[0164] 1) Set cell 1 as the source domain and the remaining cells (2, 3, 4, 5) as the target domain.

[0165] 2) Set cell 5 as the source domain and the remaining cells (1, 2, 3, 4) as the target domain.

[0166] Data preprocessing: Since the raw time-series data of sensor instrument changes over 22 days is relatively stable and lacks extreme maximum or minimum values, a Min-Max normalization method was used to map the sensor response data to a value range between 0 and 1.

[0167] Parameter settings: A 3-layer convolutional neural network and a 6-layer residual network are used to extract time-series data. The task classifier uses a 3-layer fully connected network to classify 4 types of gases. The neighborhood discriminator uses a 4-layer fully connected network for domain classification. Dynamic dimension calculation is used to avoid manual configuration.

[0168] Table 4: Comparison of model results on data B, unit: %

[0169]

[0170] Table 5: Experimental results for all cases in dataset B, in %

[0171]

[0172] Experimental Results: Table 4 shows that DP-SAD achieved the highest accuracy of 96.02% on dataset B. Among the comparison methods, 1D-CNN achieved the highest accuracy of 92.94%, but this is still lower than the accuracy achieved by DP-SAD. To more clearly observe the bias phenomenon between different instruments and devices, all cases were tested, and Table 5 shows the complete results for dataset B.

[0173] like Figure 5As shown, this invention proposes a transfer learning framework (DP-SAD) that integrates diffusion features and a semi-supervised adversarial mechanism. First, by collecting gas response signals under different times, environments, or devices, source and target domain datasets are constructed, enhancing data diversity and coverage, which helps the model learn more robust features. z-score normalization or Min-Max normalization eliminates dimensional differences between different channels, making the model training process more stable and accelerating convergence. Next, by stacking residual diffusion modules and combining them with a time-step embedding mechanism, the model can learn feature transformation patterns under different drift levels during training, effectively extracting deep features from the signal. This results in stronger cross-domain generalization ability when facing unknown target domain data. Furthermore, by fusing time information, the ability to capture complex gas response patterns is significantly enhanced. Simultaneously, by simulating multi-scale noise injection and denoising mechanisms during the diffusion process, the model becomes more robust to noise and small perturbations in the input signal. Thus, this invention can extract deep features that are insensitive to noise, interference, and distribution shifts, significantly improving feature robustness. Furthermore, by employing an adversarial training framework (gradient inversion layer and domain discriminator) along with maximum mean difference (MMD) and variance consistency constraints, the feature distributions of the source and target domains can be more effectively aligned, reducing inter-domain differences caused by sensor drift. This significantly improves the accuracy of downstream tasks such as gas classification in drift scenarios, and experiments demonstrate that its performance outperforms traditional feature extraction methods (such as CNNs). Simultaneously, the synergistic effect of adversarial training and statistical constraints makes feature distribution alignment more stable and effective, enhancing the model's generalization ability in new environments. Then, by using a classifier function and a softmax activation function, the probability prediction of gas categories can be directly performed based on diffusion features. End-to-end model training can be achieved by jointly optimizing the classifier and feature extraction modules through task classification loss. Finally, by jointly optimizing the diffusion feature extraction module, adversarial transfer module, and task classifier module through a multi-task loss function, the entire model can work collaboratively to optimize drift compensation and gas recognition performance. The trained adaptive compensation model can dynamically adjust according to real-time input signals, effectively compensating for sensor drift in the electronic nose and maintaining the accuracy and stability of gas recognition. Therefore, it can be directly applied to online drift compensation operations for the electronic nose. This invention effectively alleviates the cross-domain recognition performance degradation problem caused by gas sensor drift, providing a new solution for the long-term stable operation of the electronic nose system.

[0174] This method is simple to implement and has an ideal compensation effect. By introducing a diffusion process noise mechanism in the feature modeling stage and combining it with adversarial training to achieve feature space alignment, it effectively improves the accuracy of gas recognition and the precision of drift compensation. It can effectively solve the drift problem caused by sensor aging, environmental fluctuations and instrument differences in the long-term use of electronic nose systems.

[0175] like Figure 5 As shown, the present invention also provides an electronic nose drift compensation system driven by a diffusion adversarial migration mechanism, including a data acquisition module, a data preprocessing module, a diffusion feature extraction module, an adversarial migration module, a task classifier module, and a joint optimization module;

[0176] The data acquisition module is used to acquire the gas response signal of the gas to be tested;

[0177] The data preprocessing module is connected to the data acquisition module and is used to preprocess the gas response signal;

[0178] The diffusion feature extraction module is connected to the data preprocessing module and is used to perform time step embedding, latent space projection, multi-layer residual nonlinear transformation and forward diffusion Gaussian noise injection on the preprocessed gas response signal, and finally map it into a diffusion feature representation that integrates noise intensity and time information.

[0179] The adversarial transfer module is connected to the diffusion feature extraction module and is used to force the diffusion feature extraction module to extract domain-invariant features through adversarial training mediated by the gradient inversion layer. At the same time, it combines the maximum mean difference constraint and variance consistency constraint of the RBF kernel to achieve the distribution alignment of the source domain and target domain features.

[0180] The task classifier module is connected to the diffusion feature extraction module. It is used to calculate the classification score based on the extracted domain-invariant diffusion features, generate the gas category probability distribution, output the gas identification result, and optimize the model parameters through cross-entropy loss.

[0181] The joint optimization module is connected to the diffusion feature extraction module, the adversarial transfer module, and the task classifier module, respectively. It is used to construct a total loss function that integrates classification loss, adversarial loss, mean difference constraint loss, and variance consistency constraint loss. Differentiated joint optimization is performed on the parameters of each module to ensure the synergistic improvement of model classification accuracy and drift compensation effect.

[0182] As a preferred embodiment, the data preprocessing module preprocesses the gas response signal through z-score normalization or standardization.

[0183] In this invention, the data acquisition module facilitates the acquisition of gas response signals and their transmission to the diffusion feature extraction module. This module also enables the automated extraction of depth feature representations from the gas response signals that are insensitive to distribution shifts. The adversarial transfer module, through the synergistic effect of adversarial training and statistical constraints, forces the diffusion feature extraction module to extract domain-invariant features, effectively reducing inter-domain differences caused by sensor drift. Furthermore, aligning the feature distributions of the source and target domains ensures the stability of the transfer effect. The task classifier module outputs stable response signals and high recognition accuracy, avoiding errors in feature transformation. Finally, the joint optimization module synchronizes the parameter updates of the diffusion feature extraction module, adversarial transfer module, and task classifier module, avoiding performance bottlenecks caused by local optimization.

[0184] The system has a simple structure and a high degree of intelligence. It can process electronic nose signals in real time and output stable response and recognition results after drift compensation. It can be directly applied to industrial monitoring, environmental monitoring and other scenarios.

Claims

1. A diffusion-resistant migration mechanism-driven electronic nose drift compensation method, characterized in that, Includes the following steps: Step 1: Construct the source domain dataset and the target domain dataset, and obtain the input signal matrix after preprocessing; Step 2: Through a multi-step feature transformation and noise injection process, a diffusion feature extractor module containing time embedding, noise injection, and residual diffusion units is constructed; Step 3: First, build an adversarial architecture for the gradient inversion layer and the domain discriminator; then embed the maximum mean difference constraint unit and variance consistency constraint unit based on the RBF kernel to form a cross-domain adversarial transfer module that has both adversarial and statistical alignment capabilities. Step 4: Using a two-layer fully connected network as the core, connect to the Softmax output layer to build a task classifier module; Step 5: Build a drift compensation model and jointly optimize the parameters of each module through a multi-task loss function to obtain an adaptive compensation model for electronic nose drift. Step 6: Place the electronic nose system in the gas environment to be tested, collect the gas response signal, and obtain the real-time input signal after preprocessing; input the real-time input signal into the electronic nose drift adaptive compensation model, perform drift compensation through the built-in domain invariant feature learning and drift compensation mechanism, and output the stable response signal after drift compensation and the gas recognition accuracy.

2. The electron nose drift compensation method driven by a diffusion-resistant migration mechanism according to claim 1, characterized in that, In step one, the process of obtaining the input signal matrix is ​​as follows: S11: Collect gas response signals from the electronic nose system under different times, environments, or devices to construct source domain datasets. and target domain dataset ;in, , For data sample pairs with real labels, For gas response signals, for Corresponding tags; , These are unlabeled real gas response signal samples; S12: For the source domain dataset and target domain dataset The gas response signals from each channel are preprocessed to obtain an input signal matrix with a unified data scale and mean. .

3. The electron nose drift compensation method driven by a diffusion-resistant migration mechanism according to claim 2, characterized in that, In step S12 of step one, during the preprocessing of the gas response signal, the raw data of each channel are processed according to formula (1). Perform z-score standardization to obtain standardized data. ; (1); In the formula, This is the average of all data in the current channel; This represents the standard deviation of all data in the current channel.

4. The electron nose drift compensation method driven by a diffusion-resistant migration mechanism according to claim 2, characterized in that, In step S12 of step one, during the preprocessing of the gas response signal, the raw data of each channel are processed according to formula (2). Perform normalization to obtain normalized data. ; (2); In the formula, The minimum value of the data in the current channel; This represents the maximum value of all data in the current channel.

5. The electron nose drift compensation method driven by a diffusion-resistant migration mechanism according to claim 3 or 4, characterized in that, In step two, the diffusion feature extraction module works as follows: S21: Generate time step embedding vectors; randomly sample time steps. Learnable temporal embedding vectors are generated by mapping according to formula (3). ; (3); In the formula, , This represents the total number of time steps. For time embedding functions; S22: Input signal latent space projection and feature fusion; according to formula (4), the input signal is... Perform a linear mapping projection onto the latent space, while simultaneously fusing the temporal embedding vectors. The initial representation in the latent space is obtained. ; (4); In the formula, The input weight matrix; For input bias terms; The weight matrix is ​​embedded in time; S23: Enhanced features of multi-layer residual nonlinear transformation; employing... Initial representation of latent space by layer residual diffusion unit Perform nonlinear transformations to extract higher-order features layer by layer; The first is obtained through the following process. Latent space representation of layers First, apply formula (5) to the first... Latent space representation of layers Perform linear transformation, layer normalization and Activation operation to obtain intermediate activation value Then, according to formula (6), the intermediate activation value is... Perform a quadratic linear transformation and fuse the features from the previous layer through residual connections to obtain the th layer. Latent space representation of layers ; (5); (6); In the formula, For activation function, For layer normalization operation; For the first The weight matrix of the first linear transformation in the layer. For the first The bias term of the first linear transformation in the layer; For the first The weight matrix of the second linear transformation in the layer; For the first The bias term of the second linear transformation in the layer; S24: Forward diffusion injection of Gaussian noise; according to formula (7) based on the preset diffusion noise scheduling parameters. For the raw data Gradually add standard Gaussian noise , generate the first Noisy data samples of the step ; (7); In the formula, ; S25: Output diffusion feature vector; according to formula (8), the vector will be processed... High-order features extracted by layered neural networks Input and output projection layers generate diffused feature vectors containing noise scale information. ; (8); In the formula, This is the weight matrix of the output layer; This is the bias term for the output layer.

6. The electron nose drift compensation method driven by a diffusion-resistant migration mechanism according to claim 5, characterized in that, In step three, the working process of the anti-migration module is as follows: S31: Build an adversarial training framework and introduce a gradient inversion layer; in the diffusion feature extraction module and domain discriminator... Gradient reversal layers are inserted between inputs to construct an adversarial training architecture; during forward propagation, the gradient reversal layers diffuse the source domain features of the input. and target domain diffusion characteristics Performing an identity mapping does not change the eigenvalues; during backpropagation, the gradient reversal layer will counteract the loss. The gradient multiplied by the negative coefficient The gradient inversion layer forces the diffusion feature extraction module to learn domain-invariant features, while simultaneously training the domain discriminator. Distinguish the domain to which the features belong; where, the domain adversarial loss is obtained according to formula (9). ; (9); In the formula, ; This represents the expectation for samples in the source domain; This represents the expectation for samples in the target domain; The discrimination result of the domain discriminator on the source domain features; The discrimination result of the domain discriminator on the target domain features; S32: Add statistical distribution alignment constraints to reduce inter-domain differences; based on adversarial training, introduce maximum mean difference constraints and variance consistency constraints; for the maximum mean difference constraint, construct the maximum mean difference constraint loss using the RBF kernel according to formula (10). Through mapping function Source domain diffusion characteristics and target domain diffusion characteristics Mapping to the regenerated Hilbert space aligns the mean distributions of the two types of features; for variance consistency constraints, the variance consistency constraint loss is constructed according to formula (11). By constraining the dimensionality and variance of features in the source and target domains using the L1 norm, we can maintain consistency of intra-class variance and feature aggregation, and avoid the dispersion of feature distribution between domains. (10); In the formula, The mean of the source domain features in the regenerated Hilbert space; The mean of the target domain features in the regenerated Hilbert space; The mapping function that maps features to the regenerated Hilbert space; (11); In the formula, The variance of the source domain diffusion characteristics; The variance of the diffusion characteristics of the target domain; S33: Calculate domain alignment metrics to aid in model convergence assessment; after each training round, calculate two types of key domain alignment metrics and record the mean difference. Differences in covariance matrix This is used to quantify inter-domain distribution differences and assist in determining the model's convergence state; among which, , These are the mean values ​​of the feature vectors in the source and target domains, respectively. , These are the covariance matrices of the eigenvectors of the source and target domains, respectively.

7. The electron nose drift compensation method driven by a diffusion-resistant migration mechanism according to claim 6, characterized in that, In step four, the task classifier module operates as follows: S41: Calculate the source domain feature classification score; extract the source domain diffusion features from the diffusion feature extraction module. Input Task Classifier The classification score is obtained according to formula (12). ; (12); In the formula, These are the parameters for the task classifier module; S42: Probability distribution of generated gas categories; classification score Perform the Softmax activation operation and map the scores to the probability distributions of various gas categories according to formula (13). ; (13); S43: Calculate the task classification loss; based on the true labels of the source domain samples. With the predicted probability distribution Based on the differences, the task classification loss is calculated using cross-entropy loss according to formula (14). ; (14); In the formula, This indicates a set of labeled samples from the source domain. Take the expected value; S44: Jointly optimize model parameters to minimize task classification loss. For the objective, the parameters of the task classifier module are adjusted according to formula (15). Parameters of the diffusion feature extraction module Perform joint optimization; (15)。 8. The electron nose drift compensation method driven by a diffusion-resistant migration mechanism according to claim 7, characterized in that, In step five, the process of obtaining a high-precision electronic nose drift adaptive compensation model is as follows: S51: Construct a drift compensation model; integrate the diffusion feature extraction module, the adversarial transfer module, and the task classifier module in series to form a complete drift compensation model; after the gas response signal generates a diffusion feature vector through the diffusion feature extraction module, it is input into the adversarial transfer module to achieve inter-domain feature alignment, and input into the task classifier module to complete gas category prediction. S52: Construct the total loss function for multiple tasks; integrate the loss terms of each module according to formula (16) to construct the total loss function. This achieves synergistic optimization of classification performance and drift compensation effect; (16); In the formula, Losses due to domain confrontation Weighting coefficients; Maximum mean difference constrained loss Weighting coefficients; Loss due to variance consistency constraints Weighting coefficients; S53: Modular joint optimization of model parameters; training the drift compensation model using the training set, based on the total loss function. Differential joint optimization is performed on the parameters of the diffusion feature extraction module, the adversarial transfer module, and the task classifier module; Domain discriminator in the adversarial migration module Minimize domain adversarial loss and variance consistency constraint loss This ensures that the adversarial transfer module accurately distinguishes between source and target domain features, providing effective supervision for adversarial training; and for the diffusion feature extraction module, it maximizes the domain adversarial loss. At the same time, minimize the task classification loss. Maximum mean difference constraint loss Variance consistency constraint loss This enables the diffusion feature extraction module to learn domain-invariant features that are effective for gas classification tasks and have strong robustness to domain shifts; for the task classifier module, the minimum task classification loss is achieved. This improves the accuracy of the task classifier module in classifying gas categories in the source domain data, and at the same time works with the diffusion feature extraction module to complete parameter co-optimization.

9. An electronic nose drift compensation system driven by a diffusion-counter-migration mechanism, used to implement the electronic nose drift compensation method driven by a diffusion-counter-migration mechanism as described in claim 8, characterized in that, It includes a data acquisition module, a data preprocessing module, a diffusion feature extraction module, an adversarial transfer module, a task classifier module, and a joint optimization module; The data acquisition module is used to acquire the gas response signal of the gas to be tested; The data preprocessing module is connected to the data acquisition module and is used to preprocess the gas response signal; The diffusion feature extraction module is connected to the data preprocessing module and is used to perform time step embedding, latent space projection, multi-layer residual nonlinear transformation and forward diffusion Gaussian noise injection on the preprocessed gas response signal, and finally map it into a diffusion feature representation that integrates noise intensity and time information. The adversarial transfer module is connected to the diffusion feature extraction module and is used to force the diffusion feature extraction module to extract domain-invariant features through adversarial training mediated by the gradient inversion layer. At the same time, it combines the maximum mean difference constraint and variance consistency constraint of the RBF kernel to achieve the distribution alignment of the source domain and target domain features. The task classifier module is connected to the diffusion feature extraction module. It is used to calculate the classification score based on the extracted domain-invariant diffusion features, generate the gas category probability distribution, output the gas identification result, and optimize the model parameters through cross-entropy loss. The joint optimization module is connected to the diffusion feature extraction module, the adversarial transfer module, and the task classifier module, respectively. It is used to construct a total loss function that integrates classification loss, adversarial loss, mean difference constraint loss, and variance consistency constraint loss. Differentiated joint optimization is performed on the parameters of each module to ensure the synergistic improvement of model classification accuracy and drift compensation effect.

10. The electronic nose drift compensation system driven by a diffusion-resistant migration mechanism according to claim 9, characterized in that, The data preprocessing module preprocesses the gas response signal through z-score normalization or standardization.

Citation Information

Patent Citations

  • Electronic nose drift suppression method based on smooth condition domain adversarial network

    CN116956159A

  • Machine olfaction system drift compensation method based on dynamic domain adversarial learning

    CN121256555A