Medical image segmentation method and device based on window and axial attention fusion

By introducing the window and axial attention mechanism into the medical image segmentation model, combined with the block shuffling operation, the problem of insufficient feature interaction of the traditional model in large-size, high-resolution image processing is solved, and the performance of medical image segmentation is significantly improved. and accuracy.

CN118537565BActive Publication Date: 2024-10-18JIANGXI NORMAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411010934.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-26
Publication Date
2024-10-18
Estimated Expiration
2044-07-26

AI Technical Summary

Technical Problem

When traditional medical image segmentation models process large-size, high-resolution images, it is difficult to effectively capture the long-distance dependencies of image features, resulting in a lack of detailed features and a large span of global modeling, which affects the segmentation performance of the model.

Method used

A medical image segmentation model based on window and axial attention is adopted. By constructing a segmentation network including an encoder, WASA module and decoder, the window attention layer, axial attention layer and block shuffling layer are used to achieve local and global Effective interaction and fusion of features, calculating combined loss and updating model parameters.

Benefits of technology

Significantly improves the performance of 2D medical image segmentation, reaching state-of-the-art results, showing excellent performance in tasks such as automatic cardiac diagnosis, polyp segmentation, and retinal blood vessel segmentation, effectively suppressing noise and retaining key features.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118537565B_ABST
    Figure CN118537565B_ABST
Patent Text Reader

Abstract

The present invention relates to image processing technology, and in particular to a medical image segmentation method and device based on window and axial attention fusion. A segmentation network including an encoder, a WASA module and a decoder is constructed to segment medical images. The WASA module combines the advantages of fast local representation learning in window attention and the global modeling characteristics in axial attention, and introduces a block shuffling strategy to shuffle block areas in a feature map to achieve more efficient global-local spatial interaction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to image processing technology, and in particular to a medical image segmentation method and device based on window and axial attention fusion. Background Art

[0002] Medical image segmentation models based on traditional convolutional neural networks play a vital role in clinical diagnosis, but these medical image segmentation models are easily limited by the size of the convolution kernel receptive field, which makes them unable to capture the long-distance dependencies of image features well.

[0003] Medical image segmentation models based on the Transformer architecture have shown great potential in medical image segmentation due to their ability to efficiently capture global features. However, when processing large-scale, high-resolution medical images, the traditional global self-attention mechanism still has problems such as missing detailed features and large global modeling span; in the process of global feature extraction, the Transformer module may cause the ambiguity of local context information, thereby affecting the segmentation performance of the model. Summary of the invention

[0004] Based on this, the present invention provides a medical image segmentation method and device based on window and axial attention fusion, which at least solves one problem in the prior art.

[0005] In a first aspect, the present invention provides a medical image segmentation model training method based on window and axial attention fusion, which comprises the following steps:

[0006] Constructing a segmentation network including an encoder, a WASA module and a decoder, wherein the WASA module includes a window attention layer, an axial attention layer and a block shuffle layer;

[0007] The segmentation network is trained using a training set containing medical images, wherein in the window attention layer, the feature map of the medical image is segmented into a plurality of non-overlapping local windows, and self-attention is used for each local window to perform local feature interaction; in the axial attention layer, self-attention is applied to the width axis and the height axis of the feature map of the medical image respectively to achieve global feature interaction; in the block shuffle layer, the feature map output by the window attention layer and the axial attention layer is divided into blocks, and a block shuffle operation is performed;

[0008] A combined loss of the segmentation network is calculated, and parameters of the segmentation network are updated according to the combined loss.

[0009] In some optional embodiments, the encoder is PVTv2.

[0010] In some optional embodiments, in the window attention layer, the feature map of the medical image is segmented into n non-overlapping local windows, and use self-attention to interact local features for each of the local windows. The specific process is shown in equations (1) to (3);

[0011]

