Exhaled gas recognition method and device, computer device and storage medium

The exhaled gas recognition method trained by the teacher-student model architecture and knowledge distillation framework solves the problems of high sample dependence and low recognition accuracy, achieves efficient recognition of exhaled gases, reduces dependence on the amount of sample data, and improves recognition accuracy.

CN116168279BActive Publication Date: 2026-05-08SHENZHEN UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN UNIV
Filing Date
2023-02-23
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Existing breath gas recognition methods are highly dependent on samples and have low recognition accuracy. They are prone to overfitting and have weak generalization ability, especially when the amount of sample data is small.

Method used

A teacher-student model architecture is adopted. By obtaining the encoding parameter information of the target teacher model, the student model is transferred to learn using the exhalation dataset and the teacher's encoding parameters. The model is trained in combination with a knowledge distillation framework. The student model is iteratively trained using the first loss and the second loss, which reduces the dependence on the amount of sample data and improves the recognition accuracy.

Benefits of technology

It reduces the dependence on the amount of exhaled gas sample data, improves the accuracy of exhaled gas recognition, simplifies the feature extraction process, reduces the risk of overfitting, and enhances the model's generalization ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116168279B_ABST
    Figure CN116168279B_ABST
Patent Text Reader

Abstract

The present application relates to the medical technology field in artificial intelligence, and discloses a breath gas recognition method and device, computer equipment and storage medium. The method comprises the following steps: obtaining teacher coding parameter information of a target teacher model; obtaining a breath data set, and inputting the breath data set and the teacher coding parameter information into an encoder module of a student model to obtain a student coding result; inputting the student coding result into a decoder module of the student model to obtain a first loss; inputting the breath data set into the target teacher model for coding to obtain a teacher coding result, and calculating a second loss according to the teacher coding result and the student coding result; iteratively training the student model according to the first loss and the second loss to obtain a target student model; obtaining to-be-recognized breath gas data, and inputting the to-be-recognized breath gas data into the target student model to obtain a recognition result. The present application can improve the breath gas recognition accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of medical technology in artificial intelligence, and in particular to a method, device, computer equipment and storage medium for identifying exhaled gases. Background Technology

[0002] Lung cancer is one of the fastest-growing malignant tumors in terms of incidence and mortality, posing the greatest threat to people's lives and health. Early detection and effective treatment can significantly improve patients' survival rates. Existing lung cancer identification methods typically combine feature extraction with traditional machine learning to identify patients' exhaled breath. However, feature extraction requires manual intervention, which can lead to data loss and affect identification performance. Traditional machine learning methods are highly dependent on sample size, making them prone to overfitting when the sample size is small, and they have weak generalization ability when faced with complex sample data, ultimately resulting in low identification accuracy. Summary of the Invention

[0003] This invention provides a method, apparatus, computer device, and storage medium for exhaled gas identification, aiming to solve the problems of high sample dependence and low identification accuracy in existing exhaled gas identification methods.

[0004] In a first aspect, embodiments of the present invention provide a method for identifying exhaled gases, applied to a constructed exhaled gas identification model, the exhaled gas identification model including a teacher model and a student model, comprising:

[0005] Obtain teacher coding parameter information of the target teacher model, wherein the target teacher model is obtained by training the teacher model using the training dataset;

[0006] Obtain the exhalation dataset and input the exhalation dataset and the teacher coding parameter information into the encoder module of the student model to obtain the student coding result;

[0007] The student's encoding result is input into the decoder module of the student model to obtain the first loss;

[0008] The exhalation dataset is input into the target teacher model for encoding to obtain teacher encoding results, and a second loss is calculated based on the teacher encoding results and the student encoding results;

[0009] The student model is iteratively trained based on the first loss and the second loss to obtain the target student model;

[0010] Acquire the exhaled gas data to be identified, and input the exhaled gas data to be identified into the target student model for identification to obtain the identification result.

[0011] Secondly, embodiments of the present invention also provide an exhaled gas recognition device, applied to a constructed exhaled gas recognition model, the exhaled gas recognition model including a teacher model and a student model, comprising:

[0012] The first acquisition unit is used to acquire teacher coding parameter information of the target teacher model, wherein the target teacher model is obtained by training the teacher model using the training dataset;

[0013] The second acquisition unit is used to acquire the exhalation dataset and input the exhalation dataset and the teacher coding parameter information into the encoder module of the student model to obtain the student coding result;

[0014] The first input unit is used to input the student's encoding result into the decoder module of the student model to obtain the first loss;

[0015] The second input unit is used to input the exhalation dataset into the target teacher model for encoding to obtain teacher encoding results, and to calculate the second loss based on the teacher encoding results and the student encoding results;

[0016] A training unit is used to iteratively train the student model based on the first loss and the second loss to obtain a target student model.

[0017] The identification unit is used to acquire the exhaled gas data to be identified and input the exhaled gas data to be identified into the target student model for identification to obtain the identification result.

[0018] Thirdly, embodiments of the present invention also provide a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described method.

[0019] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the above-described method.

