A method and system for detecting VOCs, an electronic device and a storage medium

By constructing a knowledge graph and performing adaptive feature fusion, the problem of weak generalization ability of existing gas detection methods under sensor drift and cross-sensitivity is solved, and higher gas identification and concentration prediction accuracy is achieved.

CN122113019BActive Publication Date: 2026-07-17JIAXING YUANDONG PRECISE PRINTING CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JIAXING YUANDONG PRECISE PRINTING CO LTD
Filing Date
2026-04-29
Publication Date
2026-07-17

Smart Images

  • Figure CN122113019B_ABST
    Figure CN122113019B_ABST
Patent Text Reader

Abstract

This application discloses a method, system, electronic device, and storage medium for VOCs gas detection, relating to the field of gas detection technology. The method creates a key-value pair mapping list based on a knowledge source file, obtaining an initial feature matrix and adjacency matrix through the key-value pair mapping list; acquires the original data and adjacency matrix of the sensor array, and calculates a spatiotemporal fusion feature vector; calculates a knowledge feature matrix through a graph neural network model; adaptively fuses the spatiotemporal fusion feature vector and the knowledge feature matrix to obtain a fused feature vector; based on the fused feature vector, it outputs the gas type identification result and concentration prediction result of volatile organic compounds. This method solves the problem of weak model generalization ability and poor robustness in existing purely data-driven gas detection methods due to the lack of utilization of prior knowledge about the gas itself, significantly improving the accuracy of gas identification and concentration prediction, as well as the model adaptability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of gas detection technology, specifically to a gas detection method and system for VOCs, electronic equipment, and storage medium. Background Technology

[0002] This invention relates to the field of gas detection technology, and more particularly to a method and system for gas identification and concentration detection of volatile organic compounds (VOCs). In the evolution of smart workshops, modern printing processes such as offset printing, gravure printing, and screen printing, along with their associated processes like ink mixing, equipment cleaning, and print drying, have become significant industrial sources of VOC emissions. Solvent-based inks, cleaning agents, and diluents used in the production process continuously release various VOC components, including benzene, toluene, xylene, formaldehyde, ketones, and esters. These substances not only pose environmental and health risks, but their mixtures also produce a strong, pungent odor or ink smell, which is a sensory characteristic of complex mixtures of multi-component VOCs. This odor problem is essentially a direct manifestation of VOC pollution in the workshop microenvironment, and effective control depends on the rapid and accurate identification of the components and concentrations of VOCs at the emission sources.

[0003] In existing gas detection schemes based on sensor arrays and artificial intelligence, a mainstream technical approach to improve detection accuracy is to use deep learning models to fuse and learn the spatiotemporal features of multi-sensor signals. For example, Chinese patent document CN119291123A discloses a multi-sensor fusion intelligent gas detection method, which constructs a dual-branch structure based on a Transformer neural network to extract the spatial features (sensor dimension) and temporal features (sampling sequence) of the sensor array signals, fuses them, and finally achieves gas identification through a classifier. This scheme, from a data-driven perspective, utilizes the powerful feature extraction capabilities of deep learning models to improve detection performance.

[0004] However, this method fails to effectively model and utilize the inherent physicochemical properties and molecular structure of the gas being detected. When faced with sensor drift, severe cross-sensitivity, or gas types not fully covered by training data, the model's generalization ability and interpretability are insufficient, and its performance is prone to fluctuations. Summary of the Invention

[0005] The purpose of this application is to provide a method and system for detecting VOCs, an electronic device and a storage medium, to solve the problems mentioned in the background art.

[0006] In a first aspect, one embodiment of this application provides a method for detecting VOCs, implemented based on a sensor array. The method includes: creating a key-value pair mapping list based on a preset knowledge source file, and obtaining an initial feature matrix and an adjacency matrix through the key-value pair mapping list; acquiring the original data of the sensor array and the adjacency matrix, and calculating a spatiotemporal fusion feature vector; calculating a knowledge feature matrix based on the initial feature matrix and the adjacency matrix through a graph neural network model; performing knowledge-guided adaptive fusion of the spatiotemporal fusion feature vector and the knowledge feature matrix to obtain a fused feature vector; and outputting the gas type identification result and concentration prediction result of volatile organic compounds through a classification and regression fully connected layer based on the fused feature vector.

[0007] In conjunction with the first aspect, in some implementations of the first aspect, the initial feature matrix is ​​obtained through a key-value pair mapping list, including: traversing the key-value pair mapping list by alphabetical order of gas names to obtain a node list and node indices, where the node list uses different gas types as nodes; traversing the node list to obtain gas attribute fields for each gas from the knowledge source file, including molecular weight, boiling point, safe concentration threshold, and functional groups; standardizing the molecular weight, boiling point, and safe concentration threshold and storing them in a one-dimensional array to obtain feature vectors, which store the physicochemical properties of each gas type; performing one-thermal encoding based on functional groups using a functional group vocabulary and concatenating it to the feature vectors; and storing the feature vectors of multiple gases in a two-dimensional array after traversal to obtain the initial feature matrix.

[0008] In conjunction with the first aspect, in some implementations of the first aspect, the adjacency matrix is ​​obtained through a key-value pair mapping list, including: creating a two-dimensional array based on the key-value pair mapping list, where the rows and columns of the two-dimensional array represent nodes of different gas types, and all elements are set to 0; traversing all node pairs through a double loop, obtaining the molecular formula and functional groups of the gas through the node list; calculating the Taney similarity coefficient of the node pairs based on the molecular formula, and / or determining whether the node pairs share functional groups based on the functional groups; establishing associated edges between the corresponding node pairs based on the Taney similarity coefficient and / or the result of the shared functional group determination; and using the two-dimensional array as the adjacency matrix after the traversal is completed.

[0009] In conjunction with the first aspect, in some implementations of the first aspect, the spatiotemporal fusion feature vector and the knowledge feature matrix are subjected to knowledge-guided adaptive fusion, including: projecting the spatiotemporal fusion feature vector into a query matrix and projecting the knowledge feature matrix into a key matrix and a value matrix; calculating the attention weight of each key vector in the query matrix and the key matrix according to the query matrix, where the attention weight represents the correlation between the sensor signal and the prior knowledge of each gas; performing a weighted summation of the value matrix according to the attention weight to generate a knowledge context vector; and performing a weighted fusion of the spatiotemporal fusion feature vector and the knowledge context vector through a gating mechanism to generate a fused feature vector; wherein, the gating mechanism dynamically generates a gating value based on the concatenation information of the spatiotemporal fusion feature vector and the knowledge context vector to adaptively control the fusion ratio of the two.

[0010] In conjunction with the first aspect, in some implementations of the first aspect, the calculation of the Tani similarity coefficient of the node pair based on the molecular formula, and / or the determination of whether the node pair shares functional groups based on functional groups, includes: converting the molecular formula into a molecular fingerprint, calculating the Tani similarity coefficient of the node pair based on the molecular fingerprint; if the Tani similarity coefficient is greater than a preset similarity threshold, then the elements of the node pair are set to 1; and / or the intersection of the functional groups of the node pair is calculated based on the functional groups, and if the intersection is not empty, then the elements of the node pair are set to 1.

[0011] In conjunction with the first aspect, in some implementations of the first aspect, obtaining the original data and adjacency matrix of the sensor array and calculating the spatiotemporal fusion feature vector includes: obtaining the original data of the sensor array, performing pooling processing along the time dimension and sensor dimension respectively to obtain the channel attention weight vector and the time attention weight vector; obtaining the enhanced feature matrix based on the channel attention weight vector and the time attention weight vector; extracting the time series of each sensor from the enhanced feature matrix, processing it through multiple convolutional layers to obtain the temporal feature tensor; stacking the temporal feature tensors of multiple sensors after average pooling to obtain the node feature matrix; calculating the mean of the features of all sensor nodes based on the node feature matrix and the adjacency matrix to obtain the spatiotemporal fusion feature vector, which represents the overall response mode of the sensor array.