[0012] in, F Represents the feature map of medical images, , H , W and C Represent the height, width and channel of the feature map respectively; Indicates p A local window; , g Indicates the side length of the local window; Split Indicates block operation. LN Representation layer normalization, MHSA Indicates long self-attention, and represents the learnable parameters, MLP Represents a multilayer perceptron with GeLU activation function.

[0013] In some optional embodiments, in the axial attention layer, self-attention is used to perform global feature interaction on the width axis and height axis of the feature map of the medical image, respectively. The specific process is shown in equations (4) and (5).

[0014]

[0015] in,

[0016] In formula (4), , , , ; , and They represent the learnable parameters, ;

[0017] In formula (5), , , , ; , and They represent the learnable parameters, ;

[0018] h and wRepresent the row and column numbers of the feature map respectively; and They represent the number of channels of the input feature map and the number of channels of the output feature map respectively.

[0019] In some optional embodiments, the medical image segmentation model training method based on window and axial attention fusion further includes the following steps: performing a 1×1 convolution operation on the output features of the axial attention layer, performing a restoration operation on the output features of the window attention layer, and performing fusion output, as shown in formula (6);

[0020]

[0021] in, Conv represents the convolution operation, Merge Indicates a restore operation. x Represents the fusion output result.

[0022] In some optional embodiments, the block shuffling operation includes the following steps: for each shuffling, first take out the odd rows from the rows composed of blocks, and then take out the even rows to obtain a new row arrangement; first take out the odd columns from the columns composed of blocks, and then take out the even columns to obtain a new column arrangement.

[0023] In some optional embodiments, the decoder includes a decoding module and an upsampling layer. In the decoding module, the fusion output result x The maximum pooling and average pooling are fused in a 1:1 ratio, and the feature map is refined using spatial attention. The maximum value is selected in each channel and the average value is calculated. The feature map is output through the convolution layer, as shown in equations (7) to (9);

[0024]

[0025] in, represents the channel attention module, represents the spatial attention module, represents the Sigmod activation function, represents the ReLU activation function, maxpool (·) represents maximum pooling, avgpool (·) represents average pooling, represents the convolutional layer, represents the maximum value in each channel, represents the average value in each channel;

[0026] In the upsampling layer, the features are enlarged so that the resolution of the feature map is restored to the original size, as shown in formula (11);

[0027]

[0028] in, TransConv represents transposed convolution, Upsampling (·) indicates upsampling.

[0029] In some optional embodiments, It consists of two 3 × 3 convolutional layers, two batch normalization layers and two ReLU activation functions, as shown in formula (10):

[0030]

[0031] in, represents a 3 × 3 convolutional block, represents the batch normalization operation, Represents the ReLU activation function.

[0032] In some optional embodiments, the combined loss of the segmentation network is calculated according to equation (12) and equation (13);

[0033]

[0034] in, represents the combined loss of the segmentation network, Indicates m The loss of the encoding stage, M represents the number of encoder stages, Indicates m The cross entropy loss of the encoding stage, Indicates m Dice loss in the encoding stage, represents the weight hyperparameter.

[0035] In a second aspect, the present invention provides a medical image segmentation model training device, comprising:

[0036] at least one processor;

[0037] and a memory communicatively coupled to the at least one processor;

[0038] Wherein, the memory stores instructions, which, when executed by the at least one processor, implement the medical image segmentation model training method based on window and axial attention fusion.

[0039] In a third aspect, the present invention provides a medical image segmentation method, which comprises the following steps: inputting a medical image into a medical image segmentation model obtained by the medical image segmentation model training method based on window and axial attention fusion, and outputting a target image by the medical image segmentation model.

[0040] In a fourth aspect, the present invention provides a medical image segmentation device, comprising:

[0041] at least one processor;

[0042] and a memory communicatively coupled to the at least one processor;

[0043] The memory stores instructions, which implement the medical image segmentation method when executed by the at least one processor.

[0044] Due to the adoption of the above technical solution, the embodiments of the present invention have at least the following beneficial effects:

[0045] (1) A WASA module is designed, which first uses window attention and axis attention to obtain local and global features, and then effectively fuses local and global features through block shuffling operations, promoting effective information interaction between windows and axes;

[0046] (2) A dual-attention based decoding module is designed, which enables the segmentation network to effectively suppress the noise level in the feature map while retaining key features and highlighting the main information;

[0047] (3) The segmentation network including the encoder, WASA module and decoder can significantly improve the performance of 2D medical image segmentation. When compared with multiple advanced networks, the network achieves state-of-the-art (SOTA) results on different task datasets such as the Automatic Cardiac Diagnosis Challenge (ACDC), polyp segmentation, and retinal vessel segmentation. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 Schematic diagram of the overall structure of an image segmentation network in one embodiment of the present invention.

[0049] Figure 2 The figure is a schematic diagram of the principle of a WASA module in one embodiment of the present invention.

[0050] Figure 3 Shown are window attention, axial attention, and attention span in window axial attention in one embodiment of the present invention.

[0051] Figure 4 The figure is a schematic diagram of a block shuffling operation flow in one embodiment of the present invention.

[0052] Figure 5 The figure is a schematic diagram of the structure of a decoder in one embodiment of the present invention.

[0053] Figure 6 The segmentation results of four image segmentation networks on five datasets are shown.

[0054] Figure 7 The segmentation results of ParNet and ParNet+WASA methods on five polyp databases are shown.

[0055] Figure 8 The segmentation results of PolypPVT and PolypPVT+WASA methods on five polyp databases are shown.

[0056] Fig. 9 The segmentation results of DuAT and DuAT+WASA methods on five polyp databases are shown. DETAILED DESCRIPTION

[0057] The following is a clear and complete description of the concept of the present invention and the technical effects produced, so as to fully explain the purpose, scheme and effect of the present invention.

[0058] Figure 1 The overall structure of the image segmentation network in one embodiment of the present invention is shown. For ease of representation, the image segmentation network is represented by WASFANet. WASFANet includes an encoder, a window axial shuffle attention module (WASA module) and a decoder. The image to be segmented is processed by the encoder, and the encoder generates multi-level features. The WASA module obtains the local attention information and axial global attention information of the multi-level features in parallel, and promotes local-global interaction and diffuses the attention under the action of the permutation operation, which helps to enhance the multi-scale processing capability of the network model. Afterwards, the multi-level features enter the decoder and generate the final output.

[0059] Among them, the encoder can be PVTv2 trained on ImageNet. As a pyramid-type Transformer encoder, PVTv2 ensures the generalization ability and multi-scale feature processing ability required in the field of medical image segmentation. At the same time, it uses convolution operations instead of the patch embedding module of the traditional Transformer to capture spatial information, and supports input of any resolution size. In addition, PVTv2 uses a spatial reduction method to reduce the self-attention operation of quadratic complexity to linear complexity, which meets the requirements of large-resolution input of medical images. Therefore, PVTv2 is used as a model encoder to extract rich multi-scale features. PVTv2 includes an overlapping block embedding module and an encoding module, which is a prior art and will not be repeated here.

[0060] The principle of WASA module is as follows Figure 2As shown, local correlation and global dependency of feature maps are achieved by stacking N layers of axial attention layers, window attention layers, and block shuffle layers. In this embodiment, N is equal to 3, the window size is 8×8 pixels, and the block size is 8×8 pixels. The window attention layer performs self-attention within the window to capture local correlations between features, while the axial attention layer globally focuses on pixels in a sparse uniform grid covered across the entire 2D space to capture global features. Therefore, the combination of the two helps to capture the features of the image more comprehensively. The block shuffle operation is introduced to effectively mix local and global features. This operation not only increases the depth of the model's understanding of the features, but also promotes effective information interaction between windows and axes.

