Graph neural network gas classification and identification method based on comparative learning and edge marking framework

By comparing the graph neural network method of learning and edge marking frameworks, the problems of traditional models' strong dependence on label samples and high data acquisition cost are solved, and efficient gas classification recognition under supervised and unsupervised settings are realized, which significantly improves the Accuracy and stability of gas classification.

CN119128722AActive Publication Date: 2024-12-13GUANGXI UNIV

Patent Information

Application Number
CN202411219858.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-02
Publication Date
2024-12-13
Estimated Expiration
2044-09-02

AI Technical Summary

Technical Problem

Traditional graph neural networks rely on a large number of labeled samples in gas classification recognition, and the data acquisition cost is high, making it difficult to effectively train under unsupervised settings, resulting in limited model performance and inability to effectively deal with sensor drift problems.

Method used

Using a graph neural network method based on contrast learning and edge marking framework, unsupervised training is achieved through self-supervised learning and momentum encoder, reducing dependence on marking samples, and iteratively updates the similarity and differences between samples. Improve the accuracy of gas classification identification.

Benefits of technology

Significantly improves the accuracy of gas classification results and model stability, reduces data acquisition costs, provides an efficient solution in situations where data acquisition costs are high or tag information is limited, and can be carried out under supervised and unsupervised settings. Effective training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119128722A_ABST
    Figure CN119128722A_ABST
Patent Text Reader

Abstract

The invention discloses a graph neural network gas classification and recognition method based on comparative learning and an edge marking framework. The method comprises the steps that 1, a gas sensor collects gas feature data; 2, a preprocessing module carries out preprocessing operation on the gas characteristic data; 3, inputting a query set sample and a support set sample into a momentum encoder by an input layer; 4, the momentum encoder performs feature extraction operation on the query set sample and the support set sample; 5, a graph construction module constructs the query set feature vector and the support set feature vector into a fully connected graph, and initializes the fully connected graph; 6, a graph updating module performs iterative operation of node feature updating and edge feature updating on the initialized feature graph; and 7, classifying and identifying the clustering feature map by a classification and identification module, and outputting a gas classification result. The method has the advantages that by introducing an edge marking mechanism into the graph neural network, not only are the features and labels of the nodes considered, but also the labels are given to the edges, so that the similarity and the clustering relation between the samples are carefully captured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of gas identification technology, and in particular to a graph neural network gas classification and identification method based on contrastive learning and edge labeling framework. Background Art

[0002] Although the performance of chemical sensors is affected by the sensor properties, the gradual changes and unpredictability of their chemosensory signal responses when exposed to the same analyte under the same conditions, the so-called sensor drift, has long been considered a major challenge in the field of chemical sensing. This phenomenon can reduce the stability of electronic nose systems and make models used to distinguish gases or odors obsolete. The reasons may stem from a variety of effects, such as sensor aging due to long-term use, poisoning of sensitive materials due to contamination, and thermal effects of sensors during different operations. Although these drifts are usually classified into first-order and second-order components, it is difficult to distinguish them empirically and it is impossible to develop methods suitable for correcting different drift sources because the origins have not been determined. Therefore, regarding drift reduction, some researchers focus on high-performance sensor materials that can interact reversibly with gases, some minimize the irreversible effects of sensor poisoning through temperature regulation techniques, while other works believe that drift countermeasures should be implemented for first-order and second-order components from a long-term perspective. Nevertheless, the drift mechanism is quite complex and inevitable, so much so that it has plagued the sensor research community for many years and may continue to do so.

[0003] Traditional methods mainly address the drift compensation problem of electronic noses from two aspects:

[0004] (1) Signal preprocessing techniques to reduce the impact of drift by improving data quality, such as baseline processing methods: improving the signal by subtracting a reference baseline value from the sensor response, and frequency domain filtering methods: by focusing on a specific frequency domain, the noise components in the signal can be filtered out, especially those components that are not related to the target gas detection;

[0005] (2) Drift component correction method, which improves the stability and accuracy of the model by correcting the drift component in the data. It includes orthogonal signal correction (OSC): correcting drift by removing variable information irrelevant to the target variable from the data, principal component analysis (PCA): extracting main features through data dimensionality reduction to reveal the hidden and most important structure in the data, generalized least squares weighting (GLSW): optimizing the model fitting effect by assigning different weights to different data points, and direct standardization (DS): adjusting the model to adapt to possible drift by comparing the response of standardized samples with that of actual samples. These methods have been replaced in recent years due to their low sensitivity and accuracy.

[0006] Disadvantages of existing technologies: Traditional graph neural networks (GNNs) usually require labeled samples for model training and only allow models to be trained in a supervised setting, which results in the model having a high dependence on a large number of labeled samples, the model performance is easily affected by the limitations of labeled information, and the data acquisition cost is high. Summary of the invention

[0007] The present invention provides a graph neural network gas classification and recognition method based on contrastive learning and edge labeling framework, which effectively improves the accuracy of gas classification results.

[0008] To achieve the above-mentioned purpose, the present invention provides a graph neural network gas classification and recognition method based on contrastive learning and edge labeling framework, the key of which is that it includes a model training step A and a gas classification and recognition step B;

[0009] Wherein, the model training step A includes the following steps:

[0010] Step A1: construct a graph neural network training model, wherein the graph neural network training model is provided with a feature enhancement module, an encoder, a momentum encoder, a graph construction module and a graph update module;

[0011] The feature enhancement module is connected to the encoder and the momentum encoder, the encoder and the momentum encoder are connected to the graph construction module, and the graph construction module is connected to the graph update module;

[0012] Step A2: adopting a contrastive learning strategy under self-supervised learning to train the graph neural network training model. After the training is completed, retain the momentum encoder, the graph construction module and the graph update module, the momentum encoder is connected to the graph construction module, and the graph construction module is connected to the graph update module, thereby obtaining a graph neural network based on contrastive learning and edge labeling framework;

[0013] Through the above design, the contrastive learning strategy under self-supervised learning is used in the model training process, and the momentum encoder is introduced to make the representation of samples more consistent. When the labels in the training set can be used for training, self-supervised learning and supervised learning are performed simultaneously to improve the performance of the model. When the data in the training set is unlabeled, self-supervised learning is used for training to improve the performance of the model.

[0014] The graph neural network training model provided by the present invention allows the model to be trained not only in a supervised setting, but also in an unsupervised setting. This unsupervised training capability significantly reduces the model's reliance on a large number of labeled samples, thereby providing a more efficient and practical solution in situations where data acquisition costs are high or labeled information is limited.

[0015] The gas classification identification step B comprises the following steps:

[0016] Step B1: The gas sensor array collects gas characteristic data a1 in real time, and transmits the gas characteristic data a1 to a preprocessing module;

[0017] Step B2: the preprocessing module performs a preprocessing operation on the gas characteristic data a1 to obtain a query set sample a2, and passes it to the graph neural network;

[0018] Step B3: The input layer of the graph neural network inputs the query set sample a2 and N types of support set samples into the momentum encoder, and each type of support set sample contains R samples;

[0019] Step B4: the momentum encoder performs feature extraction operations on the query set sample a2 and the N-type support set samples respectively to obtain the query set feature vector a3 and the N-type support set feature vector, and pass them to the graph construction module;

[0020] Step B5: the graph construction module constructs the query set feature vector a3 and the N-type support set feature vectors into a fully connected graph a4, and initializes the node features and edge features in the fully connected graph a4 to obtain an initialized feature graph a5 and pass it to the graph update module;

[0021] Step B6: the graph updating module performs iterative operations of node feature updating and edge feature updating on the initialization feature graph a5, and after performing L iterative operations, outputs the clustering feature graph a6 to the classification and recognition module;

[0022] Step B7: The classification and recognition module classifies and recognizes the cluster feature graph a6 and outputs a gas classification result.

[0023] The preprocessing operation is to normalize and standardize the input data so that it meets the input requirements of the graph neural network based on contrastive learning and edge labeling framework.

[0024] Through the above design, the similarities and differences between samples are explicitly simulated by iteratively updating the labels of the edges. Compared with the traditional GNN model, the graph neural network CEGNNDrift based on contrastive learning and edge labeling framework does not rely on implicit clustering similarity simulation, but directly uses edge labels to guide the learning process. This explicit clustering evolution enables the model to more accurately capture the structural information between samples, thereby improving the recognition ability of new gas categories.

[0025] Preferably, in step A2, the graph neural network training model is trained using a contrastive learning strategy under self-supervised learning, and the specific steps are as follows:

[0026] Step A21: the feature enhancement module acquires m unlabeled gas samples, and the first enhancement unit in the feature enhancement module performs a feature enhancement operation on the unlabeled gas samples, and outputs a first enhanced sample set to the encoder;