[0012] In conjunction with the first aspect, in some implementations of the first aspect, the time series of each sensor is extracted from the enhanced feature matrix and processed through multiple convolutional layer networks to obtain a temporal feature tensor. This includes: traversing the convolutional layer network according to the time series, calculating the output vector of a single time series through the dilation rate and convolution kernel of the convolutional layer network; applying an activation function to the output vector of the time series to obtain a temporal feature vector; using the temporal feature vector of the previous convolutional layer network as the input vector of the next convolutional layer network; and after traversal, using the temporal feature vector output by the last layer as the temporal feature tensor of each sensor.

[0013] Secondly, this application provides a VOCs gas detection system based on a sensor array, comprising: a data acquisition module for creating a key-value pair mapping list based on a preset knowledge source file, and obtaining an initial feature matrix and an adjacency matrix through the key-value pair mapping list; a spatiotemporal feature extraction module for acquiring the original data and adjacency matrix of the sensor array, and calculating a spatiotemporal fusion feature vector; a knowledge feature extraction module for calculating a knowledge feature matrix based on the initial feature matrix and adjacency matrix through a graph neural network model; a feature fusion module for performing knowledge-guided adaptive fusion of the spatiotemporal fusion feature vector and the knowledge feature matrix to obtain a fused feature vector; and a result output module for outputting the gas type identification result and concentration prediction result of volatile organic compounds based on the fused feature vector through a classification and regression fully connected layer.

[0014] Thirdly, this application provides an electronic device, including: a processor; and a memory storing computer program instructions, which, when executed by the processor, implement the steps in the VOCs gas detection method mentioned in the first aspect above.

[0015] Fourthly, this application provides a computer-readable storage medium storing computer program instructions, which, when executed by a processor, cause the processor to perform the steps in the VOCs gas detection method mentioned in the first aspect.

[0016] The VOCs gas detection method provided in this application constructs a knowledge graph containing the physical and chemical properties and relationships of gas entities, and adaptively fuses the spatiotemporal features extracted from sensor array signals with the semantic features extracted from the knowledge graph. This solves the problem of weak model generalization ability and poor robustness in existing pure data-driven gas detection methods due to the lack of utilization of prior knowledge about the gas itself, especially in scenarios with sensor drift, cross-sensitivity, or insufficient training data. By comprehensively utilizing data patterns and domain knowledge, the method significantly improves the accuracy of gas identification and concentration prediction, as well as the adaptability of the model. Attached Figure Description

[0017] Figure 1 The diagram shown is a schematic flowchart of a VOCs gas detection method provided in an exemplary embodiment of this application.

[0018] Figure 2 The diagram shown is a schematic flowchart of a VOCs gas detection method provided in another exemplary embodiment of this application.

[0019] Figure 3The diagram shown is a schematic flowchart of a VOCs gas detection method provided in another exemplary embodiment of this application.

[0020] Figure 4 The diagram shown is a schematic flowchart of a VOCs gas detection method provided in another exemplary embodiment of this application.

[0021] Figure 5 The diagram shown is a schematic flowchart of a VOCs gas detection method provided in another exemplary embodiment of this application.

[0022] Figure 6 The diagram shown is a schematic flowchart of a VOCs gas detection method provided in another exemplary embodiment of this application.

[0023] Figure 7 The diagram shown is a schematic flowchart of a VOCs gas detection method provided in another exemplary embodiment of this application.

[0024] Figure 8 The diagram shown is a schematic diagram of the structure of a VOCs gas detection system provided in an exemplary embodiment of this application.

[0025] Figure 9 The diagram shown is a structural schematic of an electronic device provided in an exemplary embodiment of this application. Detailed Implementation

[0026] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0027] The following is combined with Figures 1 to 7 This application provides a detailed description of a gas detection method for VOCs.

[0028] Figure 1 The diagram shown is a schematic flowchart of a VOCs gas detection method provided in an exemplary embodiment of this application. Figure 1 As shown in the embodiments of this application, the gas detection method for VOCs includes the following steps.

[0029] Step 100: Create a key-value pair mapping list based on the preset knowledge source file, and obtain the initial feature matrix and adjacency matrix through the key-value pair mapping list.

[0030] For example, knowledge source files refer to the gas molecule properties of VOCs that have been pre-collected, organized, and formatted from authoritative databases or standard documents.

[0031] For example, a key-value pair mapping list refers to a temporary storage of the attribute information of all target gases parsed from external knowledge source files, used to provide structured raw data for subsequent construction of knowledge graphs.

[0032] For example, the initial feature matrix is ​​a two-dimensional array that represents the features and values ​​of all gas nodes. Each row of the matrix uniquely corresponds to a type of gas node, and each column represents a feature dimension of that node.

[0033] For example, an adjacency matrix is ​​a two-dimensional square matrix used to mathematically represent the connection relationships between various gas nodes in a knowledge graph, i.e., the topological structure of the graph. The row and column indices of the matrix correspond to the gas nodes.

[0034] Step 102: Obtain the original data and adjacency matrix of the sensor array, and calculate the spatiotemporal fusion feature vector.

[0035] For example, raw data refers to the raw data of each sensor collected by the sensor array at a set sampling frequency after receiving the acquisition command.

[0036] For example, a spatiotemporal fusion feature vector refers to a one-dimensional numerical array that is a fixed-length feature representation extracted from the original time-series signal of the sensor array through multi-layer processing. It integrates the dynamic change pattern of the signal in the time dimension and the cooperative response pattern of the sensor in the spatial dimension.

[0037] Step 104: Based on the initial feature matrix and adjacency matrix, the knowledge feature matrix is ​​calculated using a graph neural network model.

[0038] For example, a graph neural network model refers to a neural network used for deep semantic encoding of a gas knowledge graph (defined by an initial feature matrix and an adjacency matrix).

[0039] For example, the knowledge feature matrix refers to the two-dimensional matrix output after the graph neural network model has finished processing. It has a similar shape to the initial feature matrix, but its row vectors (feature representations of each gas) contain richer semantic information.

[0040] Step 106: Perform knowledge-guided adaptive fusion of the spatiotemporal fusion feature vector and the knowledge feature matrix to obtain the fusion feature vector.

[0041] For example, adaptive fusion refers to a dynamic, asymmetric feature fusion strategy. Instead of simply concatenating or averaging sensor features and knowledge features, it allows the model to autonomously decide how much information to borrow from prior knowledge and which parts to borrow based on the specific circumstances of the current sensor signal.

[0042] For example, the fused feature vector refers to the final one-dimensional feature vector generated through an adaptive fusion process. It integrates the essence of spatiotemporal fused feature vectors from sensors and knowledge feature matrices from knowledge sources.

[0043] Step 108: Based on the fused feature vector, the gas type identification result and concentration prediction result of volatile organic compounds are output through a classification and regression fully connected layer.

[0044] For example, the classification fully connected layer refers to the output layer used for gas type identification.

[0045] For example, the regression fully connected layer refers to the output layer used for gas concentration prediction.

[0046] The VOCs gas detection method provided in this application constructs a knowledge graph containing the physical and chemical properties and relationships of gas entities, and adaptively fuses the spatiotemporal features extracted from sensor array signals with the semantic features extracted from the knowledge graph. This solves the problem of weak model generalization ability and poor robustness in existing pure data-driven gas detection methods due to the lack of utilization of prior knowledge about the gas itself, especially in scenarios with sensor drift, cross-sensitivity, or insufficient training data. By comprehensively utilizing data patterns and domain knowledge, the method significantly improves the accuracy of gas identification and concentration prediction, as well as the adaptability of the model.

[0047] Figure 2 The diagram shown is a schematic flowchart of a VOCs gas detection method provided in another exemplary embodiment of this application. Figure 1 This application extends from the embodiments shown. Figure 2 The illustrated embodiment will be described in detail below. Figure 2 The illustrated embodiments and Figure 1 The differences between the embodiments shown are not repeated here, and the similarities are not repeated here.

