2D medical image segmentation method based on deep learning

Through the design of dual-branch encoder and CAF module, combined with the characteristics of CNN and Transformer, the problem of feature fusion information loss in medical image segmentation is solved, and more efficient feature fusion and segmentation performance improvement are achieved.

CN118823352APending Publication Date: 2024-10-22CHANGZHOU UNIV

Patent Information

Application Number
CN202411030316.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-10-22

AI Technical Summary

Technical Problem

Existing CNN and Transformer have the problem of information loss when merging features in medical image segmentation, resulting in the model being unable to effectively combine local and global features, affecting segmentation performance.

Method used

Using a dual-branch encoder, the CNN branch extracts local features, and the Transformer branch extracts global features, and features are fused through the designed CAF module. Multi-scale group convolution, circular attention mechanism, Hadamard product and other technologies are used to achieve effective features. Fusion.

Benefits of technology

Effectively merging the semantic information of CNN and Transformer improves the performance of medical image segmentation, reduces computational complexity, improves the receptive field and computational efficiency of the model, and achieves segmentation results that surpass advanced methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118823352A_ABST
    Figure CN118823352A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image segmentation, in particular to a 2D medical image segmentation method based on deep learning, which comprises the following steps: acquiring a medical image data set; constructing a CNN (Convolutional Neural Network) branch and a Transform branch, extracting local features by using the CNN branch, and extracting global features by using the Transform branch; constructing a CAF module, and inputting the local features and the global features into the CAF module for first feature fusion; introducing depth separable convolution into the residual block, and performing second feature fusion on the first feature fusion and a Hadamard product; fusing the second features of different levels by using up-sampling and jump connection to obtain fused image features; and performing residual connection on the first-layer image feature and the decoded third up-sampling, and obtaining a segmentation result through up-sampling. According to the method, the problem of information loss during existing CNN and Transform feature fusion is 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 image segmentation, and in particular to a 2D medical image segmentation method based on deep learning. Background Art

[0002] Medical image segmentation is a major challenge in the clinical application of medical images, and it is also a very important step. It includes a variety of tasks, such as polyp segmentation, cell segmentation, blood vessel segmentation, lesion area segmentation, etc. Manual segmentation by doctors is not only time-consuming, but also easily affected by clinical experience. Therefore, it is necessary to rely on computers for automatic medical image segmentation, and it is a good auxiliary tool for medical experts.

[0003] With the rapid development of deep learning technology, CNN network has become one of the main methods for medical image segmentation. Although CNN network has achieved great success in the field of medical image segmentation, it is quite difficult to make further breakthroughs. This is because of the inherent inductive bias of CNN network. Each convolution kernel can only focus on a sub-region of the entire image, resulting in the loss of global context and the inability to establish long-term dependencies. To solve this problem, many researchers have explored methods to alleviate the problem of limited receptive field and enhance the ability of context modeling. For example, Yu et al. proposed a convolution with adjustable expansion rate, which showed excellent performance in semantic segmentation. Peng et al. designed large kernels to capture rich global context information. Zhao et al. used pyramid pooling of multi-scale features to aggregate multi-scale global information. However, these methods cannot fundamentally solve the problem of limited receptive field.

[0004] The Transformer architecture is a model based on the self-attention mechanism, which can perform attention calculations on the input sequence at different positions and process the input sequence in parallel, thereby speeding up training. The addition of the self-attention mechanism helps to more comprehensively understand the global information in the image. Although the Transformer is good at modeling long-range dependencies, it also has the problem of insufficient local attention.

[0005] The effective fusion of global information and local information can improve the model's ability to understand images, enabling it to perform image analysis and task processing more accurately; therefore, many researchers have proposed a hybrid architecture that combines CNN and Transformer; for example, SETR uses Transformer instead of encoder, showing good results in image segmentation tasks; TransUnet's overall network architecture uses U-Net, which combines CNN and Transformer architectures; previous studies have mainly focused on replacing CNN with Transformer or combining CNN and Transformer in sequence; however, these methods have limitations in effectively combining local and global features: although combining two networks in sequence can fuse global information and local information to a certain extent, the feature information extracted by one network will inevitably suffer a lot of losses when passing through another network structure. Summary of the invention

