Electronic nose sensor drift self-adaptive calibration and model training method, device, equipment and medium
Patent Information
- Application Number
- CN202610861793.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-15
- Publication Date
- 2026-09-01
AI Technical Summary
[0003]有鉴于此,本发明的目的在于提供电子鼻传感器漂移自适应校准及模型训练方法、装置、设备及介质,能够解决电子鼻在使用中因传感器老化、环境变化等产生的信号漂移问题,并实现用极少量标样就能快速完成校准
[0013]本申请的有益效果为:电子鼻的漂移本质是同一气味在不同时间、不同设备、不同工况下数据分布发生了改变,因此单纯依赖初始条件训练的分类器必然出现泛化衰退;而传统重标定的方法之所以成本高,是因为它需要在目标漂移状态下重新收集大量标样来重新学习分布。本发明把不同漂移状态建模为不同域,用模型无关元学习框架在多域上学习一个易于被少量样本快速修正的元初始化,因此当出现新漂移时,只需采集极少量标准样本做少步更新,就能把模型快速拉回到适应当前漂移分布的状态,实现低标注成本、快速上线、减少频繁训练。进一步地,电子鼻信号同时包含吸附与脱附的时间动态形状和传感器阵列通道间的空间交叉敏感两类关键信息,漂移往往会以不同强度、不同方式影响它们。本发明用双分支的特征提取网络同步提取时空分离特征与空间关联特征这两类异质特征,使特征表达更全面、更不依赖单一统计假设;再用分类损失缓解类别不均衡导致的偏置,确保提取的联合特征向量能够准确预测气体类别,赋予特征向量类别判别能力;用度量损失重构特征距离关系,使同类更聚、异类更分,并能随漂移强度自动调整分离尺度。由此可推得:在长期老化、短期波动、跨设备差异等典型漂移场景下,本发明更容易保持稳定可分的特征空间与更强的跨域鲁棒性,从而提升识别准确率与可重复性。
Smart Images

