Graph neural network gas classification and identification method based on node marking framework
Through the graph neural network method based on the node marking framework, the problem of low marking samples and accuracy in traditional gas classification methods is solved, and the accurate classification of gas samples under complex conditions is achieved, which improves the learning ability and stability of the model.
Patent Information
- Application Number
- CN202411219849.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2024-12-13
AI Technical Summary
Traditional gas classification methods require a large number of labeled samples and target domain samples when solving the problem of sensor drift compensation, and the classification accuracy is relatively low, making it difficult to maintain stability under complex conditions.
Using the graph neural network method based on the node marking framework, the graph neural network framework is constructed, the gas samples are represented as graph structures, the image structure information is captured using the message delivery mechanism, and the spatial attention mechanism and residual connection are introduced into the feature extraction module. , improve the learning ability and stability of the model, and achieve accurate classification of gas samples.
With a small number of labeled samples, the new gas categories can be accurately identified, which improves the efficiency and accuracy of gas classification, significantly reduces the computational waste of unimportant areas, and enhances the generalization ability and calculation speed of the model.
Smart Images

Figure CN119128720A_ABST
Abstract
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 a node 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 gas classification methods generally require a large number of labeled samples for training, a large number of target domain samples as references, and low gas classification accuracy in solving the sensor drift compensation problem. Summary of the invention
[0007] The present invention provides a graph neural network gas classification and recognition method based on a node labeling framework, which realizes accurate classification of gas samples.
[0008] To achieve the above object, the present invention provides a graph neural network gas classification and recognition method based on a node labeling framework, the key of which is to include the following steps:
[0009] Step 1: The gas sensor array collects gas characteristic data a in real time and transmits the gas characteristic data a to a preprocessing module;
[0010] Step 2: The preprocessing module performs a preprocessing operation on the gas characteristic data a to obtain a query set sample b, and passes it to the graph neural network GNNDrift based on the node labeling framework;
[0011] Step 3: The input layer of the graph neural network GNNDrift based on the node labeling framework inputs the query set sample b and N types of support set samples into the feature extraction module, and each type of support set sample contains R samples;
[0012] Step 4: The feature extraction module performs feature extraction operations on the query set sample b and the N-type support set samples respectively to obtain a query set feature vector c and an N-type support set feature vector, and pass them to the encoding unit;
[0013] Step 5: The encoding unit encodes the query set feature vector c and the N-type support set feature vector respectively through the corresponding one-hot vector to obtain the query set encoding vector d and the N-type support set encoding vector, and passes them to the graph neural network module;
[0014] Step 6: The graph neural network module classifies and identifies the query set encoding vector d according to the N types of support set encoding vectors, and outputs the gas classification result.
[0015] The support set samples are labeled gas samples of known categories, N types of support set samples correspond to N gas categories, and the query set samples are unlabeled gas samples to be classified.
[0016] Through the above design, the design of the feature extraction module and the graph neural network module enables the graph neural network GNNDrift based on the node labeling framework to process complex sensor data and accurately classify gas samples.
[0017] The graph neural network GNNDrift based on the node labeling framework constructs a framework based on the graph neural network to represent the input gas sample set as a graph, in which nodes represent images and edges represent the similarities between images, thereby realizing the inference of image categories.
[0018] The core mechanism of the graph neural network GNNDrift based on the node labeling framework is to utilize the message passing mechanism of the graph neural network to allow information exchange and feature aggregation between nodes (gas samples) to capture the structural information of the image collection and generalize it to the recognition of new gas categories when there are only a small number of labeled samples.
[0019] The preprocessing operation is to perform normalization and standardization on the input data to make it meet the input requirements of the graph neural network based on the node labeling framework.
[0020] The extracted deep features provide rich information for subsequent graph neural network processing.
[0021] Preferably, in step 4, the feature extraction module performs feature extraction operation on the query set sample b or the support set sample, and the steps are as follows:
[0022] Step A1: The spatial attention layer in the feature extraction module obtains the query set sample b or the support set sample, performs a spatial feature extraction operation on it, obtains spatial feature data s1, and passes it to the first batch of normalization layers;
[0023] Step A2: 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;
[0024] Step A3: 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;
[0025] Step A4: 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;
[0026] Step A5: 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.
[0027] The feature extraction module is used to extract abstract features of input data for use by the graph neural network GNNDrift based on the node labeling framework, thereby improving the efficiency of gas classification.
[0028] The feature extraction module can not only extract the deep features of the samples, but also enhance the learning ability and stability of the model through the spatial attention mechanism SAM and residual connection.
[0029] Preferably, in step A1, the spatial attention layer performs a spatial feature extraction operation on the query set sample b or the support set sample, and the steps are as follows:
[0030] Step B1: 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:
[0031] F avg ∈R 1×W
[0032] F max ∈R 1×W
[0033] 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;
[0034] Step B2: Feature map concatenation: 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 ;
[0035] Step B3: 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:
[0036] M s =σ(Con(F concat ))
[0037] Among them, σ represents the Sigmoid function, Conv represents one-dimensional convolution, and the one-dimensional convolution operation expression is as follows:
[0038]
[0039] 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, wi,t-i is the weight of the convolution kernel at position i, b t is the bias term.
[0040] Step B4: 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′:
[0041]
[0042] in, Represents an element-wise multiplication operation.
[0043] The spatial attention mechanism SAM in the spatial attention layer is used to improve the recognition and response capabilities of the graph neural network GNNDrift based on the node labeling framework to key spatial region features in the input data, so that GNNDrift 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, GNNDrift 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.
[0044] 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.
[0045] 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.
[0046] 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;
[0047] Among them, the expression of the first residual block or the second residual block is as follows:
[0048] x 1+1 =F(x l ,{w l,i})+Comv l (x l ,{w′ l,i})
[0049] Among them, x l is the input feature, in the first residual block x l is the first batch of normalized data s2, in the second residual block x l is the second batch of normalized data s4; x l+1 is the output feature, in the first residual block x l+1 is the first residual data s3, and in the second residual block x l is the query set feature vector c or the support set feature vector; l represents the serial number of the residual layer; F(x l ,{w l,i}) is the residual function of the weight layer, which represents the input x l The result after the weight layer transformation; Conv l (x l ,{w l,i}) indicates input x l The result after the identity layer transformation; {w l,i} is the weight set of the lth residual block, {w′ l,i} is the identity layer parameter;
[0050] 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.
[0051] 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.
[0052] Preferably, in step 5, the one-hot vector is a 1×N vector consisting of 0s and 1s, and the numbers on the N vector positions in the one-hot vector correspond to N gas categories.
[0053] One-hot vector is a common representation in machine learning and computer science to represent the encoding of categorical variables. In this representation, each possible value of a category is represented as a fixed-length binary vector with all positions zero except for one position that is 1 to represent the category.
[0054] The support set feature vector or query set feature vector c and the corresponding one-hot vector h(l i ) to obtain the node vector Its expression is as follows:
[0055]
[0056] Among them, C represents the feature vector E(x i ) and the one-hot vector h(l i ) are connected.
[0057] Preferably, in step 6, the graph neural network module performs graph connection on the input query set encoding vector d and the N types of support set encoding vectors to form a graph structure with the query set encoding vector d as a vertex, in which each encoding vector represents a node, and the edge weight between any two nodes represents the distance or similarity between the two encoding vectors.
[0058] The present invention adopts a densely connected graph, so every two input images are connected by an edge, and the adjacency matrix stores the weight value between any two nodes.
[0059] Preferably, the graph neural network module is provided with m graph convolution layers connected end to end in sequence, and the kth graph convolution layer performs the following operations on the graph structure or the output graph structure of the k-1th graph convolution layer:
[0060] First, the kth graph convolution layer calculates the weight value between any two nodes. The weight value calculation expression is as follows:
[0061]
[0062] Among them, φ θ (·) represents a multi-layer perceptron network, Represents the i-th node of the k-th layer network With the jth node The weight value between
[0063] When the absolute value difference between two nodes is input, the corresponding weight value is output:
[0064]
[0065] The calculated Each row of is subjected to Softmax normalization to ensure that the sum of the weights between each node and other nodes is 1, and then the adjacency matrix B is obtained;
[0066] The kth graph convolution layer is used to calculate the k+1th graph convolution layer. The calculation process is as follows:
[0067]
[0068] in represents the output node feature vector of the k-th graph convolutional layer, L represents the L-th element, and x (k) represents the input node feature vector of the k-th graph convolutional layer, ρ represents the nonlinear activation layer, and the Leaky ReLU function is used as the nonlinear activation layer; θ represents the learning parameter, Indicates the learning parameters related to the adjacency matrix B in the kth graph convolution layer, Gc represents a graph convolution operation, M represents the set of adjacency matrices B in the graph, d1…dk+1 represents the dimension of the output feature vector, and the accumulation symbol indicates that the adjacency matrix B can be calculated in a variety of ways and the results are accumulated. In this model, there are only two cases: the weight of the node with itself is 1, and the connection weight with other nodes is
[0069] parameter It is used to adjust the contribution of the adjacency matrix B to the input signal, thereby learning the relationship between nodes in the graph.
[0070] In graph neural networks, the learning of parameters θ is performed through the back-propagation algorithm, with the goal of minimizing the network's loss function. In this way, θ can capture the complex relationships between nodes in the graph and can be used for various graph-related tasks, such as node classification, graph classification, etc.
[0071] Preferably, in the one-hot vector corresponding to the support set feature vector, only one vector position has a number of 1, and the one-hot vector corresponding to the query set feature vector c is meaningless.
[0072] The one-hot encoding corresponding to the support set vector is used to represent the gas category to which the support set vector belongs. However, the gas category of the query set feature vector c is unknown, so the one-hot vector corresponding to the query set feature vector c is meaningless.
[0073] Preferably, the gas categories include but are not limited to ammonia, acetaldehyde, acetone, ethylene, ethanol and toluene.
[0074] The beneficial effects of the present invention include being able to process complex sensor data, solve sensor drift compensation problems, and achieve accurate classification of gas samples; and being able to be extended to the identification of new gas categories with only a small number of labeled samples. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] Figure 1 It is a schematic diagram of the process of the present invention;
[0076] Figure 2 It is a schematic diagram of the structure of the present invention in Example 1;
[0077] Figure 3 It is a schematic diagram of the structure of the graph neural network GNNDrift based on the node labeling framework in Example 1;
[0078] Figure 4 This is a schematic diagram of the structure of the feature extraction module in Example 1;
[0079] Figure 5 Schematic diagram of the calculation steps of the spatial attention mechanism in Example 1;
[0080] Figure 6 This is the structure diagram of the neural network module in Example 1;
[0081] Figure 7 This is a test result diagram of Experimental Setting 1 in Example 2;
[0082] Figure 8 This is a test result diagram of Experimental Setting 2 in Example 2. DETAILED DESCRIPTION
[0083] 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.
[0084] Embodiment 1:
[0085] like Figure 1-3 As shown: A method for gas classification and recognition based on a graph neural network with a node labeling framework, comprising the following steps:
[0086] Step 1: The gas sensor array collects gas characteristic data a in real time and transmits the gas characteristic data a to a preprocessing module;
[0087] Step 2: The preprocessing module performs a preprocessing operation on the gas characteristic data a to obtain a query set sample b, and passes it to the graph neural network GNNDrift based on the node labeling framework;
[0088] Step 3: The input layer of the graph neural network GNNDrift based on the node labeling framework inputs the query set sample b and N types of support set samples into the feature extraction module, and each type of support set sample contains R samples;
[0089] Step 4: The feature extraction module performs feature extraction operations on the query set sample b and the N-type support set samples respectively to obtain a query set feature vector c and an N-type support set feature vector, and pass them to the encoding unit;
[0090] Step 5: The encoding unit encodes the query set feature vector c and the N-type support set feature vector respectively through the corresponding one-hot vector to obtain the query set encoding vector d and the N-type support set encoding vector, and passes them to the graph neural network module;
[0091] Step 6: The graph neural network module classifies and identifies the query set encoding vector d according to the N types of support set encoding vectors, and outputs the gas classification result.
[0092] like Figure 4 As shown: In step 4, the feature extraction module performs feature extraction operation on the query set sample b or the support set sample, and the steps are as follows:
[0093] Step A1: The spatial attention layer in the feature extraction module obtains the query set sample b or the support set sample, performs a spatial feature extraction operation on it, obtains spatial feature data s1, and passes it to the first batch of normalization layers;
[0094] Step A2: 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;
[0095] Step A3: 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;
[0096] Step A4: 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;
[0097] Step A5: 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.
[0098] like Figure 5 As shown: In step A1, the spatial attention layer performs a spatial feature extraction operation on the query set sample b or the support set sample, and the steps are as follows:
[0099] Step B1: 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:
[0100] F avg ∈R 1×W
[0101] F max ∈R 1×W
[0102] 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;
[0103] Step B2: 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 ;
[0104] Step B3: 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:
[0105] M s =σ(Conv(F concat ))
[0106] Among them, σ represents the Sigmoid function, Conv represents one-dimensional convolution, and the one-dimensional convolution operation expression is as follows:
[0107]
[0108] 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;
[0109] Step B4: 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′:
[0110]
[0111] in, Represents an element-wise multiplication operation.
[0112] 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;
[0113] Among them, the expression of the first residual block or the second residual block is as follows:
[0114] x l+1 =F(x l ,{w l,i})+Conv l (x l ,{w′ l,i})
[0115] Among them, x l is the input feature, x l+1 is the output feature, l represents the serial number of the residual layer; F(x l ,{w l,i}) is the residual function of the weight layer, which represents the input x l The result after the weight layer transformation; Conv l (x l ,{w l,i}) indicates input x l The result after the identity layer transformation; {w l,i} is the weight set of the lth residual block, {w′ l,i} is the identity layer parameter.
[0116] In step 5, the one-hot vector is a 1×N vector composed of 0 and 1, and the numbers on the N vector positions in the one-hot vector correspond to N gas categories; in the one-hot vector corresponding to the support set feature vector, only one vector position has a number of 1, and the one-hot vector corresponding to the query set feature vector c is meaningless.
[0117] like Figure 6 As shown: In step 6, the graph neural network module connects the input query set encoding vector d and the N types of support set encoding vectors into a graph structure with the query set encoding vector d as the vertex. In the graph structure, each encoding vector represents a node, and the edge weight between any two nodes represents the distance or similarity between the two encoding vectors.
[0118] The graph neural network module is provided with m graph convolution layers connected end to end in sequence, and the kth graph convolution layer performs the following operations on the graph structure or the output graph structure of the k-1th graph convolution layer:
[0119] First, the kth graph convolution layer calculates the weight value between any two nodes. The weight value calculation expression is as follows:
[0120]
[0121] Among them, φ θ (·) represents a multi-layer perceptron network, Represents the i-th node of the k-th layer network With the jth node The weight value between ;
[0122] When the absolute value difference between two nodes is input, the corresponding weight value is output:
[0123]
[0124] The calculated Each row of is subjected to Softmax normalization to ensure that the sum of the weights between each node and other nodes is 1, and then the adjacency matrix B is obtained;
[0125] The kth graph convolution layer is used to calculate the k+1th graph convolution layer. The calculation process is as follows:
[0126]
[0127] in represents the output node feature vector of the k-th graph convolutional layer, L represents the L-th element, and x (k) represents the input node feature vector of the k-th graph convolutional layer, ρ represents the nonlinear activation layer, and the Leaky ReLU function is used as the nonlinear activation layer; θ represents the learning parameter, It represents the learning parameters related to the adjacency matrix B in the k-th graph convolution layer, Gc represents a layer of graph convolution operation, M represents the set of adjacency matrices B in the graph, and d1…dk+1 represents the dimension of the output feature vector.
[0128] Embodiment 2:
[0129] 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:
[0130] Table 1 Collection cycle and measurement times of each batch of data
[0131]
[0132] In order to construct multiple classification tasks, Example 2 adopts two experimental configurations to verify the algorithm performance of GNNDrift:
[0133] 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.
[0134] 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.
[0135] 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.
[0136] The matrix shape of the input feature extraction module E is [16,8]. The feature extraction module 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 feature extraction module, providing rich information for subsequent graph neural network processing.
[0137] GNNDrift uses the cross entropy function as the loss function, and its calculation formula is as follows:
[0138]
[0139] The cross entropy describes the distance between two probability distributions. As can be seen from the above formula, the closer q(x) and p(x) are, the smaller the cross entropy value and the smaller the relative entropy value.
[0140] GNNDrift 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 gradient of the given parameter θ, t is gt, the Adam optimizer update rule is as follows:
[0141] (1) Calculate the first-order moment momentum estimate:
[0142] m t =β1m t-1 +(1-β1)g t
[0143] 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.
[0144] (2) Calculate the estimate of the variance of the second-order moment gradient:
[0145]
[0146] 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.
[0147] (3) Calculate the adjusted values of the first-order moment and the second-order moment:
[0148]
[0149]
[0150] (4) Update parameters:
[0151]
[0152] 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.
[0153] The Adam optimizer aims to adaptively adjust the learning rate of each parameter to improve training efficiency and model performance. The graph neural network model proposed later also uses this optimizer for parameter updates.
[0154] Some important parameters of graph neural network are shown in Table 2:
[0155] Table 2 GNNDrift parameters
[0156]
[0157] GNNDrift uses accuracy as the evaluation metric, which is the most common evaluation metric in classification tasks and indicates the proportion of samples correctly predicted by the model.
[0158] 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 categories of the task and K is the number of samples in each category. GNNDrift uses this strategy to divide the source domain dataset into the target domain dataset to train the model.
[0159] Next, seven control models were used to conduct comparative experiments with GNNDrift, EGNNDrift, and CEGNNDrift. These 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; EGNNDrift represents a graph neural network based on an edge labeling framework, and CEGNNDrift represents a graph neural network based on contrastive learning and edge labeling frameworks.
[0160] The K values of the three models, GNNDrift, EGNNDrift, and CEGNNDrift, are all set to 1. Both EGNNDrift and CEGNNDrift use the conduction learning mechanism, and EGNNDrift does not use unlabeled samples to assist training.
[0161] For Experimental Setting 1 and Experimental Setting 2, 10 networks are tested respectively to show the superiority of GNNDrift in long-distance drift and short-distance drift problems. 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. The test results of Experimental Setting 1 are as follows: Figure 7 As shown, the test results of experimental setting 2 are as follows Figure 8 As shown in the figure, "ab" means batch a is used as the source domain, batch b is used as the target domain, and Avg represents the average accuracy of the model on each task.
[0162] like Figure 7 , Figure 8 As shown: The following conclusions can be drawn:
[0163] (1) 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 decreases more significantly in the experimental settings of 1-10 and 9-10. For experimental setting 1, the model with the highest average accuracy Avg is CEGNNDrift (K=1), which reaches 86.33%. This model shows the best performance in almost all experiments, followed by EGNNDrift (K=1), which reaches 80.54%. Next are DDRCA, MCSP and GNNDrift (K=1), which reach 73.89%, 70.55% and 68.03% respectively. SVM, PCA, LDA, DRCA and DMDMR perform poorly, with average accuracy between 40% and 70%. It can be seen that the three proposed models, especially CEGNNDrift, have high stability and accuracy in this set of experimental settings.
[0164] For the second set of experiments, the model with the highest average precision Avg is CEGNNDrift, which reaches 79.10%. It is followed by GNNDrift, EGNNDrift and DDRCA, which reach 78.18%, 75.50% and 71.73% respectively. The performance of the remaining models is poor, with an average precision below 70%. It can be seen that the three proposed models have high stability and accuracy under this set of experimental settings, and CEGNNDrift still maintains the highest performance.
[0165] In general, the GNNDrift, EGNNDrift, and CEGNNDrift models performed well in these two experimental settings, showing high stability and accuracy, while the SVM, PCA, LDA, and DRCA models performed poorly, which may be due to the fact that these models are not suitable for this experimental setting or the parameters of these models are not set properly.
[0166] 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.
[0167] The reasons why the long-term drift performance of most models is worse than the short-term drift can be roughly summarized as follows:
[0168] ① The speed of data distribution change: Short-term drift usually means that the change in data distribution is relatively small, and the model can easily capture these changes and adapt. Long-term drift involves a longer time span, and the data distribution may change more significantly, which makes it more difficult for the model to adapt.
[0169] ② Model adaptability: In the short term, the model may have learned enough features to distinguish different categories, so even if there is drift, the model can still classify well. However, in the case of long-term drift, the features learned by the model may no longer be effective because they may no longer represent the current data distribution.
[0170] ③ Representativeness of training data: In short-term drift, the training data is usually closer to the distribution of the test data, so the model can generalize better to the test data. In contrast, in long-term drift, the training data may no longer be representative, resulting in a decrease in the generalization ability of the model.
[0171] ④Stability of environmental factors: In the short term, environmental factors may be relatively stable, and the model can make effective predictions by learning these stable factors. In the long term, environmental factors may change, such as temperature and humidity, which may affect the performance of the sensor and thus affect the prediction accuracy of the model.
[0172] ⑤ Degradation of sensor materials: Long-term drift may be accompanied by physical degradation of sensor materials, which may lead to nonlinear changes in sensor response that are difficult to capture in models.
[0173] In the overall analysis, the three proposed models all demonstrated excellent performance in facing different drift compensation tasks, which is mainly due to the unique advantages and targeted designs of their respective algorithms.
[0174] (2) GNNDrift outperforms most of the comparison experiments in both long-term and short-term drift experiments, which is mainly due to the following reasons:
[0175] ① Representation ability of graph-structured data: The GNNDrift model effectively captures the similarities between samples by constructing graph-structured data, which provides the model with rich structural information and helps maintain classification performance in the case of long-term drift.
[0176] ②Message passing mechanism: The core mechanism of GNN is message passing, which allows the model to exchange information between nodes and achieve feature aggregation and generalization. In the case of long-term drift, this mechanism helps the model adapt to slow changes in data distribution.
[0177] ③Feature extraction module: The designed feature extraction module, including residual block and spatial attention mechanism (SAM), enhances the model’s ability to recognize key features and improves the expressiveness of features, which is especially important for long-term drift compensation.
[0178] ④Choice of optimization algorithm: The adaptive learning rate strategy of Adam optimizer helps the model to better adjust parameters in the face of long-term drift, thereby improving the adaptability and stability of the model.
[0179] ⑤ Generalization ability of the model: The GNNDrift model was designed with generalization ability in mind. Through a carefully designed architecture and training strategy, the model can also perform well on unseen data. In summary, the reason why the GNNDrift model performs well in long-term drift tasks is mainly due to its comprehensive advantages in graph structure data processing, feature extraction, message passing mechanism, and optimization algorithm selection. These advantages enable GNNDrift to effectively adapt to sensor drift and maintain the reliability and accuracy of the electronic nose system in a variety of application scenarios.
[0180] In the context of 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, only a few samples in each category can be used for training, the features learned by the model may not be enough to distinguish the categories, resulting in performance degradation.
[0181] Since the introduction of transfer learning mechanism may have a similar effect to increasing the K value, as they both cause the model to process more samples at the same time, we chose not to use the transfer learning mechanism in the experiment to study the impact of the K value on model performance, in order to avoid the superposition of the two effects and interference with the experimental results.
[0182] The performance of GNNDrift on experimental setting 1 is tested for the cases where K is 1, 2, 3, 4, and 5 respectively. The performance of GNNDrift is shown in Table 3:
[0183] Table 3 Performance changes of GNNDrift when K is different values
[0184]
[0185] It is obvious that for the GNNDrift model, the experimental accuracy does not increase significantly with the increase of K. This may be because the GNNDrift model is more adaptable to small sample learning, and can effectively capture and utilize the relationship and interaction between samples through its graph neural network structure even in the case of fewer samples, thereby achieving relatively stable performance.
[0186] 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 graph neural network gas classification and recognition method based on a node labeling framework, characterized in that: The following steps are involved: Step 1: The gas sensor array collects gas characteristic data a in real time and transmits the gas characteristic data a to a preprocessing module; Step 2: The preprocessing module performs a preprocessing operation on the gas characteristic data a to obtain a query set sample b, and passes it to the graph neural network GNNDrift based on the node labeling framework; Step 3: The input layer of the graph neural network GNNDrift based on the node labeling framework inputs the query set sample b and N types of support set samples into the feature extraction module, and each type of support set sample contains R samples; Step 4: The feature extraction module performs feature extraction operations on the query set sample b and the N-type support set samples respectively to obtain a query set feature vector c and an N-type support set feature vector, and pass them to the encoding unit; Step 5: The encoding unit encodes the query set feature vector c and the N-type support set feature vector respectively through the corresponding one-hot vector to obtain the query set encoding vector d and the N-type support set encoding vector, and passes them to the graph neural network module; Step 6: The graph neural network module classifies and identifies the query set encoding vector d according to the N types of support set encoding vectors, and outputs the gas classification result.
2. The method for gas classification and recognition based on a graph neural network with a node labeling framework according to claim 1 is characterized by: In step 4, the feature extraction module performs feature extraction operation on the query set sample b or the support set sample, and the steps are as follows: Step A1: The spatial attention layer in the feature extraction module obtains the query set sample b or the support set sample, performs a spatial feature extraction operation on it, obtains spatial feature data s1, and passes it to the first batch of normalization layers; Step A2: 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 A3: 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 A4: 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 A5: 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.
3. The method for gas classification and recognition based on a graph neural network with a node labeling framework according to claim 2 is characterized in that: In step A1, the spatial attention layer performs a spatial feature extraction operation on the query set sample b or the support set sample, and the steps are as follows: Step B1: 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 B2: Feature map concatenation: 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 B3: 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 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; Step B4: 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.
4. The method for gas classification and recognition based on a graph neural network with a node labeling framework according to claim 2 is characterized in that: 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 l+1 =F(x l ,{w l,i })+Conv l (x l ,{w′ l,i }) Among them, x l is the input feature, x l+1 is the output feature, l represents the serial number of the residual layer; F(x l ,{w l,i }) is the residual function of the weight layer, which represents the input x l The result after the weight layer transformation; Conv l (x l ,{w l,i }) indicates input x l The result after the identity layer transformation; {w l,i } is the weight set of the lth residual block, {w′ l,i } is the identity layer parameter.
5. The method for gas classification and recognition based on a graph neural network with a node labeling framework according to claim 1 is characterized in that: In step 5, the one-hot vector is a 1×N vector consisting of 0s and 1s, and the numbers on the N vector bits in the one-hot vector correspond to N gas categories.
6. The method for gas classification and recognition based on a graph neural network with a node labeling framework according to claim 1 is characterized in that: In step 6, the graph neural network module connects the input query set encoding vector d and the N types of support set encoding vectors into a graph structure with the query set encoding vector d as the vertex. In the graph structure, each encoding vector represents a node, and the edge weight between any two nodes represents the distance or similarity between the two encoding vectors.
7. The method for gas classification and recognition based on a graph neural network with a node labeling framework according to claim 6 is characterized by: The graph neural network module is provided with m graph convolution layers connected end to end in sequence, and the kth graph convolution layer performs the following operations on the graph structure or the output graph structure of the k-1th graph convolution layer: First, the kth graph convolution layer calculates the weight value between any two nodes. The weight value calculation expression is as follows: Among them, φ θ (·) represents a multi-layer perceptron network, Represents the i-th node of the k-th layer network With the jth node The weight value between ; When the absolute value difference between two nodes is input, the corresponding weight value is output: The calculated Each row of is subjected to Softmax normalization to ensure that the sum of the weights between each node and other nodes is 1, and then the adjacency matrix B is obtained; The kth graph convolution layer is used to calculate the k+1th graph convolution layer. The calculation process is as follows: in represents the output node feature vector of the k-th graph convolutional layer, L represents the L-th element, and x (k) represents the input node feature vector of the k-th graph convolutional layer, ρ represents the nonlinear activation layer, and the Leaky ReLU function is used as the nonlinear activation layer; θ represents the learning parameter, It represents the learning parameters related to the adjacency matrix B in the k-th graph convolution layer, Gc represents a layer of graph convolution operation, M represents the set of adjacency matrices B in the graph, and d1…dk+1 represents the dimension of the output feature vector.
8. The method for gas classification and recognition based on a graph neural network using a node labeling framework according to claim 5 is characterized by: In the one-hot vector corresponding to the support set feature vector, only one vector position has a number of 1, and the one-hot vector corresponding to the query set feature vector c is meaningless.
9. The method for gas classification and recognition based on a graph neural network using a node labeling framework according to claim 5 is characterized by: Such gas classes include, but are not limited to, ammonia, acetaldehyde, acetone, ethylene, ethanol, and toluene.
Citation Information
Cited By
Small sample HRRP identification method, device and equipment fused with Gramer angle field
CN120162659A
