Optic disc and optic cup segmentation method based on Transformer and CNN
By using Transformer and CNN-based methods in optic disc and optic cup segmentation, combined with hierarchical convolution fusion and multi-scale channel cross-fusion modules, the problems of unclear boundaries and noise interference in image segmentation are solved, significantly improving segmentation accuracy and Stability, achieving better optic disc and optic cup segmentation effects.
Patent Information
- Application Number
- CN202410924224.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-07-11
AI Technical Summary
In the field of medical image segmentation, especially in the process of optic disc and optic cup segmentation, there are problems such as unclear boundaries, impact on image quality and resolution, noise interference, etc., resulting in low accuracy of segmentation results, and it is difficult for traditional methods to effectively handle fundus structures. Complexity and changing lighting conditions.
The optic disc and optic cup segmentation method based on Transformer and CNN is adopted, using TransUnet as the backbone network, combined with the hierarchical convolution fusion module and the multi-scale channel cross-fusion module, to improve the model's understanding of the global information of the image and its multi-scale feature fusion capabilities, and improve segmentation Accuracy and robustness of results.
By combining the Transformer and CNN models, the accuracy and stability of the segmentation of the optic disc and optic cup are significantly improved, the multi-scale information fusion ability of the image is enhanced, the problem of insufficient feature fusion in the segmentation task of the traditional method is solved, and more results are achieved. Good segmentation effect.
Smart Images

