Eye fundus image optic cup and optic disc segmentation method based on improved U-net

By improving the U-net network, combining CrossFormer layer, ASPP detection head and composite loss function, the problem of blurred boundaries and small sizes in view cup disc segmentation is solved, and a higher precision view cup disc segmentation is achieved.

CN120495649APending Publication Date: 2025-08-15SHANGHAI UNIV OF ENG SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510484990.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-17
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

The existing visual cup and visual disc segmentation method is difficult to achieve precise segmentation when the boundaries of the visual cup and the visual disc are blurred and overlapping each other. In particular, the visual disc and visual cup are small in size. The traditional method is sensitive to noise and complex structures, and the neural network-based method is insufficient in feature extraction.

Method used

Using an improved U-net network, the model's attention and segmentation accuracy of the visual cup disc area are enhanced by adding a CrossFormer layer to the encoder and embedding the ASPP detection head in the decoder, combined with the composite loss function of Dice Loss and Cross Entropy Loss.

Benefits of technology

The boundary integrity and accuracy of visual cup disc segmentation are improved, the model's attention to the visual cup area is enhanced, and the robustness and accuracy of segmentation are improved, especially in the segmentation effect of vascular interference and small target areas.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120495649A_ABST
    Figure CN120495649A_ABST
Patent Text Reader

Abstract

The invention discloses a fundus image optic cup and optic disc segmentation method based on improved U-net, and belongs to the technical field of medical image processing. Comprises: acquiring a fundus image data set; an improved U-net network is constructed; a CrossFormer layer is added between the last layer of the encoder and a decoding structure; an ASPP detection head is embedded at the last end of the decoder; the method comprises the following steps of: constructing a compound type loss function in which Dice Loss and Cross Entry Loss are combined; training an improved U-net network by using the fundus image data set; and inputting a fundus image to be segmented into the trained improved U-net network for segmentation to obtain an optic cup and optic disc segmentation result. Based on the improved U-net, the problems that blood vessels penetrate through the optic cup and optic disc area, the edge is fuzzy, the proportion is small, and accurate segmentation is difficult are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of medical image processing, and in particular to a method for segmenting the optic cup and disc of a fundus image based on an improved U-net. Background Art

[0002] Glaucoma is a common eye disease characterized by optic nerve damage, often accompanied by visual field defects, which can lead to irreversible blindness in severe cases. Therefore, early diagnosis and treatment of glaucoma are crucial to avoid permanent vision loss. Glaucoma patients usually show enlarged optic cup and changes in optic disc morphology. These changes are caused by the gradual loss of optic nerve fibers. The three main techniques currently used to detect glaucoma are intraocular pressure assessment, visual field testing, and optic nerve head (ONH) assessment. Among them, ONH assessment is an important criterion, which is to analyze the cup-disc ratio (CDR) from the fundus structure. CDR is calculated as the ratio of the vertical cup diameter to the vertical disc diameter. The CDR of glaucoma patients is significantly larger than that of normal people. Accurate segmentation of the optic cup and optic disc and analysis of their ratio and morphological changes are of great significance for the early diagnosis of glaucoma, disease monitoring, and the formulation of treatment plans.

[0003] Currently, methods for optic cup and optic disc segmentation mainly include traditional segmentation algorithms and neural network-based optic cup and optic disc segmentation algorithms. Traditional fundus image extraction techniques are sensitive to noise, complex structures, and background interference, and cannot guarantee the segmentation accuracy of low-contrast images or small lesions. Neural network-based optic cup and optic disc segmentation algorithms have significant advantages in accuracy, robustness, and automation, overcoming many limitations of traditional methods. However, due to the blurred and overlapping boundaries between the optic cup and optic disc, the original skip connections in U-Net are unable to fully capture the boundary features. In addition, the size of the optic disc and optic cup is relatively small, and U-Net may not pay enough attention to them during feature extraction. Summary of the Invention

