An eye fundus image lesion segmentation method and device, computer equipment and medium

By constructing a deep learning-based lesion segmentation model for fundus images, the problem of insufficient accuracy and robustness in the segmentation of various types of lesions in existing technologies has been solved. This has enabled automated and accurate segmentation of diabetic retinopathy lesions, improving detection accuracy and reducing the workload of doctors.

CN120318249BActive Publication Date: 2026-06-02QUFU NORMAL UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
QUFU NORMAL UNIV
Filing Date
2025-03-31
Publication Date
2026-06-02

Smart Images

  • Figure CN120318249B_ABST
    Figure CN120318249B_ABST
Patent Text Reader

Abstract

The application provides an eye fundus image lesion segmentation method and device, computer equipment and medium, and belongs to the technical field of medical image processing. The method improves the generalization ability of the model through data preprocessing, uses an eye fundus image lesion segmentation model containing an encoder, a global-local attention module, a multi-scale feature capturing module and a decoder, and realizes accurate segmentation of four kinds of sugar net disease lesions in the eye fundus image. The encoder adopts a three-branch structure to extract multi-scale features, the global-local attention module fuses global and local attention features, the multi-scale feature capturing module extracts multi-scale lesion features through different convolution kernels, and the decoder generates the final segmentation result through channel splicing and up-sampling. The application adopts the above-mentioned eye fundus image lesion segmentation method, device, computer equipment and medium, can simultaneously segment four kinds of sugar net disease lesions in the eye fundus image, has fewer calculation parameters, and has good accuracy and robustness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of medical image processing technology, and in particular to a method, apparatus, computer equipment, and medium for segmenting lesions in fundus images. Background Technology

[0002] Diabetic retinopathy is the most common microvascular complication of diabetes. With socioeconomic development and changes in lifestyle, the number of people with diabetes is increasing, and the incidence of diabetic retinopathy is rising year by year. Diabetic retinopathy often presents with no obvious symptoms in its early stages; however, as the disease progresses, symptoms such as blurred vision become more pronounced, and in severe cases, it can lead to blindness. Early detection of diabetic retinopathy is crucial for timely treatment and alleviating patient suffering.

[0003] The main pathological features of diabetic retinopathy include microaneurysms (MA), hemorrhages (HE), soft exudates (SE), and hard exudates (EX). Different types of lesions appear at different stages of diabetic retinopathy. Ophthalmologists typically manually label the type, size, distribution, and number of lesions to assess disease progression. However, this method is highly dependent on expert experience, costly, and limited by medical resources, making it difficult to implement on a large scale.

[0004] Therefore, it is necessary to design an automated and accurate method for segmenting diabetic retinopathy lesions to reduce the burden on physicians. However, existing methods for segmenting diabetic retinopathy lesions based on fundus color images are difficult to segment simultaneously for multiple types of lesions, and their accuracy and robustness need to be improved. Summary of the Invention

[0005] The purpose of this invention is to provide a method, device, computer equipment, and medium for segmenting lesions in fundus images. By using deep learning technology, it can achieve automated and accurate segmentation of diabetic retinopathy areas, effectively improving the accuracy of lesion detection and reducing the workload of doctors.

[0006] To achieve the above objectives, the present invention provides a method for lesion segmentation in fundus images, comprising the following steps:

[0007] The original fundus image is preprocessed to obtain the preprocessed image;

[0008] A lesion segmentation model for fundus images is constructed, which includes an encoder, a global-local attention module, a multi-scale feature capture module, and a decoder.

[0009] Feature extraction and segmentation of the preprocessed image are performed using a fundus image lesion segmentation model, including:

[0010] The encoder extracts features from the input image through a multi-head self-attention mechanism, depthwise separable convolution, and pooling operations, thus obtaining encoder features.

[0011] The global-local attention module combines global attention and local attention features to enhance feature representation and obtain global-local attention features.

[0012] The multi-scale feature capture module extracts multi-scale lesion features through convolution operations of convolution kernels at different scales, thus obtaining multi-scale features;

[0013] The decoder performs channel concatenation and upsampling of encoder features, global and local attention features, and multi-scale features to generate the final lesion segmentation result;

[0014] The Dice loss function is used to guide model training, and the model weights are optimized through backpropagation.

[0015] Preferably, the encoder includes a left branch, a middle branch, and a right branch, wherein:

[0016] The left branch uses linear layers, depthwise separable convolutions, linear layers, and max pooling to extract high-frequency information, thus obtaining the features of the left branch.

[0017] The intermediate branch extracts global contextual information of the image through average pooling, multi-head attention, and upsampling to obtain intermediate branch features;

[0018] The right branch extracts low-frequency information through max pooling and linear operations to obtain the right branch features;

[0019] The left branch features, middle branch features, and right branch features are concatenated along the channel direction and downsampled layer by layer to obtain the encoder features.

[0020] Preferably, the global-local attention module includes:

[0021] Global attention module: consists of a global channel attention submodule and a global spatial attention submodule;

[0022] The global channel attention submodule is used to capture global contextual information of the image and generate weighted global channel attention features;

[0023] The global spatial attention submodule is used to combine channel information and spatial information to generate weighted global spatial attention features;

[0024] Multi-scale local attention module: Extracts multi-scale features through convolutional kernels of different scales and generates three weighted local attention features;

[0025] The global attention feature is obtained by element-wise addition of the weighted global channel attention feature and the weighted global spatial attention feature;

[0026] Three weighted local attention features are additively fused to generate multi-scale local attention features.

[0027] Preferably, during the weighted fusion process, the global attention features, multi-scale local attention features, and encoder features are weighted and added together through skip connections to obtain the global local attention features.

[0028] Preferably, the multi-scale feature capture module includes a first branch, a second branch, and a third branch, wherein:

[0029] The first branch extracts multi-scale lesion features through 1×1 convolution, 3×3 convolution and 1×1 convolution, and obtains the first branch features;

[0030] The second branch extracts multi-scale lesion features through 1×1 convolution, 5×5 convolution and 1×1 convolution, and obtains the second branch features;

[0031] The third branch extracts multi-scale lesion features through 1×1 convolution, 7×7 convolution and 1×1 convolution, and obtains the third branch features;

[0032] The first branch features, the second branch features, and the third branch features are added and fused element by element to obtain multi-scale features.

[0033] Preferably, the decoder includes:

[0034] Channel concatenation: Encoder features, global and local attention features, and multi-scale features are concatenated into channels;

[0035] Layer-by-layer upsampling: Gradually restore the feature map resolution to the size of the preprocessed image through multiple convolutional layers;

[0036] Output segmentation results: The final lesion segmentation results are output through a 1×1 convolutional layer.

[0037] The present invention also provides a lesion segmentation device for fundus images, comprising:

[0038] The data preprocessing module is used to preprocess the raw fundus images to obtain preprocessed images;

[0039] The model building module is used to build a lesion segmentation model for fundus images. The fundus image lesion segmentation model includes an encoder, a global and local attention module, a multi-scale feature capture module, and a decoder.

[0040] The feature extraction and segmentation module is used to extract and segment features from the preprocessed image using a fundus image lesion segmentation model, including:

[0041] The encoder extracts features from the input image through a multi-head self-attention mechanism, depthwise separable convolution, and pooling operations, thus obtaining encoder features.

[0042] The global-local attention module combines global attention and local attention features to enhance feature representation and obtain global-local attention features.

[0043] The multi-scale feature capture module extracts multi-scale lesion features through convolution operations of convolution kernels at different scales, thus obtaining multi-scale features;

[0044] The decoder performs channel concatenation and upsampling of encoder features, global and local attention features, and multi-scale features to generate the final lesion segmentation result;

[0045] The model training module is used to guide model training using the Dice loss function and optimize model weights through backpropagation.

[0046] The present invention also provides a computer device, including a memory and a processor, wherein the memory is used to store instructions and the processor is used to execute the instructions to implement the fundus image lesion segmentation method as described above.

[0047] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described method for segmenting lesions in fundus images.

[0048] Therefore, the present invention employs the above-described method, apparatus, computer equipment, and medium for segmenting lesions in fundus images, and the beneficial technical effects are as follows:

[0049] (1) High-precision lesion segmentation: Channel fusion is performed on multi-scale lesion features and global and local attention features at different levels, and the channel information related to lesion segmentation is focused on, which helps to accurately identify and segment diabetic retinopathy areas.

[0050] (2) Enhance the generalization ability of the model: Expand the training dataset by using data augmentation techniques (such as rotation, scaling, translation, etc.) to improve the model’s adaptability to different diabetic retinopathy images and avoid overfitting.