[0020] This invention provides a method, apparatus, computer device, and storage medium for identifying exhaled gases. The method includes: acquiring teacher encoding parameter information of a target teacher model, wherein the target teacher model is trained using a training dataset; acquiring an exhaled gas dataset and inputting the exhaled gas dataset and the teacher encoding parameter information into an encoder module of a student model to obtain a student encoding result; inputting the student encoding result into a decoder module of the student model to obtain a first loss; inputting the exhaled gas dataset into the target teacher model for encoding to obtain a teacher encoding result, and calculating a second loss based on the teacher encoding result and the student encoding result; iteratively training the student model based on the first loss and the second loss to obtain a target student model; acquiring exhaled gas data to be identified and inputting the exhaled gas data to be identified into the target student model for identification to obtain a recognition result. The technical solution of this invention involves inputting the exhalation dataset and teacher coding parameter information into the student model to obtain a first loss, and obtaining a second loss based on the teacher coding results and student coding results. The student model is then trained using the first and second losses to obtain a target student model. This enables the identification of exhalation gas data to be identified, which not only reduces the dependence of the target student model on the amount of exhalation gas sample data, but also improves the accuracy of exhalation gas identification. Attached Figure Description

[0021] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 A schematic flowchart of an exhaled gas recognition method provided in an embodiment of the present invention;

[0023] Figure 2 A schematic diagram of a sub-process of an exhaled gas recognition method provided in an embodiment of the present invention;

[0024] Figure 3 A schematic diagram of a sub-process of an exhaled gas recognition method provided in an embodiment of the present invention;

[0025] Figure 4 A schematic diagram of a student model for an exhaled gas recognition method provided in an embodiment of the present invention;

[0026] Figure 5 for Figure 4 A schematic diagram of the gated recurrent neural network in the student model;

[0027] Figure 6 A schematic diagram of a sub-process of an exhaled gas recognition method provided in an embodiment of the present invention;

[0028] Figure 7 A schematic diagram of an exhaled gas recognition model provided in an embodiment of the present invention;

[0029] Figure 8 This is a schematic diagram of an exhaled gas recognition device provided in an embodiment of the present invention;

[0030] as well as

[0031] Figure 9 This is a schematic diagram of a computer device provided in an embodiment of the present invention. Detailed Implementation

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

[0033] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0034] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0035] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0036] As used in this specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrases "if determined" or "if [described condition or event] is detected" may be interpreted, depending on the context, as "once determined," "in response to determination," "once [described condition or event] is detected," or "in response to detection of [described condition or event]."

[0037] Please see Figure 1 , Figure 1 This is a flowchart illustrating the exhaled gas recognition method provided in an embodiment of the present invention. The exhaled gas recognition method is applied to a constructed exhaled gas recognition model, which includes a teacher model and a student model. The exhaled gas recognition method will be described in detail below.

[0038] like Figure 1 As shown, the method includes the following steps S100-S150.

[0039] S100. Obtain the teacher coding parameter information of the target teacher model, wherein the target teacher model is obtained by training the teacher model using the training dataset.

[0040] In this embodiment of the invention, the acquisition of teacher encoding parameter information of the target teacher model refers to the parameter information of the encoder module of the target teacher model, that is, the acquisition of parameter information of the encoder module of the trained teacher model. This parameter information includes the parameters of the gated recurrent neural network and the parameters of the attention module in the encoder module of the target teacher model. Specifically, the parameters of the gated recurrent neural network include the projection matrix W of the gated recurrent neural network. xr W xz ∈R d*h and projection bias b r b z ∈R 1*h The parameters of the attention module include the projection matrix W of the attention module. h*h1 W h1*1 And two bias parameters, b1 and b2. More specifically, the target teacher model is obtained by training a teacher model using a training dataset, wherein the training dataset includes simulated exhaled gas data with various concentrations. The teacher model's encoder module inputs the training dataset for encoding to obtain the teacher encoding result, and then the teacher model's decoder module decodes the teacher encoding result to obtain the concentration information of various mixed gases in the training dataset. Based on the concentration information, it can be determined whether the teacher model has been trained successfully. The trained teacher model is the target teacher model.

[0041] Please see Figure 2 In one embodiment, for example, in this embodiment of the invention, the step of training the teacher model using the training dataset to obtain the target teacher model includes the following steps S101-S103.

[0042] S101. Obtain simulated exhaled gas data from the training dataset, and input the simulated exhaled gas data into the teacher model for training to obtain gas concentration information.

[0043] In this embodiment of the invention, the simulated exhaled gas data in the training dataset is obtained by simulating real exhaled gas data through a simulation experiment. Specifically, the collection process of the simulated exhaled gas data is as follows: 2-butanone, 1-propanol, acetaldehyde, and n-heptane, which are associated with lung cancer, are selected as simulated exhaled gases. Acetone, isoprene, and methanol are then mixed as the mixed background gas for the simulated exhaled gas. The four simulated exhaled gases and the mixed background gas are then input into a 2L Tedlar gas bag through five independent gas path branches. An MFC flow controller is used to control the time each gas is introduced into the Tedlar gas bag to control the concentration of each gas in the Tedlar gas bag, thereby obtaining simulated exhaled gas data containing the concentration information of each gas. The obtained simulated exhaled gas data is input into the teacher model for training to obtain gas concentration information. The completion of the teacher model training can be determined based on the gas concentration information.