[0061] use represents the input feature map (feature map), where H , W and C Respectively represent the height, width and channel of the feature map. In this embodiment, the height and width of the feature map are equal, that is, H = W In the window attention layer, the input feature map is first split into n non-overlapping local windows, where , g is the side length of the local window. Then, self-attention is used to interact local features for each local window. The specific process is shown in equations (1) to (3):

[0062]

[0063] in, Split Indicates block operation. Indicates p A local window, LN Representation layer normalization, MHSA Indicates long self-attention, and represents the learnable parameters, MLP Represents a multilayer perceptron with GeLU activation function.

[0064] In the axial attention layer, axial attention is applied on the width axis, as shown in formula (4):

[0065]

[0066] in, H and W represents the height and width of the feature map, , , , , the projection matrix represents the learnable parameters, and They represent the number of channels of the input feature map and the number of channels of the output feature map respectively.

[0067] Similarly, axial attention is applied to the height axis, as shown in formula (5):

[0068]

[0069] in, , , , , the projection matrix represents learnable parameters.

[0070] By combining the axial attention on the width axis and the height axis, a computationally efficient self-attention model is obtained, which achieves a wider range of attention than local window attention at a low cost. In this way, it not only optimizes the application of the attention mechanism in different dimensions, but also improves the overall performance and efficiency of the model. The model can focus on key information more accurately while maintaining a full understanding of the overall structure.

[0071] In order to further promote long-distance interaction, the strategy of global and local information aggregation is adopted to merge the output of the window and axial attention layers. This strategy helps to enhance the information exchange and collaboration of different spaces, thereby improving the learning and expression capabilities of the entire model. First, the output features of the different window attention layers are restored and the output features of the axial attention layer are subjected to a 1×1 convolution operation. Then, the two are fused and output as shown in Equation (6):

[0072]

[0073] in, Conv represents the convolution operation, Merge represents the restoration operation (recombining the split multiple windows in the order of their original positions to restore the complete original feature map), x Represents the fusion output result.

[0074] Window attention focuses on the current window information, while axis attention focuses on the width and height axis information of the current position. Focusing attention between windows and between axes, global information propagation is achieved by performing local window attention and axis attention, such as Figure 3 shown.

[0075] In the block shuffle layer, the block-based shuffle unit sets the size of each block to g ×g, the feature map of the output of the previous layer window attention and axial attention and As the feature map of the current input. First, the feature map is divided according to the size of the block, such as Figure 4 As shown in (a) in the figure. The transformation strategy for each shuffle is to take out the odd rows first, then take out the even rows, and get the new row arrangement r1, r3, r5, r7, r2, r4, r6, r8; perform similar operations on the columns, complete a shuffle operation, and get the new column arrangement c1, c3, c5, c7, c2, c4, c6, c8, as shown in Figure 4 As shown in (b). Then, the new feature map is obtained to perform window attention and axial attention respectively. After each shuffle, the window attention and axial attention can receive information from other regions, thereby promoting the mutual exchange of local and global feature information. Due to its characteristics, the block shuffle operation can restore the position information of the feature map to its original state after a certain number of shuffles. Therefore, this periodic shuffling form ensures the integrity of the feature position information. At the same time, this unique dynamic design can promote information exchange between windows and on different axes, enhance the model's capture of cross-window interactive features and alleviate the spatial dependence of long-distance modeling, thereby significantly improving the model's feature processing capabilities.

[0076] The decoder adopts a four-layer decoder framework as its baseline structure. Each layer of the decoder part consists of two key blocks: a decoding module and an upsampling layer, such as Figure 5 As shown in Figure 2. Four decoding modules and upsampling layers are used to combine the pyramid features of the four stages of the decoder backbone. The decoder uses channel and spatial attention to retain complex details during segmentation, which can overcome the problem of losing some local information during upsampling and reduce the impact of pooling operations on spatial information. Finally, in order to aggregate multi-scale features, the output of each encoder layer is aggregated to generate the final segmentation map.

