Breath data analysis method and system based on gas sensor array and FPGA

By using a gas sensor array and FPGA-based exhalation data analysis method, combined with a neural network model, the operational complexity and high cost of existing exhalation analysis methods have been solved, achieving efficient and accurate exhalation data analysis that is suitable for early lung cancer screening.

CN119970004BActive Publication Date: 2025-10-24SHENZHEN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510141431.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-08
Publication Date
2025-10-24
Estimated Expiration
2045-02-08

AI Technical Summary

Technical Problem

Existing breath analysis methods require manual intervention, are complex to operate and have large errors. High-precision analyzers are large and heavy, have long analysis cycles, which limits portability and flexibility, and require high resource investment, resulting in high cost and low efficiency.

Method used

The gas sensor array and FPGA are used to analyze exhaled breath data, including data acquisition, filtering and normalization, and data prediction is performed by combining the data with a pre-set neural network model to generate target prediction results.

Benefits of technology

It improves the efficiency and accuracy of exhalation data analysis, reduces time and economic costs, achieves portability and flexibility, avoids human intervention, and is suitable for early lung cancer screening.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119970004B_ABST
    Figure CN119970004B_ABST
Patent Text Reader

Abstract

The application relates to an exhaled breath data analysis method and system based on a gas sensor array and an FPGA, wherein the method comprises the following steps: collecting exhaled gas data of a subject, and analyzing and storing the exhaled gas data to obtain initial exhaled gas data; performing filtering and normalization processing on the initial exhaled gas data to obtain target exhaled gas data; and performing data prediction processing on the target exhaled gas data through a preset neural network model to generate a target prediction result. The application can avoid manual gas analysis by collecting the exhaled gas data of the subject, performing preprocessing on the exhaled gas data, and then calling a neural network model to analyze the gas data, is beneficial to improving the gas data analysis efficiency, and can improve the accuracy of gas data analysis by analyzing the exhaled gas data through the preset neural network model.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of gas analysis, in particular to an exhaled breath data analysis method and system based on a gas sensor array and an FPGA. BACKGROUND

[0002] Most of the current breath analysis applied to early lung cancer screening is assisted by high-precision and high-sensitivity analysis instruments, such as GC-IMS (gas chromatography-ion mobility spectrometry) and GC-MS (gas chromatography-mass spectrometry).

[0003] The existing breath gas analysis has the following problems: first, the existing breath analysis method generally needs manual intervention in the feature extraction stage. The technical personnel must monitor the experimental process and subjectively judge whether the reaction curve of the breath sample meets the standard of gas analysis. This process not only requires the operator to have certain professional skills and experience, but also increases the complexity of operation and potential error sources. Second, high-precision analysis instruments are usually large in size, heavy in weight, and long in analysis period. These characteristics limit their portability and flexibility in early screening scenarios. In addition, the operation and maintenance of these instruments require high resource input, including time cost and economic cost, which may lead to inefficient use and waste of resources. Therefore, there is an urgent need for a breath data analysis method to improve the efficiency and accuracy of breath data analysis and reduce the time cost and economic cost. SUMMARY

[0004] The purpose of the embodiments of the present application is to provide an exhaled breath data analysis method and system based on a gas sensor array and an FPGA to improve the efficiency and accuracy of breath data analysis.

[0005] To solve the above technical problems, the embodiments of the present application provide an exhaled breath data analysis method based on a gas sensor array and an FPGA, comprising:

[0006] Collecting the exhaled gas data of the subjects and analyzing and storing the exhaled gas data to obtain initial exhaled gas data;

[0007] Filtering and normalizing the initial exhaled gas data to obtain target exhaled gas data;

[0008] Generating a target prediction result by performing data prediction processing on the target exhaled gas data through a pre-set neural network model.

[0009] To solve the above technical problems, the embodiments of the present application provide an exhaled breath data analysis system based on a gas sensor array and an FPGA, comprising:

[0010] A gas sensing array module for collecting the exhaled gas data of the subjects;

[0011] a gas data collection module configured to analyze and store the exhaled gas data to obtain initial exhaled gas data;

[0012] a data preprocessing module configured to filter and normalize the initial exhaled gas data to obtain target exhaled gas data;

[0013] a neural network acceleration module configured to perform data prediction processing on the target exhaled gas data by using a preset neural network model to generate a target prediction result.

[0014] The embodiment of the present application provides a breath data analysis method and system based on a gas sensor array and an FPGA. The method comprises the following steps: collecting exhaled gas data of a test subject, and analyzing and storing the exhaled gas data to obtain initial exhaled gas data; filtering and normalizing the initial exhaled gas data to obtain target exhaled gas data; and performing data prediction processing on the target exhaled gas data by using a preset neural network model to generate a target prediction result. According to the embodiment of the present application, the exhaled gas data of the test subject is collected, and the neural network model is called for gas data analysis after the exhaled gas data is preprocessed, so that the gas analysis by a person can be avoided, the efficiency of gas data analysis is improved, and the accuracy of gas data analysis is improved by using the preset neural network model to analyze the exhaled gas data. BRIEF DESCRIPTION OF DRAWINGS