[0044] S102. If the gas concentration information does not match the gas concentration information in the training dataset, then return to the step of obtaining simulated exhaled gas data from the training dataset.

[0045] In this invention, the gas concentration information output by the decoder of the teacher model can be used to determine whether the teacher model has been trained. If the gas concentration information output by the decoder does not match the gas concentration information in the training dataset, the parameters of the teacher model are adjusted, and the process returns to the step of obtaining simulated exhaled gas data in the training dataset to iteratively train the teacher model until the teacher model has been trained.

[0046] S103. If the gas concentration information matches the gas concentration information in the training dataset, then the trained teacher model is used as the target teacher model.

[0047] In this embodiment of the invention, if the gas concentration information output by the decoder of the teacher model matches the gas concentration information in the training dataset, it indicates that the teacher model has been trained. The trained teacher model then serves as the target teacher model, which has the ability to extract gas data features from the simulated exhaled gas data.

[0048] S110. Obtain the exhalation dataset and input the exhalation dataset and the teacher coding parameter information into the encoder module of the student model to obtain the student coding result.

[0049] In this embodiment of the invention, the acquired exhalation dataset is a dataset corresponding to the actual exhaled gas from a human body, which can be used to train the student model as training data. The teacher encoding parameter information is the parameter of the teacher encoder module transferred from the target teacher model. Specifically, the encoder module of the student model includes a gated recurrent neural network (i.e., a student gated recurrent neural network) and an attention module (i.e., a student attention module). After the exhalation dataset and the teacher encoding parameter information are input into the encoder module of the student model, the student model sets the parameters of the student gated recurrent neural network and the student attention module according to the teacher encoding parameter information, that is, the parameters of the encoder module of the student model are the same as the parameters of the encoder module of the target teacher model. The exhalation dataset is then input into the encoder module of the student model with the parameters set for encoding to obtain the student encoding result.

[0050] Please see Figure 3 In one embodiment, for example, in an embodiment of the present invention, step S110 includes the following steps S111-S113.

[0051] S111. Input the exhalation dataset and the teacher coding parameter information into the student gated recurrent neural network to obtain the student hidden state.

[0052] In embodiments of the present invention, such as Figure 4 As shown, Figure 4 The diagram illustrates the structure of a student model, which includes an encoder module and a decoder module. Specifically, the encoder module comprises a gated recurrent neural network (GRU) and an attention module. For example... Figure 5As shown, the gated recurrent neural network includes a reset gate and an update gate, through which the hidden state information in the recurrent neural network can be calculated. More specifically, when the output dimension of the hidden unit corresponding to the hidden state is h, the calculation formula for the reset gate is as follows:

[0053] R t =σ(X) t W xr +H t-1 W hr +b r )

[0054] Wherein, X t ∈R n*d (n is the number of samples, d is the dimension of the input vector) represents the mini-batch sample input at time step t, W xr ∈R d*h This represents the input vector X. t The projection matrix, H t-1 ∈R n*h W represents the hidden state at the previous time step. hr ∈R h*h This represents the hidden state H from the previous time step. t-1 The projection matrix, b r σ represents the bias after projection onto the output dimension h, and σ represents the sigmoid activation function, which transforms the values ​​of the input elements to between 0 and 1.

[0055] When the output dimension of the hidden unit corresponding to the hidden state is h, the calculation formula for the update gate is as follows:

[0056] Z t =σ(X) t W xz +H t-1 W hz +b z )

[0057] Wherein, X t ∈R n*d (n is the number of samples, d is the dimension of the input vector) represents the mini-batch sample input at time step t, W xz ∈R d*h This represents the input vector X. t The projection matrix, H t-1 ∈R n*h It is the hidden state of the previous time step, W hz ∈R h*h This represents the hidden state H from the previous time step. t-1 The projection matrix, bz σ represents the bias after projection onto the output dimension h, and σ represents the sigmoid activation function, which transforms the values ​​of the input elements to between 0 and 1.

[0058] The candidate hidden state can be calculated based on the calculation result of the reset gate. The specific calculation formula is as follows:

[0059]

[0060] Wherein, X t ∈R n*d (n is the number of samples, d is the dimension of the input vector) represents the mini-batch sample input at time step t, W xh This represents the input vector X. t The projection matrix, (R t ⊙H t-1 ) represents the element-wise multiplication of the hidden state of the previous time step with the output of the reset gate, and Whh represents (R t ⊙H t-1 The projection matrix of b) h ∈R 1*h It is X t and (R) t ⊙H t-1 The bias on the new dimension h, where tanh refers to the tanh activation function.

