Blood glucose prediction method and device, terminal equipment and storage medium

By combining fuzzy reasoning, attention mechanism and LSTM neural network methods, the problem of inaccurate prediction of non-invasive blood glucose monitoring is solved, and the accuracy and reliability of blood glucose prediction are significantly improved.

CN119724606APending Publication Date: 2025-03-28YANGZHOU UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411786501.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

There is a problem of inaccurate prediction of non-invasive blood glucose monitoring using neural network prediction models.

Method used

Blood glucose prediction method combined with fuzzy reasoning methods, attention mechanisms, and LSTM neural networks are used. The specific steps include obtaining the current physiological signal, performing fuzzy reasoning to obtain fuzzy membership, inputting it to the LSTM layer and the attention mechanism layer, and finally outputting the blood sugar prediction result through the fully connected layer.

Benefits of technology

It effectively improves the accuracy and reliability of non-invasive blood sugar prediction and reduces prediction errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119724606A_ABST
    Figure CN119724606A_ABST
Patent Text Reader

Abstract

The invention is suitable for the technical field of computers, and provides a blood glucose prediction method and device, terminal equipment and a storage medium, and the blood glucose prediction method comprises the following steps: firstly obtaining a current physiological signal, performing fuzzy reasoning on the current physiological signal, obtaining a fuzzy membership degree of a current time step number, then inputting the fuzzy membership degree of the current time step number into an LSTM layer, and outputting first LSTM output, and inputting the first LSTM output into an attention mechanism layer, outputting a second LSTM output, performing residual connection on the second LSTM output, inputting the second LSTM output into a full connection layer, and outputting a blood glucose prediction result. Therefore, blood glucose prediction is performed by combining the fuzzy reasoning method, the attention mechanism and the LSTM neural network, so that the accuracy and reliability of noninvasive blood glucose prediction can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer technology, and in particular, relates to a blood sugar prediction method, apparatus, terminal device and storage medium. Background Art

[0002] With the change of lifestyle, the incidence of diabetes has increased year by year, especially in the middle-aged and elderly population. Early diagnosis and monitoring of diabetes is particularly important. Traditional blood glucose monitoring methods mostly use invasive tests, such as fingertip blood sampling, which not only causes pain and discomfort, but also may pose a risk of infection, seriously affecting the patient's daily life. Therefore, the development of non-invasive blood glucose monitoring technology not only has important clinical significance, but also has far-reaching social value, and can provide patients with a more convenient and comfortable testing method.

[0003] In the related art, the current method of non-invasive blood glucose monitoring using a neural network prediction model still has the problem of inaccurate prediction. Summary of the invention

[0004] The embodiments of the present application provide a blood glucose prediction method, apparatus, terminal device and storage medium, which can solve the problem of inaccurate prediction in the current method of non-invasive blood glucose monitoring using a neural network prediction model.

[0005] In the first aspect, an embodiment of the present application provides a blood glucose prediction method, including: obtaining a current physiological signal, performing fuzzy reasoning on the current physiological signal, and obtaining the fuzzy membership of the current time step; inputting the fuzzy membership of the current time step into the LSTM layer, and outputting a first LSTM output; inputting the first LSTM output into the attention mechanism layer, and outputting a second LSTM output; inputting the second LSTM output into the fully connected layer, and outputting a blood glucose prediction result.

[0006] In a possible implementation manner of the first aspect, performing fuzzy reasoning on the current physiological signal to obtain the fuzzy membership of the current time step includes:

[0007] Define the fuzzy set corresponding to each physiological signal;

[0008] Calculate the membership degree corresponding to each physiological signal according to the membership function;

[0009] Fuzzy reasoning is performed according to the membership degree corresponding to each physiological signal and a preset fuzzy rule set to obtain the fuzzy membership degree corresponding to each physiological signal.

[0010] Optionally, in another possible implementation manner of the first aspect, before inputting the fuzzy membership of the current time step into the LSTM layer and outputting the first LSTM output, the method further includes:

[0011] The fuzzy membership is defuzzified according to the centroid method.

[0012] Optionally, in another possible implementation manner of the first aspect, the LSTM layer includes a first LSTM layer and a second LSTM layer, and the step of inputting the fuzzy membership of the current time step into the LSTM layer and outputting the first LSTM output includes:

