Diabetic retinopathy grading method based on optimized convolution block attention module
Patent Information
- Application Number
- CN202610924307.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-25
- Publication Date
- 2026-10-27
AI Technical Summary
[0002]糖尿病视网膜病变是糖尿病高发不可逆眼部并发症,微血管瘤、点状出血、硬性渗出等微小病灶分布零散、尺寸微小,依靠眼科医师人工阅片完成大批量眼底图像分级筛查存在突出短板:一方面基层眼科医师资源紧缺,大规模体检筛查时阅片工作量巨大,单日阅片上限有限,筛查周期大幅拉长;另一方面人工判读存在主观偏差,不同医师对早期细微病变判定标准不统一,易出现漏诊、错诊,且重度、中度、轻度病变分级一致性较差
[0047]本发明通过标准化预处理流程统一眼底图像尺寸并完成数据增强与归一化,能够消除原始眼底图像拍摄光线、成像尺寸带来的样本差异,规范输入数据分布,标准化后的图像可以稳定适配后续三层卷积特征提取网络,让浅层、中层、高层卷积能够有序提取视网膜纹理、血管结构与病灶语义信息,减少图像原始噪声对特征提取过程造成的干扰。统一的数据输入形式还能够降低网络训练过程中的梯度波动,保障卷积层逐层提取层级特征时的一致性。
Smart Images