[0006] In view of the shortcomings of the existing methods, the present invention solves the problem of information loss when the existing CNN and Transformer features are fused.

[0007] The technical solution adopted by the present invention is: a 2D medical image segmentation method based on deep learning comprises the following steps:

[0008] Step 1: Collect medical image datasets;

[0009] Step 2: Construct a CNN branch and a Transformer branch, input the medical image into the two branches, use the CNN branch to extract local features, and use the Transformer branch to extract global features;

[0010] As a preferred embodiment of the present invention, the CNN branch includes:

[0011] The medical image undergoes 7x7 convolution, BN, ReLU activation function and 3×3 maximum pooling to obtain the first layer image feature G3;

[0012] G3 passes through the first convolution layer consisting of three convolution blocks to obtain the second layer image feature G2;

[0013] G2 passes through the second convolution layer consisting of 4 convolution blocks to obtain the third layer image feature G1;

[0014] G1 passes through the third convolution layer consisting of 5 convolution blocks to obtain the fourth layer image feature G0.

[0015] As a preferred implementation of the present invention, the convolution block consists of 3×3 convolution, BN, ReLU activation function, 3×3 convolution and BN.

[0016] As a preferred embodiment of the present invention, the medical image is processed through a 16×16 convolution as an embedding map, and then through a Transformer branch of eleven attention blocks to obtain image feature T0, and then through continuous upsampling to obtain image feature T1 and image feature T2.

[0017] As a preferred embodiment of the present invention, each attention block sequentially comprises layer normalization, a multi-head attention layer, layer normalization and a multi-head perceptron.

[0018] Step 3: Construct a CAF module, and input local features and global features into the CAF module for first feature fusion;

[0019] As a preferred implementation of the present invention, the formula for the first feature fusion is:

[0020] X i =Concat(G i ,T i ) (4)

[0021]

[0022] In the formula, G i ,T i denote the image features extracted by the CNN branch and the Transformer branch, respectively; Concat(·) denotes concatenation operation, MHSA(·) denotes multi-head self-attention, Conv(·) denotes convolution operation, T CartToPolar (·) represents the operation of converting from Cartesian coordinate system to polar coordinate system, T PolarToCart (·) indicates the conversion from polar coordinates to Cartesian coordinates.

[0023] Step 4: Introduce depth-wise separable convolution in the residual block to fuse the first feature with the Hadamard product for the second feature fusion;

[0024] As a preferred implementation of the present invention, the formula for the second feature fusion is:

[0025]

[0026] Where Residual(·)=Conv 1×1 (DepthConv 3×3 (Conv 1×1 (·))), is the first feature fusion, and It is T i ,G i The projection matrix.

[0027] Step 5: Use upsampling and skip connection to fuse the second features of different levels to obtain the fused image features;

[0028] As a preferred embodiment of the present invention, the formula of the fused image features is:

[0029] M i =Conv 3×3 (Conv 1×1 (Conv 3×3 (Up i )))+Conv 3×3 (F i+1 ) (12)

[0030] Among them, F i is the output feature of CAF; Up i =Upsampling(F i ), Upsampling(·) represents the upsampling operation.

[0031] Step 6: Perform residual connection between the first layer image features and the decoded third upsampling, and then obtain the segmentation result through upsampling;

[0032] As a preferred embodiment of the present invention, a weighted loss function is used to supervise the image feature T2, the decoded third upsample Up2, and the CAF first feature F0, and the formula is:

[0033]

[0034] Among them, α, β, and γ are weights. It is a combination of weighted IoU loss and binary cross entropy.

[0035] Beneficial effects of the present invention:

[0036] 1. The present invention adopts a dual-branch encoder for feature extraction, CNN extracts local fine-grained features, and Transformer captures global context information; the designed CAF module includes a multi-scale grouped convolution (MSGC), a circular attention block, and a residual block including a residual block and a Hadamard product; using Transformer for feature fusion during fusion can effectively fuse the semantic information of the two branches at the same time, but it will increase the amount of calculation, but considering the quadratic computational complexity of Transformer relative to the input, it is not advisable to use the attention mechanism for the entire feature map, and the attention mechanism is selected to be used in some areas to alleviate the computational complexity problem brought by Transformer; although this will bring certain performance losses, the LBP operator that describes local image features is used, which has rotation invariance and grayscale invariance. The LBP operator describes features on a circular area, and the sampling area can be adjusted by adjusting the radius and the number of sampling points. The CAF fusion framework is used to imitate the LBP operator to use the attention mechanism on the circular area when performing feature fusion, and the radius and area width can be adjusted to adjust the sampling area;

[0037] 2. Different from axial or four-axis attention, the attention mechanism is used in the circular area, which can include more semantic information. By adjusting the radius and edge width of the circle, it can cover as much area as possible in the process of fusing semantic information at different levels;

[0038] 3. Use deep supervision to optimize the encoder, fusion module and decoder;

[0039] 4. A circular attention mechanism is proposed and implemented. Using attention in a circular area can effectively capture contextual information without significantly increasing the number of parameters, effectively perform modeling, and improve computational efficiency.

[0040] 5. Based on the circular attention mechanism, the proposed fusion method uses circular attention on different regions when fusing different layers, further expanding the receptive field of the model during fusion;

[0041] 6. Based on the CNN and Transformer branches, the CAF fusion framework can effectively fuse the semantic information of the two branches and improve the segmentation performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 is a flow chart of a 2D medical image segmentation method based on deep learning of the present invention;

[0043] Figure 2 It is a CNN branch structure diagram of the present invention;

[0044] Figure 3 It is a CAF module structure diagram of the present invention;

[0045] Figure 4 is the multi-scale grouped convolution of the present invention;

[0046] Figure 5 is the residual block of the present invention;

[0047] Figure 6 is a diagram of the CicularAttention structure in the CAF module of the present invention;

[0048] Figure 7 (a), (b), and (c) are schematic diagrams comparing axial attention fusion, four-axis attention fusion, and circular attention fusion, respectively;

[0049] Figure 8 This is a schematic diagram of the operation process of circular attention;

[0050] Fig. 9 (a), (b), and (c) are different circular attention fusion methods;

[0051] Fig.10 It is the Transformer branch structure diagram of the present invention. DETAILED DESCRIPTION

[0052] The present invention is further described below in conjunction with the accompanying drawings and embodiments. This figure is a simplified schematic diagram, which only illustrates the basic structure of the present invention in a schematic manner, and therefore it only shows the components related to the present invention.

[0053] like Figure 1 As shown, a 2D medical image segmentation method based on deep learning includes the following steps:

[0054] Step 1: Collect a medical image dataset, reshape the dataset into 352×352 or 384×384 images, annotate the lesion sites in the medical images, and divide the dataset into a training set and a test set;

[0055] Step 2: Construct a CNN branch and a Transformer branch, input the medical images into the two branches respectively, and obtain the feature maps of the two branches;

[0056] In order to achieve better performance, traditional CNNs usually need to build dozens or even hundreds of layers to capture semantic features. As the number of layers increases, the level of semantic features captured becomes higher and higher; however, too many layers will lead to a large amount of calculations and parameters; Figure 2As shown in the figure, the present invention uses the four shallowest convolution blocks of ResNet34 as CNN branches; in the CNN branch, the image will first undergo 7x7 convolution, BN, ReLU activation function and 3×3 maximum pooling to obtain the first layer of image features The first layer of image features G3 is passed through three convolutional layers in sequence, and the outputs of the three convolutional layers are used as three levels of image features; the three convolutional layers contain three, four, and five convolutional blocks respectively, and each convolutional block in each convolutional layer is composed of 3×3 convolution, BN, ReLU activation function, 3×3 convolution and BN in sequence, and the fourth layer of image features is obtained. The third layer image features The second layer image features Among them, C i is the number of channels of the corresponding feature map; the image features of G0, G1, and G2 are used to fuse with the image features of the Transformer branch; the output of G3 is used as a skip connection to supplement the feature loss during fusion and decoding.