[0077] In the decoder, the decoding module first fuses the maximum pooling and average pooling in a 1:1 ratio, achieving a better balance between retaining key features, highlighting important information, and suppressing noise in the feature map. Then, the feature map is refined using spatial attention, the maximum value is selected in each channel to highlight the most significant features, and the average value is calculated to depict the overall background information. Finally, the feature map is output through the convolution layer. The specific process is shown in Equations (7) to (9):

[0078]

[0079] in, x represents the fusion output result, represents the channel attention module, represents the spatial attention module, is the Sigmod activation function, ReLU activation function. maxpool(·) represents maximum pooling, avgpool (·) represents average pooling, represents the maximum value in each channel, represents the average value in each channel; is a convolutional layer, which consists of two 3 × 3 convolutional layers, two batch normalization layers and two ReLU activation functions; as shown in formula (10):

[0080]

[0081] in, represents a 3 × 3 convolutional block, represents the batch normalization operation, Represents the ReLU activation function.

[0082] The function of the upsampling layer is to gradually amplify the features of the current layer and gradually restore the resolution of the feature map to its original size. The upsampling layer consists of a transposed convolution layer and a convolution module, which realizes the amplification and processing of features, as shown in formula (11):

[0083]

[0084] in, TransConv represents transposed convolution, Upsampling (·) indicates upsampling.

[0085] Cross entropy loss and Dice loss are used as segmentation losses, which quantify the difference between the true label and the model prediction, and have advantages in dealing with imbalanced categories and preserving boundary details. Multiple levels of segmentation losses are used to guide the learning of the model. Therefore, the combined loss is the sum of the segmentation losses output by the four stages of the decoder and is defined as follows:

[0086]

[0087] in, Indicates m The loss of the encoding stage, M represents the number of encoder stages, Indicates m The cross entropy loss of the encoding stage, Indicates m Dice loss in the encoding stage, represents the weight hyperparameter. In this embodiment, M Set to 4, Set to 0.5.

[0088] In order to evaluate the image segmentation performance of WASFANet, it is compared with the current state-of-the-art image segmentation techniques and a series of ablation experiments are conducted.

[0089] The experiment used three medical image datasets for different tasks: heart, polyp, and fundus retina, namely the Automatic Heart Diagnosis Challenge (ACDC) dataset, the Polyp dataset, and the Fundus dataset.

[0090] Among them, the ACDC dataset contains a collection of cardiac magnetic resonance imaging (MRI) scans of 100 different patients, each imaging scan covers three major cardiac structures: right ventricle (RV), left ventricle (LV) and myocardium (Myo). The experiment uses 70 cases in the dataset (a total of 1930 axial slices) for model training, 10 cases for validation, and the remaining 20 cases for testing.

[0091] The Polyp dataset contains five public datasets for colon polyp segmentation, namely CVC-ClinicDB, Kvasir, EndoScene, ColonDB, and ETIS-LaribDB. CVC-ClinicDB contains 612 images extracted from 31 colonoscopy videos. Kvasir contains 1,000 polyp images collected from polyps in the Kvasir-SEG dataset. According to the settings in PraNet, 1,450 images were selected from CVC-ClinicDB and Kvasir-SEG as training sets, and the remaining 64 and 100 images were used as validation sets and test sets respectively. In addition, in order to evaluate the generalization performance, tests were performed on three datasets, EndoScene, ColonDB, and ETIS-LaribDB. EndoScene, ColonDB, and ETIS LaribDB contain 60, 380, and 196 images, respectively; these three test sets were collected from different medical centers and are not involved in the training of the model.

[0092] The Fundus dataset includes three datasets: CHASE_DB1, DRIVE, and STARE. The CHASE_DB1 dataset contains 28 color retinal images and expert-labeled retinal vascular segmentation results, and the image size is 999×960 pixels. In the experiment, 20 images are used for model training, and 8 images are used for model testing. The DRIVE dataset is widely used in the field of retinal vascular segmentation. The dataset consists of 40 color retinal images, each with a size of 584×565 pixels, and provides manually labeled retinal segmentation results. For model training and testing, the dataset is divided in a 1:1 ratio, and the training set and test set are both 20 images. The STARE dataset contains 20 color retinal images from 10 different patients' eyes, each with a size of 700×605 pixels. 15 of the images are selected for model training, and the remaining 5 images are used for testing.