[0061] As can be seen from the above formula for calculating the candidate hidden state, the output of the hidden state in the previous time step is multiplied element-wise with the reset gate. The value of the reset gate element is between 0 and 1. That is, when the value of the reset gate is 0, (R... t ⊙H t-1 The output of the reset gate is 0, which means that the hidden state of the previous time step is discarded. When the value of the reset gate is 1, the hidden state of the previous time step is completely preserved. This means that the reset gate determines how much information from the hidden state of the previous time step is contained in the current time step, and the reset gate is helpful in capturing the dependencies between the time series of adjacent time steps.

[0062] The hidden state can be calculated from the candidate hidden state through the update gate:

[0063]

[0064] Therefore, it can be seen that by updating gate Z t The number of candidate hidden states for the current node can be controlled. The hidden state H from the previous time step needs to be remembered. t-1It needs to be forgotten. If the value of the update gate is close to 1 for a certain time period, such as t' to t, then the information of the hidden state in the earlier time period can be directly transmitted to the current time period through the update gate. Setting the update gate helps the gated recurrent neural network to extract the information relationship between time series with large time step distances, so that the information of the student's hidden state is more comprehensive.

[0065] S112. Input the student hidden state into the student attention module to obtain the student background vector.

[0066] In this invention, after the student hidden state is obtained through computation in the student-gated recurrent neural network, it is then input into the student attention module for computation. The student attention module is the attention module within the student model. When the hidden state becomes difficult to obtain from earlier time series due to excessively long time steps, the attention module can be used to acquire it, enabling interaction and connection between hidden states at different time steps. Specifically, the student hidden state includes multiple hidden states at different time steps. The student attention module includes two fully connected layers. The hidden states at multiple time steps are input into the two fully connected layers for weighted combination to obtain hidden weights. These hidden weights are then transformed using the softmax function to obtain weight coefficients, which are the weight coefficients of the student hidden states at each time step. The student background vector is obtained by calculating the weight coefficients and the student hidden states. The specific computation process is as follows:

[0067] The calculation formula for the first fully connected layer is: Among them, W h*h1 This represents the hidden state H. t*h The projection matrix projected onto the h1 dimension, where b1 represents the hidden state H. t*h The bias on the new dimension h1, * denotes the dot product operation.

[0068] The calculation formula for the second fully connected layer is: Among them, W h1*1 b1 represents the projection matrix of the output L1 of the first fully connected layer, and b2 represents the bias of L1 in the new dimension h1.

[0069] Then, the output L2 of the second fully connected layer is transformed into an overall weight vector α using the softmax function, i.e., α = softmax(L2). The student background vector is then calculated using the weights and the student hidden state. Among them, H t It is the hidden state of GRU at time step t, α tIt represents the weight of the hidden state at time step t in the background vector. The total time step length is T, and the overall weight coefficient α = [α1, α2, α3…α] is given by the hidden state at time step t. T ].

[0070] S113. Perform a calculation on the student background vector and the student hidden state to obtain the student encoding result.

[0071] In this embodiment of the invention, after obtaining the student background vector, the student background vector is combined with the student hidden state at the last time step to obtain the student encoding result. The specific calculation formula is: Y stu_en =cont(H stu_unit H t In this embodiment of the invention, by adding an attention module, the student model can comprehensively judge each stage of training during continuous training. This assigns greater weight to reaction time periods that are beneficial to the final recognition task, while reducing the weight coefficient of reaction time periods that have less impact on or are even detrimental to the recognition task. This results in the background vector most beneficial to the final recognition task, thereby improving model performance. Furthermore, the addition of the attention module solves the gradient vanishing problem that still exists in GRU at longer time steps. It allows information to be transferred between time series with large time step differences, enabling each time step to obtain information from all time steps in between. The resulting hidden state at each time step contains more comprehensive information, which is beneficial to the final recognition task. Moreover, the attention module integrates the sequence information of consecutive time points, ensuring that each time point receives more comprehensive information.

[0072] S120. The student encoding result is input into the decoder module of the student model to obtain the first loss.

[0073] In this embodiment of the invention, after the encoder module of the student model outputs the student encoding result, the student encoding result is input into the decoder module of the student model for decoding to obtain the first loss. Specifically, the student encoding result is input into the decoder module of the student model to decode the student encoding result to obtain the predicted label. The decoder module of the student model includes two fully connected layers, and the student encoding result is input into the two fully connected layers for decoding to obtain the predicted label. The specific calculation formula is as follows:

[0074] Y1 = Sigmoid(LN(drop(W1*Y)) stu_en +b1)))

[0075] Y pre_label =W2*Y1

[0076] Where W1 is the parameter of the mapping matrix of the first fully connected layer of the student model decoder, b1 is the bias of the first fully connected layer, the fully connected layer first goes through a dropout layer to randomly set the output of some neurons to 0 to prevent the model from overfitting, then LayerNorm is used to standardize the output of the fully connected layer, and finally the Sigmoid function is used to normalize the output to between 0 and 1, Y1 is the output of the first fully connected layer, and W2 is the parameter of the mapping matrix of the second fully connected layer. pre_label It is the final predicted label output by the student model encoder.

[0077] Then, the true labels in the exhalation dataset are obtained, and the cross-entropy operation is performed between the true labels and the predicted labels to obtain the first loss. The true labels are the labels assigned when collecting the exhalation dataset. For example, when collecting exhalation gas samples from lung cancer patients and healthy volunteers, the label for lung cancer patients is set to 0, and the label for healthy volunteers is set to 1. Thus, during training, the student model will also output predicted labels, whose values ​​are between 0 and 1. The formula for calculating the first loss by performing the cross-entropy operation between the true labels and the predicted labels is as follows:

[0078] L pre =CrossEntropy(Y pre_label ,Y true )

[0079] Among them, Y pre_label This represents the predicted label, Y. true This represents the actual label, L. pre This is the first loss. The first loss L pre This can also be referred to as the classification loss between the true label and the predicted label.

[0080] S130. Input the exhalation dataset into the target teacher model for encoding to obtain teacher encoding results, and calculate the second loss based on the teacher encoding results and the student encoding results.

[0081] In this embodiment of the invention, the encoder module of the target teacher model includes a teacher-gated recurrent neural network and a teacher attention module. The exhalation dataset is encoded by the teacher-gated recurrent neural network and the teacher attention module to obtain the teacher encoding result. The teacher encoding result and the student encoding result are then calculated to obtain a second loss. The second loss can also be referred to as the distribution difference (MSE LOSS) between the output of the encoder module of the student model and the encoder module of the teacher model.

[0082] Please see Figure 6In one embodiment, for example, in an embodiment of the present invention, step S130 includes the following steps S131-S134.

[0083] S131. Input the exhalation dataset into the teacher-gated recurrent neural network to obtain the teacher hidden state;

[0084] S132. Input the teacher hidden state into the teacher attention module to obtain the teacher background vector;

[0085] S133. Perform a calculation on the teacher background vector and the teacher hidden state to obtain the teacher encoding result;

[0086] S134. Perform a mean square error calculation on the teacher coding results and the student coding results to obtain the second loss.