[0057] like Fig.10 As shown in the figure, the Transformer branch uses DeiT for feature extraction, including a 16×16 convolution as an embedding map (patch embedding), and then contains eleven attention blocks, each of which consists of layer normalization, multi-head attention layer, layer normalization, and a multi-head perceptron. When the image is input into this branch, it will first be divided into 16×16 patches. After the image is divided into patches, they will be sent to the embedding layer to convert it into a one-dimensional sequence. in, D0 is the sequence dimension after mapping, which indicates the number of patches after division. Because the Transformer model cannot distinguish the position information of each patch in the original image after division, it is necessary to add a position encoding with the same dimension to the one-dimensional sequence e to obtain Z 0 Input Transformer encoder, which consists of L layers of multi-head self-attention and multi-layer perceptron; Transformer branch completely relies on self-attention mechanism to realize global feature extraction, and the formula of self-attention is:

[0058]

[0059] Among them, D k It is a scaling parameter used to avoid gradient explosion or disappearance; Q, K, and V are all obtained by inputting Z through the mapping matrix W qkv get:

[0060]

[0061] Multi-head self-attention uses multiple W based on self-attention. qkv Get multiple groups of Q, K, V to extract different features; after the MLP after Transformer encoding, get But at this time Z T The dimension of is inconsistent with the CNN branch, so it needs to be reshaped to obtain the Transformer first image feature Then, after continuous upsampling operations, the Transformer second image feature is obtained Transformer third image feature Finally, T0, T1, and T2 are spliced ​​and fused with G0, G1, and G2 respectively.

[0062] A two-branch encoder is used to extract image features. The two branches are good at extracting local features and global features respectively, and the encoder loads a pre-trained model for fine-tuning before training. Compared with training from scratch, the use of a pre-trained model can make full use of the prior knowledge in natural images and greatly reduce the training time.

[0063] Step 3: The two branch feature maps are fused and input into the CAF module;

[0064] like Figure 3 The CAF module (CircularAttentionFusion) shown in the figure is used to fuse the image features extracted by the two branch encoders; first, the feature map extracted by the encoder is concatenated through multi-scale convolution (MSGC) The main advantage of MSGC is that it can capture feature information at different scales simultaneously; Figure 4 As shown in the figure, the convolution kernel sizes used by MSGC are 3, 5, 7 and 9 respectively; by using convolution kernels of different sizes at the same time, MSGC can flexibly extract features of different scales, making the model more robust and effective when processing various input data; this multi-scale feature extraction capability not only enhances the representation ability of the model, but also improves the model's ability to understand complex data; in order to reduce the number of parameters, the number of output channels of each convolution kernel is one-fourth of the original input, and the outputs of the four convolution kernels are spliced ​​together to obtain an output with the same dimension as the input.

[0065] Secondly, through Figure 6 The circular attention mechanism (CicularAttention) shown in Figure 7 (a) and (b) are axial attention and four-axis attention respectively. The difference between axial attention and four-axis attention is Figure 7(c) The circular area uses the attention mechanism to include more semantic information. By adjusting the radius and edge width of the circle, it can cover as much area as possible in the process of fusing semantic information at different levels. The circular attention mechanism is first converted into a polar coordinate system through coordinate system transformation. The specific implementation of a single circular attention is as follows: Figure 8 As shown in the figure, in order to facilitate the use of the attention mechanism on the circular area, it is necessary to first arrange the points in the target area together and use polar coordinate transformation to complete this task; polar coordinate system and Cartesian coordinate system are two commonly used representation methods; polar coordinate system is a two-dimensional coordinate system, in which any position can be represented by an angle and a distance relative to the origin-pole; while Cartesian coordinate system is composed of two mutually perpendicular number lines intersecting at the origin, and the coordinates of any point in the plane are set according to the coordinates of the corresponding point on the number axis; let point P be P in the Cartesian coordinate system. (x,y) , in polar coordinate system is P (ρ,θ) , then it satisfies:

[0066]

[0067] Generally speaking, images are represented by Cartesian coordinates, which can be converted to polar coordinates as follows Figure 8 As shown on the left, the circular area is expanded into a rectangular area to facilitate the use of the attention mechanism; after calculating the attention of the target area, the inverse transformation is used to convert the image back to the Cartesian coordinate system for the next step of processing; when implementing the coordinate system transformation, since the transformation matrix of the fixed-size feature map is always consistent, the model calculates the incremental step size of the angle and radius based on the parameters; loops through each polar coordinate point, calculates the coordinate result through the polar coordinate transformation formula, and finally obtains the transformation operator corresponding to the current input size through the coordinate calculation transformation matrix; this operator remains unchanged after the calculation is completed, rather than being recalculated each time; similarly, the inverse operator is also obtained through coordinate transformation to obtain the inverse transformation operator corresponding to the current input size.

[0068] Secondly, a specific area is selected as the target area according to the parameters, and then the multi-head attention mechanism is calculated. After completion, it will be restored to the feature map of the corresponding size according to the inverse transformation of the coordinate system, and then it will be connected through a residual connection, a 3×3 convolution, and then a residual connection to obtain the output of the entire CAF, that is, the first feature fusion is obtained The fusion process is as follows:

[0069] X i =Concat(G i ,T i ) (4)

[0070]

[0071]

[0072] In the formula, G i ,T i denote the image features extracted by the CNN branch and the Transformer branch, respectively, i = 0, 1, 2; Concat(·) denotes the concatenation operation, MHSA(·) denotes multi-head self-attention, Conv i×i (·) indicates the convolution operation using the convolution kernel size i, T CartToPolar (·) represents the operation of converting from Cartesian coordinate system to polar coordinate system, T PolarToCart (·) indicates the conversion from polar coordinate system to Cartesian coordinate system, R i is the output after calculating the attention, is the output of the circular attention block, i.e., the first feature fusion.

[0073] Using the attention mechanism in a specific circular area instead of the entire image can significantly reduce the number of model parameters and computational complexity, while ensuring that important features are fully focused during fusion.

[0074] Step 4: The residual block is the last step of the fusion module. The residual block of this model has two inputs, which are the output of the CAF module and T i With C i Hadamard product H i , H i It can be expressed as:

[0075]

[0076] in, represents the Hadamard multiplication operator, and It is T i ,G i The projection matrix of , i = 0, 1, 2.

[0077] In addition, in order to reduce the computational complexity of the residual block, depthwise separable convolution is introduced, such as Figure 5 As shown, the residual block as a whole can be expressed as:

[0078]

[0079] Among them, F i is the output feature of CAF, and we get the first feature F0 of CAF, the second feature F1 of CAF and the third feature F2 of CAF; Residual(·) can be expanded as:

[0080] Residual(·)=Conv 1×1 (DepthConv3×3 (Conv 1×1 (·))) (10)

[0081] The decoder not only includes upsampling, but also uses hybrid convolution and skip connections to fuse image features at different levels. Hybrid convolution combines features from two levels, which can be expressed as:

[0082] Up i =Upsampling(F i ) (11)

[0083] The first decoding up-sampling Up0, the second decoding up-sampling Up1, and the third decoding up-sampling Up2 are obtained respectively.

[0084] The fused image features M i It can contain more potentially effective image features to make the segmentation result more accurate. The formula is:

[0085] M i =Conv 3×3 (Conv 1×1 (Conv 3×3 (Up i )))+Conv 3×3 (F i+1 ) (12)

[0086] Among them, F i is the output of the CAF module, Upsampling(·) represents the upsampling operation, M i is the output of the mixed convolution.

