A method for predicting myopia vision for adolescent vision training

Through the MTSformer prediction model, MCAM and TKMM modules are used to process the characteristics and time dimension relationships of adolescent vision data, which solves the overfitting and inaccuracy problems of traditional methods in adolescent vision prediction, and improves the accuracy of prediction and the adaptability of the model. .

CN118512149BActive Publication Date: 2024-10-29山东黄海智能装备有限公司

Patent Information

Application Number
CN202410968946.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-19
Publication Date
2024-10-29
Estimated Expiration
2044-07-19

AI Technical Summary

Technical Problem

Existing time series prediction methods are prone to overfitting and inaccurate prediction when processing adolescent vision data, especially when predicting vision changes over a long period of time, and are unable to effectively assess adolescent myopia risk and training effects.

Method used

An MTSformer prediction model is proposed, including MCAM module and TKMM module. Through fragmentation processing and multi-head adaptive attention mechanism, it processes the token tensor relationship of adolescent myopia vision data in the feature dimension and time dimension, and processes the relationship between different features. dependencies, combined with fully connected layers for prediction.

Benefits of technology

It improves the accuracy of myopia vision prediction for vision training, reduces overfitting and underfitting, enhances the flexibility and adaptability of the model, and can better capture time dependence and dynamic change characteristics between multiple variables.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118512149B_ABST
    Figure CN118512149B_ABST
Patent Text Reader

Abstract

The present invention proposes a myopia vision prediction method for teenagers' vision training, which relates to the field of machine learning. The present invention proposes an MTSformer prediction model, which is applied to the myopia vision prediction scenario of teenagers' vision training, and comprises an MCAM module, a TKMM module and a fully connected layer. The MCAM module processes the relationship between token tensors of teenagers' myopia vision time series data in feature dimensions and time dimensions, the TKMM module processes the dependency between different features of teenagers' myopia vision data in feature dimensions, and the fully connected layer further integrates the outputs of the MCAM module and the TKMM module for nonlinear transformation, thereby enhancing the expression ability of the model and improving the accuracy of prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of machine learning, and in particular relates to a myopia vision prediction method for vision training of teenagers. Background Art

[0002] In recent years, the myopia rate among young people has continued to rise and has become a global public health issue. High myopia not only affects the quality of learning and life, but may also cause a series of serious eye diseases, such as retinal detachment and macular degeneration. Early intervention and scientific vision training can help control the development of myopia. However, there is currently a lack of effective predictive methods to assess the myopia risk and training effects of adolescents, which makes the implementation and optimization of vision training face many challenges. Families and schools also have certain deficiencies in knowledge about myopia prevention and control and are unable to provide sufficient support and guidance.

[0003] Vision training mainly uses a series of eye movements and visual stimulation to enhance the adjustment ability of eye muscles and improve eye blood circulation, thereby achieving the purpose of preventing and correcting myopia. However, traditional vision training methods lack scientific prediction and personalized guidance, and the effect is limited. With the advancement of science and technology, using advanced algorithms and models to predict vision changes and then develop personalized vision training plans has become an effective way to solve this problem.

[0004] At present, time series prediction has made significant progress in many fields, but its application in adolescent vision training is still insufficient. Although traditional time series prediction methods, such as RNN, CNN and LSTM, can capture time dependency, they often perform poorly when processing vision data with multiple variables and complex dependencies, especially for the prediction of vision changes over a long time span. These methods are prone to overfitting and inaccurate prediction problems. To address this problem, the present invention proposes a myopia vision prediction method for adolescent vision training. Summary of the invention

[0005] The invention provides a myopia vision prediction method for teenagers' vision training. Aiming at the myopia vision prediction task, an MTSformer prediction model is proposed, which consists of an MCAM module, a TKMM module and a fully connected layer.

[0006] The technical method adopted by the present invention to achieve the above-mentioned purpose specifically comprises the following steps:

[0007] S1. Collect data related to adolescent myopia, including characteristics and target variables, and preprocess the collected data;

[0008] S2, use the Max-Min method to normalize the visual acuity data of adolescent myopia and divide the data set proportionally;

[0009] S3. Construct an MCAM module to process the relationship between token tensors in the feature dimension and time dimension of adolescent myopia vision data, which specifically includes the following steps:

[0010] S31. Use the fragmentation method to treat the myopia data of adolescents as time series data. t Split into segments of length P and convert into token tensor matrix X;

[0011] S32. Obtain the query Q, key K and value V of the token tensor matrix X through the fully connected layer, and adaptively determine the number of attention modules H and the dimension d of the attention module head , and press d head Dimensional splitting of multiple attention modules Q i , K i 、V i ;