[0087] In this embodiment of the invention, since the encoder module of the target teacher model and the encoder module of the student model have the same structure, both adopting a main structure including a gated recurrent neural network and an attention module, the processing procedures of steps S131 to S133 are the same as those of steps S111 to S113 above. That is, the process of obtaining the teacher encoding result is the same as the process of obtaining the student encoding result. For the sake of simplicity, it will not be repeated here, and only step S134 will be described in detail. In step S113, the teacher encoding result is obtained as: Y tea_en =cont(H tea_unit H tea_T Then, the teacher's coding result and the student's coding result are subjected to mean square error calculation to obtain the second loss, the specific calculation formula of which is: L enc =MSE(Y tea_en ,Y stu_en ), where MSE represents the mean squared error, used to measure the error between two inputs Y. tea_en ,Y stu_en The difference between them, specifically, the formula for calculating the mean square error is as follows:

[0088]

[0089] Where m represents the number of samples, and i represents the i-th sample in the sample.

[0090] S140. The student model is iteratively trained according to the first loss and the second loss to obtain the target student model.

[0091] In the embodiments of the present invention, please refer to Figure 7 , Figure 7This is a schematic diagram of an exhaled gas recognition model provided in an embodiment of the present invention. After obtaining the first loss and the second loss, the final loss can be calculated based on the first loss and the second loss. The student model is then trained based on the final loss until the final loss tends to stabilize. Specifically, the current output final loss is not significantly different from the previous output final loss, indicating that the student model is stabilizing, meaning the student model training is complete, and the target student model is finally obtained. Specifically, the formula for calculating the final loss based on the first loss and the second loss is as follows:

[0092] L total =λ*L enc +(1-λ)*L pre

[0093] Here, λ is a hyperparameter of magnitude between 0 and 1, representing the second loss L between the outputs of the encoder modules of the student model and the teacher model. enc In the final loss L total The proportion of the student model's output, 1-λ, represents the first loss L between the predicted label output by the decoder and the true label. pre In the final loss L total The proportion of the student model is determined by the backpropagation gradient. The student model is iteratively trained continuously to adjust the parameters of the encoder and decoder modules, thereby adjusting the values ​​of λ and 1-λ, until the student model achieves optimal performance, ultimately yielding the trained target student model.

[0094] In this embodiment of the invention, the process of iteratively training the student model based on the first loss and the second loss to obtain the target student model is the process of training the student model based on the knowledge distillation framework. Specifically, based on the knowledge distillation framework, the knowledge learned by the large model (i.e., the teacher model) can be used to guide the small model (i.e., the student model) with fewer parameters and a simpler structure, enabling the student model to have the generalization ability of the teacher model and improving its performance. More specifically, the method involves acquiring the parameter information of the encoder module of the trained teacher model, transferring this parameter information to the encoder module of the student model, and freezing the parameters of the teacher model's encoder module. This transferred parameter information enables the student model to extract exhaled gas features. Then, the exhaled gas data used for training is simultaneously input into both the teacher and student model's encoder modules to obtain a first loss. This first loss essentially adds a regularization constraint to the student model, allowing it to adaptively learn the feature extraction capabilities of the teacher model. Finally, the parameters of the student model are fine-tuned during iterative training based on the final loss, rather than undergoing large-scale arbitrary modifications. This continuous fine-tuning improves recognition accuracy. Furthermore, training the student model based on the knowledge distillation framework can address the overfitting problem caused by insufficient sample data due to the difficulty in collecting exhaled gas samples, reducing the dependence on the amount of sample data.

[0095] S150. Obtain the exhaled gas data to be identified, and input the exhaled gas data to be identified into the target student model for identification to obtain the identification result.

[0096] In this embodiment of the invention, after obtaining the target student model, it can be used to perform a recognition task on the exhaled gas data to be identified. The exhaled gas data to be identified is obtained; for example, patient exhaled gas data can be collected and used as the exhaled gas data to be identified. This data is then input into the target student model for recognition. The patient's condition can be determined based on the recognition result output by the decoder module of the target student model. It should be noted that in this embodiment, the decoder module of the target student model includes two fully connected layers. These two fully connected layers decode the student encoding result to obtain the final output result. Specifically, after passing through the first fully connected layer, the student encoding result is standardized using LayerNorm, and then a DropOut layer is used to randomly mask a portion of neurons to improve the generalization of the student model. After passing through the sigmoid function, the weight parameters of each neuron are obtained. Finally, a fully connected layer is used to combine and connect the neurons to obtain the final recognition result. Understandably, if the exhaled gas data to be identified is exhaled gas data related to lung cancer, then the identification result can be used to determine whether the patient has lung cancer; if the exhaled gas data to be identified is exhaled gas data related to diabetes, then the dataset used to train the teacher model is a simulated exhaled gas dataset related to diabetes, and the dataset used to train the student model is a real exhaled gas dataset related to diabetes. The final trained model is a target student model that can identify diabetic patients, and this target student model can be used to determine whether the patient has diabetes; if the exhaled gas data to be identified is exhaled gas data related to COPD, then the dataset used to train the teacher model is a simulated exhaled gas dataset related to COPD, and the dataset used to train the student model is a real exhaled gas dataset related to COPD. The final trained model is a target student model that can identify COPD patients, and this target student model can be used to determine whether the patient has COPD. It should also be noted that, in the embodiments of the present invention, the exhaled gas recognition model does not require manual feature extraction of the input exhaled gas data to be recognized in order to obtain the final recognition result. This not only saves time and manpower costs, but also makes it more practical, simpler to operate, and has a high recognition accuracy.

[0097] Figure 8 This is a schematic diagram of an exhaled gas recognition device 200 provided in an embodiment of the present invention. Figure 8 As shown, corresponding to the above-described exhaled gas recognition method, the present invention also provides an exhaled gas recognition device 200. This exhaled gas recognition device 200 includes a unit for performing the above-described exhaled gas recognition method, and the device can be configured in a computer device. Specifically, please refer to... Figure 8The exhaled gas recognition device 200 includes a first acquisition unit 201, a second acquisition unit 202, a first input unit 203, a second input unit 204, a training unit 205, and a recognition unit 206.

[0098] The first acquisition unit 201 is used to acquire teacher encoding parameter information of the target teacher model, wherein the target teacher model is obtained by training the teacher model using a training dataset; the second acquisition unit 202 is used to acquire an exhalation dataset and input the exhalation dataset and the teacher encoding parameter information into the encoder module of the student model to obtain a student encoding result; the first input unit 203 is used to input the student encoding result into the decoder module of the student model to obtain a first loss; the second input unit 204 is used to input the exhalation dataset into the target teacher model for encoding to obtain a teacher encoding result, and calculate a second loss based on the teacher encoding result and the student encoding result; the training unit 205 is used to iteratively train the student model based on the first loss and the second loss to obtain a target student model; the recognition unit 206 is used to acquire exhalation gas data to be recognized and input the exhalation gas data to be recognized into the target student model for recognition to obtain a recognition result.

[0099] In some embodiments, such as this one, the second acquisition unit 202 includes a first input subunit, a second input subunit, and a first calculation subunit.

[0100] The first input subunit is used to input the exhalation dataset and the teacher encoding parameter information into the student gated recurrent neural network to obtain the student hidden state; the second input subunit is used to input the student hidden state into the student attention module to obtain the student background vector; the first calculation subunit is used to calculate the student encoding result by combining the student background vector and the student hidden state.

[0101] In some embodiments, such as this one, the second input subunit includes a third input subunit, a second calculation subunit, and a third calculation subunit.

[0102] The third input subunit is used to input the student hidden states at multiple different time steps into the two fully connected layers and perform weighted combination to obtain hidden weights; the second calculation subunit is used to transform the hidden weights through the softmax function to obtain weight coefficients; and the third calculation subunit is used to calculate the student background vector by combining the weight coefficients and the student hidden states.

[0103] In some embodiments, such as this one, the first input unit 203 includes a decoding subunit and a fourth calculation subunit.

[0104] The decoding subunit is used to input the student's encoding result into the decoder module of the student model to decode the student's encoding result and obtain the predicted label; the fourth calculation subunit is used to obtain the true label in the exhalation dataset and perform cross-entropy operation between the true label and the predicted label to obtain the first loss.

[0105] In some embodiments, such as this one, the second input unit 204 includes a fifth calculation subunit, a sixth calculation subunit, a seventh calculation subunit, and an eighth calculation subunit.

[0106] The fifth calculation subunit is used to input the exhalation dataset into the teacher-gated recurrent neural network to obtain the teacher hidden state; the sixth calculation subunit is used to input the teacher hidden state into the teacher attention module to obtain the teacher background vector; the seventh calculation subunit is used to calculate the teacher encoding result by combining the teacher background vector and the teacher hidden state; and the eighth calculation subunit is used to perform a mean square error calculation on the teacher encoding result and the student encoding result to obtain the second loss.

[0107] In some embodiments, such as this one, the training unit 205 includes a ninth computation subunit and a training subunit.

[0108] The ninth calculation subunit is used to calculate the final loss based on the first loss and the second loss; the training subunit is used to train the student model based on the final loss until the final loss stabilizes to obtain the target student model.

[0109] In some embodiments, such as this embodiment, the first acquisition unit 201 includes a first acquisition subunit, a first judgment subunit, and a second judgment subunit.

[0110] The first acquisition subunit is used to acquire simulated exhaled gas data from the training dataset, and input the simulated exhaled gas data into the teacher model for training to obtain gas concentration information; the first judgment subunit is used to return to the step of acquiring simulated exhaled gas data from the training dataset if the gas concentration information does not match the gas concentration information in the training dataset; the second judgment subunit is used to use the trained teacher model as the target teacher model if the gas concentration information matches the gas concentration information in the training dataset.

[0111] The aforementioned exhaled gas recognition device can be implemented as a computer program, which can, for example... Figure 9 It runs on the computer device shown.

[0112] Please see Figure 9 , Figure 9 This is a schematic diagram of a computer device provided in an embodiment of the present invention. The computer device 300 is an intelligent device with exhaled gas recognition function.

[0113] See Figure 9 The computer device 300 includes a processor 302, a memory, and a network interface 305 connected via a system bus 301. The memory may include a non-volatile storage medium 303 and internal memory 304.

[0114] The non-volatile storage medium 303 may store an operating system 3031 and a computer program 3032. When the computer program 3032 is executed, it causes the processor 302 to perform an exhaled gas recognition method.

[0115] The processor 302 provides computing and control capabilities to support the operation of the entire computer device 300.

[0116] The internal memory 304 provides an environment for the operation of the computer program 3032 in the non-volatile storage medium 303. When the computer program 3032 is executed by the processor 302, the processor 302 can perform an exhaled gas recognition method.

[0117] This network interface 305 is used for network communication with other devices. Those skilled in the art will understand that... Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the smart device 300 to which the present invention is applied. The specific smart device 300 may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.

[0118] The processor 302 is used to run a computer program 3032 stored in a memory to implement the process steps of the above-described method embodiments.

[0119] It should be understood that, in this embodiment of the invention, the processor 302 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.

[0120] It will be understood by those skilled in the art that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program may be stored in a storage medium, which is a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the process steps of the embodiments of the above methods.

[0121] Therefore, the present invention also provides a storage medium. This storage medium may be a computer-readable storage medium. The storage medium stores a computer program. When executed by a processor, the computer program causes the processor to perform any embodiment of the above-described exhaled gas recognition method.

[0122] The storage medium can be any computer-readable storage medium capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), magnetic disk, or optical disk.