[0051] (3) Automated segmentation and high efficiency: This invention realizes automated segmentation of diabetic retinopathy, reduces manual intervention, improves doctors' work efficiency, and has broad clinical application potential. Attached Figure Description

[0052] Figure 1 This is a flowchart of a method for segmenting lesions in fundus images according to the present invention;

[0053] Figure 2A structural diagram of a lesion segmentation model for fundus images;

[0054] Figure 3 Here is a diagram of the encoder structure;

[0055] Figure 4 This is a diagram of the global and local attention module structure.

[0056] Figure 5 Here is a structural diagram of the multi-scale feature capture module;

[0057] Figure 6 Here is a diagram of the decoder structure;

[0058] Figure 7 The data represents the segmentation results for four types of lesions on the IDRiD dataset: hard exudate, soft exudate, microaneurysm, and hemorrhage. Figure 7 (a) in the image is the original fundus image; Figure 7 (b) in the image represents the lesion label in the fundus image; Figure 7 (c) in the figure represents the lesion segmentation result obtained by the present invention. Detailed Implementation

[0059] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.

[0060] Unless otherwise defined, the technical or scientific terms used in this invention shall have the ordinary meaning as understood by one of ordinary skill in the art to which this invention pertains.

[0061] Example 1

[0062] like Figure 1 The flowchart shown below illustrates a method for segmenting lesions in fundus images according to the present invention, which specifically includes the following steps:

[0063] Step 1: Preprocess the original fundus image to enhance image quality.

[0064] 1) The contrast-enhancing histogram equalization technique is used to improve the contrast of the image, making the details in the image more obvious, which helps the subsequent model to detect the lesion area.

[0065] 2) Apply nonlocal means denoising method to remove noise that is irrelevant to lesion segmentation, while retaining important structural features, thereby reducing the interference of bad noise on accurate segmentation.

[0066] 3) The entire fundus image after contrast enhancement and denoising is cropped into block images with a resolution of 224×224 to meet the network input requirements and ensure that each image block can contain sufficient lesion information to provide high-quality input data for model training.

[0067] like Figure 2The diagram shown is a structural diagram of a lesion segmentation model for fundus images. The specific process is as follows:

[0068] Step 2: Input the preprocessed image X into the encoder to extract features.

[0069] like Figure 3 As shown, the original fundus image is first divided into three single-channel images of the same size, and then input into an encoder (a three-branch encoder) to extract features.

[0070] The left branch uses linear layers, depthwise separable convolutions, and max pooling to extract high-frequency information, resulting in the left branch features. The right branch uses max pooling and linear operations to calculate low-frequency information, resulting in the right branch features. The specific calculation process is shown below:

[0071] Y,Z,J = split(X);

[0072] G=MaxPool(Linear(DWconv(Linear(Y))));

[0073] B = Linear(MaxPool(J));

[0074] Where Y, Z, and J represent the red, green, and blue channel images extracted from the original fundus image, respectively; G represents the left branch feature; B represents the right branch feature; split represents the channel partitioning function; Linear represents a linear layer; DWconv represents depthwise separable convolution; and MaxPool represents max pooling.

[0075] The intermediate branch sequentially undergoes average pooling, multi-head attention, and upsampling to extract global contextual information of the image, resulting in intermediate branch features. The specific calculation process is shown below:

[0076] M=AvgPool(MSA(Upsample(Z)));

[0077]

[0078] Where M represents the intermediate branch feature, AvgPool represents average pooling, MSA represents multi-head attention mechanism, Upsample represents upsampling operation, Q, K, and V represent query vector, key vector, and value vector, respectively, Softmax represents probabilistics, and d k The dimension representing multi-head attention is T, which stands for transpose.

[0079] Finally, the left branch features, middle branch features, and right branch features are stitched together in the channel direction and restored to the original image size, and then downsampled layer by layer.

[0080] Fi =Concat(G,B,M);

[0081] F i+1 =Downsample(F i );

[0082] Among them, F i F represents the encoder features of the current level. i+1 This represents the encoder features of the next level. Downsample represents the downsampling operation, Concat represents the channel concatenation operation, and i represents the index variable, i∈1,2,3,4,5.

[0083] Step 3, as follows Figure 4 As shown, the global local attention module uses a global attention module and a multi-scale local attention module to capture high-frequency local edge detail information and low-frequency global information, respectively, and then performs weighted residual connection with the encoder features to obtain global local attention features.