[0015] In order to more clearly illustrate the scheme in the present application, the drawings needed in the description of the embodiments of the present application will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0016] Figure 1 is an implementation flowchart of the breath data analysis method based on the gas sensor array and the FPGA provided by the embodiment of the present application;

[0017] Figure 2 is a neural network model structure diagram provided by the embodiment of the present application;

[0018] Figure 3 is an implementation flowchart of the first sub-flow in the breath data analysis method based on the gas sensor array and the FPGA provided by the embodiment of the present application;

[0019] Figure 4 is an implementation flowchart of the second sub-flow in the breath data analysis method based on the gas sensor array and the FPGA provided by the embodiment of the present application;

[0020] Figure 5 is a curve diagram of the resistance signal of the gas sensor after maximum minimum value normalization processing provided by an embodiment of the present application;

[0021] Figure 6 is a data quantization structure diagram provided by an embodiment of the present application;

[0022] Figure 7 is a data quantization conversion diagram provided by an embodiment of the present application;

[0023] Figure 8 is a data end operation diagram provided by an embodiment of the present application;

[0024] Figure 9 is an implementation flowchart of a third sub-process in the breath data analysis method based on the gas sensor array and the FPGA provided by an embodiment of the present application;

[0025] Figure 10 is a specific architecture diagram of the hardware accelerator provided by an embodiment of the present application;

[0026] Figure 11 is a GRU operation module diagram provided by an embodiment of the present application;

[0027] Figure 12 is an implementation flowchart of a fourth sub-process in the breath data analysis method based on the gas sensor array and the FPGA provided by an embodiment of the present application;

[0028] Figure 13 is an activation function result diagram provided by an embodiment of the present application;

[0029] Figure 14 is a tanh function analysis diagram provided by an embodiment of the present application;

[0030] Figure 15 is a Softmax function analysis diagram provided by an embodiment of the present application;

[0031] Figure 16 is a weighted summation process diagram provided by an embodiment of the present application;

[0032] Figure 17 is a fully connected layer structure diagram provided by an embodiment of the present application;

[0033] Figure 18 is a whole operation control flowchart of the hardware accelerator provided by an embodiment of the present application;

[0034] Figure 19 is a breath data analysis system diagram based on the gas sensor array and the FPGA provided by an embodiment of the present application. DETAILED DESCRIPTION

[0035] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description herein is for describing particular embodiments only and is not intended to be limiting upon the application; the terms "comprising," "including," and "having," and variations thereof, as used in enrolling and claims herein, are intended to be open-ended and to mean including, but not limited to; the terms "first," "second," and the like, as used in the description herein, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description herein is for describing particular embodiments only and is not intended to be limiting upon the application; the terms "comprising," "including," and "having," and variations thereof, as used in enrolling and claims herein, are intended to be open-ended and to mean including, but not limited to; the terms "first," "second," and the like, as used in the description herein, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.

[0036] Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily mutually exclusive of one another. As will be apparent to those of ordinary skill in the art upon reading this description, the embodiments described herein are merely examples of implementations and are not intended to limit the scope of the application in any way.

[0037] In order to make the technical personnel in the art better understand the scheme of the application, the technical solutions in the embodiments of the application will be clearly and completely described below with reference to the drawings.

[0038] The application will be described in detail below with reference to the drawings and embodiments.

[0039] Please refer to Figure 1 and Figure 2 , Figure 1 shows a specific implementation of a breath data analysis method based on a gas sensor array and an FPGA, Figure 2 is a neural network model structure diagram provided by the embodiments of the application.

[0040] It should be noted that the method of the application is not limited to the order of the flow shown, and the method comprises the following steps: Figure 1 The method comprises the following steps:

[0041] S1: Collecting the exhaled gas data of the subject, and analyzing and storing the exhaled gas data to obtain initial exhaled gas data.

[0042] The purpose of the embodiment of the present application is to improve the efficiency and accuracy of exhaled gas data analysis in the context of small sample data. The embodiment of the present application analyzes the exhaled gas data of the subject to predict the concentration of the target gas in the exhaled gas data, thereby providing reference data for the doctor's diagnosis. The target gas can be butanone, acetone, acetaldehyde and n-heptane, which are closely related to lung cancer and can provide data reference information for doctors to screen lung cancer. Therefore, in the embodiment of the present application, the exhaled gas data of the subject is collected, and the exhaled gas data is analyzed and stored to obtain initial exhaled gas data.

[0043] Please refer to Figure 3 , Figure 3 A specific implementation of step S1 is shown as follows:

[0044] S11: Collecting the exhaled gas data of the subject by a MEMS gas sensor.

[0045] S12: Converting the exhaled gas data by an analog-to-digital converter to obtain the initial exhaled gas data, and storing the initial exhaled gas data.

