Expiration data analysis method and system based on gas sensor array and FPGA
Through the expiratory data analysis method based on gas sensor array and FPGA, the problem that existing expiratory analysis methods require manual intervention and high-precision instruments are solved, and efficient and accurate expiratory data analysis is achieved, reducing costs and improving portability.
Patent Information
- Application Number
- CN202510141431.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-08
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2045-02-08
AI Technical Summary
The existing expiratory analysis methods require manual intervention, are complex and have errors, and the high-precision analysis instrument is huge in size, heavy in weight, and has a long analysis cycle, which limits its portability and flexibility in early screening scenarios, and has high investment in operation and maintenance resources.
The exhalation data analysis method based on gas sensor array and FPGA is adopted. By collecting exhaled gas data, analyzing, filtering and normalizing, and finally data prediction processing is performed through a preset neural network model to generate target prediction results.
It improves the efficiency and accuracy of breath data analysis, reduces the cost of manual intervention and high-precision instrument operation and maintenance, and enhances the portability and flexibility of the analysis system.
Smart Images

Figure CN119970004A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of gas analysis technology, and in particular to a breath data analysis method and system based on a gas sensor array and FPGA. Background Art
[0002] Most of the breath analysis currently used for early screening of lung cancer relies on high-precision and high-sensitivity analytical instruments, such as GC-IMS (gas phase ion mobility spectrometry) and GC-MS (gas chromatography-mass spectrometry).
[0003] The existing exhaled gas analysis has the following problems: First, the existing exhaled gas analysis methods generally require manual intervention in the feature extraction stage. Technicians must monitor the progress of the experiment and subjectively judge whether the reaction curve of the exhaled sample meets the standards for gas analysis. This process not only requires the operator to have certain professional skills and experience, but also increases the complexity of the operation and potential sources of error. Second, high-precision analytical instruments are usually large in size, heavy in weight, and have a long analysis cycle. These characteristics limit their portability and flexibility in early screening scenarios. In addition, the operation and maintenance of these instruments require high resource investment, including time and economic costs, 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 time and economic costs. Summary of the invention
[0004] The purpose of the embodiments of the present application is to propose a breath data analysis method and system based on a gas sensor array and FPGA to improve the efficiency and accuracy of breath data analysis.
[0005] In order to solve the above technical problems, the embodiment of the present application provides a breath data analysis method based on a gas sensor array and FPGA, comprising:
[0006] Collecting exhaled gas data of the subject, 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] The target exhaled gas data is subjected to data prediction processing by using a preset neural network model to generate a target prediction result.
[0009] In order to solve the above technical problems, the embodiment of the present application provides a breath data analysis system based on a gas sensor array and FPGA, including:
[0010] A gas sensor array module, used to collect exhaled gas data of the subject;
[0011] A gas data acquisition module, used for analyzing and storing the exhaled gas data to obtain initial exhaled gas data;
[0012] A data preprocessing module, used for filtering and normalizing the initial exhaled gas data to obtain target exhaled gas data;
[0013] The neural network acceleration module performs data prediction processing on the target exhaled gas data through a preset neural network model to generate a target prediction result.
[0014] The embodiment of the present invention provides a breath data analysis method and system based on a gas sensor array and FPGA. The method includes: collecting the exhaled gas data of the subject, parsing 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 embodiment of the present invention collects the exhaled gas data of the subject, pre-processes it, and then calls the neural network model to perform gas data analysis, which can avoid manual gas analysis and is beneficial to improving the efficiency of gas data analysis. At the same time, the exhaled gas data is analyzed by a preset neural network model, which is beneficial to improving the accuracy of gas data analysis. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0016] Figure 1 This is a flowchart of an implementation of a breath data analysis method based on a gas sensor array and FPGA provided in an embodiment of the present application;
[0017] Figure 2 It is a schematic diagram of the structure of a neural network model provided in an embodiment of the present application;
[0018] Figure 3 It is a flowchart for implementing the first sub-process in the breath data analysis method based on the gas sensor array and FPGA provided in an embodiment of the present application;
[0019] Figure 4 is a flowchart for implementing the second sub-process in the breath data analysis method based on the gas sensor array and FPGA provided in an embodiment of the present application;
[0020] Figure 5 is a curve diagram of the gas sensor resistance signal provided in the embodiment of the present application after the maximum and minimum values are normalized;
[0021] Figure 6 It is a schematic diagram of the data quantification structure provided in the embodiment of the present application;
[0022] Figure 7 This is a schematic diagram of data quantitative conversion provided by an embodiment of the present application;
[0023] Figure 8 This is a schematic diagram of the data end operation provided in an embodiment of the present application;
[0024] Fig. 9 is a flowchart for implementing the third sub-process in the breath data analysis method based on the gas sensor array and FPGA provided in an embodiment of the present application;
[0025] Fig.10 is a schematic diagram of the specific architecture of the hardware accelerator provided in an embodiment of the present application;
[0026] Fig.11 Schematic diagram of the GRU operation module provided in the embodiment of the present application;
[0027] Fig.12 is a flowchart for implementing the fourth sub-process in the breath data analysis method based on the gas sensor array and FPGA provided in an embodiment of the present application;
[0028] Fig.13 It is a schematic diagram of the activation function result provided in the embodiment of the present application;
[0029] Fig.14 It is a schematic diagram of the tanh function analysis provided in the embodiment of the present application;
[0030] Fig.15 It is a schematic diagram of the Softmax function analysis provided in the embodiment of the present application;
[0031] Fig.16 is a schematic diagram of a weighted summation process provided in an embodiment of the present application;
[0032] Fig.17 is a schematic diagram of the fully connected layer structure provided in an embodiment of the present application;
[0033] Fig.18 is the entire operation control flow chart of the hardware accelerator provided in the embodiment of the present application;
[0034] Fig.19 It is a schematic diagram of an exhalation data analysis system based on a gas sensor array and FPGA provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0036] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0037] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0038] The present invention is described in detail below with reference to the accompanying drawings and embodiments.
[0039] See also Figure 1 and Figure 2 , Figure 1 A specific implementation of a breath data analysis method based on a gas sensor array and FPGA is shown. Figure 2 It is a schematic diagram of the neural network model structure provided in the embodiment of the present application.
[0040] It should be noted that if there are substantially the same results, the method of the present invention is not limited to Figure 1 The process sequence shown is limited to the following steps:
[0041] S1: collecting exhaled gas data of the subject, analyzing and storing the exhaled gas data, and obtaining 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, so as to provide reference data for the doctor's visit. Among them, the target gas can be butanone, acetone, acetaldehyde and n-heptane, etc. These gases are closely related to lung cancer and can provide doctors with data reference information for lung cancer screening. Therefore, in the embodiment of the present application, the exhaled gas data of the subject is collected, and the exhaled gas data is parsed and stored to obtain the initial exhaled gas data.
[0043] See also Figure 3 , Figure 3 A specific implementation of step S1 is shown, which is described in detail as follows:
[0044] S11: Collecting the exhaled gas data of the subject through a MEMS gas sensor.
[0045] S12: converting the exhaled gas data through an analog-to-digital converter to obtain the initial exhaled gas data, and storing the initial exhaled gas data.
[0046] Specifically, the MEMS gas sensor generates an oxidation-reduction reaction between the metal oxide gas-sensitive material and the gas molecules, causing the resistance to change, thereby collecting the exhaled gas data of the subject. 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 data redundancy and noise in the initial exhaled gas data and improve the prediction accuracy and robustness of the subsequent neural network model, it is necessary to filter and normalize the initial exhaled gas data to obtain target exhaled gas data.
[0049] See also Figures 4 to 8 , Figure 4 A specific implementation of step S2 is shown. Figure 5 is a curve diagram of the gas sensor resistance signal provided in the embodiment of the present application after the maximum and minimum values are normalized. Figure 6 is a schematic diagram of the data quantification structure provided in the embodiment of the present application, Figure 7 is a schematic diagram of data quantitative conversion provided in the embodiment of the present application, Figure 8 This is a schematic diagram of the data end operation 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: 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.
[0052] Specifically, the initial exhaled gas data is filtered to obtain filtered exhaled gas data. Then, the extreme values in the data column corresponding to the filtered exhaled gas data are identified, wherein the extreme values include the maximum value and the minimum value in the data column. The maximum value and the minimum value in the data column are used for standardization, 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 it by the extreme difference. The calculation formula is as follows:
[0053]
[0054] Among them, Xnorm represents the value of a single data, the range belongs to [0, 1], data_min is the minimum value of the data column, and data_max is the maximum value of the data column. Figure 5 As shown, it presents the curves of 10 gas sensor resistance signals after normalization to the maximum and minimum values. These data will be used as input information of the neural network model.
[0055] In a specific embodiment, the exhaled gas data and the target weight are quantized in fixed point according to a preset fixed point bit width using a data structure optimization technique, and a fixed point 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, data structure optimization technology can be used to perform low-bit-width fixed-point quantization on floating-point data in the model. The floating-point data can be target exhaled gas data, weight data, and the like.
[0057] Using a suitable fixed-point number width for linear quantization can effectively reduce the overhead of storage resources and memory access, and the impact of fixed-point number calculation on the final model result can be ignored. Fixed-point numbers are fixed decimal points, and the position of the decimal point needs to be kept in mind to avoid errors in calculations. When using fixed-point numbers for calculations, it is necessary to retain enough integer bit width to ensure that the range requirements of the data in the calculation process can be met, and enough decimal bit width is required to meet the accuracy requirements in the calculation process. Considering the requirements of data range, calculation accuracy and accelerator performance, the embodiment of the present application selects 16-bit fixed-point numbers for data quantization. The range of the input target gas data and weight value is [-1,1], so the data format is specified as Q15 (1 sign bit, 0 integer bit, 15 decimal bits), and the complement form is stored. Figure 7 It is a fixed-point quantization process of some weight values. 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 using the quantization formula.
[0058] After the data is quantized, the fixed-point format is set according to the size of the input data and weight data of each module, and the truncation operation is used to ensure that the data width is constant during the calculation and the calculation is accurate. Figure 8 As shown in the figure, the truncation operation is as follows: when adding two 16-bit signed numbers, the integer part needs to be expanded by one bit in view of the possibility of overflow in the integer part; if the final result is still limited to 16 bits, the lowest bit of the decimal part should be truncated. Similarly, for the case of multiplying two 16-bit signed numbers, in order to maintain the result of 16 bits, the 16 bits of the decimal part of the 32-bit multiplication result need to be truncated. The truncation operation achieves the correctness of the final calculation result and the stability of the data bit width at the expense of a certain degree of precision.
[0059] S3: Performing data prediction processing on the target exhaled gas data through a 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. Figure 2 As shown, the encoder module includes a gated recurrent neural network and a fully connected layer; the attention module includes two fully connected layers; and the decoding module includes a first connection layer and a second connection layer. In the embodiment of the present application, the target exhaled gas data is pattern recognized by calling a preset neural network model to obtain a target prediction result. Among them, the target prediction result is the concentration of gases such as butanone, acetone, acetaldehyde and n-heptane.
[0061] See also Figures 9 to 11 , Fig. 9 A specific implementation of step S3 is shown. Fig.10is a schematic diagram of a specific architecture of a hardware accelerator provided in an embodiment of the present application, Fig.11 This is a schematic diagram of the GRU operation module provided in the embodiment of the present application, which is described in detail as follows:
[0062] S31: Capturing information between time series signals of the target exhaled gas data through the encoder module to generate multiple time step hidden states.
[0063] Specifically, the hidden state of the target exhaled gas is calculated by the gated recurrent neural network to capture the dependency between time series signals with large time step distances; then the hidden state calculation result and the weighted combination of the target exhaled gas are mapped to a preset dimension through the fully connected layer to obtain multiple time step hidden states.
[0064] Specifically, in order to accurately analyze the exhaled gas, the embodiment of the present application provides a hardware accelerator. Fig.10 As shown, the hardware accelerator is a GRU-Net hardware accelerator, which is mainly composed of three key parts: a control module 41, a GRU-Net acceleration unit 42, and a storage module 43. These 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 entire architecture. The control module plays a key command role in the entire architecture. It is mainly responsible for regulating the read and write signals of the FPGA off-chip DRAM and the on-chip BRAM, leading the calculation logic direction of the acceleration unit, and accurately allocating and alternating the input data, weight data, and intermediate cache data in the entire reasoning process. The storage module covers a number of important storage function parts, including off-chip DRAM assuming the main data storage responsibilities, on-chip data cache for temporary storage of data to improve data reading efficiency, and local cache that is indispensable in the calculation process, providing effective storage space support for the flow of data in the calculation process. The GRU-Net acceleration unit is constructed by the PE array, multiplier and adder, and fully connected layer modules. The PE array and the multiplier-accumulator work together to efficiently complete matrix-vector multiplication operations, while the fully connected layer module integrates the fully connected layer operations and activation function operations, providing powerful operational support for the complex calculations of neural networks.
[0065] Among them, the specific workflow of the GRU-Net hardware accelerator is as follows: First, read the input data and weight data from DRAM and place them in the on-chip global cache. During this process, the control module will continue to monitor and determine whether the data has successfully completed the cache operation. Once the data is cached, the control module will send an enable signal to the GRU-Net acceleration unit to officially start the operation program of the forward reasoning algorithm. Its core operation includes the GRU (gated recurrent neural network) calculation of n points. After completing the GRU unit operation at the first moment, the result will be temporarily stored and output. Subsequently, when the control module receives the completion signal, it will immediately proceed to update the input data of the next moment and the output data of the current moment, and then start the operation process of the next moment. When all the input data complete the GRU operation, a series of operations such as the fully connected layer calculation, the Softmax function calculation, and the activation function calculation are immediately performed. Until the operation of the decoder module is successfully completed, the forward acceleration reasoning process of the entire neural network is considered to be over, marking the successful achievement of the neural network reasoning task.
[0066] Therefore, through the GRU (gated recurrent neural network) calculation of the above GRU-Net hardware accelerator, multiple time-step hidden states can be obtained. Among them, 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] Among them, 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 moment, h t-1 is the hidden state of the previous moment, Wr and Wz are the projection matrices of the reset gate and the update gate, respectively, and Ur and Uz are h t-1 The projection matrix, b r 、b z 、b c is the bias, is the candidate hidden state, h t is the hidden state of the time step.
[0071] In the embodiment of the present application, the gated recurrent neural network introduces a reset gate and an update gate based on the traditional recurrent neural network structure, which changes the hidden state calculation method. Assume that the output dimension of the hidden unit is h, x t is the input data at the current moment, h t-1 is the hidden state at the previous moment. σ is the Sigmoid activation function, which maps the input element to the range of 0 to 1. The calculation formula of the reset gate is similar to that of the update gate. Both concatenate xt and ht-1 and map them to the h dimension through a weighted combination of the biased fully connected layer. From the formula, we can see that ht-1 is multiplied by the reset gate element by element. Since the reset gate element value is between 0 and 1, when it is 0, the output is 0, that is, the hidden state of the previous time step is discarded; when it is 1, it is completely retained. This shows that the reset gate determines how much hidden state information of the previous time step is contained in the current time step. The reset gate is conducive to capturing the time series dependency of adjacent time steps. The update gate controls the amount of new information remembered at the current node and the amount of hidden information forgotten in the previous time step. If the update gate value is close to 1 in a certain time period, the earlier hidden state information can reach the current time period through the update gate. This design makes the update gate conducive to extracting time series information connections with large time step spacing.
[0072] In a specific embodiment, the GRU operation is divided into three stages. In the first stage, the update gate and the reset gate are mainly operated. Since the calculation formulas of the two are roughly 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 candidate hidden states and the operation of negating and adding 1 to the update gate, and these operations need to be based on the r calculated and cached in the first stage. t and z t Finally, in the third stage, the hidden state update operation is carried out. This operation process includes operations such as dot product operation and addition operation. Through the orderly advancement of these three stages, the complete implementation of GRU operation is finally achieved.
[0073] S32: performing 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 splicing feature information.
[0074] Specifically, the attention module performs a weighted combination of the hidden states of each time step output by the gated recurrent neural network, and then uses the Softmax function to obtain the weight of the hidden state of each time step. The hidden state of each time step is then weighted and summed according to the weight to obtain the final background vector. The background vector is concatenated with the hidden state of the last time step to obtain the concatenated feature information, which is finally input into the decoder.
[0075] See also Figures 12 to 18 , Fig.12 A specific implementation of step S32 is shown. Fig.13 is a schematic diagram of the activation function result provided in the embodiment of the present application, Fig.14 is a schematic diagram of the tanh function analysis provided in the embodiment of the present application, Fig.15 is a schematic diagram of the Softmax function analysis provided in the embodiment of the present application, Fig.16 is a schematic diagram of a weighted summation process provided in an embodiment of the present application, Fig.17 is a schematic diagram of the fully connected layer structure provided in an embodiment of the present application, Fig.18 This is the entire operation control flow chart of the hardware accelerator provided in the embodiment of the present application, which is described in detail as follows:
[0076] S321: Perform weighted combination of the hidden states of each time step through the attention module, and obtain the weight of the hidden state of each time step through the Softmax function to obtain the target weight.
[0077] S322: Perform weighted summation on the hidden states of each time step according to the target weight to obtain the background vector.
[0078] S323: Concatenate the background vector with the last hidden state of the time step to obtain the concatenated feature information.
[0079] Specifically, the attention module performs weighted combination of the hidden states of each time step, and obtains the weight of the hidden state of each time step through the Softmax function to obtain the target weight. The hidden states of each time step are weighted and summed according to the target weight to obtain the background vector.
[0080] The background vector is concatenated with the hidden state of the last time step to obtain the concatenated feature information.
[0081] S33: Re-summarize and feature decode the splicing feature information through the decoding module to generate the target prediction result.
[0082] In a specific embodiment, in the first connection layer, the spliced feature information is re-summarized by the LeakyReLu function to obtain summarized feature information; in the second connection layer, the summarized feature information is feature decoded and combined by the ReLu activation function to generate the target prediction result.
[0083] Specifically, one fully connected layer of the decoding module uses the LeakyRelu activation function. Based on ReLu, the LeakyReLu function allows the function to have a very small slope for negative inputs, so that the function will not directly output 0 for negative inputs, and the derivative is not 0 so that the neuron parameters can continue to be updated. The main function of the first fully connected layer is to re-summarize the connection information between the background vector output by the encoder and the hidden state of the last time step, so that the information is beneficial to the final gas concentration prediction task. The second fully connected layer uses the ReLu activation function. Because the predicted value of the final concentration is greater than or equal to 0, the ReLu function is used to adapt to the final task. The function of the second fully connected layer is to combine and summarize the decoding information summarized by the first fully connected layer, complete the decoding of the encoder output data, and output the target prediction results.
[0084] In a specific embodiment, the piecewise linear approximation method is used to implement the LeakyReLu function and the ReLu activation function respectively, wherein the implementation process of the piecewise linear approximation method is: the input data in the LeakyReLu function or the ReLu activation function is subjected to a piecewise processing test through Matlab software, and when the error is less than the predicted value, the input data is equidistantly divided into multiple piecewise functions, and the linear function slope and offset of the piecewise function are calculated, and the linear function slope and the offset are weightedly summed to obtain the output of the LeakyReLu function or the ReLu activation function.
[0085] Specifically, the embodiments of the present application use nonlinear functions such as Sigmoid, tanh, LeakyReLu and ReLu, but the logic gate units in the hardware of the FPGA are difficult to directly implement such functions, so linear function fitting is used to approximate them. In order to achieve the best effect as much as possible, the activation function is implemented in hardware. The piecewise linear approximation method is used, that is, the function is divided into multiple segments, and each segment is replaced by a linear function. Fig.13 As shown, taking the tanh function as an example, x is used as input to calculate the activation function. First, determine the position of x. Assume that x is in [x i ,x i+1 ], then the slope of the linear function corresponding to this area is a i , the offset is b i , and then through x multiplication operation, we can get the approximate activation function. The calculation formula is as follows:
[0086] b i = y i .f(x) = a i x + b i , x ∈ [x i , x i+1 ;
[0087] In a specific embodiment, first, data segmentation processing and testing are performed using Matlab software. When the error is less than 0.001, the implementation of the tanh function is equally divided into 64 segments, where (-8 < x < 8). Then, ai and bi of each piecewise function are calculated respectively, and the obtained values are pre-stored in the BRAM, thus realizing the linear approximation of the tanh activation function. The hardware implementation process of the tanh activation function is as Fig.14 shown. A 16-bit wide data is input, which is respectively transmitted to the register buffer and given to the parsing address module to generate the addresses corresponding to the coefficients to extract ai and bi, and then multiplication and addition operations are performed to obtain the output result. The implementation process of 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 values into a vector representing the probability distribution of the hidden states at all time steps. This function involves exponential function, adder and divider modules. The exponential function is a non-linear function. Similar to the implementation idea of the tanh function, the piecewise linear approximation method is used for operation, and the calculation formula is:
[0088] F(x) = ax 2 + bx + c;
[0089] After n input data enter and are calculated in parallel in the exponential function module, accumulation and summation are performed, and then division operations are performed in parallel correspondingly, so as to obtain the final operation result.
[0090] In a specific embodiment, as Fig.18 shown, the entire 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 to the global cache, which is a prerequisite for the subsequent operations of each calculation module. After all data are written, send a completion signal and enter S1. S1: Set the start_gru signal to 1, indicating the start of calculating a single GRU module. After a GRU operation is completed, set the output gru_done signal to 1, cache the output result h t , update x t and h tThen call the GRU module again, and after all data calculations are completed, send a completion signal to enter S2. S2: Call the attention module to perform operations, and the main operations completed include two fully connected layers, Softmax function modules, etc. After the calculation is completed according to the reasoning logic, the output signal enters S3. S3: Enter the encoder module and calculate in parallel to obtain the final prediction result value.
[0091] In an 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 subjected to data prediction processing by a preset neural network model to generate a target prediction result. The embodiment of the present invention collects the exhaled gas data of the subject, and calls a neural network model to perform gas data analysis after preprocessing the data, thereby avoiding manual gas analysis and improving the efficiency of gas data analysis. At the same time, the exhaled gas data is analyzed by a preset neural network model, which is conducive to improving the accuracy of gas data analysis.
[0092] Furthermore, the embodiment of the present application is a non-invasive detection method based on the exhaled gas detection method, which avoids the pain and potential risks brought to patients by traditional lung cancer detection methods (such as tissue biopsy, bronchoscopy, etc.). The patient only needs to exhale normally to complete the detection process, without the need for complex surgery or invasive operations, which greatly improves the patient's acceptance and compliance. The overall design of the system is compact and easy to operate. The gas sensor array has a fast response characteristic, can complete the collection and analysis of the patient's exhaled gas in a short time, obtain key gas data within 5 minutes, and combine the FPGA's ability to quickly process data. The whole process from gas collection to gas analysis output can be completed in a very short time, improving the detection efficiency. The embodiment of the present application adopts the hardware architecture design of FPGA to realize the efficient reasoning operation of the neural network algorithm. Its powerful parallel processing capability ensures stability in the process of complex data calculation, while giving play to the advantages of high accuracy of neural networks, solving the problems of real-time processing and high power consumption, and improving the stability and portability of the detection system.
[0093] In order to solve the above technical problems, the present application embodiment also provides a breath data analysis system based on a gas sensor array and FPGA. Fig.19 , Fig.19 The following is a basic structural diagram of the exhalation data analysis system based on the gas sensor array and FPGA in this embodiment. The exhalation data analysis system based on the gas sensor array and FPGA includes:
[0094] A gas sensor array module 51 is used to collect exhaled gas data of the subject;
[0095] A gas data acquisition module 52, used for analyzing and storing the exhaled gas data to obtain initial exhaled gas data;
[0096] A data preprocessing module 53, used for filtering and normalizing the initial exhaled gas data to obtain target exhaled gas data;
[0097] The neural network acceleration module 54 performs data prediction processing on the target exhaled gas data through a preset neural network model to generate a target prediction result.
[0098] Furthermore, the preset neural network model includes an encoder module, an attention module and a decoder module; the neural network acceleration module 54 includes:
[0099] An information capturing unit, configured to capture information between time series signals of the target exhaled gas data through the encoder module to generate a plurality of time step hidden states;
[0100] A splicing unit, configured to perform attention calculation on each of the time step hidden states through the attention module, so as to splice the background vector and the time step hidden state to generate splicing feature information;
[0101] A feature decoding unit is used to re-summarize and feature decode the spliced feature information through the decoding module to generate the target prediction result.
[0102] Furthermore, the encoder module includes a gated recurrent neural network and a fully connected layer; the information capture unit includes:
[0103] A hidden state calculation unit, configured to perform hidden state calculation on the target exhaled gas through the gated recurrent neural network, and map the hidden state calculation result and the target exhaled gas weighted combination to a preset dimension through 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] Among them, 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 moment, h t-1 is the hidden state of the previous moment, Wr, Wz are the projection matrices of the reset gate and the update gate, Ur, Uz are the projection matrices of ht-1, b r 、b z 、b c is the bias, is the candidate hidden state, h t is the hidden state of the time step.
[0109] Furthermore, the splicing unit comprises:
[0110] A target weight generating unit, used for performing weighted combination of the hidden states of each time step through the attention module, and obtaining the weight of the hidden state of each time step through a Softmax function to obtain a target weight;
[0111] A background vector generating unit, used for performing weighted summation of the hidden states of each time step according to the target weight to obtain the background vector;
[0112] The splicing feature information generating unit is used to splice the background vector with the last time step hidden state to obtain the splicing feature information.
[0113] Furthermore, the decoding module includes a first connection layer and a second connection layer; the feature decoding unit includes:
[0114] A summarized feature information generating unit, used for re-summarizing the concatenated feature information by using a LeakyReLu function in the first connection layer to obtain summarized feature information;
[0115] The target prediction result output unit is used to decode and combine the summarized feature information through the ReLu activation function in the second connection layer to generate the target prediction result.
[0116] Furthermore, the system further comprises:
[0117] A function implementation unit is used to respectively implement the LeakyReLu function and the ReLu activation function by piecewise linear approximation, wherein the implementation process of the piecewise linear approximation is as follows: the input data in the LeakyReLu function or the ReLu activation function is subjected to a piecewise processing test by Matlab software, and when the error is less than the predicted value, the input data is equidistantly divided into a plurality of piecewise functions, and the linear function slope and offset of the piecewise function are calculated, and the linear function slope and the offset are weightedly summed to obtain the output of the LeakyReLu function or the ReLu activation function.
[0118] Furthermore, the gas sensor array module 51 includes:
[0119] An exhaled gas collection unit, used for collecting the exhaled gas data of the subject through a MEMS gas sensor;
[0120] Furthermore, the gas data acquisition module 52 includes:
[0121] The data conversion unit is used to convert the exhaled gas data through an analog-to-digital converter to obtain the initial exhaled gas data, and store the initial exhaled gas data.
[0122] Furthermore, the data preprocessing module 53 includes:
[0123] A filtering processing unit, used for filtering the initial exhaled gas data to obtain filtered exhaled gas data;
[0124] The normalization processing unit is used to identify the extreme value in the data column corresponding to the filtered exhaled gas data, and perform normalization processing on the filtered exhaled gas data according to the extreme value to obtain the target exhaled gas data.
[0125] In an 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 subjected to data prediction processing by a preset neural network model to generate a target prediction result. The embodiment of the present invention collects the exhaled gas data of the subject, and calls a neural network model to perform gas data analysis after preprocessing the data, thereby avoiding manual gas analysis and improving the efficiency of gas data analysis. At the same time, the exhaled gas data is analyzed by a preset neural network model, which is conducive to improving the accuracy of gas data analysis.
[0126] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the present application specification and the accompanying drawings, directly or indirectly used in other related technical fields, is similarly within the scope of protection of the present application.
Claims
1. A breath data analysis method based on a gas sensor array and FPGA, characterized in that: include: Collecting exhaled gas data of the 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; The target exhaled gas data is subjected to data prediction processing by using a preset neural network model to generate a target prediction result.
2. The breath data analysis method based on gas sensor array and FPGA according to claim 1, characterized in that: The preset neural network model includes an encoder module, an attention module and a decoder module; the preset neural network model is used to perform data prediction processing on the target exhaled gas data to generate a target prediction result, including: Capturing information between time series signals of the target exhaled gas data through the encoder module to generate multiple time step hidden states; Performing 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 splicing feature information; The decoding module re-summarizes and decodes the spliced feature information to generate the target prediction result.
3. The breath data analysis method based on gas sensor array and FPGA according to claim 2, characterized in that: The encoder module includes a gated recurrent neural network and a fully connected layer; the encoder module is used to capture information between time series signals of the target exhaled gas data to generate multiple time step hidden states, including: Performing hidden state calculation on the target exhaled gas through the gated recurrent neural network, and mapping the hidden state calculation result and the target exhaled gas weighted combination to a preset dimension through the fully connected layer to obtain a plurality of time step hidden states; The time step hidden state calculation formula is: r t =σ(x t W r +h t-1 U r +b r ); z t =σ(x t W z +h t-1 U z +b z ); Among them, 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 moment, h t-1 is the hidden state of the previous moment, Wr and Wz are the projection matrices of the reset gate and the update gate, respectively, and Ur and Uz are h t-1 The projection matrix, b r , b z , b c is the bias, is the candidate hidden state, h t is the hidden state of the time step.
4. The breath data analysis method based on gas sensor array and FPGA according to claim 2, characterized in that: The attention module performs attention calculation on each of the time step hidden states to splice the background vector and the time step hidden state to generate splicing feature information, including: Performing a weighted combination of the hidden states of each time step through the attention module, and obtaining the weight of the hidden state of each time step through the Softmax function to obtain the target weight; Performing weighted summation of the hidden states of each time step according to the target weight to obtain the background vector; The background vector is concatenated with the last hidden state of the time step to obtain the concatenated feature information.
5. The breath data analysis method based on gas sensor array and FPGA according to claim 2, characterized in that: The decoding module includes a first connection layer and a second connection layer; The re-summarizing and feature decoding the splicing feature information by the decoding module to generate the target prediction result includes: In the first connection layer, the splicing feature information is re-summarized by a LeakyReLu function to obtain summarized feature information; In the second connection layer, the summarized feature information is feature decoded and combined through the ReLu activation function to generate the target prediction result.
6. The breath data analysis method based on gas sensor array and FPGA according to claim 5, characterized in that: The method further comprises: The LeakyReLu function and the ReLu activation function are respectively implemented by the piecewise linear approximation method, wherein the implementation process of the piecewise linear approximation method is: the input data in the LeakyReLu function or the ReLu activation function is subjected to a piecewise processing test through Matlab software, and when the error is less than the predicted value, the input data is equidistantly divided into multiple piecewise functions, and the linear function slope and offset of the piecewise function are calculated, and the linear function slope and the offset are weightedly summed to obtain the output of the LeakyReLu function or the ReLu activation function.
7. The breath data analysis method based on a gas sensor array and FPGA according to any one of claims 1 to 6, characterized in that: The step of collecting the exhaled gas data of the subject, parsing and storing the exhaled gas data, and obtaining initial exhaled gas data includes: Collecting the exhaled gas data of the subject through 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.
8. The breath data analysis method based on a gas sensor array and FPGA according to any one of claims 1 to 6, characterized in that: The filtering and normalizing the initial exhaled gas data to obtain target exhaled gas data includes: Performing filtering processing on the initial exhaled gas data to obtain filtered exhaled gas data; An extreme value in a data column corresponding to the filtered exhaled gas data is identified, and the filtered exhaled gas data is normalized according to the extreme value to obtain the target exhaled gas data.
9. The breath data analysis method based on gas sensor array and FPGA according to claim 4, characterized in that: The method further comprises: The exhaled gas data and the target weight are quantized in fixed point according to a preset fixed point number width by using a data structure optimization technique, and a fixed point number format corresponding to the exhaled gas data and the target weight is constructed.
10. A breath data analysis system based on a gas sensor array and FPGA, characterized in that: include: A gas sensor array module, used to collect exhaled gas data of the subject; A gas data acquisition module, used for analyzing and storing the exhaled gas data to obtain initial exhaled gas data; A data preprocessing module, used for filtering and normalizing the initial exhaled gas data to obtain target exhaled gas data; The neural network acceleration module performs data prediction processing on the target exhaled gas data through a preset neural network model to generate a target prediction result.
Citation Information
Patent Citations
Detection system for expired gas
CN103245705A
Collection device, detection device and method for baby exhaled air
CN112107333A
Early lung cancer expiration component detection and identification system based on neural network
CN113823403A
Portable human body expiration sampling and detecting equipment
CN115153655A
Expired gas identification method and device, computer equipment and storage medium
CN116168279A