[0012] S33, in the token tensor matrix X and multiple attention modules Q i , K i 、V i The attention is calculated separately, the values ​​in the time window are averaged using a moving average operation, and the attention matrix obtained by the fully connected layer is calculated.

[0013] S4. Construct a TKMM module to process the dependencies between different features in the feature dimension of adolescent myopia vision data, which specifically includes the following steps:

[0014] S41, the multiple attention modules Q obtained in step S32 i , K i 、V i , slice by token tensor dimension to obtain

[0015] S42, proposed an average adaptive weight dynamic projection method, With V i n Perform dimensionality reduction and smoothing to obtain the key after dimensionality reduction With value Dynamic projection and smooth back keys With value Dynamic projection, weighted summation to obtain the average adaptive weight key With value Dynamic projection of

[0016] S43, calculate the key after combining the average adaptive weight dynamic projection With value Representation, and calculate the final output attention score matrix

[0017] S5: Integrate the information of the MCAM module and the TKMM module, and complete the prediction through the fully connected layer.

[0018] Preferably, in step S1, the adolescent myopia vision-related data includes adolescent basic information data, left and right eye myopia degree data, left and right eye naked eye vision data, corrected vision data, learning environment data, axial length data, corneal curvature data, anterior chamber depth data, intraocular pressure data, and the mean method is used to fill in the missing data values. The specific formula is as follows:

[0019]

[0020] In the formula, X ave is the imputed mean, n is the number of missing values, x i is a non-missing value.

[0021] Preferably, in step S2, the Max-Min method is used to normalize the adolescent myopia vision data, and the training set and the test set are divided proportionally. The specific formula is as follows:

[0022]

[0023] In the formula, x is the visual acuity data of adolescents with myopia, x' is the normalized visual acuity data of adolescents with myopia, and x max is the maximum value in the data of myopia among adolescents, x min This is the minimum value in the myopia vision data for teenagers.

[0024] Preferably, in steps S3 and S31, a is defined t ∈R C is the visual acuity data of adolescents with myopia, where C is the characteristic number, t is the time, and the visual acuity matrix of adolescents with myopia input into the model is A=[a t-L+1 , …, a t ]∈R C×L , where C is the feature number of adolescent myopia vision data, L is the time step, and the adolescent myopia vision data matrix A is divided into N time step segments. The specific formula is as follows:

[0025]

[0026] In the formula, S is the stride, P is the segment length, and the segmented segments are combined into the initial token tensor matrix And the initial token tensor matrix is ​​converted into a token tensor matrix through a fully connected layer. The specific formula is as follows:

[0027]

[0028] In the formula, T0 is an additional token tensor used to aggregate global information, F1 is a fully connected layer, is the initial token tensor matrix, and E is the position embedding matrix, which is used to retain the time sequence information of the adolescent myopia vision time series data for each token tensor.

[0029] Preferably, by fragmenting the adolescent myopia vision data, dividing the adolescent myopia vision time series data into segments of fixed length and converting them into a token tensor matrix, it helps to convert long time series data into multiple short segments, retaining the time order information, and converting the data into a format suitable for model processing. Through fragmentation processing and token tensor matrix, the model can better understand and capture the time dependence and dynamic change characteristics in the adolescent myopia vision time series data. This method not only improves the data expression ability, but also enables the model to process data of different lengths and time steps, thereby improving the flexibility and adaptability of the model, while also simplifying the data processing process and improving the overall computing efficiency.

[0030] Preferably, in the steps S3 and S32, the query Q, key K and value V of the token tensor matrix X are obtained through the fully connected layer, and the specific formula is as follows:

[0031] Q=F q (X);

[0032] K=F k (X);

[0033] V=F v (X);

[0034] In the formula, F q 、F k 、F v is a fully connected layer, X is a token tensor matrix, and based on the input adolescent myopia data features, the number of attention modules H and the dimension d of each module are adaptively determined. head , the specific formula is as follows:

[0035]

[0036]

[0037] Where, d features is the dimension of the input adolescent myopia data, k is the hyperparameter for adjusting the relationship between the number of modules and features, H is the number of attention modules, and d head For each module dimension, the query Q, key K and value V of the token tensor matrix X are split into multiple attention modules. The specific formula is as follows:

[0038] Q i =Q[:,:,i·d head :(i+1)·d head ];

[0039] K i =K[:,:,i·d head :(i+1)·d head ];

[0040] V i =V[:,:,i·d head :(i+1)·d head ];