[0046] Specifically, the exhaled gas data of the subject is collected by the MEMS gas sensor through the redox reaction of metal oxide gas sensitive material and gas molecules, and the resistance changes. Then the analog-to-digital converter converts the analog signal of the exhaled gas data to obtain the initial exhaled gas data, and stores the initial exhaled gas data.

[0047] S2: Filtering and normalizing the initial exhaled gas data to obtain target exhaled gas data.

[0048] Specifically, in order to reduce the data redundancy and noise in the initial exhaled gas data and improve the prediction accuracy and robustness of the subsequent neural network model, the initial exhaled gas data needs to be filtered and normalized to obtain target exhaled gas data.

[0049] Please refer to Figures 4 to 8 , Figure 4 A specific implementation of step S2 is shown as follows: Figure 5 is a curve diagram of the gas sensor resistance signal normalized by maximum and minimum value provided by the embodiment of the present application, Figure 6 is a data quantization structure diagram provided by the embodiment of the present application, Figure 7 is a data quantization conversion diagram provided by the embodiment of the present application, Figure 8 is a data end operation diagram provided by the embodiment of the present application, which is described in detail as follows:

[0050] S21: filtering the initial exhaled gas data to obtain filtered exhaled gas data.

[0051] S22: identifying an extreme value in a data column corresponding to the filtered exhaled gas data, and performing normalization processing on the filtered exhaled gas data according to the extreme value to obtain the target exhaled gas data.

[0052] Specifically, the initial exhaled gas data is filtered to obtain filtered exhaled gas data. Then, an extreme value in a data column corresponding to the filtered exhaled gas data is identified, wherein the extreme value includes a maximum value and a minimum value in the data column. The maximum value and the minimum value in the data column are used for standardization processing, and the standardized value is between [0, 1]. The calculation method is to subtract the data from the minimum value of the column, and then divide by the range. The calculation formula is as follows:

[0053]

[0054] wherein, Xnorm represents the value of a single data, which belongs to the range [0, 1], data_min is the minimum value of the column where the data is located, and data_max is the maximum value of the column where the data is located. As shown in FIG. 10, a curve after maximum and minimum value normalization processing of 10 gas sensor resistance signals is presented, and these data will be used as input information of a neural network model. Figure 5

[0055] In one specific embodiment, a data structure optimization technique is used to quantize the exhaled gas data and the target weight according to a preset fixed point digit width, and a fixed point number format corresponding to the exhaled gas data and the target weight is constructed.

[0056] Specifically, when using FPGA (Field-Programmable Gate Array) for hardware acceleration, a data structure optimization technique can be used to quantize floating point data in the model to a low bit width. The floating point data can be target exhaled gas data, weight data, etc.

[0057] ​The linear quantization is performed by using a suitable fixed-point number width, which can effectively reduce the storage resource and memory access overhead, and the influence of fixed-point number calculation on the final model result can be ignored. The fixed-point number is a decimal point position that is fixed, and the decimal point position needs to be remembered to avoid errors during calculation. When using fixed-point numbers for calculation, enough integer bit width needs to be reserved to ensure that the data range requirement in the calculation process is met, and enough decimal bit width needs to be reserved to meet the accuracy requirement in the calculation process. Considering the requirements of data range, calculation accuracy and accelerator performance, the embodiment of the application selects a 16-bit fixed-point number for data quantization. The range of the input target gas data and the weight value is [-1, 1], so the data format is defined as Q15 (1-bit sign bit, 0-bit integer bit, 15-bit decimal bit), and the complement form is stored. Figure 7 is a fixed-point quantization process of part of the weight value, and the real value of the single-precision floating-point number is converted into a 16-bit signed fixed-point number, and the result is obtained by using the quantization formula.

[0058] After the data is quantized by the fixed-point number, the fixed-point number format suitable for the scale of the input data and the weight data of each module is set, and the truncation operation is used to ensure that the data bit width is constant and the calculation is accurate during calculation. As shown in Figure 8 , the truncation operation is as follows: when two 16-bit signed numbers are added, the integer part needs to be expanded by one bit due to the possibility of overflow; if the final result is still limited to 16 bits, the last bit of the decimal part should be truncated. Similarly, for the case of multiplying two 16-bit signed numbers, in order to maintain 16 bits of the result, the last 16 bits of the decimal part of the 32-bit multiplication result need to be truncated. The truncation operation sacrifices a certain accuracy to achieve the correctness of the final calculation result and the stability of the data bit width.

[0059] S3: performing data prediction processing on the target exhaled gas data by using the preset neural network model to generate a target prediction result.

[0060] Specifically, the preset neural network model includes an encoder module, an attention module and a decoder module. As shown in Figure 2 , the encoder module includes a gated recurrent neural network and a full connection layer; the attention module includes two full connection layers; and the decoder module includes a first connection layer and a second connection layer. In the embodiment of the application, the target exhaled gas data is subjected to pattern recognition by calling the preset neural network model to obtain a target prediction result. The target prediction result is the concentration of gases such as butanone, acetone, acetaldehyde and n-heptane.