[0084] Step 4: The global attention module consists of a global channel attention submodule and a global spatial attention submodule. It interacts with channel and spatial information to generate a global channel attention graph GC∈R. C×C and global spatial attention graph GS∈R HW×HW R represents the real number field.

[0085] Global Channel Attention Map (GC∈R) C×C With encoder feature F i Element-wise multiplication followed by the encoder feature F i The weighted global channel attention features (GCF) are obtained by summing the features. The calculation process of the global channel attention submodule is shown in the following formula:

[0086]

[0087] Where Transpose represents the matrix transpose operation, and σ represents the sigmoid activation function. This represents element-wise multiplication. This indicates an element-wise addition operation, where H, W, and C represent the height, width, and number of channels of the feature map, respectively.

[0088] Next, a linear operation is performed on the weighted global channel attention feature GCF to obtain the feature matrix Q,K,V∈R. C×HW Then, the query matrix Q is transposed, multiplied by the key matrix K, and probabilistically processed to obtain the global spatial attention feature GS∈R. HW×HW The global spatial attention feature is multiplied by the value matrix V to obtain the weighted global spatial attention feature GSF∈R. C×HWFinally, the weighted global channel attention feature GCF and the weighted global spatial attention feature GSF are added element-wise to obtain the global attention feature GF. g ∈R C×HW .

[0089] Q,K,V = Linear(GCF);

[0090]

[0091] Step 6: The multi-scale local attention module first uses 3×3, 5×5, and 7×7 convolutional kernels to adjust different receptive fields to extract multi-scale lesion features L from fundus images. i 1,L i 2,L i 3∈R C×W×H The multi-scale features are then added together to obtain the multi-scale fused feature FL. i Then, global average pooling is used to convert FL... i Compressed to Z i ∈R C×1×1 Channel attention feature Z i ∈R C×1×1 Perform a linear operation to map to fine-grained channel attention features Z′ i ∈R C'×1×1 Where C' < C, and C' represents the number of feature map channels. Next, Z'... i ∈R C'×1×1 Transform into local attention features Then, the multi-scale lesion features L i 1,L i 2,L i 3∈R C×W×H With local attention features Element-wise multiplication yields the weighted local attention features. Finally, the three weighted local attention features are additively fused to generate a multi-scale local attention feature LF. l ∈R C×HW The computational process of the multi-scale local attention module can be represented as follows:

[0092] L i 1 = Conv 3×3 (F i ),L i 2 = Conv 5×5 (F i ),L i 3 = Conv 7×7 (F i );

[0093] FL i =L i1+L i 2+L i 3;

[0094] Z i =AvgPool(FL) i );

[0095] Z i =Linear(Z) i );

[0096]

[0097] Here, AvgPool represents global average pooling, Reshape represents matrix reshaping, Conv represents convolution operation, and the subscript of Conv indicates the convolution kernel size.

[0098] Step 7: Weighted summation of global attention features, multi-scale local attention features, and encoder features via skip connections to obtain the Global Local Attention Feature (GLF). i ∈R C×W×H The specific calculation process is as follows:

[0099]

[0100] Where, μ e μ g and μ l Both represent trainable weight coefficients, with μ e μ g and μ l All are set to 1.

[0101] Step 8, as follows Figure 5 As shown, the multi-scale feature capture module utilizes different convolution operations to extract multi-scale lesion features (MO). i And then perform element-by-element addition and fusion.

[0102] First, each input global-local attention feature (GLF) i The convolution operation is performed through three branches: the first branch, the second branch, and the third branch.

[0103] The first branch extracts multi-scale lesion features through 1×1 convolution, 3×3 convolution and 1×1 convolution, and obtains the first branch features;

[0104] The second branch extracts multi-scale lesion features through 1×1 convolution, 5×5 convolution and 1×1 convolution, and obtains the second branch features;

[0105] The third branch extracts multi-scale lesion features through 1×1 convolution, 7×7 convolution and 1×1 convolution, and obtains the third branch features;

[0106] Convolutional operations at different scales can capture multi-level features, facilitating the effective fusion of low-level edge details and high-level semantic information. The detailed computation process of this module is shown below:

[0107] GLF1, GLF2, GLF3 = split(GLF i );

[0108]

[0109] Wherein, GFL1, GFL2, and GFL3 represent the red, green, and blue channel feature maps extracted from the global local feature map, respectively; O1, O2, and O3 represent the features extracted from the first, second, and third branches, respectively; and MO i This represents the output of the multi-scale feature capture module, i.e., multi-scale lesion features. ReLU represents the linear rectified activation function.