[0027] The second enhancement unit in the feature enhancement module performs a feature enhancement operation on the unlabeled gas sample set, and outputs a second enhanced sample set to the momentum encoder;

[0028] Step A22: the encoder performs a feature extraction operation on the first enhanced sample set to obtain a first feature vector set, and transmits the first feature vector set to a graph construction module;

[0029] The momentum encoder performs a feature extraction operation on the second enhanced sample set to obtain a second feature vector set, and transmits the second feature vector set to a graph construction module;

[0030] Step A23: the graph construction module constructs the first feature vector set and the second feature vector set into a fully connected graph, initializes the node features and edge features in the fully connected graph, and then passes the initialized feature graph to the graph update module;

[0031] Step A24: the graph updating module performs iterative operations of node feature updating and edge feature updating on the initialized feature graph, and after performing L iterative operations, outputs the clustering feature graph to the classification recognition module;

[0032] Step A25: the classification and recognition module classifies and recognizes the cluster feature graph, and calculates the model loss according to the classification and recognition result;

[0033] Step A26: updating encoder parameters and graph update module parameters according to the model loss loss, and then updating momentum encoder parameters according to the encoder parameters;

[0034] Step A27: Repeat steps A21-A26 to obtain the optimal graph neural network training model, retain the momentum encoder, graph construction module and graph update module, as well as the optimal parameters of each module, and obtain a graph neural network based on contrastive learning and edge labeling framework.

[0035] The optimal parameters are: during the training process, when the calculated model loss is less than the loss threshold, the parameters used by the model. Under this parameter condition, the model can achieve accurate classification of gas samples and the model performance is excellent.

[0036] Through the above design, unsupervised training of the graph neural network training model is achieved, significantly reducing the model's dependence on a large number of labeled samples.

[0037] Preferably, in step A21, the first enhancement unit performs a feature enhancement operation on the unlabeled gas sample using a feature zeroing enhancement method. The feature zeroing enhancement method is: for a given sample x i , where each feature x i,j , the probability of p1 is set to 0, and the expression is as follows:

[0038]

[0039] Among them, x′ i,j Represents sample x i After the enhancement, the j-th feature, x i,j Represents sample x i The jth feature of

[0040] The second enhancement unit performs a feature enhancement operation on the unlabeled gas sample using an additive Gaussian perturbation enhancement method. The additive Gaussian perturbation enhancement method is to perform a feature enhancement operation on the unlabeled gas sample for a given sample x. i , each eigenvalue x i,j It will be multiplied by a number drawn from a Gaussian distribution with mean 1 and variance p2, expressed as follows:

[0041] x′ i,j =x i,j (1+N(0, p2))

[0042] Among them, N(0, p2) represents a random number drawn from a normal distribution with a mean of 0 and a variance of p2.

[0043] Sample x i Get new samples through data enhancement method and After that, the new sample is passed through encoder E1 and momentum encoder E2 to obtain the feature vector and

[0044] For the sample x i , using two different data enhancement methods to enhance and obtain two new samples and The two enhanced samples are regarded as one category, and the two enhanced samples and the samples enhanced by other samples are regarded as different categories. In this way, a series of positive and negative sample pairs can be obtained.

[0045] In contrastive learning, in this way, the model is trained to recognize and distinguish subtle differences between different samples. Specifically, for each sample x i , enhanced samples generated by data augmentation methods A and B and are considered as positive sample pairs because they come from the same original sample. Other samples are generated after data augmentation, such as and (where j≠k), they are considered as negative sample pairs because they come from different original samples.

[0046] Preferably, in step A22, the encoder and the momentum encoder have the same structure and the same initial parameters;

[0047] In the step A26, the encoder parameters are fully updated according to the model loss, and the momentum encoder parameters are partially updated according to the encoder parameters.

[0048] The core idea of ​​the momentum encoder is to use a momentum updated encoder. The parameters of the momentum encoder are updated by the parameters of the network with a smaller momentum coefficient. After the encoder parameter update is completed, the parameters of the momentum encoder are updated again. The momentum encoder parameter update expression is as follows:

[0049]

[0050] in, represents the momentum encoder parameters updated in the t+1th training, represents the momentum encoder parameters updated for the tth training, represents the encoder parameters updated in the t+1th training, represents the encoder parameters updated during the t-th training, and u represents the momentum coefficient.

[0051] Preferably, in step B4, the momentum encoder performs a feature extraction operation on the query set sample a2 or the support set sample, the steps are as follows:

[0052] Step B41: the spatial attention layer in the momentum encoder obtains the query set sample a2 or the support set sample, performs a spatial feature extraction operation on it, obtains the spatial feature data s1, and passes it to the first batch of normalization layers;

[0053] Step B42: the first batch normalization layer performs a batch normalization operation on the spatial feature data s1 to obtain a first batch of normalized data s2, and passes it to the first residual block;

[0054] Step B43: the first residual block performs a residual convolution operation on the first batch of normalized data s2 to obtain first residual data s3, and passes it to the second batch of normalized layers;

[0055] Step B44: the second batch normalization layer performs a batch normalization operation on the first residual data s3 to obtain a second batch of normalized data s4, and passes it to the second residual block;

[0056] Step B45: The second residual block performs a residual convolution operation on the second batch of normalized data s4 to obtain a query set feature vector c or a support set feature vector, and passes it to the encoding unit.

[0057] The momentum encoder is used to extract abstract features of the input data for use by the graph neural network CEGNNDrift based on contrastive learning and edge labeling framework, thereby improving the efficiency of gas classification.

[0058] The momentum encoder can not only extract deep features of samples, but also enhance the learning ability and stability of the model through spatial attention mechanism SAM and residual connection.

[0059] Preferably, in step B41, the spatial attention layer performs a spatial feature extraction operation on the query set sample a2 or the support set sample, and the steps are as follows:

[0060] Step B411: Get a one-dimensional feature map: Assume that the input data X∈R of the spatial attention layer C×W , where C and W represent the number of channels and channel width of the input data respectively; by performing average pooling and maximum pooling on the input data X, the average pooling feature map and the maximum pooling feature map are obtained, and the expressions are as follows:

[0061] F avg ∈R 1×W

[0062] F max ∈R 1×W

[0063] Among them, F avg represents the average value of the average pooling feature map in the channel dimension, F max Represents the maximum value of the maximum pooling feature map in the channel dimension;

[0064] Step B412: Feature map concatenation: concatenate the average pooled feature map F avg And the maximum pooling feature map F max Splice in the channel dimension to get the spliced ​​feature map F concat ∈R 2×W ;

[0065] Step B413: Get the spatial attention map: for the concatenated feature map F concat Perform a one-dimensional convolution operation and obtain the spatial attention map M through the sigmoid activation function s ∈R2×W , the expression is as follows:

[0066] M s =σ(Conv(F concat ))

[0067] Among them, σ represents the Sigmoid function, Conv represents one-dimensional convolution, and the one-dimensional convolution operation expression is as follows:

[0068]

[0069] Among them, y t is the value of the output feature vector at position t, x i is the value of the input feature vector at position i, w i,t-i is the weight of the convolution kernel at position i, b t is the bias term.

[0070] Step B414: Attention weighting: The original input feature map X is combined with the spatial attention map M s Multiply them together to get the weighted output feature map X′:

[0071]

[0072] in, Represents an element-wise multiplication operation.

[0073] The spatial attention mechanism SAM in the spatial attention layer is used to improve the recognition and response capabilities of the graph neural network CEGNNDrift based on contrastive learning and edge labeling framework to key spatial region features in the input data, so that CEGNNDrift can dynamically focus on processing the most critical part of the data for the current task, thereby significantly improving processing efficiency and accuracy. Through the spatial attention mechanism, CEGNNDrift can not only better capture the essential characteristics of the data, but also optimize at the feature representation level, thereby enhancing the performance of subsequent tasks such as classification, detection or segmentation.

[0074] The spatial attention mechanism SAM has several significant advantages: First, it improves the model's focus, allowing the model to concentrate resources on processing the most critical features in the data, thereby reducing the computational waste on unimportant areas. Second, SAM enhances feature expression, and by highlighting important spatial features, it helps to generate richer and more discriminative feature representations, which is crucial for improving the performance of the model on complex tasks. In addition, SAM is highly adaptable, enabling the model to adaptively adjust its focus and effectively process data under different categories or conditions. SAM also has the convenience of end-to-end learning and can be easily integrated into existing deep learning frameworks. Its generalization ability is also enhanced because the model can focus on key information in the data, thereby performing well on unseen data. In terms of computational efficiency, SAM can increase the computational speed of the model in some cases by reducing the processing of unimportant areas. Finally, the concept of SAM is intuitive, the implementation is simple, and it can be easily implemented and applied through existing deep learning libraries. These advantages make SAM a powerful tool for deep learning models to process complex spatial data.