[0061] Please refer to Figures 9 to 11 , Figure 9 , which shows a specific implementation of step S3, Figure 10is a specific architecture schematic diagram of the hardware accelerator provided by the embodiment of the application, Figure 11 is a GRU operation module schematic diagram provided by the embodiment of the application, which is described as follows:

[0062] S31: information capture between time series signals of the target exhaled gas data is performed through the encoder module, and a plurality of time step hidden states are generated.

[0063] Specifically, the hidden state calculation of the target exhaled gas is performed through the gated recurrent neural network to capture the dependency relationship between time step signals with a large time step distance; then the hidden state calculation result and the target exhaled gas are combined and mapped to a preset dimension through the fully connected layer to obtain a plurality of time step hidden states.

[0064] Specifically, in order to accurately analyze the exhaled gas, the embodiment of the application provides a hardware accelerator. As shown in the figure, Figure 10 The hardware accelerator is a GRU-Net hardware accelerator, which mainly consists of three key parts: a control module 41, a GRU-Net acceleration unit 42 and a storage module 43. The three parts work together to realize the operation process of the neural network forward reasoning algorithm. The control module plays a key command role in the whole architecture. It is mainly responsible for regulating and controlling the read-write signals of the FPGA off-chip DRAM and on-chip BRAM, guiding the calculation logic of the acceleration unit, and accurately allocating and alternately scheduling the input data, weight data and intermediate cache data in the whole reasoning process. The storage module covers multiple important storage function parts, including the off-chip DRAM which undertakes the main data storage responsibility, the on-chip data cache which is used for temporarily storing data to improve the data reading efficiency, and the indispensable local cache in the calculation process, which provides effective storage space support for the flow of data in the calculation process. The GRU-Net acceleration unit is jointly constructed by the PE array, the multiplier-accumulator and the fully connected layer module. Among them, the PE array and the multiplier-accumulator cooperate with each other and are specially used for efficiently completing the matrix vector multiplication operation, while the fully connected layer module integrates the fully connected layer operation and the activation function operation function, which provides strong operation support for the complex calculation of the neural network.

[0065] The specific workflow of the GRU-Net hardware accelerator is as follows: first, the input data and weight data are read from the DRAM and placed in the global cache on the chip, and in this process, the control module continuously monitors and judges whether the data has successfully completed the cache operation. Once the data is cached, the control module sends an enable signal to the GRU-Net acceleration unit to start the operation program of the forward inference algorithm. The core operation includes n-point GRU (Gated Recurrent Unit) calculation, and after the operation of the first time GRU unit is completed, the result is temporarily stored and output. Then, the control module immediately updates the input data of the next time and the output data of the current time when receiving the completion signal, and then starts the operation process of the next time. When all the input data completes the GRU operation, a series of operations such as full connection layer calculation, Softmax function calculation and activation function calculation are executed. Until the operation of the decoder module is successfully completed, the forward acceleration inference process of the entire neural network is completed, which marks the successful completion of the neural network inference task.

[0066] Therefore, through the GRU (Gated Recurrent Unit) calculation of the GRU-Net hardware accelerator, multiple time step hidden states can be obtained. The time step hidden state calculation formula is:

[0067] r t =σ(x t W r +h t-1 U r +b r );

[0068] z t =σ(x t W z +h t-1 U z +b z );

[0069]

[0070] Wherein, r t is the reset gate, z t is the update gate, σ is the Sigmoid activation function, tanh is the tanh activation function, x t is the target exhaled gas data at the current time, h t-1 is the hidden state at the last time, Wr and Wz are the projection matrices of the reset gate and the update gate respectively, Ur and Uz are the projection matrices of h t-1 , b r , b z , and b c are biases. ht is the candidate hidden state for the candidate hidden state, h t is the time step hidden state.

[0071] In the embodiments of the present application, the gated recurrent neural network introduces reset gates and update gates on the basis of the structure of the traditional recurrent neural network, and changes the calculation method of the hidden state. Let the output dimension of the hidden unit be h, x t is the input data at the current moment, h t-1 is the hidden state at the last moment. σ is a Sigmoid activation function, which maps the input elements to the interval of 0 to 1. The calculation formulas of the reset gate and the update gate are similar, and both are the concatenation of xt and ht-1, which is mapped to the h dimension through a weighted combination of a bias full connection layer. From the candidate hidden state It can be seen from the formula that ht-1 is multiplied by the reset gate element by element. When the element value of the reset gate is 0, the output is 0, that is, the hidden state at the last time step is discarded; when it is 1, it is completely retained. This shows that the reset gate determines how much the current time step contains the hidden state information at the last time step. The reset gate is beneficial to capture the time series dependence between adjacent time steps. The update gate controls the amount of new information and the amount of forgetting of the hidden information at the last time step. If the update gate value is close to 1 at a certain time period, the early hidden state information can reach the current time period through the update gate. This design makes the update gate beneficial to extract the time series information contact between time steps with large intervals.