[0041] Where i=0, 1,…, H-1 is the i-th attention module, d head For each module dimension, Q i , K i 、V i is the query, key, and value for each attention module, and

[0042]

[0043] Preferably, the query, key and value of the token tensor matrix are obtained through the fully connected layer, and the number and dimension of the attention modules are adaptively determined. The adaptive multi-head attention mechanism can dynamically adjust the number and dimension of the attention modules according to the characteristics of the input data, thereby improving the flexibility and performance of the model when processing different types of data. Specifically, the token tensor matrix is ​​divided into multiple attention modules through the fully connected layer, and each module independently processes a part of the data features, thereby enhancing the adaptability and robustness of the model, being able to perform well when processing complex data, and reducing the problems of overfitting and underfitting.

[0044] Preferably, in steps S3 and S33, Q i , K i 、V i Slice on the feature dimension to get the sub-matrix of each feature. The specific formula is as follows:

[0045]

[0046]

[0047]

[0048] In the formula, is the sub-matrix of query, key, and value of the cth feature of the i-th attention module, and calculates the token tensor matrix and the attention scores of multiple attention modules. The specific formula is as follows:

[0049]

[0050]

[0051] In the formula, MA is the moving average method, is the submatrix of query and key, and is the scaling factor, d is the hidden dimension after linear transformation, N is the number of time steps, is the attention score of the token tensor matrix, For the attention scores of multiple attention modules, use and Calculate the attention matrix, use layer normalization to process the attention matrix, and obtain the output attention matrix through the fully connected layer. The specific formula is as follows:

[0052]

[0053]

[0054]

[0055]

[0056]

[0057] In the formula, is the attention score of the token tensor matrix, is the attention score of multiple attention modules, V i c is the submatrix of values, is the attention matrix of the token tensor matrix, is the attention matrix of multiple attention modules, λ1 and λ2 are learnable parameters for scaling, β1 and β2 are learnable parameters for translation, and μ1 and μ2 are related to They are The mean and variance of the attention matrix, is the normalized attention matrix.

[0058] Preferably, attention calculations are performed on the token tensor matrix and multiple attention modules respectively, and the values ​​in the time window are averaged using a moving average operation, and the attention matrix is ​​calculated. Slicing and attention calculations are performed on queries, keys, and values, which helps the model identify and understand important features and patterns in the data. The model can capture the relationship between different features. The moving average operation further smoothes fluctuations in the data and reduces the impact of noise on the model. By calculating the attention matrix, the model can focus on the most relevant parts of the data, thereby improving the accuracy of feature extraction and the stability of model prediction.

[0059] Preferably, in the steps S4 and S41, the query Q, key K and value V of the token tensor matrix X obtained in step S32 are sliced ​​according to the token tensor dimension, and the specific formula is as follows:

[0060]

[0061]

[0062]

[0063] In the formula, Q i , K i 、V i is the query, key, and value of each attention module, n is the index of the token tensor, and n=1, 2, ..., N+1, V i n The query, key, and value of the nth token tensor.

[0064] Preferably, multiple attention modules are sliced ​​according to the token tensor dimension, and the keys and values ​​are initially projected and reduced in dimension through a fully connected layer, which can reduce high-dimensional feature data to a low-dimensional space and reduce computational complexity, thereby helping to reduce the computational burden of the model while retaining key features in the data. At the same time, through the slicing operation, the model can independently process the feature relationship of each token tensor, reducing interference and complexity between different features, thereby improving the accuracy and effectiveness of feature representation, and improving the processing efficiency and flexibility of the model.

[0065] Preferably, in steps S4 and S42, a fully connected layer is used With V i n Perform preliminary projection dimensionality reduction to obtain the dynamic projection after dimensionality reduction. The specific formula is as follows:

[0066]

[0067]

[0068] In the formula, F pk 、F pv is the fully connected layer, V i n is the key and value of the nth token tensor, For dynamic projection of keys and values ​​after dimensionality reduction, use moving average operation to With V i n And smoothing, the specific formula is as follows:

[0069]

[0070]

[0071] In the formula, MA is the moving average method, V i n is the key and value of the nth token tensor, N t is the window size of the moving average, V i j is the i-th eigenvalue of the key matrix and value matrix at the j-th time step, For the dynamic projection of smoothed keys and values, an adaptive weight γ is proposed. The specific formula is as follows:

[0072] γ=σ(F γ (X f ));

[0073] Where σ is the sigmoid function, F γ is a fully connected layer used to calculate the adaptive weights, X f is the feature matrix, calculates the attention score, combines the dynamic projection after dimensionality reduction and the dynamic projection after smoothing, and performs weighted summation through adaptive weights. The specific formula is as follows:

[0074]

[0075]

[0076] In the formula, γ is the adaptive weight, F pk 、F pv is the fully connected layer, is the projection of keys and values ​​after dimensionality reduction, It is the smoothed key and value projection.

[0077] Preferably, the average adaptive weight dynamic projection method performs dimensionality reduction and smoothing on keys and values, combines adaptive weights for weighted summation, and enhances the accuracy and smoothness of feature representation. After preliminary projection and dimensionality reduction of keys and values ​​through the fully connected layer, the dynamic projection results are smoothed using a moving average operation. The smoothing reduces the noise in the data, making the projection results more stable, and introduces adaptive weights to dynamically adjust the weight distribution according to data characteristics, making the feature representation more accurate.

[0078] Preferably, the step S4, S43 calculates the key and value representation after combining the average adaptive weight dynamic projection, and the specific formula is as follows:

[0079]

[0080]

[0081] In the formula, V i n is the key and value of the nth token tensor, is the dynamic projection of the average adaptive weight key and value, To combine the representation of keys and values ​​after dynamic projection of average adaptive weights, and calculate the output through attention scores, the specific formula is as follows:

[0082]

[0083]

[0084] In the formula, is the scaling factor, is the query of the nth token tensor, is the key of the nth token tensor, To combine the average adaptive weighted dynamic projection key representation, is the attention matrix based on the global attention score, is the attention matrix based on the local attention score, and then the global and local attention scores are weighted summed to get the final output attention score matrix. The specific formula is as follows:

[0085]

[0086]

[0087] In the formula, α is the weighted coefficient of the global and local attention scores, which is used to adjust the proportion of the two. is the attention matrix based on the global attention score, is the attention matrix based on the local attention score, is the weighted sum matrix of global and local attention scores, To represent the dynamic projection value combined with the average adaptive weight, is the final output attention score matrix.

[0088] Preferably, by calculating the attention score matrix by combining the key and value representations after dynamic projection with average adaptive weights, the model can identify and focus on the most relevant parts of the data, thereby improving the accuracy of feature extraction and the stability of model prediction, and combining the global and local attention scores for weighted summation. The global attention score captures the overall characteristics of the data, while the local attention score focuses on the detailed changes in the data. The combination of the two enables the model to comprehensively consider features at different scales and improve the overall performance of the model.

[0089] Preferably, in step S5, the information of the MCAM module and the TKMM module are integrated, and the prediction is completed through the fully connected layer. The specific formula is as follows:

[0090]

[0091] Where W1 and W2 are weight matrices, b1 and b2 are bias vectors, and σ is the Sigmoid activation function. are the attention matrix and the final output attention score matrix obtained through the fully connected layer, and Y is the prediction result.

[0092] In summary, due to the adoption of the technical scheme, the beneficial effects of the present invention are as follows: the present invention proposes an MTSformer prediction model, which is applied to the myopia vision prediction scenario of youth vision training, including an MCAM module, a TKMM module and a fully connected layer. The MCAM module processes the relationship between token tensors of youth myopia vision time series data in the feature dimension and the time dimension, and the TKMM module processes the dependency between different features of youth myopia vision data in the feature dimension. The fully connected layer integrates the outputs of the MCAM module and the TKMM module for further nonlinear transformation to enhance the expression ability of the model, thereby improving the accuracy of the prediction. BRIEF DESCRIPTION OF THE DRAWINGS

[0093] Figure 1 A step-by-step diagram of a myopia vision prediction method for vision training for teenagers.

[0094] Figure 2 This is the structure diagram of the MTSformer prediction model.

[0095] Figure 3 This is the MCAM module structure diagram.

[0096] Figure 4This is the TKMM module structure diagram.

[0097] Figure 5 This is a diagram showing the fitting effect of myopia vision prediction for teenagers’ vision training using the MTSformer prediction model. DETAILED DESCRIPTION

[0098] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0099] See also Figure 1-Figure 5 The present invention provides a technical solution: a myopia prediction method for adolescent vision training, which processes the relationship between token tensors in the feature dimension and the time dimension of adolescent myopia time series data by constructing an MCAM module, and processes the dependency between different features of adolescent myopia data in the feature dimension by constructing a TKMM module, thereby improving the capture of time correlation and dynamic dependency between multiple variables in adolescent myopia data, thereby improving the accuracy of the model in predicting myopia for adolescent vision training. The specific steps are as follows: Figure 1 shown.

[0100] Construct the MTSformer prediction model, whose structure is as follows Figure 2 As shown, the specific steps are as follows:

[0101] S1. Collect data related to adolescent myopia, including features and target variables, and preprocess the collected data.

[0102] Furthermore, the data related to adolescent myopia vision include adolescent basic information data, left and right eye myopia data, left and right eye naked eye vision data, corrected vision data, learning environment data, axial length data, corneal curvature data, anterior chamber depth data, intraocular pressure data, and the mean method is used to fill in the missing data values. The specific formula is as follows:

[0103]

[0104] In the formula, X ave is the imputed mean, n is the number of missing values, x i is a non-missing value.

[0105] S2. Use the Max-Min method to normalize the adolescent myopia vision data and divide the data set proportionally.

[0106] Furthermore, the Max-Min method was used to normalize the visual acuity data of adolescent myopia, and the training set and test set were divided into a ratio of 8:2. The specific formula is as follows:

[0107]

[0108] In the formula, x is the visual acuity data of adolescents with myopia, x' is the normalized visual acuity data of adolescents with myopia, and x max is the maximum value in the data of myopia among adolescents, x min This is the minimum value in the myopia vision data for teenagers.

[0109] S31. Use the fragmentation method to treat the myopia data of adolescents as time series data. t Split into segments of length P and converted into a token tensor matrix X.

[0110] Further, the MCAM module is constructed, and its structure is as follows Figure 3 As shown, define a t ∈R C is the visual acuity data of adolescents with myopia, where C is the characteristic number, t is the time, and the visual acuity matrix of adolescents with myopia input into the model is A=[a t-L+1 , …, a t ]∈R C×L , where C is the feature number of adolescent myopia vision data, L is the time step, and the adolescent myopia vision data matrix A is divided into N time step segments. The specific formula is as follows:

[0111]

[0112] In the formula, S is the stride, P is the segment length, and the segmented segments are combined into the initial token tensor matrix And the initial token tensor matrix is ​​converted into a token tensor matrix through a fully connected layer. The specific formula is as follows:

[0113]

[0114] In the formula, T0 is an additional token tensor used to aggregate global information, F1 is a fully connected layer, is the initial token tensor matrix, and E is the position embedding matrix, which is used to retain the time sequence information of the adolescent myopia vision time series data for each token tensor.

[0115] S32. Obtain the query Q, key K and value V of the token tensor matrix X through the fully connected layer, and adaptively determine the number of attention modules H and the dimension d of the attention module head , and press d herd Dimensional splitting of multiple attention modules Qi , K i 、V i .

[0116] Furthermore, the query Q, key K and value V of the token tensor matrix X are obtained through the fully connected layer. The specific formula is as follows:

[0117] Q=F q (X);

[0118] K=F k (X);

[0119] V=F v (X);

[0120] In the formula, F q 、F k 、F v is a fully connected layer, X is a token tensor matrix, and based on the input adolescent myopia data features, the number of attention modules H and the dimension d of each module are adaptively determined. head , the specific formula is as follows:

[0121]

[0122]

[0123] Where, d features is the dimension of the input adolescent myopia data, k is the hyperparameter for adjusting the relationship between the number of modules and features, H is the number of attention modules, and d head For each module dimension, the query Q, key K and value V of the token tensor matrix X are split into multiple attention modules. The specific formula is as follows:

[0124] Q i =Q[:,:,i·d head :(i+1)·d head ];

[0125] K i =K[:,:,i·d head :(i+1)·d head ];

[0126] V i =V[:,:,i·d head :(i+1)·d head ];

[0127] Where i=0, 1,…, H-1 is the i-th attention module, d head For each module dimension, Q i , K i 、Vi is the query, key, and value for each attention module, and

[0128] S33, in the token tensor matrix X and multiple attention modules Q i , K i 、V i The attention is calculated separately, the values ​​in the time window are averaged using a moving average operation, and the attention matrix obtained by the fully connected layer is calculated.

[0129] Furthermore, Q i , K i 、V i Slice on the feature dimension to get the sub-matrix of each feature. The specific formula is as follows:

[0130]

[0131]

[0132] V i c =V i [:,c,:];

[0133] In the formula, V i c is the query, key, and value submatrices of the Cth feature of the i-th attention module, and calculates the token tensor matrix and the attention scores of multiple attention modules. The specific formula is as follows:

[0134]

[0135]

[0136] In the formula, MA is the moving average method, is the submatrix of query and key, and is the scaling factor, d is the hidden dimension after linear transformation, N is the number of time steps, is the attention score of the token tensor matrix, For the attention scores of multiple attention modules, use and Calculate the attention matrix, use layer normalization to process the attention matrix, and obtain the output attention matrix through the fully connected layer. The specific formula is as follows:

[0137]

[0138]

[0139]

[0140]

[0141]

[0142] In the formula, is the attention score of the token tensor matrix, is the attention score of multiple attention modules, V i c is the submatrix of values, is the attention matrix of the token tensor matrix, is the attention matrix of multiple attention modules, λ1 and λ2 are learnable parameters for scaling, β1 and β2 are learnable parameters for translation, and μ1 and μ2 are related to They are The mean and variance of the attention matrix, is the normalized attention matrix.

[0143] S41, construct TKMM module, its structure is as follows Figure 4 As shown, the multiple attention modules Q obtained in step S32 are i , K i 、V i , slice by token tensor dimension to obtain V i n .

[0144] Furthermore, the query Q, key K and value V of the token tensor matrix X obtained in step S32 are sliced ​​according to the token tensor dimension. The specific formula is as follows:

[0145]

[0146]

[0147] V i n =V[:,n,:];

[0148] In the formula, Q i , K i 、V i is the query, key, and value of each attention module, n is the index of the token tensor, and n=1, 2, ..., N+1, V i n The query, key, and value of the nth token tensor.

[0149] S42, proposed an average adaptive weight dynamic projection method, With V i n Perform dimensionality reduction and smoothing to obtain the key after dimensionality reduction With value Dynamic projection and smooth back keys With value Dynamic projection, weighted summation to obtain the average adaptive weight key With value Dynamic projection.

[0150] Furthermore, using the fully connected layer With V i n Perform preliminary projection dimensionality reduction to obtain the dynamic projection after dimensionality reduction. The specific formula is as follows:

[0151]

[0152]

[0153] In the formula, F pk 、F pv is the fully connected layer, V i n is the key and value of the nth token tensor, For dynamic projection of keys and values ​​after dimensionality reduction, use moving average operation to With V i n And smoothing, the specific formula is as follows:

[0154]

[0155]

[0156] In the formula, MA is the moving average method, V i n is the key and value of the nth token tensor, N t is the window size of the moving average, V i j is the i-th eigenvalue of the key matrix and value matrix at the j-th time step, For the dynamic projection of smoothed keys and values, an adaptive weight γ is proposed. The specific formula is as follows:

[0157] γ=σ(F γ (X f ));

[0158] Where σ is the sigmoid function, F γ is a fully connected layer used to calculate the adaptive weights, X f is the feature matrix, calculates the attention score, combines the dynamic projection after dimensionality reduction and the dynamic projection after smoothing, and performs weighted summation through adaptive weights. The specific formula is as follows:

[0159]

[0160]

[0161] In the formula, γ is the adaptive weight, F pk 、F pv is the fully connected layer, is the projection of keys and values ​​after dimensionality reduction, It is the smoothed key and value projection.

[0162] S43, calculate the key after combining the average adaptive weight dynamic projection With value Representation, and calculate the final output attention score matrix

[0163] Furthermore, the key and value representations after dynamic projection combined with the average adaptive weight are calculated. The specific formula is as follows:

[0164]

[0165]

[0166] In the formula, V i n is the key and value of the nth token tensor, is the dynamic projection of the average adaptive weight key and value, To combine the representation of keys and values ​​after dynamic projection of average adaptive weights, and calculate the output through attention scores, the specific formula is as follows:

[0167]

[0168]

[0169] In the formula, is the scaling factor, is the query of the nth token tensor, is the key of the nth token tensor, To combine the average adaptive weighted dynamic projection key representation, is the attention matrix based on the global attention score, is the attention matrix based on the local attention score, and then the global and local attention scores are weighted summed to get the final output attention score matrix. The specific formula is as follows:

[0170]

[0171]

[0172] In the formula, α is the weighted coefficient of the global and local attention scores, which is used to adjust the proportion of the two. is the attention matrix based on the global attention score, is the attention matrix based on the local attention score, is the weighted sum matrix of global and local attention scores, To represent the dynamic projection value combined with the average adaptive weight, is the final output attention score matrix.

[0173] S5: Integrate the information of the MCAM module and the TKMM module, and complete the prediction through the fully connected layer.

[0174] Furthermore, the information of the MCAM module and the TKMM module is integrated, and the prediction is completed through the fully connected layer. The specific formula is as follows:

[0175]

[0176] Where W1 and W2 are weight matrices, b1 and b2 are bias vectors, and σ is the Sigmoid activation function. are the attention matrix and the final output attention score matrix obtained through the fully connected layer, and Y is the prediction result.