[0013] Input the fuzzy membership of the current time step and the fuzzy membership of the previous three time steps into the first LSTM layer and output the hidden state vector;

[0014] The hidden state vector is input to the second LSTM layer and the first LSTM output is output.

[0015] Optionally, in another possible implementation manner of the first aspect, the attention mechanism layer includes a linear layer and an activation function layer, and the step of inputting the first LSTM output to the attention mechanism layer and outputting the second LSTM output includes:

[0016] Set the positional encoding for the first LSTM output at each time step;

[0017] Input the first LSTM output to the linear layer and output the attention weight corresponding to the first LSTM output;

[0018] Input the attention weight corresponding to the first LSTM output into the activation function layer and output the normalized attention weight;

[0019] According to the first LSTM output of each time step and the normalized attention weight corresponding to the first LSTM output of each time step, the second LSTM output of each time step is output.

[0020] Optionally, in another possible implementation of the first aspect, the step of inputting the second LSTM output to the fully connected layer and outputting the blood glucose prediction result includes:

[0021] Through the residual connection, the second LSTM output of the last time step and the second LSTM output of each time step are added to obtain the third LSTM output;

[0022] The third LSTM output is input into the fully connected layer to output the blood glucose prediction result.

[0023] Optionally, in another possible implementation of the first aspect, after inputting the second LSTM output to the fully connected layer and outputting the blood glucose prediction result, the method further includes:

[0024] Obtaining an error value of each blood sugar prediction result according to each blood sugar prediction result and the true value corresponding to each blood sugar prediction result;

[0025] According to the error value of each blood glucose prediction result and the number of samples of the blood glucose prediction result, a mean square error is generated, and the accuracy of the blood glucose prediction result is optimized according to the mean square error.

[0026] In the second aspect, an embodiment of the present application provides a blood glucose prediction device, including: an acquisition module, used to acquire a current physiological signal, perform fuzzy reasoning on the current physiological signal, and obtain the fuzzy membership of the current time step; a first output module, used to input the fuzzy membership of the current time step into the LSTM layer, and output a first LSTM output; a second output module, used to input the first LSTM output into the attention mechanism layer, and output a second LSTM output; a third output module, used to input the second LSTM output into the fully connected layer, and output a blood glucose prediction result.

[0027] In a third aspect, an embodiment of the present application provides a terminal device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the blood glucose prediction method as described above when executing the computer program.

[0028] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the blood glucose prediction method as described above is implemented.

[0029] In the technical solution of the present application, the current physiological signal is first obtained, fuzzy reasoning is performed on the current physiological signal, the fuzzy membership of the current time step is obtained, and then the fuzzy membership of the current time step is input into the LSTM layer, the first LSTM output is output, and then the first LSTM output is input into the attention mechanism layer, the second LSTM output is output, and then the second LSTM output is input into the fully connected layer, and the blood glucose prediction result is output. Therefore, by combining the fuzzy reasoning method, the attention mechanism and the LSTM neural network for blood glucose prediction, the accuracy and reliability of non-invasive blood glucose prediction can be effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only 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.

[0031] Figure 1 is a flow chart of a blood sugar prediction method provided in one embodiment of the present application;

[0032] Figure 2is a flow chart of a blood sugar prediction method provided by another embodiment of the present application;

[0033] Figure 3 It is a schematic diagram of the model structure of the blood glucose prediction method provided in one embodiment of the present application;

[0034] Figure 4 is a flow chart of a blood sugar prediction device provided by an embodiment of the present application;

[0035] Figure 5 It is a schematic diagram of the structure of the terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0036] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0037] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0038] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0039] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0040] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0041] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0042] The blood glucose prediction method, apparatus, terminal device and storage medium provided in the present application are described in detail below with reference to the accompanying drawings.

[0043] Figure 1 A flow chart of a blood sugar prediction method provided in an embodiment of the present application is shown.

[0044] like Figure 1 As shown, the blood sugar prediction method comprises the following steps:

[0045] Step 101, obtaining a current physiological signal, performing fuzzy reasoning on the current physiological signal, and obtaining the fuzzy membership of the current time step.

[0046] For example, physiological signals may refer to signals such as systolic blood pressure, heart rate, and body temperature, and this application does not limit this.