[0048] like Figure 2 As shown in the embodiments of this application, the gas detection method for VOCs obtains an initial feature matrix through a key-value pair mapping list, including the following steps.

[0049] Step 200: Based on the key-value pair mapping list, traverse the keys in alphabetical order of gas names to obtain a node list and node indices.

[0050] Specifically, first, the storage path of the knowledge source file is obtained in the system configuration, the knowledge source file under the specified path is read, and the gas attribute fields are parsed. The gas attribute fields include gas name, molecular formula, molecular weight, boiling point, functional groups, and safe concentration threshold.

[0051] For example, knowledge source files refer to the gas molecule properties of VOCs that have been pre-collected, organized, and formatted from authoritative databases or standard documents.

[0052] For example, the gas name serves as the unique identifier of the node; the molecular formula refers to the input for calculating the molecular fingerprint, used to construct structurally similar edges in subsequent steps, and is stored using SMILES strings, which are a specification for explicitly describing molecular structures using ASCII strings; molecular weight and boiling point are continuous numerical attributes used as part of the node features; functional groups refer to a list of strings, as a gas molecule may include multiple functional groups, for example, the functional groups of ethanol methyl ether are hydroxyl (-OH) and primary amine (-NH2), used to establish shared functional group edges in subsequent steps and encoded as node features; the safe concentration threshold refers to the legally mandated safe concentration threshold for various gas molecules in VOCs, and is also a continuous numerical attribute.

[0053] Next, based on the gas attribute field, a key-value pair mapping list DM is created, where the gas name Name is used as the primary key, and all attributes of each gas are stored as a structure.

[0054] For example, if the gas molecules in VOCs include formaldehyde and benzene, then formaldehyde and benzene are stored in the bond-value pair mapping list DM as follows: DM = {Name = Formaldehyde: {Smiles: C=O, Weight: 30.03, Point: -19.1, Groups: Aldehyde group, Oel: 0.5}, Name = Benzene: {Smiles: C1=CC=CC=C1, Weight: 78.11, Point: 80.1, Groups: Aromatic hydrocarbon, Oel: 3.2}}.

[0055] Finally, create an empty list of nodes (NodeList) and an empty index (NameIndex). Based on the key-value pair mapping list (DM), iterate through the gas names (Name) alphabetically, processing each gas in turn. Let's say the current gas being processed is the [number of]th [gas]. m One gas, of which m Start from 0.

[0056] Step 202: Traverse the node list and obtain the gas attribute fields from the knowledge source file for each gas.

[0057] Specifically, firstly, the first m The name of each gas (Name) is appended to the end of the NodeList. Simultaneously, a new key-value pair is added to the node index NameIndex, with the key being the gas name (Name) and the value being... m .

[0058] For example, after the traversal is complete, the node list NodeList becomes an ordered list containing all gas names, and the node index NameIndex becomes the index for quickly finding the corresponding node by gas name.

[0059] Next, an initial feature matrix is ​​created based on the preset feature dimension planning. F k Its shape is (M, D k Where M is the total number of gases, i.e., the length of the NodeList. D k It is the total length of the eigenvectors.

[0060] Secondly, iterate through the NodeList again, for the first node... m The gas name Name, based on the key-value pair mapping list DM, is obtained through the... m The gas name (Name) is retrieved from the main dictionary object, along with its corresponding gas attribute field. A new dictionary object with a length of... D k eigenvectors of a one-dimensional array f m .

[0061] Step 204: After standardizing the molecular weight, boiling point, and safe concentration threshold, store them in a one-dimensional array to obtain the feature vector.

[0062] Specifically, three floating-point values ​​are sequentially retrieved from the gas attribute field, standardized using pre-loaded normalization parameters, and then the standardized three floating-point values ​​are sequentially placed into the feature vector. f m The starting position. The three floating-point values ​​include molecular weight (Weight), boiling point (Point), and safe concentration threshold (Oel).

[0063] For example, the normalization parameter is calculated from the entire gas ensemble and is used to standardize the denominator of the calculation, the purpose of which is to eliminate the influence of dimensions.

[0064] Step 206: Based on the functional groups, perform one-hot encoding using the functional group vocabulary and concatenate it to the feature vector.

[0065] Specifically, functional groups are extracted from the gas property field, and a binary vector with a length equal to the size of the functional group vocabulary is created. G m Initially all values ​​are 0, for the th mFor each functional group of a gas, find its position in the functional group vocabulary and set that position to 1. Then, convert the binary vector... G m spliced ​​to feature vector f m After the three floating-point numerical characteristics.

[0066] For example, a functional group vocabulary refers to an ordered list containing all possible functional group categories, such as ["aldehyde", "ketone", "alcohol", "aromatic hydrocarbon", ...].

[0067] Step 208: After traversal is complete, the feature vectors of multiple gases are stored in a two-dimensional array to obtain the initial feature matrix.

[0068] Specifically, the constructed feature vector f m Assigned to the initial feature matrix F k The m OK.

[0069] For example, the initial feature matrix construction process transforms human-readable symbolic knowledge into machine-processable numerical knowledge; the node list and node index establish a stable, bidirectional correspondence between gas entities and graph node indices, used for all subsequent index-based graph convolution operations; the feature vector construction incorporates physical and chemical properties such as gas molecular weight, boiling point, safe concentration threshold, and functional groups. Among these, the functional group encoding feature transforms discrete category information into standard binary vectors, enabling the model to understand the concept of "which functional group it belongs to."

[0070] The VOCs gas detection method provided in this application standardizes the continuous attributes of gases, such as molecular weight, boiling point, and safety threshold, extracted from knowledge source files, and performs one-thermal encoding on functional group categories to construct the initial feature vector for each gas node. This solves the problem of how to transform heterogeneous and multimodal gas prior information (numerical attributes and category attributes) into a unified and standardized numerical representation, providing high-quality and computable node feature input for subsequent graph neural networks, and ensuring that knowledge can be effectively encoded and learned.

[0071] Figure 3 The diagram shown is a schematic flowchart of a VOCs gas detection method provided in another exemplary embodiment of this application. Figure 1 This application extends from the embodiments shown. Figure 3 The illustrated embodiment will be described in detail below. Figure 3 The illustrated embodiments and Figure 1 The differences between the embodiments shown are not repeated here, and the similarities are not repeated here.

[0072] like Figure 3 As shown in the embodiments of this application, the gas detection method for VOCs obtains the adjacency matrix through a key-value pair mapping list, including the following steps.

[0073] Step 300: Create a two-dimensional array based on the key-value pair mapping list.

[0074] Specifically, create a two-dimensional adjacency matrix A of size M × M, and initialize all its elements to 0. Where A[ i ][ j ] = 1 indicates a node i and nodes j There is an edge between them. i = j ={0, 1, 2, ..., M-1}.

[0075] Step 302: Traverse all node pairs through a double loop and obtain the molecular formula and functional groups of the gas from the node list.

[0076] Specifically, all possible node pairs are traversed through a double loop. i , j ),in i and j The value range is [0, M-1]. For each pair of nodes, the node list NodeList[ i ] and NodeList[ j Get the gas names Name of the two gases, and then get the molecular formula Smiles and functional groups Groups of the corresponding gas name Name from the key-value pair mapping list DM.

[0077] Step 304: Calculate the Tani similarity coefficient of the node pair based on the molecular formula, and / or determine whether the node pair shares functional groups based on functional groups.

[0078] For example, the Tani similarity coefficient is an index that quantifies the degree of similarity between two gas molecules in their overall chemical structure. It is used to provide a calculable basis for automatically establishing structural similarity association edges between gas entity nodes when constructing a gas knowledge graph.

[0079] Step 306: Based on the Tani similarity coefficient and / or the shared functional group judgment result, establish associated edges between the corresponding node pairs.

[0080] For example, a shared functional group refers to two different gas molecules that have at least one functional group of the same type in their respective chemical structures.

[0081] Step 308: After the traversal is complete, use the two-dimensional array as an adjacency matrix.

[0082] Specifically, a data acquisition task is created, with a preset sampling frequency. This task synchronously sends data read commands to all N sensors, and stores the raw response values ​​returned by the N sensors as a data vector with the same timestamp in a buffer named BufferX. The average response calculated during the training phase for each sensor channel under standard background gas conditions is then read. Mean [N] and standard deviation Std [N].

[0083] For example, the mean and standard deviation are used to Z-score normalize the real-time signal during data preprocessing to eliminate inherent baseline bias and sensitivity differences in the sensor.

[0084] The VOCs gas detection method provided in this application calculates the Tani similarity between gases based on molecular formulas to determine structural similarity, and / or determines whether functional groups are shared based on a functional group list. Based on this, it establishes associated edges between nodes in the knowledge graph, solving the problem of how to automatically and quantitatively construct semantic relationships between gas entities and transform isolated gas attribute lists into a structured knowledge network with rich associations. This enables the constructed knowledge graph to accurately reflect the chemical similarity and homology between gases, providing key structural information for subsequent graph neural networks to perform deep relationship reasoning.

[0085] Figure 4 The diagram shown is a schematic flowchart of a VOCs gas detection method provided in another exemplary embodiment of this application. Figure 1 This application extends from the embodiments shown. Figure 4 The illustrated embodiment will be described in detail below. Figure 4 The illustrated embodiments and Figure 1 The differences between the embodiments shown are not repeated here, and the similarities are not repeated here.

[0086] like Figure 4 As shown in the embodiments of this application, the gas detection method for VOCs includes the following steps: performing knowledge-guided adaptive fusion of spatiotemporal fusion feature vectors and knowledge feature matrices.

[0087] Step 400: Project the spatiotemporal fusion feature vector into a query matrix, and project the knowledge feature matrix into a key matrix and a value matrix.

[0088] Specifically, firstly, based on the spatiotemporal fusion feature vector F sensor Spatiotemporal fusion feature vector F sensorInput a fully connected layer of a graph fusion neural network, and project it to a dimension of D through a linear transformation. proj The space is used to obtain the query matrix. Q sensor .

[0089] Q sensor = F sensor × w q ; in, w q This represents the weight matrix used to generate the query matrix, with dimensions (D1, D2). proj ); Query matrix Q sensor The dimension is (D1, D2). proj ).