[0072] In one specific embodiment, the GRU operation is carried out in three stages. In the first stage, the operation of the update gate and the reset gate is mainly carried out. Since the calculation formulas of the two are basically the same, and there is no data dependency between them, the calculation work can be carried out in parallel; when the first stage is successfully completed, the second stage is entered, which mainly involves the calculation of the candidate hidden state and the operation of taking the inverse of the update gate and adding 1, and these operations can be carried out based on r t and z t ; finally, the operation of updating the hidden state is carried out in the third stage, which includes dot product operation and addition operation, etc. Through the orderly advancement of the three stages, the complete realization of the GRU operation is finally achieved.

[0073] S32: performing attention calculation on each time step hidden state through the attention module to splice the background vector and the time step hidden state to generate spliced feature information.

[0074] Specifically, the attention module gates and combines the hidden states of each time step of the recurrent neural network output, and then the weight of each time step of the hidden state is obtained through the Softmax function, and then the hidden states of each time step are weighted and summed according to the weight to obtain the final background vector. The background vector is spliced with the hidden state of the last time step to obtain the spliced feature information, and finally the spliced feature information is input into the decoder.

[0075] Referring to Figures 12 to 18 , Figure 12 shows a specific embodiment of step S32, Figure 13 is a schematic diagram of an activation function result provided by the embodiment of the application, Figure 14 is a schematic diagram of a tanh function analysis provided by the embodiment of the application, Figure 15 is a schematic diagram of a Softmax function analysis provided by the embodiment of the application, Figure 16 is a schematic diagram of a weighted summation process provided by the embodiment of the application, Figure 17 is a schematic diagram of a fully connected layer structure provided by the embodiment of the application, Figure 18 is a whole operation control flowchart of a hardware accelerator provided by the embodiment of the application, which is described in detail as follows:

[0076] S321: The attention module weights and combines each time step hidden state, and obtains the weight of each time step hidden state through the Softmax function to obtain the target weight.

[0077] S322: Each time step hidden state is weighted and summed according to the target weight to obtain the background vector.

[0078] S323: The background vector is spliced with the last time step hidden state to obtain the spliced feature information.

[0079] Specifically, the attention module weights and combines each time step hidden state, and obtains the weight of each time step hidden state through the Softmax function to obtain the target weight. Each time step hidden state is weighted and summed according to the target weight to obtain the background vector.

[0080] The background vector is spliced with the last time step hidden state to obtain the spliced feature information.

[0081] S33: The decoding module re-induces and decodes the spliced feature information to generate the target prediction result.

[0082] In one specific embodiment, in the first layer connection layer, the spliced feature information is re-inducted by a LeakyReLu function to obtain inducted feature information; and in the second layer connection layer, the inducted feature information is decoded and combined by a ReLu activation function to generate the target prediction result.

[0083] Specifically, a layer of the full connection layer of the decoding module uses a LeakyRelu activation function. The LeakyReLu function has a small slope for negative input on the basis of ReLu, so that the function does not directly output 0 for negative input, and the derivative is not 0, so that the neuron parameters can continue to be updated. The main role of the first full connection layer is to re-induct the joint information of the background vector output by the encoder and the hidden state at the last time step, so that the information is conducive to the final gas concentration prediction task. The second full connection layer uses a ReLu activation function, because the predicted value of the final concentration is greater than or equal to 0, so the ReLu function is used to adapt to the final task. The role of the second full connection layer is to combine and summarize the decoded information obtained by the first full connection layer, complete the decoding of the encoder output data, and output the target prediction result.

[0084] In one specific embodiment, the LeakyReLu function and the ReLu activation function are respectively implemented by using a piecewise linear approximation method. The implementation process of the piecewise linear approximation method is as follows: the input data in the LeakyReLu function or the ReLu activation function is tested by piecewise processing through Matlab software, when the error is less than the predicted value, the input data is equally divided into multiple piecewise functions, and the linear function slope and offset of the piecewise functions are calculated, the linear function slope and the offset are weighted and summed to obtain the output of the LeakyReLu function or the ReLu activation function.

[0085] Specifically, the embodiments of the present application use Sigmoid, tanh, LeakyReLu and ReLu nonlinear functions, but it is difficult to directly implement such functions in the logic gate unit of the hardware in the FPGA. Therefore, a linear function fitting is used to approximate and replace. In order to achieve the best effect as much as possible, the activation function is implemented on the hardware. The piecewise linear approximation method is used, that is, the function is divided into multiple segments, and a linear function is used to replace each segment. As shown in Figure 13 , taking the tanh function as an example, x is used as input to calculate the activation function. First, the position of x is determined. Assuming that x is in [x i ,x i+1 ], the linear function slope corresponding to this region is a i , and the offset is b i . The approximate activation function can be obtained by multiplying x. The calculation formula is as follows:

[0086] b i = y i .f(x) = a i x + b i , x e [x i , x i+1 ];