[0047] Among them, fuzzy reasoning can refer to a control method based on fuzzy logic, which is used to deal with systems with high uncertainty and complexity. In fuzzy control, both input and output variables use fuzzy sets, and control rules are usually expressed in the form of "if...then..."

[0048] For example, there is currently a health monitoring system that determines the health status by measuring a person's heart rate and body temperature, and makes appropriate decisions through fuzzy control. Our goal is to decide whether to take action (such as rest, medical treatment, etc.) based on the heart rate and body temperature data:

[0049] Step 1: First, the input heart rate and body temperature data need to be fuzzified, that is, the precise values ​​are converted into fuzzy sets. For example, the input data of heart rate and body temperature may be as follows: heart rate: 70 beats / minute; body temperature: 37.5℃, and the following fuzzy sets are defined: heart rate: Low: below 60 beats / minute; Normal: 60 to 100 beats / minute; High: above 100 beats / minute, body temperature: Low: below 36.5℃; Normal: 36.5℃ to 37.5℃; High: above 37.5℃. These specific values ​​are mapped to fuzzy sets through membership functions. For a heart rate of 70 beats / minute and a body temperature of 37.5°C, we can calculate their membership in each fuzzy set: Heart rate of 70: belongs to the "normal" fuzzy set, with a membership of 0.8; belongs to the "low" fuzzy set, with a membership of 0.2 (less); Body temperature of 37.5°C: belongs to the "normal" fuzzy set, with a membership of 1.0; belongs to the "high" fuzzy set, with a membership of 0 (not at all high temperature).

[0050] Step 2: Define a set of fuzzy rules based on these fuzzy input data. For example, the health status based on heart rate and body temperature can be judged by the following rules: Rule 1: If the heart rate is normal and the body temperature is normal, the health status is normal; Rule 2: If the heart rate is high and the body temperature is normal, there may be health problems, and rest is recommended; Rule 3: If the heart rate is normal and the body temperature is high, there may be a fever, and rest is recommended; Rule 4: If the heart rate is high and the body temperature is high, there may be serious problems, and medical treatment is recommended.

[0051] Step 3: The reasoning process is to infer the output based on the fuzzy rules. For each rule, the membership of the input data is used to derive the membership of the output. For example, the reasoning process of Rule 2 is as follows: Input: Heart rate is normal (membership 0.8), body temperature is normal (membership 1.0); Reasoning: Rule 2 specifies that if the heart rate is high and the body temperature is normal, rest is recommended. The membership of the "rest" recommendation can be calculated based on the membership of the heart rate and body temperature. Finally, a fuzzy output will be obtained, such as the membership value of "rest".

[0052] Furthermore, in the embodiment of the present application, the above step 101 further includes:

[0053] Step 1011, defining a fuzzy set corresponding to each physiological signal;

[0054] Step 1012, calculating the membership degree corresponding to each physiological signal according to the membership function;

[0055] Step 1013: Perform fuzzy reasoning according to the membership degree corresponding to each physiological signal and a preset fuzzy rule set to obtain the fuzzy membership degree corresponding to each physiological signal.

[0056] Preferably, the membership function may be a Gaussian function.

[0057] In one embodiment, the blood pressure fuzzy set is defined as "low", "normal", and "high". Then the membership of the variable is calculated by the Gaussian function, and the formula is:

[0058]

[0059] where μ A (x) is the membership of the input value x in the fuzzy set A, C is the center of the Gaussian function (i.e., the maximum point of the membership function), and σ is the standard deviation, which determines the width of the membership (i.e., the degree of expansion of the fuzzy set).

[0060] Next, the inference process is carried out to derive the fuzzy output based on the fuzzy rule set and the fuzzy input. Fuzzy rules are usually expressed in the form of "if-then". For each rule, the membership of the output is calculated using the membership of the fuzzy input.

[0061] The reasoning process is the process of reasoning based on the fuzzy rule set and fuzzy input to obtain the fuzzy output. Fuzzy rules are usually expressed in the form of "if-then". The form of defining fuzzy rules is: if x1 is A1 and x2 is A1, then y is B. Among them, A1 and A2 are the fuzzy sets of input variables, and B is the fuzzy set of output variables.

[0062] Commonly used reasoning methods include the minimum rule and the multiplication rule. The formula is as follows. For given inputs x1 and x2, the membership of the fuzzy output is:

[0063]

[0064] Simple example: Assume the following rules:

[0065] Rule 1: If “blood pressure is low”, then “blood sugar is low”.

[0066] Rule 2: If “blood pressure is normal”, then “blood sugar is normal”.

[0067] Step 102, input the fuzzy membership of the current time step into the LSTM layer, and output the first LSTM output.

[0068] It should be noted that the LSTM layer plays a core role in time series modeling in the entire model and can effectively capture the long-term dependency of blood sugar levels. The LSTM layer contains an input gate i t 、Forget gate t and output gate o t, which can dynamically control the inflow, forgetting and output of information. The input gate is responsible for determining the importance of the current input information and how much of the current input information can enter the unit state; the forget gate determines the degree of retention of the previous information and determines how much information is forgotten from the unit state; and the output gate controls the information content output to the next layer and determines how much of the unit state can be output to the next time step. Through these gating mechanisms, LSTM can enhance its memory capacity, thereby improving the prediction effect of blood sugar changes. The calculation of each gate can be expressed as:

[0069] i t =σ(W i ·[h t-1 ,x t ]+b i )

[0070] f t =σ(W f ·[h t-1 ,x t ]+b f )

[0071] o t =σ(W o ·[h t-1 ,x t ]+b o )

[0072] Among them, σ is the Sigmoid activation function, W is the weight matrix, and b is the bias term.

[0073] The fuzzified membership values ​​will be input into the LSTM network to capture the dependencies in the time series data. The advantage of this structure is that through the combination of multiple layers of LSTM units, the feature learning ability of the model is significantly enhanced, and feature information closely related to changes in blood sugar levels can be extracted from complex time series data.

[0074] Furthermore, in the embodiment of the present application, before the above step 102, the following steps are further included:

[0075] The fuzzy membership is defuzzified according to the centroid method.

[0076] After obtaining the fuzzy membership through the above steps, it is necessary to perform defuzzification processing to convert the fuzzy membership into a specific clear output value. Common defuzzification methods include the centroid method and the maximum membership method. The centroid method is used in this embodiment, and its formula is:

[0077]

[0078] Where y is the output value, μ B (y) is the membership function of the fuzzy output.

[0079] The output value is then transmitted to the LSTM network.

[0080] Furthermore, in the embodiment of the present application, the above step 102 further includes:

[0081] Step 1021, input the fuzzy membership of the current time step and the fuzzy membership of the previous three time steps into the first LSTM layer, and output the hidden state vector.

[0082] Step 1022, input the hidden state vector to the second LSTM layer, and output the first LSTM output.

[0083] It should be noted that the LSTM layer includes the first LSTM layer and the second LSTM layer. The LSTM layer consists of two layers of stacked LSTM units. This design enables the model to better capture long-term dependencies and strengthen the modeling ability of time series data. Each LSTM layer outputs a hidden state for use by the next layer, further improving the network's deep learning capabilities. The first LSTM layer extracts low-level features from the input data, while the second LSTM layer can learn more abstract and complex temporal dependencies.

[0084] It should also be noted that in the LSTM network, the input structure is the fuzzy membership output by the fuzzy layer. The dimension of the output of this layer is n rules , represents the number of rules. In order to make a judgment on the prediction of the current moment, the number of time steps of LSTM is set to 3, which means that the LSTM layer considers the information of the past 3 time points in each input. This design aims to utilize the signal information of the past to capture the potential patterns in the time series.

[0085] Step 103, input the first LSTM output to the attention mechanism layer, and output the second LSTM output.

[0086] Furthermore, in the embodiment of the present application, the above step 103 further includes:

[0087] Step 1031, input the first LSTM output to the linear layer, and output the attention weight corresponding to the first LSTM output;

[0088] Step 1032, input the attention weight corresponding to the first LSTM output to the activation function layer, and output the normalized attention weight;

[0089] Step 1033: output the second LSTM output of each time step according to the first LSTM output of each time step and the normalized attention weight corresponding to the first LSTM output of each time step.

[0090] It should be noted that in the attention mechanism layer, the key technology is to assign weights to different time steps of LSTM so that the model can focus on the information that contributes more to blood glucose prediction. Therefore, before step 1031, a position code can also be generated for each time step to ensure that the position code is consistent with the current device. This step can be expressed by the following formula:

[0091]

[0092] Among them, pos represents the position index, i is the index of the feature dimension, and d model is the dimension of the model. The position encoding generated in this way can help the model better capture the position information of the time steps in the sequence and enable the model to consider the importance of each time step when calculating.

[0093] Next, a linear layer is used to calculate the attention weights for each time step. Assume that the output of the first LSTM at each time step is h t , the calculation formula of the linear layer is:

[0094] a t =W·h t +b

[0095] Among them, a t is the attention weight corresponding to the first LSTM output, W is the weight matrix, and b is the bias term. By calculating the weight scores of the first LSTM output of all time steps, the score of each time step can be obtained. Then, these weights are normalized using the Softmax function to ensure that the sum of the weights of each time step is 1:

[0096]

[0097] Among them, α t is the normalized attention weight, and T is the total number of time steps. This process ensures that the model can identify which time steps are most important for the current prediction.

[0098] After normalization, the first LSTM output h is calculated based on each time step. t The normalized attention weight α corresponding to the first LSTM output at each time step t , output the second LSTM output for each time step, the formula is as follows:

[0099]

[0100] In the embodiment of the present application, through this step, the model comprehensively utilizes the most relevant information in the input sequence, and the output finally generated can better reflect the contribution to blood glucose prediction, thereby improving the accuracy of the model. The introduction of the attention mechanism not only enhances the expressiveness of the model, but also improves the interpretability of the model, enabling it to more accurately locate the key time steps that affect the prediction.

[0101] Step 104, input the second LSTM output to the fully connected layer, and output the blood glucose prediction result.

[0102] It should be noted that the fully connected layer is an important part of the neural network, which is responsible for mapping the output of the previous layer to the final predicted value. In the present invention, the function of the fully connected layer is to integrate the features processed by the fuzzy layer, LSTM layer and attention mechanism, and finally generate the blood glucose prediction value.

[0103] Furthermore, in the embodiment of the present application, the above step 104 further includes:

[0104] Step 1041, through residual connection, add the second LSTM output of the last time step and the second LSTM output of each time step to obtain a third LSTM output.

[0105] Step 1042, input the third LSTM output to the fully connected layer, and output the blood glucose prediction result.

[0106] Before the fully connected layer, the second LSTM output h of the last time step is connected through a residual connection T Add the second LSTM output weighted_output of each time step to obtain the third LSTM output, which is a feature vector of fused information. This process can be expressed by the following formula:

[0107] residual_output=weighted_output+h T

[0108] The introduction of this residual connection mechanism helps alleviate the gradient vanishing problem in deep networks, allowing information to flow more efficiently, enhancing the learning ability of the model, and enabling the network to learn richer feature representations.

[0109] The output of the third LSTM after the residual connection is input into the fully connected layer, and the prediction value is calculated by the following formula:

[0110] output=W f residual_output+b f

[0111] In this formula, W fis the weight matrix of the fully connected layer, b f is the bias term. The output of the fully connected layer represents the model's prediction of blood glucose levels under the current input conditions, which is a continuous value. This mapping process ensures that the features learned by the deep network can be effectively converted into usable predictive information to support clinical decision-making.

[0112] The blood glucose prediction method provided by the present application first obtains the current physiological signal, performs fuzzy reasoning on the current physiological signal, obtains the fuzzy membership of the current time step, then inputs the fuzzy membership of the current time step into the LSTM layer, outputs the first LSTM output, then inputs the first LSTM output into the attention mechanism layer, outputs the second LSTM output, then inputs the second LSTM output into the fully connected layer, and outputs the blood glucose prediction result. Thus, by combining the fuzzy reasoning method, the attention mechanism and the LSTM neural network for blood glucose prediction, the accuracy and reliability of non-invasive blood glucose prediction can be effectively improved.

[0113] Figure 2 A flow chart of a blood glucose prediction method provided in yet another embodiment of the present application is shown.

[0114] like Figure 2 As shown, the blood sugar prediction method comprises the following steps:

[0115] Step 201, obtaining a current physiological signal, performing fuzzy reasoning on the current physiological signal, and obtaining the fuzzy membership of the current time step.

[0116] Step 202, input the fuzzy membership of the current time step into the LSTM layer, and output the first LSTM output.