[0090] Next, based on the knowledge feature matrix F knowledge , knowledge feature matrix F knowledge The input graph is fused from two independent fully connected layers of a neural network and projected onto a dimension D through a linear transformation. proj In the space, the key matrix is ​​obtained. K kg Sum matrix V kg .

[0091] K kg = F knowledge × w k ; V kg = F knowledge × w v ; in, w k , w v These represent the weight matrices used to generate the key matrix and value matrix, respectively, both with dimensions (D2, D3). proj ); Key matrix K kg Sum matrix V kg The dimension is (M, D) proj ).

[0092] For example, linear projection is a standardized process before fusing spatiotemporal fusion feature vectors and knowledge feature matrices, mapping features from different networks and distributions to a common latent space, and querying the matrix. Q sensor The key matrix represents what signal is currently being observed. K kg What gas properties are represented in the knowledge base, and what is the value matrix? V kg A depth representation characterizing gas properties.

[0093] Step 402: Based on the query matrix, calculate the attention weight of each key vector in the query matrix and the key matrix.

[0094] Specifically, firstly, based on the query matrix Q sensor Calculate the query matrix Q sensor AND key matrix K kg The dot product of each row (i.e., the bond vector of each gas entity) yields a raw score vector containing M scalars. S raw .

[0095] ; in, K kg [ j ] represents the key matrix K kg The j row vectors j ={1, 2, ..., M}.

[0096] Next, the original score vector is scaled using the scaling operation in the attention mechanism. S raw Divide each score in by sqrt ( D proj ), to obtain the scaled score vector S scaled .

[0097] ; Finally, the scaled score vector S scaled application Softmax The function is normalized to an attention weight vector α = {α1, α2, ..., α...}. j , ..., α M}

[0098] ; Where, α j Indicates the first j The sensor features of the element in the knowledge graph j Attention weights for each gas, where ∑(α) = 1 in the attention weight vector and each α j >0.

[0099] For example, attention weight α j Quantify the current sensor signal pattern and the first in the knowledge base j The correlation strength between the prior knowledge of the gases. For example, if the dot product score of the current signal with the bond vectors of formaldehyde and acetaldehyde is high, then the weights of formaldehyde and acetaldehyde will be large.

[0100] Step 404: The value matrix is ​​weighted and summed according to the attention weights to generate a knowledge context vector.

[0101] Specifically, based on the attention weight vector α, the value matrix V kg We perform a weighted summation to obtain the knowledge context vector. C kg .

[0102] ; in, V kg [ j ] represents a value matrix V kg The j Row vectors.

[0103] For example, since the attention weight vector α is a row vector of (1, M), the value matrix... V kg It is (M, D proj The matrix of ), therefore, the knowledge context vector C kg It is a dimension D proj The vector.

[0104] For example, the knowledge context vector represents a dynamic hybrid summary of all gas knowledge in the knowledge graph. The attention weight vector α is determined by the sensor signal and includes the essence of those gas properties most relevant to the current signal, representing a priori knowledge description tailored to the current sensor signal.

[0105] Step 406: Through a gating mechanism, the spatiotemporal fusion feature vector and the knowledge context vector are weighted and fused to generate a fused feature vector.

[0106] Specifically, firstly, the spatiotemporal fusion feature vectors are...F sensor and knowledge context vectors C kg Two vectors are concatenated and input into a gating network to obtain the gating value. g .

[0107] ; in, w g , b g These represent the learnable weights and biases of the gating network, respectively.

[0108] For example, a gated network refers to a network that includes a fully connected layer and a... Sigmoid The activation function outputs a gating value in the range [0, 1], which is a scalar.

[0109] Next, based on the gate value g Spatiotemporal fusion feature vector F sensor and knowledge context vectors C kg Fusion, resulting in a fused feature vector. F fused The dimension of the fused feature vector is (1, ...). D fused ).

[0110] F fused = g × F sensor +(1- g )× C kg ; For example, gate value g As a soft switch, its performance is jointly determined by the spatiotemporal fusion feature vector (sensor signal) and the knowledge context vector: when the sensor signal is clear and highly discriminative, the model confidence is high. g The confidence level approaches 1, indicating that the fused feature vectors primarily inherit from the sensor signals, meaning they rely on the data. However, when the sensor signals are weak, noisy, or subject to cross-interference, the model's confidence level is low. g The feature vector is reduced, and the fusion feature vector mainly inherits the prior knowledge in the knowledge context vector for inference, that is, it relies on common sense.

[0111] The VOCs gas detection method provided in this application uses sensor spatiotemporal features as query vectors and knowledge features as key-value matrices. It calculates cross-attention weights to generate dynamic knowledge context vectors and introduces a gating mechanism jointly determined by sensor features and knowledge context for adaptive weighted fusion. This solves the problems of how to achieve dynamic and refined guidance of knowledge on sensor signal processing and how to adaptively balance the dependence on original data and prior knowledge according to the signal-to-noise ratio of the current signal. It realizes the emphasis on data when the signal quality is high and the emphasis on knowledge when the signal is interfered with or blurred, thereby greatly enhancing the detection robustness and fault tolerance of the system in complex and harsh environments.

[0112] Figure 5 The diagram shown is a schematic flowchart of a VOCs gas detection method provided in another exemplary embodiment of this application. Figure 1 This application extends from the embodiments shown. Figure 5 The illustrated embodiment will be described in detail below. Figure 5 The illustrated embodiments and Figure 1 The differences between the embodiments shown are not repeated here, and the similarities are not repeated here.

