An automatic classification method and system for rare fundus diseases based on OCT images
The meta-learning method of metadata enhancement and consistency loss solves the problem of insufficient performance of traditional deep learning in the classification of rare fundus diseases, achieves efficient classification results with a small number of samples, and improves the adaptability and stability of the model.
Patent Information
- Application Number
- CN202410869834.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-01
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2044-07-01
AI Technical Summary
Traditional deep learning methods perform poorly in the classification of rare fundus diseases and cannot effectively utilize limited annotated data. Moreover, small sample learning methods are greatly affected by the training sample size and initial model parameter selection, resulting in a decline in model performance on new tasks. .
A meta-learning method based on metadata enhancement and consistency loss is adopted to build a small sample classification network model suitable for rare fundus diseases by learning knowledge from common fundus disease data, and using inner loop and outer loop training mechanisms to improve the generalization of the model. capability and stability.
It significantly improves the classification performance of rare fundus diseases and can quickly adapt and accurately classify when faced with a small amount of sample data, which is better than other small sample learning methods.
Smart Images

Figure CN118411573B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image classification, and in particular to an automatic classification method and system for rare fundus diseases based on OCT images. Background Art
[0002] The retina is an important part of the human eye, and the health of the retina is crucial to the human visual system. Any damage, disease or abnormality of the retina may lead to eye problems or visual impairment. Optical Coherence Tomography (OCT) technology is widely used in the diagnosis of retinal diseases in the field of ophthalmology. Automatic classification of retinal OCT images can effectively help doctors screen, diagnose and follow up patients. At present, convolutional neural networks have been widely used in the field of medical imaging, providing assistance for the automatic screening of some common diseases. However, for rare diseases with a small number of cases, traditional deep learning methods cannot achieve good results.
[0003] Few Shot Learning (FSL) has attracted widespread attention in many fields such as image classification, object detection, and semantic segmentation. One of the important reasons is that the training of deep learning relies on a large amount of labeled data. In some practical applications, such as rare diseases, animals, plants, etc., it is very difficult to obtain a sufficient number of samples. The goal of few-shot learning is to identify new categories using only a small number of labeled samples. In fact, the emergence of few-shot learning is inspired by the human learning mechanism. When faced with new tasks or new categories, humans are usually able to quickly learn and generalize knowledge from limited samples. This ability has inspired researchers to conduct research on few-shot learning to enable machine learning methods to simulate the way humans learn.
[0004] The meta-learning method is an important approach to deal with small sample learning problems. Its core idea is to let the model learn the ability to analyze and solve problems from past knowledge and experience, thereby guiding the learning process of new tasks. In this way, the model can quickly adapt and solve problems when faced with new tasks using only a small amount of sample data. Model-Agnostic Meta-Learning (MAML) is one of the most classic methods of meta-learning. The core of this method is to maximize the sensitivity of the loss function to the weights initialized for the new task. Regardless of the model used, the weights are optimized along the direction of the sum of the gradient vectors of each task, and the optimal weights of the model are estimated for the new task, so that it can achieve good results on the new task. Since then, many scholars have optimized and improved MAML in many aspects. Summary of the invention
[0005] In view of the above problems existing in the prior art, the present invention is proposed.
[0006] Therefore, the present invention provides an automatic classification method for rare fundus diseases based on OCT images, which can solve the problem that traditional deep learning cannot effectively classify rare fundus diseases. Classification methods based on deep learning can only rely on a large amount of labeled data for training. When faced with a limited number of rare diseases, they cannot fully learn their characteristics and have low classification performance. When the number of common and rare diseases used in training is unbalanced, the model tends to predict common categories and rare categories cannot be accurately classified. Retinal OCT images cover a variety of diseases and normal conditions without diseases. There may be large intra-class differences and inter-class similarities between samples, making it difficult for the model to accurately distinguish different categories. After the deep learning model is trained, it is only applicable to the same tasks as the training set. When faced with new data or new tasks that are different from the training data, the performance of the model will be greatly reduced. The performance of existing small sample learning methods is still limited by the amount of training samples, and the category features cannot be fully learned, and the performance of the method is greatly affected by the selection of initial model parameters.
[0007] The purpose is to allow the network model to learn knowledge and experience from a large amount of OCT image data of common fundus diseases, so as to guide the learning process of the new task of classifying rare fundus diseases. In this way, the network model can quickly adapt to the classification of rare fundus diseases using only a small amount of sample OCT image data, and obtain better classification performance. The meta-learning method based on metadata enhancement and consistency loss proposed in the present invention generates data samples, alleviates the problem of poor generalization of model performance due to sample size limitations, and helps improve the model's ability to distinguish different categories and better adapt to unseen data; the present invention can effectively improve the performance of rare fundus disease classification based on OCT images, and shows superiority compared with other existing small sample learning methods.
[0008] In order to solve the above technical problems, the present invention provides the following technical solutions: a method for automatically classifying rare fundus diseases based on OCT images, comprising: building a retinal OCT image classification network based on a residual module and a fully connected layer, the network taking the OCT image as input and the image lesion category label as output; constructing a common fundus disease training set, training a classification network model based on all training samples in the training set, and obtaining initial parameters of the classification network model; based on the common fundus disease training set, randomly constructing a small sample training task for common diseases, and further training the network, comprising an inner loop and an outer loop, the inner loop is embedded in the outer loop, and each outer loop contains multiple inner loops; randomly selecting samples from the common fundus disease training set. Take K types of lesion categories, randomly select less than 26 samples from each category, and train a small sample classification network model suitable for a specific category combination based on metadata enhancement and unlabeled query update strategy to obtain a small sample classification network model for common diseases; according to the training results of multiple small sample classification network models obtained by multiple rounds of inner loops, introduce consistency loss to train a small sample classification network model that can be widely applied to different common disease combinations; construct a training set for rare fundus diseases, and based on the training samples, fine-tune the small sample classification network model obtained by meta-training to obtain a small sample classification network model suitable for rare diseases; input OCT images into the small sample classification network model for rare diseases to obtain the classification results of lesion types.
[0009] As a preferred embodiment of the method for automatic classification of rare fundus diseases based on OCT images described in the present invention, the retinal OCT image classification network includes: the first 15 layers of the network are 3×3 convolution layers, the 16th layer is a fully connected layer, the number of convolution channels of the 1st, 2nd and 3rd layers is 64, the number of convolution channels of the 4th, 5th, 6th and 7th layers is 128, the number of channels of the 8th, 9th, 10th and 11th layers is 256, the number of channels of the 12th, 13th, 14th and 15th layers is 512, the outputs of the 1st and 3rd layers, the outputs of the 5th and 7th layers, the outputs of the 9th and 11th layers, and the outputs of the 13th and 15th layers are directly added through residual connections and then input into the next layer, the outputs of the 3rd and 5th layers, the outputs of the 7th and 9th layers, and the outputs of the 11th and 13th layers are respectively added through residual connections containing 1×1 convolution and changing the number of channels and then input into the next layer;
[0010] The network takes OCT images as input and outputs the predicted probability of the image belonging to each type of lesion. The maximum value of the probability of each category is the corresponding category as the final image classification result. The first 15 convolutional layers are represented as feature extractors. , the fully connected layer is represented as a classifier .
[0011] As a preferred solution of the method for automatic classification of rare fundus diseases based on OCT images described in the present invention, wherein: the initial parameters of the classification network model are obtained by constructing a common fundus disease training set, based on all training samples and true labels of all categories in the training set, and All parameters are trained, and the pre-trained weights are obtained by gradient descent optimization. The pre-trained feature extractor Contains a series of weights W and biases b.
[0012] As a preferred solution of the method for automatic classification of rare fundus diseases based on OCT images described in the present invention, the further training of the network includes freezing the pre-trained feature extractor. Contains a series of weights W and biases b, freezes the weights and biases, and adjusts them using shift and scale operations with a scaling factor of , the mobility coefficient is , the adjusted network weight is , biased to , the meta-training phase is and classifier Parameters Perform training and meta-training to optimize parameters To include , A collection of parameters.
[0013] As a preferred solution of the method for automatic classification of rare fundus diseases based on OCT images described in the present invention, the inner loop includes constructing a small sample training task set. , where the i-th task is Each task contains K categories in the common disease data set. In each category, N samples are randomly selected to form the support set data. , M samples constitute the query set data , two sets of network parameters are used in the optimization and , are initialized to the parameters obtained in the previous outer loop ;
[0014] The metadata enhancement includes: performing mixed data enhancement on the query set data in the inner loop to obtain a new query set to increase data diversity and improve the generalization ability of the model, and selecting two samples from the query set and , and calculate the linear interpolation of samples and labels:
[0015] ,
[0016] ,
[0017] in, and Refers to two images respectively, and Refers to the category labels of the two images respectively, is a random interpolation coefficient between 0 and 1. The generated virtual samples are used to replace the original samples to obtain a new query set. ;
[0018] For samples in the support set , use the cross entropy function to calculate the loss function:
[0019] ,
[0020] in, yes The predicted value obtained through the network output, k is the category number, for Whether it belongs to the label of the kth category, n represents the number of support set samples, C represents the number of categories, Expressed as the support set loss function, for the samples in the query set , using entropy regularization to calculate the loss function:
[0021] ,
[0022] in, yes The predicted value obtained through the network output, m represents the number of query set samples, Expressed as a query set loss function;
[0023] Update parameters using gradient descent :
[0024] ,
[0025] in, Express Find the gradient, Represented as the inner loop learning rate;
[0026] The new query set calculates the loss function separately and updates the parameters ,
[0027] ,
[0028] in, is the cross entropy loss function on the new query set obtained by metadata enhancement, Express Find the gradient.
[0029] As a preferred solution of the method for automatic classification of rare fundus diseases based on OCT images described in the present invention, the outer loop includes and The difference between is the data distribution difference between the support set and the query set. and The Frobenius norm of the parameter difference is used as a meta-regularization term in the outer loop loss function to improve the consistency of the network learning on different data. The consistency loss is calculated as follows: ,
[0030] in, is the Frobenius norm, calculated as the square root of the sum of the squares of the absolute values of the matrix elements;
[0031] In the outer loop, for a task batch consisting of B tasks, the loss on the new query set is calculated, added to the consistency loss, and summed over all tasks, and the model parameters are adjusted. Perform a gradient descent update,
[0032] ,
[0033] in, is the regularization weight, , is a set of tasks for a batch, Express Find the gradient, represents the i-th task, Indicates that the i-th task takes The cross entropy loss on the new query set, represents the consistency loss of the i-th task.
[0034] As a preferred solution of the method for automatic classification of rare fundus diseases based on OCT images described in the present invention, the small sample classification network model includes constructing a rare fundus disease training set, the number of categories is K, and N samples are used for each rare disease. The values of K and N are the same as those in the inner loop. Based on sample training, adaptation to new tasks is performed, and the model parameters finally output by the outer loop are used as initial values. Gradient descent optimization is performed on the small sample training set of rare fundus diseases, so that the model can adapt to new tasks and obtain a small sample classification network model suitable for rare diseases.
[0035] Another object of the present invention is to provide an automatic classification system for rare fundus diseases based on OCT images. The retinal OCT image classification network is based on residual modules and fully connected layers, which can efficiently process and classify OCT images, improve classification accuracy and deep feature extraction capabilities. The pre-training module pre-trains the classification network through common fundus disease training sets, optimizes the initial model, and reduces subsequent training time and resources. The meta-training module designs small sample training tasks to improve the adaptability and generalization ability of the model to small sample data. The inner loop training module uses metadata enhancement and unlabeled query update strategies to significantly enhance the small sample classification ability and preliminarily construct a rare disease classification model. The outer loop training module introduces consistency loss, and optimizes the classification network through multiple rounds of inner loops to enhance the stability of the model and its adaptability to different lesion combinations. The adjustment module fine-tunes the small sample classification network based on the rare fundus disease training set to improve the accuracy and specificity of the model in classifying rare lesions. The classification module inputs the OCT image into the fine-tuned rare disease classification network and quickly outputs the classification results of the lesion type.
[0036] As a preferred solution of the OCT image-based rare fundus disease automatic classification system described in the present invention, it includes: a retinal OCT image classification network, a pre-training module, a meta-training module, an inner loop training module, an outer loop training module, an adjustment module, and a classification module;
[0037] Retinal OCT image classification network, based on residual module and fully connected layer, the retinal OCT image classification network is built. The network takes OCT image as input and image lesion category label as output;
[0038] Pre-training module, builds a training set of common fundus diseases, trains the classification network model based on all training samples in the training set, and obtains the initial parameters of the classification network model;
[0039] The meta-training module randomly constructs small sample training tasks for common diseases based on the common fundus disease training set to further train the network. It includes an inner loop and an outer loop. The inner loop is embedded in the outer loop, and each outer loop contains multiple inner loops.
[0040] The inner loop training module randomly selects K lesion categories from the common fundus disease training set, and randomly selects less than 26 samples from each category. Based on metadata enhancement and unlabeled query update strategy, a small sample classification network model suitable for category combination is trained to obtain a small sample classification network model for common diseases.
[0041] The outer loop training module introduces consistency loss based on the training results of multiple small sample classification network models obtained through multiple rounds of inner loops, and trains small sample classification network models that can be widely applied to different common disease combinations;
[0042] Adjust the module, build a rare fundus disease training set, and fine-tune the small sample classification network model obtained by meta-training based on the training samples to obtain a small sample classification network model suitable for rare diseases;
[0043] The classification module inputs the OCT image into the rare disease small sample classification network model to obtain the classification result of the lesion type.
[0044] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and wherein when the processor executes the computer program, the processor implements the steps of any one of the methods for automatically classifying rare fundus diseases based on OCT images.
[0045] A computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps of any one of the methods for automatically classifying rare fundus diseases based on OCT images are implemented.
[0046] Beneficial effects of the present invention: The present invention first helps the network converge quickly and alleviates the overfitting problem that is easily caused by MAML training in deep networks by migrating large-scale pre-trained deep neural network weights. Then, in the meta-training process, an unlabeled query update strategy is designed to improve the generalization of the model. And mixed data enhancement is performed on the query set data to help the model better adapt to unprecedented tasks. Finally, the mechanism of learning consistency loss is introduced to help eliminate data distribution differences, so that the model can learn more consistent knowledge. Finally, better classification results were achieved on the rare fundus disease OCT dataset. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0048] Figure 1 A schematic flow chart of a method for automatically classifying rare fundus diseases based on OCT images provided in accordance with an embodiment of the present invention.
[0049] Figure 2 A schematic flow chart of a method for automatically classifying rare fundus diseases based on OCT images provided in accordance with an embodiment of the present invention.
[0050] Figure 3 An example diagram of various types of images in an OCT data set for an automatic classification method for rare fundus diseases based on OCT images provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0051] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0052] Example 1
[0053] Reference Figure 1-Figure 2 , which is the first embodiment of the present invention, provides an automatic classification method for rare fundus diseases based on OCT images, comprising:
[0054] The overall block diagram of the Meta-DGCL method proposed in this invention is shown in the attached figure. Figure 1 As shown. This method draws on the idea of meta-transfer learning. By pre-training on a common fundus disease dataset, the initial parameters of the deep neural network are obtained to help the network converge quickly. In the small sample classification model training stage, Model-Agnostic Meta-Learning (MAML) is used as the benchmark method, and the unlabeled query update training strategy and metadata enhancement method are introduced. The former helps improve the model's ability to distinguish different categories and better adapt to unseen data, and the latter is to generate new sample pairs to alleviate the problem of poor model generalization caused by sample size limitations. In addition, in order to improve the learning ability of the deep network model, the regularization loss is calculated based on the difference between the model parameters obtained from the support set and the query set respectively, so as to improve the consistency of the small sample classification model training and thus improve the performance of the small sample classification model.
[0055] S1: A retinal OCT image classification network is built based on convolutional layers, residual connections, and fully connected layers. The network takes OCT images as input and outputs the predicted probability that the image belongs to each type of lesion. The overall network structure is shown in the attached diagram. Figure 2 shown.
[0056] It should be noted that the retinal OCT image classification network includes: the first 15 layers of the network are 3×3 convolution layers, the 16th layer is a fully connected layer, the number of convolution channels of the 1st, 2nd and 3rd layers is 64, the number of convolution channels of the 4th, 5th, 6th and 7th layers is 128, the number of channels of the 8th, 9th, 10th and 11th layers is 256, the number of channels of the 12th, 13th, 14th and 15th layers is 512, the outputs of the 1st and 3rd layers, the outputs of the 5th and 7th layers, the outputs of the 9th and 11th layers, and the outputs of the 13th and 15th layers are directly added through residual connections and then input into the next layer, the outputs of the 3rd and 5th layers, the outputs of the 7th and 9th layers, and the outputs of the 11th and 13th layers are respectively added through residual connections containing 1×1 convolution and changing the number of channels and then input into the next layer;
[0057] The network takes OCT images as input and outputs the predicted probability of the image belonging to each type of lesion. The maximum value of the probability of each category is the corresponding category as the final image classification result. The first 15 convolutional layers are represented as feature extractors. , the fully connected layer is represented as a classifier .
[0058] S2: Construct a training set of common fundus diseases, train the classification network model based on all training samples in the training set, and obtain the initial parameters of the classification network model.
[0059] It should be noted that the initial parameters of the classification network model include constructing a common fundus disease training set, based on all training samples and true labels of all categories in the training set, and All parameters are trained, and the pre-trained weights are obtained by gradient descent optimization. The pre-trained feature extractor Contains weight W and bias b.
[0060] S3: Based on the common fundus disease training set, small sample training tasks of common diseases are randomly constructed to further train the network, which includes an inner loop and an outer loop. The inner loop is embedded in the outer loop, that is, each round of the outer loop contains multiple rounds of the inner loop.
[0061] Freeze the pre-trained weights W and bias b, and adjust them only using shift and scale operations. Let the scale factor be , the mobility coefficient is The adjusted weight is , biased to In the following, the training optimization parameters are To include and classifier Parameters A collection of parameters.
[0062] The inner loop is used to train a small sample classification network model suitable for a specific category combination, and the outer loop is used to train a small sample classification network model that can be widely applied to different lesion combinations. Finally, a set of network model parameters that can quickly adapt to new tasks with different lesion combinations is output. The inner loop is embedded in the outer loop, that is, each round of the outer loop contains multiple rounds of the inner loop.
[0063] It should be noted that the inner loop includes constructing a small sample training task set , where the i-th task is , divided into support set data and query set data ,
[0064] Each task only contains K categories in the common disease dataset, and in each category, N samples are taken as support set data. , M samples are query set data K is a positive integer between 3 and 6. N is a positive integer less than 11, and M is an integer between 10 and 15.
[0065] Two sets of network parameters are used in the optimization and , are initialized to the parameters obtained in the previous outer loop ;
[0066] The metadata enhancement includes: performing mixed data enhancement on the query set data in the inner loop to obtain a new query set to increase data diversity and improve the generalization ability of the model, and selecting two samples from the query set and , and calculate the linear interpolation of samples and labels:
[0067] ,
[0068] ,
[0069] in, and Refers to two images respectively, and Refers to the category labels of the two images respectively, is a random interpolation coefficient between 0 and 1. The generated virtual samples are used to replace the original samples to obtain a new query set. ;
[0070] For samples in the support set , use the cross entropy function to calculate the loss function:
[0071] ,
[0072] in, yes The predicted value obtained through the network output, k is the category number, for Whether it belongs to the label of the kth category, n represents the number of support set samples, C represents the number of categories, Expressed as the support set loss function, for the samples in the query set , using entropy regularization to calculate the loss function:
[0073] ,
[0074] in, yes The predicted value obtained through the network output, m represents the number of query set samples, It is expressed as the query set loss function; this design has two considerations: first, the query set labels are only used in the outer loop to avoid affecting the generalization of the model in the outer loop. Secondly, entropy regularization of unlabeled query set data helps improve the generalization performance of the model, enabling it to better cope with various unknown or complex situations.
[0075] Update parameters using gradient descent :
[0076] ,
[0077] in, Express Find the gradient, Represented as the inner loop learning rate;
[0078] The new query set calculates the loss function separately and updates the parameters ,
[0079] ,
[0080] in, is the cross entropy loss function on the new query set obtained by metadata enhancement, Express Find the gradient, is the inner loop learning rate, initially set to 0.01, and after every 10 outer loop rounds, The update is 0.05 times. The number of inner loop updates is set to 10 times.
[0081] It should be noted that the external circulation includes and The difference between is the data distribution difference between the support set and the query set, so use and The Frobenius norm of the parameter difference is used as a meta-regularization term in the outer loop loss function to improve the consistency of the network learning on different data. The consistency loss is calculated as follows: ,
[0082] in, is the Frobenius norm, calculated as the square root of the sum of the squares of the absolute values of the matrix elements;
[0083] In the outer loop, for multiple small sample classification network models suitable for different tasks (i.e., different lesion combinations) obtained in the inner loop, the loss on the new query set is calculated, added to the consistency loss, and the loss of each network under all tasks is summed. Perform a gradient descent update,
[0084] ,
[0085] in, is the regularization weight, , is a set of tasks for a batch, Express Find the gradient, represents the i-th task, Indicates that the i-th task takes The cross entropy loss on the new query set, represents the consistency loss of the i-th task. The outer loop learning rate The initial setting is 0.005, and every 10 rounds, Updated to 0.05 times.
[0086] S4: Randomly select K lesion categories (K is a positive integer between 3 and 6) from the common fundus disease training set, randomly select less than 26 samples from each category, and train a small sample classification network model suitable for these category combinations based on metadata enhancement and unlabeled query update strategy.
[0087] S5: Based on the training results of B small sample classification network models obtained in the inner loop of round B (B is an integer between 10 and 20), a consistency loss is introduced to train a small sample classification network model that can be widely applied to different lesion combinations.
[0088] S6: Construct a training set for rare fundus diseases, and fine-tune the small sample classification network model obtained by meta-training based on no more than 10 training samples to obtain a small sample classification network model suitable for rare diseases.
[0089] Construct a training set of rare fundus diseases with K categories. Use N samples for each rare disease category. The values of K and N are the same as those in the inner loop. Based on these sample training, adapt to new tasks. Use the model parameters output by the outer loop as the initial values, perform gradient descent optimization on the small sample training set of rare fundus diseases, so that the model can adapt to new tasks and obtain a small sample classification network model suitable for rare diseases.
[0090] S7: Input the OCT image into the trained rare disease classification network model obtained in step S5 to obtain the classification result of the lesion type.
[0091] Example 2
[0092] refer to Figure 3 , which is the second embodiment of the present invention, provides an automatic classification method for rare fundus diseases based on OCT images. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through experiments.
[0093] It should be noted that the data contains OCT images acquired by the Optovue scanner. Common diseases include age-related macular degeneration (AMD), diabetic retinopathy (DR), choroidal neovascularization (CNV), central serous chorioretinopathy (CSC), and retinal vein occlusion (RVO). The common disease dataset also includes a "normal" category, for a total of 6 categories. Rare diseases include retinal detachment (RD), retinal hemorrhage (RH), optic atrophy (OA), epiretinal membrane (ERM), central retinal artery occlusion (CRAO), retinoschisis (RS), and retinal detachment (RD), with a total of 7 categories. Image examples of each category are shown in the attached figure. Figure 3 shown.
[0094] The dataset is divided into three parts: pre-training, meta-training, and fine-tuning. The datasets for pre-training and meta-training are the same, including normal and 5 common fundus diseases, a total of 6 categories, 400 OCT images in each category. In the pre-training stage, all 400 OCT images of 6 categories are used together for network parameter optimization. In the meta-training stage, a task set with K=4 categories, N query sets, M=10 test sets, and B=10 task batch size is randomly generated for network parameter optimization, as shown in Table 1.
[0095] Table 1. Composition of OCT dataset
[0096]
[0097] In the fine-tuning stage, 7 rare disease datasets were used, with 60 OCT images in each training set and 120 OCT images in each test set. Randomly generate tasks with K=4 categories and N training sets. In the testing stage, the number of test sets is M=10. It is strictly ensured that the test set has no intersection with the training set during fine-tuning to accurately evaluate the performance of the model on new samples.
[0098] This paper uses accuracy as the evaluation indicator of small sample learning methods for classification tasks.
[0099] ,
[0100] Each test experiment contains 200 tasks, and each task is fine-tuned and tested separately. The test experiment is repeated 5 times to obtain 1000 task classification experiments. Finally, the average accuracy with a 95% confidence interval is calculated as the evaluation indicator.
[0101] The test task consists of 4 types of N-shot tasks. The value of N is the same during meta-training and fine-tuning, and the test results are calculated when N is 1, 5, and 10 respectively.
[0102] The model is trained and tested based on the public platform PyTorch and a GeForce GTX 2080Ti GPU with 11GB memory. In the pre-training stage, the model is trained by the SGD optimizer for 50 rounds, with the learning rate initialized to 0.004, the initial optimization momentum to 0.9, and the weight decay coefficient to 0.0005. In the meta-training stage, the Adam optimizer is used for 50 rounds of training. The inner loop learning rate is initially set to 0.01 and updated to 0.05 times every 10 rounds. The number of inner loop updates is set to 10 times. The outer loop learning rate is initially set to 0.005 and updated to 0.05 times every 10 rounds. In the fine-tuning stage, the learning rate is set to 0.01 and the number of updates is set to 10 times.
[0103] Tables 2 and 3 show the results and comparisons of relevant ablation experiments and comparative experiments. In the ablation experiments, meta-transfer learning is used as the basic method, and the unlabeled query update strategy, metadata enhancement and consistency learning designed by the present invention are added to the basic method, and the classification accuracy on test samples under various settings is significantly improved. In the comparative experiment, the performance of the method proposed by the present invention surpasses other classical methods, indicating that the meta-learning method based on metadata enhancement and consistency loss proposed by the present invention can effectively solve the problem of model performance degradation caused by insufficient sample size of rare fundus diseases.
[0104] Table 2. Ablation experiments of the method of the present invention on OCT datasets
[0105]
[0106] Table 3. Comparative experiments of the method of the present invention and other small sample learning methods
[0107] method 1shot 5shot 10shot MAML 42.46±1.86 50.20±1.92 51.76±1.48 ProtoNet 55.58±1.63 77.69±1.34 82.58±1.00 R2D2 58.69±7.23 78.41±6.90 82.00±7.42 MatchingNet 60.32±2.03 70.19±1.70 70.21±1.73 FEAT 57.89±1.70 60.50±1.89 62.25±1.66 BILSTM 60.03±1.73 62.32±1.62 66.75±1.81 iMAML 66.28±7.51 79.52±8.61 81.57±5.15 DEMCR 64.29±1.76 69.96±1.55 67.69±1.59 Meta-DGCL 67.24±1.74 82.45±1.34 83.21±1.37
[0108] Example 3
[0109] The third embodiment of the present invention is different from the first two embodiments in that:
[0110] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0111] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0112] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0113] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0114] Example 4
[0115] The fourth embodiment of the present invention provides an automatic classification system for rare fundus diseases based on OCT images, characterized by comprising: a retinal OCT image classification network, a pre-training module, a meta-training module, an inner loop training module, an outer loop training module, an adjustment module, and a classification module;
[0116] Retinal OCT image classification network, based on residual module and fully connected layer, the retinal OCT image classification network is built. The network takes OCT image as input and image lesion category label as output;
[0117] Pre-training module, builds a training set of common fundus diseases, trains the classification network model based on all training samples in the training set, and obtains the initial parameters of the classification network model;
[0118] The meta-training module randomly constructs small sample training tasks for common diseases based on the common fundus disease training set to further train the network. It includes an inner loop and an outer loop. The inner loop is embedded in the outer loop, and each outer loop contains multiple inner loops.
[0119] The inner loop training module randomly selects K lesion categories from the common fundus disease training set, and randomly selects less than 26 samples from each category. Based on metadata enhancement and unlabeled query update strategy, a small sample classification network model suitable for category combination is trained to obtain a rare disease classification network model;
[0120] The outer loop training module introduces consistency loss based on the training results of multiple small sample classification network models obtained through multiple rounds of inner loops, and trains small sample classification network models that can be widely applied to different lesion combinations;
[0121] Adjust the module, build a rare fundus disease training set, and fine-tune the small sample classification network model obtained by meta-training based on the training samples to obtain a small sample classification network model suitable for rare diseases;
[0122] The classification module inputs the OCT image into the rare disease classification network model to obtain the classification results of the lesion type.
[0123] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. An automatic classification method for rare fundus diseases based on OCT images, characterized by: include, A retinal OCT image classification network is built based on residual modules and fully connected layers. The network takes OCT images as input and image lesion category labels as output. Construct a training set of common fundus diseases, train a classification network model based on all training samples in the training set, and obtain the initial parameters of the classification network model; Based on the common fundus disease training set, a small sample training task of common diseases is randomly constructed, and the network is meta-trained, which includes an inner loop and an outer loop. The inner loop is embedded in the outer loop, and each outer loop contains multiple inner loops. K lesion categories are randomly selected from the common fundus disease training set, samples are randomly selected from each category, and a small sample classification network model suitable for a specific common disease combination is trained based on metadata enhancement and unlabeled query update strategy; Based on the training results of multiple common disease small sample classification network models obtained through multiple rounds of inner loops, consistency loss is introduced to train small sample classification network models suitable for different common disease combinations; Construct a training set for rare fundus diseases, and fine-tune the small sample classification network model obtained by meta-training based on the training samples to obtain a small sample classification network model suitable for rare diseases; Input the OCT images into the rare disease small sample classification network model to obtain the classification results of the lesion type; The inner loop includes constructing a small sample training task set D tr ={T1,T2,...,T n }, where the i-th task is Support set data and query set data Two sets of network parameters θ are used in the optimization tr and θ ts , are initialized to the parameters θ obtained in the previous outer loop; The metadata enhancement includes: performing mixed data enhancement on the query set data in the inner loop to obtain a new query set to increase data diversity and improve the generalization ability of the model, and selecting two samples (x p ,y p ) and (x q ,y q ), and calculate the linear interpolation of samples and labels: Among them, x p and x q Refers to two images respectively, y p and q They refer to the category labels of the two images respectively, and λ is a random interpolation coefficient between 0 and 1. The generated virtual samples are used to replace the original samples to obtain a new query set. Represents the generated sample, Represents the label of the generated sample; For the samples in the support set (x j ,y j ), and use the cross entropy function to calculate the loss function: in, is the predicted value of xj after the network output, k is the category number, is the label of whether xj belongs to the kth category, n is the number of support set samples, C is the number of categories, Expressed as the support set loss function, for the samples in the query set Calculate the loss function using entropy regularization: in, yes The predicted value obtained through the network output, m represents the number of query set samples, Expressed as a query set loss function; Update the parameters θ using gradient descent tr : in, Represents the tr Find the gradient, α represents the inner loop learning rate; The new query set calculates the loss function separately and updates the parameter θ ts , in, is the cross entropy loss function on the new query set obtained by metadata enhancement, Represents the ts Find the gradient; The outer loop includes θ tr and θ ts The difference between the support set and the query set is the data distribution difference between them, using θ tr and θ ts The Frobenius norm of the parameter difference is used as a meta-regularization term in the outer loop loss function to improve the consistency of the network learning on different data. The consistency loss is calculated as follows: L F =||θ tr -θ ts || F Among them, || || F is the Frobenius norm, calculated as the square root of the sum of the squares of the absolute values of the matrix elements; In the outer loop, for a task batch consisting of multiple tasks in multiple inner loops, the loss on the new query set is calculated, added to the consistency loss, and summed over all tasks, and the model parameters θ are updated by gradient descent. Among them, δ is the regularization weight, δ = 0.3, p(T) is the task set of a batch, Indicates the gradient of θ, T i represents the i-th task, Indicates that the i-th task takes the network parameter θ tr The cross entropy loss on the new query set, represents the consistency loss of the i-th task.
2. The method for automatically classifying rare fundus diseases based on OCT images as claimed in claim 1, characterized in that: The retinal OCT image classification network includes: the first 15 layers of the network are 3×3 convolution layers, the 16th layer is a fully connected layer, the number of convolution channels of the 1st, 2nd and 3rd layers is 64, the number of convolution channels of the 4th, 5th, 6th and 7th layers is 128, the number of channels of the 8th, 9th, 10th and 11th layers is 256, the number of channels of the 12th, 13th, 14th and 15th layers is 512, the outputs of the 1st and 3rd layers, the outputs of the 5th and 7th layers, the outputs of the 9th and 11th layers, and the outputs of the 13th and 15th layers are directly added through residual connections and then input into the next layer, the outputs of the 3rd and 5th layers, the outputs of the 7th and 9th layers, and the outputs of the 11th and 13th layers are respectively added through residual connections containing 1×1 convolution and changing the number of channels and then input into the next layer; The network takes OCT images as input and the predicted probability that the image belongs to each type of lesion as output. The maximum value of the probability of each category is taken, and the corresponding category is the final image classification result. The first 15 convolutional layers are represented as feature extractors Ψ, and the fully connected layers are represented as classifiers ψ.
3. The method for automatically classifying rare fundus diseases based on OCT images as claimed in claim 2, characterized in that: The initial parameters of the classification network model are obtained by constructing a common fundus disease training set, training all parameters of Ψ and ψ based on all training samples and true labels of all categories in the training set, and obtaining pre-trained weights by optimizing through gradient descent. The pre-trained feature extractor Ψ includes weights W and bias b.
4. The method for automatically classifying rare fundus diseases based on OCT images as claimed in claim 3, characterized in that: The further training of the network includes freezing the pre-trained feature extractor Ψ including weights W and biases b, freezing the weights and biases, and adjusting them using shift and scale operations, with the scaling factor being The mobility coefficient is The adjusted network weight is Bias is The meta-training phase and the parameters θψ of the classifier ψ are trained, and the parameters θ optimized by meta-training are The set of parameters of θψ.
5. The method for automatically classifying rare fundus diseases based on OCT images as claimed in claim 4, characterized in that: The small sample classification network model includes constructing a rare fundus disease training set, adapting to new tasks based on sample training, using the model parameters finally output by the outer loop as initial values, and performing gradient descent optimization on the network parameters θ on the small sample training set of rare fundus diseases, so that the model can adapt to new tasks and obtain a small sample classification network model suitable for rare diseases.
6. An automatic classification system for rare fundus diseases based on OCT images, which implements an automatic classification method for rare fundus diseases based on OCT images as described in any one of claims 1 to 5, comprising a retinal OCT image classification network, a pre-training module, a meta-training module, an inner loop training module, an outer loop training module, an adjustment module, and a classification module; Retinal OCT image classification network, based on residual module and fully connected layer, the retinal OCT image classification network is built. The network takes OCT image as input and image lesion category label as output; Pre-training module, builds a training set of common fundus diseases, trains the classification network model based on all training samples in the training set, and obtains the initial parameters of the classification network model; The meta-training module randomly constructs small sample training tasks for common diseases based on the common fundus disease training set to further train the network. It includes an inner loop and an outer loop. The inner loop is embedded in the outer loop, and each outer loop contains multiple inner loops. The inner loop training module randomly selects K lesion categories from the common fundus disease training set, randomly selects samples from each category, and trains a small sample classification network model that can be applied to a specific common disease combination based on metadata enhancement and unlabeled query update strategy; The outer loop training module introduces consistency loss based on the training results of multiple small sample classification network models obtained through multiple rounds of inner loops, and trains small sample classification network models suitable for different common disease combinations; Adjust the module, build a rare fundus disease training set, and fine-tune the small sample classification network model obtained by meta-training based on the training samples to obtain a small sample classification network model suitable for rare diseases; The classification module inputs the OCT image into the rare disease small sample classification network model to obtain the classification result of the lesion type.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