[0117] Step 203, input the first LSTM output to the attention mechanism layer, and output the second LSTM output.

[0118] Step 204, input the second LSTM output to the fully connected layer, and output the blood glucose prediction result.

[0119] The specific implementation process and principle of the above steps 201-204 can be referred to the detailed description of the above embodiment, which will not be repeated here.

[0120] Step 205: Obtain an error value of each blood sugar prediction result according to each blood sugar prediction result and the true value corresponding to each blood sugar prediction result.

[0121] Step 206, generating a mean square error according to the error value of each blood glucose prediction result and the number of samples of the blood glucose prediction result, and optimizing the accuracy of the blood glucose prediction result according to the mean square error.

[0122] In machine learning models, mean squared error (MSE) is a common loss function that measures the difference between the model's predicted value and the true value. Its basic principle is to calculate the difference between the predicted value and the actual value, square the difference and average it to get an indicator to measure the prediction accuracy. In the blood glucose prediction method, MSE as a loss function can effectively monitor and optimize the performance of the model.

[0123] The calculation formula of MSE is as follows:

[0124]

[0125] Among them, y i is the true blood glucose value (label value) of the i-th sample, is the predicted blood glucose value of the ith sample, and n is the total number of samples.

[0126] The MSE is used to calculate the average sum of squares of the prediction errors of all samples. Each time a prediction is made, the goal of the model is to minimize this error, that is, to minimize the difference between the predicted value and the actual value, and to optimize the model by minimizing the prediction error.

[0127] The blood sugar prediction method provided by the present application first obtains the current physiological signal, performs fuzzy reasoning on the current physiological signal, obtains the fuzzy membership of the current time step, then inputs the fuzzy membership of the current time step into the LSTM layer, outputs the first LSTM output, then inputs the first LSTM output into the attention mechanism layer, outputs the second LSTM output, then inputs the second LSTM output into the fully connected layer, outputs the blood sugar prediction result, and then obtains the error value of each blood sugar prediction result according to each blood sugar prediction result and the true value corresponding to each blood sugar prediction result, and finally generates the mean square error according to the error value of each blood sugar prediction result and the number of samples of the blood sugar prediction result, and optimizes the accuracy of the blood sugar prediction result according to the mean square error. Thus, the difference between the blood sugar prediction value and the true blood sugar value is reduced by the mean square error, so that the accuracy and reliability of non-invasive blood sugar prediction can be effectively improved.

[0128] Figure 3 A schematic diagram of the model structure of the blood glucose prediction method provided by the present application is shown. First, the physiological signal is input into the fuzzy logic layer for fuzzy reasoning, and the fuzzy processed data is sent to the LSTM network layer to capture the dependencies in the time series data. Then, the LSTM output of each time step is positionally encoded and sent to the attention layer for weighted summation of the data. The feature vector of the fusion information generated by the output of the attention layer after residual connection is sent to the fully connected layer, and finally the prediction result is output through the fully connected layer.

[0129] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0130] Corresponding to the blood sugar prediction method in the above embodiment, Figure 4 A structural block diagram of a blood glucose prediction device provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.

[0131] Reference Figure 4 , the device 400 comprises:

[0132] An acquisition module 401 is used to acquire a current physiological signal, perform fuzzy reasoning on the current physiological signal, and acquire a fuzzy membership degree of a current time step;

[0133] A first output module 402, used for inputting the fuzzy membership of the current time step into the LSTM layer and outputting a first LSTM output;

[0134] A second output module 403, used to input the first LSTM output to the attention mechanism layer and output a second LSTM output;

[0135] The third output module 404 is used to input the second LSTM output into the fully connected layer and output the blood glucose prediction result.

[0136] In actual use, the blood glucose prediction device provided in the embodiment of the present application can be configured in any terminal device to execute the aforementioned blood glucose prediction method.

[0137] In a possible implementation of the embodiment of the present application, the acquisition module 401 includes:

[0138] A definition unit, used to define the fuzzy set corresponding to each physiological signal;

[0139] A calculation unit, used for calculating the membership corresponding to each physiological signal according to the membership function;

[0140] The acquisition unit is used to perform fuzzy reasoning according to the membership degree corresponding to each physiological signal and a preset fuzzy rule set to acquire the fuzzy membership degree corresponding to each physiological signal.