[0075] The spatial attention mechanism SAM is introduced before the convolutional layer, which significantly improves the performance of the feature extraction module by enhancing the ability to focus on key information in the input feature space.

[0076] Preferably, the first residual block and the second residual block have the same structure, and are both provided with a weight layer and an identity layer connected in parallel, wherein the weight layer is composed of five one-dimensional convolutional layers connected end to end in sequence, and the identity layer is composed of one residual-connected one-dimensional convolutional layer;

[0077] Among them, the expression of the first residual block or the second residual block is as follows:

[0078] x n+1 =F(x n ,{w n,m ))+Conv n (x n ,{w′ n,m})

[0079] Among them, x n is the input feature, in the first residual block x n is the first batch of normalized data s2, in the second residual block x n is the second batch of normalized data s4; x n+1 is the output feature, in the first residual block x n+1 is the first residual data s3, and in the second residual block x n is the query set feature vector c or the support set feature vector; n represents the sequence number of the residual layer; F(x n ,{w n,m)) is the residual function of the weight layer, which means that the input x n The result after the weight layer transformation; Conv n (x n ,{w′ n,m}) indicates input x n The result after the identity layer transformation; {w n,m} is the weight set of the nth residual block, w′ n,m is the identity layer parameter.

[0080] The convolutional layer in the residual block contains multiple convolution kernels W, each of which is responsible for extracting a specific type of local features of the input data.

[0081] In each residual block, the stacking of one-dimensional convolutional layers allows the model to learn local features of different scales. The first convolutional layer is responsible for capturing the most basic local features, while subsequent convolutional layers are able to capture more complex patterns. This stacking method not only increases the learning ability of the model, but also maintains the stability of the network through residual connections.

[0082] Preferably, in step B5, each node in the fully connected graph a4 represents a feature vector, and each edge represents the type of relationship between two nodes; the node feature initialization expression is as follows:

[0083]

[0084] in, represents the i-th initial node feature, E(x i ) represents the i-th input sample x i Extracted feature vectors;

[0085] The edge feature initialization expression is as follows:

[0086]

[0087] Among them, y i represents the i-th node label, y j represents the jth node label, y ij represents the edge feature label between nodes i and j, represents the initial edge feature between nodes i and j, each edge feature is a two-dimensional vector, when d=1, e ij1 Indicates the strength of the inter-class relationship between two connected nodes. When d = 2, e ij2 Indicates the strength of the intra-class relationship between two connected nodes; || is the aggregation of intra-class and inter-class relationships; label indicates the label, and NULL indicates that the sample does not contain a label.

[0088] Only the labels of the edges between labeled samples in the support set can be directly initialized to [1||0]. The labels of the edges related to the unlabeled samples in the support set or the samples in the query set are set to [0.5||0.5], indicating that the relationship between the vertices connected by the edge is unknown.

[0089] The edge feature initialization expression in the model training step is as follows:

[0090]

[0091] Preferably, in step B6, the graph update module is provided with L layers of graph neural networks, each layer of the graph neural network is provided with a node feature update unit, a similarity calculation unit and an edge feature update unit, and each layer of the graph neural network performs an iterative operation of node feature update and edge feature update once;

[0092] The graph updating module performs iterative operations of updating node features and edge features on the initialized feature graph a5, and the steps are as follows:

[0093] Step B61: the node feature updating unit in the graph updating module performs a node feature updating operation on the initialization feature graph a5 to obtain a node update feature graph, and transmits the node update feature graph to the similarity calculation unit and the edge feature updating unit;

[0094] The node feature update expression is as follows:

[0095]

[0096] in, represents the normalized edge feature, represents the sum of all edges connected to node i, and k represents the index of all other nodes directly connected to node i; represents the node change network, represents the network parameters of node changes, l represents the lth layer of graph neural network, 1≤l≤L;

[0097] In each layer of graph neural network, node features Updated by aggregating the features of neighboring nodes. This process takes into account the edge features. As weights, similar to the attention mechanism.

[0098] Step B62: the similarity calculation unit calculates the similarity between every two nodes in the node update feature graph through the metric network, and transmits the calculated similarity to the edge feature update unit;

[0099] The similarity calculation expression between every two nodes is as follows:

[0100]

[0101] in, represents the similarity of the intra-class relationship between nodes i and j, represents the similarity of the inter-class relationship between nodes i and j, represents the metric network, represents the parameters of the metric network;

[0102] Step B63: the edge feature updating unit performs an edge feature updating operation on the node update feature graph according to the similarity, obtains an edge update feature graph and passes it to the next layer of graph feature network for iterative operation;

[0103] The edge feature update expression is as follows:

[0104]

[0105] in, The edge feature vector between nodes i and j; represents the unnormalized edge feature vector calculated based on the node feature update; express The L1 norm of , which is the sum of the absolute values ​​of all elements in the vector;

[0106] Step B64: When the number of iterations is equal to L, the edge feature update unit in the L-th layer graph neural network outputs the cluster feature map a6 to the classification recognition module.

[0107] Through the above design, the graph structure information of the data is utilized to explicitly perform clustering by iteratively updating node and edge features, thereby improving the performance of small sample learning tasks.

[0108] Preferably, in step B7, the classification recognition module extracts the similarity data between the query set sample nodes and each support set sample node in the cluster feature graph a6, and calculates the average similarity between the query set samples and each type of support set samples, and then takes the gas category corresponding to the support set sample with the largest average similarity as the gas classification result.

[0109] Each gas category corresponds to multiple support set samples. The similarity data between the support set samples of the same gas category and the query set samples are not the same. Therefore, the average similarity between the query set samples and each type of support set samples is calculated, and then the gas category corresponding to the support set sample with the largest average similarity value is taken as the gas classification result of the query set samples.

[0110] Through the above design, the accuracy of gas classification results is effectively improved.

[0111] Beneficial effects of the invention: The invention introduces the idea of ​​contrastive learning into the CEGNNDrift model, which not only significantly improves the model performance, but more importantly, it allows the model to be trained not only in a supervised setting, but also in an unsupervised setting. This unsupervised training capability significantly reduces the model's reliance on a large number of labeled samples, thereby providing a more efficient and practical solution in situations where data acquisition costs are high or labeled information is limited. BRIEF DESCRIPTION OF THE DRAWINGS

[0112] Figure 1 It is a schematic diagram of the process of the present invention;

[0113] Figure 2 This is a schematic diagram of the structure of the neural network training model in Example 1;

[0114] Figure 3 Schematic diagram of the graph neural network structure based on contrastive learning and edge labeling framework in Example 1;

[0115] Figure 4 This is a schematic diagram of the structure of the image update module in Example 1;

[0116] Figure 5 Schematic diagram of the momentum encoder structure in Example 1;

[0117] Figure 6 Schematic diagram of the calculation steps of the spatial attention mechanism in Example 1;

[0118] Figure 7 This is a schematic diagram of the Senet architecture in Example 1;

[0119] Figure 8 is the accuracy of each algorithm in Example 2 when the categories are symmetric;

[0120] Fig. 9 This is a test accuracy diagram of each algorithm in Example 2 when the categories are asymmetric. DETAILED DESCRIPTION

[0121] The present invention is further described in detail below in conjunction with the accompanying drawings and specific examples. The following examples or drawings are used to illustrate the present invention, but are not used to limit the scope of the present invention.

[0122] Embodiment 1:

[0123] like Figure 1-3 As shown: A gas classification and recognition method based on a graph neural network based on contrastive learning and edge labeling framework, including a model training step A and a gas classification and recognition step B;

[0124] Wherein, the model training step A includes the following steps:

[0125] Step A1: construct a graph neural network training model, wherein the graph neural network training model is provided with a feature enhancement module, an encoder, a momentum encoder, a graph construction module and a graph update module;

[0126] The feature enhancement module is connected to the encoder and the momentum encoder, the encoder and the momentum encoder are connected to the graph construction module, and the graph construction module is connected to the graph update module;

[0127] Step A2: adopting a contrastive learning strategy under self-supervised learning to train the graph neural network training model. After the training is completed, retain the momentum encoder, the graph construction module and the graph update module, the momentum encoder is connected to the graph construction module, and the graph construction module is connected to the graph update module, thereby obtaining a graph neural network based on contrastive learning and edge labeling framework;

[0128] The gas classification identification step B comprises the following steps:

[0129] Step B1: The gas sensor array collects gas characteristic data a1 in real time, and transmits the gas characteristic data a1 to a preprocessing module;

[0130] Step B2: the preprocessing module performs a preprocessing operation on the gas characteristic data a1 to obtain a query set sample a2, and passes it to the graph neural network;

[0131] Step B3: The input layer of the graph neural network inputs the query set sample a2 and N types of support set samples into the momentum encoder, and each type of support set sample contains R samples;