[0177] Furthermore, the MTSformer prediction model was written in Python with version 3.9. Pytorch was selected as the framework in the CUDA11.27 environment and trained on NVIDIA Tesla V100 SXM2-16-GB GPUs. The dataset was 96 months of adolescent myopia vision data, which was input into the MTSformer prediction model after preprocessing. The training batch size was set to 128, and the learning rate Adam was selected as the optimizer with a learning rate of 1×10 -3 .

[0178] Furthermore, the MTSformer prediction model achieves the following fitting effect on the prediction of myopia vision in adolescent vision training: Figure 5As shown in the figure, it can be seen that the gray star-shaped curve of the model predicted data and the black triangle-shaped curve of the real data have a high degree of fit, and the trend of the predicted data is basically consistent with that of the real data. Although there are some fluctuations, the overall trend remains consistent. Specifically, the horizontal axis in the figure represents the date, and the vertical axis represents the degree of myopia in adolescents. By predicting 96 months of data, the MTSformer model can capture the overall trend of changes in myopia vision. The model's fitting effect in the early stage is particularly significant. As time goes by, the model gradually adjusts the prediction to better match the actual data. The difference between the real data and the predicted data is mainly concentrated at individual time points, but the overall error is small, indicating that the MTSformer model has good performance and stability when dealing with long-term vision change predictions. It can be seen from the experimental results that the MTSformer prediction model has high accuracy and reliability in predicting myopia vision in adolescent vision training, which provides a scientific basis for the formulation of personalized vision training programs.

Claims