[0004] In response to the defects of the existing technology, the present invention performs optic cup and optic disc segmentation of fundus images based on an improved U-net, which is used to solve the problem that the optic cup and optic disc area has blood vessels passing through it, has blurred edges and a small proportion, making it difficult to accurately segment.

[0005] In order to achieve the above object, the present invention provides a method for optic cup and disc segmentation of fundus images based on an improved U-net, comprising the following steps:

[0006] (1) Obtain fundus image dataset;

[0007] (2) Construct an improved U-net network; add a CrossFormer layer between the last layer of the encoder and the decoding structure; embed the ASPP detection head at the end of the decoder; and construct a composite loss function that combines Dice Loss and Cross Entropy Loss;

[0008] (3) using the fundus image dataset to train the improved U-net network;

[0009] (4) Inputting the fundus image to be segmented into the trained improved U-net network for segmentation to obtain the optic cup and optic disc segmentation results.

[0010] Furthermore, the CrossFormer layer includes four consecutive CrossFormer modules, wherein the first and third CrossFormer modules include a cross-scale embedding layer and a short-distance attention CrossFormer block, and the second and fourth CrossFormer modules include a cross-scale embedding layer and a long-distance attention CrossFormer block.

[0011] Furthermore, the short-distance attention CrossFormer block contains layer normalization, short attention module, dynamic position bias module DPB and multi-layer perceptron module, which can be expressed as:

[0012]

[0013] The long-distance attention CrossFormer block contains layer normalization, long attention module, dynamic position bias module DPB and multi-layer perceptron module, which is expressed as:

[0014]

[0015] Where: Z s represents the output of the short-range attention CrossFormer block, z s-1 represents the input of the short-range attention CrossFormer block; Z l represents the output of the long-distance attention CrossFormer block, z l-1 represents the input of the long-distance attention CrossFormer block; LN() represents layer normalization, SDA DPB () represents the short-distance attention module after DPB, LDA DPB () represents the long-distance attention module after DPB, and MLP() represents the multi-layer perceptron module.

[0016] Furthermore, the cross-scale embedding layer in the first CrossFormer block uses four convolution kernels with kernel sizes of 4×4, 8×8, 16×16 and 32×32 to merge the input images in blocks, and the cross-scale embedding layers in the other three CrossFormer blocks use two convolution kernels with kernel sizes of 2×2 and 4×4 to merge the input images in blocks.

[0017] Furthermore, the ASPP detection head consists of a global pooling, an ASPP module, a feature fusion and a classifier connected in sequence.

[0018] Furthermore, the composite loss function is:

[0019] L total =mL CE +nL Dice

[0020] Among them: m and n are weighting coefficients, L CE is the cross entropy loss function, L Dice for Dice loss;

[0021] L Dice Specifically:

[0022]

[0023] Where: X represents the sum of the intersection of the predicted value and the true value; Y represents the sum of the union of the predicted value and the true value; A i represents the predicted value, B i is the true value, c represents the smoothing coefficient;

[0024] L CE Specifically:

[0025]

[0026] Where: N is the total number of pixels in the image; C is the number of classification categories; y i,c ∈{0, 1} indicates whether pixel i belongs to category c; p i,c is the model’s predicted probability that pixel i belongs to category c.

[0027] Furthermore, the weighted coefficient m of the composite loss function is 1, and the weighted coefficient n is 0.5.

[0028] The present invention also provides a fundus image optic cup and optic disc segmentation device based on an improved U-net, comprising:

[0029] An acquisition module, used to acquire a fundus image dataset;

[0030] The network building module is used to build an improved U-net network; add a CrossFormer layer between the last layer of the encoder and the decoding structure; embed the ASPP detection head at the end of the decoder; and construct a composite loss function that combines Dice Loss and Cross Entropy Loss.

[0031] A training module, configured to train an improved U-net network using the fundus image dataset;