[0087] Step 6. After two mixed convolutions and then upsampling, some of the lowest-level semantic information will be lost. Therefore, the first-layer image feature G3 of CNN and the second upsampling Up2 are used for residual connection to make up for these omissions, and finally the segmentation result is obtained by upsampling; the residual connection can use element-level addition.

[0088] Finally, the weighted loss function is used to optimize the model. The calculation formula is as follows:

[0089]

[0090] In the formula, G is the true value, and the weights used in the model are α = 0.6, β = 0.3, γ = 0.1, It is a combination of weighted IoU loss and binary cross entropy, and the formula is as follows:

[0091]

[0092] Use deep supervision to optimize the model. Specifically, supervise the output T2 of the Transformer branch, the feature Up2 in decoding, and the output F0 of CAF to optimize the model.

[0093] Experimental process:

[0094] First, the performance of the proposed model is evaluated on intestinal polyp datasets, including five public endoscopy datasets: Kvasir, CVC-ClinicDB (ClinicDB), CVC-ColonDB (ColonDB), EndoScene, and ETIS datasets. First, comparative experiments are performed on the Kvasir and CVC-ClinicDB independent datasets. When performing independent verification on Kvasir, the images are resized to 352×352, and on CVC-ClinicDB, they are resized to 384×384. Then, in order to verify the generalization ability of the model for intestinal polyp segmentation tasks, the PraNe t approach, a total of 1450 images from the Kvasir and ClinicDB datasets were selected as the training set (Kvasir: 900, ClinicDB: 550), and then tested on five different test sets, each containing 798 images (Kvasir: 100, ClinicDB: 62, ColonDB: 380, EndoScene: 60, ETIS: 196); for the generalization ability test, all images were resized to 352×352; in addition, it was also tested on the skin disease dataset (ISIC2018), and the image input was resized to 384×384 for skin disease segmentation.

[0095] In order to verify the effectiveness of the model of the present invention, the model is evaluated from the following indicators: mean Dice (mDice), mean IoU (mIoU), precision and recall.

[0096] The CAF module is built using the PyTorch framework and trained on an NVIDIA RTX 3090 GPU for 100 epochs with a batch size of 16 and a learning rate of 1e -4 The Adam optimizer uses a learning rate decay strategy; both branches of the present invention use pre-trained models, the CNN branch uses ResNet34, and the Transformer branch uses 12-layer DeiT, and each layer of multi-head attention contains 16 heads.

[0097] Table 1: KvasirDataSet experimental results

[0098]

[0099] Table 2: Experimental results of CVC-ClinicDB DataSet

[0100]

[0101]

[0102] Table 3: Experimental results on the generalization ability of intestinal polyp segmentation task

[0103]

[0104] Table 4: Experimental results of ISIC-2018 DataSe, the results marked with * are reproduced by us using the released source code

[0105]

[0106]

[0107] The performance of the proposed model was evaluated on two separate intestinal polyp datasets and compared with the most advanced methods to verify its effectiveness. It was then tested on a mixed dataset of intestinal polyp segmentation tasks to verify the generalization ability of the proposed method. In order to evaluate the contribution of each component in the fusion framework, an ablation experiment was performed on the proposed model.

[0108] First, the performance of CAFuse on the Kavsir dataset is evaluated, as shown in Table 1; the model of the present invention is better than the SOTA method DS-TransUNet, and the mDice, mIoU, Recall and Precision of CAFuse are 0.934, 0.888, 0.940 and 0.937, which are improved by 1.7%, 2%, 0.4% and 0.21% respectively compared with DS-TransUNet.

[0109] Secondly, the performance of CAFuse on CVC-ClinicDB was evaluated, as shown in Table 2. Due to the current optimal method FAFuse, the indicators of CAFuse of the proposed model are 0.956, 0.917, 0.959, and 0.956, respectively. It is slightly inferior to 0.959 of DoubleU-Net in Precision, and the other aspects are improved by 0.6%, 1%, and 0.8% respectively compared with FAFuse.