[0123] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0124] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of each unit is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0125] The steps in the method of this invention can be adjusted, merged, or reduced in order according to actual needs. The units in the device of this invention can be merged, divided, or reduced according to actual needs. Furthermore, the functional units in the various embodiments of this invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0126] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.

[0127] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0128] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Since these modifications and variations fall within the scope of the claims and their equivalents, this invention also intends to include these modifications and variations.

[0129] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for identifying exhaled gases, characterized in that, The method is applied to the constructed exhaled gas recognition model, which includes a teacher model and a student model, and includes: Obtain teacher encoding parameter information of the target teacher model, wherein the target teacher model is obtained by training the teacher model using a training dataset; the teacher encoding parameter information is the parameter of the teacher encoder module transferred from the target teacher model; Obtain the exhalation dataset and input the exhalation dataset and the teacher coding parameter information into the encoder module of the student model to obtain the student coding result; The student's encoding result is input into the decoder module of the student model to obtain a first loss, wherein the first loss is the classification loss between the true label and the predicted label; The exhalation dataset is input into the target teacher model for encoding to obtain the teacher encoding result, and a second loss is calculated based on the teacher encoding result and the student encoding result, wherein the second loss is the distribution difference between the output of the encoder module of the student model and the encoder module of the teacher model; The student model is iteratively trained based on the first loss and the second loss to obtain the target student model; Acquire the exhaled gas data to be identified, and input the exhaled gas data to be identified into the target student model for identification to obtain the identification result; The encoder module of the student model includes a student-gated recurrent neural network and a student attention module. The step of inputting the exhalation dataset and the teacher encoding parameter information into the encoder module of the student model to obtain the student encoding result includes: The exhalation dataset and the teacher's encoded parameter information are input into the student gated recurrent neural network for computation to obtain the student hidden state; The student's hidden state is input into the student attention module for computation to obtain the student's background vector; The student's background vector and the student's hidden state are used to obtain the student's encoding result; The student hidden state includes multiple student hidden states at different time steps, and the student attention module includes two fully connected layers. The step of inputting the student hidden state into the student attention module for computation to obtain the student background vector includes: The hidden states of the students at multiple different time steps are input into the two fully connected layers and weighted to obtain the hidden weights. The two fully connected layers include a first connected layer and a second connected layer. The calculation formula for the first fully connected layer is as follows: Among them, W h*h1 This represents the hidden state H. t*h The projection matrix projected onto the h1 dimension, where b1 represents the hidden state H. t*h The bias on the new dimension h1, * denotes the dot product operation; the calculation formula for the second fully connected layer is: Among them, W h1*1 b1 represents the projection matrix of the output L1 of the first fully connected layer, b2 represents the bias of L1 in the new dimension h1, and L2 is the hidden weight. The hidden weights are transformed and calculated using the softmax function to obtain the weight coefficients; The student background vector is obtained by calculating the weight coefficients and the student hidden state.