[0093] For the heart image segmentation task, the Dice score is used as the evaluation indicator of the ACDC dataset. For the polyp image segmentation task, Dice and mIoU are used as evaluation indicators. For the retinal image vascular image segmentation task, sensitivity (S e ), specificity (S p )、Accuracy( )and The score is used as an evaluation indicator.

[0094] Where mIoU represents the average IoU of all images to be segmented. IoU is used to measure the overlap between the predicted segmentation result and the true segmentation target, as shown in formula (14):

[0095]

[0096] The Dice score is a commonly used evaluation metric to measure the similarity between the predicted segmentation result and the true segmentation target, as shown in Equation (15). It provides a score from 0 to 1, where 1 indicates a perfect match and 0 indicates no match at all.

[0097]

[0098] S e Also known as the true positive rate or recall rate, it measures the model's ability to identify positive samples and can predict whether the target is correctly classified, as shown in formula (16):

[0099]

[0100] S p Measures the model's ability to correctly identify negative category samples, as shown in formula (17):

[0101]

[0102] is the percentage of evaluating the overall classification accuracy of the model in the segmentation task, as shown in formula (18):

[0103]

[0104] It is a comprehensive indicator for evaluating the performance of the classification model. It combines the precision and recall of the model, thereby integrating the accuracy and completeness of the classification results, as shown in formula (19).

[0105]

[0106] AUC (area under curve) is the area under the ROC curve. It is believed that the larger the curve area, the better the model effect. The characteristic of AUC is that it is not affected by the ratio of positive and negative samples. The ROC curve is drawn based on the true positive rate (TPR) and false positive rate (FPR) of the model under different threshold conditions. TPR and FPR are shown in formulas (20) and (21).

[0107]

[0108] Among them, TP is true positive, which means the foreground pixel is predicted correctly; FP is false positive, which means the background pixel is predicted incorrectly; FN is false negative, which means the foreground pixel is predicted incorrectly; TN is true negative, which means the background pixel is predicted correctly.

[0109] Table 1 shows the Dice and mIoU results of different image segmentation networks on five polyp segmentation datasets. It can be seen that WASFANet achieves an average Dice score of 93.38% and 95.21% on the Kvasir and ClinicDB datasets, respectively, significantly outperforming all other methods. In particular, in the EndoScene, ColonDB, and ETIS-LaribDB test sets, WASFANet outperforms existing medical segmentation baselines in all indicators, which also verifies that WASFANet has better generalization ability.

[0110] Table 1 Dice and mIoU results of different image segmentation networks on five polyp segmentation datasets

[0111]

[0112] like Figure 6 As shown in the figure, WASFANet can better depict the boundaries and shapes of polyps compared with PraNet, PolybPVT and DuAT, thanks to its powerful global-local feature capture capability.

[0113] Table 2 shows the average Dice scores of WASFANet and other SOTA methods. It can be seen that in terms of single organ segmentation, WASFANet achieved better results than other image segmentation networks in terms of myocardium and right ventricle, with Dice scores of 90.33% and 95.84% respectively; MISSFormer achieved the best segmentation result in left ventricle segmentation, with a Dice score of 89.55%. However, in terms of overall segmentation accuracy, WASFANet still achieved the best segmentation accuracy, with a Dice score of 91.88%.

[0114] Table 2 Average Dice scores of different image segmentation networks

[0115]

[0116] Table 3 lists the results of retinal vascular image segmentation of different image segmentation networks on DRIVE, CHASE DB1 and STARE datasets. It can be seen that on the CHASE_DB1 dataset, WASFANet outperforms other compared image segmentation networks in all indicators; in the DRIVE and STARE datasets, WASFANet outperforms other compared image segmentation networks in all indicators. e , , AUC, and Dice indicators are better than other image segmentation networks. p The indicators are slightly lower than MC-Unet.