[0132] Step B4: the momentum encoder performs feature extraction operations on the query set sample a2 and the N-type support set samples respectively to obtain the query set feature vector a3 and the N-type support set feature vector, and pass them to the graph construction module;

[0133] Step B5: the graph construction module constructs the query set feature vector a3 and the N-type support set feature vectors into a fully connected graph a4, and initializes the node features and edge features in the fully connected graph a4 to obtain an initialized feature graph a5 and pass it to the graph update module;

[0134] Step B6: the graph updating module performs iterative operations of node feature updating and edge feature updating on the initialization feature graph a5, and after performing L iterative operations, outputs the clustering feature graph a6 to the classification and recognition module;

[0135] Step B7: The classification and recognition module classifies and recognizes the cluster feature graph a6 and outputs a gas classification result.

[0136] In step A2, the graph neural network training model is trained using a contrastive learning strategy under self-supervised learning, and the specific steps are as follows:

[0137] Step A21: the feature enhancement module acquires m unlabeled gas samples, and the first enhancement unit in the feature enhancement module performs a feature enhancement operation on the unlabeled gas samples, and outputs a first enhanced sample set to the encoder;

[0138] The second enhancement unit in the feature enhancement module performs a feature enhancement operation on the unlabeled gas sample set, and outputs a second enhanced sample set to the momentum encoder;

[0139] Step A22: the encoder performs a feature extraction operation on the first enhanced sample set to obtain a first feature vector set, and transmits the first feature vector set to a graph construction module;

[0140] The momentum encoder performs a feature extraction operation on the second enhanced sample set to obtain a second feature vector set, and transmits the second feature vector set to a graph construction module;

[0141] Step A23: the graph construction module constructs the first feature vector set and the second feature vector set into a fully connected graph, initializes the node features and edge features in the fully connected graph, and then passes the initialized feature graph to the graph update module;

[0142] Step A24: the graph updating module performs iterative operations of node feature updating and edge feature updating on the initialized feature graph, and after performing L iterative operations, outputs the clustering feature graph to the classification recognition module;

[0143] Step A25: the classification and recognition module classifies and recognizes the cluster feature graph, and calculates the model loss according to the classification and recognition result;

[0144] Step A26: updating encoder parameters and graph update module parameters according to the model loss loss, and then updating momentum encoder parameters according to the encoder parameters;

[0145] Step A27: Repeat steps A21-A26 to obtain the optimal graph neural network training model, retain the momentum encoder, graph construction module and graph update module, as well as the optimal parameters of each module, and obtain a graph neural network based on contrastive learning and edge labeling framework.

[0146] In the step A21, the first enhancement unit performs a feature enhancement operation on the unlabeled gas sample using a feature zeroing enhancement method. The feature zeroing enhancement method is to perform a feature enhancement operation on the unlabeled gas sample for a given sample x. i , where each feature x i,j , the probability of p1 is set to 0, and the expression is as follows:

[0147]

[0148] Among them, x′ i,j Represents sample x i After the enhancement, the j-th feature, x i,j Represents sample x i The jth feature of

[0149] The second enhancement unit performs a feature enhancement operation on the unlabeled gas sample using an additive Gaussian perturbation enhancement method. The additive Gaussian perturbation enhancement method is to perform a feature enhancement operation on the unlabeled gas sample for a given sample x. i , each eigenvalue x i,j It will be multiplied by a number drawn from a Gaussian distribution with mean 1 and variance p2, expressed as follows:

[0150] x′ i,j =x i,j (1+N(0, p2))

[0151] Among them, N(0, p2) represents a random number drawn from a normal distribution with a mean of 0 and a variance of p2.

[0152] The graph neural network training model provided by the present invention not only allows the model to be trained in a supervised setting, but also allows it to be trained in an unsupervised setting.

[0153] The supervised training process can be described as follows:

[0154] (1) During each round of training, a batch of samples is collected from the source domain based on the N-way K-shot paradigm for training. After the batch of samples is expanded in categories, each sample x i By performing data enhancement in different ways, two enhanced samples are obtained and

[0155] (2) Enhance the sample and Input encoder E1 and momentum encoder E2 respectively to get the corresponding feature vector and

[0156] (3) Initialize vertices and edges. Set the edges between any two different nodes as unknown edges. Input the graph neural network, predict the unknown edges, and calculate the model loss. It should be noted that when calculating the loss, samples obtained by enhancing samples of the same type should be considered as the same class, otherwise they should be considered as different classes.

[0157] (4) Use the model loss to update the encoder E1 and the graph neural network, and use the parameters of the encoder E1 to update the momentum encoder E2.

[0158] Its unsupervised training process can be described as follows:

[0159] (1) During each round of training, a batch of samples is collected from the source domain for training. This batch of samples does not need to be expanded. Each sample x i By performing data enhancement in different ways, two enhanced samples are obtained and

[0160] (2) Enhance the sample and Input encoder E1 and momentum encoder E2 respectively to get the corresponding feature vector and

[0161] (3) Initialize vertices and edges. Set the edges between any two different nodes as unknown edges. Input the graph neural network, predict the unknown edges, and calculate the model loss. It should be noted that when calculating the loss, the samples obtained by enhancing the same sample should be considered as the same class, otherwise they should be considered as different classes.

[0162] (4) Use the model loss to update the encoder E1 and the graph neural network, and use the parameters of the encoder E1 to update the momentum encoder E2.

[0163] The model training process based on contrastive learning is as follows:

[0164] For all samples x i Get new samples through data enhancement method and After that, the new sample is passed through encoder E1 and momentum encoder E2 to obtain the feature vector and

[0165] When using supervised training, for edge label setting, due to the contrastive learning strategy, the same category samples x are set i For samples obtained through data augmentation, the labels of the edges between corresponding nodes are 1, and the labels of all other edges are 0.

[0166] When using unsupervised learning for training, set the same sample x i For samples obtained through data augmentation, the labels of the edges between corresponding nodes are 1, and the labels of all other edges are 0.

[0167] For edge initialization, regardless of whether supervised learning is used for training, except for the labels between nodes themselves, which are set to [1||0], the relationships between other edges are invisible and are set to [0.5||0.5].

[0168] In the step A22, the encoder and the momentum encoder have the same structure and the same initial parameters;

[0169] In the step A26, the encoder parameters are fully updated according to the model loss, and the momentum encoder parameters are partially updated according to the encoder parameters.

[0170] like Figure 5 As shown: In step B4, the momentum encoder performs feature extraction operation on the query set sample a2 or the support set sample, the steps are as follows:

[0171] Step B41: the spatial attention layer in the momentum encoder obtains the query set sample a2 or the support set sample, performs a spatial feature extraction operation on it, obtains the spatial feature data s1, and passes it to the first batch of normalization layers;

[0172] Step B42: the first batch normalization layer performs a batch normalization operation on the spatial feature data s1 to obtain a first batch of normalized data s2, and passes it to the first residual block;

[0173] Step B43: the first residual block performs a residual convolution operation on the first batch of normalized data s2 to obtain first residual data s3, and passes it to the second batch of normalized layers;

[0174] Step B44: the second batch normalization layer performs a batch normalization operation on the first residual data s3 to obtain a second batch of normalized data s4, and passes it to the second residual block;

[0175] Step B45: The second residual block performs a residual convolution operation on the second batch of normalized data s4 to obtain a query set feature vector c or a support set feature vector, and passes it to the encoding unit.

[0176] like Figure 6 As shown: In step B41, the spatial attention layer performs a spatial feature extraction operation on the query set sample a2 or the support set sample, and the steps are as follows:

[0177] Step B411: Get a one-dimensional feature map: Assume that the input data X∈R of the spatial attention layer C×W , where C and W represent the number of channels and channel width of the input data respectively; by performing average pooling and maximum pooling on the input data X, the average pooling feature map and the maximum pooling feature map are obtained, and the expressions are as follows:

[0178] F avg ∈R 1×W

[0179] F max ∈R 1×W

[0180] Among them, F avg represents the average value of the average pooling feature map in the channel dimension, F max Represents the maximum value of the maximum pooling feature map in the channel dimension;

[0181] Step B412: Feature map concatenation: concatenate the average pooled feature map F avg And the maximum pooling feature map F max Splice in the channel dimension to get the spliced ​​feature map F concat ∈R 2×W ;

[0182] Step B413: Get the spatial attention map: for the concatenated feature map F concat Perform a one-dimensional convolution operation and obtain the spatial attention map M through the sigmoid activation function s ∈R 2×W , the expression is as follows:

[0183] M s =σ(Conv(F concat ))

[0184] Among them, σ represents the Sigmoid function, Conv represents one-dimensional convolution, and the one-dimensional convolution operation expression is as follows:

[0185]

