A multi-task cooperative gas detection method based on sensor array signals
Patent Information
- Application Number
- CN202611128213.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-28
- Publication Date
- 2026-10-20
AI Technical Summary
[0005]如何在同一气体检测系统中同时实现混合气体种类识别与多组分浓度同步定量输出,以克服现有方案中交叉干扰严重导致识别准确率低、定性与定量功能分离导致系统复杂的问题
[0029]本发明采用多个金属氧化物半导体气体传感器组成的阵列采集响应信号,不同气体在各传感器上形成差异化响应模式,为气体种类识别提供数据基础;同步采集温湿度值并融入原始响应向量形成增广向量,再按时间序列堆叠为数据张量,使温湿度作为同等输入维度参与后续全部计算过程。将数据张量同时输入类别计算路径和浓度计算路径,两条路径的计算参数相互独立,类别计算路径输出类别概率分布并取最大概率对应的气体类别作为初步识别类别且记录该最大概率值,浓度计算路径输出浓度向量,以初步识别类别在浓度向量中的对应位置取出浓度值,当该浓度值大于零且最大概率值大于预设概率阈值时输出初步识别类别和该浓度值,否则取浓度向量中最大元素对应的类别和该最大浓度值输出。通过类别计算路径输出与浓度计算路径输出之间的双重判定和相互校验,单一系统在一次测量中同步输出气体种类识别结果与多组分浓度值,解决了混合气体交叉干扰导致识别准确率低以及定性与定量功能分离导致系统复杂的问题。
Smart Images