[0117] Table 3 Retinal vascular image segmentation results of different image segmentation networks

[0118]

[0119] Ablation studies are performed to test the role of each component of the WASA module. In order to verify the versatility of the module, it is introduced into other hierarchical visual models (such as PraNet, DuAT, Polyp-PVT) to verify the performance of medical image segmentation.

[0120] The combination of window attention and axial attention allows for sparse global interactions with relatively low complexity, enabling the model to obtain efficient and effective global context modeling at all stages. An ablation study is performed on the polyp dataset to evaluate the effectiveness of the attention component of the WASA module. First, PVTv2b2 pre-trained on ImageNet is used as the backbone network, and the same polyp dataset experimental settings are used in all experiments. Then, four ablation experiments are performed to analyze their gains: 1) removing the axial and window attention layers at each stage; 2) removing the window attention layer at each stage; 3) removing the axial attention layer at each stage; 4) retaining the window and axial attention layers at each stage. As shown in Table 4, both the window attention layer and the axial attention layer significantly help improve the performance.

[0121] Table 4 Ablation experimental results of window and axial attention layers on five polyp data

[0122]

[0123] The effects of different variants of block shuffling operations on the performance of the image segmentation network are compared by changing the block size and the number of iterations. The results are shown in Table 5. From the results in the table, it can be observed that the number of block shuffling operations contributes to the final performance, which is reasonable because multiple iterations help to obtain more efficient context features. The larger the block size, the better the performance, which may be attributed to the fact that larger blocks can cover more areas and increase the amount of interactive information. However, when the block size is equal to the window size, the window attention cannot obtain more context information through the block shuffling operation, resulting in a decrease in performance.

[0124] Table 5 Segmentation results of five polyp data with different block shuffling operations

[0125]

[0126] In order to prove the universality of the window axial attention mechanism, an ablation experiment was conducted on the polyp segmentation dataset, and the WASA module was integrated into the existing PraNet, DuAT, and Polyp-PVT models, that is, the window axial shuffle attention was used to replace the independent jump connection between the encoding and decoding layers. The results are shown in Table 6. The segmentation indicators on the PraNet, DuAT, and Polyp-PVT frameworks are improved. This shows that the WASA module can be embedded in other network jump connection layers to capture rich global-local information and improve network performance. At the same time, Figure 7-Figure 9 The segmentation results of the three networks PraNet, Polyb-PV, and DuAT before and after adding the WASA module are visualized. From the visualization, it can be seen that the segmentation results of the image segmentation network with the WASA module are closer to the real segmentation results, and can more accurately locate the polyp position and depict the polyp boundary.

[0127] Table 6 Segmentation results of different methods of window axial shuffle attention integration on five polyp datasets

[0128]

[0129] The above is only a preferred embodiment of the present invention. The present invention is not limited to the above implementation. As long as the technical effect of the present invention is achieved by the same or equivalent means, it should belong to the protection scope of the present invention. Within the protection scope of the present invention, its technical scheme and / or implementation method can have various modifications and changes.

Claims

1. A medical image segmentation model training method based on window and axial attention fusion, characterized in that: The following steps are involved: Constructing a segmentation network including an encoder, a WASA module and a decoder, wherein the WASA module includes a window attention layer, an axial attention layer and a block shuffle layer; The segmentation network is trained using a training set containing medical images, wherein in the window attention layer, the feature map of the medical image is segmented into a plurality of non-overlapping local windows, and self-attention is used for each local window to perform local feature interaction; in the axial attention layer, self-attention is applied to the width axis and the height axis of the feature map of the medical image respectively to achieve global feature interaction; in the block shuffle layer, the feature map output by the window attention layer and the axial attention layer is divided into blocks, and a block shuffle operation is performed; Calculating a combined loss of the segmentation network, and updating parameters of the segmentation network according to the combined loss; In the window attention layer, the feature map of the medical image is segmented into n non-overlapping local windows, and use self-attention to interact local features for each of the local windows. The specific process is shown in equations (1) to (3); in, F Represents the feature map of medical images, , H , W and C Represent the height, width and channel of the feature map respectively; Indicates p A local window; , g Indicates the side length of the local window; Split Indicates block operation. LN Representation layer normalization, MHSA Indicates long self-attention, and represents the learnable parameters, MLP Represents a multilayer perceptron with GeLU activation function.

