A Medical Image Segmentation Method and Device Based on CSWin-MDKDNet
By using the multidimensional selective fusion module and knowledge distillation loss of the CSWin-MDKDNet network, the problems of difficulty in modeling long-distance dependencies and feature redundancy in medical image segmentation of traditional convolutional neural networks are solved, and more efficient medical image segmentation results are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-27
- Publication Date
- 2026-03-10
AI Technical Summary
Traditional convolutional neural networks struggle to effectively model long-range spatial dependencies in medical image segmentation, and the high computational cost introduced by the attention mechanism can easily lead to feature redundancy, affecting segmentation accuracy.
The CSWin-MDKDNet network is adopted, which combines the Multidimensional Selective Fusion Module (MDSF) and the Knowledge Distillation Loss (KD-loss). Through the cross-window attention Transformer block and multi-scale information enhancement, fine fusion of channel and spatial features is achieved, which alleviates the feature redundancy problem.
It improves the accuracy and robustness of medical image segmentation, especially demonstrating excellent performance in Synapse multi-organ and ACDC heart segmentation tasks, while reducing computational resource requirements.
Smart Images

Figure CN121010600B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical image processing technology, and in particular to a medical image segmentation method and apparatus based on CSWin-MDKDNet. Background Technology
[0002] Accuracy and robustness of medical image segmentation are fundamental to computer-aided diagnostic systems and are crucial for image-guided surgery, disease diagnosis, treatment planning, and clinical quantitative analysis. With the development of deep learning and its wide-ranging and promising applications, many convolution-based medical image segmentation methods have been proposed to segment specific target objects within medical images.
[0003] Among these methods, various U-shaped convolutional neural network (CNN) architectures have been developed, particularly UNet, UNet++, UNet3+, Attention U-Net, and nnU-Net, for medical image segmentation across different imaging modalities. These architectures have achieved significant success in many medical applications, such as multi-organ segmentation, skin lesion segmentation, and polyp segmentation, demonstrating the powerful ability of CNNs to learn semantic information. However, traditional convolutional operations are limited by their local receptive fields, making it difficult to effectively model the long-range spatial dependencies prevalent in medical images. To address this limitation, some studies have proposed expanding the receptive field through standard convolutional operations or depthwise stacking of extended convolutions, or establishing self-attention mechanisms based on CNN features. However, these methods have failed to significantly improve the ability to model long-term dependencies.
[0004] Attention mechanisms have also been integrated into these models to enhance feature maps and improve pixel-level classification. While attention-based models have shown improved performance, they still face significant challenges due to the computationally expensive convolutional blocks typically associated with attention mechanisms. Furthermore, the introduction of attention mechanisms introduces additional parameters, and over-parameterized models often learn redundant features, leading to poor visual understanding.
[0005] Inspired by the groundbreaking advancements of Transformers in natural language processing, researchers have begun exploring their potential in computer vision. A significant milestone in this exploration is the VisionTransformer (ViT), which for the first time effectively simulates long-range correlations between image pixels using a self-attention (sa) mechanism.
[0006] The introduction of ViT not only provided a new paradigm for visual representation learning but also achieved performance comparable to or even surpassing traditional CNNs on multiple tasks. Subsequently, a large amount of research focused on adapting the Transformer architecture to the vision domain. These works have consistently achieved improvements across various vision tasks, demonstrating the enormous potential of ViT in the vision field. In the field of medical image vision, many studies have also considered incorporating Transformers into medical image segmentation tasks, such as TransUNet, Swin-Unet, HiFormer, and CSWin-Unet.
[0007] However, it is worth noting that while self-attention mechanisms are adept at capturing global contextual information, their ability to simulate local detailed features remains relatively limited. Summary of the Invention
[0008] To address the above problems, this invention proposes a medical image segmentation method and apparatus based on CSWin-MDKDNet. It constructs a novel network, CSWin-MDKDNet (Cross-Shaped Window with Multi-Dimensional & Knowledge Distillation Network), based on a multi-scale decoding architecture. This network designs a Multi-dimensional Selective Fusion (MDSF) module to achieve fine fusion of channel and spatial features based on attention, while simultaneously enhancing feature diversity using multi-scale information. To solve the feature redundancy problem caused by over-parameterization, the network introduces a knowledge distillation loss (KD-loss), effectively mitigating the semantic loss problem caused by feature redundancy, thereby improving segmentation performance.
[0009] On the one hand, the medical image segmentation method based on CSWin-MDKDNet has the following specific steps:
[0010] S1, CSWin-MDKDNet network construction steps: Construct a CSWin-MDKDNet network based on CSWin-Unet, a multidimensional fusion and knowledge distillation cross-shaped window network. The CSWin-MDKDNet network includes several encoders and several decoders corresponding to the number of stages constituting the UNet structure. Encoders and decoders in the same stage of the UNet structure are skip-connected. The encoder adopts a CSWin Transformer block with cross-shaped window attention. The input of the encoder in the first stage is the medical image to be processed, and the input of the encoders in other stages is the output of the previous stage. The decoder includes a multidimensional selective fusion module and a CSWin Transformer block. The decoder in the last stage takes the output of the encoder in the same stage as the input. The decoders in each other stage concatenate the output of the encoder in the same stage from the skip connection and the output of the decoder in the previous stage after upsampling. After the multidimensional selective fusion module performs channel feature and spatial feature fusion and multi-scale information enhancement, the result is input into the CSWin Transformer block of the decoder. The attention features output by the CSWin Transformer block of the decoder are used as the decoder output.
[0011] S2, CSWin-MDKDNet network training steps: The CSWin-MDKDNet network is trained using a total loss function that includes a loss function and a knowledge distillation loss to obtain a trained CSWin-MDKDNet network; the knowledge distillation loss performs information distillation from shallow channel features to deep channel features of the CSWin Transformer block.
[0012] S3, the medical image segmentation step, uses the trained CSWin-MDKDNet network to segment the medical image to be processed, and obtains the segmented medical image.
[0013] Preferably, the multidimensional selective fusion module includes a channel attention submodule, a spatial attention submodule, and a multi-scale convolutional block submodule, which respectively perform channel feature enhancement, spatial feature enhancement, and multi-scale information enhancement; the specific implementation process of the multidimensional selective fusion module is as follows:
[0014] ;
[0015] ;
[0016] ;
[0017] ;
[0018] ;
[0019] in, This represents the output of the channel attention submodule; This represents the Sigmoid activation function; Indicates a fully connected layer; Represents the ReLU activation function; This indicates adaptive max pooling; Indicates adaptive average pooling; ⊙ indicates pixel-wise multiplication; This represents the input to a multi-scale convolutional block; This represents the output of the spatial attention submodule; This represents a 7x7 large kernel convolutional layer operation; Indicates will and To splice; This indicates that the maximum value is pooled along the channel dimension; This indicates that the average value is pooled along the channel dimension. This represents the multi-scale fusion features in a multi-scale convolutional block submodule; Indicates the ReLU6 activation layer; Indicates the batch normalization layer; Indicates the core size is deep convolutional layers, Indicates the core size. Represents the set of kernel sizes; This represents a pointwise convolutional layer; This represents the output of a multi-scale convolutional block submodule; This represents the output of the multidimensional selective fusion module; This indicates mixed washing of the channel.
[0020] Preferably, the multi-scale convolutional submodule includes three parallel deep convolutional layers for multi-scale feature extraction, and the kernel sizes of the three parallel deep convolutional layers are 1x1, 3x3 and 5x5, respectively.
[0021] Preferably, the total loss function of CSWin-MDKDNet includes a loss function and a knowledge distillation loss; the knowledge distillation loss is used as a regularization term, and the total loss function is a weighted sum of the knowledge distillation loss and the loss function.
[0022] Preferably, the loss function is the standard cross-entropy-Dice combined loss; the total loss function is expressed as:
[0023] ;
[0024] in, Represents the total loss function; Indicates the balance parameters; This represents the loss from knowledge distillation. This represents the standard cross-entropy-dice combined loss.
[0025] Preferably, the knowledge distillation loss is expressed as:
[0026] ;
[0027] in, This represents the loss from knowledge distillation. This represents all deep channel feature maps in the c-th layer of the m-th CSWin Transformer block; This represents all shallow channel feature maps of layer c in the m-th CSWin Transformer block; Indicates the number of CSWin Transformer blocks. Indicates the layer number of the CSWin Transformer block; The cardinality of a set; express The square of the norm.
[0028] On the other hand, a medical image segmentation device based on CSWin-MDKDNet includes the following:
[0029] The CSWin-MDKDNet network construction module is used to construct a multidimensional fusion and knowledge distillation cross-window network based on CSWin-Unet. The CSWin-MDKDNet network includes several encoders and several decoders corresponding to the number of stages constituting the UNet structure. Encoders and decoders in the same stage of the UNet structure are skip-connected. The encoder adopts a CSWin Transformer block with cross-window attention. The input of the encoder in the first stage is the medical image to be processed, and the input of the encoders in other stages is the output of the previous stage. The decoder includes a multidimensional selective fusion module and a CSWin Transformer block. The decoder in the last stage takes the output of the encoder in the same stage as the input. The decoders in each other stage concatenate the output of the encoder in the same stage from the skip connection and the output of the decoder in the previous stage after upsampling. After the multidimensional selective fusion module performs channel feature and spatial feature fusion and multi-scale information enhancement, the result is input to the CSWin Transformer block of the decoder. The attention features output by the CSWin Transformer block of the decoder are used as the decoder output.
[0030] The CSWin-MDKDNet network training module is used to train the CSWin-MDKDNet network using a total loss function that includes a loss function and a knowledge distillation loss, to obtain a trained CSWin-MDKDNet network; the knowledge distillation loss performs information distillation from shallow channel features to deep channel features of the CSWin Transformer block.
[0031] The medical image segmentation module is used to segment the medical image to be processed using a trained CSWin-MDKDNet network, and obtain the segmented medical image.
[0032] Compared with the prior art, the present invention has the following beneficial effects:
[0033] (1) The CSWin-MDKDNet of the present invention introduces a multidimensional selective fusion module (MDSF), which realizes fine fusion of channel and spatial features based on attention, and at the same time enhances feature diversity by utilizing multi-scale information;
[0034] (2) This invention introduces knowledge distillation loss (KD-loss) as a regularization term of the total loss function to alleviate the feature redundancy problem caused by over-parameterization in deep neural networks. This loss function enables CSWin-MDKDNet to effectively discard irrelevant or redundant features while retaining key semantic information, thereby enhancing the interpretability and generalization ability of the model.
[0035] (3) Based on the CSWin-Unet architecture, the CSWin-MDKDNet of the present invention enhances its functionality by integrating the MDSF module and KD-loss function. This comprehensive improvement enables CSWin-MDKDNet to achieve advanced performance on medical image datasets such as Synapse multi-organ segmentation and ACDC heart segmentation benchmarks. Attached Figure Description
[0036] The present invention will now be described in further detail with reference to the accompanying drawings;
[0037] Figure 1 This is a flowchart of a medical image segmentation method based on CSWin-MDKDNet according to an embodiment of the present invention;
[0038] Figure 2 This is a diagram of the CSWin-MDKDNet architecture of the medical image segmentation method based on CSWin-MDKDNet according to an embodiment of the present invention.
[0039] Figure 3 This is a schematic diagram of the CSWinTransformer block of the medical image segmentation method based on CSWin-MDKDNet according to an embodiment of the present invention;
[0040] Figure 4 This is a schematic diagram of the CSWin self-attention mechanism of the medical image segmentation method based on CSWin-MDKDNet according to an embodiment of the present invention;
[0041] Figure 5 This is a schematic diagram of the multidimensional selective fusion module of the medical image segmentation method based on CSWin-MDKDNet according to an embodiment of the present invention;
[0042] Figure 6 This is a schematic diagram of knowledge distillation for a medical image segmentation method based on CSWin-MDKDNet according to an embodiment of the present invention; wherein, (a) represents the shallow channel feature similarity matrix (left) and the deep channel feature similarity matrix (right); (b) represents a schematic diagram of feature distillation;
[0043] Figure 7 This is a visualization of the segmented image obtained by the CSWin-MDKDNet-based medical image segmentation method according to an embodiment of the present invention, using the Synapse dataset as input.
[0044] Figure 8 This is a structural block diagram of a medical image segmentation device based on CSWin-MDKDNet according to an embodiment of the present invention. Detailed Implementation
[0045] The present invention will be further described below through specific embodiments.
[0046] like Figure 1 As shown, the specific steps of the medical image segmentation method based on CSWin-MDKDNet are as follows:
[0047] S1, CSWin-MDKDNet network construction steps: Construct the CSWin-MDKDNet network, a multidimensional fusion and knowledge distillation cross-shaped window network based on CSWin-Unet.
[0048] The CSWin-MDKDNet network consists of several encoders and decoders corresponding to the number of stages that constitute the UNet structure. Encoders and decoders in the same stage of the UNet structure are skip-connected. The encoder uses a CSWinTransformer block with cross-window attention. The input of the encoder in the first stage is the medical image to be processed, and the input of the encoders in other stages is the output of the previous stage. The decoder includes a multidimensional selective fusion module and a CSWin Transformer block. The decoder in the last stage takes the output of the encoder in the same stage as its input. The decoders in each other stage concatenate the output of the encoder in the same stage from the skip connection and the output of the decoder in the previous stage after upsampling. After the multidimensional selective fusion module performs channel feature and spatial feature fusion and multi-scale information enhancement, the result is input to the CSWin Transformer block of the decoder. The attention features output by the CSWin Transformer block of the decoder are used as the decoder output.
[0049] CSWin-Unet [Liu X, Gao P, Yu T, et al. CSWin-Unet: Transformer UNet with cross-shaped windows for medical image segmentation[J]. InformationFusion, 2025, 113: 102634.] integrates the self-attention mechanism of CSWin Transformer [Dong X, Bao J, Chen D, et al. CSWin Transformer: A general vision transformer backbone with cross-shaped windows[C] / / Proceedings of the IEEE / CVF conference on computer vision and pattern recognition. 2022: 12124-12134], enhancing feature learning capabilities through horizontal and vertical stripe self-attention. This embodiment constructs CSWin-MDKDNet based on CSWin-Unet.
[0050] The overall architecture of CSWin-MDKDNet adopts the following... Figure 2The diagram shows a hierarchical encoder-decoder structure with skip connections. The core building block of this network is the CSWin Transformer block. For a medical image input of size H×W×3, convolutional token embedding is first performed using a 7×7 convolutional kernel (stride of 4) to generate a patch token of size H / 4×W / 4 with C channels. Both the encoder and decoder contain four progressive stages, with skip connections between corresponding stages to preserve spatial and contextual information. This design follows the architectural principles of UNet.
[0051] In the encoder, downsampling is achieved using convolutional layers with 3×3 kernels and a stride of 2. These layers reduce the spatial resolution to half the input size while doubling the number of feature channels, thereby enhancing the network's cartographic representation at lower resolutions.
[0052] In the decoder, the CARAFE upsampling module [Wang J, Chen K, Xu R, et al. Carafe: Content-aware reassembly of features[C] / / Proceedings of the IEEE / CVFinternational conference on computer vision. 2019: 3007-3016] is used to restore spatial resolution. This module effectively doubles the spatial dimension and halves the number of channels. The upsampled features are then combined with the corresponding encoder features via skip connections and further refined using the MDSF module. The MDSF module enhances spatial consistency and improves feature representation by dynamically integrating multi-scale contextual information.
[0053] Following the decoder stage, a final 4 × CARAFE upsampling operation is applied to upscale the feature map to the original input resolution H × W. Finally, a linear projection layer is used to transform the high-resolution feature map into the final segmentation mask.
[0054] CSWin Transformer block.
[0055] Traditional Transformer architectures effectively capture global semantic dependencies through self-attention mechanisms that process all pixel locations. However, this approach incurs significant computational overhead when processing high-resolution medical images. The CSWin self-attention mechanism organizes attention computation into horizontal and vertical stripes, thereby enhancing parallel processing capabilities. This design not only saves computational resources but also expands the interaction range of the receptive field. Figure 3As shown, the CSWin Transformer block integrates this self-attention design, including the CSWin self-attention module (Cross-shaped Window Self-Attention), layer normalization, multi-layer perceptron, and skip connections. In the multi-head self-attention mechanism, input features... First, a linear projection transformation is performed, and the heads are assigned to N heads (usually an even number is chosen). Unlike traditional self-attention or multi-head self-attention based on shift windows, CSWin self-attention innovatively achieves local self-attention learning within the divided horizontal or vertical stripes (e.g., ...). Figure 4 (As shown). This configuration allows each head to compute self-attention only within its specified horizontal or vertical stripe.
[0056] Specifically, in the horizontal stripe self-attention configuration of CSWin Transformer, the input features Systematically divided into Non-overlapping horizontal stripes are represented as Each stripe has a width ,and By ratio OK. Consider the computation within a specific header, represented as the nth header. In this case, the dimensions of query (Q), key (K), and value (V) are all... ,in It is the number of channels. It is the total number of heads.
[0057] The calculation of the self-attention mechanism on horizontal stripes is as follows:
[0058] ;
[0059] ;
[0060] ;
[0061] in, It is the first The feature map of horizontal stripes; and These represent the weight matrices for the query, key, and value of the nth head, respectively. This represents the output of self-attention computed on horizontal stripes. Vertical stripe self-attention can be derived similarly, its output represented as... .
[0062] The N heads are divided into two groups, each containing n / 2 heads. Each group generates its own self-attention output: the first group learns horizontal fringe self-attention, and the second group learns vertical fringe self-attention. After completing the self-attention calculations separately, the two outputs are concatenated along the channel dimension, mathematically expressed as:
[0063] ;
[0064] ;
[0065] in, This indicates the nth attention head; It is a weight matrix used to linearly transform the cascaded outputs of the multi-head self-attention mechanism to produce the final attentional output. This linear transformation helps learn the relationships between different heads and fuse attentional information. The cascaded output effectively combines horizontal and vertical contextual information, providing a comprehensive understanding of the spatial relationships in the input image.
[0066] Based on the self-attention mechanism described above, the CSWin Transformer block can be defined as:
[0067] ;
[0068] ;
[0069] in, Indicates the first Each CSWin Transformer block or the output of each preceding convolutional layer.
[0070] Multidimensional selective fusion module.
[0071] Compared to using a single attention mechanism, the combination of channel attention and spatial attention, especially in a sequential manner, helps improve the model's ability to capture important feature information and efficient multi-scale convolutional blocks to enhance feature maps that preserve contextual relationships.
[0072] This embodiment introduces an efficient multidimensional selective fusion module to refine the feature map. The multidimensional selective fusion module performs depth-direction convolutions at multiple scales; this improves the feature map generated by the visual encoder and is able to capture multi-scale salient features by suppressing irrelevant regions.
[0073] like Figure 5 As shown, the multidimensional selective fusion module includes a channel attention submodule, a spatial attention submodule, and a multi-scale convolutional block submodule.
[0074] In the channel attention submodule, adaptive max pooling and adaptive average pooling are first applied to the spatial dimension of the input. Then, a two-layer MLP (compression ratio e=4) is used to model the cross-channel interaction, where the first FC layer reduces the channel dimension by a factor of e, and then the second FC layer restores the original channel dimension through the ReLU activation function.
[0075] In the spatial attention submodule, pooling is first performed along the channel dimension on the maximum and average values to focus on local features. Then, a large kernel (7×7) convolutional layer is used to enhance the local contextual relationships between features.
[0076] In the multi-scale convolutional block submodule, firstly, the number of channels is expanded using pointwise (1×1) convolutional layers, followed by batch normalization layers and ReLU6 activation layers. Then, layers with different kernel sizes are used. Multi-scale depthwise convolutions are used to simultaneously capture multi-scale and multi-resolution contextual information. Since depthwise convolutions ignore inter-channel relationships, channel shuffling is used to introduce these relationships. Finally, another pointwise convolutional layer and a normalization layer are used to transform the number of channels back to the original dimensions, while also encoding the dependencies between channels.
[0077] In one specific embodiment, given an input feature map intermediate state The output y can be represented as:
[0078] ;
[0079] ;
[0080] ;
[0081] ;
[0082] ;
[0083] in, It is the output of the channel attention submodule; This is the output of the spatial attention submodule; It is the output of the multi-scale convolutional block submodule. This represents the Sigmoid activation function; Indicates a fully connected layer; Represents the ReLU activation function; This indicates adaptive max pooling; Indicates adaptive average pooling; ⊙ indicates pixel-wise multiplication; This represents the input to a multi-scale convolutional block; This represents a 7x7 large kernel convolutional layer operation; Indicates will and To splice; This indicates that the maximum value is pooled along the channel dimension; This indicates that the average value is pooled along the channel dimension. This represents the multi-scale fusion features in a multi-scale convolutional block submodule; Indicates the ReLU6 activation layer; Indicates the batch normalization layer; Indicates the core size is deep convolutional layers, Indicates the core size. Represents the set of kernel sizes; This represents a pointwise convolutional layer; This represents the output of the multidimensional selective fusion module; This indicates mixed washing of the channel.
[0084] S2, CSWin-MDKDNet network training steps: The CSWin-MDKDNet network is trained using a total loss function that includes a loss function and a knowledge distillation loss to obtain a trained CSWin-MDKDNet network; the knowledge distillation loss performs information distillation from shallow channel features to deep channel features of the CSWin Transformer block.
[0085] Knowledge distillation loss.
[0086] Knowledge distillation refers to the process of transferring knowledge from a complex model (teacher model) to a lightweight model (student model). Empirical studies show that over-parameterized CNN / ViT architectures often learn redundant feature representations, which impairs the ability to acquire discriminative visual concepts. To illustrate this phenomenon, the feature similarity matrix output from the first encoder layer of CSWin-Unet was analyzed, examining both shallow and deep channel dimensions. Figure 6 As shown in (a), two key findings can be obtained: (1) Deep redundancy: between deep channels ( Figure 6 (a) The higher similarity score in the right figure indicates that different channels have learned highly similar features; (2) Shallow diversity: the shallow channels ( Figure 6 The lower similarity matrix in the middle (a) left figure reflects significant differences in the features learned by each channel. This is consistent with the overparameterization problem observed in other architectures, which introduces task-irrelevant visual features, increasing unnecessary computational costs while reducing model performance.
[0087] To address the feature redundancy problem, several channel compression methods have been proposed in the field of model pruning, which utilize... Norm penalty is used to establish sparse priors for channel saliency. Inspired by this, this embodiment employs... Norms enable information distillation from shallow (upper half of channel features) to deep (lower half of channel features), guiding deep features to learn effective contextual information. Its mathematical expression can be stated as:
[0088] ;
[0089] in, This represents all deep channel feature maps in the c-th layer of the m-th CSWin Transformer block; This represents all shallow channel feature maps of layer c in the m-th CSWin Transformer block; This indicates the number of CSWin Transformer blocks, where C represents the number of layers in the CSWin Transformer blocks; The cardinality of a set; express The square of the norm. For example... Figure 6 As shown in (b), the channel is divided into an upper and lower half, ensuring a consistent number of features between shallow and deep layers through this equal division. Drawing upon several channel compression methods already proposed in the field of model pruning, this method is adopted... Norm constraints are applied. Compared to methods that require introducing additional modules to reduce redundancy, the approach proposed in this embodiment... The method has the significant advantages of simple structure and no additional computational cost.
[0090] Fusion loss function.
[0091] The total loss function of the CSWin-MDKDNet model is composed of knowledge distillation loss. Combined loss with standard cross-entropy - dice Weighted composition, where, It is calculated by comparing the predicted results with the actual segmentation results. Its mathematical expression can be stated as:
[0092] ;
[0093] in, These are the balancing parameters.
[0094] It should be noted that the loss function of the CSWin-MDKDNet model can also use other loss functions besides the standard cross-entropy-dice combined loss, which can be set according to the specific needs. This embodiment does not impose any restrictions.
[0095] S3, the medical image segmentation step, uses the trained CSWin-MDKDNet network to segment the medical image to be processed, and obtains the segmented medical image.
[0096] Experimental verification.
[0097] Dataset selection.
[0098] The Synapse dataset contains 30 CT scans from the MICCAI 2015 Abdominal Multi-Map Organ Segmentation Challenge, totaling 3779 abdominal CT images. Each CT scan contains 85 to 198 slices, each with a resolution of 512×512 pixels and a voxel physical size of ([0.54,0.54]×[0.98,0.98]×[2.5,5.0]) mm³. Based on the criteria set in the literature [Chen J, Lu Y, Yu Q, et al. Transunet: Transformers make strong encoders for medical image segmentation[J]. arxiv preprint arxiv:2102.04306,2021] and [Cao H, Wang Y, Chen J, et al. Swin-unet: Unet-like pure transformer for medical image segmentation[C] / / European conference on computer vision.Cham: Springer Nature Switzerland, 2022: 205-218], 18 cases were selected as the training set and 12 cases as the evaluation set. For the segmentation performance of eight abdominal organs (aorta, gallbladder, left kidney, right kidney, liver, pancreas, spleen, and stomach), the average Dice similarity coefficient (DSC) and the average Hausdorff distance (HD) were used as evaluation metrics.
[0099] The ACDC dataset. The Automated Cardiac Diagnosis Challenge (ACDC) dataset originates from the ACDC competition held at the 2017 MICCAI conference. This dataset contains short-axis cardiac cine-MRI scans of 100 patients, acquired using 1.5T and 3T MRI scanners, and manually labeled by medical experts for three types of cardiac structures: right ventricle (RV), myocardium (MYO), and left ventricle (LV). Data was randomly allocated to a training set of 70 cases, a validation set of 10 cases, and a test set of 20 cases. The evaluation metric used was the average Dice similarity coefficient (DSC) of the three structures to quantify the consistency between the segmentation model and the expert annotations.
[0100] Experiment setup.
[0101] The CSWin-KDMDNet model was implemented using Python and the PyTorch framework. Model training and evaluation were both performed on an NVIDIA 3090 graphics card with 24GB of VRAM. Initialization was achieved by loading pre-trained ImageNet CSWin Transformer block weights to accelerate convergence using prior knowledge. For data augmentation, flipping and spinning strategies were employed to increase the diversity of the training set, thereby enhancing the model's generalization ability to unseen data. Training parameters were set as follows: batch size of 24, initial learning rate of 0.05, stochastic gradient descent optimizer, momentum of 0.9, and weight decay coefficient. The loss function has a balance parameter of 0.01. This configuration aims to optimize the balance between model learning speed and convergence stability.
[0102] Image results on the Synapse dataset.
[0103] As shown in Table 1, CSWin-KDMDNet significantly improves the average DSC and HD scores on the Synapse dataset. The figure also shows the mean DSC, mean HD, and single-organ DSC scores for each organ (aorta, gallbladder, left kidney, right kidney, liver, pancreas, spleen, and stomach). The data shows significant differences in performance among different methods across organs and evaluation metrics (DSC / HD). Bold values represent optimal performance, and underlined values represent suboptimal performance.
[0104] Table 1: Comparison of the performance of different models on the Synapse dataset.
[0105]
[0106] Wherein, DSC represents the Dice similarity coefficient, with ↑ indicating higher performance and better; HD represents the Hausdorff distance, with ↓ indicating lower performance and better; Aor represents the aorta; Gall represents the gallbladder; Lkid represents the left kidney; Rkid represents the right kidney; Liv represents the liver; Pan represents the pancreas; Spl represents the spleen; and Sto represents the stomach.
[0107] CSWin-MDKDNet demonstrates superior performance in multi-organ segmentation tasks: achieving the highest scores in pancreas (66.63) and left kidney (86.96) segmentation, while achieving second-best results in right kidney, spleen, and liver segmentation. Its overall DSC score of 81.82 ranks first among all methods, indicating that this method has the best overall segmentation accuracy.
[0108] To more intuitively evaluate the method's performance, a visual comparative analysis of the segmentation results was performed. For example... Figure 7 As shown, experimental results on the Synapse dataset demonstrate that the CSWin-MDKDNet model significantly outperforms other methods in boundary segmentation accuracy. Specifically: the first row of results shows that, compared to CSWin-Unet, this model not only generates finer segmentation boundaries but also corrects incorrect pancreatic segmentation; the second row of results shows that existing methods generally suffer from missegmentation of the stomach (mislabeling some stomach tissue as pancreas), while this method effectively alleviates this phenomenon, exhibiting superior anatomical structure recognition capabilities.
[0109] Results on the ACDC dataset.
[0110] Table 2 presents the quantitative evaluation results of the CSWin-MDKDNet model on the ACDC dataset and provides a comprehensive comparison with current mainstream segmentation methods. The Dice similarity coefficient (DSC) was used as the primary evaluation metric to assess three key cardiac structures: right ventricle (RV), myocardium (MYO), and left ventricle (LV). The data shows that the CSWin-MDKDNet model significantly outperformed all compared methods with a comprehensive DSC score of 91.76%, specifically achieving best performance in both right ventricle (89.84%) and left ventricle (95.90%) segmentation tasks, and demonstrating significant competitiveness in myocardial segmentation (89.53%). These results fully validate the superiority and robustness of CSWin-MDKDNet in cardiac MRI image segmentation tasks.
[0111] Table 2: Comparison of different models on the ACDC dataset.
[0112]
[0113] In this context, RV represents the right ventricle; MYO represents the myocardium; and LV represents the left ventricle.
[0114] Comparison of computational efficiency.
[0115] The fundamental goal of neural network model design is to minimize the number of parameters and computational complexity while maintaining performance. This simplification is crucial for achieving efficient model training and deployment on devices with limited computing resources. Therefore, in addition to accuracy and generalization ability, the number of parameters and computational complexity should be carefully considered when evaluating a model. As shown in Table 3, CSWin-MDKDNet achieves a better balance between model performance and computational efficiency: compared to the classic Transformer model TransUNet, CSWin-MDKDNet requires only 24.9% of the parameters and 5.5% of the computational cost, yet significantly improves the DSC metric for medical image segmentation by 4.34%; and compared to CSWin-Unet, this method only adds 0.39M parameters and 0.2G FLOPs, achieving a DSC improvement of 0.7 percentage points.
[0116] Table 3: Comparison of computational efficiency of different models.
[0117]
[0118] Where Params (M) represents the number of parameters, in units of M; FLOPs (G) represents the number of floating-point operations, in units of G.
[0119] Ablation experiment.
[0120] Ablation experiments were conducted on the Synapse dataset using CSWin-Unet as the baseline model. As shown in Table 4, all ablation comparisons were based on CSWin-Unet. Experimental results show that when only the Multidimensional Selective Fusion Module (MDSF) is introduced, the model's DSC metric on the Synapse dataset improves from the baseline of 81.12% to 81.45%, while significantly improving boundary alignment quality, demonstrating that this module effectively enhances spatial detail modeling capabilities through cross-scale dynamic feature interaction. When the KD-loss training strategy is applied alone, the DSC further improves to 81.64%, with a simultaneous improvement in boundary alignment, verifying the enhancing effect of the self-distillation mechanism on semantic consistency.
[0121] Table 4: Ablation experiments for each module.
[0122]
[0123] When the MSDF module and KD-loss strategy are used together, the model achieves optimal performance: a cumulative 0.7% improvement in DSC and a 3.4% decrease in HD compared to the baseline. This confirms that the two are highly complementary: MSDF strengthens local feature representation through adaptive weight allocation, while KD-loss constrains feature distribution from a global semantic perspective. Their synergistic effect ultimately achieves a dual breakthrough in segmentation accuracy and anatomical structural integrity.
[0124] In summary, the CSWin-MDKDNet proposed in this embodiment is a novel medical image segmentation framework that effectively bridges the gap between local feature extraction and global context modeling. By innovatively integrating channel attention, spatial attention, and multi-scale convolutional blocks, the proposed Multidimensional Selective Fusion (MDSF) module achieves refined attention fusion of channel-spatial features. Addressing the key issue of feature redundancy in deep networks, a knowledge distillation loss (KD-loss) is proposed. This loss function guides the model to learn compact and discriminative feature representations, effectively suppressing interference from irrelevant features. Ablation experiments further verify the complementarity of MDSF and KD-loss, demonstrating that their synergistic effect produces more robust segmentation performance.
[0125] like Figure 8 As shown, the present invention also discloses a medical image segmentation device based on CSWin-MDKDNet, comprising:
[0126] The CSWin-MDKDNet network construction module 801 is used to construct a CSWin-MDKDNet network based on CSWin-Unet, which is a multidimensional fusion and knowledge distillation cross-shaped window network. The CSWin-MDKDNet network includes several encoders and several decoders corresponding to the number of stages constituting the UNet structure. The encoders and decoders in the same stage of the UNet structure are skip-connected. The encoder adopts a CSWin Transformer block with cross-shaped window attention. The input of the encoder in the first stage is the medical image to be processed, and the input of the encoders in other stages is the output of the previous stage. The decoder includes a multidimensional selective fusion module and a CSWin Transformer block. The decoder in the last stage takes the output of the encoder in the same stage as the input. The decoders in each other stage concatenate the output of the encoder in the same stage from the skip connection and the output of the decoder in the previous stage after upsampling. After the multidimensional selective fusion module performs channel feature and spatial feature fusion and multi-scale information enhancement, the result is input to the CSWin Transformer block of the decoder. The attention features output by the CSWin Transformer block of the decoder are used as the decoder output.
[0127] The CSWin-MDKDNet network training module 802 is used to train the CSWin-MDKDNet network using a total loss function that includes a loss function and a knowledge distillation loss, to obtain a trained CSWin-MDKDNet network; the knowledge distillation loss performs information distillation from the shallow channel features of the CSWin Transformer block to the deep channel features.
[0128] The medical image segmentation module 803 is used to segment the medical image to be processed using a trained CSWin-MDKDNet network to obtain the segmented medical image.
[0129] The specific implementation of the CSWin-MDKDNet-based medical image segmentation device is the same as the CSWin-MDKDNet-based medical image segmentation method, and will not be described again in this embodiment.
[0130] The above are merely specific embodiments of the present invention, but the design concept of the present invention is not limited thereto. Any non-substantial modifications made to the present invention using this concept shall be considered as infringing upon the protection scope of the present invention.
Claims
1.A medical image segmentation method based on CSWin-MDKDNet, characterized in that, The method comprises the following steps: S1, a CSWin-MDKDNet network construction step, a CSWin-MDKDNet network based on a CSWin-Unet is constructed; the CSWin-MDKDNet network comprises a plurality of encoders and a plurality of decoders corresponding to a plurality of stages of UNet structure, and the encoders and the decoders of the same stage of the UNet structure are connected through jumping; the encoder adopts a CSWin Transformer block with cross window attention, the input of the encoder of the first stage is a medical image to be processed, and the input of the encoder of other stages is the output of the previous stage; the decoder comprises a multi-dimensional selective fusion module and a CSWin Transformer block, the output of the encoder of the same stage is input into the decoder of the last stage, the output of the encoder of the same stage from the jumping connection and the output of the decoder of the previous stage after being up-sampled are spliced, and then the spliced result is input into the CSWin Transformer block of the decoder after being fused in the channel feature and the spatial feature and being enhanced in the multi-scale information, and the attention feature output by the CSWin Transformer block of the decoder is the output of the decoder; the multi-dimensional selective fusion module comprises a channel attention submodule, a spatial attention submodule and a multi-scale convolution block submodule, and is used for performing channel feature enhancement, spatial feature enhancement and multi-scale information enhancement, respectively; the total loss function of the CSWin-MDKDNet comprises a loss function and a knowledge distillation loss; the knowledge distillation loss is used as a regularization term, and the total loss function is a weighted sum of the knowledge distillation loss and the loss function; S2, a CSWin-MDKDNet network training step, the CSWin-MDKDNet network is trained through a total loss function comprising a loss function and a knowledge distillation loss, and a trained CSWin-MDKDNet network is obtained; the knowledge distillation loss performs information distillation from the shallow channel feature of the CSWin Transformer block to the deep channel feature; S3, a medical image segmentation step, a medical image to be processed is segmented by using the trained CSWin-MDKDNet network, and a segmented medical image is obtained. 2.The CSWin-MDKDNet based medical image segmentation method of claim 1, wherein, The multi-dimensional selective fusion module comprises a channel attention submodule, a spatial attention submodule and a multi-scale convolution block submodule, and is used for performing channel feature enhancement, spatial feature enhancement and multi-scale information enhancement, respectively; the specific implementation process of the multi-dimensional selective fusion module is represented as: ; ; ; ; ; wherein, denotes the output of the channel attention sub-module; denotes a Sigmoid activation function; denotes a fully connected layer; denotes a ReLu activation function; denotes adaptive max pooling; denotes adaptive average pooling; denotes pixel-wise multiplication; denotes the input of the multi-scale convolution block; denotes the output of the spatial attention sub-module; denotes a 7x7 large kernel convolution layer operation; denotes concatenating and ; denotes a max pooling operation along the channel dimension; denotes an average pooling operation along the channel dimension; denotes multi-scale fused features in the multi-scale convolution block sub-module; denotes a ReLU6 activation layer; denotes a batch normalization layer; denotes a depth convolution layer with kernel size , denotes kernel size, denotes a set of kernel sizes; denotes a point-wise convolution layer; denotes the output of the multi-scale convolution block sub-module; denotes the output of the multi-dimensional selective fusion module; denotes channel shuffle. 3.The CSWin-MDKDNet based medical image segmentation method of claim 2, wherein, The multi-scale convolution block submodule comprises three parallel deep convolution layers for multi-scale feature extraction, and the kernel sizes of the three parallel deep convolution layers are 1x1, 3x3 and 5x5, respectively. 4.The CSWin-MDKDNet based medical image segmentation method of claim 1, wherein, The loss function is a standard cross entropy-dice combination loss; the total loss function is represented as: ; wherein, represents the total loss function; represents the balancing parameter; represents the knowledge distillation loss; represents the standard cross-entropy-dice combination loss. 5.The CSWin-MDKDNet based medical image segmentation method of claim 1, wherein, The knowledge distillation loss is represented as: ; wherein, denotes the knowledge distillation loss; denotes all deep channel feature maps of the c-th layer in the m-th CSWin Transformer block; denotes all shallow channel feature maps of the c-th layer in the m-th CSWin Transformer block; denotes the number of CSWin Transformer blocks, denotes the number of layers of the CSWin Transformer block; denotes the cardinality of the set; denotes the square of the norm. 6.A CSWin-MDKDNet based medical image segmentation device, characterized by, The method comprises the following steps: The CSWin-MDKDNet network construction module is configured to construct a CSWin-MDKDNet network based on a CSWin-Unet multidimensional fusion and knowledge distillation cross window network; the CSWin-MDKDNet network comprises a plurality of encoders and a plurality of decoders corresponding to a plurality of stages of a UNet structure, and the encoders and the decoders of the same stage of the UNet structure are connected by jumping; the encoders adopt CSWin Transformer blocks with cross window attention, the input of the encoder of the first stage is a medical image to be processed, and the input of the encoder of each other stage is the output of the previous stage; the decoders comprise a multidimensional selective fusion module and a CSWin Transformer block, the input of the decoder of the last stage is the output of the encoder of the same stage, the input of each other decoder is the output of the encoder of the same stage connected by jumping and the output of the decoder of the previous stage after being up-sampled, the multidimensional selective fusion module is used to fuse channel features and spatial features and enhance multi-scale information, and the CSWin Transformer block of the decoder is used to output attention features; and the output of the CSWin Transformer block of the decoder is the output of the decoder; The multidimensional selective fusion module comprises a channel attention submodule, a spatial attention submodule and a multi-scale convolution block submodule, and is respectively used to enhance channel features, enhance spatial features and enhance multi-scale information; the total loss function of the CSWin-MDKDNet comprises a loss function and a knowledge distillation loss; the knowledge distillation loss is used as a regularization term, the total loss function is a weighted sum of the knowledge distillation loss and the loss function; the CSWin-MDKDNet network training module is configured to train the CSWin-MDKDNet network by using the total loss function comprising the loss function and the knowledge distillation loss, and obtain a trained CSWin-MDKDNet network; the knowledge distillation loss is used to perform information distillation from shallow channel features to deep channel features of the CSWin Transformer block; The medical image segmentation module is configured to segment a medical image to be processed by using the trained CSWin-MDKDNet network, and obtain a segmented medical image.
Citation Information
Patent Citations
Urban streetscape advertisement image segmentation method
CN116189180A
Method for accurately segmenting medical image
CN117994517A