[0032] The segmentation module is used to input the fundus image to be segmented into the trained improved U-net network for segmentation to obtain the optic cup and optic disc segmentation results.

[0033] Beneficial effects of the present invention:

[0034] 1) The present invention adds a CrossFormer to the encoder. By establishing global dependencies between pixels in the horizontal and vertical directions, it better combines global information to capture long-distance features, thereby improving the model's ability to resist vascular interference and maintaining the integrity of the optic cup and optic disc segmentation boundary.

[0035] 2) The present invention introduces the ASPP detection head at the end of the decoder, and captures multi-level contextual feature information through multi-dimensional dilated convolution, thereby obtaining the multi-scale characteristics of the optic cup and optic disc, thereby improving the segmentation accuracy of the optic cup, optic disc and their irregular boundaries.

[0036] 3) The present invention also proposes a new composite loss function, which enhances the constraint on small target gradients, thereby improving the model's attention to the optic cup area, while taking into account the background and optic disc segmentation performance and local optic cup fine processing, thereby improving the overall segmentation accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 This is a diagram of the overall network structure of the fundus image optic cup and optic disc segmentation method based on the improved U-net in an embodiment of the present invention.

[0038] Figure 2 Schematic diagram of the LDA structure of the fundus image optic cup and optic disc segmentation method based on the improved U-net in an embodiment of the present invention.

[0039] Figure 3 Schematic diagram of the SDA structure of the fundus image optic cup and optic disc segmentation method based on the improved U-net in an embodiment of the present invention.

[0040] Figure 4 Schematic diagram of the DPB structure of the fundus image optic cup and optic disc segmentation method based on the improved U-net in an embodiment of the present invention.

[0041] Figure 5Schematic diagram of the ASPP module structure of the fundus image optic cup and optic disc segmentation method based on the improved U-net according to an embodiment of the present invention.

[0042] Figure 6 This is the optic cup and optic disc segmentation result of the fundus image optic cup and optic disc segmentation method based on the improved U-net in an embodiment of the present invention. DETAILED DESCRIPTION

[0043] The specific implementation methods of the present invention are described in detail below with reference to the accompanying drawings and preferred embodiments. It should be understood that these embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention.

[0044] like Figure 1 As shown, the present invention provides a method for segmenting the optic cup and disc of fundus images based on an improved U-net, and the specific steps include:

[0045] S101: Acquire a fundus image dataset.

[0046] The embodiment of the present invention uses the PAPILA, DRISHTI-GS, ORIGA and REFUGE datasets.

[0047] The PAPILA dataset contains retinal images of both eyes for each patient, along with segmentation annotations of the optic cup and optic disc. The dataset comprises 1,200 color fundus images, demonstrating its diversity and high resolution, encompassing individuals of varying ages and health conditions.

[0048] The DRISHTI-GS dataset was developed to support glaucoma detection and optic nerve head segmentation research. The dataset contains 101 fundus images from different patients with detailed manual annotations of optic disc and optic cup segmentation.

[0049] The ORIGA dataset is an online fundus image database specifically designed for glaucoma research. It contains 650 fundus images, 168 of which are from patients diagnosed with glaucoma, and the remainder are normal images. Each image includes segmented annotations of the optic disc and optic cup regions, along with diagnostic information related to glaucoma.

[0050] The REFUGE dataset is a publicly available fundus image database focused on glaucoma detection and optic disc and cup segmentation. The images were collected at the Zhongshan Eye Center of Sun Yat-sen University in China and cover patients with normal retinal function, glaucoma, and other fundus pathologies. It contains 1,200 color fundus images from a variety of devices and individuals.

[0051] S102. Build an improved U-net network; add a CrossFormer layer between the last layer of the encoder and the decoding structure; embed the ASPP detection head at the end of the decoder; and build a composite loss function that combines Dice Loss and Cross Entropy Loss.

[0052] (1) CrossFormer is added to the encoder to better combine global information to capture long-distance features by establishing global dependencies between pixels in the horizontal and vertical directions.