[0186] Among them, y t is the value of the output feature vector at position t, x i is the value of the input feature vector at position i, w i,t-i is the weight of the convolution kernel at position i, b t is the bias term;

[0187] Step B414: Attention weighting: The original input feature map X is combined with the spatial attention map M s Multiply them together to get the weighted output feature map X′:

[0188]

[0189] in, Represents an element-wise multiplication operation.

[0190] When performing unsupervised learning, since the category expansion strategy is not applicable, the channel attention mechanism CAM can be used on the unperturbed dimensions. Specifically, SEnet (Squeeze-and-Excitation Networks) is added to model the relationship between sample channels.

[0191] SEnet is a method to implement the channel attention mechanism in deep convolutional neural networks (CNNs). The core idea is to improve the representation ability of the network by explicitly modeling the interdependence between convolutional feature channels. Its architecture is shown in Figure 7.

[0192] The basic idea is as follows:

[0193] (1) Compression: This step aggregates the values ​​of all elements in each channel into a single value through global average pooling. This allows the overall statistical information of each channel to be obtained without losing information within the channel. The formula is as follows:

[0194]

[0195] Among them, x represents the initial sample, z represents the sample after the initial sample x is compressed, dim_size represents the length of each dimension of the sample, i represents the i-th sample, and F sq Indicates a compression operation.

[0196] (2) Extraction: The compressed vector is passed through two fully connected layers to generate channel weights. In order to improve computational efficiency, a reduction factor ratio is set to reduce the number of neurons in the first layer to the original ReLU is used as a nonlinear function. The second layer retains the same number of neurons as the input and uses a sigmoid function to limit the weights between 0 and 1. These fully connected layers are parameterized by parameters w′1 and w′2.

[0197] s=F ex (z)=g(f(x,{w′1},{w′2}))

[0198] Among them, s represents the sample after the compressed sample z is extracted, g() and f() represent two fully connected layer operations, w′1 and w′2 represent the fully connected layer parameters, and F ex Represents a fetch operation.

[0199] (3) Reweighting: The importance score of each channel is derived from the Extract stage, and then the channels are reweighted using this score. This process involves multiplying each channel one by one by its corresponding importance score, resulting in a finely calibrated adjusted attention channel.

[0200]

[0201] in, represents the final sample matrix, whose shape is the same as the initial sample x; F sc Represents a weighting operation.

[0202] SEnet introduces a channel attention mechanism to explicitly model the interdependence between channels, and improves the representation ability and performance of the network by utilizing global information and adaptive recalibration. Although this model is usually used for tasks such as image recognition, due to the similarity between gas samples and image samples, we migrate it to the model to improve performance.

[0203] like Figure 5 As shown in the figure: the first residual block and the second residual block have the same structure, and both are provided with a weight layer and an identity layer connected in parallel, the weight layer is composed of 5 one-dimensional convolutional layers connected end to end in sequence, and the identity layer is composed of 1 residual-connected one-dimensional convolutional layer;

[0204] Among them, the expression of the first residual block or the second residual block is as follows:

[0205] x n+1 =F(x n ,{w n,m})+Conv n (x n ,{w′ n,m})

[0206] Among them, x n is the input feature, x n+1 is the output feature, n represents the serial number of the residual layer; F(x n ,{w n,m}) is the residual function of the weight layer, which represents the input x n The result after the weight layer transformation; Conv n (x n ,{w′ n,m}) indicates input x n The result after the identity layer transformation; {w n,m} is the weight set of the nth residual block, w′ n,m is the identity layer parameter.

[0207] like Figure 2 , Figure 4 As shown: In step B5, each node in the fully connected graph a4 represents a feature vector, and each edge represents the type of relationship between two nodes; the node feature initialization expression is as follows:

[0208]

[0209] in, represents the i-th initial node feature, E(x i ) represents the i-th input sample x i Extracted feature vectors;

[0210] The edge feature initialization expression is as follows:

[0211]

[0212] Among them, y i represents the i-th node label, y j represents the jth node label, y ij represents the edge feature label between nodes i and j, represents the initial edge feature between nodes i and j, each edge feature is a two-dimensional vector, when d=1, e ij1 Indicates the strength of the inter-class relationship between two connected nodes. When d = 2, e ij2 Indicates the strength of the intra-class relationship between two connected nodes; || is the aggregation of intra-class and inter-class relationships; label indicates the label, and NULL indicates that the sample does not contain a label.

[0213] In step B6, the graph update module is provided with L layers of graph neural networks, each layer of the graph neural network is provided with a node feature update unit, a similarity calculation unit and an edge feature update unit, and each layer of the graph neural network performs an iterative operation of node feature update and edge feature update once;

[0214] The graph updating module performs iterative operations of updating node features and edge features on the initialized feature graph a5, and the steps are as follows:

[0215] Step B61: the node feature updating unit in the graph updating module performs a node feature updating operation on the initialization feature graph a5 to obtain a node update feature graph, and transmits the node update feature graph to the similarity calculation unit and the edge feature updating unit;

[0216] The node feature update expression is as follows:

[0217]

[0218] in, represents the normalized edge feature, represents the sum of all edges connected to node i, and k represents the index of all other nodes directly connected to node i; represents the node change network, represents the network parameters of node changes, l represents the lth layer of graph neural network, 1≤l≤L;

[0219] Step B62: the similarity calculation unit calculates the similarity between every two nodes in the node update feature graph through the metric network, and transmits the calculated similarity to the edge feature update unit;

[0220] The similarity calculation expression between every two nodes is as follows:

[0221]

[0222] in, represents the similarity of the intra-class relationship between nodes i and j, represents the similarity of the inter-class relationship between nodes i and j, represents the metric network, represents the parameters of the metric network;

[0223] Step B63: the edge feature updating unit performs an edge feature updating operation on the node update feature graph according to the similarity, obtains an edge update feature graph and passes it to the next layer of graph feature network for iterative operation;

[0224] The edge feature update expression is as follows:

[0225]

[0226] in, The edge feature vector between nodes i and j; represents the unnormalized edge feature vector calculated based on the node feature update; express The L1 norm of , which is the sum of the absolute values ​​of all elements in the vector;

[0227] Step B64: When the number of iterations is equal to L, the edge feature update unit in the L-th layer graph neural network outputs the cluster feature map a6 to the classification recognition module.

[0228] In step B7, the classification recognition module extracts the similarity data between the query set sample nodes and each support set sample node in the cluster feature graph a6, and calculates the average similarity between the query set sample and each type of support set sample, and then takes the gas category corresponding to the support set sample with the largest average similarity as the gas classification result.

[0229] Embodiment 2:

[0230] Based on Example 1, Example 2 uses the "Gas Sensor Array Drift Dataset" in the UCI Machine Learning Library to verify the graph neural network gas classification and recognition method based on the node labeling framework. The data set includes 13,910 measurement data collected over a period of 36 months, using an advanced electronic nose system equipped with 16 sturdy metal oxide semiconductor gas sensors. These sensors are divided into four mini sensor arrays, each array containing four different models of sensors manufactured by Figaro, the four models are TGS2600, TGS2602, TGS2610 and TGS2620. The main goal is to detect and classify six volatile organic compounds: ammonia NH3, acetaldehyde C2H4O, acetone C3H6O, ethylene C2H4, ethanol C2H5OH and toluene C7H8. All data are divided into 10 batches according to the collection order. The collection cycle and number of measurements of each batch of data in the data set are shown in Table 1:

[0231] Table 1 Collection cycle and measurement times of each batch of data

[0232]

[0233] In order to construct multiple classification tasks, Example 2 adopts two experimental configurations to verify the algorithm performance of CEGNNDrift:

[0234] Experimental setting 1: The first batch is used as the source domain dataset for training, and the subsequent batches are used as the target domain dataset for performance evaluation, thus forming a series of 9 independent classification tasks. This setting is mainly to study the performance of the model under short-term drift and long-term drift.

[0235] Experimental setting 2: A sequential training strategy is adopted. For each batch T numbered from 2 to 10, the previous batch, batch T-1, is used as the source domain dataset for training, and the next batch, batch T, is used as the target domain dataset for testing. This setting also generates 9 corresponding classification tasks. This setting is mainly used to study the performance of the model under short-term drift.

[0236] Using these two experimental settings, we can more comprehensively test the model’s long-term drift, i.e., the time interval between the source domain and the target domain is long, and short-term drift, i.e., the time interval between the source domain and the target domain is short.

[0237] The matrix shape of the input momentum encoder E is [16, 8]. The momentum encoder converts this matrix into a matrix of shape [64, 2], and then flattens it into a vector of shape

[128] . This vector contains the deep features extracted by the momentum encoder, providing rich information for subsequent graph neural network processing.