[0141] Furthermore, in a possible implementation of the embodiment of the present application, the apparatus 400 further includes:

[0142] The defuzzification module is used to defuzzify the fuzzy membership according to the centroid method.

[0143] Further, in a possible implementation of the embodiment of the present application, the LSTM layer includes a first LSTM layer and a second LSTM layer, and the first output module 402 includes:

[0144] A first output unit is used to input the fuzzy membership of the current time step and the fuzzy membership of the previous three time steps into the first LSTM layer, and output a hidden state vector;

[0145] The second output unit is used to input the hidden state vector into the second LSTM layer and output the first LSTM output.

[0146] Further, in a possible implementation of the embodiment of the present application, the attention mechanism layer includes a linear layer and an activation function layer, and the second output module 403 includes:

[0147] The encoding unit is used to set the position encoding for the first LSTM output of each time step;

[0148] The third output unit is used to input the first LSTM output into the linear layer and output the attention weight corresponding to the first LSTM output;

[0149] The fourth output unit is used to input the attention weight corresponding to the output of the first LSTM into the activation function layer, and output the normalized attention weight;

[0150] The fifth output unit is used to output the second LSTM output of each time step according to the first LSTM output of each time step and the normalized attention weight corresponding to the first LSTM output of each time step.

[0151] Furthermore, in a possible implementation of the embodiment of the present application, the third output module 404 includes:

[0152] An obtaining unit is used to add the second LSTM output of the last time step and the second LSTM output of each time step through a residual connection to obtain a third LSTM output;

[0153] The sixth output unit is used to input the third LSTM output into the fully connected layer and output the blood glucose prediction result.

[0154] Furthermore, in a possible implementation of the embodiment of the present application, the apparatus 400 further includes:

[0155] A second acquisition module is used to acquire an error value of each blood sugar prediction result according to each blood sugar prediction result and a true value corresponding to each blood sugar prediction result;

[0156] The generation module is used to generate a mean square error according to the error value of each blood sugar prediction result and the number of samples of the blood sugar prediction result, and optimize the accuracy of the blood sugar prediction result according to the mean square error.

[0157] The blood glucose prediction device provided by the present application first obtains the current physiological signal, performs fuzzy reasoning on the current physiological signal, obtains the fuzzy membership of the current time step, then inputs the fuzzy membership of the current time step into the LSTM layer, outputs the first LSTM output, then inputs the first LSTM output into the attention mechanism layer, outputs the second LSTM output, then inputs the second LSTM output into the fully connected layer, and outputs the blood glucose prediction result. Thus, by combining the fuzzy reasoning method, the attention mechanism and the LSTM neural network for blood glucose prediction, the accuracy and reliability of non-invasive blood glucose prediction can be effectively improved.

[0158] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0159] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0160] In order to implement the above embodiments, the present application also proposes a terminal device.

[0161] Figure 5 A schematic diagram of the structure of a terminal device according to an embodiment of the present application.

[0162] like Figure 5 As shown, the terminal device 200 includes:

[0163] The memory 210 and at least one processor 220, a bus 230 connecting different components (including the memory 210 and the processor 220), the memory 210 stores a computer program, and when the processor 220 executes the program, the blood glucose prediction method described in the embodiment of the present application is implemented.

[0164] Bus 230 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.

[0165] The terminal device 200 typically includes a variety of electronic device readable media, which can be any available media that can be accessed by the terminal device 200, including volatile and non-volatile media, removable and non-removable media.

[0166] The memory 210 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 240 and / or cache memory 250. The terminal device 200 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 260 may be used to read and write non-removable, non-volatile magnetic media ( Figure 5 not shown, usually called a "hard drive"). Although Figure 5 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical medium) may be provided. In these cases, each drive may be connected to bus 230 via one or more data medium interfaces. Memory 210 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present application.

[0167] A program / utility 280 having a set (at least one) of program modules 270 may be stored, for example, in the memory 210, such program modules 270 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 270 generally perform the functions and / or methods of the embodiments described herein.