[0087] In one embodiment, the data segmentation processing test is first performed using Matlab software, when the error is less than 0.001, the tanh function is implemented to be equally spaced into 64 segments, wherein (-8 < x < 8). Then ai and bi of each segmented function are calculated respectively, and then the obtained values are stored in BRAM in advance, so that the linear approximation tanh activation function can be realized. The hardware implementation process of the tanh activation function is shown in Figure 14 A 16-bit wide data is input, transmitted to the register cache and given to the address module to generate the corresponding coefficient address extraction ai and bi, and then multiplication and addition operations are performed to obtain the output result. The process of implementing the Sigmoid activation function is almost the same as that of the tanh function. The main function of the Softmax function is to convert a vector containing multiple numerical values into a vector representing the probability distribution of all time steps of hidden states. The function involves an exponential function, an adder and a divider module. The exponential function is a nonlinear function, and the implementation idea similar to the tanh function is to use the piecewise linear approximation method to calculate, and the calculation formula is:

[0088] F(x) = ax 2 + bx + c

[0089] After n input data are input into the parallel calculation exponential function module, the sum is accumulated, and then the division operation is performed in parallel, so as to obtain the final operation result.

[0090] In one embodiment, as shown in Figure 18 , the whole operation control process of the GRU-Net hardware accelerator is provided: first, reset and assign initial values to the signals in the module, and then enter the S0 state. S0: read the weight values and activation values stored in the DRAM, write the global cache, and prepare for the subsequent calculation of each module as a prerequisite, and after all data are written, send the completion signal to enter S1. S1: set the start_gru signal to 1, indicating that the single GRU module starts to calculate, and after completing the GRU operation once, output the gru_done signal to 1, and cache the output results h t , update x t and h tAfter the GRU module is called again, a completion signal is sent into S2 after all data calculation is completed. S2: the attention module is called for operation, and the main operations include two full connection layers, a Softmax function module, etc. After the inference logic is calculated, the output signal enters S3. S3: the encoder module is entered, and the final prediction result value is obtained through parallel calculation.

[0091] In the embodiment of the present application, the exhaled gas data of the subject is collected, and the exhaled gas data is analyzed and stored to obtain initial exhaled gas data; the initial exhaled gas data is filtered and normalized to obtain target exhaled gas data; and the target exhaled gas data is processed by a preset neural network model to generate a target prediction result. The embodiment of the present application can avoid manual gas analysis by collecting the exhaled gas data of the subject and calling a neural network model for gas data analysis after preprocessing. It is beneficial to improve the efficiency of gas data analysis, and it is beneficial to improve the accuracy of gas data analysis by analyzing the exhaled gas data through a preset neural network model.

[0092] Further, the exhaled gas detection method based on the embodiment of the present application belongs to a non-invasive detection method, which avoids the pain and potential risk brought to patients by traditional lung cancer detection methods (such as tissue biopsy, bronchoscopy, etc.). Patients only need to exhale normally to complete the detection process without complex surgery or invasive operation, greatly improving the acceptance and compliance of patients. The overall design of the system is compact and easy to operate. The gas sensor array has fast response characteristics and can complete the collection and analysis of the patient's exhaled gas in a short time. Key gas data can be obtained within 5 minutes. Combined with the fast data processing capability of FPGA, the whole process from gas collection to gas analysis output can be completed in a very short time, improving the detection efficiency. The hardware architecture design of FPGA is adopted in the embodiment of the present application, which realizes the efficient inference operation of the neural network algorithm. Its powerful parallel processing capability ensures the stability in the complex data operation process, and at the same time, the high accuracy advantage of the neural network is exerted, solving the problems of real-time processing and high power consumption, improving the stability and portability of the detection system.

[0093] To solve the above technical problems, the embodiment of the present application also provides an exhaled gas data analysis system based on a gas sensor array and FPGA. For details, please refer to Figure 19 , Figure 19 The basic structure block diagram of the exhaled gas data analysis system based on the gas sensor array and FPGA in the embodiment is shown in the figure. The exhaled gas data analysis system based on the gas sensor array and FPGA includes:

[0094] The gas sensor array module 51 is used to collect the exhaled gas data of the subject;

[0095] The gas data collection module 52 is configured to analyze and store the exhaled gas data to obtain initial exhaled gas data.

[0096] The data preprocessing module 53 is configured to filter and normalize the initial exhaled gas data to obtain target exhaled gas data.

[0097] The neural network acceleration module 54 is configured to perform data prediction processing on the target exhaled gas data by using a preset neural network model to generate a target prediction result.

[0098] Further, the preset neural network model comprises an encoder module, an attention module and a decoder module; and the neural network acceleration module 54 comprises:

[0099] An information capturing unit is configured to capture information between time series signals of the target exhaled gas data by using the encoder module to generate a plurality of time step hidden states.

[0100] A splicing unit is configured to perform attention calculation on each of the time step hidden states by using the attention module to splice a background vector and the time step hidden state to generate spliced feature information.