[0053] like Figure 1 As shown in Figure 2, the CrossFormer layer contains 4 consecutive CrossFormer modules, where the first and third CrossFormer modules include sequentially connected cross-scale embedding layers and short-distance attention CrossFormer blocks, and the second and fourth CrossFormer modules include sequentially connected cross-scale embedding layers and long-distance attention CrossFormer blocks.

[0054] The short-distance attention CrossFormer block contains layer normalization, short-distance attention module, dynamic position bias module DPB and multi-layer perceptron module, such as Figure 2 As shown, it is expressed as:

[0055]

[0056] The long-distance attention CrossFormer block contains layer normalization, long-distance attention module, dynamic position bias module DPB and multi-layer perceptron module, such as Figure 3 As shown, it is expressed as:

[0057]

[0058] Where: Z s represents the output of the short-range attention CrossFormer block, z s-1 represents the input of the short-range attention CrossFormer block; Z l represents the output of the long-distance attention CrossFormer block, z l-1 represents the input of the long-distance attention CrossFormer block; LN() represents layer normalization, SDA DPB () represents the short-distance attention module after DPB, LDA DPB () represents the long-distance attention module after DPB, and MLP() represents the multi-layer perceptron module.

[0059] LDA is used to obtain local features, SDA is used to obtain global features; DPB is used to dynamically generate relative position deviations of embeddings.

[0060] The Long-Range Attention CrossFormer process is as follows: First, layer normalization is performed on the feature maps. Second, the result is passed through LDA, which fuses and embeds feature maps of different scales, reducing irrelevant computations and thus lowering computational complexity. LDA takes an S×S embedding as input, where the embeddings are sampled at a fixed interval I. By grouping the embeddings, LDA can capture global or long-range dependencies. After grouping, the embeddings within each group undergo standard self-attention. LDA is well-suited for handling large-scale attention relationships. Then, DPB is applied to LDA, which dynamically generates relative positional biases between the embeddings to ensure the effective fusion of features at different scales. Finally, the features are passed through layer normalization and an MLP. The MLP, typically consisting of two fully connected layers and an activation function, further abstracts the features after attention, improving the model's ability to model complex patterns.

[0061] The processing of the short-distance attention CrossFormer is as follows: First, the feature map is layer-normalized. Second, the result of the operation is passed through SDA, which groups all adjacent G×G embeddings together. The advantage of this method is that it can put adjacent embeddings together, reducing computational complexity while retaining local context information. SDA is suitable for processing attention relationships in a smaller range. Then, DPB acts on SDA, which can dynamically generate relative position deviations of embeddings to ensure the effectiveness of fusion of features at different scales. Finally, the features are passed through layer normalization and MLP. MLP is usually composed of two fully connected layers and an activation function, which can further abstract the features after attention and improve the model's ability to model complex patterns.

[0062] like Figure 4 As shown in the figure, the basic idea of DPB is:

[0063] First, the relative position D between embeddings is represented by adding a bias term to the calculation of self-attention.

[0064]

[0065] Among them, Q, K, V are query, key, and value matrices respectively, f is the dimension of embedding, and A is the relative position deviation matrix.

[0066] Then, the relative position coordinates (Δx ij , Δy ij ), output a scalar A through nonlinear transformation ij , indicating the relative position relationship between the two embeddings.

[0067] Ai,j =DPB(Δx ij , Δy ij )

[0068] The cross-scale embedding layer in the first CrossFormer block uses four convolution kernels with kernel sizes of 4×4, 8×8, 16×16 and 32×32 to merge the input images into blocks. The cross-scale embedding layers in the other three CrossFormer blocks use two convolution kernels with kernel sizes of 2×2 and 4×4 to merge the input images into blocks.

[0069] (2) The ASPP detection head is introduced at the end of the decoder to capture multi-level context feature information through multi-dimensional dilated convolution, thereby obtaining the multi-scale characteristics of the optic cup and optic disc, specifically:

[0070] like Figure 1 As shown in , the decoder consists of a sequentially connected convolution block, pooling layer, and ASPP detection head. The ASPP detection head consists of a sequentially connected global pooling, ASPP module, feature fusion, and classifier. The ASPP module is part of the ASPP detection head, as shown in Figure 5 As shown in Figure 2, it is responsible for extracting specific multi-scale features. The ASPP detection head further processes the features obtained by the ASPP module to generate the final segmentation result.

[0071] The processing process is:

[0072] First, a parallel dilated convolution consisting of one 1x1 convolution and three 3x3 convolutions is applied to the feature map extracted by the base deep convolutional neural network (DCNN). The sampling rate of each convolution is different. When the output stride is 16, the three 3x3 convolutions have rates = (6, 12, 18).

[0073] Secondly, the feature map of the last layer is globally average pooled and passed into a 1x1 convolution, and bilinear interpolation is used to restore it to the original image size. This solves the problem of local feature loss caused by the excessive rate of ASPP, thereby increasing the model's acquisition of local and global information.

[0074] Then, the features of all branches are concat, and then integrated using 1x1 conv+BN.

[0075] Finally, the feature map generates the final classification logits through 1×1 convolution, thereby completing the segmentation of the optic cup and optic disc.

[0076] (3) Using a new composite loss function, by strengthening the constraint on small target gradients, the model's attention to the optic cup area is improved, while taking into account the background and optic disc segmentation performance and the fine processing of the local optic cup, thereby improving the overall segmentation accuracy. Specifically:

[0077] First, Dice Loss is introduced. The predicted value is set to A and the actual value is set to B. The size of the intersection and union of the predicted value and the actual value directly determines the Dice Loss, which can be expressed as:

[0078]

[0079] Where: X represents the sum of the intersection of the predicted value and the true value. Y represents the sum of the union of the predicted value and the true value. i Indicates the predicted value. B i is the true value. c is the smoothing coefficient that approaches 0.

[0080] Secondly, Cross Entropy Loss is introduced. By calculating the difference between the predicted probability distribution and the true label pixel by pixel, the degree of classification error is quantified to achieve accurate classification of global pixels. It uses the logarithmic function to enhance the penalty for incorrect predictions, so that the model tends to output high-confidence predictions that are closer to the true label during training. Assuming there are C categories, the predicted probability distribution of each pixel i in the input image is p i =[p i,1 , p i,2 ,…,p i,C ], the true label is one-hot encoded y i =[y i,1 ,y i,2 ,…,y i,C ], its mathematical expression is:

[0081]

[0082] Where: N is the total number of pixels in the image. C is the number of classification categories (usually 3 in cup-disc segmentation: background, disc, cup). i,c ∈{0, 1} indicates whether pixel i belongs to category c. i,c is the model’s predicted probability that pixel i belongs to category c.

[0083] Finally, the Cross Entropy Loss and Dice Loss are weighted to obtain a new loss function, which is calculated as follows:

[0084] L total =mL CE +nL Dice

[0085] Where m and n are parameters. When m is 1 and n is 0.5, segmentation accuracy is highest. This improvement not only accurately classifies pixels globally using cross entropy, but also enhances the ability to optimize small objects and blurred boundaries through Dice Loss, thereby improving segmentation accuracy of the optic cup and optic disc regions.

[0086] The improved U-net network was trained and verified using the fundus image dataset.

[0087] Example 1

[0088] The experimental materials and equipment, parameter settings, and evaluation indicators of this embodiment are as follows:

[0089] 1) Experimental materials and equipment