Figure FT_1
Abstract
Description
Technical Field
[0001] This invention relates to the field of gas detection technology, and more specifically to a multi-task collaborative gas detection method based on sensor array signals. Background Technology
[0002] Gas detection technology has wide applications in environmental monitoring, industrial safety, and indoor air quality control. With increasing societal concern about air quality, the demand for detecting harmful gases such as volatile organic compounds (VOCs) continues to grow. In typical application scenarios such as chemical production workshops, renovation environments, and furniture manufacturing plants, various VOCs, including formaldehyde, ethanol, ethyl acetate, benzene, and pentanone, often exist in the air in mixed forms. This requires gas detection equipment not only to identify the gases present in the air but also to simultaneously output the specific concentration values of each gas in order to assess the environmental risk level and take appropriate measures.
[0003] In existing gas detection solutions, detection devices based on metal-oxide-semiconductor (MOS) sensors are widely used due to their low cost and fast response speed. However, existing solutions typically use a single type or a small number of sensors to form the detection system. When facing a mixed gas environment, different gases produce cross-responses on the same sensor surface, and the electrical signal output by the sensor is the result of the combined effect of multiple gases. This makes it difficult for the system to distinguish between structurally similar target gases and interfering gases, resulting in low identification accuracy. Furthermore, existing solutions generally implement gas type identification and quantitative concentration measurement as two independent functions. Some systems use chromatography or mass spectrometry for component analysis to complete qualitative identification, and then use dedicated sensors for concentration calibration to achieve quantitative measurement. The overall system architecture is complex, the equipment is large, and the cost is high, making it difficult to meet the needs of rapid on-site detection. Therefore, how to simultaneously achieve mixed gas type identification and synchronous quantitative output of multi-component concentrations in a single detection system has become a technical problem that urgently needs to be solved in the field of gas detection. Summary of the Invention
[0004] The purpose of this invention is to provide a multi-task collaborative gas detection method based on sensor array signals, and to solve the following technical problems:
[0005] How to simultaneously identify mixed gas types and output the quantitative concentration of multiple components in the same gas detection system, so as to overcome the problems of low identification accuracy due to severe cross-interference and system complexity due to the separation of qualitative and quantitative functions in the existing solutions.
[0006] The objective of this invention can be achieved through the following technical solutions:
[0007] A multi-task collaborative gas detection method based on sensor array signals includes the following steps:
[0008] S1. Collect the response signals of each sensor in the gas sensor array under the target gas environment at a fixed sampling frequency, and assemble the response signals of each sensor at the same time into an original response vector in sequence.
[0009] S2. Simultaneously collect ambient temperature and relative humidity, append temperature and humidity values to the end of the original response vector to form an augmented vector, and stack multiple augmented vectors into a data tensor according to the time series.
[0010] S3. Input the data tensor into both the category calculation path and the concentration calculation path simultaneously, with the calculation parameters of the two paths being independent of each other;
[0011] S4. After performing nonlinear mapping on the data tensor, the category calculation path outputs the category probability distribution. The gas category corresponding to the highest probability is taken as the initial identification category, and the highest probability value is recorded.
[0012] S5. The concentration calculation path performs a nonlinear mapping on the data tensor and outputs a concentration vector. Each element in the concentration vector corresponds to the concentration value of each type of gas in order of category.
[0013] S6. Take the concentration value at the position corresponding to the initially identified category in the concentration vector; if the concentration value is greater than zero and the maximum probability value is greater than the preset probability threshold, output the initially identified category and the concentration value; otherwise, take the category corresponding to the largest element in the concentration vector and output the maximum concentration value.
[0014] As a further aspect of the present invention, the specific process in S1 is as follows:
[0015] The gas sensor array consists of multiple metal oxide semiconductor gas sensors. The resistance value of each metal oxide semiconductor gas sensor changes when exposed to a reducing gas environment. The voltage value across each metal oxide semiconductor gas sensor is collected, and the resistance value of the metal oxide semiconductor gas sensor is obtained by dividing the voltage value by a preset constant bias current value. The resistance values of all metal oxide semiconductor gas sensors collected at each sampling time are arranged in ascending order according to the physical arrangement number of the sensors in the array. After the arrangement is completed, the original response vector corresponding to the sampling time is formed.
[0016] As a further aspect of the present invention: in S2, the specific process of stacking multiple augmented vectors into a data tensor according to the time series is as follows:
[0017] Whenever an augmented vector is acquired and formed, it is stored at the tail of the cache queue. After storage, it is checked whether the total number of augmented vectors currently stored in the cache queue exceeds a preset queue depth value. If it exceeds the queue depth value, the earliest stored augmented vector is removed from the head of the cache queue. The head removal operation is repeated until the total number of augmented vectors currently stored in the cache queue equals the queue depth value. All augmented vectors currently stored in the cache queue are stacked in the third dimension in order from the head to the tail, forming a three-dimensional data tensor.
[0018] As a further aspect of the present invention: the specific process of appending the temperature and humidity values to the end of the original response vector to form an augmented vector in step S2 is as follows:
[0019] After collecting ambient temperature and relative humidity values at each sampling time, the ambient temperature value is divided by a preset temperature normalization base to obtain a normalized temperature value, and the relative humidity value is divided by a preset humidity normalization base to obtain a normalized humidity value. The normalized temperature value and the normalized humidity value are then written sequentially to the position after the last element of the original response vector. After writing is completed, the augmented vector corresponding to that sampling time is obtained.
[0020] As a further aspect of the present invention, the specific process of S3 is as follows:
[0021] The category calculation path and the concentration calculation path each independently receive the same data tensor. After receiving the data tensor, the category calculation path performs a nonlinear transformation layer by layer according to the preset inter-layer connection order in the category calculation path. After receiving the data tensor, the concentration calculation path performs a nonlinear transformation layer by layer according to the preset inter-layer connection order in the concentration calculation path. Data is transferred between layers in the category calculation path using a first connection weight, and between layers in the concentration calculation path using a second connection weight. The first connection weight and the second connection weight are numerically different. The category calculation path reads only the first connection weight during the nonlinear transformation process, and the concentration calculation path reads only the second connection weight during the nonlinear transformation process.
[0022] As a further aspect of the present invention, the specific process of S4 is as follows:
[0023] The category calculation path includes multiple layers of nonlinear calculation units connected in series. The output of the previous nonlinear calculation unit serves as the input of the next nonlinear calculation unit. Each nonlinear calculation unit performs a multiplication and addition calculation on the received feature vector and the category weight matrix stored in that layer. The result of the multiplication and addition calculation is input into an activation function for numerical transformation and then output to the next layer. The activation function type of the previous nonlinear calculation unit is different from that of the next nonlinear calculation unit. The output of the last nonlinear calculation unit is mapped to form a category probability distribution vector. The element with the largest value is taken from the category probability distribution vector as the maximum probability value. The maximum probability value is written into a designated storage unit. The position of the maximum probability value in the category probability distribution vector is mapped to the gas category and recorded as the preliminary identification category.
[0024] As a further aspect of the present invention, the specific process of S5 is as follows:
[0025] The concentration calculation path consists of a concentration input layer, a concentration intermediate calculation layer, and a concentration output layer connected in series. The data tensor is input into the concentration input layer, which expands the data tensor into a one-dimensional feature vector and then passes it to the concentration intermediate calculation layer. The concentration intermediate calculation layer contains multiple layers of nonlinear calculation units connected in series. Each nonlinear calculation unit receives the intermediate feature vector output from the previous layer, performs a multiplication and addition calculation on the intermediate feature vector and the concentration weight matrix stored in that layer, and inputs the result of the multiplication and addition calculation into an activation function to perform a numerical transformation before outputting it to the next layer. The feature vector output from the last layer of the concentration intermediate calculation layer is passed to the concentration output layer. The concentration output layer maps the received feature vector into a concentration vector and outputs it. The position of each element in the concentration vector is bound to a preset gas category.
[0026] As a further aspect of the present invention, the specific process of S6 is as follows:
[0027] Obtain the category number of the preliminary identification category, determine the position index of the preliminary identification category in the concentration vector based on the category number, retrieve the corresponding concentration value from the concentration vector using the position index, and simultaneously read the maximum probability value from the designated storage unit. Compare the maximum probability value with a preset probability threshold. If the concentration value is greater than zero and the maximum probability value is greater than the preset probability threshold, then the preliminary identification category and the concentration value are used as the output result. If the concentration value is equal to zero or the maximum probability value is less than or equal to the preset probability threshold, then the element with the largest value is retrieved from the concentration vector, and the position index of this element in the concentration vector is used to correspond to a preset gas category. The preset gas category and the element with the largest value are used together as the output result.
[0028] The beneficial effects of this invention are:
[0029] This invention employs an array of multiple metal-oxide-semiconductor (MOS) gas sensors to acquire response signals. Different gases exhibit differentiated response patterns on each sensor, providing a data foundation for gas type identification. Temperature and humidity values are simultaneously acquired and integrated into the original response vector to form an augmented vector, which is then stacked in a time series to form a data tensor. This ensures that temperature and humidity participate in all subsequent calculations as equal input dimensions. The data tensor is simultaneously input into both the category calculation path and the concentration calculation path. The calculation parameters of the two paths are independent. The category calculation path outputs a category probability distribution and selects the gas category with the highest probability as the initial identification category, recording this maximum probability value. The concentration calculation path outputs a concentration vector, extracting the concentration value corresponding to the initial identification category at its corresponding position in the concentration vector. If the concentration value is greater than zero and the maximum probability value is greater than a preset probability threshold, the initial identification category and the concentration value are output; otherwise, the category corresponding to the largest element in the concentration vector and the maximum concentration value are output. Through dual judgment and mutual verification between the outputs of the category calculation path and the concentration calculation path, a single system simultaneously outputs gas type identification results and multi-component concentration values in a single measurement. This solves the problems of low identification accuracy due to cross-interference from mixed gases and system complexity caused by the separation of qualitative and quantitative functions. Attached Figure Description
[0030] The invention will now be further described with reference to the accompanying drawings.
[0031] Figure 1 This is a flowchart illustrating the present invention. Detailed Implementation
[0032] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0033] Please see Figure 1 As shown, this invention is a multi-task collaborative gas detection method based on sensor array signals, comprising the following steps:
[0034] S1. Collect the response signals of each sensor in the gas sensor array under the target gas environment at a fixed sampling frequency, and assemble the response signals of each sensor at the same time into an original response vector in sequence.
[0035] S2. Simultaneously collect ambient temperature and relative humidity, append temperature and humidity values to the end of the original response vector to form an augmented vector, and stack multiple augmented vectors into a data tensor according to the time series.
[0036] S3. Input the data tensor into both the category calculation path and the concentration calculation path simultaneously, with the calculation parameters of the two paths being independent of each other;
[0037] S4. After performing nonlinear mapping on the data tensor, the category calculation path outputs the category probability distribution. The gas category corresponding to the highest probability is taken as the initial identification category, and the highest probability value is recorded.
[0038] S5. The concentration calculation path performs a nonlinear mapping on the data tensor and outputs a concentration vector. Each element in the concentration vector corresponds to the concentration value of each type of gas in order of category.
[0039] S6. Take the concentration value at the position corresponding to the initially identified category in the concentration vector; if the concentration value is greater than zero and the maximum probability value is greater than the preset probability threshold, output the initially identified category and the concentration value; otherwise, take the category corresponding to the largest element in the concentration vector and output the maximum concentration value.
[0040] In another preferred embodiment of the present invention, the specific process in S1 is as follows:
[0041] The gas sensor array consists of 25 metal-oxide-semiconductor (MOS) gas sensors arranged in a 5x5 matrix on a circuit board. Each MOS gas sensor comprises a gas-sensitive material and a heating resistor. The gas-sensitive material is a nano-particle tin oxide or zinc oxide semiconductor material. The heating resistor heats up when energized, raising the gas-sensitive material to a constant operating temperature between 300°C and 400°C, which remains constant throughout the data acquisition process. When reducing gas molecules in the target gas environment undergo a redox reaction with oxygen ions adsorbed on the surface of the gas-sensitive material, the resistance of the gas-sensitive material changes.
[0042] To measure the resistance of each sensor, a constant bias current of 100 microamps, provided by a constant current source circuit, is applied across each metal-oxide-semiconductor gas sensor. This constant current value is continuously output throughout the acquisition process and remains unchanged regardless of the load. The acquisition circuit simultaneously samples the voltage values across all 25 sensors at a sampling frequency of 100 times per second. Dividing the voltage value across each sensor by the constant bias current of 100 microamps yields the resistance value of that sensor at the current sampling moment.
[0043] The physical arrangement and numbering of 25 sensors on the circuit board are pre-defined. The sensor in the first row and first column is numbered 1, the sensor in the first row and second column is numbered 2, and so on, increasing sequentially until the sensor in the fifth row and fifth column is numbered 25. After each sampling time, the resistance values of all 25 sensors collected at that sampling time are arranged in ascending order of their physical arrangement numbers. The resistance value of number 1 is placed in the first position, the resistance value of number 2 is placed in the second position, and so on, until the resistance value of number 25 is placed in the 25th position. After arrangement, a 25-dimensional original response vector is obtained, which is the original response vector for that sampling time. The above acquisition, division calculation, and arrangement operations are repeated for each sampling time, thereby generating an original response vector corresponding to each sampling time.
[0044] In another preferred embodiment of the present invention, the specific process of stacking multiple augmented vectors into a data tensor according to a time series in step S2 is as follows:
[0045] After each sampling moment completes the acquisition and forms an augmented vector, the augmented vector is stored at the tail of the buffer queue. The buffer queue is a first-in, first-out (FIFO) data structure with a pre-defined queue depth of 10. After each new augmented vector is stored, the total number of augmented vectors currently stored in the buffer queue is checked to see if it exceeds the queue depth of 10. If the total number of augmented vectors is 11, it exceeds the queue depth of 10. In this case, the earliest-stored augmented vector is removed from the head of the buffer queue; that is, the earliest-stored augmented vector is removed. After removal, the total number of augmented vectors currently stored in the buffer queue is checked again. If it still exceeds 10, the earliest-stored augmented vector is removed from the head of the queue, and the above checking and removal operations are repeated until the total number of augmented vectors currently stored in the buffer queue equals the queue depth of 10. At this point, the cache queue stores augmented vectors formed in the last 10 sampling times. The earliest augmented vector is removed, and the latest augmented vector is located at the tail of the queue.
[0046] After completing the above update operations, retrieve all 10 augmented vectors currently stored in the cache queue. Stack these 10 augmented vectors one by one along the third dimension, from the head to the tail (i.e., from the earliest stored augmented vector to the latest stored one). Each augmented vector is a one-dimensional vector containing 27 elements. Stacking these 10 one-dimensional augmented vectors along the third dimension forms a 10x27 three-dimensional data tensor. The first dimension corresponds to the time series direction and has a length of 10; the second dimension corresponds to the sensor response and temperature / humidity data direction and has a length of 27; and the third dimension is the stacking direction. This three-dimensional data tensor constitutes the input data for subsequent calculation steps. After a new augmented vector is generated at the next sampling time, store this new augmented vector at the tail of the cache queue. Repeat the above checks, removal of the head vector, and stacking operations to generate a new three-dimensional data tensor, thus generating a three-dimensional data tensor corresponding to the current cache queue content at each sampling time.
[0047] In another preferred embodiment of the present invention, the specific process of appending the temperature and humidity values to the end of the original response vector to form an augmented vector in step S2 is as follows:
[0048] At each sampling moment, ambient temperature and relative humidity values are acquired synchronously with the resistance values of 25 sensors. The temperature sensor is a resistive type, and the humidity sensor is a capacitive type. Both the temperature and humidity sensors are integrated onto the same circuit board with the 25-sensor array, operating within the same target gas environment. At the designated sampling moment, the temperature sensor outputs a current analog voltage value, which is proportional to the ambient temperature. The acquisition circuit reads this analog voltage value and quantizes it into a digital value to obtain the digital temperature value. Similarly, the humidity sensor outputs a current analog voltage or frequency value, which is proportional to the current relative humidity. The acquisition circuit reads this value, quantizes it, and obtains the digital humidity value.
[0049] After obtaining the digital values of temperature and humidity, the digital temperature value is divided by a preset temperature normalization base to obtain a normalized temperature value. The temperature normalization base is 100, meaning that the normalized temperature value obtained by dividing the digital temperature value by 100 is between 0 and 1. Similarly, the digital humidity value is divided by a preset humidity normalization base to obtain a normalized humidity value. The humidity normalization base is 100, meaning that the normalized humidity value obtained by dividing the digital humidity value by 100 is between 0 and 1.
[0050] After normalization, the original response vector for that sampling moment is obtained. This original response vector is a 25-dimensional vector containing the resistance values of 25 sensors. The 25th element of this original response vector is taken; this is the last element of the original response vector. The normalized temperature value is written after the 25th element, becoming the 26th element of the original response vector. The normalized humidity value is written after the normalized temperature value, becoming the 27th element of the original response vector. After writing, the original 25-dimensional original response vector is expanded into a 27-dimensional vector. The first 25 elements are still the resistance values of the 25 sensors, the 26th element is the normalized temperature value, and the 27th element is the normalized humidity value. This 27-dimensional vector is the augmented vector corresponding to that sampling moment. The above normalization and writing operations are performed at each sampling moment, thus forming an augmented vector corresponding to each sampling moment.
[0051] In another preferred embodiment of the present invention, the specific process of S3 is as follows:
[0052] The category calculation path and concentration calculation path are pre-deployed within the microprocessor, which is a dual-core ESP32 microprocessor. The category calculation path is deployed on the first processor core, and the concentration calculation path is deployed on the second processor core. After the cache queue is updated and stacked to form a three-dimensional data tensor, this three-dimensional data tensor is stored at a specified starting address in the microprocessor's internal random access memory. The first processor core reads the three-dimensional data tensor from this specified starting address, and simultaneously, the second processor core also reads the same three-dimensional data tensor from the same specified starting address. The first and second processor cores initiate read operations within the same clock cycle, each independently acquiring the entire data content of the three-dimensional data tensor.
[0053] The category calculation path pre-defines multiple cascaded nonlinear calculation layers. Each nonlinear calculation layer contains a weight matrix, and the values in this weight matrix are pre-trained parameters. The first processor core executes the calculation layer by layer in order from the first layer to the last layer. In each layer, the first processor core retrieves the weight matrix stored in that layer, performs a multiplication-addition operation on the received input data with the weight matrix, and then inputs the result of the multiplication-addition operation into the pre-defined activation function of that layer for numerical transformation. After the transformation is completed, the result data is passed to the next layer as the input data for that next layer. The concentration calculation path also pre-defines multiple cascaded nonlinear calculation layers. Each nonlinear calculation layer contains a weight matrix, and the values in this weight matrix are different from those in the weight matrix of the category calculation path, representing independent parameters obtained in pre-training. The second processor core executes the calculation layer by layer in order from the first layer to the last layer. In each layer, the second processor core retrieves the weight matrix stored in that layer, performs a multiplication-addition operation on the received input data with the weight matrix, and then inputs the result of the multiplication-addition operation into the pre-defined activation function of that layer for numerical transformation. After the transformation is completed, the result data is passed to the next layer as the input data for that next layer.
[0054] The weight matrices for each layer in the category calculation path are stored in the first storage area within the microprocessor, while the weight matrices for each layer in the concentration calculation path are stored in the second storage area within the microprocessor. The physical address ranges of the first and second storage areas do not overlap. When performing calculations, the first processor core only accesses addresses in the first storage area to read the weight matrix values, and the second processor core only accesses addresses in the second storage area to read the weight matrix values. The first processor core does not access addresses in the second storage area, and the second processor core does not access addresses in the first storage area. The first and second processor cores independently execute the aforementioned layer-by-layer calculations. During execution, the two processor cores do not send data to each other or wait for each other's calculation progress; each proceeds independently according to its own calculation speed until it has completed the calculations for all layers.
[0055] In another preferred embodiment of the present invention, the specific process of S4 is as follows:
[0056] The category computation path is deployed in the first processor core of the microprocessor. This path consists of an input layer, four intermediate hidden layers, and an output layer, which are sequentially connected in series, with the output of the previous layer serving as the input of the next. Upon receiving a 3D data tensor, the input layer extracts each element of the tensor in the following order: first along the second dimension, then along the first dimension, and finally along the third dimension, arranging them into a one-dimensional feature vector. The length of this one-dimensional feature vector is equal to the first dimension length (10) multiplied by the second dimension length (27) of the 3D data tensor, meaning it contains 270 elements arranged in the order they were extracted from the 3D data tensor. The input layer then passes the arranged one-dimensional feature vector to the first intermediate hidden layer.
[0057] The first intermediate hidden layer receives the one-dimensional feature vector and uses its 270 elements as input data. This first intermediate hidden layer stores a class weight matrix with 128 rows and 270 columns, where each element is a pre-determined value. The first intermediate hidden layer multiplies each of the 270 elements in the input data with the corresponding 270 elements of the first column of the class weight matrix and sums the multiplications to obtain a weighted sum for the first column. This process is repeated for the second to 128th columns of the class weight matrix, resulting in 128 weighted sums. These 128 weighted sums are then arranged to form a 128-dimensional vector. The first intermediate hidden layer inputs this 128-dimensional vector into its pre-defined activation function, a linear rectified unit (RCU). The activation function transforms all elements less than 0 in the 128-dimensional vector to 0, while leaving elements greater than or equal to 0 unchanged. After this transformation, a 128-dimensional output feature vector is obtained, which is then passed to the second intermediate hidden layer.
[0058] After receiving the 128-dimensional feature vector, the second intermediate hidden layer performs a multiply-add operation on the received 128-dimensional feature vector and the class weight matrix stored in the second intermediate hidden layer using the same multiply-add operation method. The class weight matrix of the second intermediate hidden layer has 64 rows and 128 columns. After the operation, a 64-dimensional vector is obtained. This 64-dimensional vector is input into the preset activation function of this layer. The activation function of the second intermediate hidden layer is different from the activation function of the first intermediate hidden layer. The activation function of the second intermediate hidden layer is a hyperbolic tangent function. This activation function maps the value of each element in the 64-dimensional vector to the range of negative 1 to positive 1. After the mapping is completed, a 64-dimensional output feature vector is obtained and passed to the third intermediate hidden layer. The third and fourth intermediate hidden layers perform multiplication-addition calculations and activation function transformations sequentially. The class weight matrix of the third intermediate hidden layer has 64 rows and 64 columns, and its activation function type is rectified linear unit (RCU). The class weight matrix of the fourth intermediate hidden layer has 32 rows and 64 columns, and its activation function type is also RCU. The activation function types of the third and fourth intermediate hidden layers are the same, the activation function type of the first and third intermediate hidden layers is the same, and the activation function type of the second intermediate hidden layer is different from both the first and third intermediate hidden layers. After the fourth intermediate hidden layer completes its calculations, it outputs a 32-dimensional feature vector, which is then passed to the output layer.
[0059] After receiving the 32-dimensional feature vector, the output layer stores a mapping matrix with 16 rows and 32 columns. The 16 rows represent the total number of target categories, including 5 single gas categories, 10 two-gas mixture categories, and 1 zero-point category. The output layer multiplies and adds the 32-dimensional feature vector to the mapping matrix, obtaining 16 log-probability values. These 16 log-probability values are then input into a flexible maximum activation function. The flexible maximum activation function exponentially operates on each of the 16 log-probability values and normalizes them, ensuring that all 16 output values are between 0 and 1 and that the sum of the 16 output values equals 1. These 16 output values constitute the category probability distribution vector. The values of the 16 elements in the category probability distribution vector are compared one by one, and the value of the element with the largest value is recorded as the maximum probability value. This maximum probability value is written into the microprocessor's register, and its position index in the category probability distribution vector is also recorded. Based on this position index, the corresponding gas category name is searched in a preset category mapping table, and this gas category name is recorded as the initial identification category.
[0060] In another preferred embodiment of the present invention, the specific process of S5 is as follows:
[0061] The concentration calculation path is deployed in the second processor core of the microprocessor. This path includes a concentration input layer, three intermediate concentration hidden layers, and a concentration output layer, which are connected in series. The output of the previous layer serves as the input of the next layer. The concentration input layer receives a three-dimensional data tensor formed by stacked buffer queues. This three-dimensional data tensor has a size of 10 x 27, where the first dimension is 10 and the second dimension is 27. The concentration input layer extracts each element of this three-dimensional data tensor in the following order: first, it extracts elements one by one along the second dimension; then, it extracts elements along the first dimension; and finally, it extracts elements along the third dimension. The extracted elements are then arranged into a one-dimensional feature vector containing 270 elements. After arrangement, the concentration input layer passes this one-dimensional feature vector to the first intermediate concentration hidden layer.
[0062] After receiving the 270-dimensional feature vector, the first concentration intermediate hidden layer uses it as its input data. This layer stores a concentration weight matrix with 128 rows and 270 columns, where each element is a pre-determined value. The first concentration intermediate hidden layer multiplies each of the 270 elements in the input data with the corresponding 270 elements in the first column of the concentration weight matrix, summing the results to obtain a weighted sum. This weighted sum corresponds to the first element in the output vector. The first concentration intermediate hidden layer repeats this multiplication and addition operation on columns 2 through 128 of the concentration weight matrix, obtaining 128 weighted sums. These 128 weighted sums are then arranged in ascending order of column number to form a 128-dimensional vector. The first concentration intermediate hidden layer inputs the 128-dimensional vector into the preset activation function of the layer. The activation function is a linear rectified unit. The linear rectified unit transforms the value of each element less than 0 in the 128-dimensional vector to 0, and keeps the value of the elements greater than or equal to 0 unchanged. After the transformation, a 128-dimensional output feature vector is obtained, which is passed to the second concentration intermediate hidden layer.
[0063] After receiving the 128-dimensional feature vector, the second concentration intermediate hidden layer performs a multiply-add operation on the received 128-dimensional feature vector and the concentration weight matrix stored in the second concentration intermediate hidden layer using the same multiply-add operation method. The concentration weight matrix of the second concentration intermediate hidden layer has 64 rows and 128 columns. After the operation, a 64-dimensional vector is obtained. This 64-dimensional vector is input into the preset activation function of this layer. The activation function of the second concentration intermediate hidden layer is of the same type as the activation function of the first concentration intermediate hidden layer. Both are linear rectified units. The activation function transforms the values of elements less than 0 in the 64-dimensional vector to 0, while the values of elements greater than or equal to 0 remain unchanged. After the transformation, the 64-dimensional output feature vector is passed to the third concentration intermediate hidden layer. After receiving the 64-dimensional feature vector, the third concentration intermediate hidden layer performs a multiply-add operation on the received 64-dimensional feature vector and the concentration weight matrix stored in the third concentration intermediate hidden layer using the same multiply-add operation method. The concentration weight matrix of the third concentration intermediate hidden layer has 64 rows and 64 columns. After the operation, a 64-dimensional vector is obtained. This 64-dimensional vector is input into the preset activation function of this layer. The activation function of the third concentration intermediate hidden layer is of the same type as the activation functions of the first and second concentration intermediate hidden layers. They are all linear rectified units. The activation function transforms the values of elements less than 0 in the 64-dimensional vector to 0, while the values of elements greater than or equal to 0 remain unchanged. After the transformation, a 64-dimensional output feature vector is obtained and passed to the concentration output layer.
[0064] After receiving the 64-dimensional feature vector, the concentration output layer stores a concentration mapping matrix with 5 rows and 64 columns, where 5 represents the total number of target gas types, including formaldehyde, ethanol, ethyl acetate, benzene, and pentamidine. The concentration output layer multiplies and adds the 64-dimensional feature vector to the concentration mapping matrix, obtaining five values, which are the predicted concentrations of the five target gases. The concentration output layer then arranges these five predicted concentration values according to a preset gas category order: formaldehyde (first), ethanol (second), ethyl acetate (third), benzene (fourth), and pentamidine (fifth). This arrangement results in a 5-dimensional concentration vector, where the position of each element is associated with a preset gas category.
[0065] In another preferred embodiment of the present invention, the specific process of S6 is as follows:
[0066] After the category calculation path completes its calculation, the initially identified category is recorded in the first register inside the microprocessor, the maximum probability value is recorded in the second register inside the microprocessor, and after the concentration calculation path completes its calculation, the concentration vector is stored in the third storage area inside the microprocessor.
[0067] During output determination, the microprocessor first reads the gas category name corresponding to the initially identified category from the first register. The microprocessor internally stores a category number mapping table, which records the correspondence between each gas category name and its position index in the concentration vector: formaldehyde corresponds to index 1, ethanol to index 2, ethyl acetate to index 3, benzene to index 4, and pentamidine to index 5. The microprocessor searches for the corresponding position index in the category number mapping table based on the gas category name of the initially identified category. After finding the position index, the microprocessor uses this position index as the read address offset to retrieve the concentration value at that position index from the concentration vector stored in the third storage area. This concentration value is the predicted concentration value corresponding to the initially identified category.
[0068] The microprocessor simultaneously reads the maximum probability value from the second register and compares it with a preset probability threshold, which is pre-set in the microprocessor's read-only memory and has a value of 0.7. The microprocessor then determines whether the predicted concentration value extracted from the concentration vector is greater than 0 and whether the maximum probability value is greater than the preset probability threshold of 0.7. If both the predicted concentration value and the maximum probability value are greater than 0.7, the microprocessor determines that the preliminary identification category is reliable. It outputs both the preliminary identification category and the predicted concentration value, which are then sent to the display driver circuit. The display driver circuit drives the screen to display the gas category name and concentration value, with the concentration value in parts per million (ppm).
[0069] If the predicted concentration value is 0, or the maximum probability value is less than or equal to 0.7, the microprocessor determines that the preliminary identification category is unreliable. In this case, the microprocessor retrieves the concentration value at the first position from the concentration vector stored in the third storage area as the current maximum value, and records the index of the first position as the current maximum index. The microprocessor then sequentially retrieves the concentration values at the second, third, fourth, and fifth positions in the concentration vector. Each retrieved concentration value is compared with the current maximum value. If the retrieved concentration value is greater than the current maximum value, the retrieved concentration value is updated to the current maximum value, and the index of that position is updated to the current maximum index. If the retrieved concentration value is less than or equal to the current maximum value, the current maximum value and the current maximum index remain unchanged. After traversing all five positions of the concentration vector, the microprocessor obtains the element with the largest value in the concentration vector and its corresponding position index. The microprocessor searches for the gas category name corresponding to the location index in the category number mapping table, and uses the found gas category name and the element with the largest value as the output result. The output result is transmitted to the display driver circuit, which drives the display screen to display the gas category name and concentration value. The concentration value is in parts per million.
[0070] The foregoing has provided a detailed description of one embodiment of the present invention, but this description is merely a preferred embodiment and should not be construed as limiting the scope of the invention. All equivalent variations and modifications made within the scope of the claims of this invention should still fall within the patent coverage of this invention.
Claims
1. A multi-task collaborative gas detection method based on sensor array signals, characterized in that, Includes the following steps: S1. Collect the response signals of each sensor in the gas sensor array under the target gas environment at a fixed sampling frequency, and assemble the response signals of each sensor at the same time into an original response vector in sequence. S2. Simultaneously collect ambient temperature and relative humidity, append temperature and humidity values to the end of the original response vector to form an augmented vector, and stack multiple augmented vectors into a data tensor according to the time series. S3. Input the data tensor into both the category calculation path and the concentration calculation path simultaneously, with the calculation parameters of the two paths being independent of each other; S4. After performing nonlinear mapping on the data tensor, the category calculation path outputs the category probability distribution. The gas category corresponding to the highest probability is taken as the initial identification category, and the highest probability value is recorded. S5. The concentration calculation path performs a nonlinear mapping on the data tensor and outputs a concentration vector. Each element in the concentration vector corresponds to the concentration value of each type of gas in order of category. S6. Take the concentration value at the position corresponding to the initially identified category in the concentration vector; if the concentration value is greater than zero and the maximum probability value is greater than the preset probability threshold, output the initially identified category and the concentration value; otherwise, take the category corresponding to the largest element in the concentration vector and output the maximum concentration value.
2. The multi-task collaborative gas detection method based on sensor array signals according to claim 1, characterized in that, The specific process in S1 is as follows: The gas sensor array consists of multiple metal oxide semiconductor gas sensors. The resistance value of each metal oxide semiconductor gas sensor changes when exposed to a reducing gas environment. The voltage value across each metal oxide semiconductor gas sensor is collected, and the resistance value of the metal oxide semiconductor gas sensor is obtained by dividing the voltage value by a preset constant bias current value. The resistance values of all metal oxide semiconductor gas sensors collected at each sampling time are arranged in ascending order according to the physical arrangement number of the sensors in the array. After the arrangement is completed, the original response vector corresponding to the sampling time is formed.
3. The multi-task collaborative gas detection method based on sensor array signals according to claim 1, characterized in that, In step S2, the specific process of stacking multiple augmented vectors into a data tensor according to the time series is as follows: Whenever an augmented vector is acquired and formed, it is stored at the tail of the cache queue. After storage, it is checked whether the total number of augmented vectors currently stored in the cache queue exceeds a preset queue depth value. If it exceeds the queue depth value, the earliest stored augmented vector is removed from the head of the cache queue. The head removal operation is repeated until the total number of augmented vectors currently stored in the cache queue equals the queue depth value. All augmented vectors currently stored in the cache queue are stacked in the third dimension in order from the head to the tail, forming a three-dimensional data tensor.
4. The multi-task collaborative gas detection method based on sensor array signals according to claim 3, characterized in that, In step S2, the specific process of appending temperature and humidity values to the end of the original response vector to form an augmented vector is as follows: After collecting ambient temperature and relative humidity values at each sampling time, the ambient temperature value is divided by a preset temperature normalization base to obtain a normalized temperature value, and the relative humidity value is divided by a preset humidity normalization base to obtain a normalized humidity value. The normalized temperature value and the normalized humidity value are then written sequentially to the position after the last element of the original response vector. After writing is completed, the augmented vector corresponding to that sampling time is obtained.
5. The multi-task collaborative gas detection method based on sensor array signals according to claim 1, characterized in that, The specific process of S3 is as follows: The category calculation path and the concentration calculation path each independently receive the same data tensor. After receiving the data tensor, the category calculation path performs a nonlinear transformation layer by layer according to the preset inter-layer connection order in the category calculation path. After receiving the data tensor, the concentration calculation path performs a nonlinear transformation layer by layer according to the preset inter-layer connection order in the concentration calculation path. Data is transferred between layers in the category calculation path using a first connection weight, and between layers in the concentration calculation path using a second connection weight. The first connection weight and the second connection weight are numerically different. The category calculation path reads only the first connection weight during the nonlinear transformation process, and the concentration calculation path reads only the second connection weight during the nonlinear transformation process.
6. The multi-task collaborative gas detection method based on sensor array signals according to claim 1, characterized in that, The specific process of S4 is as follows: The category calculation path includes multiple layers of nonlinear calculation units connected in series. The output of the previous nonlinear calculation unit serves as the input of the next nonlinear calculation unit. Each nonlinear calculation unit performs a multiplication and addition calculation on the received feature vector and the category weight matrix stored in that layer. The result of the multiplication and addition calculation is input into an activation function for numerical transformation and then output to the next layer. The activation function type of the previous nonlinear calculation unit is different from that of the next nonlinear calculation unit. The output of the last nonlinear calculation unit is mapped to form a category probability distribution vector. The element with the largest value is taken from the category probability distribution vector as the maximum probability value. The maximum probability value is written into a designated storage unit. The position of the maximum probability value in the category probability distribution vector is mapped to the gas category and recorded as the preliminary identification category.
7. The multi-task collaborative gas detection method based on sensor array signals according to claim 1, characterized in that, The specific process of S5 is as follows: The concentration calculation path consists of a concentration input layer, a concentration intermediate calculation layer, and a concentration output layer connected in series. The data tensor is input into the concentration input layer, which expands the data tensor into a one-dimensional feature vector and then passes it to the concentration intermediate calculation layer. The concentration intermediate calculation layer contains multiple layers of nonlinear calculation units connected in series. Each nonlinear calculation unit receives the intermediate feature vector output from the previous layer, performs a multiplication and addition calculation on the intermediate feature vector and the concentration weight matrix stored in that layer, and inputs the result of the multiplication and addition calculation into an activation function to perform a numerical transformation before outputting it to the next layer. The feature vector output from the last layer of the concentration intermediate calculation layer is passed to the concentration output layer. The concentration output layer maps the received feature vector into a concentration vector and outputs it. The position of each element in the concentration vector is bound to a preset gas category.
8. The multi-task collaborative gas detection method based on sensor array signals according to claim 6, characterized in that, The specific process of S6 is as follows: Obtain the category number of the preliminary identification category, determine the position index of the preliminary identification category in the concentration vector based on the category number, retrieve the corresponding concentration value from the concentration vector using the position index, and simultaneously read the maximum probability value from the designated storage unit. Compare the maximum probability value with a preset probability threshold. If the concentration value is greater than zero and the maximum probability value is greater than the preset probability threshold, then the preliminary identification category and the concentration value are used as the output result. If the concentration value is equal to zero or the maximum probability value is less than or equal to the preset probability threshold, then the element with the largest value is retrieved from the concentration vector, and the position index of this element in the concentration vector is used to correspond to a preset gas category. The preset gas category and the element with the largest value are used together as the output result.