[0101] A feature decoding unit is configured to perform re-induction and feature decoding on the spliced feature information by using the decoder module to generate the target prediction result.

[0102] Further, the encoder module comprises a gated recurrent neural network and a fully connected layer; and the information capturing unit comprises:

[0103] A hidden state calculation unit is configured to perform hidden state calculation on the target exhaled gas by using the gated recurrent neural network, and to perform weighted combination and mapping of the hidden state calculation result and the target exhaled gas to a preset dimension by using the fully connected layer to obtain a plurality of time step hidden states.

[0104] The time step hidden state calculation formula is:

[0105] r t =σ(x t W r +h t-1 U r +b r );

[0106] z t =σ(x t W z +h t-1 U z +b z );

[0107]

[0108] wherein, r t is a reset gate, z t is an update gate, σ is a Sigmoid activation function, tanh is a tanh activation function, x t is target exhaled gas data at a current time, h t-1 is a hidden state at a previous time, Wr, Wz are projection matrices of the reset gate and the update gate respectively, Ur, Uz are projection matrices of ht-1, b r , b z , b c are biases, is a candidate hidden state, h t is a time step hidden state.

[0109] Further, the splicing unit comprises:

[0110] a target weight generation unit configured to combine each of the time step hidden states by weighting through the attention module, and obtain a weight of each of the time step hidden states by a Softmax function, to obtain a target weight;

[0111] a background vector generation unit configured to weight-sum each of the time step hidden states according to the target weight, to obtain the background vector;

[0112] a spliced feature information generation unit configured to splice the background vector and the last time step hidden state, to obtain the spliced feature information.

[0113] Further, the decoding module comprises a first layer connection layer and a second layer connection layer; and the feature decoding unit comprises:

[0114] an inductive feature information generation unit configured to re-induce the spliced feature information by a LeakyReLu function in the first layer connection layer, to obtain inductive feature information;

[0115] a target prediction result output unit configured to perform feature decoding and combination on the inductive feature information by a ReLu activation function in the second layer connection layer, to generate the target prediction result.

[0116] Further, the system further comprises:

[0117] The function implementation unit is configured to implement the LeakyReLu function and the ReLu activation function respectively by using a piecewise linear approximation method, and the piecewise linear approximation method includes the following steps: performing piecewise processing test on input data in the LeakyReLu function or the ReLu activation function by using Matlab software, when an error is less than a predicted value, equally dividing the input data into a plurality of piecewise functions, calculating a linear function slope and an offset of the piecewise functions, and performing weighted summation on the linear function slope and the offset to obtain an output of the LeakyReLu function or the ReLu activation function.

[0118] Further, the gas sensing array module 51 includes:

[0119] The exhaled gas collection unit is configured to collect the exhaled gas data of the subject by using the MEMS gas sensor.

[0120] Further, the gas data collection module 52 includes:

[0121] The data conversion unit is configured to perform data conversion on the exhaled gas data by using an analog-to-digital converter to obtain the initial exhaled gas data, and store the initial exhaled gas data.

[0122] Further, the data preprocessing module 53 includes:

[0123] The filtering processing unit is configured to perform filtering processing on the initial exhaled gas data to obtain filtered exhaled gas data.

[0124] The normalization processing unit is configured to identify extreme values in a data column corresponding to the filtered exhaled gas data, and perform normalization processing on the filtered exhaled gas data according to the extreme values to obtain the target exhaled gas data.

[0125] In the embodiment, the exhaled gas data of the subject is collected, and the exhaled gas data is analyzed and stored to obtain initial exhaled gas data. The initial exhaled gas data is filtered and normalized to obtain target exhaled gas data. The target exhaled gas data is processed by using a preset neural network model to generate a target prediction result. The embodiment can avoid manual gas analysis, improve the efficiency of gas data analysis, and improve the accuracy of gas data analysis by collecting the exhaled gas data of the subject, preprocessing the exhaled gas data, and calling the neural network model to analyze the gas data.

[0126] Obviously, the above-described embodiments are only some embodiments but not all the embodiments of the present application, the preferred embodiments of the present application are shown in the drawings, but do not limit the scope of the present application. The present application can be implemented in many different forms, and conversely, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent replacements to some technical features therein. Any equivalent structure made by using the content of the specification and drawings, directly or indirectly applied to other related technical fields, is also within the protection scope of the present application.

Claims

1. A breath data analysis method based on a gas sensor array and FPGA, characterized by, The method comprises the following steps: Collecting exhaled gas data of a subject, and analyzing and storing the exhaled gas data to obtain initial exhaled gas data; Filtering and normalizing the initial exhaled gas data to obtain target exhaled gas data; Performing data prediction processing on the target exhaled gas data through a preset neural network model to generate a target prediction result; The preset neural network model comprises an encoder module, an attention module and a decoder module; the data prediction processing on the target exhaled gas data through the preset neural network model to generate the target prediction result comprises: Capturing information between time series signals of the target exhaled gas data through the encoder module to generate a plurality of time step hidden states; Performing attention calculation on each of the time step hidden states through the attention module to splice a background vector and the time step hidden state to generate spliced feature information; Re-inducing and feature decoding the spliced feature information through the decoder module to generate the target prediction result.