[0238] CEGNNDrift uses binary cross entropy loss BCELoss as the loss function, which is calculated as follows:

[0239] BCELoss is particularly suitable for binary classification, that is, when there are only two output categories, such as 0 and 1, which usually represent "no" and "yes"; the output of the model is a probability value, indicating the probability of an event. BCELoss calculates the cross entropy between the model output probability and the true label (0 or 1).

[0240] The formula of the cross entropy loss function is defined as follows:

[0241]

[0242] Where N is the total number of samples. i is the true label of the i-th sample, 0 or 1; p i is the probability that the model predicts that the i-th sample is category 1, and log is the natural logarithm.

[0243] CEGNNDrift uses Adam as the optimizer, which is a gradient descent optimization algorithm used in deep learning. It combines the advantages of momentum and RMSprop. When the parameter θ is given, the gradient of t is g t , then the Adam optimizer update rule is as follows:

[0244] (1) Calculate the first-order moment momentum estimate:

[0245] m t =β1m t-1 +(1-β1)g t

[0246] Among them, m t is the first-order moment at the tth moment; β1 is the decay rate of the first-order moment, which is usually set to 0.9.

[0247] (2) Calculate the estimate of the variance of the second-order moment gradient:

[0248]

[0249] Among them, v t It is t The second-order moment of the moment; β2 is the decay rate of the second-order moment, which is usually set to 0.999.

[0250] (3) Calculate the adjusted values ​​of the first-order moment and the second-order moment:

[0251]

[0252] (4) Update parameters:

[0253]

[0254] Among them, θ t+1 is the parameter for the next moment, α is the learning rate; ε is a small constant used to prevent the denominator from being zero, usually set to 1e-8.

[0255] The Adam optimizer aims to adaptively adjust the learning rate of each parameter to improve training efficiency and model performance. The graph neural network training model proposed later also uses this optimizer for parameter updates.

[0256] Some important parameters of graph neural network are shown in Table 1.

[0257] This model uses accuracy as the evaluation indicator, which is the most common evaluation indicator in classification tasks and indicates the proportion of samples correctly predicted by the model.

[0258] N-way K-shot is a learning paradigm commonly used in small sample learning to divide the data set for training or testing tasks, where N is the number of task categories and K is the number of samples in each category. Since this model is unsupervised training, the samples during training are randomly selected instead of being divided using the N-way K-shot paradigm. The samples used during testing are divided using this paradigm.

[0259] Table 1

[0260]

[0261] Next, these seven models are used as comparison models to compare with GNNDrift, EGNNDrift, CEGNNDrift (S) and CEGNNDrift (U), where GNNDrift, EGNNDrift and CEGNNDrift (S) represent the graph neural network based on the node labeling framework, the graph neural network based on the edge labeling framework and the graph neural network based on the contrastive learning and edge labeling framework, which are trained based on supervised learning when there is one labeled sample for reference in each category (i.e., K = 1), and CEGNNDrift (U) represents the unsupervised learning model when there are five labeled samples for reference in each category (i.e., K = 5). Both EGNNDrift and CEGNNDrift use the conduction learning mechanism, and EGNNDrift does not use unlabeled samples to assist in training.

[0262] The seven models are support vector machine model SVM, principal component analysis model PCA, multi-constrained subspace projection MCSP, linear discriminant analysis model LDA, domain regularized component analysis model DRCA, domain-based subspace learning model DMDMR that considers maximizing label feature dependency and minimizing feature redundancy, and discriminant domain regularized component analysis model DDRCA.

[0263] For Experimental Setting 1 and Experimental Setting 2, 11 networks are tested to show the superiority of CEGNNDrift in long-distance drift and short-distance drift. At this time, the categories of the source domain and the target domain are the same, that is, the categories are symmetrical. The test results are plotted as a heat map as shown in Figure 8 As shown in the figure, "ab" means taking batch a as the source domain and batch b as the target domain, Avg represents the average accuracy of the model on each task, and U and S represent the CEGNNDrift models trained under unsupervised learning and supervised learning, respectively.

[0264] like Figure 8 As shown, the following conclusions can be drawn:

[0265] After evaluating the performance of short-term drift and long-term drift, it is found that all models show good performance when dealing with short-term drift, but the performance generally decreases in the case of long-term drift. In particular, the performance decrease is more significant in the 1-10 and 1-10 experimental settings. The model with the highest average precision (Avg) is CEGNNDrift (S), which reaches 84.96%. This model shows the best performance in almost all experiments, followed by EGNNDrift and EGNNDrift (U), which reach 80.54% and 80.33% respectively. Next are DDRCA, MCSP and GNNDrift, which reach 73.89%, 70.55% and 68.03% respectively. SVM, PCA, LDA, DRCA and DMDMR perform poorly, with average precision ranging from 40% to 70%. It can be seen that the three models we proposed, especially CEGNNDrift, have high stability and accuracy in this set of experimental settings, whether under supervised or unsupervised conditions.

[0266] In addition, we can see that different experimental settings have different effects on the models. For example, under the experimental settings of 1-4, 1-5, 1-7, and 1-8, most models perform better, but under the experimental settings of 1-6, 1-9, and 1-10, most models perform worse. This may be due to the influence of the characteristics of these experimental settings on the models.

[0267] In most experimental settings, the CEGNNDrift model achieved the highest average accuracy, and it was not trained with labeled samples, so it has a wider range of applicability than other models. The reasons for its high accuracy can be roughly summarized as follows:

[0268] ① Contrastive learning strategy: By introducing contrastive learning, the CEGN Drift model can be trained in an unsupervised setting. Contrastive learning provides training signals by distinguishing between positive sample pairs (similar views) and negative sample pairs (dissimilar views), which helps the model learn to distinguish subtle differences between different samples.

[0269] ② Proxy task individual discrimination: Individual discrimination, as a proxy task, prompts the model to regard each training data as a unique category, enhances the model's ability to recognize sample features, and ensures that the feature vectors of samples with consistent categories are closer.

[0270] ③Data enhancement strategy: CEGNNDrift adopts two data enhancement strategies - feature zeroing enhancement and additive Gaussian perturbation enhancement. These strategies increase the diversity of samples and force the model to learn more robust and generalized feature representations.

[0271] ④ Adjustment of graph neural network: Based on the data enhancement strategy, CEGNNDrift adjusted the graph neural network by setting edge labels to distinguish samples enhanced by the same feature vector from other samples, further improving the model's ability to recognize similar samples.

[0272] ⑤ Iterative update mechanism: During the training process of the CEGNNDrift model, both the feature vectors and edge labels are iteratively updated. This mechanism allows the model to gradually extract useful signals for sample classification in each round of iteration. The slow update of the momentum encoder enables the model to stably and consistently update the encoder parameters, thereby generating a more stable contrastive learning objective to improve the effect of representation learning.

[0273] ⑥ Generalization ability: When using unsupervised learning, CEGN Drift reduces the reliance on a large number of labeled samples, thus providing a more efficient and practical solution when the data acquisition cost is high or the labeled information is limited.

[0274] (1) The impact of category asymmetry on model performance:

[0275] The category asymmetry problem refers to the situation where the sample categories in the training set and the test set are inconsistent. The source domain dataset used here contains five gas samples: ammonia, acetaldehyde, acetone, ethylene, and ethanol, and the target domain dataset contains six gases: ammonia, acetaldehyde, acetone, ethylene, ethanol, and toluene.