[0090] The experiment uses PAPILADataset as the training dataset, and DRISHTI-GS, ORIGA and REFUGEDatasets as the test datasets. The experiment is implemented based on the deep learning framework PyTorch, and the experimental platform configuration is as follows: using an Intel Core i5-13500 computer processor with 128GB of running memory; using an independent graphics card Nvidia RTX4090; using Cuda12.1 and Cudnn8.9.7 to accelerate GPU computing; using Python packages such as Numpy for data processing; and using the Matplotlib library to complete segmentation result visualization and other operations.

[0091] 2) Parameter settings

[0092] The model training parameters are set as follows: Batch size is set to 1; Epoch is set to 20,000 times; the initial learning rate is set to 0.001, and the learning rate is reduced to 0.0001 after 100 epochs; the Adam optimizer is used to optimize the model parameters. The weight decay in the optimizer is set to 10 -9 .

[0093] 3) Evaluation indicators

[0094] Each model was tested 10 times, and Intersection over Union (IoU), Dice, and Accuracy (ACC) were used to evaluate the model segmentation performance. mIoU, mDice, and mAC represent the average values of IoU, Dice, and ACC, respectively, for the 10 experiments. The computational cost of the model was evaluated using the time T required to process each photo. TP represents the intersection of the true lesion and the predicted lesion area, FP represents the intersection of the true normal and the predicted lesion area, TN represents the intersection of the true normal and the predicted normal area, and FN represents the intersection of the true lesion and the predicted normal area. The specific calculation formula is as follows:

[0095]

[0096]

[0097] 4) Result evaluation

[0098] Tables 1-3 compare the segmentation performance of U-net and the improved method on various datasets, where T represents the processing time per image. "↑" and "↓" indicate that larger and smaller values indicate better model performance, respectively. Tables 1-3 show that the improved algorithm improves mIoU, mDice, and mACC by 9.96% / 2.75% / 4.54%, 2.65% / 2.94% / 5.31%, and 5.89% / 5.57% / 4.21% on the DRISHTI-GS, ORIGA, and REFUGE datasets, respectively. Experimental results demonstrate that the new model enhances attention to long-range dependent features while refining local features of the optic cup and disc boundary, thereby improving the segmentation accuracy of blurred boundaries and the optic cup and disc, and thus enhancing overall segmentation performance.

[0099] Table 1

[0100]

[0101] Table 2

[0102]

[0103] Table 3

[0104]

[0105] Example 2

[0106] The dataset and evaluation index used are the same as those in Example 1. The model parameters are set as follows: batch size is set to 1; the number of training epochs is set to 2000 times; the initial learning rate is set to 0.001, and the learning rate is reduced to 0.0001 after 100 epochs; the Adam optimizer is used to optimize the model parameters. The weight decay in the optimizer is set to 10 -9 .

[0107] Figure 6 The following are the optic cup and optic disc segmentation results using the U-net and improved U-net algorithms on three datasets. Comparing the results on the three datasets, the U-net algorithm shows incomplete segmentation edges, disjointed segmented regions, and poor segmentation performance in areas with vascular interference. In contrast, the improved algorithm achieves more complete segmentation edges and accurately segments areas with vascular interference, highly similar to the labels.

[0108] S103 , inputting the fundus image to be segmented into the improved Unet network for segmentation to obtain an optic cup and optic disc segmentation result.

[0109] The embodiment of the present invention further provides a device for segmenting the optic cup and disc of fundus images based on an improved U-net, comprising:

[0110] An acquisition module, used to acquire a fundus image dataset;

[0111] The network building module is used to build an improved U-net network; add a CrossFormer layer between the last layer of the encoder and the decoding structure; embed the ASPP detection head at the end of the decoder; and construct a composite loss function that combines Dice Loss and Cross Entropy Loss.

[0112] A training module, configured to train an improved U-net network using the fundus image dataset;

[0113] The segmentation module is used to input the fundus image to be segmented into the trained improved U-net network for segmentation to obtain the optic cup and optic disc segmentation results.

