Non-invasive blood glucose concentration prediction system and method based on deep triplet network
By adopting a deep Transformer triplet network in a non-invasive blood glucose concentration prediction system, combined with the improved Transformer network and SVR regression prediction network, the problems of low adaptability and computational complexity of existing methods are solved, and more efficient, stable and widely applicable blood glucose concentration prediction is achieved.
Patent Information
- Application Number
- CN202411942056.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2044-12-27
AI Technical Summary
The existing non-invasive blood glucose concentration prediction methods are low in adaptability, and the feature extraction part adopts the ResNet-18 network, which leads to poor performance when processing complex tasks, and deeper models will increase computational complexity and resource consumption.
A non-invasive blood glucose concentration prediction system based on the deep Transformer triplet network is adopted, including data acquisition, data processing, model construction and prediction modules, and the improved Transformer network and SVR regression prediction network are used to improve feature extraction and prediction performance.
The performance and stability of non-invasive blood sugar concentration prediction is improved, the applicability of the model to people with different signs is enhanced, performance degradation caused by noise and interference is reduced, and the training speed and resource consumption are relatively low.
Smart Images

Figure CN119380993B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of blood sugar detection, and in particular to the technical field of non-invasive blood sugar detection. Background Art
[0002] Data from the International Diabetes Federation (IDF) show that the number of diabetes patients worldwide is increasing dramatically, and this trend has driven the demand for more convenient and comfortable blood sugar monitoring methods. The development of non-invasive blood sugar monitoring equipment is at the forefront of diabetes management and has the potential to improve the quality of life of more than 400 million diabetics worldwide. However, there are currently many technical bottlenecks in non-invasive blood sugar detection technology, including weak detection capabilities of biological signals, individual differences (sweat and temperature, etc.), physiological time lag problems, challenges in algorithms and data processing technologies, and the convenience and stability of equipment.
[0003] The Chinese invention patent application "A non-invasive blood glucose concentration prediction method" (publication number CN118919080A) provides a prediction model based on a triplet neural network, improves the loss function of the triplet network, and proposes a TCLoss loss function based on ternary loss and contrast loss. The DTRSVR model under TCLoss constraints combines the optimization capabilities of the triplet neural network and the regression algorithm to improve the performance and stability of non-invasive blood glucose concentration regression prediction, reduce errors and fluctuations, and provide a new idea and technical means for non-invasive measurement of blood glucose concentration, which will help promote the development of clinical diagnosis, drug treatment, toxicant identification and other fields, and improve human health and quality of life. However, this method still has the problem of low adaptability. The main reason is that the feature extraction part adopts ResNet-18 network. Although ResNet-18 can extract rich features, its feature extraction ability may not be as good as some deeper network models, especially when dealing with complex tasks. It may seem incapable. This also led to the use of only two volunteers for verification in the subsequent verification of this invention patent application. However, the two volunteers cannot represent the common physical sign categories and cannot prove that this method is generally applicable to people with different physical signs. However, if a more complex model than ResNet-18 network is used for feature extraction, the computational complexity of the method will be increased. When the number of input samples is large, it is easy to lead to the problem of excessive computing time and computing resources and excessive cost. In addition, complex models will be at risk of performance degradation when facing noise, occlusion or other interference factors in the data. Summary of the invention
[0004] In order to solve the problem that the previous non-invasive blood glucose concentration prediction method is not universally applicable, the present invention proposes a non-invasive blood glucose concentration prediction system and method based on a deep Transformer triplet network, wherein the system includes a data acquisition module, a data processing module, a model building module and a prediction module;
[0005] The data acquisition module collects and preprocesses the spectral characteristic data of the volunteer's fingers;
[0006] The data processing module divides the preprocessed data into a training set, a validation set and a test set;
[0007] The model building module builds a non-invasive blood glucose concentration prediction model, and uses the data in the data processing module to train the non-invasive blood glucose concentration prediction model to obtain an optimal non-invasive blood glucose concentration prediction model; the non-invasive blood glucose concentration prediction model includes a triple input network, an improved Transformer network and an SVR regression prediction network in sequence;
[0008] The prediction module predicts the blood glucose concentration of the human body according to the optimal non-invasive blood glucose concentration prediction model.
[0009] Furthermore, the data acquisition module collects and preprocesses the spectral characteristic data of part of the volunteer's fingers, specifically: collects the volunteers' real blood glucose concentration data according to the oral glucose tolerance test, uses a near-infrared spectral imager to measure the partial reflection spectral data of the volunteers' fingers, and performs multivariate scattering correction processing on the reflection spectral data, then calculates the absorbance of the reflection spectrum according to the Lamber Beer law, and normalizes the absorbance of different wavelengths as the original spectral characteristic data.
[0010] Furthermore, the original spectral feature data is divided into a training set, a validation set, and a test set, where the training set is used to generate the model, the validation set is used to adjust the model parameters, and the test set does not participate in the training and generation of the model at all and is used to evaluate the model.
[0011] Furthermore, the training set, validation set, and test set are divided into triplets, and a concentration is randomly selected from all the true blood glucose concentration values of the subjects as the label value corresponding to the anchor sample. , when the label value is Extract positive samples within the range ,exist Extract negative samples within the range , forming a triple sample ,in , is the original anchor feature data; , is the original positive feature data; , is the original negative feature data; among them, Represents the positive sample label range parameter, Represents the negative sample label range parameter, Indicates the sample size.
[0012] Furthermore, the triplet input network divides the spectral data into three groups and inputs them into three groups of improved Transformer networks. The three groups of data correspond to the original anchor feature data, the original positive feature data, and the original negative feature data, respectively.
[0013] Furthermore, parameters are shared in the three groups of improved Transformer networks.
[0014] Furthermore, in the improved Transformer network, the improvements to the original Transformer network are as follows:
[0015] Before the data is input into the original Transformer network, the data is first embedded, and then position encoding is introduced to add a unique identifier to each position in the input sequence, using sine and cosine functions of different frequencies, through:
[0016]
[0017] Conduct, among which, is the index of the time step, is the feature index, is the characteristic dimension;
[0018] A gated residual network is introduced into the original Transformer network, a gated residual network is added before the multi-head attention module, and the gated residual network is used to replace the feedforward neural network in the original Transformer network.
[0019] The present invention also provides a non-invasive blood glucose concentration prediction method based on a deep triplet network, characterized in that the method comprises the following steps:
[0020] S1. Collect and preprocess the spectral characteristic data of some volunteers' fingers;
[0021] S2, dividing the preprocessed data into training set, validation set and test set;
[0022] S3, building a non-invasive blood glucose concentration prediction model, and using the data in the data processing module to train the non-invasive blood glucose concentration prediction model to obtain an optimal non-invasive blood glucose concentration prediction model; the non-invasive blood glucose concentration prediction model sequentially includes a triple input network, an improved Transformer network and an SVR regression prediction network;
[0023] S4. Predict human blood glucose concentration based on the optimal non-invasive blood glucose concentration prediction model.
[0024] The beneficial effects of the system of the present invention are:
[0025] (1) Transformer is selected to cooperate with the triplet network. Transformer itself has a strong ability to learn and represent features of long sequence data, and the structure of the triplet network can provide it with more supervision information. The comparison of positive and negative samples in the triplet network allows Transformer to learn the differences and similarities between different data samples more clearly, thereby generating more discriminative feature representations, which helps to improve performance in tasks such as regression prediction. In addition, the triplet network introduces the comparison of positive and negative examples to make Transformer more robust to changes in input data. When faced with noise, occlusion or other interference factors in the data, the model can make more accurate judgments and identifications based on the feature relationships learned by contrastive learning, reducing performance degradation caused by data perturbations. The loss function design of the triplet network enables Transformer to obtain more targeted gradient information during training. Comparing the difference between positive and negative examples to calculate the loss can guide the model to adjust parameters faster and converge in a direction that is more conducive to the optimization goal, thereby speeding up training and reducing training time and resource consumption.
[0026] (2) The specific improvement to the Transformer network is to add a gated residual network (GRN) before its multi-head attention module, that is, the input data is adjusted by the GRN before entering the multi-head attention layer. The GRN controls the flow of information through a learnable gating mechanism to dynamically adjust the input information entering the attention mechanism. During the training process, it automatically and selectively strengthens important features and suppresses unimportant information, avoiding the problem of redundant or insufficient information while maintaining the flexibility and expressiveness of the model.
[0027] In addition, GRN is used to replace the Feed-Forward Networks (FFN) in the traditional Transformer to generate feature representations after nonlinear transformation. In the traditional Transformer, FNN transforms the representation of each position independently, and the processing of each position is fixed without considering the difference in input. Therefore, for some input features, a simple feedforward network may cause information redundancy or over-emphasis on some irrelevant information. The gating mechanism of GRN enables the network to respond more carefully to different input information, rather than just applying fixed linear transformations and activation functions. This ability prompts GRN to improve the learning ability of Transformer and enable the model to capture deeper features and dependencies.
[0028] (3) There are four categories of volunteers in the system of the present invention, namely, thin men, fat men, thin women, and fat women. The body mass index (BMI) is used to measure the fatness or thinness of the human body. BMI = weight (kg) / height 2 (m*m). When the male BMI is between 25-29.9, it is considered to be fat; when the male BMI is lower than 18.5, it is considered to be thin; when the female BMI is between 25-29.9, it is considered to be fat; and when the female BMI is lower than 18.5, it is considered to be thin.
[0029] The experimental results show that the system of the present invention has achieved excellent results in all four groups of people, and the determination coefficient R 2 All are greater than 0.8. In the Clark Error Grid analysis designed by American diabetes expert Clark, all test points fall in Area A. Clark Error Grid is a tool used to evaluate the accuracy of blood glucose monitoring systems. Area A (clinical accuracy area) is the most ideal area, indicating that the difference between the blood measurement value and the reference value is within the clinically acceptable range, indicating that the blood glucose measurement results are very accurate and have little adverse effect on clinical decision-making. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 Schematic diagram of the process of the non-invasive blood glucose concentration prediction model in an embodiment of the present invention;
[0031] Figure 2 Schematic diagram of an improved Transformer network in an embodiment of the present invention;
[0032] Figure 3 Schematic diagram of a multi-head attention mechanism in an embodiment of the present invention;
[0033] Figure 4 are the four volunteers in different dimensions in the embodiment of the present invention. Clustered column chart of values;
[0034] Figure 5 are the four volunteers in different dimensions in the embodiment of the present invention. Clustered column chart of values;
[0035] Figure 6 The Clarke grid analysis diagram of the calculation results of the four groups of models in Table 3 in the embodiment of the present invention;
[0036] Figure 7 This is a graph showing the trend of training loss and validation loss during 300 training sessions when the TNN-SVR model is used for feature extraction in an embodiment of the present invention;
[0037] Figure 8 This is a graph showing the trend of training loss and validation loss during 300 training sessions when the TTSVR model is used for feature extraction in an embodiment of the present invention;
[0038] Fig. 9 The Clarke grid analysis diagram of the calculation results of the four groups of models in Table 4 in the embodiment of the present invention;
[0039] Fig.10 The Clarke grid analysis diagram of the calculation results of the four groups of models in Table 5 in the embodiment of the present invention;
[0040] Fig.11 It is a Clarke grid analysis diagram of the calculation results of the four groups of models in Table 6 in the embodiment of the present invention. DETAILED DESCRIPTION
[0041] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the protection scope of the present invention.
[0042] Embodiment 1,
[0043] This embodiment provides a non-invasive blood glucose concentration prediction system based on a deep triplet network, the system comprising a data acquisition module, a data processing module, a model building module and a prediction module;
[0044] The data acquisition module collects and preprocesses the spectral characteristic data of the volunteer's fingers;
[0045] The data processing module divides the preprocessed data into a training set, a validation set and a test set;
[0046] The model building module builds a non-invasive blood glucose concentration prediction model, and uses the data in the data processing module to train the non-invasive blood glucose concentration prediction model to obtain an optimal non-invasive blood glucose concentration prediction model; the non-invasive blood glucose concentration prediction model includes a triple input network, an improved Transformer network and an SVR regression prediction network in sequence;
[0047] The prediction module predicts the blood glucose concentration of the human body according to the optimal non-invasive blood glucose concentration prediction model.
[0048] Embodiment 2,
[0049] This embodiment further limits the embodiment 1 and further introduces the data acquisition module.
[0050] According to the oral glucose tolerance test (OGTT), the actual blood glucose concentration data of volunteers were collected, and the partial reflection spectrum data of volunteers' fingers was measured using a near-infrared spectral imager. The reflection spectrum data was corrected by multivariate scattering to reduce the data differences caused by physical scattering. Then, the absorbance of the reflection spectrum was calculated according to the Lamber Beer law, and the absorbance of different wavelengths was normalized as the original spectral feature data.
[0051] Embodiment 3,
[0052] This embodiment further limits the embodiment 1 and further illustrates the data processing module.
[0053] The original data is divided into training set, validation set and test set, where the training set is used to generate the model, the validation set is used to adjust the model parameters, and the test set does not participate in the training and generation of the model at all and is used to evaluate the model.
[0054] The training set, validation set, and test set are divided into triplets, and a concentration is randomly selected from all the true blood glucose concentration values of the subjects as the label value corresponding to the anchor sample , (No. The label value of the anchor sample extracted. ) in the label value Extract positive samples within the range ,exist Extract negative samples within the range , forming a triple sample ,in , is the original anchor feature data; , is the original positive feature data; , is the original negative feature data; among them, Represents the positive sample label range parameter, Represents the negative sample label range parameter, Indicates the sample size.
[0055] The triplet input network divides the spectral data into three groups and inputs them into the improved Transformer network. The three groups of data correspond to the original anchor feature data, the original positive feature data and the original negative feature data respectively.
[0056] Embodiment 4,
[0057] This embodiment further limits the embodiment 1 and further illustrates the model building module.
[0058] like Figure 1The figure shows the process flow of the non-invasive blood glucose concentration prediction model. First, the spectral data is divided into triplets and input into three improved Transformer networks with shared parameters for feature extraction. The weights are updated according to the TC Loss function and the training is repeated until the loss value is small enough or the maximum training batch is reached. The training is terminated and the characterization data with blood glucose spectrum information is output. Finally, the output feature data is transferred to the SVR regression prediction network for training and testing of the regression algorithm.
[0059] like Figure 2 The figure shows a schematic diagram of the improved Transformer network. The improvements to the original Transformer network are as follows:
[0060] Before the data is input into the original Transformer network, the data is first embedded, and then position encoding is introduced to add a unique identifier to each position in the input sequence, using sine and cosine functions of different frequencies, through:
[0061]
[0062] Conduct, among which, is the index of the time step, is the feature index, is the characteristic dimension;
[0063] A gated residual network (GRN) is introduced into the original Transformer network, a gated residual network is added before the multi-head attention module, and the gated residual network is used to replace the feedforward neural network in the original Transformer network.
[0064] The improved Transformer network includes a multi-head attention mechanism, a gated residual network, a residual link, and an addition and normalization module. Enter the improved Transformer network for feature extraction, for the Anchor branch, is a two-dimensional data matrix with dimension (batch-size, input-dim). In order to adapt the one-dimensional data to the multi-head attention mechanism and other sequence processing operations in the improved Transformer model, The time step dimension is expanded to become a three-dimensional matrix (batch-size, sequence-length, hidden-dim). Add position encoding, perform multi-head attention processing, residual connection and layer normalization, and output a three-dimensional matrix (batch-size, sequence-length, hidden-dim).
[0065] Introduction to positional encoding:
[0066] The improved Transformer network does not have the traditional RNN or CNN to capture the sequence order information, so the position encoding is introduced to add a unique identifier to each position in the input sequence. The position encoding has the same dimension d as the embedding, and the two can be added. Sine and cosine functions of different frequencies are used for this.
[0067] Introduce the multi-head attention mechanism:
[0068] The multi-head attention mechanism in the improved Transformer network maps the input to different attention subspaces to capture more features and semantic information. By computing multiple attention heads in parallel and concatenating and linearly transforming their results, the model can better learn different dependencies. When processing sequence data, the attention mechanism finds the most relevant information from the input sequence based on the given query (Query, Q), and weights and sums this information to generate the final output. In the attention mechanism, the query (Query, Q) represents the input currently being processed; the key (Key, K) represents the features of all input sequences, which are used to calculate the relevance to the query; the value (Value, V) represents the actual information in all input sequences, and the final output will be obtained based on the weighted sum of these values.
[0069] (Query, Q) where Query stands for query and Q is the abbreviation of Query, which stands for Query. Similarly, (Key, K) and (Value, V) are the same expressions.
[0070] For the Anchor branch, for anchors that have been expanded in the time step dimension and added with position encoding and whose dimensions are known to be (batch-size, sequence-length, hidden-dim) .
[0071] First, generate the weight matrices of Query, Key, and Value by random initialization , and , and the dimensions of the three weight matrices are (hidden-dim, d k ), where d k =hidden-dim / Num-heads is the characteristic dimension of each attention head, and Num-heads is the number of attention heads in multi-head attention. As the training parameters of the model, these three weight matrices are continuously updated through the back propagation algorithm during the training process. Their role is to project the input into the Query space, Key space and Value space:
[0072] .
[0073] The second step is to calculate the attention weights. Each multi-head attention mechanism will perform an independent linear transformation, which generates matrices corresponding to the Query, Key, and Value matrices respectively. Their dimensions are (batch-size, sequence-length, d k ). For each attention head, the dot product between the matrices corresponding to the Query and Key is calculated to get the attention score:
[0074] ;
[0075] Among them, Q is Query, K is Key, and V is Value. The calculated attention score dimension is (batch-size, sequence-length, 1), which represents the self-attention score of each sample in sequence-length time steps. Softmax is a normalized exponential function, which can limit each element to the range of (0, 1) and make the sum of all elements equal to 1. Indicates the transpose of the matrix corresponding to Key.
[0076] The third step is to perform a weighted summation, and perform a weighted summation of the obtained attention score and the matrix Value to obtain the updated feature representation. Among them, the shape of the attention score is (batch-size, sequence-length, 1), and the shape of the Value matrix is (batch-size, sequence-length, d k ), weighted by element-by-element multiplication, to obtain a new feature representation (batch-size, sequence-length, d k ).like Figure 3 shown.
[0077] The fourth step is to perform multi-head attention splicing. After Num-heads heads have been calculated independently, new feature representations of Num-heads groups are obtained respectively. These outputs are spliced back to (batch-size, sequence-length, hidden-dim) in the feature dimension, and then a linear transformation is performed to restore them to the original feature dimension.
[0078] Introduce residual links and layer normalization:
[0079] In the improved Transformer network, each encoder’s multi-head attention mechanism and gated residual network are surrounded by a residual connection and layer normalization step, such as Figure 2As shown, Figure 2 The addition and normalization in represents the layer normalization step, where "addition" represents residual connection, because the residual connection directly adds the input of the layer to the output of the layer, so there is the expression of "addition". After the residual connection, the obtained data is layer normalized. Its purpose is to stabilize the distribution and impose constrained space to express the ambiguity of each word to reduce the variance of the data in each dimension. Residual connection is a skip connection technology that adds the original input to the output processed by the self-attention mechanism. It not only retains the input information and allows the network to better transmit input data, but also prevents the gradient from disappearing and helps the model training more stable. In the residual connection, the two matrices are connected in an element-by-element manner.
[0080] The result of the residual connection (batch-size, sequence-length, hidden-dim) is normalized in layers, that is, the hidden-dim features of each sample are normalized so that the normalized features have zero mean and unit variance to ensure that the distribution of the data is more stable during the training process.
[0081] The improved Transformer network is combined with the triplet network to create a deep Transformer triplet network for extracting features for application in complex regression tasks. The improved Transformer network is used as a shared feature extraction network. For triplet , they extract features through three identical improved Transformer networks to ensure the consistency of the feature extraction process of the three. Among them, the two-dimensional data anchor containing batch information , positive example and negative examples Enter the Anchor branch, Positive branch and Nagetive branch respectively, and then use the transformer network structure to extract features, and finally obtain a triple feature representation with a dimension of (batch-size, output-dim) , and ,in Represents the parameter set in the improved Transformer network. After forward propagation, it is represented according to the triple feature , and And the corresponding label information, calculate the loss function TC Loss. Use the back propagation algorithm to calculate the gradient of the loss relative to the network parameters to guide the model to adjust the parameters. And use the Adam optimizer to update the weights to enhance the representation of data features in high-dimensional space. The training goal of the triplet neural network is to minimize the high-dimensional representation distance between the anchor point and the positive example. , while maximizing the high-dimensional representation distance between the anchor point and the negative example .
[0082] Adam is an improved optimization algorithm that combines the momentum-based optimization method with the adaptive learning rate-based optimization algorithm. It uses two independent momentum estimates to estimate the momentum of the gradient (first-order moment) and the momentum of the square of the gradient (second-order moment), and performs bias correction on the first-order moment and second-order moment of the gradient.
[0083] The core idea of the deep Transformer triplet network is to process anchor, positive and negative samples through an improved Transformer network with shared weights. Each input sample (anchor, positive and negative) first passes through an improved Transformer network with shared parameters to extract high-dimensional feature representations. These feature representations are then used to calculate the triplet loss function, namely the TC Loss function, to minimize the distance between the anchor and the positive example, while maximizing the distance between the anchor and the negative example. This method ensures that the extracted features are highly discriminative and can capture complex data patterns. The SVR regression prediction network is able to make accurate regression predictions based on these features. The training of the SVR regression prediction network includes selecting a suitable kernel function (such as a linear kernel or a radial basis kernel), adjusting the regularization parameters, and performing model validation and optimization to ensure the best performance in the regression task.
[0084] Original Features , and Embedding the network via triplet Transformer Mapping to high-dimensional feature space , we get the deep features . Further update the network parameters through triplet Transformer embedding network pre-training Get deep features with triplet characteristics After the network training is completed, the deep Transformer triplet network can extract features from the test data that was not involved in the training. Each input data sample will pass through the improved Transformer network to generate a high-dimensional vector of fixed length. These vectors represent the deep features of the input data and are used for further SVR regression tasks. The details of data processing and dimensionality changes are as follows:
[0085] (1) The dimension of the original spectral data is input-dim. The number of samples passed to the model in each batch training iteration is batch-size, and the data dimension is (batch-size, input-dim).
[0086] (2) The data is mapped to the hidden dimension hidden-dim through the embedding layer. The embedding layer consists of a fully connected layer, which can aggregate the global information of the input data and compress the original features into a lower-dimensional space to reduce the complexity of the data while retaining the key features and reducing the computational burden of subsequent layers. At this time, the data dimension is (batch-size, hidden-dim).
[0087] (3) Add position encoding to the data to enhance the model’s understanding of sequence position information. At this time, the data dimension remains unchanged and is still (batch-size, 1, hidden-dim).
[0088] (4) The data enters the Transformer block, which contains multi-head attention, layer normalization, gated residual network and residual link. The input and output dimensions of each layer are the same, and the dimension is maintained as (batch-size, 1, hidden-dim) in all layers.
[0089] (5) Map the data from the hidden dimension to the output dimension output-dim to obtain a deep feature with triplet characteristics , the data dimension is (batch-size, output-dim). The Transformer-based triplet neural network completes the feature extraction of spectral signals.
[0090] (6) Number of features It is input into the SVR regression prediction network, and each sample is represented by output-dim features. The SVR regression prediction network uses the radial basis function kernel (RBF kernel) to map the input features to a high-dimensional space. Through the kernel function, a hyperplane can be found in the high-dimensional space for regression to solve nonlinear problems. In the prediction stage, the SVR regression prediction network outputs a prediction value for each input sample, and the dimension of the prediction output is (batch-size, 1).
[0091] Embodiment 5,
[0092] This example experiments on the non-invasive blood glucose concentration prediction system based on the deep Transformer triplet network in the present invention to verify its effectiveness.
[0093] Data preparation:
[0094] The non-invasive blood glucose spectral signals of 4 volunteers were extracted to test the model effect, and the pre-processed blood glucose absorbance spectrum was obtained. The 4 volunteers used body mass index (BMI) to measure the fatness of the human body, namely, thin male, fat male, thin female, and fat female.
[0095] The preprocessed data of the four volunteers were divided into data sets. Five concentrations, or 450 samples, were randomly selected from all concentrations as the test set. To verify the universality of the regression algorithm, the spectral data corresponding to these concentrations were not involved in the training and generation of the model. Then, 20% of the data were randomly selected from the remaining 22 concentrations as the validation set, and the remaining 80% of the data were used as the training set.
[0096] Hyperparameter settings:
[0097] The setting of the threshold hyperparameter in the triplet is , The training process of the model adopts a two-layer iteration relationship. The first layer has 30 outer iterations, and each outer iteration contains 10 inner iterations.
[0098] The non-invasive blood glucose concentration prediction model constructed is obtained by splicing the triplet input network, the improved Transformer network and the SVR regression prediction network, and is named the Triplet Transformer SVR Network (TTSVR) model. TTSVR will be used instead in the subsequent introduction.
[0099] Regarding the setting of hyperparameters in TTSVR, the parameters of the modules of the triplet Transformer embedding network and regression prediction network used are shown in Table 1. The loss function The initial values of the parameters are specified as .
[0100] Table 1:
[0101]
[0102] According to the parameter information in Table 1, we can see that from the current anchor label label, samples with label y values in the range of [label-0.1, label+0.1] are selected as samples of the same category. After screening out samples of the same category, according to ap_pairs=10, one category will generate 100 pairs of triplets. The training data includes 22 blood glucose concentrations and will generate 2200 pairs of triplets, of which 80%, or 1760 pairs, are used as training sets, and 440 pairs are used as validation sets.
[0103] For the Anchor branch of the triplet network, enter the anchor point is a two-dimensional matrix (128, 149) containing batch-size information, where 128 represents the number of samples and 149 represents the number of features. After embedding changes and time step dimension expansion It becomes a three-dimensional matrix (128, 1, 32), and then enters the Transformer network structure improved by the shared network. In the multi-head attention processing, due to the number of heads of 8, the data becomes (128, 1, 4), and then the number of features is concatenated back to 32 dimensions. After global average pooling, the time step dimension is discarded, and the final output feature is represented as a two-dimensional matrix (128, Output-dim).
[0104] Predictive Analytics:
[0105] For TTSVR, the dimension of the output feature matrix has a great impact on the prediction results, so it is very necessary to determine the optimal output dimension. Using the control variable method, the output dimensions are set to 16, 32, 64, 128, 256, and 512 for research. This setting includes both the mapping of low-dimensional space and the mapping to higher dimensions, which is more comprehensive.
[0106] For the blood glucose spectrum data of four volunteers, the experimental results of the TTSVR model are shown in Table 2. , when the output dimension is 16, the four volunteers The values are all minimum values; for the evaluation index determination coefficient , when the output dimension is 16, the four volunteers The values are all maximum values. Therefore, we can know that the optimal output dimension of the TTSVR model for the data of four volunteers is 16.
[0107] Table 2:
[0108]
[0109] In order to intuitively demonstrate the regression prediction effect, the result data in Table 2 are visualized and the four volunteers under different dimensions are plotted. Value and Clustered column charts of values, such as Figure 4 and Figure 5 shown.
[0110] analyze Figure 4 It can be seen that when the output dimension is 16, the four volunteers The value is significantly smaller than other dimensions, and the lowest value is 0.0049. Figure 5 It can be seen that when the output dimension is 16, the four volunteers The value is significantly larger than other dimensions, and the maximum value is 0.8151.
[0111] Comparative experiment:
[0112] For the first selected volunteer, the regression results are shown in Table 3. Compared with other models, the TTSVR model proposed in this invention Value and The value is significantly better than other models, and its determination coefficient is increased by 0.2692 compared with the result of regression prediction using only SVR. Further analysis of the performance of different network structures under the same loss function setting shows that the determination coefficient of the model using Transformer is increased by 18.52% compared with the model without Transformer.
[0113] Table 3:
[0114]
[0115] In order to analyze the results intuitively, the Clark grid analysis diagram of the calculation results of the four groups of models in Table 3 is given (see Figure 6 ), where the horizontal axis of each image represents the reference blood glucose value (mg / dl), and the vertical axis represents the predicted blood glucose value (mg / dl); nearly half of the result points of the regression model using DBN-SVR for feature extraction fall into area B, nearly one-fifth of the result points of the regression model using TNN-SVR for feature extraction fall into area B, and all the result points of the regression model based on TTSVR for feature extraction fall into area A.
[0116] Figure 7 and Figure 8 The figure shows the trend change of training loss and validation loss during 300 training sessions when using the TNN-SVR model and the TTSVR model for feature extraction. It can be seen that with the increase in the number of training times, the training loss of the model based on TNN-SVR fluctuates slightly, and the validation loss fluctuates greatly. The training loss and validation loss of the model based on TTSVR maintain a consistent trend and converge quickly, which shows that the model training effect is good.
[0117] For the second selected volunteer, the regression results are shown in Table 4. Compared with other models, the TTSVR model proposed in this invention Value and The value is significantly better than other models. Compared with the results of regression prediction using only SVR, its mean square error is reduced by 0.0276 and the determination coefficient is increased by 0.4821. Further analysis of the performance of different network structures under the same loss function setting shows that compared with the model without Transformer, the determination coefficient of the model using Transformer is increased by 31.80%.
[0118] Table 4:
[0119]
[0120] In order to analyze the results intuitively, the Clark grid analysis diagrams of the calculation results of the four groups of models in Table 4 are given (see Fig. 9). Some of the result points of the DBN-SVR model fall into area B, and although the result points of the TNN-SVR model almost all fall into area A, In contrast, the result points of the TTSVR model not only fall 100% into area A, but are also closely distributed on the straight line All edges intersect with it.
[0121] For the third volunteer selected, the regression results are shown in Table 5. Compared with other models, the TTSVR model proposed in this invention Value and The value is significantly better than other models, and its determination coefficient is increased by 0.3600 compared with the result of regression prediction using only SVR. Further analysis of the performance of different network structures under the same loss function setting shows that the determination coefficient of the model using Transformer is increased by 13.97% compared with the model without Transformer.
[0122] Table 5:
[0123]
[0124] In order to analyze the results intuitively, the Clark grid analysis diagram of the calculation results of the four groups of models in Table 5 is given (see Fig.10 ). Both the DBN-SVR model and the TNN-SVR model have results that fall into area B. In contrast, 100% of the results from the TTSVR model fall into area A.
[0125] For the fourth volunteer selected, the regression results are shown in Table 6. Compared with other models, the TTSVR model proposed in this invention Value and The value is significantly better than other models. Compared with the results of regression prediction using only SVR, its mean square error is reduced by 0.3940 and the determination coefficient is increased by 0.6805. Further analysis of the performance of different network structures under the same loss function setting shows that the determination coefficient of the model using Transformer is increased by 21.13% compared with the model without Transformer.
[0126] Table 6:
[0127]
[0128] In order to analyze the results intuitively, the Clark grid analysis diagram of the calculation results of the four groups of models in Table 6 is given (see Fig.11 ). Some of the result points of the DBN-SVR model fall into area B, and although the result points of the TNN-SVR model almost all fall into area A, In contrast, the result points of the TTSVR model not only fall 100% into area A, but are also closely distributed on the straight line All edges intersect with it.
[0129] In summary, the experimental results strongly support that the TTSVR model is an effective regression prediction model, and its performance is significantly better than SVR, DBN-SVR, and TNN-SVR.
Claims
1. A non-invasive blood glucose concentration prediction system based on a deep triplet network, characterized in that: The system includes a data acquisition module, a data processing module, a model building module and a prediction module; The data acquisition module collects and preprocesses the spectral characteristic data of the volunteer's fingers; The data processing module divides the preprocessed data into a training set, a validation set and a test set; The model building module builds a non-invasive blood glucose concentration prediction model, and uses the data in the data processing module to train the non-invasive blood glucose concentration prediction model to obtain an optimal non-invasive blood glucose concentration prediction model; the non-invasive blood glucose concentration prediction model includes a triple input network, an improved Transformer network and an SVR regression prediction network in sequence; In the improved Transformer network, the improvements to the original Transformer network are as follows: Before the data is input into the original Transformer network, the data is first embedded, and then position encoding is introduced to add a unique identifier to each position in the input sequence, using sine and cosine functions of different frequencies, through: Conduct, among which, is the index of the time step, is the feature index, is the characteristic dimension; Introduce a gated residual network into the original Transformer network, add a gated residual network before the multi-head attention module, and use the gated residual network to replace the feedforward neural network in the original Transformer network; The prediction module predicts the blood glucose concentration of the human body according to the optimal non-invasive blood glucose concentration prediction model.
2. The non-invasive blood glucose concentration prediction system based on deep triplet network according to claim 1, characterized in that: The data acquisition module collects and preprocesses the spectral characteristic data of part of the volunteer's fingers, specifically: collects the volunteers' real blood glucose concentration data according to the oral glucose tolerance test, uses a near-infrared spectral imager to measure the partial reflection spectral data of the volunteers' fingers, and performs multivariate scattering correction on the reflection spectral data, then calculates the absorbance of the reflection spectrum according to the Lamber Beer law, and normalizes the absorbance of different wavelengths as the original spectral characteristic data.
3. The non-invasive blood glucose concentration prediction system based on deep triplet network according to claim 2 is characterized in that: The original spectral feature data is divided into training set, validation set and test set, where the training set is used to generate the model, the validation set is used to adjust the model parameters, and the test set does not participate in the training and generation of the model at all and is used to evaluate the model.
4. The non-invasive blood glucose concentration prediction system based on deep triplet network according to claim 3 is characterized in that: The training set, validation set, and test set are divided into triplets, and a concentration is randomly selected from all the true blood glucose concentration values of the subjects as the label value corresponding to the anchor sample , when the label value is Extract positive samples within the range ,exist Extract negative samples within the range , forming a triple sample ,in , is the original anchor feature data; , is the original positive feature data; , is the original negative feature data; among them, Represents the positive sample label range parameter, Represents the negative sample label range parameter, Indicates the sample size.
5. The non-invasive blood glucose concentration prediction system based on deep triplet network according to claim 4 is characterized in that: The triplet input network divides the spectral data into three groups and inputs them into three groups of improved Transformer networks. The three groups of data correspond to the original anchor feature data, the original positive feature data, and the original negative feature data, respectively.
6. The non-invasive blood glucose concentration prediction system based on deep triplet network according to claim 5, characterized in that: Parameter sharing in three groups of improved Transformer networks.
7. A non-invasive blood glucose concentration prediction method based on a deep triplet network, characterized in that: The method comprises the following steps: S1. Collect and preprocess the spectral characteristic data of some volunteers' fingers; S2, dividing the preprocessed data into training set, validation set and test set; S3, building a non-invasive blood glucose concentration prediction model, and using the data in the data processing module to train the non-invasive blood glucose concentration prediction model to obtain an optimal non-invasive blood glucose concentration prediction model; the non-invasive blood glucose concentration prediction model sequentially includes a triple input network, an improved Transformer network and an SVR regression prediction network; In the improved Transformer network, the improvements to the original Transformer network are as follows: Before the data is input into the original Transformer network, the data is first embedded, and then position encoding is introduced to add a unique identifier to each position in the input sequence, using sine and cosine functions of different frequencies, through: Conduct, among which, is the index of the time step, is the feature index, is the characteristic dimension; Introduce a gated residual network into the original Transformer network, add a gated residual network before the multi-head attention module, and use the gated residual network to replace the feedforward neural network in the original Transformer network; S4. Predict human blood glucose concentration based on the optimal non-invasive blood glucose concentration prediction model.
Citation Information
Patent Citations
Gating Transform traffic signal control of Transform Light based on sequence modeling
CN117523845A
Noninvasive blood glucose concentration prediction method
CN118919080A