2. The gas sensor array and FPGA based breath data analysis method according to claim 1, wherein, The encoder module comprises a gated recurrent neural network and a fully connected layer; the capturing information between time series signals of the target exhaled gas data through the encoder module to generate a plurality of time step hidden states comprises: Performing hidden state calculation on the target exhaled gas through the gated recurrent neural network, and weighting and combining the hidden state calculation result and the target exhaled gas through the fully connected layer to map to a preset dimension to obtain a plurality of time step hidden states; The time step hidden state calculation formula is: ; ; ; ; wherein r t is a reset gate, z t is an update gate, σ is a Sigmoid activation function, tanh is a tanh activation function, x t is target exhaled gas data at a current time, h t-1 is a hidden state at a previous time, Wr, Wz are projection matrices of the reset gate and the update gate respectively, Ur, Uz are projection matrices of h t-1 respectively, b r , b z , b c are biases, is a candidate hidden state, h t is a time step hidden state.

3. The gas sensor array and FPGA based breath data analysis method according to claim 1, wherein, The attention calculation on each of the time step hidden states through the attention module to splice the background vector and the time step hidden state to generate the spliced feature information comprises: Weighting and combining each of the time step hidden states through the attention module, and obtaining the weight of each of the time step hidden states through a Softmax function to obtain a target weight; Weighted summing each of the time step hidden states according to the target weight to obtain the background vector; Splicing the background vector and the last time step hidden state to obtain the spliced feature information.

4. The gas sensor array and FPGA based breath data analysis method according to claim 1, wherein, The decoder module comprises a first layer connection layer and a second layer connection layer; The re-inducing and feature decoding the spliced feature information through the decoder module to generate the target prediction result comprises: In the first layer connection layer, re-inducing the spliced feature information through a LeakyReLu function to obtain induced feature information; In the second layer connection layer, feature decoding and combining the induced feature information through a ReLu activation function to generate the target prediction result.

5. The gas sensor array and FPGA based breath data analysis method according to claim 4, wherein, The method further comprises: The LeakyReLu function and the ReLu activation function are realized by using a piecewise linear approximation method, and the piecewise linear approximation method is realized by: segmenting and processing input data in the LeakyReLu function or the ReLu activation function by using Matlab software, when the error is less than the predicted value, the input data is equally divided into a plurality of segment functions, and the linear function slope and offset of the segment function are calculated, and the linear function slope and the offset are weighted and summed to obtain the output of the LeakyReLu function or the ReLu activation function.

6. The gas sensor array and FPGA based breath data analysis method according to any one of claims 1 to 5, characterized in that, The exhaled gas data of the subject is collected, and the exhaled gas data is analyzed and stored to obtain initial exhaled gas data, including: The exhaled gas data of the subject is collected by a MEMS gas sensor; The exhaled gas data is converted by an analog-to-digital converter to obtain the initial exhaled gas data, and the initial exhaled gas data is stored.

7. The gas sensor array and FPGA based breath data analysis method according to any one of claims 1 to 5, characterized in that, The initial exhaled gas data is filtered and normalized to obtain target exhaled gas data, including: The initial exhaled gas data is filtered to obtain filtered exhaled gas data; Identify the extreme value in the data column corresponding to the filtered exhaled gas data, and normalize the filtered exhaled gas data according to the extreme value to obtain the target exhaled gas data.

8. The breath data analysis method based on gas sensor array and FPGA according to claim 3, characterized in that, The method further comprises: Using data structure optimization technology to quantize the exhaled gas data and the target weight according to a preset point number width, and constructing a fixed point number format corresponding to the exhaled gas data and the target weight.

9. A breath data analysis system based on a gas sensor array and an FPGA, characterized by Including: A gas sensing array module for collecting exhaled gas data of a subject; A gas data acquisition module for analyzing and storing the exhaled gas data to obtain initial exhaled gas data; A data preprocessing module for filtering and normalizing the initial exhaled gas data to obtain target exhaled gas data; A neural network acceleration module for generating a target prediction result by pre-setting a neural network model for data prediction processing of the target exhaled gas data; The preset neural network model includes an encoder module, an attention module and a decoder module; the neural network acceleration module includes: An information capture unit for capturing information between time series signals of the target exhaled gas data through the encoder module to generate a plurality of time step hidden states; A splicing unit for calculating attention of each time step hidden state through the attention module to splice background vectors and the time step hidden states to generate spliced feature information; A feature decoding unit for re-induction and feature decoding of the spliced feature information through the decoder module to generate the target prediction result.

Citation Information

Patent Citations

  • Systems, Methods and Devices for Detecting and Identifying Substances in a Subject's Breath

    US20200029858A1

  • Apparatus and method for analyzing exhaled breath

    US20210247381A1