[0114] As described above, 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 above embodiments, those skilled in the art should understand that the technical solutions described in the above embodiments can still be modified, or some of the technical features thereof can 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 method for optic cup and disc segmentation in fundus images based on improved U-net, characterized in that: The steps include: (1) Obtain fundus image dataset; (2) Construct an improved U-net network; add a CrossFormer layer between the last layer of the encoder and the decoding structure; embed the ASPP detection head at the end of the decoder; and construct a composite loss function that combines Dice Loss and Cross Entropy Loss; (3) using the fundus image dataset to train the improved U-net network; (4) Inputting the fundus image to be segmented into the trained improved U-net network for segmentation to obtain the optic cup and optic disc segmentation results.

2. The optic cup and optic disc segmentation method based on the improved U-net network according to claim 1, characterized in that: The CrossFormer layer contains 4 consecutive CrossFormer modules, where the first and third CrossFormer modules include a cross-scale embedding layer and a short-distance attention CrossFormer block, and the second and fourth CrossFormer modules include a cross-scale embedding layer and a long-distance attention CrossFormer block.

3. The optic cup and optic disc segmentation method based on the improved U-net network according to claim 2, characterized in that: The short-distance attention CrossFormer block contains layer normalization, short attention module, dynamic position bias module DPB and multi-layer perceptron module, which is expressed as: The long-distance attention CrossFormer block contains layer normalization, long attention module, dynamic position bias module DPB and multi-layer perceptron module, which is expressed as: Where: Z s represents the output of the short-range attention CrossFormer block, z s-1 represents the input of the short-range attention CrossFormer block; Z l represents the output of the long-distance attention CrossFormer block, z l-1 represents the input of the long-distance attention CrossFormer block; LN() represents layer normalization, SDA DPB () represents the short-distance attention module after DPB, LDA DPB () represents the long-distance attention module after DPB, and MLP() represents the multi-layer perceptron module.

4. The optic cup and optic disc segmentation method based on the improved U-net network according to claim 2, characterized in that: The cross-scale embedding layer in the first CrossFormer block uses four convolution kernels with kernel sizes of 4×4, 8×8, 16×16 and 32×32 to merge the input images into blocks. The cross-scale embedding layers in the other three CrossFormer blocks use two convolution kernels with kernel sizes of 2×2 and 4×4 to merge the input images into blocks.

5. The optic cup and optic disc segmentation method based on the improved U-net network according to claim 1, characterized in that: The ASPP detection head consists of a global pooling, an ASPP module, a feature fusion and a classifier connected in sequence.

6. The optic cup and optic disc segmentation method based on the improved U-net network according to claim 1, characterized in that: The composite loss function is: L total =mL CE +nL Dice Among them: m and n are weighting coefficients, L CE is the cross entropy loss function, L Dice for Dice loss; L Dice Specifically: Where: X represents the sum of the intersection of the predicted value and the true value; Y represents the sum of the union of the predicted value and the true value; A i represents the predicted value, B i is the true value, c represents the smoothing coefficient; L CE Specifically: Where: N is the total number of pixels in the image; C is the number of classification categories; y i,c ∈{0, 1} indicates whether pixel i belongs to category c; p i,c is the model’s predicted probability that pixel i belongs to category c.

7. The improved U-net-based method for optic cup and disc segmentation in fundus images according to claim 6, characterized in that: The weighted coefficient m of the composite loss function is 1, and the weighted coefficient n is 0.

5.

8. A device for segmenting optic cup and disc of fundus images based on improved U-net, characterized in that: include: An acquisition module, used to acquire a fundus image dataset; The network building module is used to build an improved U-net network; add a CrossFormer layer between the last layer of the encoder and the decoding structure; embed the ASPP detection head at the end of the decoder; and construct a composite loss function that combines Dice Loss and Cross Entropy Loss. A training module, configured to train an improved U-net network using the fundus image dataset; The segmentation module is used to input the fundus image to be segmented into the trained improved U-net network for segmentation to obtain the optic cup and optic disc segmentation results.