[0110] Secondly, in order to verify the generalization ability of the model in the intestinal polyp segmentation task, an evaluation was performed on a mixed dataset, as shown in Table 3. It can be seen that when the validation set is images from Kvasir, the average Dice and average IoU of CAF are 1.1% and 1.6% lower than those of DS-TransUNet, respectively. However, when the validation set is other data, the model of the present invention has achieved SOTA performance, so the overall average Dice and IoU are still higher than those of DS-TransUNet.

[0111] Secondly, the performance of the model was verified on the skin disease dataset, as shown in Table 4. Compared with the optimal method FAFuse, the model of the present invention improved Dice by 0.4% and IoU by 1.4%, with almost the same recall rate, and Precision was inferior to DoubleU-Net.

[0112] The effectiveness of individual components in CAF was verified on the CVC-ClinicDB Dataset, as shown in Table 5. The study was conducted by gradually adding CAF modules to the same backbone. As can be seen from Table 5, MSGC increased mDice by 0.3%, indicating that MSGC can help the model obtain multi-scale information when the model is fused. The circular attention block increased mDice by 1.1%, which means that circular attention plays an important role in the fusion process and can help the model to fuse global and local features. The residual block increased mDice by 0.2%, which also shows that the addition of Hadamard product and convolution also plays a role in the fusion of semantic features. The complete CAF increased mDice by 1.6% compared with the fusion using Concatenate, indicating that CAF can well combine the advantages of CNN and Transformer to obtain more accurate segmentation results.

[0113] Table 5: Ablation studies

[0114]

[0115] The radius and width of each circular attention in the three CAF modules can be set individually, which are the main hyperparameters adjusted in the model.

[0116] Table 6: Hyperparameter experiments for R and W

[0117]

[0118]

[0119] like Fig. 9 The schematic diagram of the fusion method and the comparison of hyper parameters in Table 6 are shown in Figure 6. Fig. 9 (a) shows that the attention area can retain as much information as possible. Fig. 9 (b) and (b) are two other ways to implement circular attention. The present invention adopts Fig. 9 (a), it can be seen that splitting a circular area into three layers for calculation will not increase the amount of calculation too much; the radius and width of each layer of attention in the circular attention are ablated; as shown in Table 6, when the input image is 384×384, the sizes of the feature maps in the three layers are 24×24, 48×48, and 96×96 respectively (if it is 352×352, they are 22×22, 44×44, and 88×88 respectively); experiments are conducted on CVC-ClinicDB. As shown in Table 6, when the radius exceeds the range of the feature map, the exceeding part will be filled with 0 (black) after the coordinate transformation, and will be erased during the inverse transformation, so it will not affect the attention calculation.

[0120] As shown in Tables 7 and 8, the number of parameters of the fusion method of the present invention is significantly less than the number of parameters for modifying the circular attention to the global attention; the circular area is set to an area approximately equal to the size of the entire feature map, so as to estimate the parameters and calculation amount of the full-image attention; due to the 24G video memory limitation of RTX 3090, the parameter amount of self-attention is obtained when BatchSize is 1, while the parameter amount of circular attention is obtained when BatchSize is 16.

[0121] Table 7: Parameter comparison of 384×384 global attention and circular attention

[0122]

[0123] Table 8: Parameter comparison of 352×352 global attention and circular attention

[0124]

[0125] The present invention proposes a fusion framework CAFuse for intestinal polyp segmentation, which has achieved SOTA performance indicators on two intestinal polyp datasets and a mixed dataset. CAFuse performs segmentation by fusing the semantic information of two branches, and is a feasible solution for medical image segmentation, especially the intestinal polyp task. Experiments show that CAFuse can effectively fuse local information from CNN and global information from Transformer.

[0126] Based on the above ideal embodiments of the present invention, the relevant staff can make various changes and modifications without departing from the technical concept of the present invention through the above description. The technical scope of the present invention is not limited to the contents of the specification, and its technical scope must be determined according to the scope of the claims.

Claims

