A U-shaped medical image segmentation method based on boundary perception enhancement
By using the boundary-aware enhancement method of the EBP-UNet model, the segmentation problem across topological structures in medical image segmentation was solved, achieving high-precision and unified segmentation of closed organs and vascular networks, and improving the model's adaptability and efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NORTHWEST UNIV
- Filing Date
- 2026-05-29
- Publication Date
- 2026-07-31
AI Technical Summary
Existing medical image segmentation models suffer from problems such as inaccurate boundary localization, breakage of small structures, and weak model generalization ability when facing different topological structures such as closed organs and reticular blood vessels, making it difficult to achieve high-precision and unified cross-topological segmentation.
A boundary-aware enhancement-based U-shaped medical image segmentation method is adopted. The EBP-UNet model is used, combined with dual encoders, dynamic multi-scale kernel modules and grouped attention gating modules. Through strip deformable convolution modules and CSWin Transformer modules, local details and global topological relationships of different topological structures are adaptively captured, so as to achieve accurate feature calibration and fusion.
It improves the model's segmentation accuracy and continuity across different topologies, alleviates the problems of feature redundancy in closed structures and breaks in mesh structures, achieves efficient cross-topology segmentation, and reduces model deployment and learning costs.
Smart Images

Figure CN122493053A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical image segmentation technology, and specifically to a U-shaped medical image segmentation method based on boundary awareness enhancement. Background Technology
[0002] Medical image segmentation targets include both anatomical tissues and lesions with closed topological structures such as the liver, pancreas, and cell nuclei, and physiological tissues with retinal vessels and other network topological structures. These two types of structures differ significantly in morphological features, spatial distribution, and segmentation challenges. Closed structures have well-defined boundaries and complete regions; the core of segmentation lies in accurately fitting the target edges and suppressing background noise interference. Network structures, on the other hand, are characterized by their thinness, numerous branches, and complex topological connections. The key to segmentation is not only achieving accurate identification of individual vessels but also ensuring the continuity and integrity of the network structure to avoid breaks, missed detections, and false positives.
[0003] Current medical image segmentation models often suffer from limitations in adapting to a single topological structure. Models optimized for closed structures struggle to adapt their feature extraction and fusion mechanisms to the intricate branches and complex topological features of network structures. Conversely, models specifically designed for network structures, due to overemphasis on fine-grained feature extraction, exhibit feature redundancy and low computational efficiency in closed structure segmentation. Clinical medicine demands segmentation models that not only possess high accuracy but also cross-topological universality—meaning the same model must meet the segmentation requirements of different targets, such as closed organs, lesions, and vascular networks, thereby reducing the deployment and learning costs of models in clinical applications. Summary of the Invention
[0004] The purpose of this invention is to provide a U-shaped medical image segmentation method based on boundary awareness enhancement, which solves the problems of inaccurate boundary positioning, small structural breaks and weak model generalization ability of existing segmentation models when facing different topological structures such as closed organs and reticular blood vessels. It achieves high-precision and unified segmentation of closed regions and reticular structures under a single framework.
[0005] To achieve the above objectives, the present invention provides the following technical solution: A U-shaped medical image segmentation method based on boundary awareness enhancement includes the following steps: Step 1: Select multiple publicly available medical image segmentation datasets covering different imaging modalities and typical topological structures, and divide them into training and testing sets; Step 2: Build the EBP-UNet model; The EBP-UNet model includes a dual encoder, a dynamic multi-scale kernel module DMSKM, and a grouped attention gating module GAGM. The dual encoder includes a strip deformable convolution module SDCM and a CSWin Transformer module. The strip deformable convolution module SDCM consists of two core stages: a strip convolution stage and a deformable convolution stage. The CSWin Transformer module divides the attention head into two groups: a horizontal head (H-Head) and a vertical head (V-Head), and computes the self-attention of the horizontal and vertical strips in parallel. The dynamic multi-scale kernel module DMSKM drives the generation of dynamic convolutional kernel weights with global context, completes complementary feature extraction through parallel multi-scale deep convolution, and achieves accurate feature calibration by combining adaptive spatial attention, providing feature support for skip connections that combines local details and global semantics. The Group Attention Gating Module (GAGM) is a feature fusion unit embedded in the U-shaped network skip connection path and the decoder upsampling branch. The feature inputs of the GAGM come from two core links, one of which is the high-level semantic features output from the previous layer of the decoder. The other is the low-level spatial features transmitted by the encoder at the corresponding level through skip connections. ; Step 3: Train the model using the training set data to obtain the optimal model parameters; Step 3.1: Generate input features from the input images in the training set through the initial convolutional layer. Input features First, local contextual features are extracted using a 5×5 depthwise convolution. Then, a 1×W horizontal strip convolution and an H×1 vertical strip convolution are used to extract continuous features in the horizontal and numerical directions, respectively. The obtained features are encoded by multiplying them using pointwise convolution. Finally, the original input features and the encoded features are multiplied element-wise to complete the strip convolution stage. Step 3.2: Based on the preset stripe width SW, the input feature map is divided into... Each horizontal band and Each vertical stripe is computed in parallel with the self-attention of the horizontal and vertical stripes. Step 3.3: Input the concatenated features from Step 3.1 and Step 3.2 into the Dynamic Multi-Scale Kernel Module (DMSKM). After global context encoding, the large and small scale convolution kernels are adaptively selected, multi-scale features are extracted in parallel, and feature fusion is completed. Finally, the final features are output after spatial attention weighting calibration. Step 3.4: Obtain the high-level semantic features of the decoder's preceding layer output. Low-level spatial features transmitted by the encoder via skip connections The high-level semantic features output by the decoder are upsampled and spatially aligned and semantically enhanced by depthwise separable convolution. Then, they are grouped and convolved in parallel with the low-level spatial features transmitted by the encoder. After fusion, an attention weight map is generated, and the low-level spatial features are adaptively calibrated to complete the adaptive fusion output of high and low level features. Step 4: Input the test set data into the trained model and output the segmentation results.
[0006] Furthermore, step 3.1 includes: dynamically learning the horizontal and vertical offsets of each convolutional sampling point through an offset prediction branch with a convolutional kernel size of 3×3. The offset It is used to adjust the sampling position of the standard 3×3 convolution kernel, enabling the convolution operation to adapt to the irregular shape of the target. The calculation process is as follows: in The feature map output by the strip convolution stage. (·) denotes deformable convolution operation. This is a shape-adaptive feature map output by deformable convolution; After processing, the residuals are added element-wise to the original input features from the strip convolution stage to form strip deformable features. : in The original input features, For batch normalization, For activation functions; at last, After convolution to adjust the channel dimensions, the final output of the SDCM module is obtained. : .
[0007] Furthermore, the self-attention calculation process in step 3.2 includes: In the formula, for Normalized input feature map, It is a fully connected layer. , , For the horizontal direction, Query, Key, Value, , , For the vertical Query, Key, and Value, For normalization function, , These are the horizontal and vertical Query-Key dot products, respectively. For the attention head dimension, To output the projection matrix, , These are the self-attention outputs for horizontal and vertical stripes, respectively. For splicing operations, This is the feature map after cross-shaped self-attention fusion.
[0008] Furthermore, step 3.3 includes the following process: First, global context encoding is performed on the concatenated features from steps 3.1 and 3.2 using global average pooling to obtain globally context-encoded features. The calculation process is as follows: in, As the normalization factor, This represents the concatenated feature vector. This represents the summation of spatial dimensions; Based on this, the global context features are processed by two different 1×1 convolutions and... Softmax Activation function, to obtain small-scale kernel selection weights Large-scale kernel selection weights : in , Indicates the probability of different choices; Then, a small-scale kernel is selected by choosing the index with the highest probability. and large-scale kernel in The expression returns the position of the maximum value in the vector; Next, use a kernel size of and Depthwise separable convolutions are used for cascaded feature extraction: in Indicates the result after initial convolution. , This represents the feature map generated by small-scale depthwise convolution. Represents the feature map generated by large-scale deep convolution; Will and By stitching along the channel dimension, preliminary fusion of multi-scale features is achieved, resulting in fused features. : ; Fusion features Parallel average pooling and max pooling are performed to capture average statistical features and salient semantic features in the spatial dimension, respectively, and then convolution and... Sigmoid Activation function processing to generate spatial attention weights , The formula is as follows: in Indicates adaptive average pooling. Indicates maximum activation pooling. This represents average spatial attention. This represents maximum spatial attention; Spatial attention weights , Separate and fusion features Perform element-wise multiplication to obtain a weighted feature map. Add the two weighted feature maps element-wise to obtain the final output: .
[0009] Furthermore, step 3.4 includes the following process: First, high-level semantic features Perform a 2x upsampling operation to map its spatial size to the lower-level spatial features. With completely consistent dimensions, detail restoration and feature enhancement are achieved through 3×3 depthwise separable convolutions, followed by Batch Normalization (BN) and ReLU activation functions, ultimately yielding preprocessed high-level features that have achieved spatial alignment and semantic enhancement. The formula is as follows: in Indicates upsampling, This represents a 3×3 depth-separable convolution; The preprocessed high-level semantic features and the original low-level spatial features are subjected to two independent 3×3 grouped convolutions and... BN Parallel feature encoding is performed, and the grouped convolutional encoding process of the two feature paths is represented as follows: in Grouped convolutional coding features representing high semantic paths Grouped convolutional coding features representing low-level paths; The encoded high-level features are added element-wise to the low-level features, and the fused features are then processed... ReLU Activation function, 1×1 pointwise convolution and BN, Multi-channel features are mapped to single-channel feature maps, and then... Sigmoid The activation function generates an attention weight map, which is then compared with the original encoder's low-level spatial features. Element-wise multiplication is performed, retaining only the effective spatial details and boundary information that match the high-level semantic features, as shown in the following formula: in This represents a mixed attention map. This represents the fusion result of high-level semantic features and low-level semantic features. This represents the final characteristic of the output.
[0010] Compared with the prior art, the present invention has the following beneficial effects: This invention proposes a boundary-aware enhanced U-shaped medical image segmentation model, EBP-UNet, which reconstructs a dual-encoder architecture. One branch includes a strip-shaped deformable convolution module (SDCM), which captures local details of closed structure contour edges and fine branches of mesh structures through a combination of horizontal and vertical strip convolutions and deformable convolutions. The other branch includes a CSWinTransformer module (CSTM), which models global topological relationships more efficiently while preserving fine-grained features through a cross-shaped window self-attention mechanism and local enhanced positional encoding. A dynamic multi-scale kernel module (DMSKM) is proposed, which adaptively adjusts the receptive field of the convolution based on the boundary distribution characteristics of the input features, matching the large-scale contour boundaries of closed structures with the small-scale fine boundaries of mesh structures, thus improving the model's perception accuracy of different boundary shapes. A grouped attention gating module (GAGM) is designed, which performs weighted fusion of two types of feature maps through a grouped attention gating mechanism, enhancing the collaborative expression of different feature maps and achieving topological adaptation of feature fusion.
[0011] In the strip-shaped deformable convolution module SDCM of this invention, strip-shaped convolution focuses on the continuous features of blood vessels in the horizontal and vertical directions. Combined with deformable convolution, it adaptively fits the irregular boundaries of blood vessel bifurcation and curvature, capturing fine-grained details of slender blood vessels. The cross-shaped window self-attention mechanism of CSTM expands the attention receptive field to a cross shape, which can efficiently model the global topological association of vascular networks and make up for the efficiency shortcomings of the standard Swin Transformer square window in network structure modeling. The dynamic multi-scale kernel module DMSKM, through a global context-driven dynamic convolution kernel weight generation mechanism, can adaptively select small-scale or large-scale convolution kernels according to the boundary distribution of input blood vessel features, realizing the matching of small-scale boundaries of slender blood vessel ends with large-scale contours of blood vessel trunks. The grouped attention gating module GAGM expands the receptive field through grouped convolution, captures the local spatial context association of blood vessels, and adaptively generates attention weight maps guided by high-level semantic features of the decoder, assigning high weights to the target blood vessel region and low weights to the background noise region, alleviating the semantic gap problem of cross-layer feature fusion. Attached Figure Description
[0012] Figure 1 This is a schematic diagram of the structure of the EBP-UNet model of the present invention; Figure 2 This is a schematic diagram of the strip-shaped deformable convolution module of the present invention; Figure 3 This is a schematic diagram of the CSwin transformer module of the present invention; Figure 4 This is a schematic diagram of the structure of the dynamic multi-scale kernel module of the present invention; Figure 5 This is a schematic diagram of the group attention gating module of the present invention; Figure 6 To demonstrate the segmentation performance of the model of this invention on visual test images of other models on the DRIVE dataset; Figure 7 The model of this invention was used to segment images of the visualization portion of test images compared to other models on the STARE dataset. Detailed Implementation
[0013] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0014] The U-shaped medical image segmentation method based on boundary awareness enhancement described in this embodiment includes the following steps: Step 1: Select multiple publicly available medical image segmentation datasets covering different imaging modalities and typical topological structures, and divide them into training and testing sets. This embodiment selects the GlaS colon gland segmentation dataset, the DRIVE fundus retinal vessel segmentation dataset, and the STARE fundus retinal vessel segmentation dataset. These three datasets cover two mainstream medical imaging modalities: pathological histological images and color fundus photographs. They include two types of segmentation objects with significantly different morphological features and segmentation difficulties: glandular targets with closed topology and vascular targets with mesh topology. This can fully verify the model's generalization ability and universal adaptability under different imaging conditions and different topologies, and solve the clinical pain point of the limited adaptability of traditional models to a single topology.
[0015] GlaS Dataset: This dataset contains 165 images (85 for training, 80 for testing), ranging in pixel size from 567×430 to 775×552. These images are derived from 16 histological sections, each from patients with T3 or T4 stage colorectal adenocarcinoma.
[0016] The DRIVE dataset contains 40 color fundus images, all collected from the Dutch Diabetic Retinopathy Screening Project, with a resolution of 565×584 pixels. The dataset is divided into a 50 / 50 training and test set (20 images for training and 20 for testing). Each image is manually annotated by two senior ophthalmologists, and an expert-annotated fundus field mask is provided to eliminate interference from non-fundus regions. The retinal vessels in the DRIVE dataset exhibit a typical mesh-like topology, characterized by numerous branches, large vessel diameters, and a high proportion of delicate capillaries. Issues such as blurred vessel boundaries and discontinuities due to uneven fundus illumination, low contrast, and mild lesions further complicate segmentation. The core challenge lies in accurately capturing delicate vessel capillaries while maintaining the integrity and continuity of the vascular network topology, avoiding vessel breaks, false positives, and missed capillaries. This dataset effectively validates the model's ability to model mesh-like topologies.
[0017] The STARE dataset contains 20 color fundus images with a resolution of 700×605 pixels. Ten of these images contain severe fundus lesions, such as diabetic retinopathy, glaucoma, and choroidal neovascularization. The STARE dataset not only preserves the mesh-like topological structure of retinal vessels but also introduces extreme clinical scenarios such as multiple lesion interference and complex background noise, thus validating the model's ability to segment challenging mesh-like topological structures.
[0018] Step 2: Build the EBP-UNet model The EBP-UNet model is specifically improved to address the segmentation needs of both closed and mesh topologies. The overall model architecture is as follows: Figure 1As shown, it includes a dual encoder (SDCM+CSTM), a dynamic multi-scale kernel module, and a grouped attention gating module.
[0019] In medical image segmentation tasks, the feature extraction capability of the encoder directly determines the segmentation accuracy. Traditional encoder architectures suffer from two core defects: First, encoders based on standard convolution have square receptive fields for their convolutional kernels. When capturing irregular edges of closed structures or thin branches of mesh structures, they incorporate a large amount of irrelevant background information, making it difficult to effectively capture anisotropic contextual information where features are dense in one dimension and sparse in another. This leads to the loss of features from slender targets and insufficient accuracy in fitting edges of closed structures. Second, while encoders based on the Swing Transformer can model global semantics, the square window self-attention mechanism requires a sliding window to achieve global information interaction. The receptive field of a single layer is limited, resulting in low efficiency when modeling the topological continuity of mesh structures.
[0020] To address the aforementioned issues, the EBP-UNet model of this invention reconstructs a dual-encoder architecture. One branch includes a strip deformable convolution module (SDCM), which combines horizontal and vertical strip convolutions with deformable convolutions to capture local details of the edges of closed structure contours and the fine branches of the mesh structure. The other branch includes a CSWin Transformer module (CSTM), which, through a cross-shaped window self-attention mechanism and local enhanced positional encoding, preserves fine-grained features while efficiently modeling global topological relationships, thus alleviating the low global modeling efficiency and loss of local details caused by the window limitation of the Swing Transformer.
[0021] (1) SDCM branch SDCM consists of two core stages: a strip convolution stage and a deformable convolution stage. It captures fine-grained features of closed structure edges and mesh structure branches through sequential processing that focuses directional features to achieve shape adaptation. Simultaneously, residual connections ensure the integrity of feature transfer. Its structure is as follows: Figure 2 As shown.
[0022] In the strip convolution stage, the input features First, a 5×5 depthwise convolution is used to extract local contextual features. Then, a horizontal strip convolution (H Strip Conv) is input, which uses a 1×W narrow convolution kernel to focus on the continuous features of the target in the horizontal direction. Immediately afterwards, an H×1 vertical strip convolution (V Strip Conv) is used to enhance the structural associations of the target in the vertical direction.
[0023] Unlike standard convolutions that extract features from square regions, strip convolutions allow the network to focus more on features along the horizontal or vertical axis. To further enhance the interaction of features across the channel dimensions, pointwise convolutional multiplication is used to encode the resulting features. Finally, the original input features and the encoded features are multiplied element-wise to complete the strip convolution stage.
[0024] While strip convolution effectively focuses on directional features, it remains limited by the fixed kernel structure, making it difficult to adapt to irregular shapes such as blood vessel bifurcation and organ indentation. The core objective of deformable convolution is to break fixed geometric constraints by dynamically adjusting the convolution sampling position to fit the complex boundaries and bifurcation structures of the target.
[0025] The deformable convolution stage dynamically learns the horizontal and vertical offsets of each convolutional sampling point through an additional offset prediction branch (with a kernel size of 3×3). These offsets are used to adjust the sampling position of the standard 3×3 convolution kernel so that the convolution operation can adapt to the irregular shape of the target. The calculation process can be represented by formulas (1) and (2).
[0026] in The feature map output by the strip convolution stage. (·) denotes deformable convolution operation. This is a shape-adaptive feature map output by deformable convolution.
[0027] To improve training stability, After processing, the residuals are added element-wise to the original input features from the strip convolution stage to form strip deformable features. .
[0028] Finally, to further integrate features and output feature maps adapted for subsequent modules, After convolution to adjust the channel dimensions, the final output of the SDCM module is obtained. The process is shown in formulas (3) and (4).
[0029] in The original input features, For batch normalization, This is the activation function.
[0030] (2) CSTM branch The cross-shaped window self-attention is the core innovation of CSTM, and its structure is as follows: Figure 3As shown, it abandons the square window design of SwinTransformer and divides the attention head into two groups, horizontal head (H-Head) and vertical head (V-Head), and calculates the self-attention of horizontal strips and vertical strips in parallel.
[0031] Specifically, based on the preset stripe width SW, the input feature map is divided into... Each horizontal band and There are three vertical stripes, where H represents the height of the convolution kernel and W represents the width of the convolution kernel. The horizontal stripes focus on the horizontal topological relationships of the target, while the vertical stripes enhance the vertical structural continuity. The self-attention calculation process is shown in formulas (5) to (9).
[0032] In the formula, for Normalized input feature map, It is a fully connected layer. , , For the horizontal direction, Query, Key, Value, , , For the vertical Query, Key, and Value, For normalization function, , These are the horizontal and vertical Query-Key dot products, respectively. For the attention head dimension, To output the projection matrix, , These are the self-attention outputs for horizontal and vertical stripes, respectively. This is the feature map after cross-shaped self-attention fusion.
[0033] Through the above design, the effective attention range of each feature pixel at a spatial location is expanded from a local region to a cross-shaped receptive field covering its entire row and column. This allows the model to explicitly model structures with clear orientation. For example, when segmenting retinal vessels, horizontal and vertical context aggregation can effectively infer the linear extension paths of vascular branches, enhancing connectivity preservation for delicate and meandering structures. When segmenting closed structures such as polyps and glands, this mechanism helps integrate contour information of their boundaries in multiple directions, thereby generating a segmentation mask with greater overall consistency and smoothness.
[0034] (3) Dynamic multi-scale kernel module Traditional skip connections often use fixed-size convolutions to achieve a simple fusion of the encoder and decoder, which cannot take into account both the fine-grained details of tiny structures and the global semantics of large targets in medical images, directly limiting the effectiveness of feature transfer.
[0035] This invention proposes a Dynamic Multi-Scale Kernel Module (DMSKM). DMSKM uses global context to drive the generation of dynamic convolutional kernel weights, extracts complementary features through parallel multi-scale deep convolutions, and combines adaptive spatial attention to achieve precise feature calibration, providing feature support for skip connections that combines local details with global semantics. The overall structure of DMSKM is as follows: Figure 4 As shown.
[0036] The module first performs global context encoding on the features concatenated from steps 3.1 and 3.2 using global average pooling. This compresses the spatial dimension to aggregate global channel statistical features and eliminates the interference of local noise on the subsequent generation of kernel weights, resulting in globally context-encoded features. The calculation process is shown in formula (10).
[0037] in, As the normalization factor, This represents the concatenated feature vector. This represents the summation of spatial dimensions; Based on this, the global context features are processed by two different 1×1 convolutions and... Softmax Activation function, to obtain small-scale kernel selection weights Large-scale kernel selection weights The process is as shown in equation (11).
[0038] , The different selection probabilities are intended to enable the model to autonomously determine the most relevant small-scale and large-scale kernels for each individual input instance. Subsequently, the small-scale kernel is selected by choosing the index with the highest probability using formulas (12) and (13). and large-scale kernel .
[0039] in The expression returns the position of the maximum value in the vector; Next, use a kernel size of and The depthwise separable convolution is used for cascaded feature extraction, as shown in equations (14) to (16).
[0040] in Indicates the result after initial convolution. , This represents the feature map generated by small-scale depthwise convolution. Represents the feature map generated by large-scale deep convolution; After completing multi-scale feature extraction, the module will and By splicing along the channel dimension, the initial fusion of multi-scale features is completed, resulting in the fused features of formula (17). .
[0041] Fusion features Parallel average pooling and max pooling are performed to capture the average statistical features and salient semantic features of the spatial dimension, respectively. These two methods complement each other to fully preserve the key information of the spatial dimension. Then, convolution and... Sigmoid Activation function processing to generate spatial attention weights , The process is as shown in equations (18) to (20).
[0042] in Indicates adaptive average pooling. Indicates maximum activation pooling. This represents average spatial attention. This represents maximum spatial attention; Spatial attention weights , Separate and fusion features Element-wise multiplication is performed to achieve adaptive enhancement of spatial dimension, resulting in a weighted feature map. The two weighted features are then added element-wise to obtain the final output of formula (21).
[0043] (4) Group attention gating module The Group Attention Gate Module (GAGM) is a feature fusion unit embedded in the U-shaped network skip connection path and the decoder upsampling branch. Its core function is to achieve adaptive fusion of high-level semantic features of the decoder and low-level spatial features of the encoder. It solves the problems of limited receptive field and semantic gap between high-level semantic information and low-level spatial details when fusion of cross-layer features in traditional attention gating mechanisms. While reducing the computational cost of the model, it enhances the feature activation of target regions in medical images and suppresses the interference of irrelevant background regions. It provides fused features with both semantic consistency and spatial accuracy for the decoder's hierarchical feature decoding and segmentation map reconstruction.
[0044] The Group Attention Gating Module (GAGM) is designed to perform weighted fusion of two types of feature maps through a group attention gating mechanism, enhancing the collaborative representation of different feature maps and achieving topological adaptation of feature fusion. Its structure is as follows: Figure 5 As shown.
[0045] The feature inputs of GAGM come from two core links, one of which is the high-level semantic features output from the pre-decoder layer. These features carry global target category semantic information and high-level structural cognition in the image. The other type is low-level spatial features passed by the encoder at the corresponding level through skip connections. These features preserve the fine-grained edge, texture, and spatial location information of the original image.
[0046] Due to the hierarchical design of encoder downsampling and decoder upsampling, the two input features have an inherent difference in spatial resolution. The module first processes the high-level semantic features... Perform a 2x upsampling operation to map its spatial size to the lower-level spatial features. Completely consistent dimensions. To compensate for the inevitable smoothing of details and attenuation of semantic information caused by upsampling, the upsampled features are further enhanced by 3×3 depthwise separable convolutions for detail restoration and feature enhancement, and then... BN and ReLU The activation function is used to obtain the preprocessed high-level features that complete spatial alignment and semantic enhancement, which are mathematically expressed as (22).
[0047] in Indicates upsampling, This represents a 3×3 depth-separable convolution; The module uses two independent 3×3 grouped convolutions to process the preprocessed high-level semantic features and the original low-level spatial features. BNParallel feature encoding is performed. Grouped convolution divides the channel dimension of the input features into multiple independent groups, and performs convolution operations within each group. Compared with the 1×1 pointwise convolution widely used in traditional attention gating, this design expands the receptive field of the convolution operation without increasing the number of parameters, and can more fully capture the local spatial context and structural features of the target region in medical images. At the same time, the channel decoupling design of grouped convolution reduces the information redundancy between different feature channels, and improves the efficiency and discriminability of feature encoding. The grouped convolution encoding process of the two features can be expressed as formulas (23) and (24), respectively.
[0048] in Grouped convolutional coding features representing high semantic paths This represents the grouped convolutional coding features of the low-level paths.
[0049] The encoded high-level features are added element-wise to the low-level features to achieve preliminary fusion of high-level semantic information and low-level spatial information. The fused features are then processed... ReLU The activation function enhances the effective information representation in the features. Then, the features are fused through a 1×1 pointwise convolution with... BN Multi-channel features are mapped to single-channel feature maps, and then... Sigmoid An activation function is used to generate an attention weight map. Each pixel value in this weight map corresponds to an importance coefficient for the same spatial location in the input feature map. This enables adaptive learning of the discriminative power between target and background regions in medical images, guided by high-level semantic features. Regions containing key segmentation targets such as lesions, organs, and blood vessels are assigned higher weights, while irrelevant background regions are assigned lower weights. Finally, the weight map is combined with the original encoder's low-level spatial features. Element-wise multiplication is performed to complete the adaptive gating calibration of the low-level spatial features, filtering out background noise and redundant information in the low-level features that are irrelevant to the segmentation task, and retaining only the effective spatial details and boundary information that match the high-level semantic features. The above process is as shown in formulas (25) to (27).
[0050] in This represents a mixed attention map. This represents the fusion result of high-level semantic features and low-level semantic features. This represents the final characteristic of the output.
[0051] Step 3: Train the model using the training set data to obtain the optimal model parameters. Step 4: Input the test set data into the trained model and output the segmentation results. Experimental section: To comprehensively verify the topology adaptation capability and cross-scene universality of the proposed EBP-UNet in different medical image scenarios, this invention conducts systematic evaluations on the GlaS colon gland segmentation dataset, the DRIVE fundus retinal vessel segmentation dataset, and the STARE fundus retinal vessel segmentation dataset.
[0052] This experiment was conducted using the Python programming language and the PyTorch deep learning framework. The hardware configuration used was: Intel Core i7-13700K 3.4GHz (turbo boost up to 5.4GHz), 32GB of RAM, and an NVIDIA GeForce RTX 3080 Ti graphics card. The software environment included Windows 11 operating system, PyCharm 2023 integrated development environment, PyTorch 2.2, Python 3.10, and CUDA 12.0.
[0053] Comparative experiment (1) GlaS dataset As shown in Table 1, EBP-UNet achieved a Dice coefficient of 91.10% and an IoU of 83.81% on the GlaS dataset. Experimental results demonstrate that EBP-UNet leads in segmentation accuracy for closed topological structures, accurately distinguishing the boundary regions of adhering glands and suppressing interference from background noise in pathological sections.
[0054] Table 1. Comparison of EBP-UNet and different models on the GlaS dataset. (2) DRIVE dataset The comparison results on the DRIVE dataset are shown in Table 2. The table shows that EBP-UNet's Acc, Sp, and Recall are 96.13%, 97.61%, and 82.70%, respectively. A key characteristic of the DRIVE dataset samples is good uniformity of fundus illumination, but some areas exhibit thin vessel diameters, dense branching, and low terminal contrast. Figure 6 Visualization results show that CS-Net performs poorly in segmenting blood vessel terminals, while FR-Unet and CRMA-UNet exhibit disconnection issues during segmentation, which are particularly severe in the third and fourth rows.
[0055] Table 2 Comparison of EBP-UNet and different models on the DRIVE dataset. (3) STARE dataset The comparison results on the STARE dataset are shown in Table 3. It can be seen that EBP-UNet achieves 97.23% Acc, 98.50% Sp, and 79.21% Recall on the STARE dataset. Compared with other comparison models on this dataset, this invention achieves the best performance in all three metrics (Acc, Sp, and Recall), demonstrating comprehensive and excellent overall segmentation performance. A visualization comparison of EBP-UNet on the STARE dataset is shown below. Figure 7 Compared to methods such as CS-Net and FR-UNet, it can segment the capillary network more completely and continuously, and suppress noise, making it visually closer to the ground truth.
[0056] Table 3 Comparison of EBP-UNet and different models on the STARE dataset. ablation experiment To verify the independent effectiveness of each module in EBP-UNet and the synergistic effect among multiple modules, this experiment selected DUCK-Net as the baseline and adopted a verification strategy of progressively stacking modules. Ablation experiments were conducted on the DRIVE and STARE retinal vessel segmentation datasets. Acc, Sp, and Recall were selected as the core evaluation metrics. By comparing the model performance under different module combinations, the effects of the dual encoder structure composed of the strip deformable convolution module and the CSWin Transformer module, the dynamic multi-scale kernel module, and the grouped attention gating module on the model's modeling ability were quantitatively analyzed. Detailed results of the ablation experiments are shown in Tables 4 and 5.
[0057] Table 4 shows the ablation experimental results on the DRIVE dataset. Table 5 shows the ablation experimental results on the STARE dataset. After the first step of stacking the dual encoder structure (SDCM+CSTM), the Accuracy improved to 95.91%, Sp to 97.42%, and Recall to 80.71% on the DRIVE dataset. On the STARE dataset, the Accuracy improved to 96.60%, Sp to 98.11%, and Recall to 78.22%. This result fully validates the rationality of the dual encoder structure. SDCM focuses on the continuous features of blood vessels in the horizontal and vertical directions through strip convolution, and combines deformable convolution to adaptively fit the irregular boundaries of blood vessel bifurcation and curvature, effectively capturing the fine-grained details of delicate blood vessels. The cross-shaped window self-attention mechanism of CSTM expands the attention receptive domain to a cross shape, which can efficiently model the global topological associations of vascular networks, making up for the efficiency shortcomings of the standard Swin Transformer square window in network structure modeling. Both extract local boundary features and global topological features in parallel, showing stable performance gains in network structure segmentation tasks.
[0058] After the second step of adding DMSKM, the model improved across all metrics on both the DRIVE and STARE datasets. It is reasonable to infer that DMSKM, through its global context-driven dynamic convolutional kernel weight generation mechanism, can adaptively select small or large-scale convolutional kernels based on the boundary distribution of the input vascular features. This achieves accurate matching between the small-scale boundaries of delicate vascular tips and the large-scale contours of the main vascular trunk, effectively solving the problem that traditional skip connections with fixed convolutional kernels struggle to handle multi-scale features, and enhancing the effectiveness of feature transfer between the encoder and decoder.
[0059] After the third step of stacking GAGM, the model performance reached its optimal level. This indicates that GAGM expands the receptive field through grouped convolution, fully capturing the local spatial context of blood vessels. At the same time, guided by the high-level semantic features of the decoder, it adaptively generates attention weight maps, assigning high weights to the target vascular region and low weights to the background noise region, thus solving the semantic gap problem of cross-layer feature fusion.
[0060] In summary, the introduction of each module improved the model's performance in the retinal vessel segmentation task, and the modules exhibited a good synergistic enhancement effect.
[0061] This invention addresses the core problems of existing segmentation models, namely poor adaptability across topological structures and insufficient boundary awareness and mesh topology modeling capabilities. It proposes EBP-UNet, a boundary-aware enhanced U-shaped medical image segmentation model. This model enhances target boundary capture and global topology modeling capabilities by optimizing the dual encoder structure and designing dynamic multi-scale kernels and grouped attention gating modules. Comparative experiments on multiple datasets demonstrate that EBP-UNet outperforms mainstream state-of-the-art models in segmentation tasks involving both closed and mesh topologies. Ablation experiments also verify the independent effectiveness and synergistic gain of each module. This invention overcomes the inherent limitation of traditional models' single-topology adaptation, improving the cross-scene universality of medical image segmentation models.
Claims
1. A U-shaped medical image segmentation method based on boundary-aware enhancement, characterized in that, Includes the following steps: Step 1: Select multiple publicly available medical image segmentation datasets covering different imaging modalities and typical topological structures, and divide them into training and testing sets; Step 2: Build the EBP-UNet model; The EBP-UNet model includes a dual encoder, a dynamic multi-scale kernel module DMSKM, and a grouped attention gating module GAGM. The dual encoder includes a strip deformable convolution module SDCM and a CSWin Transformer module. The strip deformable convolution module SDCM consists of two core stages: a strip convolution stage and a deformable convolution stage. The CSWin Transformer module divides the attention head into two groups: a horizontal head (H-Head) and a vertical head (V-Head), and computes the self-attention of the horizontal and vertical strips in parallel. The dynamic multi-scale kernel module DMSKM drives the generation of dynamic convolutional kernel weights with global context, completes complementary feature extraction through parallel multi-scale deep convolution, and achieves accurate feature calibration by combining adaptive spatial attention, providing feature support for skip connections that combines local details and global semantics. The Group Attention Gating Module (GAGM) is a feature fusion unit embedded in the U-shaped network skip connection path and the decoder upsampling branch. The feature inputs of the GAGM come from two core links, one of which is the high-level semantic features output from the previous layer of the decoder. The other is the low-level spatial features transmitted by the encoder at the corresponding level through skip connections. ; Step 3: Train the model using the training set data to obtain the optimal model parameters; Step 3.1: Generate input features from the input images in the training set through the initial convolutional layer. Input features First, local contextual features are extracted using a 5×5 depthwise convolution. Then, a 1×W horizontal strip convolution and an H×1 vertical strip convolution are used to extract continuous features in the horizontal and numerical directions, respectively. The obtained features are encoded by multiplying them using pointwise convolution. Finally, the original input features and the encoded features are multiplied element-wise to complete the strip convolution stage. Step 3.2: Based on the preset stripe width SW, the input feature map is divided into... Each horizontal band and Each vertical stripe is computed in parallel with the self-attention of the horizontal and vertical stripes. Step 3.3: Input the concatenated features from Step 3.1 and Step 3.2 into the Dynamic Multi-Scale Kernel Module (DMSKM). After global context encoding, the large and small scale convolution kernels are adaptively selected, multi-scale features are extracted in parallel, and feature fusion is completed. Finally, the final features are output after spatial attention weighting calibration. Step 3.4: Obtain the high-level semantic features of the decoder's preceding layer output. Low-level spatial features transmitted by the encoder via skip connections The high-level semantic features output by the decoder are upsampled and spatially aligned and semantically enhanced by depthwise separable convolution. Then, they are grouped and convolved in parallel with the low-level spatial features transmitted by the encoder. After fusion, an attention weight map is generated, and the low-level spatial features are adaptively calibrated to complete the adaptive fusion output of high and low level features. Step 4: Input the test set data into the trained model and output the segmentation results.
2. The U-shaped medical image segmentation method based on boundary awareness enhancement according to claim 1, characterized in that, Step 3.1 includes: dynamically learning the horizontal and vertical offsets of each convolutional sampling point through an offset prediction branch with a convolutional kernel size of 3×3. The offset It is used to adjust the sampling position of the standard 3×3 convolution kernel, enabling the convolution operation to adapt to the irregular shape of the target. The calculation process is as follows: in This is the feature map output by the strip convolution stage. (·) denotes deformable convolution operation. This is a shape-adaptive feature map output by deformable convolution; After processing, the residuals are added element-wise to the original input features from the strip convolution stage to form strip deformable features. : in The original input features, For batch normalization, For activation functions; at last, After convolution to adjust the channel dimensions, the final output of the SDCM module is obtained. : .
3. The U-shaped medical image segmentation method based on boundary awareness enhancement according to claim 2, characterized in that, Step 3.2, the self-attention calculation process, includes: In the formula, for Normalized input feature map, It is a fully connected layer. , , For the horizontal direction, Query, Key, Value, , , For the vertical Query, Key, and Value, For normalization function, , These are the horizontal and vertical Query-Key dot products, respectively. For the attention head dimension, To output the projection matrix, , These are the self-attention outputs for horizontal and vertical stripes, respectively. For splicing operations, This is the feature map after cross-shaped self-attention fusion.
4. The U-shaped medical image segmentation method based on boundary awareness enhancement according to claim 3, characterized in that, Step 3.3 includes the following process: First, global context encoding is performed on the concatenated features from steps 3.1 and 3.2 using global average pooling to obtain globally context-encoded features. The calculation process is as follows: in, As the normalization factor, This represents the concatenated feature vector. This represents the summation of spatial dimensions; Based on this, the global context features are processed by two different 1×1 convolutions and... Softmax Activation function, to obtain small-scale kernel selection weights Large-scale kernel selection weights : in , Indicates the probability of different choices; Then, a small-scale kernel is selected by choosing the index with the highest probability. and large-scale kernel in The expression returns the position of the maximum value in the vector; Next, use a kernel size of and Depthwise separable convolutions are used for cascaded feature extraction: in Indicates the result after initial convolution. , This represents the feature map generated by small-scale depthwise convolution. Represents the feature map generated by large-scale deep convolution; Will and By stitching along the channel dimension, preliminary fusion of multi-scale features is achieved, resulting in fused features. : ; Fusion features Parallel average pooling and max pooling are performed to capture average statistical features and salient semantic features in the spatial dimension, respectively, and then convolution and... Sigmoid Activation function processing to generate spatial attention weights , The formula is as follows: in Indicates adaptive average pooling. Indicates maximum activation pooling. This represents average spatial attention. This represents maximum spatial attention; Spatial attention weights , Separate and fusion features Perform element-wise multiplication to obtain a weighted feature map. Add the two weighted feature maps element-wise to obtain the final output: 。 5. The U-shaped medical image segmentation method based on boundary awareness enhancement according to claim 4, characterized in that, Step 3.4 includes the following process: First, high-level semantic features Perform a 2x upsampling operation to map its spatial size to the lower-level spatial features. With completely consistent dimensions, detail restoration and feature enhancement are achieved through 3×3 depthwise separable convolutions, followed by Batch Normalization (BN) and ReLU activation functions, ultimately yielding preprocessed high-level features that have achieved spatial alignment and semantic enhancement. The formula is as follows: in Indicates upsampling, This represents a 3×3 depthwise separable convolution; The preprocessed high-level semantic features and the original low-level spatial features are subjected to two independent 3×3 grouped convolutions and... BN Parallel feature encoding is performed, and the grouped convolutional encoding process of the two feature paths is represented as follows: in Grouped convolutional coding features representing high semantic paths Grouped convolutional coding features representing low-level paths; The encoded high-level features are added element-wise to the low-level features, and the fused features are then processed... ReLU Activation function, 1×1 pointwise convolution and BN, Multi-channel features are mapped to single-channel feature maps, and then... Sigmoid The activation function generates an attention weight map, which is then compared with the original encoder's low-level spatial features. Element-wise multiplication is performed, retaining only the effective spatial details and boundary information that match the high-level semantic features, as shown in the following formula: in This represents a mixed attention map. This represents the fusion result of high-level semantic features and low-level semantic features. This represents the final characteristic of the output.