[0110] Step 9, as follows Figure 6 As shown, the decoder features from the previous stage are combined with the multi-scale lesion features MO. i The input is fed into the decoder for channel concatenation and upsampling to obtain the final lesion segmentation result. The decoder uses average pooling, linear layers, activation layers, and probabilistic operations to calculate the attention weight of each channel. The channel attention weights are then multiplied element-wise with the encoder features and the fusion result of multi-scale lesion features, focusing on feature channels relevant to lesion segmentation and suppressing irrelevant feature channel information. Then, the feature map is upsampled layer by layer, gradually restoring the low-resolution feature map to a higher spatial resolution, making the details in the image clearer. Finally, the decoder feature map is passed through a 1×1 convolutional layer to output the diabetic retinopathy lesion segmentation result, accurately segmenting the lesion region.

[0111] D=Sigmoid(Linear(Activate(LN(AvgPool(Concat(F i MO i );

[0112] E i =Conv 3×3 (ReLU(Conv 3×3 (ReLU(Conv 3×3 (Concat(F i MO i )×D))))));

[0113] Output = Conv 1×1 (E5);

[0114] Where D represents channel attention weights, Activate represents the activation layer, LN represents layer normalization, and E i This represents the output of each decoder layer, and Output represents the final segmentation result.

[0115] Step 10: Use Dice loss as the loss function to guide model training. The calculation formula is shown below:

[0116]

[0117] Where U and Y represent the lesion label and the predicted segmentation result obtained by the model, respectively; |U| and |Y| represent the number of pixels in the lesion label and the segmentation prediction result, respectively; N represents the total number of pixels in the fundus image; and y j and These represent the label value and predicted value of pixel j, respectively.

[0118] This embodiment is experimentally validated on the internationally publicly available IDRide dataset. The model designed in this invention is trained on the IDRide training set and the optimal weights are saved. The segmentation performance is then verified on the test set. Table 1 shows the comparison results of the present invention with Unet, ResUnet, and Unet++ on four lesion segmentation methods on the IDRide dataset. Figure 7 These are four lesion segmentation results obtained by this invention on the IDRiD dataset. For example... Figure 7 As shown, the present invention can accurately segment the four types of lesions in diabetic retinopathy, and the segmentation results are close to those of manual annotation.

[0119] Table 1 Comparison Results

[0120]

[0121] Example 2

[0122] A device for segmenting lesions in fundus images, comprising:

[0123] The data preprocessing module is used to preprocess the raw fundus images to obtain preprocessed images;

[0124] The model building module is used to build a lesion segmentation model for fundus images. The fundus image lesion segmentation model includes an encoder, a global and local attention module, a multi-scale feature capture module, and a decoder.

[0125] The feature extraction and segmentation module is used to extract and segment features from the preprocessed image using a fundus image lesion segmentation model, including:

[0126] The encoder extracts features from the input image through a multi-head self-attention mechanism, depthwise separable convolution, and pooling operations, thus obtaining encoder features.

[0127] The global-local attention module combines global attention and local attention features to enhance feature representation and obtain global-local attention features.

[0128] The multi-scale feature capture module extracts multi-scale lesion features through convolution operations of convolution kernels at different scales, thereby obtaining multi-scale image features;

[0129] The decoder performs channel concatenation and upsampling of encoder features, global and local attention features, and multi-scale features to generate the final lesion segmentation result;

[0130] The model training module is used to guide model training using the Dice loss function and optimize model weights through backpropagation.

[0131] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0132] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.

[0133] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.

[0134] It is worth noting that all contents not described in detail in this invention are existing technologies and are well known to those skilled in the art.

[0135] Therefore, the present invention employs the above-mentioned method, apparatus, computer equipment and medium for segmenting fundus image lesions, which can simultaneously segment four types of diabetic retinopathy lesions in fundus images with fewer computational parameters, and has good accuracy and robustness.

[0136] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.

Claims

1. A method for segmenting lesions in fundus images, characterized in that, Includes the following steps: The original fundus image is preprocessed to obtain the preprocessed image; A fundus image lesion segmentation model is constructed, which includes a multi-stage encoder, a global-local attention module, a multi-scale feature capture module, and a corresponding multi-stage decoder. Feature extraction and segmentation of the preprocessed image are performed using a fundus image lesion segmentation model, including: The encoder extracts features from the input image through a multi-head self-attention mechanism, depthwise separable convolution, and pooling operations, thus obtaining encoder features. The global-local attention module takes encoder features as input, combines global attention and local attention features to enhance feature representation, and obtains global-local attention features. The multi-scale feature capture module takes global and local attention features as input and extracts multi-scale lesion features through convolution operations of convolution kernels of different scales to obtain multi-scale features; The decoder concatenates and upsamples the features from the previous stage decoder with the multi-scale features to generate the final lesion segmentation result; The Dice loss function is used to guide model training, and the model weights are optimized through backpropagation. The global-local attention module includes: Global attention module: consists of a global channel attention submodule and a global spatial attention submodule; The global channel attention submodule is used to capture global contextual information of the image and generate weighted global channel attention features; The global spatial attention submodule is used to combine channel information and spatial information to generate weighted global spatial attention features; Multi-scale local attention module: Extracts multi-scale features through convolutional kernels of different scales and generates three weighted local attention features; The global attention feature is obtained by element-wise addition of the weighted global channel attention feature and the weighted global spatial attention feature; Three weighted local attention features are additively fused to generate multi-scale local attention features; The encoder includes a left branch, a middle branch, and a right branch, where: The left branch uses linear layers, depthwise separable convolutions, linear layers, and max pooling to extract high-frequency information, thus obtaining the features of the left branch. The intermediate branch extracts global contextual information of the image through average pooling, multi-head attention, and upsampling to obtain intermediate branch features; The right branch extracts low-frequency information through max pooling and linear operations to obtain the right branch features; The left branch features, middle branch features, and right branch features are concatenated along the channel direction and downsampled layer by layer to obtain the encoder features.

2. The method for segmenting lesions in fundus images according to claim 1, characterized in that, During the weighted fusion process, global attention features, multi-scale local attention features, and encoder features are weighted and added together through skip connections to obtain global and local attention features.

3. The method for segmenting lesions in fundus images according to claim 2, characterized in that, The multi-scale feature capture module includes a first branch, a second branch, and a third branch, wherein: The first branch extracts multi-scale lesion features through 1×1 convolution, 3×3 convolution and 1×1 convolution, and obtains the first branch features; The second branch extracts multi-scale lesion features through 1×1 convolution, 5×5 convolution and 1×1 convolution, and obtains the second branch features; The third branch extracts multi-scale lesion features through 1×1 convolution, 7×7 convolution and 1×1 convolution, and obtains the third branch features; The first branch features, the second branch features, and the third branch features are added and fused element by element to obtain multi-scale features.

4. The method for segmenting lesions in fundus images according to claim 3, characterized in that, The decoder includes: Channel stitching: The decoder features and multi-scale features from the previous stage are stitched together. Layer-by-layer upsampling: Gradually restore the feature map resolution to the size of the preprocessed image through multiple convolutional layers; Output segmentation results: The final lesion segmentation results are output through a 1×1 convolutional layer.

5. A device for segmenting lesions in fundus images, characterized in that, A method for performing fundus image lesion segmentation as described in any one of claims 1-4, comprising: The data preprocessing module is used to preprocess the raw fundus images to obtain preprocessed images; The model building module is used to build a fundus image lesion segmentation model. The fundus image lesion segmentation model includes a multi-stage encoder, a global and local attention module, a multi-scale feature capture module, and a corresponding multi-stage decoder. The feature extraction and segmentation module is used to extract and segment features from the preprocessed image using a fundus image lesion segmentation model, including: The encoder extracts features from the input image through a multi-head self-attention mechanism, depthwise separable convolution, and pooling operations, thus obtaining encoder features. The global-local attention module takes encoder features as input, combines global attention and local attention features to enhance feature representation, and obtains global-local attention features. The multi-scale feature capture module takes global and local attention features as input and extracts multi-scale lesion features through convolution operations of convolution kernels of different scales to obtain multi-scale features; The decoder performs channel concatenation and upsampling of the encoder features and multi-scale features from the previous stage to generate the final lesion segmentation result; The model training module is used to guide model training using the Dice loss function and optimize model weights through backpropagation.

6. A computer device, characterized in that, It includes a memory and a processor, the memory being used to store instructions, and the processor being used to execute the instructions to implement the fundus image lesion segmentation method as described in any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the fundus image lesion segmentation method as described in any one of claims 1 to 4.