[0276] In addition to the above 7 comparison models, a sensor drift compensation model specifically for category asymmetry is used - UDA-CA[. The UDA-CA model is an unsupervised domain adaptation method that aims to reduce the distribution difference between the source domain (labeled dataset) and the target domain (unlabeled dataset) through class-aware projection. This method is particularly suitable for situations where there is a significant distribution difference between the source domain and the target domain, while maintaining the category separability within the source domain. The core idea is to map the data of the source domain and the target domain to a common feature space through a projection matrix W, while minimizing the distribution difference between the source domain and the target domain and maintaining the category cohesion within the source domain.

[0277] When K = 1, the accuracy of the three models EGNNDrift, CEGNNDrift (S) and CEGNNDrift (U) in the asymmetric case is verified, and 8 comparison models are used for comparison. We plot the test results into a heat map, as shown in Fig. 9 shown.

[0278] The experimental results consistently show that both EGNNDrift and CEGNNDrift models have shown high accuracy in the case of asymmetric categories, showing their strong adaptability and robustness to inconsistent categories between training and test sets. This finding confirms the potential of these models in practical applications, especially in classification tasks when facing unknown categories.

[0279] Specifically, CEGNNDrift(S) is more efficient than EGNNDrift in most tasks under supervised training. The EGNNDrift model has proven its effectiveness in dealing with category asymmetry, and the CEGNNDrift model further enhances its performance. CEGNNDrift(U) also has excellent performance under unsupervised training.

[0280] (2) Explore the impact of K value on model efficiency:

[0281] In small sample learning, the size of the K value directly affects the difficulty of the model learning task. When the K value is large, it means that there are more samples in each category for training, which usually helps the model to better learn the characteristics of each category, thereby improving the classification accuracy. On the contrary, when the K value is small, that is, there are only a few samples in each category for training, the features learned by the model may not be enough to distinguish the categories, resulting in performance degradation.

[0282] Since the introduction of transfer learning mechanism may have the same effect as increasing the K value, as they both cause the model to process more samples at the same time, in the experiment to study the impact of K value on model performance, we chose not to use transfer learning mechanism to avoid the superposition of the two effects and interference with the experimental results.

[0283] The performance of the three CEGNNDrift models in experimental setting 1 is tested for the cases where K is 1, 2, 3, 4, and 5. For the CEGNNDrift model, no labeled data is required for training, but labeled samples in the target domain are required as a benchmark to determine the probability that the unknown category sample belongs to that category.

[0284] When supervised learning is used, the performance of CEGNNDrift is shown in Table 2.

[0285] Table 2

[0286]

[0287] The performance of CEGNNDrift in unsupervised learning is shown in Table 3.

[0288] Table 3

[0289]

[0290] For CEGNNDrft(S) and CEGNNDrft(U), ​​the efficiency of both models is at the lowest level when K=1. As K increases, the model efficiency increases, but the growth rate is more gradual as N increases. When K=1, that is, when only one sample per category is used for training, the efficiency of all models is at a low level. This finding is not surprising, because in small-sample learning, it is difficult for models to learn feature representations with strong generalization ability due to the lack of sufficient data to capture the diversity and complexity of the data. However, as the value of K increases, that is, the number of training samples increases, the efficiency of all models is observed to improve. This trend indicates that more training data provides the model with richer information, enabling it to better understand and simulate the inherent laws of sensor drift. This improvement is particularly significant in the early stage, indicating that in small-sample learning, even a small increase in samples can significantly improve the performance of the model.

[0291] As the value of K increases further, especially when K is large, the improvement in model efficiency begins to slow down. This may mean that the model has approached the upper limit of its performance or is affected by overfitting to some extent. In addition, this may also indicate that there is an optimal number of training samples in small sample learning, and beyond this number, adding more samples has limited contribution to improving model performance.

[0292] (3) The impact of the conduction learning mechanism on CEGNNDrift

[0293] In order to deeply evaluate the role of the transduction mechanism in the CEGNNDrift model and its specific impact on the model performance, this embodiment designs a series of comparative experiments. In these experiments, the performance of the model with the transduction mechanism enabled and disabled is directly compared in terms of accuracy. Since semi-supervised learning and transduction learning mechanisms have similar effects, that is, both increase model performance through unlabeled samples, supervised learning is used instead of semi-supervised learning to train CEGNNDrift.

[0294] Through this method, we aim to reveal whether the conduction learning mechanism can significantly improve the classification efficiency of the model in small sample learning tasks. The experimental results will effectively explain how the conduction learning mechanism affects the model's ability to capture the similarities and differences between samples under different training and testing conditions, as well as the specific contribution of this mechanism to the accuracy and robustness of the final classification decision.

[0295] In addition, these comparative experiments will also verify the adaptability and effectiveness of the CEGNNDrift model for sensor drift compensation tasks under different configurations, thereby providing an experimental basis for model selection and optimization in practical applications.

[0296] For CEGNNDrift(S), K=1 is set, and for CEGNNDrift(U), ​​K=5 is set. The experimental results are shown in Table 4.

[0297] Table 4

[0298]

[0299] The introduction of the conduction learning mechanism significantly improves the classification efficiency of the three models. The experimental results clearly demonstrate the importance of conduction learning in small sample learning tasks, especially when there is only one support sample in each category. This mechanism enhances the model's understanding of the global structure of the data by considering the relationship between all test samples in the graph.

[0300] (4) Impact of category expansion strategy

[0301] In order to improve the category diversity of source domain data, a dimension expansion strategy is used for CEGNNDrift(S), which randomly shuffles the sensor channels to increase the number of sample categories, so that the model can be exposed to a wider range of data types, thereby improving its generalization ability. When verifying the effectiveness of this strategy, the performance of the CEGNNDrift(S) model without this strategy is compared with the model with this strategy. The case where there is only one support sample in each category (i.e., K=1) is selected, and the experimental setting 1 is used to perform the experiment, and EGNNDrift does not use unlabeled samples to assist training and testing. The experimental results are shown in Table 5. When it is necessary to note, CEGNNDrift(S) uses a conduction learning strategy.

[0302] The category expansion strategy plays a key role in improving the performance of the two models. Experimental results show that the model using this strategy has a significant improvement in accuracy, which indicates that by increasing the number of categories, the model can better generalize to unseen categories, thus showing better adaptability and robustness in practical applications.

[0303] Table 5

[0304]

[0305] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A gas classification and recognition method based on graph neural network based on contrastive learning and edge labeling framework, characterized in that: It includes a model training step A and a gas classification and recognition step B; Wherein, the model training step A includes the following steps: Step A1: construct a graph neural network training model, wherein the graph neural network training model is provided with a feature enhancement module, an encoder, a momentum encoder, a graph construction module and a graph update module; The feature enhancement module is connected to the encoder and the momentum encoder, the encoder and the momentum encoder are connected to the graph construction module, and the graph construction module is connected to the graph update module; Step A2: adopting a contrastive learning strategy under self-supervised learning to train the graph neural network training model. After the training is completed, retain the momentum encoder, the graph construction module and the graph update module, the momentum encoder is connected to the graph construction module, and the graph construction module is connected to the graph update module, thereby obtaining a graph neural network based on contrastive learning and edge labeling framework; The gas classification identification step B comprises the following steps: Step B1: The gas sensor array collects gas characteristic data a1 in real time, and transmits the gas characteristic data a1 to a preprocessing module; Step B2: the preprocessing module performs a preprocessing operation on the gas characteristic data a1 to obtain a query set sample a2, and passes it to the graph neural network; Step B3: The input layer of the graph neural network inputs the query set sample a2 and N types of support set samples into the momentum encoder, and each type of support set sample contains R samples; Step B4: the momentum encoder performs feature extraction operations on the query set sample a2 and the N-type support set samples respectively to obtain the query set feature vector a3 and the N-type support set feature vector, and pass them to the graph construction module; Step B5: the graph construction module constructs the query set feature vector a3 and the N-type support set feature vectors into a fully connected graph a4, and initializes the node features and edge features in the fully connected graph a4 to obtain an initialized feature graph a5 and pass it to the graph update module; Step B6: the graph updating module performs iterative operations of node feature updating and edge feature updating on the initialization feature graph a5, and after performing L iterative operations, outputs the clustering feature graph a6 to the classification and recognition module; Step B7: The classification and recognition module classifies and recognizes the cluster feature graph a6 and outputs a gas classification result.

2. The method for gas classification and recognition based on graph neural network based on contrastive learning and edge labeling framework according to claim 1 is characterized by: In step A2, the graph neural network training model is trained using a contrastive learning strategy under self-supervised learning, and the specific steps are as follows: Step A21: the feature enhancement module acquires m unlabeled gas samples, and the first enhancement unit in the feature enhancement module performs a feature enhancement operation on the unlabeled gas samples, and outputs a first enhanced sample set to the encoder; The second enhancement unit in the feature enhancement module performs a feature enhancement operation on the unlabeled gas sample set, and outputs a second enhanced sample set to the momentum encoder; Step A22: the encoder performs a feature extraction operation on the first enhanced sample set to obtain a first feature vector set, and transmits the first feature vector set to a graph construction module; The momentum encoder performs a feature extraction operation on the second enhanced sample set to obtain a second feature vector set, and transmits the second feature vector set to a graph construction module; Step A23: the graph construction module constructs the first feature vector set and the second feature vector set into a fully connected graph, initializes the node features and edge features in the fully connected graph, and then passes the initialized feature graph to the graph update module; Step A24: the graph updating module performs iterative operations of node feature updating and edge feature updating on the initialized feature graph, and after performing L iterative operations, outputs the clustering feature graph to the classification recognition module; Step A25: the classification and recognition module classifies and recognizes the cluster feature graph, and calculates the model loss according to the classification and recognition result; Step A26: updating encoder parameters and graph update module parameters according to the model loss loss, and then updating momentum encoder parameters according to the encoder parameters; Step A27: Repeat steps A21-A26 to obtain the optimal graph neural network training model, retain the momentum encoder, graph construction module and graph update module, as well as the optimal parameters of each module, and obtain a graph neural network based on contrastive learning and edge labeling framework.

3. The method for gas classification and recognition based on graph neural network based on contrastive learning and edge labeling framework according to claim 2 is characterized by: In the step A21, the first enhancement unit performs a feature enhancement operation on the unlabeled gas sample using a feature zeroing enhancement method. The feature zeroing enhancement method is to perform a feature enhancement operation on the unlabeled gas sample for a given sample x. i , where each feature x i,j , the probability of p1 is set to 0, and the expression is as follows: Among them, x′ i,j Represents sample x i After the enhancement, the j-th feature, x i,j Represents sample x i The jth feature of The second enhancement unit performs a feature enhancement operation on the unlabeled gas sample using an additive Gaussian perturbation enhancement method. The additive Gaussian perturbation enhancement method is to perform a feature enhancement operation on the unlabeled gas sample for a given sample x. i , each eigenvalue x i,j It will be multiplied by a number drawn from a Gaussian distribution with mean 1 and variance p2, expressed as follows: x′ i,j =x i,j ·(1+N(0,p2)) Among them, N(0,p2) represents a random number drawn from a normal distribution with mean 0 and variance p2.

4. The method for gas classification and recognition based on graph neural network based on contrastive learning and edge labeling framework according to claim 2 is characterized by: In the step A22, the encoder and the momentum encoder have the same structure and the same initial parameters; In the step A26, the encoder parameters are completely updated according to the model loss loss, and the momentum encoder parameters are partially updated according to the encoder parameters. The momentum encoder parameter update expression is as follows: in, represents the momentum encoder parameters updated in the t+1th training, represents the momentum encoder parameters updated for the tth training, represents the encoder parameters updated in the t+1th training, represents the encoder parameters updated during the t-th training, and u represents the momentum coefficient.

5. The method for gas classification and recognition based on graph neural network based on contrastive learning and edge labeling framework according to claim 1 is characterized by: In step B4, the momentum encoder performs a feature extraction operation on the query set sample a2 or the support set sample, and the steps are as follows: Step B41: the spatial attention layer in the momentum encoder obtains the query set sample a2 or the support set sample, performs a spatial feature extraction operation on it, obtains the spatial feature data s1, and passes it to the first batch of normalization layers; Step B42: the first batch normalization layer performs a batch normalization operation on the spatial feature data s1 to obtain a first batch of normalized data s2, and passes it to the first residual block; Step B43: the first residual block performs a residual convolution operation on the first batch of normalized data s2 to obtain first residual data s3, and passes it to the second batch of normalized layers; Step B44: the second batch normalization layer performs a batch normalization operation on the first residual data s3 to obtain a second batch of normalized data s4, and passes it to the second residual block; Step B45: The second residual block performs a residual convolution operation on the second batch of normalized data s4 to obtain a query set feature vector c or a support set feature vector, and passes it to the encoding unit.

6. The method for gas classification and recognition based on graph neural network based on contrastive learning and edge labeling framework according to claim 5 is characterized by: In step B41, the spatial attention layer performs a spatial feature extraction operation on the query set sample a2 or the support set sample, and the steps are as follows: Step B411: Get a one-dimensional feature map: Assume that the input data X∈R of the spatial attention layer C×W , where C and W represent the number of channels and channel width of the input data respectively; by performing average pooling and maximum pooling on the input data X, the average pooling feature map and the maximum pooling feature map are obtained, and the expressions are as follows: F avg ∈R 1×W F max ∈R 1×W Among them, F avg represents the average value of the average pooling feature map in the channel dimension, F max Represents the maximum value of the maximum pooling feature map in the channel dimension; Step B412: Feature map concatenation: concatenate the average pooled feature map F avg And the maximum pooling feature map F max Splice in the channel dimension to get the spliced ​​feature map F concat ∈R 2×W ; Step B413: Get the spatial attention map: for the concatenated feature map F concat Perform a one-dimensional convolution operation and obtain the spatial attention map M through the sigmoid activation function s ∈R 2×W , the expression is as follows: M s =σ(Conv(F concat )) Among them, σ represents the Sigmoid function, Conv represents one-dimensional convolution, and the one-dimensional convolution operation expression is as follows: Among them, y t is the value of the output eigenvector at position t, x i is the value of the input feature vector at position i, w i,t-i is the weight of the convolution kernel at position i, b t is the bias term; Step B414: Attention weighting: The original input feature map X is combined with the spatial attention map M s Multiply them together to get the weighted output feature map X′: in, Represents an element-wise multiplication operation.

7. The method for gas classification and recognition based on graph neural network based on contrastive learning and edge labeling framework according to claim 5 is characterized by: The first residual block and the second residual block have the same structure, and are both provided with a weight layer and an identity layer connected in parallel, wherein the weight layer is composed of five one-dimensional convolutional layers connected end to end in sequence, and the identity layer is composed of one one-dimensional convolutional layer connected by a residual; Among them, the expression of the first residual block or the second residual block is as follows: x n+1 =F(x n ,{w n,m })+Conv n (x n ,{w′ n,m }) Among them, x n is the input feature, x n+1 is the output feature, n represents the serial number of the residual layer; F(x n ,{w n,m }) is the residual function of the weight layer, which represents the input x n The result after the weight layer transformation; Conv n (x n ,{w′ n,m }) indicates input x n The result after the identity layer transformation; {w n,m } is the weight set of the nth residual block, w′ n,m is the identity layer parameter.

8. The method for gas classification and recognition based on graph neural network based on contrastive learning and edge labeling framework according to claim 1 is characterized by: In step B5, each node in the fully connected graph a4 represents a feature vector, and each edge represents the type of relationship between two nodes; the node feature initialization expression is as follows: in, represents the i-th initial node feature, E(x i ) represents the i-th input sample x i Extracted feature vectors; The edge feature initialization expression is as follows: Among them, y i represents the i-th node label, y j represents the jth node label, y ij represents the edge feature label between nodes i and j, represents the initial edge feature between nodes i and j, each edge feature is a two-dimensional vector, when d=1, e ij1 Indicates the strength of the inter-class relationship between two connected nodes. When d = 2, e ij2 Indicates the strength of the intra-class relationship between two connected nodes; || is the aggregation of intra-class and inter-class relationships; label indicates the label, and NULL indicates that the sample does not contain a label.

9. The method for gas classification and recognition based on graph neural network based on contrastive learning and edge labeling framework according to claim 1 is characterized by: In step B6, the graph update module is provided with L layers of graph neural networks, each layer of the graph neural network is provided with a node feature update unit, a similarity calculation unit and an edge feature update unit, and each layer of the graph neural network performs an iterative operation of node feature update and edge feature update once; The graph updating module performs iterative operations of updating node features and edge features on the initialized feature graph a5, and the steps are as follows: Step B61: the node feature updating unit in the graph updating module performs a node feature updating operation on the initialization feature graph a5 to obtain a node update feature graph, and transmits the node update feature graph to the similarity calculation unit and the edge feature updating unit; The node feature update expression is as follows: in, represents the normalized edge feature, represents the sum of all edges connected to node i, and k represents the index of all other nodes directly connected to node i; represents the node change network, represents the network parameters of node changes, l represents the lth layer of graph neural network, 1≤l≤L; Step B62: the similarity calculation unit calculates the similarity between every two nodes in the node update feature graph through the metric network, and transmits the calculated similarity to the edge feature update unit; The similarity calculation expression between every two nodes is as follows: in, represents the similarity of the intra-class relationship between nodes i and j, represents the similarity of the inter-class relationship between nodes i and j, represents the metric network, represents the parameters of the metric network; Step B63: the edge feature updating unit performs an edge feature updating operation on the node update feature graph according to the similarity, obtains an edge update feature graph and passes it to the next layer of graph feature network for iterative operation; The edge feature update expression is as follows: in, The edge feature vector between nodes i and j; represents the unnormalized edge feature vector calculated based on the node feature update; express The L1 norm of , which is the sum of the absolute values ​​of all elements in the vector; Step B64: When the number of iterations is equal to L, the edge feature update unit in the L-th layer graph neural network outputs the cluster feature map a6 to the classification recognition module.

10. The method for gas classification and recognition based on graph neural network based on contrastive learning and edge labeling framework according to claim 1, characterized in that: In step B7, the classification recognition module extracts the similarity data between the query set sample nodes and each support set sample node in the cluster feature graph a6, and calculates the average similarity between the query set sample and each type of support set sample, and then takes the gas category corresponding to the support set sample with the largest average similarity as the gas classification result.

Citation Information

Patent Citations

  • Gas contour identification method

    CN110889418A

  • Data path circuit design using reinforcement learning

    CN116070557A

  • Systems and methods for graph-based active learning using semi-supervised classification of SAR data

    WO2023193026A1

Cited By

  • Electronic nose cross-domain identification and drift compensation method based on contrast variation auto-encoder

    CN122241322A