2. The method according to claim 1, characterized in that In the axial attention layer, self-attention is used to perform global feature interaction on the width axis and height axis of the feature map of the medical image, respectively. The specific process is shown in equations (4) and (5). in, In formula (4), , , , ; , and They represent the learnable parameters, ; In formula (5), , , , ; , and They represent the learnable parameters, ; h and w Represent the row and column numbers of the feature map respectively; and They represent the number of channels of the input feature map and the number of channels of the output feature map respectively.

3. The method according to claim 2, characterized in that The medical image segmentation model training method based on window and axial attention fusion also includes the following steps: performing a 1×1 convolution operation on the output features of the axial attention layer, performing a restoration operation on the output features of the window attention layer, and performing fusion output, as shown in formula (6); in, Conv represents the convolution operation, Merge Indicates a restore operation. x Represents the fusion output result.

4. The method according to claim 3, characterized in that The block shuffling operation includes the following steps: for each shuffling, first take out the odd rows and then take out the even rows from the rows composed of blocks to obtain a new row arrangement; first take out the odd columns and then take out the even columns from the columns composed of blocks to obtain a new column arrangement.

5. The method according to claim 4, characterized in that The decoder includes a decoding module and an upsampling layer. In the decoding module, the fusion output result x The maximum pooling and average pooling are fused in a 1:1 ratio, and the feature map is refined using spatial attention. The maximum value is selected in each channel and the average value is calculated. The feature map is output through the convolution layer, as shown in equations (7) to (9); in, represents the channel attention module, represents the spatial attention module, represents the Sigmod activation function, represents the ReLU activation function, maxpool (·) represents maximum pooling, avgpool (·) represents average pooling, represents the convolutional layer, represents the maximum value in each channel, represents the average value in each channel; In the upsampling layer, the features are enlarged so that the resolution of the feature map is restored to the original size, as shown in formula (11); in, TransConv represents transposed convolution, Upsampling (·) indicates upsampling.

6. According to the method of claim 5, the combined loss of the segmentation network is calculated according to equations (12) and (13); in, represents the combined loss of the segmentation network, Indicates m The loss of the encoding stage, M represents the number of encoder stages, Indicates m The cross entropy loss of the encoding stage, Indicates m Dice loss in the encoding stage, represents the weight hyperparameter.

7. A medical image segmentation model training device, characterized in that: include: at least one processor; and a memory communicatively coupled to the at least one processor; Wherein, the memory stores instructions, which, when executed by the at least one processor, implement the medical image segmentation model training method based on window and axial attention fusion as described in any one of claims 1-6.

8. A medical image segmentation method, characterized in that: The method comprises the following steps: inputting a medical image into a medical image segmentation model obtained by the medical image segmentation model training method based on window and axial attention fusion as described in any one of claims 1 to 6, and outputting a target image by the medical image segmentation model.

9. A medical image segmentation device, characterized in that: include: at least one processor; and a memory communicatively coupled to the at least one processor; Wherein, the memory stores instructions, and when the instructions are executed by the at least one processor, the medical image segmentation method of claim 8 is implemented.

Citation Information

Patent Citations

  • Intestinal polyp segmentation method and system fused with mixed attention mechanism, and medium

    CN117036714A

  • Ball screw fault diagnosis method based on channel parallel fusion multi-attention mechanism

    CN117218508A