Eye fundus photo classification system capable of being used for chronic kidney disease detection and storage medium
Through the integrated learning strategy of fundus photo preprocessing and deep learning model, combined with the convolutional neural network of the CCAM module, the problems of low efficiency and low accuracy of fundus photo classification in the existing technology are solved, and efficient and automated chronic kidney disease detection is achieved. .
Patent Information
- Application Number
- CN202410474322.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-11
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2040-12-11
AI Technical Summary
The existing classification methods based on fundus photos in chronic kidney disease detection are inefficient and inaccurate. Doctors' naked eye observation relies on subjective experience and has a heavy workload. The image segmentation and feature extraction algorithms are complex and slow in calculation. The deep learning model is very sensitive to the quality of the input photos. Sensitive and prone to overfitting.
Fundus photo preprocessing methods are used, including extraction of regions of interest, data amplification, integrated learning strategies and branched neural network model training. The DenseNet-101 network and Focal Loss loss function are used, combined with the convolutional neural network model of the CCAM module, to perform image processing. Preprocessing and classification.
It improves the accuracy and efficiency of fundus photo classification, reduces computing resource usage, ensures input photo quality control, solves the over-fitting problem, and achieves automated and fast classification result output.
Smart Images

Figure CN118537584A
Abstract
Description
[0001] This patent application is a divisional application of Chinese Patent No. 202011450625.X, whose invention name is "Fundus Photo Classification Method, Fundus Image Processing Method and System", and its full text is incorporated herein by reference. Technical Field
[0002] The present invention relates to the technical field of medical image classification and detection, and in particular to a fundus photograph classification method, a fundus image processing method and a system. Background Art
[0003] Chronic kidney disease (CKD) is a chronic disease that affects global public health issues. The prevalence and incidence of CKD are increasing year by year. It is characterized by high morbidity, difficulty in treatment, high mortality and low awareness. CKD is often accompanied by cardiovascular diseases such as hypertension and diabetes. When CKD gradually worsens, patients need kidney transplants or rely on dialysis for a long time to maintain their lives.
[0004] Studies have shown that early diagnosis and treatment of chronic kidney disease patients can effectively prevent further deterioration of the disease. One of the means of prevention and treatment is to observe the progression of the disease through fundus photography and regular physical examinations so as to intervene in time. However, there are many inconveniences for doctors to observe fundus photos with their naked eyes. First, it is difficult to accurately judge and classify based on experience alone, and second, it requires a huge workload of reading films. How to classify and select potential target fundus photos for doctors' reference and improve the accuracy of classification has always been an urgent problem to be solved.
[0005] In recent years, with the development of computer vision technology, many deep learning models have been widely used in the field of medical images. Therefore, in order to reduce the time and effort of manual screening while ensuring the recognition accuracy, it is necessary to design an image preprocessing and deep learning classification method for fundus photos that can be used for chronic kidney disease detection.
[0006] Currently, classification methods based on fundus photographs are mainly divided into three categories: the first category is to manually mark disease-related areas through naked eye observation by doctors; the second category is to use image segmentation, feature extraction and other means to extract features such as the optic cup / disc ratio and arteriovenous ratio of fundus photographs, and combine them with machine learning methods for classification; the third category is to use an end-to-end deep learning model for direct prediction.
[0007] The method of observation by the naked eye and manual calibration relies more on the subjective experience of the doctor, and has a huge workload and low efficiency. The method of using image segmentation, feature extraction and other means to extract features such as the cup / disc ratio and arteriovenous ratio of fundus photographs, and combining them with machine learning methods for classification, generally has a complex algorithm process design and slow calculation speed, which is very demanding on the correlation between the disease and the extracted features. If the correlation between the extracted features and the disease is poor or the algorithm for extracting features is unstable, the classification effect may be unsatisfactory. The method of using an end-to-end deep learning model for classification requires quality control of the input fundus photographs. Once the quality of the input fundus photographs is poor, the deep learning model cannot achieve normal classification results. Summary of the invention
[0008] The present invention provides a fundus photo classification method and system, which can solve the technical problems of low efficiency and low accuracy of the existing classification method based on fundus photos in chronic kidney disease detection.
[0009] To achieve the above object, the present invention adopts the following technical solutions:
[0010] According to one aspect of the present invention, a method for classifying fundus photographs that can be used for chronic kidney disease detection is provided.
[0011] The following steps are involved:
[0012] S100, obtaining fundus photographs and preprocessing them to generate standardized fundus images;
[0013] S200, dividing the fundus image into a training set and a test set, and performing data augmentation on the training set;
[0014] S300, preprocess the training set and test set of S200 to ensure that each batch category of the input model is uniform during the training phase;
[0015] S400, based on S300 integrated learning strategy, and trained the branch neural network model;
[0016] S500: Perform model fusion to obtain a final detection model to achieve classification of fundus photos.
[0017] Furthermore, the S100 acquires and preprocesses the fundus photograph to generate a standardized fundus picture;
[0018] include:
[0019] 1.8) For each fundus photograph, first extract the region of interest (ROI), extract the R channel component of the fundus photograph, and perform binarization processing;
[0020] 1.9) Use a 5x5 convolution kernel to perform a closing operation on the R channel component after binarization, select a seed point (int(h / 2), int(w / 2)), where h is the height of the image, w is the width of the image, and int represents rounding of floating-point numbers. Use the connected component analysis algorithm to extract the circular / circular cross-sectional area located in the center of the fundus photograph as mask 1;
[0021] 1.10) Find the minimum bounding rectangle of the binary mask 1 image and expand it outward by 10 pixels as mask 2;
[0022] 1.11) Perform pixel-wise operation on the original fundus photograph based on the mask 1 image, that is, for the corresponding points in the original image and the binary mask 1 image, if the corresponding point value on the mask 1 image is 1, the values of the RGB three channels of the original image are retained; if the corresponding point value on the mask 1 image is 0, the values of the RGB three channels of the original image are all set to 0;
[0023] 1.12) Based on the binary mask 2 image, the original fundus photograph is cut to obtain an intermediate image to achieve the purpose of extracting the ROI area;
[0024] 1.13) Extract the G channel component of the intermediate image, and use the histogram equalization method for the points whose pixel values in the corresponding mask 1 image are not 0 to enhance the image contrast. Where N is the total number of pixels, v is the original grayscale, s is the grayscale after histogram equalization, ranging from 0 to 255, cdf is the cumulative distribution function of v, and round means rounding to an integer; cdf min is the minimum value of cdf;
[0025] 1.14) The intermediate image and the R channel component, the G channel component after histogram equalization processing, and the B channel component are combined to obtain the preprocessed fundus photograph.
[0026] Furthermore, in S200, the processed fundus photographs are divided into a training set and a test set, and data augmentation is performed on the training set;
[0027] Among them, the processed fundus photos are divided into training set and test set, specifically including:
[0028] The original fundus photo dataset was randomly divided into training and test sets using a stratified sampling method at a ratio of 4:1;
[0029] In the training set, the stratified sampling method is used again to randomly divide the data into five non-overlapping subsets: training set 1, training set 2, training set 3, training set 4, and training set 5.
[0030] Furthermore, in S200, the processed fundus photographs are divided into a training set and a test set, and data augmentation is performed on the training set;
[0031] Among them, the training set is augmented with data, including:
[0032] For each fundus photograph in the training set subset, data augmentation is achieved by randomly using any of the following methods:
[0033] 3.1) Flip left and right;
[0034] 3.2) Crop the image with a random ratio between 0 and 0.1 and resize it to the original image size;
[0035] 3.3) Use a Gaussian filter of size 5x5 and random σ for smoothing.
[0036] Furthermore, in S300, data preprocessing is performed on the training set and the test set of S200 to ensure that each batch category of the input model in the training stage is uniform;
[0037] Specifically include:
[0038] 4.1) The dimension of the fundus photograph after image preprocessing is: (h, w, c), where h is the height of the image, w is the width of the image, and c is the number of channels; the pixel value range of each channel is 0 to 255, and the pixel value range is normalized and mapped to the interval of 0 to 1;
[0039] 4.2) Set hyperparameters for model training;
[0040] Batch size and size l, set batch size = 16, l = 600 in each training set;
[0041] For the training set, the input data was prepared in a ratio of 12:4 between negative samples (i.e., those without chronic kidney disease) and positive samples (i.e., those with chronic kidney disease), where negative samples were sampled without replacement and positive samples were sampled with replacement; the batch size of the test set was 1, and both negative and positive samples were sampled without replacement;
[0042] The input fundus image is resized to make its dimension (l,l,c), and the resulting input data format is m (l,l,c,n) tensor data, where n is the batch size and m is the total number of batches.
[0043] Furthermore, the S400 integrates the learning strategy based on the S300 and trains the branch neural network model;
[0044] Among them, the integrated learning strategy specifically includes:
[0045] Train 5 branch models based on 5 non-overlapping subsets of the training set;
[0046] Each model uses 4 training set subsets as training sets, and the remaining training set subset is used as the test set to adjust the parameter branch model;
[0047] The training and parameter adjustment process of each branch model is independent of each other.
[0048] Furthermore, the S400 integrates the learning strategy based on the S300 and trains the branch neural network model;
[0049] Among them, training a branch neural network model includes:
[0050] 6.1) For each branch model, DenseNet-101 is used as the basic network structure, and the last fully connected layer of DenseNet-101 is removed, and a fully connected layer with an output dimension of 2 is added. The model parameters are transferred or retrained using the parameters pre-trained based on ImageNet;
[0051] 6.2) The loss function of the deep learning model adopts the focal loss function, and its specific formula is:
[0052]
[0053] Among them, α and γ are manually set hyperparameters, specifically α = 0.6, γ = 0.25, p is the probability value of the image output by softmax being a positive sample, y is the true label of the image, y = 1 means suffering from chronic kidney disease, y = 0 means not suffering from chronic kidney disease, in order to prevent overfitting, L2 regularization is used to constrain the model;
[0054] 6.3) The optimization strategy of the model is carried out using the Adam optimizer; the Adam optimization steps are as follows:
[0055]
[0056] m t =β1m t-1 +(1-β1)g t
[0057]
[0058]
[0059] Among them, g tis the gradient of the loss function L with respect to the parameter θ at time t, β1 and β2 are both hyperparameters, β1 = 0.9 and β2 = 0.999, and m0 = 0, v0 = 0, α is the learning rate, and e is the denominator protection parameter; α = 0.0001, e = 1*10 -8 ,θ t is the updated parameter;
[0060] 6.4) Dropout strategy: During the training process, 40% of the random parameters in the model's back layer do not participate in the back propagation of the gradient;
[0061] 6.5) Early-Stop strategy: During the training of the branch model, once the absolute value of the loss on the training set and the loss on the test set becomes significantly larger, the training is stopped and the model before the deviation becomes too large is retained.
[0062] Furthermore, the S500 performs model fusion to obtain a final detection model to achieve classification of fundus photos;
[0063] Specifically include:
[0064] For the trained branch model, during the test process, the soft-voting method is used to obtain the final classification result of the model.
[0065] On the other hand, the present invention also discloses a fundus photo classification system, comprising the following units:
[0066] A fundus photo preprocessing unit, used to obtain and preprocess fundus photos to generate standardized fundus images;
[0067] A fundus photo division unit is used to divide the processed fundus photos into a training set and a test set, and perform data augmentation on the training set;
[0068] The training set and test set processing unit performs data preprocessing on the training set and test set to ensure that each batch category of the input model is uniform during the training phase;
[0069] A model training unit, used to train a branch neural network model based on an integrated learning strategy;
[0070] The model fusion determination unit is used to perform model fusion to obtain a final detection model and realize the classification of fundus photos.
[0071] According to another aspect of the present invention, a method for processing fundus images is provided, which is characterized by comprising the following steps:
[0072] Constructing a first data set, including preprocessing of original fundus images and data screening of preprocessed fundus images, wherein the original fundus image preprocessing includes data desensitization, ROI extraction, and contrast enhancement, and the data screening of preprocessed fundus images includes screening the preprocessed fundus images using a MobileNet v3 large model and a soft voting method, removing fundus images that do not meet quality standards, and constructing the first data set;
[0073] Construct a convolutional neural network model with a CCAM module, wherein the convolutional neural network model includes a backbone network and the CCAM module, wherein the backbone network includes an input, a first convolutional layer, an MLP and a first Sigmoid, and the CCAM module includes an upper branch and a lower branch, wherein the upper branch is used to extract CAM using a second convolutional layer based on a first feature map, and to differentiate the importance of features using a second Sigmoid; the lower branch uses excitation and squeezing operations to extract the channel weights of the first feature map, and performs a scale operation in combination with CAM to obtain a channel CAM map with a channel attention mechanism, and then performs a Hadamard product operation on the channel CAM map and the first feature map and adds the first feature map to the fully connected layer or GAP; the first feature map is the output of the first convolutional layer;
[0074] Using Focal Loss as a loss function, and using the first data set to train the convolutional neural network model with the CCAM module;
[0075] The trained convolutional neural network model with the CCAM module is used to process the user's fundus image and output the classification result.
[0076] According to yet another aspect of the present invention, the MLP is a fully connected layer or a GAP (global average pooling).
[0077] According to another aspect of the present invention, left and right fundus images of the user are collected and data desensitization, ROI extraction and contrast enhancement are performed.
[0078] According to another aspect of the present invention, the trained convolutional neural network model with the CCAM module is used to process the left and right fundus images in parallel, and the second feature map of the left eye and the second feature map of the right eye are output respectively. Then, they are aggregated together with the channel as the axis as the feature tensor of the input fully connected layer or GAP, and finally the classification result is output.
[0079] According to another aspect of the present invention, the decision-making basis area of the convolutional neural network model is visualized and a heat map is generated using the SmoothGrad-CAM++ method.
[0080] It can be seen from the above technical solution that the fundus photo classification method of the present invention is implemented based on fundus photos. The present invention is directed to the method for preprocessing fundus photos and the deep learning classification model; specifically, it includes the steps of generating standardized fundus photos through fundus photo preprocessing; and the proportional distribution of the number of positive and negative samples in each batch in the input data preprocessing; ensemble learning plus focal loss solves the class imbalance problem in fundus photo classification.
[0081] Compared with the method of naked-eye observation and manual calibration by doctors, the present invention has high effect and excellent automation; compared with the method of using image segmentation, feature extraction and other means to extract features such as the optic cup / disc ratio and the arteriovenous ratio of fundus photos and combining them with machine learning methods for classification, the present invention has fast calculation speed and occupies less computer resources during operation; compared with the use of end-to-end deep learning models for classification, the present invention ensures the quality control of the fundus photos at the input end and solves the problem of overfitting to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS
[0082] Figure 1 is a schematic diagram of the method of the present invention;
[0083] Figure 2 is a schematic diagram of generating a standardized fundus photograph by preprocessing the fundus photograph in the method of the present invention;
[0084] Figure 3 It is a schematic diagram of network model training of the present invention;
[0085] Figure 4 It is a schematic diagram of the fusion of the model of the present invention;
[0086] Figure 5 is a schematic diagram of a convolutional neural network model with a CCAM module of the present invention;
[0087] Figure 6 It is a schematic diagram of the left and right eye feature fusion network of the present invention. DETAILED DESCRIPTION
[0088] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, 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, not all of the embodiments.
[0089] Example 1
[0090] The fundus photo classification method described in the embodiment of the present invention mainly uses image morphology and deep learning methods, uses morphological methods to pre-process the fundus photos, and then introduces a focal loss function that is more suitable for the incidence problem and a training strategy for the class imbalance problem based on the DenseNet-101 network model, and designs an automatic classification method based on the DenseNet-101 network model.
[0091] To achieve the above-mentioned purpose of the invention, an embodiment of the present invention proposes an image preprocessing and automatic classification method of fundus photos based on a deep learning algorithm, comprising the following steps:
[0092] (1) Generate standardized fundus photos by preprocessing the fundus photos, such as Figure 2 Shown
[0093] 1.15) For each fundus photograph, first extract the region of interest (ROI), extract the R channel component of the fundus photograph, and perform binarization processing;
[0094] 1.16) Use a 5x5 convolution kernel to perform a closing operation on the R channel component after binarization, select a seed point (int(h / 2), int(w / 2)), where h is the height of the image, w is the width of the image, and int represents rounding of floating-point numbers. Use the connected component analysis algorithm to extract the circular / circular cross-sectional area located in the center of the fundus photograph as mask 1;
[0095] 1.17) Find the minimum bounding rectangle of the binary mask 1 image and expand it outward by 10 pixels as mask 2;
[0096] 1.18) Perform pixel-wise operation on the original fundus photograph based on the mask 1 image, that is, for the corresponding points in the original image and the binary mask 1 image, if the corresponding point value on the mask 1 image is 1, the values of the RGB three channels of the original image are retained; if the corresponding point value on the mask 1 image is 0, the values of the RGB three channels of the original image are all set to 0;
[0097] 1.19) Based on the binary mask 2 image, the original fundus photograph is cut to obtain an intermediate image to achieve the purpose of extracting the ROI area;
[0098] 1.20) Extract the G channel component of the intermediate image, and use the histogram equalization method for the points whose pixel values in the corresponding mask 1 image are not 0 to enhance the image contrast. Where N is the total number of pixels, v is the original grayscale, s is the grayscale after histogram equalization, ranging from 0 to 255, cdf is the cumulative distribution function of v, and round means rounding to an integer; cdf min is the minimum value of cdf;
[0099] 1.21) Merge the intermediate image and the R channel component, the G channel component after histogram equalization processing, and the B channel component to obtain the preprocessed fundus photograph.
[0100] (2) Divide the training set and test set
[0101] The original fundus photo dataset was randomly divided into a training set and a test set using a stratified sampling method at a ratio of 4:1. In the training set, the data was randomly divided into five non-overlapping subsets: training set 1, training set 2, training set 3, training set 4, and training set 5 using a stratified sampling method.
[0102] (3) Expanding the training set through data augmentation
[0103] For each fundus photograph in the training set subset, data augmentation is achieved by randomly using one or more of the following methods:
[0104] 3.1) Flip left and right;
[0105] 3.2) Crop the image with a random ratio between 0 and 0.1 and resize it to the original image size;
[0106] 3.3) Use a Gaussian filter of size 5x5 and random σ for smoothing.
[0107] (4) Input data preprocessing
[0108] 4.1) The dimension of the fundus photo after image preprocessing is (h,w,c), where h is the height of the image, w is the width of the image, and c is the number of channels. The pixel value range of each channel is 0 to 255. Here, the pixel value range is normalized and mapped to the range of 0 to 1;
[0109] 4.2) Set the hyperparameters of model training - batch size and size l. Here, the batch size in each training set is set to 16 and l = 600. For the training set, the input data is prepared in a ratio of 12:4 according to the negative samples (without chronic kidney disease) and positive samples (with chronic kidney disease), where the negative samples are sampled without replacement and the positive samples are sampled with replacement; the batch size of the test set is 1, and both negative and positive samples are sampled without replacement. The training set maintains a constant ratio of positive samples to negative samples to ensure that each time the gradient is updated, it will not fall into a local minimum due to class imbalance. The input fundus image is resized to make its dimension (l,l,c), and the input data format is m (l,l,c,n) tensor data, where n is the batch size and m is the total number of batches.
[0110] (5) Ensemble learning strategy
[0111] The main strategy for training deep learning models is ensemble learning, that is, training 5 branch models on the basis of 5 non-intersecting training set subsets. Each model uses 4 training set subsets as training sets, and the remaining training set subset is used as the test set to adjust the parameters of the branch model. For example, branch model 1 uses training sets 2, 3, 4, and 5 as training sets for training, and training set 1 is used as the validation set to adjust the parameters. The training and parameter adjustment process of each branch model is independent of each other.
[0112] (6) Network model training, such as Figure 3 Shown
[0113] 6.1) For each branch model, DenseNet-101 is used as the basic network structure, and the last fully connected layer of DenseNet-101 is removed, and a fully connected layer with an output dimension of 2 is added. The model parameters can be transferred using the parameters pre-trained based on ImageNet, or they can be retrained;
[0114] The network model structure can also use VGG, ResNet, etc.
[0115] 6.2) The loss function of the deep learning model adopts the focal loss function, and its specific formula is:
[0116]
[0117] Among them, α and γ are manually set hyperparameters, where α = 0.6, γ = 0.25, p is the probability value of the image output by softmax being a positive sample, y is the true label of the image, y = 1 means suffering from chronic kidney disease, y = 0 means not suffering from chronic kidney disease, in order to prevent overfitting, L2 regularization is used to constrain the model;
[0118] 6.3) The optimization strategy of the model is carried out using the Adam optimizer. The Adam optimization steps are as follows:
[0119]
[0120] m t =β1m t-1 +(1-β1)g t
[0121]
[0122]
[0123] Among them, g tis the gradient of the loss function L with respect to the parameter θ at time t, β1 and β2 are both hyperparameters, β1 = 0.9 and β2 = 0.999, and m0 = 0, v0 = 0, α is the learning rate, and e is the denominator protection parameter. Here α = 0.0001, e = 1*10 -8 ,θ t is the updated parameter;
[0124] 6.4) Dropout strategy: During the training process, 40% of the random parameters in the model's back layer do not participate in the back propagation of the gradient;
[0125] 6.5) Early-Stop strategy: During the training of the branch model, once the absolute value of the deviation between the loss on the training set and the loss on the test set becomes significantly larger, the training is stopped and the model before the deviation becomes too large is retained.
[0126] (7) Model fusion on the test set, such as Figure 4 Shown
[0127] For the five trained branch models, during the testing process, the soft-voting method is used to obtain the final classification result of the model, and the final classification result is provided to, for example, doctors for reference.
[0128] In this step, Hard-voting can be used to replace Soft-voting.
[0129] It can be understood that the training model determined by the method of the embodiment of the present invention can directly input the fundus photograph and then automatically output the classification result, which is fast and accurate.
[0130] In summary, the fundus photograph classification method of the embodiment of the present invention is more effective and has an excellent degree of automation compared to the method of naked eye observation and manual calibration by doctors; compared to the method of extracting features such as the optic cup / disc ratio and the arteriovenous ratio of fundus photographs by image segmentation, feature extraction and the like, and combining the machine learning method for classification, the present invention has a fast calculation speed and occupies less computer resources during operation; compared to classification using an end-to-end deep learning model, the present invention ensures the quality control of the fundus photographs at the input end and solves the problem of overfitting to a certain extent.
[0131] On the other hand, the present invention also discloses a fundus photo classification system, comprising the following units:
[0132] A fundus photo preprocessing unit, used to obtain and preprocess fundus photos to generate standardized fundus images;
[0133] A fundus photo division unit is used to divide the processed fundus photos into a training set and a test set, and perform data augmentation on the training set;
[0134] The training set and test set processing unit performs data preprocessing on the training set and test set to ensure that each batch category of the input model is uniform during the training phase;
[0135] A model training unit, used to train a branch neural network model based on an integrated learning strategy;
[0136] The model fusion determination unit is used to perform model fusion to obtain a final detection model and realize the classification of fundus photos.
[0137] It is understandable that the system provided by the embodiment of the present invention corresponds to the method provided by the embodiment of the present invention, and the explanation, examples and beneficial effects of the relevant contents can refer to the corresponding parts in the above method.
[0138] The embodiment of the present application also provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0139] Memory, used to store computer programs;
[0140] A processor, configured to implement the above-mentioned fundus photograph classification method when executing a program stored in the memory;
[0141] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned fundus photo classification methods are implemented.
[0142] In another embodiment provided in the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any of the fundus photograph classification methods in the above embodiments.
[0143] Example 2
[0144] In the prior art, the convolutional neural network model using the attention branch module is used to process fundus image data, but the attention branch module still has many shortcomings. First, the attention branch module refers to the CAM approach and replaces the fully connected layer connected to the softmax with GAP. Compared with the fully connected layer with trainable parameters, GAP is only a pooling operation and cannot adjust the parameters, which increases the training pressure of the previous convolution layer and slows down the global convergence speed. Secondly, the attention branch module receives the feature map output from the previous convolution layer and compresses the feature map information into CAM through ordinary convolution and 1x1x1 convolution. On the other branch, the attention branch module constrains the loss function by 1x1 convolution and GAP. In fact, the two components of 1x1 convolution and GAP can directly derive CAM. It can be considered that the CAM derived from GAP is the actual constraint loss function, while the CAM derived from 1x1x1 convolution acts on the original feature map to enhance the effective feature expression. This CAM ambiguity caused by the structural design leads to the possible difference in the focus of the two branches of the attention branch module. Then, the loss function constraints added by the attention branch module to the backbone network only apply to the training phase. That is to say, in the testing phase, most of the parameters in the attention branch module are in a passively frozen state, occupying storage space but not participating in calculations, which increases unnecessary hardware overhead.
[0145] In order to improve the accuracy of classifying fundus photographs or images and solve one or more of the above-mentioned technical problems, the present invention further proposes a new convolutional neural network model to solve the problems of slow model training speed and CAM ambiguity in the prior art; at the same time, the module is integrated into the network, the constraints on the loss function are deleted, and unnecessary hardware overhead is reduced.
[0146] Specifically, see Figure 5 According to a preferred embodiment of the present invention, a method for processing fundus images is provided, which is characterized by comprising the following steps:
[0147] Constructing a first data set, including preprocessing of original fundus images and data screening of preprocessed fundus images, wherein the original fundus image preprocessing includes data desensitization, ROI extraction, and contrast enhancement, and the data screening of preprocessed fundus images includes screening the preprocessed fundus images using a MobileNet v3 large model and a soft voting method, removing fundus images that do not meet quality standards, and constructing the first data set;
[0148] Construct a convolutional neural network model with a CCAM module, wherein the convolutional neural network model includes a backbone network and the CCAM module, wherein the backbone network includes an input, a first convolutional layer, an MLP and a first Sigmoid, and the CCAM module includes an upper branch and a lower branch, wherein the upper branch is used to extract CAM using a second convolutional layer based on a first feature map, and to differentiate the importance of features using a second Sigmoid; the lower branch uses excitation and squeezing operations to extract the channel weights of the first feature map, and performs a scale operation in combination with CAM to obtain a channel CAM map with a channel attention mechanism, and then performs a Hadamard product operation on the channel CAM map and the first feature map and adds the first feature map to the fully connected layer or GAP; the first feature map is the output of the first convolutional layer;
[0149] Using Focal Loss as a loss function, and using the first data set to train the convolutional neural network model with the CCAM module;
[0150] The trained convolutional neural network model with the CCAM module is used to process the user's fundus image and output the classification result.
[0151] Preferably, MLP is a fully connected layer or GAP (global average pooling). CCAM is specifically CAM and channel attention module (Class activation mapping and Channel Attention Module).
[0152] Advantageously, the MobileNet v3 large model achieves good data screening effects, with an average accuracy of 0.9800, an average Kappa coefficient of 0.9686, and an average Macro F1 of 0.9769 under 5-fold cross validation. At the same time, the FLOPs are only 299.88M, the parameter scale is 4199259, the size occupies 16.11Mb, and the average task execution time is 0.1221 seconds.
[0153] Advantageously, Focal Loss can significantly improve the sensitivity of the model, and CCAM improves the AUC and model classification accuracy.
[0154] Advantageously, the convolutional neural network model with the CCAM module achieved an average AUC of 0.8450, an average accuracy of 0.8024, an average sensitivity of 0.7138, and an average specificity of 0.8261 on the TRCKDS dataset, for example. The results under various indicators show that the generalization ability is strong and there is not much performance loss on cross-ethnic datasets. CCAM can adaptively enhance the expression of local features associated with chronic kidney disease and its contribution to the final classification results.
[0155] Specifically, the TongRen Chronic Kidney Disease Study (TRCKDS) dataset mainly includes subjects who underwent ophthalmological examinations and physical examinations at Beijing Tongren Hospital affiliated to Capital Medical University in Beijing, China. There are a total of 12,740 subjects' chronic kidney disease-related data and 20,461 fundus images.
[0156] Preferably, see Figure 5 The upper layer branch includes the second convolution layer, BN (batch normalization), 1X1 convolution, ReLU function, 1X1 convolution (the number of tip channels is 1), BN and the second Sigmoid. The lower layer branch includes GAP (global average pooling), BN (batch normalization), FC (fully connected layer), FC and the first Sigmoid.
[0157] According to another preferred embodiment of the present invention, the classification result can be used to express the relevance of chronic kidney disease, for example, a score can be output. Preferably, the classification result is provided to doctors for reference. Preferably, the classification result can also be the probability or predicted probability of chronic kidney disease.
[0158] According to another preferred embodiment of the present invention, the left and right fundus images of the user are collected and data desensitization, ROI is extracted and contrast is enhanced. ROI is a region of interest.
[0159] According to another preferred embodiment of the present invention, see Figure 6 , the trained convolutional neural network model with the CCAM module is used to process the left and right fundus images in parallel, and the second feature map of the left eye and the second feature map of the right eye are output respectively, and then the channels are used as axes to aggregate them together as the feature tensors of the input fully connected layer or GAP, and finally the classification result (first classification result) is output. Advantageously, the present invention integrates the features of the left and right eyes, and fuses the features of the left and right eyes, which can effectively improve the classification accuracy of patients with chronic kidney disease.
[0160] According to another preferred embodiment of the present invention, further, the trained convolutional neural network model with the CCAM module is used to process the left and right fundus images respectively, and the second feature map of the left eye and the second feature map of the right eye are output respectively, which are used as the feature tensors of the input full connection layer or GAP respectively, and finally the corresponding second classification result (left eye) and the third classification result (left eye) are output. Preferably, the second classification result and the third classification result are compared to obtain a first difference, and when the first difference is within the first predetermined range, the first classification result is output as the final classification result. Further, when the first difference is outside the first predetermined range, the larger value of the second classification result and the third classification result is used as the final classification result. This is to take into account that when the classification results of the left and right eyes differ greatly, there is a potential error, and the first classification result (fusion result) at this time will deviate from the actual situation. In view of this situation, the present invention takes the larger value of the second classification result and the third classification result (i.e., the higher correlation with chronic kidney disease) as the final classification result, which is conducive to locating the user for further detection by the doctor without the risk of omission or misdetection, which may be quite disadvantageous to the user.
[0161] Preferably, when the first difference is within the first predetermined range, the second classification result and the third classification result are determined as the neighboring result, and the final classification result is output according to the first classification result and the neighboring result. For example, the first classification result and the neighboring result may be averaged, etc. This method can further improve the accuracy of detection.
[0162] According to another preferred embodiment of the present invention, the decision-making basis area of the convolutional neural network model is visualized and a heat map is generated using the SmoothGrad-CAM++ method. Advantageously, the heat map obtained by the SmoothGrad-CAM++ method can improve the accuracy of the focus area and can focus on the abnormal area.
[0163] Through experimental verification, the comparison results of the convolutional neural network model (ResNet-CCAM) with the CCAM module of the present invention and other mainstream classification network models SKNet, DenseNet, and Inception V4 are shown in the following table.
[0164] Performance of different models on TRCKDS
[0165]
[0166]
[0167] Note 1: AUC, accuracy, sensitivity and specificity are expressed as mean (standard deviation), where the bold result is the best result, and * indicates that the result of the paired t-test between the best result and the best result is significantly different at a significance level of 0.05.
[0168] It can be seen that the present invention has achieved the best results in multiple evaluation indicators such as AUC, accuracy, sensitivity and specificity.
[0169] Finally, it should be noted that the convolutional neural network model with the CCAM module in Example 2 can be combined with Example 1 for use.
[0170] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A fundus photo classification system, Features include: A fundus photo preprocessing unit, used to obtain and preprocess fundus photos to generate standardized fundus images; A fundus photo division unit is used to divide the processed fundus photos into a training set and a test set, and perform data augmentation on the training set; The training set and test set processing unit performs data preprocessing on the training set and test set to ensure that each batch category of the input model is uniform during the training phase; A model training unit, used to train a branch neural network model based on an integrated learning strategy; The model fusion determination unit is used to perform model fusion to obtain the final detection model and realize the classification of fundus photos. Among them, training the branch neural network model specifically includes: 6.1) For each branch model, DenseNet-101 is used as the basic network structure, and the last fully connected layer of DenseNet-101 is removed, and a fully connected layer with an output dimension of 2 is added. The model parameters are transferred or retrained using the parameters pre-trained based on ImageNet; 6.2) The loss function of the deep learning model adopts the focal loss function, and its specific formula is: Among them, α and γ are manually set hyperparameters, specifically α = 0.6, γ = 0.25, p is the probability value of the image output by softmax being a positive sample, y is the true label of the image, y = 1 means suffering from chronic kidney disease, y = 0 means not suffering from chronic kidney disease, in order to prevent overfitting, L2 regularization is used to constrain the model; 6.3) The optimization strategy of the model is carried out using the Adam optimizer; the Adam optimization steps are as follows: m t =b 1 m t-1 +(1-β 1 )g t Among them, g t is the gradient of the loss function L with respect to the parameter θ at time t, β 1 and β 2 are all hyperparameters, β 1 = 0.9 and β 2 =0.999, and m 0 =0,v 0 =0, α is the learning rate, e is the denominator protection parameter; α = 0.0001, e=1*10 -8 ,θ t is the updated parameter; 6.4) Dropout strategy: During the training process, 40% of the random parameters in the model's back layer do not participate in the back propagation of the gradient; 6.5) Early-Stop strategy: During the training of the branch model, once the absolute value of the deviation between the loss on the training set and the loss on the test set becomes significantly larger, the training is stopped and the model before the deviation becomes too large is retained.
2. The fundus photograph classification system according to claim 1, Features Obtain fundus photos and preprocess them to generate standardized fundus images, including: 1.1) For each fundus photograph, first extract the region of interest ROI, extract the R channel component of the fundus photograph, and perform binarization processing; 1.2) Use a 5x5 convolution kernel to perform a closing operation on the R channel component after binarization, select a seed point (int(h / 2), int(w / 2)), where h is the height of the image, w is the width of the image, and int represents rounding of floating-point numbers. Use the connected component analysis algorithm to extract the circular or circular cross-sectional area located in the center of the fundus photograph as mask 1; 1.3) Find the minimum bounding rectangle of the binary mask 1 image and expand it outward by 10 pixels as mask 2; 1.4) Perform pixel-wise operation on the original fundus photograph based on the mask 1 image, that is, for the corresponding points in the original image and the binary mask 1 image, if the corresponding point value on the mask 1 image is 1, the values of the RGB three channels of the original image are retained; if the corresponding point value on the mask 1 image is 0, the values of the RGB three channels of the original image are all set to 0; 1.5) Based on the binary mask 2 image, the original fundus photograph is cut to obtain an intermediate image to achieve the purpose of extracting the ROI area; 1.6) Extract the G channel component of the intermediate image, and use the histogram equalization method for the points whose pixel values in the corresponding mask 1 image are not 0 to enhance the image contrast. Where N is the total number of pixels, v is the original grayscale, s is the grayscale after histogram equalization, ranging from 0 to 255, cdf is the cumulative distribution function of v, and round means rounding to an integer; cdf min is the minimum value of cdf; 1.7) The intermediate image and the R channel component, the G channel component after histogram equalization processing, and the B channel component are combined to obtain the preprocessed fundus photograph.
3. The fundus photograph classification system according to claim 2, Features Dividing the processed fundus photos into training sets and test sets specifically includes: The original fundus photo dataset was randomly divided into training and test sets using a stratified sampling method at a ratio of 4:1; In the training set, the stratified sampling method is used again to randomly divide the data into five non-overlapping subsets: training set 1, training set 2, training set 3, training set 4, and training set 5.
4. The fundus photograph classification system according to claim 3, Features Data augmentation for the training set specifically includes: For each fundus photograph in the training set subset, data augmentation is achieved by randomly using any of the following methods: 3.1) Flip left and right; 3.2) Crop the image with a random ratio between 0 and 0.1 and resize it to the original image size; 3.3) Use a Gaussian filter of size 5x5 and random σ for smoothing.
5. The fundus photograph classification system according to claim 4, Features Data preprocessing is performed on the training set and the test set to ensure that each batch category input into the model during the training phase is uniform. Specifically, it includes: 4.1) The dimension of the fundus photograph after image preprocessing is: (h, w, c), where h is the height of the image, w is the width of the image, and c is the number of channels; the pixel value range of each channel is 0 to 255, and the pixel value range is normalized and mapped to the interval of 0 to 1; 4.2) Set hyperparameters for model training; Batch size and size l, set batch size = 16, l = 600 in each training set; For the training set, the input data was prepared in a ratio of 12:4 between negative samples (i.e., those without chronic kidney disease) and positive samples (i.e., those with chronic kidney disease), where negative samples were sampled without replacement and positive samples were sampled with replacement; the batch size of the test set was 1, and both negative and positive samples were sampled without replacement; The input fundus image is resized to make its dimension (l,l,c), and the resulting input data format is m (l,l,c,n) tensor data, where n is the batch size and m is the total number of batches.
6. The fundus photograph classification system according to claim 5, Features The ensemble learning strategy specifically includes: Train 5 branch models based on 5 non-overlapping subsets of the training set; Each model uses 4 training set subsets as training sets, and the remaining training set subset is used as the test set to adjust the parameter branch model; The training and parameter adjustment process of each branch model is independent of each other.
7. The fundus photograph classification system according to claim 6, Features Perform model fusion to obtain the final detection model, and realize the classification of fundus photos, which specifically includes: For the trained branch model, during the test process, the soft-voting method is used to obtain the final classification result of the model.
8. A fundus image processing method, Features The following steps are involved: Constructing a first data set, including preprocessing of original fundus images and data screening of preprocessed fundus images, wherein the original fundus image preprocessing includes data desensitization, ROI extraction, and contrast enhancement, and the data screening of preprocessed fundus images includes screening the preprocessed fundus images using a MobileNet v3 large model and a soft voting method, removing fundus images that do not meet quality standards, and constructing the first data set; Construct a convolutional neural network model with a CCAM module, wherein the convolutional neural network model includes a backbone network and the CCAM module, wherein the backbone network includes an input, a first convolutional layer, an MLP and a first Sigmoid, and the CCAM module includes an upper branch and a lower branch, wherein the upper branch is used to extract CAM using a second convolutional layer based on a first feature map, and to differentiate the importance of features using a second Sigmoid; the lower branch uses excitation and squeezing operations to extract the channel weights of the first feature map, and performs a scale operation in combination with CAM to obtain a channel CAM map with a channel attention mechanism, and then performs a Hadamard product operation on the channel CAM map and the first feature map and adds the first feature map to the fully connected layer or GAP; the first feature map is the output of the first convolutional layer; Using Focal Loss as a loss function, and using the first data set to train the convolutional neural network model with the CCAM module; Collect the user's left and right fundus images and perform data desensitization, ROI extraction, and contrast enhancement; The trained convolutional neural network model with the CCAM module is used to process the left and right fundus images in parallel, and the second feature map of the left eye and the second feature map of the right eye are output respectively, and then the channels are used as axes to aggregate them together as feature tensors of the input fully connected layer or GAP, and finally the classification results are output, and the classification results are used to express the relevance of chronic kidney disease; The SmoothGrad-CAM++ method is used to visualize the decision-making area of the convolutional neural network model and generate a heat map.
9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, which is suitable for being loaded and executed by a processor, so that a computer device having the processor executes the method of claim 8.
Citation Information
Patent Citations
Attention mechanism-based in-depth learning diabetic retinopathy classification method
CN108021916A
Fundus photo recognition method, device and equipment and storage medium
CN110334575A
Retinal fundus image classification method based on improved CNN model
CN111144296A
Detection method for eyeground multi-disease classification based on deep learning
CN111938569A