Figure CN122990779A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of deep learning technology for medical images, specifically to a method for grading diabetic retinopathy based on an optimized convolutional block attention module. Background Technology
[0002] Diabetic retinopathy is a common and irreversible ocular complication of diabetes. Microaneurysms, punctate hemorrhages, hard exudates, and other tiny lesions are scattered and small in size. Relying on ophthalmologists to manually interpret images for large-scale fundus image grading screening has significant shortcomings: On the one hand, there is a shortage of ophthalmologists at the grassroots level, and the workload of interpreting images during large-scale physical examinations is enormous, with a limited daily limit on the number of images that can be interpreted, which greatly extends the screening cycle; on the other hand, manual interpretation is subject to subjective bias, and different doctors have different standards for judging early subtle lesions, which can easily lead to missed diagnoses and misdiagnoses, and the consistency of grading severe, moderate, and mild lesions is poor. With the rapid deployment of computer vision and deep learning technologies, convolutional neural networks (CNNs) have become the mainstream technology for automatic grading of fundus images. Conventional CNNs rely on multi-layer convolutions to automatically extract semantic features of texture, edges, and lesions, which can replace manual screening of batches of images. However, general convolutional structures lack the ability to focus on specific lesions, and their extraction of features of micron-level lesions in the fundus is insufficient. Lesion areas are easily obscured by background information such as retinal vessels, optic disc, and macula, resulting in low accuracy in identifying early diabetic retinopathy and failing to meet the needs of precise clinical grading. To address the problem of insufficient lesion focus, the academic community has begun to introduce Convolutional Block Attention (CBAM) modules embedded in convolutional networks. These modules enhance lesion features through channel and spatial dual-branch weights. However, the original CBAM architecture still has inherent technical defects when adapted to fundus images, becoming a core pain point that urgently needs optimization in this field.
[0003] In recent years, a large number of academic papers at home and abroad have conducted systematic research on the grading model of diabetic retinopathy fused with CBAM. A representative work is "CF-ResNet: Research on Grading Diagnostic Model of Diabetic Retinopathy Fusion of Attention and Multi-scale Features" published by Liu Xinyu et al. in the third issue of Computer Science and Applications in 2026. This paper uses ResNet50 as the backbone network to embed the standard CBAM module to carry out DR grading experiments, which confirms that CBAM can screen lesion channels and spatial regions to a certain extent. However, the experimental data in the original paper clearly reflects that the original CBAM spatial branch has defects when using a 7×7 large convolution kernel to adapt to small lesions in the fundus: the receptive field coverage of 7×7 convolution is too large, which easily merges the normal retinal background pixels around the lesion, weakens the feature weight of local fine lesions such as microaneurysms and small hemorrhages, reduces the sensitivity of the model to fundus images of early mild cases, and the feature values fluctuate greatly after attention weighting. The loss curve oscillates significantly and the convergence speed is slow during the training phase. Another foreign paper, "Enhancing fundus image analysis for diabetic retinopathy using CheXNet with CBAM and Grad-CAM visualization," migrates the standard CBAM to the CheXNet network for fundus image classification. The ablation experiments in the paper demonstrate that the CBAM architecture, without normalization constraints on the attention output features, suffers from significant feature distribution shift issues. The model's validation set accuracy fluctuates by more than 5 percentage points, indicating insufficient generalization stability. Furthermore, the paper points out that all existing original CBAM applications in academic research do not include a batch normalization process after spatial attention computation, failing to correct the weighted feature distribution shift. Small lesion features are easily overwhelmed by background features with larger numerical amplitudes. Even with multi-scale feature fusion strategies, it is difficult to address the two core issues of mismatch between spatial convolution kernel size and small lesions, and unstable attention output features, at the underlying architectural level. Existing papers only rely on backbone networks and multi-scale modules to compensate for the inherent defects of CBAM, without fundamentally reconstructing and optimizing the spatial branching structure and post-normalization process of CBAM. These optimization methods are merely stopgap measures, offering limited improvement in classification accuracy and failing to fully adapt to the scenario of identifying small fundus lesions. The aforementioned existing academic research schemes generally suffer from three major limitations: poor adaptability of spatial convolution kernel size, lack of stable constraints on features after attention enhancement, and weakened expression of features of small lesions. These limitations restrict the application of deep learning-assisted diagnostic models in fundus screening at the grassroots level.
[0004] Several invention patents in China's intellectual property field have also been published for grading diabetic retinopathy using attention mechanisms. Among them, Chinese patent CN114266757B, "A Grading Method for Diabetic Retinopathy Based on Multi-Scale Fusion Attention Mechanism," is a representative prior art in this field. This patent scheme uses standard CBAM as the core attention unit, combined with a multi-scale convolutional fusion module to complete the grading of fundus images. The overall process includes four major steps: image preprocessing, multi-scale feature extraction, standard CBAM feature enhancement, and pooling classification. By capturing features of lesions of different sizes through multi-scale branches, it improves the problem of missing small lesions by a single convolutional scale to a certain extent. However, this patent scheme still has unavoidable shortcomings in underlying technology. First, it does not perform lightweight reduction processing on the CBAM spatial branch convolution kernel, but still uses the industry-standard 7×5 / 7×7 convolution kernel. For microaneurysms and punctate hemorrhages that are only a few pixels in size, the large convolution kernel will introduce a large number of irrelevant features. Background pixels participate in weight calculation, diluting the spatial attention weight of lesion areas, resulting in limited improvement in the accuracy of early mild case image grading. Secondly, this patent only sets a batch normalization layer inside the convolutional block, without adding an independent batch normalization processing step after the CBAM channel and spatial dual weighting. The feature map values after attention weight scaling have high dispersion and unstable feature distribution. Subsequent pooling and fully connected layers are easily affected by abnormal feature values, and the training process is prone to overfitting. At the same time, this patent uses a four-layer serial convolutional block as the feature extraction backbone, resulting in a large network depth and a large number of model parameters. The inference speed is slow on low-end screening terminals, making it difficult to adapt to real-time screening scenarios with portable fundus cameras in communities. In addition, although the CBAM channel branch of this patent uses global averaging and max pooling to obtain channel descriptions, it does not form a dedicated adaptation with the three-layer lightweight convolutional backbone. The high-level lesion feature extraction is insufficient, and there is feature redundancy between the multi-scale fusion module and the CBAM module, resulting in high computational resource consumption. In summary, although this patent combines the attention mechanism with the DR grading task, it does not specifically improve the original structural defects of CBAM. The ability to identify small lesions, the stability of model training, and the lightweight nature of inference are all significantly insufficient, thus limiting its clinical practical value.
[0005] Existing academic literature and authorized patent solutions reveal that current diabetic retinopathy grading technologies based on convolutional block attention modules (CBAMs) generally suffer from three core bottlenecks that cannot be addressed simultaneously: First, the traditional 7×7 large convolutional kernel of the spatial branch of CBAMs is mismatched with the micron-scale lesions in the fundus, easily introducing background noise that weakens lesion features; second, the lack of post-batch normalization constraint after attention channel and spatial weighting results in discrete enhanced feature distribution, training oscillations, and poor generalization ability; third, most networks have too many convolutional layers in the backbone, resulting in a large number of parameters and high difficulty in deploying on underlying devices. Existing research and patents only alleviate these problems through external multi-scale and transfer learning auxiliary methods, without optimizing the original structure of the spatial convolutional kernel and post-normalization process within the CBAM module, thus failing to fundamentally improve the representation of micro-lesion features and the stability of the model. Summary of the Invention
[0006] To address the aforementioned technical problems, this application discloses a method for grading diabetic retinopathy based on an optimized convolutional block attention module, comprising the following steps:
[0007] S1: Obtain the fundus image to be classified, perform preprocessing operations on the fundus image to obtain a standardized fundus image;
[0008] S2: Input the standardized fundus image into a three-layer convolutional feature extraction network, extract features sequentially through the first convolutional block, the second convolutional block, and the third convolutional block, and output the third convolutional feature map F;
[0009] S3: Input the third-layer convolutional feature map F into the attention module of the optimized convolutional block, and calculate the channel attention weights through the channel attention branches respectively. Spatial attention branch calculation of spatial attention weights ;
[0010] S4: Employing channel attention weights Channel-enhanced feature maps are obtained by weighting the third-layer convolutional feature map F channel by channel. Then spatial attention weights are used. Enhanced feature map of the channel Element-wise weighting yields spatially augmented feature maps. Batch normalization (BN) is then applied to these spatially augmented feature maps to output the augmented feature maps. ;
[0011] S5: Input the enhanced feature map into the adaptive average pooling layer and convert it into a fixed-size pooling feature map;
[0012] S6: Expand the pooling feature map into a one-dimensional feature vector, feed it into a fully connected classifier, and output the classification result of fundus images of diabetic retinopathy.
[0013] Preferably, the preprocessing operation in S1 includes the following sub-steps:
[0014] S101: Scale the fundus image to a preset fixed size;
[0015] S102: During the model training phase, data augmentation operations such as brightness adjustment, contrast adjustment, and random cropping are performed on the scaled image.
[0016] S103: Convert the enhanced image to tensor format;
[0017] S104: Normalize the image tensor using preset mean and standard deviation to obtain a standardized fundus image.
[0018] Preferably, the three-layer convolutional feature extraction network structure in S2 is configured as follows:
[0019] The first and second convolutional blocks are connected in series. Each convolutional block contains two convolutional layers, a batch normalization layer, a ReLU non-linear activation layer, and a max pooling layer. The third convolutional block is connected to the output of the second convolutional block. The third convolutional block contains a convolutional layer, a batch normalization layer, and a ReLU non-linear activation layer. The output of the third convolutional block is connected to the input of the attention module of the optimized convolutional block.
[0020] Preferably, the calculation process of the channel attention branch in S3 includes:
[0021] S301: Perform global average pooling and global max pooling on the input feature map F respectively to obtain the corresponding channel description features: , ;in This is the feature map of the third convolutional layer; This is a global average pooling operation; This is a global max-pooling operation; Describe the characteristics of the output channels for global average pooling; This describes the characteristics of the output channel in global max pooling.
[0022] S302: Will , Inputting each into the same shared convolutional mapping network g The two sets of mapping results are added together and then fed into the Sigmoid function to generate channel attention weights. ;in For shared convolutional mapping network operations; Use the Sigmoid activation function; This represents the channel attention weight.
[0023] S303: Adjust channel attention weights Multiplying the input feature map F channel by channel yields the channel-enhanced feature map: ;in Enhance the feature map for the channel. This is a channel-by-channel multiplication operation.
[0024] Preferably, the calculation process of the spatial attention branch in S3 includes:
[0025] S311: Enhanced feature map of the channel Perform average pooling and max pooling along the channel dimension to obtain two sets of spatial description graphs;
[0026] S312: Concatenate two sets of spatial description maps and feed them into a convolutional layer with a kernel size of 5×5. The output is processed by the Sigmoid function to obtain the spatial attention weights. ;in This is an average pooling operation along the channel dimension; This is a max pooling operation along the channel dimension; For feature concatenation operations; Convolution operation with a 5×5 kernel; For spatial attention weights.
[0027] S313: Adjust spatial attention weights With channel enhancement feature map Element-wise multiplication yields the spatially enhanced feature map; the multiplication operation in the formula is an element-wise multiplication operation.
[0028] Preferably, the batch normalization process in S4 includes:
[0029] S401: Extract spatial augmentation feature map As batch normalized input data;
[0030] S402: Perform batch normalization on the spatial augmentation feature map to obtain the optimized convolutional block attention module output augmentation feature map. The calculation formula is as follows: ;in Representative batch normalization operation; For spatial enhancement feature maps; To optimize the output of the attention module in the convolutional block, we enhance the feature map.
[0031] Preferably, the S5 adaptive average pooling process includes:
[0032] S501: Enhance feature map Input adaptive average pooling layer;
[0033] S502: Adaptive average pooling layer pair Spatial dimensionality compression is performed, limiting the spatial size of the output feature map to a preset size while keeping the number of feature channels unchanged, and the output pooled feature map is then generated. ;
[0034] in This is a fixed-size two-dimensional feature map output by adaptive average pooling.
[0035] Preferably, the S6 feature map flattening process includes:
[0036] S601: Read the 2D pooling feature map of the adaptive average pooling output. ;
[0037] S602: Dimensionally stretch the 2D pooled feature map along the channel dimension, converting the 2D structure into a 1D structure and generating a 1D feature vector. .
[0038] Preferably, the feature mapping process for a fully connected classifier includes:
[0039] S611: Transform one-dimensional feature vectors The first fully connected layer is used to perform the initial linear transformation.
[0040] S612: The initial transformation features are fed into the second fully connected layer to complete the quadratic linear mapping;
[0041] S613: After mapping, the features are processed by the Dropout layer to perform a random masking operation on the neurons, resulting in a filtered feature vector. .
[0042] Preferably, the classification output processing flow includes:
[0043] S621: Filter the feature vector output from the Dropout layer. Send to the output layer;
[0044] S622: The output layer calculates the input feature vector and outputs the prediction score for each category; where Score is the prediction probability score for each fundus image category.
[0045] S623: Based on the output predicted score, match the corresponding category label to obtain the classification result of diabetic retinopathy level in fundus image.
[0046] Compared with the prior art, the technical solution of this application has the following technical effects:
[0047] This invention standardizes the preprocessing workflow to unify the size of fundus images and performs data augmentation and normalization. This eliminates sample differences caused by lighting and imaging size in the original fundus images, standardizes the distribution of input data, and allows the standardized images to stably adapt to the subsequent three-layer convolutional feature extraction network. This enables shallow, middle, and high-level convolutions to extract retinal texture, vascular structure, and lesion semantic information in an orderly manner, reducing the interference of original image noise on the feature extraction process. The unified data input format also reduces gradient fluctuations during network training, ensuring consistency in the extraction of hierarchical features layer by layer in the convolutional layers.
[0048] This invention employs a three-layer progressive convolutional feature extraction structure, layer by layer extracting semantic features of superficial texture, local structure, and high-level lesions from fundus images. The hierarchical structure is streamlined and controllable, allowing for the control of overall model parameters while fully capturing lesion-related features. Each convolutional block is equipped with batch normalization and nonlinear activation units, and the output features of each layer are standardized to avoid excessive shifts in feature value ranges. The high-level features output by the three-layer convolutional network focus on key lesion areas in the fundus, fully preserving the feature information of subtle lesions such as microaneurysms and hemorrhages.
[0049] This invention optimizes the convolutional block attention module to complete feature enhancement through dual channels and spatial branches. The channel branch relies on global double pooling to filter feature channels with lesion information, while the spatial branch uses a 5x5 convolution kernel adapted to small lesions to generate spatial weights, accurately locating local lesion areas in the fundus. After spatial weighting, batch normalization is added to unify the distribution range of features after attention enhancement, alleviating the feature dispersion problem caused by weight scaling. The entire attention process amplifies the lesion-related feature response layer by layer, weakens the feature weights of background regions unrelated to the retina, and allows the network to prioritize focusing on various subtle lesion areas, continuously strengthening the expression of lesion features in the overall feature map.
[0050] This invention utilizes adaptive average pooling to compress feature dimensions, fixes the output feature size, reduces the computational burden on subsequent fully connected classifiers, and minimizes fitting bias caused by redundant parameters. After pooling, the flattened features are fed into a hierarchical fully connected structure with randomly deactivated units to complete feature mapping, filtering out invalid feature interference and outputting classification results corresponding to the level of fundus lesions. The entire pooling and classification process is tightly integrated, stably receiving standardized enhanced features from the attention module, ensuring complete transfer of feature information to the classification output, continuously maintaining stable classification operation, and reliably completing the automatic classification of diabetic retinopathy levels in fundus images.
[0051] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the preferred embodiments of this application are described in detail below with reference to the accompanying drawings.
[0052] The above and other objects, advantages and features of this application will become more apparent to those skilled in the art from the following detailed description of specific embodiments in conjunction with the accompanying drawings. Attached Figure Description
[0053] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In all drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn to scale.
[0054] Based on the description of the figures and their corresponding technical content in the document, the titles of the figures are as follows:
[0055] Figure 1 This is an overall flowchart of the diabetic retinopathy grading method based on the optimized convolutional block attention module of the present invention;
[0056] Figure 2 This is a schematic diagram of the structure of the three-layer convolutional feature extraction network described in this invention;
[0057] Figure 3 This is a schematic diagram of the structure of the optimized convolutional block attention module described in this invention;
[0058] Figure 4 This is a flowchart illustrating the calculation of the channel attention branch described in this invention;
[0059] Figure 5 This is a flowchart of the spatial attention branch calculation described in this invention;
[0060] Figure 6 This is a comparison chart of the classification accuracy of the optimized convolutional block attention module and the original convolutional block attention module described in this invention. Detailed Implementation
[0061] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. In the following description, specific details such as specific configurations and components are provided merely to help fully understand the embodiments of this application. Therefore, those skilled in the art should understand that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this application. In addition, for clarity and brevity, descriptions of known functions and structures are omitted in the embodiments.
[0062] It should be understood that the phrase "an embodiment" or "this embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "an embodiment" or "this embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.
[0063] Furthermore, reference numerals and / or letters may be repeated in different examples within this application. Such repetition is for the purpose of simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or settings discussed.
[0064] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, B exists alone, and A and B exist simultaneously. The term " / and" in this article describes another type of relationship between related objects, indicating that two relationships can exist. For example, A / and B can mean: A exists alone, and A and B exist alone. In addition, the character " / " in this article generally indicates that the related objects before and after it are in an "or" relationship.
[0065] In this article, the term "at least one" is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, "at least one of A and B" can mean: A exists alone, A and B exist simultaneously, or B exists alone.
[0066] It should also be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion.
[0067] Example 1
[0068] This embodiment mainly describes a method for grading diabetic retinopathy based on an optimized convolutional block attention module, such as... Figure 1 As shown, it includes the following steps:
[0069] S1: Obtain the fundus image to be classified, perform preprocessing operations on the fundus image to obtain a standardized fundus image;
[0070] S2: Input the standardized fundus image into a three-layer convolutional feature extraction network, extract features sequentially through the first convolutional block, the second convolutional block, and the third convolutional block, and output the third convolutional feature map F;
[0071] S3: Input the third-layer convolutional feature map F into the attention module of the optimized convolutional block, and calculate the channel attention weights through the channel attention branches respectively. Spatial attention branch calculation of spatial attention weights ;
[0072] S4: Employing channel attention weights Channel-enhanced feature maps are obtained by weighting the third-layer convolutional feature map F channel by channel. Then spatial attention weights are used. Enhanced feature map of the channel Element-wise weighting yields spatially augmented feature maps. Batch normalization (BN) is then applied to these spatially augmented feature maps to output the augmented feature maps. ;
[0073] S5: Input the enhanced feature map into the adaptive average pooling layer and convert it into a fixed-size pooling feature map;
[0074] S6: Expand the pooling feature map into a one-dimensional feature vector, feed it into a fully connected classifier, and output the classification result of fundus images of diabetic retinopathy.
[0075] The method mainly consists of five parts: fundus image preprocessing, convolutional feature extraction, optimized convolutional block attention enhancement, pooling compression, and classification output.
[0076] The input fundus images are subjected to size unification, data augmentation, and normalization processing;
[0077] A three-layer convolutional feature extraction network is used to extract fundus image features layer by layer;
[0078] An optimized convolutional block attention module is introduced after the third layer of convolutional feature maps. The lesion-related features are enhanced through channel attention branches and spatial attention branches. The spatial attention branch uses a 5×5 convolutional kernel, and a batch normalization layer is added after the attention output.
[0079] The fundus image is used to assist in classification by using an adaptive average pooling layer and a fully connected classifier.
[0080] The specific steps are as follows:
[0081] S1: Preprocess the fundus image.
[0082] This step is used to obtain a standardized fundus image suitable for network input. First, the input fundus image is acquired; then, the fundus image is adjusted to a uniform size; next, during the training phase, the image undergoes enhancement processing such as brightness adjustment, contrast adjustment, and random cropping; finally, the image is converted into tensor form and normalized according to preset mean and standard deviation.
[0083] S2: Calculate the convolutional features of the fundus image.
[0084] like Figure 2 As shown, this step is used to extract hierarchical convolutional features from fundus images. The preprocessed fundus image is input into a three-layer convolutional feature extraction network. The first convolutional block is used to extract shallow image features from the fundus image, the second convolutional block is used to further extract local structural features, and the third convolutional block is used to obtain higher-level convolutional features. Convolutional layers, batch normalization layers, nonlinear activation functions, and pooling operations are set in the first and second convolutional blocks to achieve feature extraction and spatial size compression; the high-level convolutional features output by the third convolutional block are further input into the attention module of the optimization convolutional block to enhance the feature representation ability of regions related to diabetic retinopathy.
[0085] S3: Calculate and optimize the attention features of the convolutional block.
[0086] like Figure 3 As shown, this step is used to enhance key features related to diabetic retinopathy in fundus images; the third-layer convolutional feature map is input into the optimized convolutional block attention module, and channel attention calculation, spatial attention calculation, and batch normalization are performed sequentially to obtain the output enhanced feature map, as shown. Figure 4 , Figure 5 As shown.
[0087] Let F be the convolutional feature map of the third layer of the input optimization convolutional block attention module. First, perform global average pooling and global max pooling on F respectively to obtain two channel description results:
[0088]
[0089]
[0090] Here, AvgPool(·) represents global average pooling, and MaxPool(·) represents global max pooling.
[0091] Then, the two channel description results are input into the shared convolutional mapping network, and the two mapping results are added together and then passed through the Sigmoid function to obtain the channel attention weights:
[0092]
[0093] Among them, g Represents a shared convolutional mapping network, A c Channel attention weights
[0094] Channel-wise weighting of the input feature map F is performed using channel attention weights to obtain the channel-enhanced feature map:
[0095]
[0096] The channel-enhanced feature maps are subjected to average pooling and max pooling along the channel dimension to obtain two spatial description maps. These two spatial description maps are then concatenated and input into a 5×5 convolutional layer, and the spatial attention weights are obtained by passing the sigmoid function.
[0097]
[0098] Among them, Avg c (·) indicates average pooling along the channel dimension, Max c (·) indicates max pooling along the channel dimension, Conv 5×5 This indicates a convolution operation with a kernel size of 5×5, where the subscript s indicates the spatial dimension.
[0099] The channel-enhanced feature maps are element-wise weighted using spatial attention weights, and the output enhanced feature maps are obtained through a batch normalization layer.
[0100]
[0101] Among them, BN This indicates batch normalization. Through the above processing, the optimized convolutional block attention module can first filter important features from the channel dimension, then enhance the local expression of lesion-related regions from the spatial dimension, and stabilize the feature distribution after attention enhancement through batch normalization.
[0102] S4: Perform pooling compression on the output augmentation features.
[0103] This step reduces the input dimensionality of subsequent classifiers. The enhanced feature map output from the optimized convolutional block attention module is input into an adaptive average pooling layer, which then transforms it into a pooled feature map of a preset size. This process allows control over the parameter scale of subsequent fully connected classifiers while preserving key feature information.
[0104] S5: Output fundus image to assist in classification.
[0105] This step is used to perform classification based on the pooled features. The fixed-size pooled feature map is unfolded into a one-dimensional feature vector and input into a fully connected classifier; the fully connected classifier performs non-linear mapping and classification on the feature vector and outputs the classification.
[0106] The results obtained indicate whether the fundus image belongs to the normal category or the diabetic retinopathy category.
[0107] This embodiment standardizes the distribution of fundus image input data through standardized image preprocessing, and uses a three-layer progressive convolutional network to extract fundus texture and lesion hierarchical features in a layered manner. Then, by optimizing the convolutional block attention module, it accurately locates small lesion areas with a 5x5 convolution kernel and adds batch normalization operation after weighting to stabilize the feature distribution. With the help of adaptive pooling and a hierarchical fully connected classification structure, it completely transmits standardized lesion features to complete the hierarchical output. The whole solution can weaken the interference of retinal irrelevant background without changing the basic network framework, strengthen the expression of subtle lesion features, stably control the gradient fluctuation of model training, and simultaneously improve the accuracy of fundus image hierarchical recognition of diabetic retinopathy and the stability of model generalization operation. It is suitable for use in intelligent screening scenarios of large batches of primary fundus images.
[0108] Based on Example 1, this example selects a binary classification dataset containing normal fundus samples and fundus samples from severe diabetic retinopathy to conduct model performance verification experiments. All fundus image samples underwent uniform size scaling, data augmentation, tensor transformation, and normalization preprocessing to ensure consistent image data distribution in the input model. Two sets of control models were set up. The first set was a baseline comparison model equipped with the original convolutional block attention module. This model uses a standard 7×7 convolutional kernel for its spatial attention branch, and no batch normalization process was added after the channel and spatial weighted operations. The second set was an improved model with optimized convolutional block attention module as described in this application. It uses a 5×5 spatial convolutional kernel with a post-attention output batch normalization structure, corresponding to the 5×5 spatial convolutional kernel defined in the aforementioned claims. Both models share the same three-layer convolutional feature extraction backbone, adaptive average pooling structure, and hierarchical fully connected classifier. Only the internal structure of the attention module is distinguished, thus eliminating interference from other variables such as the network backbone and classification structure on the experimental accuracy, ensuring that the experimental results only reflect the performance changes brought about by the optimized convolutional block attention module.
[0109] like Figure 6As shown, after the complete training process, the classification accuracy values of the two models on the test set and validation set were read respectively. The bar chart provides a visual comparison of the accuracy results of the two models. For the baseline model equipped with the original convolutional block attention module, the white bars represent a classification accuracy of 89.5% on the test set, and the bars with diagonal fills represent a classification accuracy of 90% on the validation set. The difference in accuracy between the two datasets is small, but the overall numerical range is low, reflecting that the original attention structure has obvious limitations in extracting fundus lesion features. Small lesion features are easily covered by retinal background information, the model has limited ability to distinguish between normal fundus images and diseased fundus images, and the numerical distribution after feature weighting is discrete, limiting the room for improvement in classification accuracy.
[0110] The improved model using the optimized convolutional block attention module of this application achieved a classification accuracy of 93.5% on the test set (corresponding to the white bars) and 92.1% on the validation set (corresponding to the diagonally filled bars). Both datasets showed a significant increase in accuracy compared to the baseline model. Comparing the accuracy differences between the two models on the same dataset reveals a 4 percentage point improvement in test set accuracy and a 2.1 percentage point improvement in validation set accuracy. The higher improvement on the test set compared to the validation set indicates that the optimized attention module better adapts to unfamiliar fundus image samples not used in model training, effectively enhancing the model's generalization performance. Furthermore, the accuracy difference between the validation and test sets did not significantly widen, indicating no obvious overfitting and more stable classification performance.
[0111] The overall numerical distribution of the two models in the bar chart can be used to further analyze the underlying performance gains brought by the technical solution of this application. The original convolutional block attention module introduces a large number of irrelevant background pixels due to the large spatial convolution kernel, weakening the weight of the lesion area, and the lack of post-normalization constraints leads to feature distribution shift, resulting in an overall low classification accuracy. This application adjusts the spatial branch convolution kernel to a 5x5 specification to adapt to small fundus lesions, accurately reducing the receptive field range of spatial weight calculation and reducing background noise interference. At the same time, after spatial attention weighting, a batch normalization layer is added to unify the feature value distribution and correct the feature dispersion problem caused by weight scaling. The entire set of optimizations only targets the internal structure of the convolutional block attention module and does not require changes to other layers of the network. While retaining the original complete algorithm flow, it simultaneously improves the recognition accuracy and operational stability of fundus image classification tasks, which can better meet the actual needs of automatic grading screening of fundus images for diabetic retinopathy.
[0112] This embodiment, through a control experiment that only distinguishes the internal structure of the attention module, shows that compared to the comparison model equipped with the original convolutional block attention module, the model using the optimized convolutional block attention module of this application significantly improves the accuracy of both the test and validation sets. The accuracy of the test set increases by four percentage points, and the accuracy of the validation set increases by two and a half percentage points. The higher improvement in the test set reflects the enhanced generalization ability of the model. The absence of an abnormal increase in the difference in accuracy between the two datasets proves that the model has no obvious overfitting. Based on the internal structure improvements of reducing the receptive field and background noise by using a 5x5 spatial convolutional kernel and normalizing the feature distribution by post-batch normalization, the recognition accuracy and operational stability of the binary classification task of fundus images of normal and severe diabetic retinopathy are simultaneously improved without changing the other layers of the network and without completely retaining the original algorithm flow, thus adapting to the actual use needs of intelligent fundus image screening.
[0113] The above are merely preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. For those skilled in the art, the present invention can have various modifications and variations. Any changes, modifications, substitutions, integrations, and parameter changes made to these embodiments within the spirit and principles of the present invention, without departing from the principles and spirit of the present invention, through conventional substitutions or to achieve the same function, fall within the scope of protection of the present invention.
Claims
1. A method for grading diabetic retinopathy based on an optimized convolutional block attention module, characterized in that, Includes the following steps: S1: Obtain the fundus image to be classified, perform preprocessing operations on the fundus image to obtain a standardized fundus image; S2: Input the standardized fundus image into a three-layer convolutional feature extraction network, extract features sequentially through the first convolutional block, the second convolutional block, and the third convolutional block, and output the third convolutional feature map F; S3: Input the third-layer convolutional feature map F into the attention module of the optimized convolutional block, and calculate the channel attention weights through the channel attention branches respectively. Spatial attention branch calculation of spatial attention weights ; S4: Employing channel attention weights Channel-enhanced feature maps are obtained by weighting the third-layer convolutional feature map F channel by channel. Then spatial attention weights are used. Enhanced feature map of the channel Element-wise weighting yields spatially augmented feature maps. Batch normalization (BN) is then applied to these spatially augmented feature maps to output the augmented feature maps. ; S5: Input the enhanced feature map into the adaptive average pooling layer and convert it into a fixed-size pooling feature map; S6: Expand the pooling feature map into a one-dimensional feature vector, feed it into a fully connected classifier, and output the classification result of fundus images of diabetic retinopathy.
2. The method for grading diabetic retinopathy based on an optimized convolutional block attention module according to claim 1, characterized in that, The preprocessing operation described in S1 includes the following sub-steps: S101: Scale the fundus image to a preset fixed size; S102: During the model training phase, data augmentation operations such as brightness adjustment, contrast adjustment, and random cropping are performed on the scaled image. S103: Convert the enhanced image to tensor format; S104: Normalize the image tensor using preset mean and standard deviation to obtain a standardized fundus image.
3. The method for grading diabetic retinopathy based on an optimized convolutional block attention module according to claim 2, characterized in that, The three-layer convolutional feature extraction network structure described in S2 is configured as follows: The first and second convolutional blocks are connected in series. Each convolutional block contains two convolutional layers, a batch normalization layer, a ReLU non-linear activation layer, and a max pooling layer. The third convolutional block is connected to the output of the second convolutional block. The third convolutional block contains a convolutional layer, a batch normalization layer, and a ReLU non-linear activation layer. The output of the third convolutional block is connected to the input of the attention module of the optimized convolutional block.
4. The method for grading diabetic retinopathy based on an optimized convolutional block attention module according to claim 3, characterized in that, The calculation process of the channel attention branch described in S3 includes: S301: Perform global average pooling and global max pooling on the input feature map F respectively to obtain the corresponding channel description features: , ;in This is the feature map of the third convolutional layer; This is a global average pooling operation; This is a global max-pooling operation; Describe the characteristics of the output channels for global average pooling; This describes the characteristics of the output channel in global max pooling. S302: Will , Inputting each into the same shared convolutional mapping network g The two sets of mapping results are added together and then fed into the Sigmoid function to generate channel attention weights. ;in For shared convolutional mapping network operations; Use the Sigmoid activation function; This represents the channel attention weight. S303: Adjust channel attention weights Multiplying the input feature map F channel by channel yields the channel-enhanced feature map: ;in Enhance the feature map for the channel. This is a channel-by-channel multiplication operation.
5. The method for grading diabetic retinopathy based on an optimized convolutional block attention module according to claim 4, characterized in that, The calculation process of the spatial attention branch described in S3 includes: S311: Enhanced feature map of the channel Perform average pooling and max pooling along the channel dimension to obtain two sets of spatial description graphs; S312: Concatenate two sets of spatial description maps and feed them into a convolutional layer with a kernel size of 5×5. The output is processed by the Sigmoid function to obtain the spatial attention weights. ;in This is an average pooling operation along the channel dimension; This is a max pooling operation along the channel dimension; For feature concatenation operations; Convolution operation with a 5×5 kernel; For spatial attention weights. S313: Adjust spatial attention weights With channel enhancement feature map Element-wise multiplication yields the spatially enhanced feature map; the multiplication operation in the formula is an element-wise multiplication operation.
6. The method for grading diabetic retinopathy based on an optimized convolutional block attention module according to claim 5, characterized in that, The batch normalization process in S4 includes: S401: Extract spatial augmentation feature map As batch normalized input data; S402: Perform batch normalization on the spatial augmentation feature map to obtain the optimized convolutional block attention module output augmentation feature map. The calculation formula is as follows: ;in Representative batch normalization operation; For spatial enhancement feature maps; To optimize the output of the attention module in the convolutional block, we enhance the feature map.
7. The method for grading diabetic retinopathy based on an optimized convolutional block attention module according to claim 6, characterized in that, The S5 adaptive average pooling process includes: S501: Enhance feature map Input adaptive average pooling layer; S502: Adaptive average pooling layer pair Spatial dimensionality compression is performed, limiting the spatial size of the output feature map to a preset size while keeping the number of feature channels unchanged, and the output pooled feature map is then generated. ; in This is a fixed-size two-dimensional feature map output by adaptive average pooling.
8. The method for grading diabetic retinopathy based on an optimized convolutional block attention module according to claim 7, characterized in that, The S6 feature map flattening process includes: S601: Read the 2D pooling feature map of the adaptive average pooling output. ; S602: Dimensionally stretch the 2D pooled feature map along the channel dimension, converting the 2D structure into a 1D structure and generating a 1D feature vector. .
9. The method for grading diabetic retinopathy based on an optimized convolutional block attention module according to claim 8, characterized in that, The feature mapping process for a fully connected classifier includes: S611: Transform one-dimensional feature vectors The first fully connected layer is used to perform the initial linear transformation. S612: The initial transformation features are fed into the second fully connected layer to complete the quadratic linear mapping; S613: After mapping, the features are processed by the Dropout layer to perform a random masking operation on the neurons, resulting in a filtered feature vector. .
10. The method for grading diabetic retinopathy based on an optimized convolutional block attention module according to claim 9, characterized in that, The classification output processing flow includes: S621: Filter the feature vector output from the Dropout layer. Send to the output layer; S622: The output layer calculates the input feature vector and outputs the prediction score for each category; where Score is the prediction probability score for each fundus image category. S623: Based on the output predicted score, match the corresponding category label to obtain the classification result of diabetic retinopathy level in fundus image.
Citation Information
Patent Citations
A Diabetic Retinopathy Grading Method Based on Multi-Scale Fusion Attention Mechanism
CN114266757B