[0113] like Figure 5 As shown in the embodiments of this application, the gas detection method for VOCs includes the following steps: calculating the Taney similarity coefficient of the node pair based on the molecular formula, and / or determining whether the node pair shares functional groups based on functional groups.

[0114] Step 500: Convert the molecular formula into a molecular fingerprint, and calculate the Tani similarity coefficient of the node pairs based on the molecular fingerprint.

[0115] Specifically, the molecular formula Smiles (SMILES strings) is converted into molecular fingerprints using a pre-defined cheminformatics computation library. A molecular fingerprint is a fixed-length binary string used to characterize molecular structure.

[0116] Step 502: If the similarity coefficient of Tani is greater than the preset similarity threshold, then the element of the node pair is set to 1.

[0117] Specifically, calculating gas i and j The similarity coefficient between molecular fingerprints δ ij If the similarity coefficient of Tani is greater than or equal to the preset similarity threshold θ1, then set A[ i ][ j ] = 1 and A[ j ][ i ] = 1.

[0118] Tanny similarity coefficient δ ij : δ ij = c / ( a + b - c ); The similarity threshold θ1 ranges from [0.7, 0.9], and in this embodiment, θ1 is set to 0.7. a Represents gas i The total number of bits with a value of 1 in the molecular fingerprint; b Represents gas j The total number of bits with a value of 1 in the molecular fingerprint; c Represents gas i and gas j The total number of bits where all positions are 1 in the molecular fingerprint.

[0119] For example, the graph created in this embodiment is an undirected graph; therefore, the nodes i and nodes j There is an edge between them, which also indicates that the nodes j and nodes i There is an edge between them.

[0120] Step 504, and / or based on functional groups, calculate the intersection of functional groups of the node pairs. If the intersection is not empty, set the elements of the node pairs to 1.