2. The method according to claim 1, characterized in that, The step of inputting the student's encoding result into the decoder module of the student model to obtain the first loss includes: The student's coding result is input into the decoder module of the student model to decode the student's coding result and obtain the predicted label; Obtain the true label from the exhalation dataset, and perform cross-entropy calculation between the true label and the predicted label to obtain the first loss.

3. The method according to claim 2, characterized in that, The encoder module of the target teacher model includes a teacher-gated recurrent neural network and a teacher attention module. The step of inputting the exhalation dataset into the target teacher model for encoding to obtain teacher encoding results, and calculating a second loss based on the teacher encoding results and the student encoding results, includes: The exhalation dataset is input into the teacher-gated recurrent neural network for computation to obtain the teacher hidden state; The teacher's hidden state is input into the teacher's attention module for computation to obtain the teacher's background vector; The teacher's background vector and the teacher's hidden state are used to obtain the teacher's encoding result; The second loss is obtained by performing a mean square error calculation on the teacher's coding results and the student's coding results.

4. The method according to claim 3, characterized in that, The step of iteratively training the student model based on the first loss and the second loss to obtain the target student model includes: The final loss is calculated based on the first loss and the second loss; The student model is trained based on the final loss until the final loss stabilizes to obtain the target student model.

5. The method according to claim 1, characterized in that, The target teacher model is obtained by training the teacher model using the training dataset, including: Obtain simulated exhaled gas data from the training dataset, and input the simulated exhaled gas data into the teacher model for training to obtain gas concentration information; If the gas concentration information does not match the gas concentration information in the training dataset, then return to the step of obtaining simulated exhaled gas data from the training dataset; If the gas concentration information matches the gas concentration information in the training dataset, then the trained teacher model will be used as the target teacher model.

6. A breath gas recognition device, applied to a constructed breath gas recognition model, the breath gas recognition model including a teacher model and a student model, characterized in that, The device includes: The first acquisition unit is used to acquire teacher encoding parameter information of the target teacher model, wherein the target teacher model is obtained by training the teacher model using a training dataset; the teacher encoding parameter information is the parameter of the teacher encoder module transferred from the target teacher model; The second acquisition unit is used to acquire the exhalation dataset and input the exhalation dataset and the teacher coding parameter information into the encoder module of the student model to obtain the student coding result; The first input unit is used to input the student's encoding result into the decoder module of the student model to obtain a first loss, wherein the first loss is the classification loss between the true label and the predicted label; The second input unit is used to input the exhalation dataset into the target teacher model for encoding to obtain the teacher encoding result, and to calculate the second loss based on the teacher encoding result and the student encoding result, wherein the second loss is the distribution difference between the output of the encoder module of the student model and the encoder module of the teacher model; A training unit is used to iteratively train the student model based on the first loss and the second loss to obtain a target student model. The identification unit is used to acquire the exhaled gas data to be identified and input the exhaled gas data to be identified into the target student model for identification to obtain the identification result; The encoder module of the student model includes a student gated recurrent neural network and a student attention module, and the second acquisition unit includes: The first input subunit is used to input the exhalation dataset and the teacher coding parameter information into the student gated recurrent neural network to obtain the student hidden state; The second input subunit is used to input the student hidden state into the student attention module to obtain the student background vector; The first calculation subunit is used to perform operations on the student background vector and the student hidden state to obtain the student encoding result; The student hidden state includes multiple student hidden states at different time steps; the student attention module includes two fully connected layers; and the second input subunit includes: The third input subunit is used to input the student's hidden state at multiple different time steps into the two fully connected layers and then perform a weighted combination to obtain the hidden weight. The two fully connected layers include a first connected layer and a second connected layer. The calculation formula for the first fully connected layer is as follows: , among which, W h*h1 This represents the hidden state H. t*h The projection matrix projected onto the h1 dimension, where b1 represents the hidden state H. t*h The bias on the new dimension h1, * denotes the dot product operation; the calculation formula for the second fully connected layer is: , among which, W h1*1 b1 represents the projection matrix of the output L1 of the first fully connected layer, b2 represents the bias of L1 in the new dimension h1, and L2 is the hidden weight. The second calculation subunit is used to transform and calculate the hidden weights using the softmax function to obtain weight coefficients. The third calculation subunit is used to calculate the student background vector by combining the weight coefficients and the student hidden state.

7. A computer device, characterized in that, The computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The storage medium stores a computer program that, when executed by a processor, can implement the method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Network training method and device, data identification method and device, equipment and medium

    CN111598213A

  • Address recognition method and device, electronic equipment and storage medium

    CN112329467A

  • Mixed gas type and concentration identification method and device and storage medium

    CN112464999A