1. A method for predicting myopia vision for adolescent vision training, It is characterized in that The following steps are involved: S1. Collect data related to adolescent myopia, including characteristics and target variables, and preprocess the collected data; S2, use the Max-Min method to normalize the visual acuity data of adolescent myopia and divide the data set proportionally; S3. Construct an MCAM module to process the relationship between token tensors in the feature dimension and time dimension of adolescent myopia vision data, which specifically includes the following steps: S31. Use the fragmentation method to treat the myopia data of adolescents as time series data. t Split into segments of length P and converted into a token tensor matrix X. Specifically, define a t ∈R C is the visual acuity data of adolescents with myopia, where C is the characteristic number, t is the time, and the visual acuity matrix of adolescents with myopia input into the model is A=[a t-L+1 , …, a t ]∈R C×L , where C is the feature number of adolescent myopia vision data, L is the time step, and the adolescent myopia vision data matrix A is divided into N time step segments. The specific formula is as follows: In the formula, S is the stride, P is the segment length, and the segmented segments are combined into the initial token tensor matrix And the initial token tensor matrix is ​​converted into a token tensor matrix through a fully connected layer. The specific formula is as follows: Where, T 0 is an additional token tensor used to aggregate global information, F 1 is the fully connected layer, is the initial token tensor matrix, and E is the position embedding matrix, which is used to retain the time sequence information of the adolescent myopia time series data for each token tensor; S32. Obtain the query Q, key K and value V of the token tensor matrix X through the fully connected layer, and adaptively determine the number of attention modules H and the dimension of the attention module, d head , and press d head Dimensional splitting of multiple attention modules Q i , K i 、V i Specifically, the query Q, key K and value V of the token tensor matrix X are obtained through the fully connected layer. The specific formula is as follows: Q=F q (X); K=F k (X); V=F v (X); In the formula, F q 、F k 、F v is a fully connected layer, X is a token tensor matrix, and based on the input adolescent myopia data features, the number of attention modules H and the dimension of each module are adaptively determined, d head , the specific formula is as follows: Where, d features is the dimension of the input adolescent myopia data, k is the hyperparameter for adjusting the relationship between the number of modules and features, H is the number of attention modules, and d head For each module dimension, the query Q, key K and value V of the token tensor matrix X are split into multiple attention modules. The specific formula is as follows: Q i =Q[:,:,i·d head :(i+1)·d head ]; K i =K[:,:,i·d head :(i+1)·d head ]; V i =V[:,:,i·d head :(i+1)·d head ]; Where i=0,1,…,H-1 is the i-th attention module, d head For each module dimension, Q i , K i 、V i is the query, key, and value of each attention module, and Q i , K i , S33, in the token tensor matrix X and multiple attention modules Q i , K i 、V i The attention is calculated separately, the values ​​in the time window are averaged using a moving average operation, and the attention matrix obtained by the fully connected layer is calculated. Specifically, Q i , K i 、V i Slice on the feature dimension to get the sub-matrix of each feature. The specific formula is as follows: In the formula, is the query, key, and value submatrices of the cth feature of the i-th attention module, and calculates the token tensor matrix and the attention scores of multiple attention modules. The specific formula is as follows: In the formula, MA is the moving average method, is the sub-matrix of query and key, and is the scaling factor, d is the hidden dimension after linear transformation, N is the number of time steps, is the attention score of the token tensor matrix, For the attention scores of multiple attention modules, use and Calculate the attention matrix, use layer normalization to process the attention matrix, and obtain the output attention matrix through the fully connected layer. The specific formula is as follows: In the formula, is the attention score of the token tensor matrix, is the attention score of multiple attention modules, is the submatrix of values, is the attention matrix of the token tensor matrix, is the attention matrix of multiple attention modules, λ 1 , 2 is a learnable parameter for scaling, β 1 , β 2 is a learnable parameter for translation, μ 1 , μ 2 and They are The mean and variance of the attention matrix, is the normalized attention matrix; S4. Construct a TKMM module to process the dependencies between different features in the feature dimension of adolescent myopia vision data, which specifically includes the following steps: S41, the multiple attention modules Q obtained in step S32 i , K i 、V i , slice by token tensor dimension to obtain Specifically, the query Q, key K and value V of the token tensor matrix X obtained in step S32 are sliced ​​according to the token tensor dimension. The specific formula is as follows: In the formula, Q i , K i 、V i is the query, key, and value of each attention module, n is the index of the token tensor, and n=1, 2, ..., N+1, The query, key, and value of the nth token tensor; S42, proposed an average adaptive weight dynamic projection method, and Perform dimensionality reduction and smoothing to obtain the key after dimensionality reduction With value Dynamic projection and smooth back keys With value Dynamic projection, weighted summation to obtain the average adaptive weight key With value Dynamic projection of and Perform preliminary projection dimensionality reduction to obtain the dynamic projection after dimensionality reduction. The specific formula is as follows: In the formula, F pk 、F pv is the fully connected layer, is the key and value of the nth token tensor, For dynamic projection of keys and values ​​after dimensionality reduction, use moving average operation to and And smoothing, the specific formula is as follows: In the formula, MA is the moving average method, is the key and value of the nth token tensor, N t is the window size of the moving average, is the i-th eigenvalue of the key matrix and value matrix at the j-th time step, For the dynamic projection of smoothed keys and values, an adaptive weight γ is proposed. The specific formula is as follows: γ=σ(F γ (X f )); Where σ is the sigmoid function, F γ is a fully connected layer used to calculate the adaptive weights, X f is the feature matrix, calculates the attention score, combines the dynamic projection after dimensionality reduction and the dynamic projection after smoothing, and performs weighted summation through adaptive weights. The specific formula is as follows: In the formula, γ is the adaptive weight, F pk 、F pv is the fully connected layer, is the projection of keys and values ​​after dimensionality reduction, is the smoothed key and value projection; S43, calculate the key after combining the average adaptive weight dynamic projection With value Representation, and calculate the final output attention score matrix Specifically, the key and value representations after dynamic projection combined with average adaptive weights are calculated. The specific formula is as follows: In the formula, is the key and value of the nth token tensor, is the dynamic projection of the average adaptive weight key and value, To combine the representation of keys and values ​​after dynamic projection of average adaptive weights, and calculate the output through attention scores, the specific formula is as follows: In the formula, is the scaling factor, is the query of the nth token tensor, is the key of the nth token tensor, To combine the average adaptive weighted dynamic projection key representation, is the attention matrix based on the global attention score, is the attention matrix based on the local attention score, and then the global and local attention scores are weighted summed to get the final output attention score matrix. The specific formula is as follows: In the formula, α is the weighted coefficient of the global and local attention scores, which is used to adjust the proportion of the two. is the attention matrix based on the global attention score, is the attention matrix based on the local attention score, is the weighted sum matrix of global and local attention scores, To represent the dynamic projection value combined with the average adaptive weight, is the final output attention score matrix; S5, integrate the information of the MCAM module and the TKMM module, and complete the prediction through the fully connected layer. The specific formula is as follows: Where W 1 , W 2 is the weight matrix, b 1 、b 2 is the bias vector, σ is the Sigmoid activation function, are the attention matrix and the final output attention score matrix obtained through the fully connected layer, and Y is the prediction result.

Citation Information

Patent Citations

  • Teenager myopia prediction method and system for vision correction

    CN117153407A

  • Personalized difference analysis method for retinopathy

    CN117877692A

Cited By

  • Teenager vision development trend prediction method and system based on multi-modal data fusion

    CN121122701A