1. A 2D medical image segmentation method based on deep learning, characterized in that: The following steps are involved: Step 1: Collect medical image datasets; Step 2: Construct a CNN branch and a Transformer branch, input the medical image into the two branches, use the CNN branch to extract local features, and use the Transformer branch to extract global features; Step 3: Construct a CAF module and input local features and global features into the CAF block for first feature fusion; Step 4: Introduce depth-wise separable convolution in the residual block to fuse the first feature with the Hadamard product for the second feature fusion; Step 5: Use upsampling and skip connection to fuse the second features of different levels to obtain the fused image features; Step 6: Perform a residual connection between the first layer image features and the decoded third upsampling, and then obtain the segmentation result through upsampling.

2. The 2D medical image segmentation method based on deep learning according to claim 1, characterized in that: CNN branches include: The medical image undergoes 7x7 convolution, BN, ReLU activation function and 3×3 maximum pooling to obtain the first layer image feature G3; G3 passes through the first convolution layer consisting of 3 convolution blocks to obtain the second layer image feature G2; G2 passes through the second convolution layer consisting of 4 convolution blocks to obtain the third layer image feature G1; G1 passes through the third convolution layer consisting of 5 convolution blocks to obtain the fourth layer image feature G2.

3. The 2D medical image segmentation method based on deep learning according to claim 2, characterized in that: The convolution block consists of 3×3 convolution, BN, ReLU activation function, 3×3 convolution and BN.

4. The 2D medical image segmentation method based on deep learning according to claim 1, characterized in that: The medical image undergoes a 16×16 convolution as an embedding map, and then passes through the Transformer branch of eleven attention blocks to obtain image feature T0, and then undergoes continuous upsampling to obtain image feature T1 and image feature T2.

5. The 2D medical image segmentation method based on deep learning according to claim 4, characterized in that: Each attention block consists of layer normalization, a multi-head attention layer, layer normalization, and a multi-head perceptron.

6. The 2D medical image segmentation method based on deep learning according to claim 1, characterized in that: The formula for the first feature fusion is: X i =Concat(G i ,T i ) (4) In the formula, G i ,T i denote the image features extracted by the CNN branch and the Transformer branch, respectively; Concat(·) denotes concatenation operation, MHSA(·) denotes multi-head self-attention, Conv(·) denotes convolution operation, T CarToPolar (·) represents the operation of converting from Cartesian coordinate system to polar coordinate system, T PolarToCart (·) indicates the conversion from polar coordinates to Cartesian coordinates.

7. The 2D medical image segmentation method based on deep learning according to claim 6, characterized in that: The formula for the second feature fusion is: Where Residual(·)=Conv 1×1 (DepthCOnv 3×3 (Conv 1×1 (·))), is the first feature fusion, and It is T i ,G i The projection matrix.

8. The 2D medical image segmentation method based on deep learning according to claim 7, characterized in that: The formula of the fused image features is: M i =Conv 3×3 (Conv 1×1 (Conv 3×3 (Up i )))+Conv 3×3 (F i+1 ) (12) Among them, F i is the output feature of CAF; Up i =Upsampling(F i ), Upsampling(·) represents the upsampling operation.

9. The 2D medical image segmentation method based on deep learning according to claim 4 or 8, characterized in that: The weighted loss function is used to supervise the Transformer's image feature T2, the third upsample Up2 of the decoder, and the first feature F0 of CAF. The formula is: Among them, α, β, and γ are weights. It is a combination of weighted IoU loss and binary cross entropy.

10. A 2D medical image segmentation system based on deep learning, characterized in that: include: a memory for storing instructions executable by a processor; A processor, configured to execute instructions to implement the deep learning-based 2D medical image segmentation method as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Medical image segmentation method based on multi-scale cross-layer attention fusion network

    CN117152433A

  • Medical image segmentation system and method fusing MLP branch and CNN branch

    CN118154875A

Cited By

  • Unmanned aerial vehicle small target detection method, deep learning network model, system and readable storage medium

    CN120409558A