[0121] Specifically, and / or according to the gas i and gas j Given functional groups, calculate the intersection of two functional groups. If the intersection is not empty, then set A[ i ][ j ] = 1 and A[ j ][ i = 1. Where a non-empty intersection represents gas. i and gas j Share at least one functional group category For example, after the traversal is complete, an adjacency matrix A(M, M) is generated, and the adjacency matrix A is compared with the initial feature matrix. F k (M, D k Together, they constitute the complete mathematical representation of a knowledge graph.

[0122] The VOCs gas detection method provided in this application solves the problem of how to provide similarity criteria from different levels (overall and local) of molecular structure and establish connections between nodes in a knowledge graph by converting the SMILES expression of gas molecules into molecular fingerprints and calculating the Tani similarity coefficient, and by calculating the intersection of functional group lists. This enables quantitative assessment of the similarity of the overall molecular structure and judgment of the homology of local chemical properties of molecules.

[0123] Figure 6 The diagram shown is a schematic flowchart of a VOCs gas detection method provided in another exemplary embodiment of this application. Figure 1 This application extends from the embodiments shown. Figure 6 The illustrated embodiment will be described in detail below. Figure 6 The illustrated embodiments and Figure 1 The differences between the embodiments shown are not repeated here, and the similarities are not repeated here.

[0124] like Figure 6 As shown in the embodiments of this application, the gas detection method for VOCs includes the following steps: obtaining the original data and adjacency matrix of the sensor array and calculating the spatiotemporal fusion feature vector.

[0125] Step 600: Obtain the raw data of the sensor array, and perform pooling processing along the time dimension and sensor dimension respectively to obtain the channel attention weight vector and the time attention weight vector.

[0126] Specifically, firstly, from the buffer BufferX, extract the raw response values ​​of all N sensor channels up to the current time T, counting backwards by (T-1) time steps, to generate a raw data matrix. X raw Among them, the original data matrix X raw The dimension is N × T, where N represents the number of rows in the matrix, which is the total number of sensors, and T represents the number of columns in the matrix, which is the total number of timestamps captured.

[0127] Next, based on the mean Mean [N] and standard deviation Std [N], for the original data matrix X raw Raw response value of each sensor channel X raw [ i ][ t Z-score normalization was performed to obtain the normalized response values ​​for each sensor channel. X raw ' [ i ][t ].

[0128] ; in, X raw [ i ][ t ] indicates the first i The sensor channel, the first t The original response value of each timestamp. i ={0, 1,..., N-1} t ={0, 1, ..., T-1}; Mean [ i ] indicates the first i The average value of each sensor; Std [ i ] indicates the first i The standard deviation of each sensor.

[0129] Next, normalize the response values ​​of all sensor channels. X raw ' [ i ][ t Generate a standardized data matrix. X raw ' According to the standardized data matrix X raw ' Standardized data matrix along the time dimension T X raw ' Perform global average pooling to obtain an N-dimensional channel pooling vector. V chan ={ V chan [0], V chan [1], ..., V chan [ i ], ..., V chan [N-1]}.

[0130] ; in, V chan [ i ] indicates the first i The average response value of each sensor over the entire time window.

[0131] Secondly, the channel pooling vector V chanInput a perceptron consisting of two fully connected layers, and pass the channel pooling vector through the first fully connected layer. V chan The dimension is compressed from N to N / r, and then restored to N dimensions through a second fully connected layer, resulting in a compressed channel pooling vector. Z chan ={ Z chan [0], Z chan [1], ..., Z chan [ i ], ..., Z chan [N-1]}.

[0132] ; in, Z chan [ i ] indicates the first i The compressed response values ​​of a sensor over the entire time window; r represents the reduction ratio; w 1 and b 1 represents the weight matrix and bias vector of the first fully connected layer. w The dimension of 1 is (N / r × N); representing w 2 and b 2 represents the weight matrix and bias vector of the second fully connected layer. w The dimension of 2 is (N × N / r); ReLU This represents a commonly used activation function in this field.

[0133] Secondly, based on the compressed channel pooling vector Z chan ,pass Sigmoid The activation function outputs an N-dimensional channel attention weight vector. W chan .

[0134] ; in, W chan [ i ] indicates the first i The channel attention weights of each sensor throughout the entire time window range from [0, 1].

[0135] Similarly, based on the channel attention weight vector W chan The calculation process involves standardizing the data matrix. X raw 'Global average pooling is performed along the sensor dimension N to obtain a T-dimensional time pooling vector. V time .

[0136] ; For example, each element in the time pooling vector represents the average response intensity of all sensors at a given timestamp.

[0137] Finally, the time pooling vector V time After being processed by a similarly structured perceptron, through Sigmoid The activation function outputs a T-dimensional temporal attention weight vector. W time .

[0138] For example, the perceptron used for channel pooling vectors has an input-output dimension of N, and the perceptron used for temporal pooling vectors has a similar structure, both including two fully connected layers, but with an input-output dimension of T.

[0139] Step 602: Obtain the enhanced feature matrix based on the channel attention weight vector and the temporal attention weight vector.

[0140] Specifically, the channel attention weight vector W chan With standardized data matrix X raw ' Multiply each row by the result, then multiply the result by the time attention weight vector. W time By multiplying each column sequentially, we obtain the enhanced feature matrix. X att The enhanced feature matrix has dimensions (N, T).

[0141] ; For example, the channel attention weight vector allows the model algorithm to focus on specific sensors that are more sensitive to the current gas response, while the temporal attention weight vector allows the model algorithm to focus on the most discriminative phase of the response curve. Thus, useful signals are enhanced and irrelevant noise is suppressed at the beginning of feature extraction.

[0142] Step 604: Extract the time series of each sensor from the enhanced feature matrix, process it through multiple convolutional network layers to obtain the temporal feature tensor.

[0143] Specifically, the enhanced feature matrix X att Consider it as N independent one-dimensional time series of length T, which is the Nth i Each sensor extracts its time series.X att [ i The network has dimensions (1, T) and consists of L layers of stacked one-dimensional causal dilated convolutional layers with shared weights. It independently processes N time series data. X att [ i , :).

[0144] Step 606: After performing average pooling on the temporal feature tensors of multiple sensors, stack them to obtain the node feature matrix.

[0145] Specifically, firstly, the temporal feature tensor of each sensor is... H temp [ i Global average pooling is performed along the time dimension T to obtain a... C last Pooling temporal feature vectors of dimension f i .

[0146] For example, the pooled temporal feature vector is used to characterize the first... i The response pattern of each sensor across its entire timestamp.

[0147] For example, a global average pooling operation in the time dimension converts a variable-length temporal feature tensor into a fixed-length vector.

[0148] Next, the pooled temporal feature vectors of the N sensors are... f i Stacking to form a node feature matrix H node Among them, the node feature matrix H node The dimension is (N, C last ).

[0149] Step 608: Calculate the mean value of all sensor node features based on the node feature matrix and the adjacency matrix to obtain the spatiotemporal fusion feature vector.

[0150] Specifically, firstly, based on the node feature matrix H node Given an adjacency matrix A, perform a graph convolution operation to obtain the graph convolution node features. H gc .

[0151] H gc = A × H node × w gc ; in, w gc This represents the weight matrix for the graph convolution operation, with dimensions ( C last , D1).

[0152] For example, the node feature matrix H node The dimension is (N, C last The adjacency matrix A has dimensions (M × M), where N and M both represent the total number of sensors, i.e., N = M. Therefore, the node feature matrix... H node The adjacency matrix A can be multiplied by matrix multiplication.

[0153] Next, the graph convolution node features are analyzed. H gc application ReLU The activation function yields the updated node feature matrix. H node '.

[0154] H node '= ReLU ( H gc ); Finally, the updated node feature matrix H node Global average pooling is performed along the node dimension N to calculate the mean of the features of all sensor nodes, thus obtaining the spatiotemporal fusion feature vector of the sensor nodes. F sensor .

[0155] ; in, F sensor [ j ] indicates the first j The spatiotemporal fusion characteristics of individual sensor nodes j ={1, 2, ..., D1}.

[0156] For example, the spatial topology of the sensor array is modeled, and graph convolution operations enable the features of each sensor to aggregate information from its spatial neighbors to simulate the diffusion and mixing effects of gas in space; the spatiotemporal fusion feature vector is used to characterize the overall response pattern of the sensor array.

[0157] The VOCs gas detection method provided in this application provides adaptive enhancement of sensor signals through a dual attention mechanism of channels and time, followed by extraction of long-term temporal dependence features via a causal dilated convolutional network, and finally aggregation of spatial information through graph convolution based on sensor spatial topology. This solves the problem of how to efficiently and collaboratively extract and fuse the temporal dynamic characteristics and spatial correlation features between sensor units from multi-channel temporal signals, and achieves the generation of fused feature vectors that can comprehensively characterize the spatiotemporal patterns of gas response without significantly increasing computational complexity, laying a solid foundation for subsequent deep integration with knowledge.

[0158] Figure 7 The diagram shown is a schematic flowchart of a VOCs gas detection method provided in another exemplary embodiment of this application. Figure 1 This application extends from the embodiments shown. Figure 7 The illustrated embodiment will be described in detail below. Figure 7 The illustrated embodiments and Figure 1 The differences between the embodiments shown are not repeated here, and the similarities are not repeated here.

[0159] like Figure 7 As shown in the embodiment of this application, the gas detection method for VOCs extracts the time series of each sensor from the enhanced feature matrix, processes it through multiple convolutional layer networks, and obtains a time-series feature tensor, including the following steps.

[0160] Step 700: Based on the time series, traverse the convolutional network and calculate the output vector of a single time series using the dilation rate and convolution kernel of the convolutional network.

[0161] Specifically, for each time series X att [ i , :],Set the first l Dilation rate of layer (l starting from 1) convolution D rate [ l ] = 2 l-1 The convolution kernel size is K, and causal padding is used. Wherein, l Indicates the number of convolutional layers. l ={1, 2,..., L}.

[0162] For example, causal filling is represented in time series. X att [ i The comma :] is padded with zeros on the left to indicate that the output depends only on the current and past inputs; the number of zeros is 1. D rate *(K-1) items.

[0163] Next, based on the expansion rate D rate [ l ] and convolution kernel K, calculate the th l The output vector of a single time series by a layer of causal dilated convolution y l ={ y l [0], y l [1], ..., y l [ t ], ..., y l [ T -1]}.

[0164] ; in, y l [ t ] indicates the first l Layer for a single time series, the first t One output value; w [ k ] indicates the first k Each convolutional kernel weight; b This represents the bias vector of the convolutional layer; when t- D rate [ l ]× k When the index is less than 0, the index of the time series is negative. Since causal padding is set, the value is filled with 0.

[0165] Step 702: Apply an activation function to the output vector of the time series to obtain the time series feature vector.

[0166] Specifically, after each convolutional operation, the following steps are applied: ReLU Activation function, to obtain the first l Temporal feature vectors of layers H l .

[0167] H l [ t ]= ReLU ( y l [ t ]); Step 704: Use the temporal feature vector of the previous convolutional layer as the input vector of the next convolutional layer.

[0168] Specifically, the first convolutional layer has 1 input channel and 1 output channel. C1. The number of input and output channels in subsequent convolutional layers varies depending on the convolution operation. Therefore, let the number of output channels in the last convolutional layer be... C last .

[0169] For example, weight sharing means sharing convolutions, with all sensors using the same set of convolution kernels to extract temporal features because different sensors have similar temporal patterns in their gas dynamic responses. Weight sharing is used to reduce the number of parameters; causal dilated convolutions are used to ensure real-time performance and effectively capture long-range temporal dependencies.

[0170] Step 706: After the traversal is completed, the temporal feature vector output from the last layer is used as the temporal feature tensor of each sensor.

[0171] Specifically, after processing the time series data of each sensor through a convolutional network, the temporal feature vector output by the last convolutional layer is... H L As a temporal feature tensor H temp [ i The temporal feature tensor dimension is ( ). C last , T), including C last Each time-series feature channel.

[0172] The VOCs gas detection method provided in this application solves the problem of how to effectively capture long-range time-dependent patterns in sensor responses with a limited number of network layers while ensuring the causality of the processing process by using a causal one-dimensional convolutional layer of expansion rate to process the time-series signal of each sensor. It achieves efficient extraction of time-series features with a lightweight network structure, which not only meets the real-time requirements of online detection, but also ensures accurate modeling of the dynamic adsorption / desorption process of gas.

[0173] In another embodiment, a knowledge feature matrix is ​​calculated using a graph neural network model based on the initial feature matrix and the adjacency matrix, including: Specifically, firstly, based on the initial feature matrix F k Through a linear transformation weight matrix w linear Perform a linear transformation operation to obtain the characteristic matrix after the linear transformation. H k .

[0174] H k = F k × w linear ; in, H k This represents the feature matrix after linear transformation, with dimensions (M, D). model ), used as input for subsequent graph attention layer calculations; linear transformation weight matrix w linear The dimension is ( D k D model ), initial feature matrix F k The dimension is (M, D k ).

[0175] For example, a linear transformation refers to mapping the initial feature matrix to a new space. The graph neural network model learns an effective combination of the initial feature matrix, providing a foundation for the subsequent attention mechanism.

[0176] Next, based on the characteristic matrix after linear transformation H k The adjacency matrix A is input into the first graph attention layer of the graph neural network model, which has L layers in total. K parallel attention heads are set up. For each attention head... k , k ={1, 2, ..., K}, and perform the following steps.

[0177] (1) For each pair of nodes in the adjacency matrix A that have an edge i and j That is, A[ i ][ j If != 0, use two weight matrices respectively. w qk and w kk For nodes i and j The features are transformed to obtain the query vector. q i and key vector k j ; query vector q i and key vector k j Concatenate them into a long vector, and then combine this long vector with the attention vector. a k Perform a dot product operation and apply a non-linear activation function to the dot product result. LeakyReLU Receive attention score e ij .

[0178] ; in, H k [ i ]、 H k [ j ] represents a node i and j The characteristic matrix after linear transformation H k Input vector; w qk , w kk Indicates the first k The weight matrix used to generate the query vector and key vector in each attention head; a k Indicates the first k Attention vectors in each attention head; concatenate ( x , y Functions represent vectors x sum vector y splicing; LeakyReLU The function represents the nonlinear activation function of the graph neural network model.

[0179] (2) For nodes i For nodes i All neighboring nodes j Calculated attention score e ij application softmax The function is normalized to obtain the normalized attention coefficients. α ij .

[0180] ; in, α ij Represents a node i For neighboring nodes j Normalized attention coefficients; neighbors ( i ) represents the node in the adjacency matrix A. i The set of directly connected nodes.

[0181] For example, normalization is used to ensure that the sum of the attention coefficients for all neighboring nodes of each node is 1. (3) Based on attention coefficient α ij Through a weight matrix w vk For nodes j Features H k [ j Transform the vector to obtain the value vector.v j Using attention coefficient α ij The value vectors of the neighboring nodes are weighted and summed, then the node is added. i Its own transformed features ( w qk H k [ i ]), to obtain the node i In the k Weighted features under individual attention H k [ i ] k .

[0182] ; Secondly, the nodes calculated from the K attention heads i Weighted features H k [ i ] k Perform a splicing operation along the feature dimension to form nodes. i aggregation features H k [ i ] ' .

[0183] ; For example, unlike ordinary graph convolutional networks that use predefined, fixed neighbor weights, the graph neural network model in this application uses attention coefficients. α ij The strength of relationships between nodes is dynamically learned. A multi-attention head mechanism is used to learn node relationships in parallel across different representation subspaces, enhancing the model's expressive power.

[0184] Finally, after completing the computation of one graph attention layer, the feature aggregation of L graph attention layers is completed to obtain the output nodes of the last layer. i aggregation features H k [ i ] '' After traversing all nodes, the knowledge feature matrix is ​​obtained. F knowledge .

[0185] For example, knowledge feature matrix F knowledgeThe dimension is (M, D2), where D2 is the feature dimension of the last layer output. Each row of the knowledge feature matrix corresponds to a gas entity, but the feature vector of that row is no longer just the initial physicochemical properties, but a deep representation rich in contextual semantics that integrates information from all relevant neighbors in the graph.

[0186] In another embodiment, based on the fused feature vector, a fully connected layer for classification and regression outputs the gas type identification results and concentration prediction results of volatile organic compounds, including: Specifically, firstly, the feature vectors will be fused. F fused Input a fully connected classification layer, and pass it through the weight matrix. w cls Perform a linear transformation to obtain the score vector. logits .

[0187] logits = F fused w cls + b cls ; in, b cls The bias vector of the fully connected classification layer; the weight matrix. w cls The dimension is ( D fused (M), where M is the total number of gas types defined in the knowledge graph; score vector logits Each element logits [ j ] Corresponding to the j The score for each gas.

[0188] Next, for the score vector logits application Softmax The function is transformed into a probability distribution vector P={P[1], P[2], ..., P[ j If the largest predicted probability P is... max =P[ j ], then its gas index j The corresponding gas type is the predicted gas type.

[0189] P[ j ]= Softmax ( logits [ j ]); Wherein, P[ j ] indicates that the sample belongs to the first... jThe predicted probability of a gas is 0≤P[j]≤1 and ∑(P)=1.

[0190] Finally, the feature vectors will be fused. F fused Input a fully connected regression layer, through the weight matrix w reg Perform a linear transformation, then apply a nonlinear activation function. ReLU The predicted concentration values ​​for each gas were obtained. C pred .

[0191] C pred = ReLU ( F fused w reg + b reg ); in, b reg The bias scalar represents the regressive fully connected layer; the weight matrix represents the bias scalar. w reg The dimension is ( D fused , 1); Fusion feature vectors F fused and weight matrix w reg The dot product is a scalar, and when you add another scalar, the predicted concentration value is also a scalar.

[0192] For example, nonlinear activation functions ReLU This is used to ensure that the concentration prediction value is non-negative.

[0193] For example, Softmax The function is a standard method to transform multi-class score vectors into probabilities, which is used to amplify the differences between scores of different gases and make the highest probability more prominent. Both branches (classification fully connected layer and regression fully connected layer) will use the fused feature vector as input, so that the identification task and concentration estimation task can promote each other and share the data learned from sensor signals and knowledge.

[0194] Figure 8 The diagram shown is a schematic representation of a VOCs gas detection system provided in an exemplary embodiment of this application. Figure 8 As shown, the VOCs gas detection system provided in this application embodiment includes: a data acquisition module 800, a spatiotemporal feature extraction module 802, a knowledge feature extraction module 804, a feature fusion module 806, and a result output module 808.

[0195] The data acquisition module 800 is used to create a key-value pair mapping list based on a preset knowledge source file, and obtain the initial feature matrix and adjacency matrix through the key-value pair mapping list; the spatiotemporal feature extraction module 802 is used to acquire the raw data and adjacency matrix of the sensor array, and calculate the spatiotemporal fusion feature vector; the knowledge feature extraction module 804 is used to calculate the knowledge feature matrix based on the initial feature matrix and adjacency matrix through a graph neural network model; the feature fusion module 806 is used to perform knowledge-guided adaptive fusion of the spatiotemporal fusion feature vector and the knowledge feature matrix to obtain the fused feature vector; the result output module 808 is used to output the gas type identification result and concentration prediction result of volatile organic compounds based on the fused feature vector through a classification and regression fully connected layer.

[0196] It should be understood that the operation and functions of the relevant modules mentioned in the VOCs gas detection system can be referenced above. Figures 1 to 7 To avoid repetition, the gas detection methods for VOCs provided will not be described in detail here.

[0197] Figure 9 The diagram shown is a structural schematic of an electronic device provided in an exemplary embodiment of this application. Figure 9 As shown, the electronic device 90 includes one or more processors 901 and memory 902.

[0198] The processor 901 may be a central processing unit (CPU) or other form of processing unit with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 90 to perform desired functions.

[0199] The memory 902 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 901 may execute the program instructions to implement feature fusion, average pooling, and / or other desired functions of the various embodiments of this application described above. Various contents such as gas attribute fields and adjacency matrices may also be stored in the computer-readable storage medium.

[0200] In one example, the electronic device 90 may also include an input device 903 and an output device 904, which are interconnected via a bus system and / or other forms of connection mechanism (not shown).

[0201] The input device 903 may include, for example, a keyboard, a mouse, etc.

[0202] The output device 904 can output various information to the outside, including gas type and gas concentration. The output device 904 may include, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, etc.

[0203] Of course, for the sake of simplicity, Figure 9 Only some of the components of the electronic device 90 relevant to this application are shown in this illustration; components such as buses, input / output interfaces, etc., are omitted. In addition, the electronic device 90 may include any other suitable components depending on the specific application.

[0204] In addition to the methods and apparatus described above, embodiments of this application may also be computer program products, which include computer program instructions that, when executed by a processor, cause the processor to perform the steps in the gas detection methods for VOCs according to various embodiments of this application described above.

[0205] Computer program products can be written in any combination of one or more programming languages ​​to perform the operations of the embodiments of this application. The programming languages ​​include object-oriented programming languages ​​such as Java and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0206] Furthermore, embodiments of this application may also be computer-readable storage media storing computer program instructions thereon, which, when executed by a processor, cause the processor to perform the steps of the VOCs gas detection method according to the various embodiments of this application described above.

[0207] Computer-readable storage media may take the form of any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may, for example, include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0208] The basic principles of this application have been described above with reference to specific embodiments. However, it should be noted that the advantages, benefits, and effects mentioned in this application are merely examples and not limitations, and should not be considered as essential features of each embodiment of this application. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the application to the necessity of employing the aforementioned specific details for implementation.

[0209] The block diagrams of devices, apparatuses, devices, and systems involved in this application are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, apparatuses, devices, and systems can be connected, arranged, and configured in any manner. Words such as “comprising,” “including,” “having,” etc., are open-ended terms meaning “including but not limited to,” and are used interchangeably with them. The terms “or” and “and” as used herein refer to the terms “and / or,” and are used interchangeably with them unless the context clearly indicates otherwise. The term “such as” as used herein refers to the phrase “such as but not limited to,” and is used interchangeably with it.

[0210] It should also be noted that in the apparatus, equipment, and methods of this application, the components or steps can be disassembled and / or recombined. These disassemblies and / or recombinations should be considered as equivalent solutions of this application.

[0211] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use this application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein can be applied to other aspects without departing from the scope of this application. Therefore, this application is not intended to be limited to the aspects shown herein, but rather to be accorded the widest scope consistent with the principles and novel features disclosed herein.

[0212] The above description has been given for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of this application to the forms disclosed herein. Although numerous exemplary aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations thereof.

Claims

1. A method for detecting VOCs gases, characterized in that, Implemented based on sensor arrays, including: A key-value pair mapping list is created based on a preset knowledge source file, and an initial feature matrix and an adjacency matrix are obtained through the key-value pair mapping list; Obtain the raw data of the sensor array and the adjacency matrix, and calculate the spatiotemporal fusion feature vector; Based on the initial feature matrix and the adjacency matrix, a knowledge feature matrix is ​​calculated using a graph neural network model; The spatiotemporal fusion feature vector and the knowledge feature matrix are subjected to knowledge-guided adaptive fusion to obtain a fusion feature vector, including: The spatiotemporal fusion feature vector is projected into a query matrix, and the knowledge feature matrix is ​​projected into a key matrix and a value matrix; Based on the query matrix, the attention weight of the query matrix and each key vector in the key matrix is ​​calculated, and the attention weight represents the correlation between the sensor signal and the prior knowledge of each gas. The value matrix is ​​weighted and summed according to the attention weights to generate a knowledge context vector; The spatiotemporal fusion feature vector and the knowledge context vector are weighted and fused through a gating mechanism to generate the fused feature vector; wherein, the gating mechanism dynamically generates a gating value based on the concatenation information of the spatiotemporal fusion feature vector and the knowledge context vector to adaptively control the fusion ratio of the two. Based on the fused feature vector, a classification and regression fully connected layer is used to output the gas type identification results and concentration prediction results of volatile organic compounds.

2. The method for detecting VOCs gas according to claim 1, characterized in that, The process of obtaining the initial feature matrix through the key-value pair mapping list includes: Based on the key-value pair mapping list, the keys are traversed in alphabetical order of gas names to obtain a node list and node indexes. The node list refers to using different gas types as nodes. Traverse the node list and obtain gas attribute fields from the knowledge source file for each gas. The gas attribute fields include molecular weight, boiling point, safe concentration threshold, and functional groups. After standardizing the molecular weight, boiling point and safe concentration threshold, the data are stored in a one-dimensional array to obtain a feature vector. The feature vector stores the physicochemical properties of each gas type. Based on the functional groups, one-hot encoding is performed using the functional group vocabulary, and then concatenated to the feature vector; After traversal, the feature vectors of multiple gases are stored in a two-dimensional array to obtain the initial feature matrix.

3. The method for detecting VOCs gas according to claim 2, characterized in that, The process of obtaining the adjacency matrix through the key-value pair mapping list includes: Based on the key-value pair mapping list, create a two-dimensional array where the rows and columns of the two-dimensional array represent nodes of different gas types, and all elements are set to 0; By traversing all node pairs through a double loop, the molecular formula and functional groups of the gas are obtained from the node list. Based on the molecular formula, calculate the Tani similarity coefficient of the node pair, and / or determine whether the node pair shares functional groups based on the functional groups; Based on the Tani similarity coefficient and / or the shared functional group judgment result, establish association edges between the corresponding node pairs; After traversal is complete, the two-dimensional array is used as the adjacency matrix.

4. The method for detecting VOCs gas according to claim 3, characterized in that, The step of calculating the Tani similarity coefficient of the node pair based on the molecular formula, and / or determining whether the node pair shares functional groups based on the functional groups, includes: The molecular formula is converted into a molecular fingerprint, and the Tani similarity coefficient of the node pair is calculated based on the molecular fingerprint. If the similarity coefficient of the Tani is greater than the preset similarity threshold, then the element of the node pair is set to 1; And / or, based on the functional groups, calculate the intersection of the functional groups of the node pairs; if the intersection is not empty, then the elements of the node pairs are set to 1.

5. A method for detecting VOCs gas according to any one of claims 1-3, characterized in that, The step of acquiring the raw data of the sensor array and the adjacency matrix, and calculating the spatiotemporal fusion feature vector, includes: The raw data of the sensor array is obtained and pooled along the time dimension and the sensor dimension respectively to obtain the channel attention weight vector and the time attention weight vector. The enhanced feature matrix is ​​obtained based on the channel attention weight vector and the temporal attention weight vector. The time series of each sensor is extracted from the enhanced feature matrix and processed through multiple convolutional network layers to obtain a temporal feature tensor; The temporal feature tensors of multiple sensors are averaged and then stacked to obtain a node feature matrix. Based on the node feature matrix and the adjacency matrix, the mean value of all sensor node features is calculated to obtain the spatiotemporal fusion feature vector, which characterizes the overall response mode of the sensor array.

6. The method for detecting VOCs gas according to claim 5, characterized in that, The step of extracting the time series of each sensor from the enhanced feature matrix and processing it through multiple convolutional layers to obtain a temporal feature tensor includes: Based on the time series, the convolutional network is traversed, and the output vector of a single time series is calculated through the dilation rate and convolution kernel of the convolutional network. Applying an activation function to the output vector of the time series yields a time series feature vector; Use the temporal feature vector of the previous convolutional layer as the input vector of the next convolutional layer. After the traversal is completed, the temporal feature vector output from the last layer is used as the temporal feature tensor for each sensor.

7. A VOCs gas detection system, characterized in that, Implemented based on sensor arrays, including: The data acquisition module is used to create a key-value pair mapping list based on a preset knowledge source file, and obtain an initial feature matrix and an adjacency matrix through the key-value pair mapping list; The spatiotemporal feature extraction module is used to obtain the original data of the sensor array and the adjacency matrix, and calculate the spatiotemporal fusion feature vector. The knowledge feature extraction module is used to calculate the knowledge feature matrix based on the initial feature matrix and the adjacency matrix through a graph neural network model. The feature fusion module is used to perform knowledge-guided adaptive fusion of the spatiotemporal fusion feature vector and the knowledge feature matrix to obtain a fused feature vector. This includes: projecting the spatiotemporal fusion feature vector into a query matrix and projecting the knowledge feature matrix into a key matrix and a value matrix; calculating the attention weight of each key vector in the query matrix and the key matrix based on the query matrix, where the attention weight represents the correlation between the sensor signal and prior knowledge of each gas; performing a weighted summation of the value matrix based on the attention weight to generate a knowledge context vector; and performing a weighted fusion of the spatiotemporal fusion feature vector and the knowledge context vector through a gating mechanism to generate the fused feature vector. The gating mechanism dynamically generates a gating value based on the concatenation information of the spatiotemporal fusion feature vector and the knowledge context vector to adaptively control the fusion ratio between the two. The results output module is used to output the gas type identification results and concentration prediction results of volatile organic compounds based on the fused feature vector through a classification and regression fully connected layer.

8. An electronic device, characterized in that, include: Processor; and A memory that stores computer program instructions, which, when executed by a processor, cause the processor to perform the steps of the method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, A computer-readable storage medium stores computer program instructions that, when executed by a processor, cause the processor to perform the steps of the method as described in any one of claims 1 to 6.