[0168] The terminal device 200 can also communicate with one or more external devices 290 (e.g., keyboard, pointing device, display 291, etc.), and can also communicate with one or more devices that enable users to interact with the terminal device 200, and / or communicate with any device that enables the terminal device 200 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be carried out through an input / output (I / O) interface 292. In addition, the terminal device 200 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN) and / or public network, such as the Internet) through a network adapter 293. As shown in the figure, the network adapter 293 communicates with other modules of the terminal device 200 through a bus 230. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the terminal device 200, including but not limited to: microcode, device driver, redundant processing unit, external disk drive array, RAID system, tape drive, and data backup storage system, etc.

[0169] The processor 220 executes various functional applications and data processing by running the programs stored in the memory 210 .

[0170] It should be noted that the implementation process and technical principles of the terminal device of this embodiment refer to the aforementioned explanation of the blood glucose prediction method of the embodiment of the present application, and will not be repeated here.

[0171] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

[0172] An embodiment of the present application provides a computer program product. When the computer program product runs on a terminal device, the terminal device can implement the steps in the above-mentioned method embodiments when executing the computer program product.

[0173] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0174] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0175] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0176] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0177] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0178] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A blood sugar prediction method, characterized in that: include: Acquire a current physiological signal, perform fuzzy reasoning on the current physiological signal, and acquire a fuzzy membership degree of a current time step; Input the fuzzy membership of the current time step into the LSTM layer, and output the first LSTM output; Input the first LSTM output to the attention mechanism layer and output the second LSTM output; The second LSTM output is input into the fully connected layer to output the blood glucose prediction result.

2. The method according to claim 1, characterized in that The step of performing fuzzy reasoning on the current physiological signal to obtain the fuzzy membership of the current time step includes: defining a fuzzy set corresponding to each of the physiological signals; Calculating the membership degree corresponding to each of the physiological signals according to the membership function; Fuzzy reasoning is performed according to the membership degree corresponding to each of the physiological signals and a preset fuzzy rule set to obtain the fuzzy membership degree corresponding to each of the physiological signals.

3. The method according to claim 2, characterized in that Before inputting the fuzzy membership of the current time step into the LSTM layer and outputting the first LSTM output, the method further comprises: The fuzzy membership is defuzzified according to the centroid method.

4. The method according to claim 3, characterized in that The LSTM layer includes a first LSTM layer and a second LSTM layer, and the fuzzy membership of the current time step is input into the LSTM layer, and the first LSTM output is output, including: Input the fuzzy membership of the current time step and the fuzzy membership of the previous three time steps into the first LSTM layer, and output a hidden state vector; The hidden state vector is input to the second LSTM layer, and the first LSTM output is output.

5. The method according to claim 4, characterized in that The attention mechanism layer includes a linear layer and an activation function layer, and the step of inputting the first LSTM output to the attention mechanism layer and outputting the second LSTM output includes: Set a position encoding for the first LSTM output for each time step; Input the first LSTM output to the linear layer, and output the attention weight corresponding to the first LSTM output; Input the attention weight corresponding to the first LSTM output to the activation function layer, and output the normalized attention weight; Output the second LSTM output of each time step according to the first LSTM output of each time step and the normalized attention weight corresponding to the first LSTM output of each time step.

6. The method according to claim 5, characterized in that The step of inputting the second LSTM output to the fully connected layer and outputting the blood glucose prediction result includes: By using a residual connection, the second LSTM output of the last time step and the second LSTM output of each time step are added to obtain a third LSTM output; The third LSTM output is input into the fully connected layer to output the blood glucose prediction result.

7. The method according to any one of claims 1 to 6, characterized in that: After inputting the second LSTM output to the fully connected layer and outputting the blood sugar prediction result, the method further includes: According to each of the blood sugar prediction results and the true value corresponding to each of the blood sugar prediction results, obtaining an error value of each of the blood sugar prediction results; A mean square error is generated according to the error value of each blood sugar prediction result and the number of samples of the blood sugar prediction result, and the accuracy of the blood sugar prediction result is optimized according to the mean square error.

8. A blood sugar prediction device, characterized in that: include: An acquisition module, used for acquiring a current physiological signal, performing fuzzy reasoning on the current physiological signal, and acquiring a fuzzy membership degree of a current time step; A first output module, used for inputting the fuzzy membership of the current time step into the LSTM layer, and outputting a first LSTM output; A second output module, used to input the first LSTM output into the attention mechanism layer and output a second LSTM output; The third output module is used to input the second LSTM output into the fully connected layer and output the blood glucose prediction result.

9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.