Figure CN118470330B
Abstract
Description
Technical Field
[0001] The present invention relates to a medical image segmentation method, in particular to an optic disc and optic cup segmentation method based on Transformer and CNN, belonging to the technical field of deep learning. Background Art
[0002] Glaucoma is a serious eye disease that can lead to vision loss or even blindness if not treated promptly. When treating glaucoma in the early stages, segmenting the optic disc and optic cup is a crucial step. The optic disc is the starting point of the optic nerve fibers and is the most common site of glaucoma. Damage to it may lead to optic nerve damage and vision loss. The optic cup is a depression in the optic disc. Glaucoma patients often experience an enlarged optic cup, which is one of the important indicators for early diagnosis of glaucoma. Therefore, accurate segmentation of the optic disc and optic cup is crucial.
[0003] There may be some challenges in the process of segmenting the optic disc and optic cup. First, the boundaries of the optic disc and optic cup are not always clearly visible, especially when the patient's fundus structure is not regular or there is bleeding. This may lead to difficulties in accurately identifying and segmenting these structures. Secondly, the segmentation process may also be affected by image quality, resolution, and fundus structure. Therefore, image processing and data enhancement techniques are needed to enhance the clarity and contrast of the image in order to more accurately identify and segment these structures. Finally, since the optic disc and optic cup have certain changes in morphology and color, there may be noise and interference, which will increase the complexity of the segmentation algorithm. In addition, since the fundus image may be affected by factors such as lighting conditions and patient eye movement, it is necessary to design a new method for segmenting the optic disc and optic cup to solve the problem of low accuracy of the segmentation results.
[0004] In the field of medical image segmentation, convolutional neural networks and Transformers each have their own advantages. Therefore, in the task of optic disc and optic cup segmentation, effectively combining the two can achieve better results. First, convolutional neural networks, with their advantages in spatial data processing, can effectively extract local features and capture texture information in images. Secondly, based on its self-attention mechanism, Transformer can effectively capture the global dependencies between different regions in the entire fundus image. This enables Transformer to better understand the structure and association between the optic disc and the optic cup, and improves the accuracy and stability of the segmentation task. Therefore, the present invention will use Transformer and CNN models to perform the task of optic disc and optic cup segmentation, using TransUnet as the backbone network, using the combination of CNN and Transformer as the encoder, and UNet's decoder as the decoder of the network. By training the network model, the model weights are obtained, and the optic disc and optic cup are accurately segmented. This method can effectively solve a series of challenges faced in the process of segmenting the optic disc and optic cup. Summary of the invention
[0005] In order to achieve accurate segmentation of the optic disc and the optic cup, the present invention proposes a optic disc and optic cup segmentation method based on Transformer and CNN. The technical solution provided by the present invention is:
[0006] A method for segmenting optic disc and optic cup based on Transformer and CNN, comprising the following steps:
[0007] S1. Obtain image data to be segmented;
[0008] S2. Inputting the image data into the trained optic disc and optic cup segmentation model based on Transformer and CNN, wherein the backbone network of the optic disc and optic cup segmentation model based on Transformer and CNN is a TransUNet network, and the TransUNet network includes an encoder CNN module, an encoder Transformer module and a decoder module;
[0009] S3. Obtain optic disc and optic cup segmentation results according to the image data and the optic disc and optic cup segmentation model based on Transformer and CNN.
[0010] Furthermore, the training process of the optic disc and optic cup segmentation model based on Transformer and CNN includes the following steps:
[0011] S2-1. Obtain the optic disc and optic cup dataset;
[0012] S2-2. The optic disc and cup data set image is input into the encoder CNN module to obtain a local feature map of the image;
[0013] S2-3. Inputting the local feature map of the image into the encoder Transformer module to obtain an encoded feature representation;
[0014] S2-4. Input the encoded feature representation into the decoder module to obtain the optic disc and optic cup segmentation results.
[0015] Furthermore, the optic disc and optic cup datasets in step S2-1 are three public optic disc and optic cup datasets, namely RIM-ONE-v3, REFUGE and DRISHTI-GS datasets.
[0016] Furthermore, the encoder CNN module in step S2-2 adopts a hierarchical convolution fusion module to replace the traditional convolution in the CNN layer;
[0017] The method of inputting the concentrated image of the optic disc and optic cup data into the encoder CNN module to obtain the local feature map of the image specifically includes: firstly, the original feature map received by the encoder CNN module x It is passed into a depth-separable convolution with a convolution kernel size of 1×1 for convolution, and the original feature map is x The convolution kernels are respectively passed into the depth-wise separable convolution with sizes of 3×3 and 5×5 to obtain the feature maps processed by the three convolution kernels, and then the feature maps processed by the three convolution kernels are added to obtain the added feature map. X 1. Then add the feature map X 1 are respectively passed into the depth-wise separable convolution of size 1×1 and 3×3 for convolution, and the obtained feature maps are added together to obtain the feature map X 2. Finally, the feature map X 2 is passed into a 1×1 depth-separable convolution for convolution and combined with the original feature map through a 1×1 depth-separable convolution x Add to get the local features of the image X 3. The specific operation formula of the hierarchical convolution fusion module is as follows:
[0018] (1)
[0019] (2)
[0020] (3)
[0021] in, DW Denotes a depth-wise separable convolution operation. The subscripts 1, 3, and 5 indicate the size of the convolution kernel. Conv Represents a 1×1 normal convolution operation.
[0022] Furthermore, the step S2-3 specifically includes:
[0023] The local features of the image X 3 The input is divided into small blocks in the encoder Transformer module, and then a fixed position code is assigned to each small block. Then, self-attention calculation and feature interaction are performed on the position code and the feature vector corresponding to each small block to obtain the encoded feature representation of each small block.
[0024] Furthermore, in the decoder of step S2-4, a multi-scale channel cross-fusion module is used to replace the traditional skip connection in the TransUNet network, and the operations in the multi-scale channel cross-fusion module specifically include:
[0025] The multi-scale channel cross-fusion module divides the feature maps output by the encoder and decoder into four parts according to the channel. The feature maps output by each layer of the encoder are m1, m2, m3, and m4, and the feature maps output by each layer of the decoder are n1, n2, n3, and n4. The feature maps output by the decoder and the feature maps output by the encoder are fused in pairs, and then the fused feature maps are passed into the dilated convolution with dilation factors of 1, 2, 5, and 7 respectively. The feature maps after the dilated convolution are spliced by channel to obtain the spliced feature maps. O ,The specific operation formula of the multi-scale channel cross fusion module is as follows:
[0026] (4)
[0027] (5)
[0028] (6)
[0029] (7)
[0030] Among them, m represents the output of each layer of the decoder, F d represents the output features of the decoder, n represents the output of each layer of the encoder, and F e represents the output features of the encoder, w represents the feature map after cross-connecting m and n, O represents the final output of the module, concat represents the channel concatenation operation, D represents the dilated convolution operation, and 1, 2, 5, and 7 represent the dilation factors.
[0031] Furthermore, all the traditional convolutions in the backbone network TransUNet in step S2 are replaced by the hierarchical convolution fusion module.
[0032] The advantages of the present invention are:
[0033] The present invention introduces TransUnet as a backbone network and optimizes the network. By replacing all traditional convolutions in the TransUnet network with the hierarchical convolution fusion module proposed by the present invention, the model's ability to understand the global information of the image in the optic disc and cup segmentation task is improved, and the fusion ability of multi-scale information is enhanced; secondly, the present invention proposes a multi-scale channel cross-fusion module, which is applied to the jump connection part of the TransUnet network, solving the problem of insufficient fusion of different scale features in the segmentation task of the model, thereby improving the accuracy and robustness of the segmentation result. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention.
[0035] Figure 1 It is a schematic diagram of the structural framework of the overall network of the present invention.
[0036] Figure 2 It is a schematic diagram of the structural framework of the hierarchical convolutional fusion module of the present invention.
[0037] Figure 3 Schematic diagram of the structural framework of the multi-scale channel cross-fusion module of the present invention.
[0038] Figure 4 This is a comparison diagram of the present invention and other advanced methods. DETAILED DESCRIPTION
[0039] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0040] The disclosed embodiment provides a method for segmenting the optic disc and optic cup based on Transformer and CNN.
[0041] like Figure 1 As shown, a method for segmenting the optic disc and optic cup based on Transformer and CNN includes the following steps:
[0042] S1. Obtain image data to be segmented;
[0043] S2. Input the image data into the trained Transformer and CNN-based optic disc and optic cup segmentation model, wherein the backbone network of the Transformer and CNN-based optic disc and optic cup segmentation model is a TransUNet network, and the TransUNet network includes an encoder CNN module, an encoder Transformer module, and a decoder module;
[0044] S3. Obtain the optic disc and optic cup segmentation results based on the image data and the optic disc and optic cup segmentation model based on Transformer and CNN.
[0045] In this embodiment, the training process of the optic disc and optic cup segmentation model based on Transformer and CNN includes the following steps:
[0046] S2-1. Obtain the optic disc and optic cup dataset;
[0047] S2-2. Input the concentrated images of the optic disc and optic cup data set into the encoder CNN module to obtain a local feature map of the image;
[0048] S2-3. Input the local feature map of the image into the encoder Transformer module to obtain the encoded feature representation;
[0049] S2-4. Input the encoded feature representation into the decoder module to obtain the optic disc and optic cup segmentation results.
[0050] In this embodiment, the optic disc and optic cup datasets obtained in step S2-1 are three public optic disc and optic cup datasets, namely RIM-ONE-v3, REFUGE and DRISHTI-GS datasets;
[0051] like Figure 2 As shown, in this embodiment, the encoder CNN in step S2-2 uses a hierarchical convolution fusion module to replace the traditional convolution in the CNN layer;
[0052] In this embodiment, step S2-2 obtains the local feature map of the image by inputting the concentrated image of the optic disc and optic cup data into the encoder CNN module, specifically comprising: firstly, the original feature map received by the encoder CNN module x It is passed into a depth-separable convolution with a convolution kernel size of 1×1 for convolution, and the original feature map is x The convolution kernels are respectively passed into the depth-wise separable convolution with sizes of 3×3 and 5×5 to obtain the feature maps processed by the three convolution kernels, and then the feature maps processed by the three convolution kernels are added to obtain the added feature map. X 1. Then add the feature map X1 are respectively passed into the depth-wise separable convolution of size 1×1 and 3×3 for convolution, and the obtained feature maps are added together to obtain the feature map X 2. Finally, the feature map X 2 is passed into a 1×1 depth-separable convolution for convolution and combined with the original feature map through a 1×1 depth-separable convolution x Add to get the local features of the image X 3. The specific operation formula of the hierarchical convolution fusion module is as follows:
[0053] (1)
[0054] (2)
[0055] (3)
[0056] in, DW Denotes a depth-wise separable convolution operation. The subscripts 1, 3, and 5 indicate the size of the convolution kernel. Conv Represents a 1×1 normal convolution operation.
[0057] In this embodiment, step S2-3 specifically includes:
[0058] The local features of the image X 3 The input is divided into small blocks in the encoder Transformer module, and then a fixed position code is assigned to each small block. Then, self-attention calculation and feature interaction are performed on the position code and the feature vector corresponding to each small block to obtain the encoded feature representation of each small block.
[0059] like Figure 3 As shown, in this embodiment, a multi-scale channel cross-fusion module is used in the decoder of step S2-4 to replace the traditional skip connection in the TransUNet network. The operations in the multi-scale channel cross-fusion module specifically include:
[0060] The multi-scale channel cross-fusion module divides the feature maps output by the encoder and decoder into four parts according to the channel. The feature maps output by each layer of the encoder are m1, m2, m3, and m4, and the feature maps output by each layer of the decoder are n1, n2, n3, and n4. The feature maps output by the decoder and the feature maps output by the encoder are fused in pairs, and then the fused feature maps are passed into the dilated convolution with dilation factors of 1, 2, 5, and 7 respectively. The feature maps after the dilated convolution are spliced by channel to obtain the spliced feature maps. O ,The specific operation formula of the multi-scale channel cross fusion module is as follows:
[0061] (4)
[0062] (5)
[0063] (6)
[0064] (7)
[0065] Where m represents the output of each layer of the decoder, F d represents the output features of the decoder, n represents the output of each layer of the encoder, and F e represents the output features of the encoder, w represents the feature map after cross-connecting m and n, O represents the final output of the module, concat represents the channel concatenation operation, D represents the dilated convolution operation, and 1, 2, 5, and 7 represent the dilation factors.
[0066] In this embodiment, all traditional convolutions in the backbone network TransUNet in step S2 are replaced by hierarchical convolution fusion modules.
[0067] like Figure 4 As shown, in this embodiment, Figure 4 This is the experimental comparison result between the method of the present invention and segmentation methods such as U-Net, AttU-Net and TransUNet on the data set obtained by the present invention. In the figure, the first column is the initial image input, the second column is the true value of the image segmentation, the last column is the segmentation result of the method of the present invention, and the other columns are the segmentation results of other prior art methods. Compared with the segmentation results of other prior art methods, the segmentation result of the method of the present invention is closest to the true value and has the best segmentation effect.
[0068] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for segmenting optic disc and optic cup based on Transformer and CNN, characterized in that: The following steps are involved: S1. Obtain image data to be segmented; S2. Inputting the image data into the trained optic disc and optic cup segmentation model based on Transformer and CNN, wherein the backbone network of the optic disc and optic cup segmentation model based on Transformer and CNN is a TransUNet network, and the TransUNet network includes an encoder CNN module, an encoder Transformer module and a decoder module; S3. Obtain the optic disc and optic cup segmentation results according to the image data and the optic disc and optic cup segmentation model based on Transformer and CNN; The training process of the optic disc and optic cup segmentation model based on Transformer and CNN includes the following steps: S2-1. Obtain the optic disc and optic cup dataset; S2-2. The optic disc and cup data set image is input to the encoder CNN module to obtain a local feature map of the image; The method of inputting the concentrated image of the optic disc and optic cup data into the encoder CNN module to obtain the local feature map of the image specifically includes: firstly, the original feature map received by the encoder CNN module x It is passed into a depth-separable convolution with a convolution kernel size of 1×1 for convolution, and the original feature map is x The convolution kernels are respectively passed into the depth-wise separable convolution with sizes of 3×3 and 5×5 to obtain the feature maps processed by the three convolution kernels, and then the feature maps processed by the three convolution kernels are added to obtain the added feature map. X 1. Then add the feature map X 1 are respectively passed into the depth-wise separable convolution of size 1×1 and 3×3 for convolution, and the obtained feature maps are added together to obtain the feature map X 2. Finally, the feature map X 2 is passed into a 1×1 depth-separable convolution for convolution and combined with the original feature map through a 1×1 depth-separable convolution x Add to get the local features of the image X 3. The specific operation formula of the hierarchical convolution fusion module is as follows: (1) (2) (3) in, DW Denotes a depth-wise separable convolution operation. The subscripts 1, 3, and 5 indicate the size of the convolution kernel. Conv Represents a 1×1 ordinary convolution operation; S2-3. Inputting the local feature map of the image into the encoder Transformer module to obtain an encoded feature representation; S2-4. The encoded feature representation is input to the decoder module to obtain the optic disc and optic cup segmentation results; The decoder adopts a multi-scale channel cross-fusion module to replace the traditional jump connection in the TransUNet network. The operations in the multi-scale channel cross-fusion module specifically include: the multi-scale channel cross-fusion module divides the feature maps output by the encoder and the decoder into four parts according to the channel, wherein the feature maps output by each layer of the encoder are m1, m2, m3, and m4, respectively, and the feature maps output by each layer of the decoder are n1, n2, n3, and n4, respectively. The feature maps output by the decoder and the feature maps output by the encoder are fused in pairs, and then the fused feature maps are respectively passed into the dilated convolution with dilation factors of 1, 2, 5, and 7, and the feature maps after the dilation convolution are w Splice by channel to get the spliced feature map O , the specific operation formula of the multi-scale channel cross fusion module is as follows: (4) (5) (6) (7) Where m represents the output of each layer of the decoder, F d represents the output features of the decoder, n represents the output of each layer of the encoder, and F e represents the output features of the encoder, w represents the feature map after cross-connecting m and n, O represents the final output of the module, concat represents the channel concatenation operation, D represents the dilated convolution operation, and 1, 2, 5, and 7 represent the dilation factors.
2. The optic disc and optic cup segmentation method based on Transformer and CNN according to claim 1, characterized in that: The optic disc and optic cup datasets in step S2-1 are three public optic disc and optic cup datasets, namely RIM-ONE-v3, REFUGE and DRISHTI-GS datasets.
3. The optic disc and optic cup segmentation method based on Transformer and CNN according to claim 1, characterized in that: The step S2-3 specifically includes: The local features of the image X 3 The input is divided into small blocks in the encoder Transformer module, and then a fixed position code is assigned to each small block. Then, self-attention calculation and feature interaction are performed on the position code and the feature vector corresponding to each small block to obtain the encoded feature representation of each small block.
4. The optic disc and optic cup segmentation method based on Transformer and CNN according to claim 1, characterized in that: All traditional convolutions in the backbone network TransUNet in step S2 are replaced by the hierarchical convolution fusion module.