Figure CN122670907A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electronic nose detection technology, and in particular to methods, apparatus, equipment and media for adaptive calibration and model training of electronic nose sensor drift. Background Technology
[0002] After prolonged use or device replacement, electronic nose sensors experience signal drift due to aging, contamination, temperature and humidity fluctuations, and device differences. This leads to changes in the "odor fingerprint" distribution of the same sample. Traditional methods often require collecting a large number of standard samples, retraining, or frequent manual calibration, which is costly, time-consuming, and prone to failure when encountering new drift states. The closest existing technology uses domain adaptive networks to align the feature distributions of the source and target domains to suppress drift, but it still has significant drawbacks: First, this approach is heavily dependent on the sample size of the target domain. In scenarios with few samples, the variance of the distribution distance estimation is large, and the alignment gradient is unstable, resulting in unstable calibration and high sample consumption. Second, as drift evolves over time, repeated alignment and retraining are required, leading to frequent maintenance, long update cycles, and poor application continuity. Finally, aligning only the overall edge distribution may disrupt the category structure, resulting in negative transfer and affecting classification stability. Therefore, existing technologies still have shortcomings in small-sample drift calibration, drift stage evolution, cross-device generalization, and rapid updates. There is an urgent need for a method that can enable electronic noses to quickly complete calibration and maintain recognition accuracy even with few standard samples and under new drift conditions. Summary of the Invention
[0003] In view of this, the purpose of this invention is to provide a method, apparatus, device, and medium for adaptive calibration and model training of electronic nose sensors, which can solve the signal drift problem caused by sensor aging and environmental changes during use of electronic noses, and achieve rapid calibration using only a very small number of standard samples. The specific solution is as follows: In a first aspect, this application discloses a training method for an electronic nose sensor drift calibration model, including: Acquire response data from the electronic nose sensor under multiple different drift states, and treat the response data under each drift state as a drift task; The response data in each drift mission is divided into a support set and a query set; An initial model containing a feature extraction network is constructed, and the initial model is meta-trained using a model-independent meta-learning framework; wherein, the feature extraction network is used to generate a joint feature vector that integrates spatiotemporal separation features and spatial correlation features; During the meta-training process, the meta-initialization parameters of the initial model are updated using the joint feature vector of the support set corresponding to each drift task to obtain the adaptation parameters. The meta-loss of the adaptation parameters is calculated using the joint feature vector of the query set corresponding to each drift task, and the meta-initialization parameters are updated using the outer loop gradient based on the meta-loss until the meta-loss converges to obtain the target parameters. The inner loop gradient update and the outer loop gradient update are optimized using a joint loss function, which includes a classification loss for optimizing class discrimination ability and a metric loss for optimizing distance relationships in the feature space. The target parameters are used as general initialization parameters for the initial model to generate a trained electronic nose sensor drift calibration model.
[0004] Optionally, the step of dividing the response data in each drift task into a support set and a query set includes: The task set consisting of multiple drift tasks is divided into a meta-training set and a meta-test set; wherein, the drift tasks in the meta-training set are used for the inner loop gradient update and the outer loop gradient update during model training, and the drift tasks in the meta-test set are used for the performance evaluation of the final generated model. For each drift task in the meta-training set, the response data of the drift task is divided into a support set and a query set by random sampling.
[0005] Optionally, the feature extraction network includes a dual-branch feature extraction module, which includes a spatiotemporal separation feature extraction path and a spatial correlation feature extraction path; wherein, the spatiotemporal separation feature extraction path is used to extract the spatiotemporal separation features by sequentially convolving separable convolutions along the time dimension and the sensor dimension; the spatial correlation feature extraction path is used to construct a hybrid receptive field using standard convolutions to extract the spatial correlation features of the sensor array; Accordingly, generating the joint feature vector using the feature extraction network includes: The spatiotemporal separation features and the spatial correlation features are fused through residual connections to generate the joint feature vector.
[0006] Optionally, the step of using the joint feature vector of the support set corresponding to each drift task to perform inner-loop gradient update on the meta-initialization parameters of the initial model to obtain the adaptation parameters, and using the joint feature vector of the query set corresponding to each drift task to calculate the meta-loss of the adaptation parameters, and performing outer-loop gradient update on the meta-initialization parameters according to the meta-loss until the meta-loss converges to obtain the target parameters includes: For the current drift task in the current training round, the joint feature vector of the corresponding support set is used to calculate the first loss value of the meta-initialization parameters of the initial model on the support set based on the joint loss function, and the inner loop gradient is updated on the meta-initialization parameters according to the first loss value to obtain the adaptation parameters corresponding to the current drift task. Using the joint feature vector of the query set corresponding to the current drift task, the second loss value of the adaptation parameter on the query set is calculated based on the joint loss function, and the second loss values of all drift tasks are aggregated to obtain the total meta-loss; The meta-initialization parameters are updated by performing outer-loop gradient updates based on the total meta-loss to obtain the updated meta-initialization parameters; The updated meta-initialization parameters are used as the starting parameters for the current drift task in the next training round when performing the inner loop gradient update, and the inner loop gradient update and the outer loop gradient update are repeated until the total meta-loss converges to obtain the target parameters.
[0007] Optionally, the classification loss is a dynamically reweighted cross-entropy loss; the formula for calculating the dynamically reweighted cross-entropy loss is: ;in, B For batch size, For the first i The category to which each sample belongs The weight, For model parameters Time prediction samples Category The probability of; where, The instantaneous probability of each category of samples within each training batch is dynamically determined based on the number of samples of each category in the training batch and the batch size, and Laplace smoothing is introduced to avoid zero probability.
[0008] Optionally, the metric loss is an adaptive triplet loss; the formula for calculating the adaptive triplet loss is: ;in, B For batch size, For anchor point samples a eigenvectors, For anchor point samples a The eigenvector of the farthest positive example, For anchor point samples a The eigenvectors of the nearest negative example, m The parameters are trainable adaptive margins, and the Softplus function is used to control non-negativity. It is the L2 norm. This is the ReLU function.
[0009] Secondly, this application discloses an adaptive calibration method for electronic nose sensor drift, including: Obtain the trained electronic nose sensor drift calibration model; wherein the electronic nose sensor drift calibration model is a model generated by training using the aforementioned training method for electronic nose sensor drift calibration models; When a new unknown drift state occurs, a preset number of samples with category labels are collected as a calibration support set, and the electronic nose sensor drift calibration model is updated with a preset number of gradient steps using the calibration support set to obtain a target recognition model adapted to the unknown drift state. The target recognition model is used to extract features and classify unknown gas samples in the current environment to output calibrated odor recognition results.
[0010] Thirdly, this application discloses a training device for an electronic nose sensor drift calibration model, comprising: The drift task partitioning module is used to acquire response data from the electronic nose sensor under multiple different drift states, and to treat the response data under each drift state as a drift task; the response data in each drift task is divided into a support set and a query set; A meta-training module is used to construct an initial model containing a feature extraction network and to perform meta-training on the initial model using a model-independent meta-learning framework. The feature extraction network generates a joint feature vector that integrates spatiotemporal separation features and spatial correlation features. During the meta-training process, the meta-initialization parameters of the initial model are updated using the joint feature vector of the support set corresponding to each drift task via an inner-loop gradient update to obtain adaptation parameters. The meta-loss of the adaptation parameters is calculated using the joint feature vector of the query set corresponding to each drift task, and the meta-initialization parameters are updated using an outer-loop gradient based on the meta-loss until the meta-loss converges to obtain target parameters. The inner-loop gradient update and the outer-loop gradient update are optimized using a joint loss function, which includes a classification loss for optimizing class discrimination and a metric loss for optimizing distance relationships in the feature space. The target parameters are used as the general initialization parameters of the initial model to generate a trained electronic nose sensor drift calibration model.
[0011] Fourthly, this application discloses an electronic device comprising a processor and a memory; wherein the memory is used to store a computer program, which is loaded and executed by the processor to implement the method described above.
[0012] Fifthly, this application discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the method described above.
[0013] The beneficial effects of this application are as follows: The drift of an electronic nose is essentially due to the change in the data distribution of the same odor under different times, devices, and operating conditions. Therefore, a classifier trained solely on initial conditions will inevitably experience generalization decay. Traditional recalibration methods are costly because they require collecting a large number of standard samples to relearn the distribution under the target drift state. This invention models different drift states as different domains and uses a model-independent meta-learning framework to learn a meta-initialization that is easily corrected quickly with a small number of samples across multiple domains. Therefore, when a new drift occurs, only a very small number of standard samples need to be collected for a few updates to quickly bring the model back to a state adapted to the current drift distribution, achieving low labeling costs, rapid deployment, and reduced frequent training. Furthermore, the electronic nose signal simultaneously contains two key types of information: the temporal dynamic shape of adsorption and desorption, and the spatial cross-sensitivity between sensor array channels. Drift often affects these two types of information with different intensities and in different ways. This invention employs a dual-branch feature extraction network to simultaneously extract two types of heterogeneous features: spatiotemporal separation features and spatial correlation features. This makes the feature representation more comprehensive and less reliant on a single statistical hypothesis. Furthermore, a classification loss is used to mitigate the bias caused by class imbalance, ensuring that the extracted joint feature vector can accurately predict gas categories and endowing the feature vector with class discriminative capabilities. A metric loss is used to reconstruct feature distance relationships, making similar categories more clustered and dissimilar categories more distinct, and automatically adjusting the separation scale according to drift intensity. Therefore, it can be deduced that under typical drift scenarios such as long-term aging, short-term fluctuations, and cross-device differences, this invention is more likely to maintain a stable and separable feature space and stronger cross-domain robustness, thereby improving recognition accuracy and repeatability. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0015] Figure 1 This is a block diagram of an electronic nose system for fragrances and flavors disclosed in this application; Figure 2 This is a schematic diagram of a single-sample-injection response curve of a sensor disclosed in this application; Figure 3 This is a schematic diagram of the data distribution of the five sensor detection units disclosed in this application; Figure 4This is a flowchart of a training method for an electronic nose sensor drift calibration model disclosed in this application; Figure 5 This is a schematic diagram of the model structure of an electronic nose sensor drift adaptive calibration method based on meta-learning disclosed in this application; Figure 6 This is a flowchart of an adaptive calibration method for electronic nose sensor drift disclosed in this application; Figure 7 This is a schematic diagram of the training device structure for an electronic nose sensor drift calibration model disclosed in this application; Figure 8 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation
[0016] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0017] In numerous applications such as tobacco, flavorings, food, and chemicals, it is often necessary to classify and identify or quantitatively predict the composition and odor characteristics of volatile organic compounds (VOCs). Traditional analytical methods, such as gas chromatography / mass spectrometry (GC / GC-MS), have advantages such as high precision and strong interpretability, but the equipment is expensive, the operation is complex, and the detection cycle is long, making it difficult to meet the needs of high-frequency, on-site, and rapid screening applications. As a biomimetic olfactory analysis device, the electronic nose typically uses a sensor array composed of multiple gas sensors to obtain an "odor fingerprint," and combines signal processing and pattern recognition algorithms to achieve rapid identification of gas type, concentration, and quality. It has the characteristics of convenience, low cost, and non-invasiveness, and therefore has been widely used in many fields.
[0018] The electronic nose system comprises an inlet, pump valve, flow control, sensor chamber, sensor array consisting of multiple different sensors, signal acquisition unit, and pattern recognition unit. (Reference) Figure 1 This paper demonstrates the experimental data acquisition process of an electronic nose system for fragrances and flavors. The electronic nose sensor typically generates a typical time-series response curve for a single sample injection, including the rising segment, peak value, steady-state segment, and recovery segment. Steady-state features (such as steady-state response amplitude, steady-state mean, and steady-state slope) and transient features (rising or falling time constant, peak time, derivative peak value, integral area, and piecewise slope) can be extracted from this curve. These features, after dimensionality reduction or deep feature extraction, are input into a classifier and regressor to complete the recognition task. (Reference) Figure 2This demonstrates the sensor's single-sample-injection response curve. During long-term operation of the electronic nose, the statistical distribution of the sensor output will change over time or due to environmental factors, a phenomenon known as "sensor drift." Common sources of drift include sensor aging, contamination and poisoning, temperature and humidity variations, and instrument differences. At the data level, drift often manifests as baseline drift, sensitivity drift, dynamic characteristic drift, distribution drift, and domain shift. (Reference) Figure 3 The data distribution of four standard gases across five detection units is shown.
[0019] Overview of existing drift compensation techniques: Signal or feature-based correction: such as baseline correction, normalization, and feature recalibration; Model-based domain adaptation: suppressing drift by aligning the feature distributions of the source and target domains and fine-tuning parameters; Semi-supervised or unsupervised strategies: using unlabeled target domain data for structural constraints or self-training; Integration and online updates: improving long-term robustness through multi-classifiers, drift detection, and incremental learning.
[0020] The closest existing technology suppresses drift by aligning the feature distributions of the source and target domains using domain-adaptive networks. However, it suffers from the following drawbacks: (1) There is still a significant dependence on the sample size of the target domain, which leads to unstable calibration and high sample consumption in small sample scenarios: The core alignment constraint of the existing technical solution is based on the calculation of statistical distances such as MMD based on the target domain samples. Its essence is to estimate the distribution difference between the two domains using a limited number of samples. Therefore, when the sample size of the target domain is small, the variance of the distribution distance estimation is large and the alignment gradient is unstable, which can easily lead to insufficient alignment, over-alignment or distortion of the feature space. In order to obtain stable results, more target domain samples are often collected in the experiment, which causes serious consumption of calibration samples and high acquisition costs in small sample scenarios; (2) When the drift evolves over time, it needs to be repeatedly aligned and retrained: Existing technical solutions usually perform one-time feature alignment and model optimization for a fixed target domain (a certain drift stage or a certain device). When the sensor continues to age, the environment changes, or the drift stage changes, that is, the target domain distribution changes again, it is necessary to collect the target domain data of the new stage and retrain to restore performance. This will lead to problems such as frequent maintenance, long update cycle and poor application continuity. (3) Aligning only the overall edge distribution may destroy the category structure, resulting in negative transfer and affecting classification stability: MMD alignment usually constrains the overall distribution of features in the source and target domains to be close, but does not necessarily guarantee alignment of the same category and separation of different categories. Therefore, samples of different categories may be pulled closer and the inter-class boundaries may be compressed during the alignment process, resulting in the destruction of the category structure in the feature space. The decision boundary of the predictor is more likely to be misclassified in the target domain, resulting in negative transfer. To this end, this application provides an adaptive calibration scheme for electronic nose sensor drift, which can stably complete drift calibration even with very few calibration samples in the target domain, achieve rapid adaptation when facing new drift stages or new devices, and maintain category structure and recognition stability during the adaptation process.
[0021] Before introducing this application, in order to facilitate a better understanding of this application, the relevant terms used in this application will be explained first.
[0022] (1) Electronic nose: an odor recognition system consisting of a gas sensor array, signal acquisition and processing and pattern recognition algorithm, used to convert odors into a computable fingerprint spectrum to achieve classification, comparison or quality judgment; (2) Gas sensor array: A collection of multiple sensor channels in an electronic nose (e.g., metal oxide MOX). Different channels have different sensitivities to different volatiles, and when combined, they form a multidimensional response; (3) Sensor response (response curve, time-series signal): The electrical signal (e.g., conductivity) output by the sensor during sample introduction, adsorption, and desorption processes that changes over time. It is typically a matrix of data representing "time point × sensor channel". (4) Sensor drift: The systematic changes in sensor output with time, environment, pollution, aging, etc., that is, the inconsistent distribution of the response of the same odor at different times or on different devices, which leads to a decrease in model performance; (5) Drift calibration: The correction process performed to counteract the effects of drift. The purpose is not to change the sample itself, but to ensure that the electronic nose can still correctly identify or maintain consistency even after drifting. (6) Domain (Task) and Domain Shift: A domain can be understood as a set of conditions under which data is generated (such as a certain device, a certain aging stage, a certain temperature and humidity condition), which can be represented as a task in meta-learning. When the training domain is different from the actual usage domain, a domain shift will occur, which manifests as a change in data distribution; (7) Few samples and support set: Few samples refer to a very small number of labeled samples for each category that can be used for learning or calibration; in this invention, the support set is the small batch of standard samples used for rapid calibration. (8) Query Set: In meta-learning training, the data used to test whether the model adapted to the support set can really generalize, and is used for outer layer updates (equivalent to the role of the validation set in training). (9) Meta-learning: a training idea of "learning to learn": let the model experience many tasks during the training phase, so as to learn a more general initialization or strategy, so that it can quickly adapt to new tasks with very little data. (10) Model-Agnostic Meta-Learning (MAML): One of the typical methods of meta-learning. Its core is "two-layer optimization": Inner layer: Uses the support set for few-step gradient updates to simulate "fast on-site calibration"; Outer layer: Evaluate and update the initial parameters using the query set, making it easier for the initial parameters to be quickly calibrated to the new domain; (11) Feature extraction: The process of converting the original sensor time-series signals into feature representations (feature vectors or feature maps) that are more suitable for classification. The extracted features should be as insensitive to drift as possible while preserving class differences; (12) Dynamic reweighted cross-entropy: a variant of the loss function used for classification training: increasing the weight of the class with fewer samples and decreasing the weight of the class with more samples to alleviate the bias caused by class imbalance; (13) Triple loss: By constructing a constrained feature space of anchor sample a, positive sample of the same class p, and negative sample of different class n, the same class is closer and the different class is farther away, thus obtaining a more stable and separable feature representation.
[0023] (14) Adaptive Margin: The distance difference threshold in the triplet loss is not a fixed constant in this invention, but can be learned or changed with the task, so as to maintain a suitable separation scale under different drift intensities.
[0024] This invention discloses a training method for an electronic nose sensor drift calibration model, see [link to relevant documentation]. Figure 4 As shown, the method includes: Step S11: Acquire response data of the electronic nose sensor under multiple different drift states, and treat the response data under each drift state as a drift task.
[0025] Electronic nose sensors typically consist of an array of multiple gas sensors. During a single sample injection, each sensor outputs an electrical signal that varies over time, known as the response data. This response data includes transient information about the gas's adsorption and desorption processes, as well as cross-sensitivity information of the sensor array to various volatile components.
[0026] Different drift states refer to various typical scenarios where the output characteristics of an electronic nose sensor undergo systematic changes due to factors such as aging, contamination and poisoning, temperature and humidity variations, and instrument differences during long-term operation. Examples include the aging state of the same sensor at different time stages (e.g., the first, third, and sixth months of use); the operating state of the same sensor under different environmental conditions (e.g., different temperatures and humidity levels); and the device differences between different individual devices (e.g., multiple electronic noses of the same model). These different drift states can be obtained through data collection in real-world scenarios or simulated using publicly available sensor drift datasets (e.g., multiple batches of data organized in batches in the UCI Machine Learning Library's Gas Sensor Array Drift Dataset, or data from multiple sensor units in the UCI Machine Learning Library's Twin Gas Sensor Arrays).
[0027] In this embodiment, after acquiring the response data, the data under different drift states needs to be organized into drift tasks for model training. Specifically, the response data under each drift state is treated as an independent drift task. For example, all the response data collected by the first device can be considered as one task, and the response data from the second device as another task; or the data from the first time batch can be considered as one task, and the data from the second time batch as another task. Each drift task contains multiple samples, and each sample corresponds to the sensor response data collected in one injection and its corresponding gas category label.
[0028] Step S12: Divide the response data in each drift task into a support set and a query set.
[0029] In this embodiment, aging states at different time periods, different equipment, and different batches under different operating conditions are regarded as different drift domains. After constructing the response data of each drift state into an independent drift task, the data within each drift task needs to be further divided. A model that can adapt quickly is trained using the data of a certain domain. In this way, when a new drift occurs on site, only a small number of standard samples need to be collected as a support set, and the model can complete the calibration through a few updates and be used for subsequent identification.
[0030] Specifically, refer to Figure 5 The task set consisting of multiple drift tasks is divided into a meta-training set. With meta-test set The drift tasks in the meta-training set are used for the inner loop gradient update and the outer loop gradient update during model training, while the drift tasks in the meta-test set are used for the performance evaluation of the final generated model. For each drift task in the meta-training set... (Its sample set is denoted as) The response data of the drift task is divided into support sets through random sampling. and query set Random partitioning can increase the task diversity of meta-training and improve the generalization robustness of the model.
[0031] It should be noted that both the support set and the query set come from the same sample set of the drift task, with the query set typically having a larger sample size than the support set. The support set is used to simulate the "small number of standard samples" scenario encountered in real-world applications, serving as the inner loop adaptation during meta-training. The query set is used to evaluate the model's generalization performance after adaptation to the support set, serving as the outer loop update during meta-training. Through rapid adaptation using the support set and validation of generalization using the query set, the model acquires rapid domain adaptation capabilities.
[0032] Step S13: Construct an initial model containing a feature extraction network, and perform meta-training on the initial model using a model-independent meta-learning framework; wherein, the feature extraction network is used to generate a joint feature vector that integrates spatiotemporal separation features and spatial correlation features.
[0033] In this embodiment, a feature extraction network is used to extract drift-robust feature representations from the raw response data of the electronic nose sensor. This step is fundamental to building the model's sensing capabilities. The electronic nose signal contains two types of information: first, the transient response of gas adsorption / desorption over time; and second, the cross-sensitivity between different sensor channels. To comprehensively capture this information, the feature extraction network of this invention includes a dual-branch feature extraction module, the structure of which is referenced... Figure 5 .
[0034] (1) First branch: Spatiotemporal separation feature extraction path, used to extract spatiotemporal separation features in the sensor dimension and time dimension. Specifically, separable convolution is used to sequentially convolve along the time dimension and sensor dimension to obtain spatiotemporal separation features with a low parameter count. The feature description formula for this branch is as follows: ; in, It is a non-linear activation. and It is a strip convolutional layer.
[0035] (2) Second branch: Spatial correlation feature extraction path, used to extract spatial correlation features of the sensor array, which is less sensitive to drift at the feature level; specifically, it uses standard convolution to construct a hybrid receptive field to extract the spatial correlation features of the sensor array. The feature description formula for this branch is as follows: ; in, It is a standard convolutional layer.
[0036] The features extracted from the two branches are concatenated to form a more complete and robust representation of the original signal. Specifically, spatiotemporal separation features and spatial correlation features are fused through residual connections to generate a joint feature vector. The formula for describing the residual connection is: ;in, This indicates a linear mapping to align dimensions. This indicates that two features are concatenated.
[0037] As can be seen, the spatiotemporal separation features output from the first branch and the spatial correlation features output from the second branch are first concatenated along the feature channel dimension to obtain the concatenated features. Then, the concatenated features are transformed by linear mapping to match the feature dimensions of the original sensor time-series response data. The concatenated features with the above-mentioned dimension alignment are added element-wise to the original sensor time-series response data to finally obtain the joint feature vector, so as to retain the low-level detailed information of the original response.
[0038] In order to enable the feature extraction network to adapt quickly between different drift states, in this embodiment of the application, the initial model is meta-trained using the Model-Agnostic Meta-Learning (MAML) framework, so that the model learns universal model parameters across drift domains, and can quickly adapt and complete calibration with very few standard samples when encountering a new drift state.
[0039] In one feasible implementation, without changing the overall idea of offline cross-drift task training and online few-shot fast update, the meta-learning algorithm can also be replaced with: First-order model-independent meta-learning: First-order MAML (first-order approximation of model-independent meta-learning), reducing computational cost; Reptile meta-learning: updating meta-parameters using parameter differences after multi-task inner loops, simplifying engineering implementation; Meta-SGD (meta-learning step size): simultaneously learning the initialization parameters and the update step size / direction of each parameter, making online updates faster; ANIL (update only the output head or a few layers): stabilizing feature extraction during meta-training, updating only the output head or calibration layer online; Bayesian meta-learning: learning the parameter distribution (mean / variance), performing posterior updates online with a few samples, improving stability under uncertainty.
[0040] Step S14: During the meta-training process, the meta-initialization parameters of the initial model are updated using the joint feature vector of the support set corresponding to each drift task to obtain the adaptation parameters. The meta-loss of the adaptation parameters is calculated using the joint feature vector of the query set corresponding to each drift task. The meta-initialization parameters are updated using the outer loop gradient based on the meta-loss until the meta-loss converges to obtain the target parameters. The inner loop gradient update and the outer loop gradient update are optimized using a joint loss function, which includes a classification loss for optimizing class discrimination ability and a metric loss for optimizing distance relationships in the feature space.
[0041] In the embodiments of this application, the core idea of model-independent meta-learning is to find a meta-initialization parameter. This makes it possible in any new domain Only a small amount of gradient descent is needed to converge to the optimum. During meta-training, model parameters are updated twice, through inner and outer loops. During meta-testing, a small number of labeled samples from the support set are used to quickly adapt the model parameters, and finally, the model is evaluated by testing on the query set. The meta-training process specifically includes the following sub-steps: (1) For the current drift task in the current training round, the first loss value of the meta-initialization parameter of the initial model on the support set is calculated based on the joint feature vector of the corresponding support set and the joint loss function. The meta-initialization parameter is updated with inner loop gradient according to the first loss value to obtain the adaptation parameter corresponding to the current drift task.
[0042] In this sub-step, rapid calibration is simulated through inner loop gradient updates. The inner loop is performed using the support set. T Step gradient descent, the first step t The step update rule formula is: ;in, For the first i The drifting mission in the first t Model parameters during step update The inner loop learning rate, This is the Hadamard product, which represents the element-wise multiplication of the gradient with the learning rate. Let L be the gradient of the loss function with respect to the model parameters θ. The calculation is performed using the support set of the i-th task. In this process, for each task, starting with the meta-initialization parameters of the current model, the first loss value (including the joint loss consisting of classification loss and metric loss) is calculated using the support set of that task, and one or more gradient descent operations are performed to obtain the adaptation parameters. This process simulates the behavior of updating model parameters with only a small number of standard samples when encountering new drifts in real-world applications.
[0043] (2) Using the joint feature vector of the query set corresponding to the current drift task, calculate the second loss value of the adaptation parameter on the query set based on the joint loss function, and aggregate the second loss values of all drift tasks to obtain the total meta-loss.
[0044] In this sub-step, after inner-loop adaptation, the adaptation parameters for each task are obtained. To evaluate the generalization performance of the adaptation parameters on new samples, a second loss value is calculated using the query set of the same task. This second loss value is then accumulated across the gradients of all tasks, and the meta-initialization parameters are updated using the outer-loop gradient. The formula for calculating the total meta-loss is: ;in, The number of domains used in each epoch.
[0045] (3) Update the outer loop gradient of the meta-initialization parameters according to the total meta-loss to obtain the updated meta-initialization parameters.
[0046] The meta-optimizer is used to update the meta-initialization parameters, which are then updated as follows: ;in, The outer loop learning rate.
[0047] (4) The updated meta-initialization parameters are used as the starting parameters for the current drift task in the next training round when performing the inner loop gradient update, and the inner loop gradient update and the outer loop gradient update are repeatedly executed until the total meta-loss converges to obtain the target parameters.
[0048] In this sub-step, the updated meta-initialization parameters are used as the starting parameters for the current drift task in the next training epoch when performing inner-loop gradient updates. Then, the above inner-loop gradient update and outer-loop gradient update processes are repeated until the total meta-loss converges or the preset number of training epochs is reached. The target parameters obtained at this point are the general initialization parameters for the trained electronic nose sensor drift calibration model.
[0049] It should be noted that a joint loss function is used in both the inner and outer loop gradient updates, and this joint loss represents the direction of training optimization. In this embodiment, the joint loss function includes classification loss and metric loss, simultaneously optimizing the classification objective and metric learning objective within the meta-learning framework.
[0050] In one feasible implementation, unlike the traditional approach of first statistically analyzing the entire training set and then fixing the weights, this invention uses dynamic reweighted cross-entropy loss for classification loss. By dynamically weighting the class imbalance, the model can correctly classify the classes and pay more attention to the classes with fewer samples.
[0051] The reweighted cross-entropy loss estimates the class distribution in real time within each batch to adapt to changes in data distribution caused by task sampling in meta-learning. For a given support set or query set batch... To calculate the instantaneous probability of each category of sample, the number of samples in each category in the batch is counted, and the ratio is taken with the batch size to obtain the instantaneous probability. To avoid probability anomalies caused by zero samples, Laplace smoothing is introduced into the instantaneous probability calculation. The probability calculation formula is: ; in, For instantaneous probability, B For batch size, K For the number of gas categories, , This is an indicator function used to count categories in a batch. k The number of samples; when the label of the i-th sample... equals category k The value is 1 when it is active; otherwise it is 0.
[0052] To ensure that the minority class receives a larger gradient, the reciprocal of the squared frequency is used to assign a larger weight to the minority class. The weight calculation formula is as follows: To avoid division by zero errors, take , For category j The instantaneous probability. This weight is incorporated into the cross-entropy loss function to obtain the dynamically reweighted cross-entropy loss, which is calculated using the following formula: ;in, B For batch size, For the first i The category to which each sample belongs The weight, For model parameters Time prediction samples Category The probability of; where, The instantaneous probability of each category of samples within each training batch is dynamically determined based on the number of samples of each category in the training batch and the batch size, and Laplace smoothing is introduced to avoid zero probability.
[0053] In another feasible implementation, the metric loss uses adaptive triplet loss, which brings samples of the same class closer together and pushes samples of different classes further apart in the feature space, making the feature space more stable and easier to distinguish. Within the metric learning framework, triplet loss constructs anchor points, positive examples, and negative example sample groups, driving the clustering of similar samples and the separation of dissimilar samples in the feature space. Margin is an important hyperparameter, denoted by the variable m below. Triplet loss requires that the distance from the anchor point to a negative example must be at least m farther than the distance to a positive example. When m is too large, the loss will always be zero, resulting in gradient vanishing; when m is too small, the model will overemphasize already separated samples, slowing down the convergence speed. To adapt to the problem of different degrees of feature shift in electronic nose drift, this invention sets m as a trainable parameter, and the meta-optimizer can automatically adjust m according to the task difficulty. Softplus activation is used to ensure non-negativity, and the calculation formula is: ;in, This represents the original parameters.
[0054] To improve the efficiency of triplet loss, in each training batch, the most difficult positive and negative examples are actively selected for each anchor sample, allowing the loss to focus on the fuzzy boundaries in the feature space. The formula for calculating adaptive triplet loss is: ;in, B For batch size, For anchor point samples a eigenvectors, For anchor point samples a The eigenvector of the farthest positive example, For anchor point samples a The eigenvectors of the nearest negative example, m The parameters are trainable adaptive margins, and the Softplus function is used to control non-negativity. It is the L2 norm. Use the ReLU function to ensure that the loss value is non-negative. Indicates the anchor point The farthest positive example, that is, the sample of the same kind that is farthest from the anchor point feature; Indicates the anchor point The nearest negative example is the out-of-class sample that is closest to the anchor feature. The formula for calculating the farthest positive example is: The formula for calculating the most recent negative is: ; The feature vector of a positive sample belonging to the same category as anchor sample a; This is the feature vector of a negative sample that belongs to a different category than the anchor sample a.
[0055] Finally, to balance classification and metric learning, learnable weights are introduced. To balance the two losses, their weights can be adaptively adjusted during training. The joint loss formula is as follows: .
[0056] Step S15: Use the target parameters as the general initialization parameters of the initial model to generate the trained electronic nose sensor drift calibration model.
[0057] In this step, the target parameters obtained through the combined effect of the above inner and outer loop double-layer optimization and joint loss are used as the general initialization parameters of the initial model, and the trained drift calibration model is output.
[0058] like Figure 5 As shown, the electronic nose drift calibration model consists of three parts: a bi-branch feature extraction module, joint loss, and model-independent meta-learning. During implementation, multiple feature extraction modules are first used to select and extract features from the original gas data, obtaining feature vectors representing gas information. These feature vectors are then further reduced in dimensionality using a fully connected layer to obtain the predicted probability distribution. In calculating the joint loss, the reweighted cross-entropy loss is calculated using the predicted probability distribution, and the adaptive triplet loss is calculated using the feature vectors. The two are weighted to obtain the joint loss. During training using model-independent meta-learning, the model parameters are optimized using a two-layer inner-loop and outer-loop approach with the joint loss on the support set and query set in the meta-task, thereby obtaining the optimal model parameters.
[0059] The beneficial effects of this application are as follows: The drift of an electronic nose is essentially due to the change in the data distribution of the same odor under different times, devices, and operating conditions. Therefore, a classifier trained solely on initial conditions will inevitably experience generalization decay. Traditional recalibration methods are costly because they require collecting a large number of standard samples to relearn the distribution under the target drift state. This invention models different drift states as different domains and uses a model-independent meta-learning framework to learn a meta-initialization that is easily corrected quickly with a small number of samples across multiple domains. Therefore, when a new drift occurs, only a very small number of standard samples need to be collected for a few updates to quickly bring the model back to a state adapted to the current drift distribution, achieving low labeling costs, rapid deployment, and reduced frequent training. Furthermore, the electronic nose signal simultaneously contains two key types of information: the temporal dynamic shape of adsorption and desorption, and the spatial cross-sensitivity between sensor array channels. Drift often affects these two types of information with different intensities and in different ways. This invention employs a dual-branch feature extraction network to simultaneously extract two types of heterogeneous features: spatiotemporal separation features and spatial correlation features. This makes the feature representation more comprehensive and less reliant on a single statistical hypothesis. Furthermore, a classification loss is used to mitigate the bias caused by class imbalance, ensuring that the extracted joint feature vector can accurately predict gas categories and endowing the feature vector with class discriminative capabilities. A metric loss is used to reconstruct feature distance relationships, making similar categories more clustered and dissimilar categories more distinct, and automatically adjusting the separation scale according to drift intensity. Therefore, it can be deduced that under typical drift scenarios such as long-term aging, short-term fluctuations, and cross-device differences, this invention is more likely to maintain a stable and separable feature space and stronger cross-domain robustness, thereby improving recognition accuracy and repeatability.
[0060] This application discloses an adaptive calibration method for electronic nose sensor drift. When the electronic nose sensor exhibits a new, unknown drift state (e.g., aging after long-term operation, drastic changes in environmental temperature and humidity, or replacement of different device units), calibration can be completed with only a very small number of standard samples, without requiring the recollection of a large number of standard samples or retraining the model from scratch, thus restoring high-precision recognition capabilities. See also... Figure 6 As shown, the method includes: Step S21: Obtain the trained electronic nose sensor drift calibration model; wherein the electronic nose sensor drift calibration model is a model trained using the aforementioned training method for electronic nose sensor drift calibration models.
[0061] In this embodiment, the electronic nose sensor drift calibration model refers to a neural network model with general target parameters obtained by training on the Model-Independent Meta-Learning (MAML) framework as described in the foregoing embodiments. For more specific details regarding the working process of this model, please refer to the relevant content disclosed in the foregoing embodiments; further elaboration will not be repeated here.
[0062] Step S22: When a new unknown drift state occurs, a preset number of samples with category labels are collected as a calibration support set, and the electronic nose sensor drift calibration model is updated with a preset number of gradient steps using the calibration support set to obtain a target recognition model adapted to the unknown drift state.
[0063] In practical applications, the electronic nose system continuously monitors the sensor's response output. When a decrease in recognition accuracy is detected or the system prompts for calibration, a new unknown drift state can be identified. At this point, the operator or automated system only needs to collect a small number of standard samples of known odor categories, defining them as the standard support set. Using a small number of labeled samples from the standard support set, the model parameters are quickly adapted, providing a supervisory signal for subsequent rapid calibration.
[0064] Furthermore, the model is rapidly calibrated on-site based on the standard support set to obtain a target recognition model adapted to unknown drift states. Specifically, starting with the target parameters of the electronic nose sensor drift calibration model, the loss function is calculated using the standard support set, and the model parameters are iteratively updated a preset number of times along the gradient descent direction. Since the target parameters have already been meta-trained to be in a parameter space highly sensitive to drift, this small number of updates is sufficient for the model to fully adapt to the data distribution changes under the new drift state without overfitting or underfitting.
[0065] Step S23: Use the target recognition model to extract features and classify unknown gas samples in the current environment to output calibrated odor recognition results.
[0066] In this step, after obtaining the target recognition model adapted to the unknown drift state, the electronic nose system can enter normal detection mode. For any unknown gas sample in the current environment, the system inputs its sensor response data into the target recognition model for feature extraction and classification, and outputs the calibrated odor recognition result. Because the model parameters of the target recognition model have been quickly calibrated for the current drift state, the output recognition result can effectively overcome the deviation caused by sensor drift and maintain a high accuracy similar to that in the non-drift state.
[0067] Accordingly, this application also discloses a training device for an electronic nose sensor drift calibration model, see [link to relevant documentation]. Figure 7 As shown, the device includes: The drift task division module 11 is used to acquire response data of the electronic nose sensor under multiple different drift states, and to divide the response data under each drift state into a drift task; and to divide the response data in each drift task into a support set and a query set. The meta-training module 12 is used to construct an initial model containing a feature extraction network and to perform meta-training on the initial model using a model-independent meta-learning framework. The feature extraction network generates a joint feature vector that integrates spatiotemporal separation features and spatial correlation features. During the meta-training process, the meta-initialization parameters of the initial model are updated using the joint feature vector of the support set corresponding to each drift task via an inner-loop gradient to obtain adaptation parameters. The meta-loss of the adaptation parameters is calculated using the joint feature vector of the query set corresponding to each drift task, and the meta-initialization parameters are updated using an outer-loop gradient based on the meta-loss until the meta-loss converges to obtain target parameters. The inner-loop gradient update and the outer-loop gradient update are optimized using a joint loss function, which includes a classification loss for optimizing class discrimination and a metric loss for optimizing distance relationships in the feature space. The target parameters are used as the general initialization parameters of the initial model to generate a trained electronic nose sensor drift calibration model.
[0068] For more detailed information on the working process of each of the above modules, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.
[0069] Therefore, it can be seen that, through the above-described scheme of this embodiment, the drift of the electronic nose is essentially due to the change in the data distribution of the same odor under different times, devices, and operating conditions. Thus, a classifier trained solely on initial conditions will inevitably experience generalization decay. The reason why traditional recalibration methods are costly is that they require collecting a large number of standard samples again to relearn the distribution under the target drift state. This invention models different drift states as different domains and uses a model-independent meta-learning framework to learn a meta-initialization that is easily corrected quickly with a small number of samples across multiple domains. Therefore, when a new drift occurs, only a very small number of standard samples need to be collected for a few updates to quickly bring the model back to a state adapted to the current drift distribution, achieving low labeling costs, rapid deployment, and reduced frequent training. Furthermore, the electronic nose signal simultaneously contains two key types of information: the temporal dynamic shape of adsorption and desorption, and the spatial cross-sensitivity between sensor array channels. Drift often affects these two types of information with different intensities and in different ways. This invention employs a dual-branch feature extraction network to simultaneously extract two types of heterogeneous features: spatiotemporal separation features and spatial correlation features. This makes the feature representation more comprehensive and less reliant on a single statistical hypothesis. Furthermore, a classification loss is used to mitigate the bias caused by class imbalance, ensuring that the extracted joint feature vector can accurately predict gas categories and endowing the feature vector with class discriminative capabilities. A metric loss is used to reconstruct feature distance relationships, making similar categories more clustered and dissimilar categories more distinct, and automatically adjusting the separation scale according to drift intensity. Therefore, it can be deduced that under typical drift scenarios such as long-term aging, short-term fluctuations, and cross-device differences, this invention is more likely to maintain a stable and separable feature space and stronger cross-domain robustness, thereby improving recognition accuracy and repeatability.
[0070] Furthermore, embodiments of this application also disclose an electronic device, Figure 8 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0071] Figure 8 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the methods disclosed in any of the foregoing embodiments.
[0072] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0073] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk, or optical disk, etc. The resources stored on it can include an operating system 221, computer programs 222, and data 223, etc. The data 223 can include various types of data. The storage method can be temporary storage or permanent storage.
[0074] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including computer programs capable of performing the methods executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.
[0075] Furthermore, this application also discloses a computer-readable storage medium, which includes random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, magnetic disks, optical disks, or any other form of storage medium known in the art. The computer program, when executed by a processor, implements the aforementioned method. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0076] Furthermore, embodiments of this application provide a computer program product, including a computer program / instructions, which, when executed by a processor, implements any of the above-described methods.
[0077] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0078] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0079] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0080] The above provides a detailed description of the electronic nose sensor drift adaptive calibration and model training method, apparatus, device, and medium provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only intended to help understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A training method for an electronic nose sensor drift calibration model, characterized in that, include: Acquire response data from the electronic nose sensor under multiple different drift states, and treat the response data under each drift state as a drift task; The response data in each drift mission is divided into a support set and a query set; An initial model containing a feature extraction network is constructed, and the initial model is meta-trained using a model-independent meta-learning framework; wherein, the feature extraction network is used to generate a joint feature vector that integrates spatiotemporal separation features and spatial correlation features; During the meta-training process, the meta-initialization parameters of the initial model are updated using the joint feature vector of the support set corresponding to each drift task to obtain the adaptation parameters. The meta-loss of the adaptation parameters is calculated using the joint feature vector of the query set corresponding to each drift task, and the meta-initialization parameters are updated using the outer loop gradient based on the meta-loss until the meta-loss converges to obtain the target parameters. The inner loop gradient update and the outer loop gradient update are optimized using a joint loss function, which includes a classification loss for optimizing class discrimination ability and a metric loss for optimizing distance relationships in the feature space. The target parameters are used as general initialization parameters for the initial model to generate a trained electronic nose sensor drift calibration model.
2. The training method for the electronic nose sensor drift calibration model according to claim 1, characterized in that, The process of dividing the response data in each drift task into a support set and a query set includes: The task set consisting of multiple drift tasks is divided into a meta-training set and a meta-test set; wherein, the drift tasks in the meta-training set are used for the inner loop gradient update and the outer loop gradient update during model training, and the drift tasks in the meta-test set are used for the performance evaluation of the final generated model. For each drift task in the meta-training set, the response data of the drift task is divided into a support set and a query set by random sampling.
3. The training method for the electronic nose sensor drift calibration model according to claim 1, characterized in that, The feature extraction network includes a dual-branch feature extraction module, which includes a spatiotemporal separation feature extraction path and a spatial correlation feature extraction path. The spatiotemporal separation feature extraction path is used to extract the spatiotemporal separation features by sequentially convolving separable convolutions along the time dimension and the sensor dimension. The spatial correlation feature extraction path is used to construct a hybrid receptive field using standard convolutions to extract the spatial correlation features of the sensor array. Accordingly, generating the joint feature vector using the feature extraction network includes: The spatiotemporal separation features and the spatial correlation features are fused through residual connections to generate the joint feature vector.
4. The training method for the electronic nose sensor drift calibration model according to claim 1, characterized in that, The process involves using the joint feature vector of the support set corresponding to each drift task to perform inner-loop gradient updates on the meta-initialization parameters of the initial model to obtain adaptation parameters, calculating the meta-loss of the adaptation parameters using the joint feature vector of the query set corresponding to each drift task, and performing outer-loop gradient updates on the meta-initialization parameters based on the meta-loss until the meta-loss converges to obtain target parameters, including: For the current drift task in the current training round, the joint feature vector of the corresponding support set is used to calculate the first loss value of the meta-initialization parameters of the initial model on the support set based on the joint loss function, and the inner loop gradient is updated on the meta-initialization parameters according to the first loss value to obtain the adaptation parameters corresponding to the current drift task. Using the joint feature vector of the query set corresponding to the current drift task, the second loss value of the adaptation parameter on the query set is calculated based on the joint loss function, and the second loss values of all drift tasks are aggregated to obtain the total meta-loss; The meta-initialization parameters are updated by performing outer-loop gradient updates based on the total meta-loss to obtain the updated meta-initialization parameters; The updated meta-initialization parameters are used as the starting parameters for the current drift task in the next training round when performing the inner loop gradient update, and the inner loop gradient update and the outer loop gradient update are repeated until the total meta-loss converges to obtain the target parameters.
5. The training method for the electronic nose sensor drift calibration model according to claim 1, characterized in that, The classification loss is the dynamically reweighted cross-entropy loss; the formula for calculating the dynamically reweighted cross-entropy loss is: ;in, B For batch size, For the first i The category to which each sample belongs The weight, For model parameters Time prediction samples Category The probability of; where, The instantaneous probability of each category of samples within each training batch is dynamically determined based on the number of samples of each category in the training batch and the batch size, and Laplace smoothing is introduced to avoid zero probability.
6. The training method for the electronic nose sensor drift calibration model according to claim 1, characterized in that, The metric loss is the adaptive triplet loss; the formula for calculating the adaptive triplet loss is: ;in, B For batch size, For anchor point samples a eigenvectors, For anchor point samples a The eigenvector of the farthest positive example, For anchor point samples a The eigenvectors of the nearest negative example, m The parameters are trainable adaptive margins, and the Softplus function is used to control non-negativity. It is the L2 norm. This is the ReLU function.
7. An adaptive calibration method for electronic nose sensor drift, characterized in that, include: Obtain a trained electronic nose sensor drift calibration model; wherein the electronic nose sensor drift calibration model is a model trained using the training method for electronic nose sensor drift calibration models as described in any one of claims 1 to 6; When a new unknown drift state occurs, a preset number of samples with category labels are collected as a calibration support set, and the electronic nose sensor drift calibration model is updated with a preset number of gradient steps using the calibration support set to obtain a target recognition model adapted to the unknown drift state. The target recognition model is used to extract features and classify unknown gas samples in the current environment to output calibrated odor recognition results.
8. A training device for an electronic nose sensor drift calibration model, characterized in that, include: The drift task division module is used to acquire response data from the electronic nose sensor under multiple different drift states and to treat the response data under each drift state as a drift task. The response data in each drift mission is divided into a support set and a query set; A meta-training module is used to construct an initial model containing a feature extraction network and to perform meta-training on the initial model using a model-independent meta-learning framework. The feature extraction network generates a joint feature vector that integrates spatiotemporal separation features and spatial correlation features. During the meta-training process, the meta-initialization parameters of the initial model are updated using the joint feature vector of the support set corresponding to each drift task via an inner-loop gradient update to obtain adaptation parameters. The meta-loss of the adaptation parameters is calculated using the joint feature vector of the query set corresponding to each drift task, and the meta-initialization parameters are updated using an outer-loop gradient based on the meta-loss until the meta-loss converges to obtain target parameters. The inner-loop gradient update and the outer-loop gradient update are optimized using a joint loss function, which includes a classification loss for optimizing class discrimination and a metric loss for optimizing distance relationships in the feature space. The target parameters are used as the general initialization parameters of the initial model to generate a trained electronic nose sensor drift calibration model.
9. An electronic device, characterized in that, The electronic device includes a processor and a memory; wherein the memory is used to store a computer program, which is loaded and executed by the processor to implement the method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store a computer program; wherein the computer program, when executed by a processor, implements the method as described in any one of claims 1 to 7.