A lesion segmentation method based on double-branch coding and foreground-background difference enhancement
By employing the dual-branch encoding of the DCDB-Net model and the foreground-background difference enhancement method, the problem of insufficient global modeling capability of convolutional neural networks in medical image segmentation is solved, improving the segmentation accuracy of complex structures and blurred boundaries, reducing interference from salient and non-salient regions, and achieving more efficient medical image segmentation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NANTONG UNIV
- Filing Date
- 2026-03-23
- Publication Date
- 2026-06-05
AI Technical Summary
Existing convolutional neural networks have insufficient global modeling capabilities in medical image segmentation, making it difficult to handle target regions with complex structures, blurred boundaries, and large scale variations. Furthermore, it is difficult to distinguish between soft boundaries between the foreground and background, and the coexistence of salient and non-salient regions interferes with model feature learning.
We employ the DCDB-Net model based on dual-branch encoding, combining CNN encoding branches and VMamba encoding branches. Through cross-branch guided feature fusion, multi-scale fusion semantic decoupling, learnable feature contrast enhancement, and similarity-difference fusion decoder, we enhance the model's ability to represent foreground and background and reduce interference from salient and non-salient regions.
It improves the accuracy and robustness of medical image segmentation, alleviates the problem of difficulty in distinguishing soft boundaries between foreground and background, and enhances the segmentation accuracy for regions with blurred boundaries and small-scale targets.
Smart Images

Figure CN122156637A_ABST
Abstract
Description
Technical Field
[0001] With the development of medical imaging technology, medical images are playing an increasingly important role in disease diagnosis and treatment decisions. Accurate segmentation of target regions in medical images is one of the key tasks in medical image analysis. However, traditional lesion segmentation methods often rely on human experience or rule-based image processing algorithms, which are not only inefficient but also struggle to obtain stable and accurate segmentation results in complex scenarios.
[0002] In recent years, with the development of deep learning technology, medical image segmentation methods based on convolutional neural networks (CNNs) have received widespread attention. These methods can improve the accuracy of medical image segmentation to a certain extent by automatically learning image features. However, since CNNs mainly rely on local receptive fields for feature extraction, their ability to model long-distance dependencies is limited, and they still have certain limitations when dealing with complex structures, blurred boundaries, and target regions with large scale variations.
[0003] To overcome the limitations of convolutional neural networks in global modeling capabilities, visual models such as Transformer have been introduced into medical image segmentation tasks in recent years. Through self-attention mechanisms, they can more effectively capture global contextual information in images. However, these models typically have high computational complexity and parameter size, requiring significant computational resources. In high-resolution medical image processing, this can easily lead to increased training costs and decreased inference efficiency.
[0004] To address these issues, researchers proposed the Vision Mamba architecture based on a state-space model. This architecture significantly reduces computational complexity and improves computational efficiency while maintaining global modeling capabilities. However, Vision Mamba still has certain limitations in medical image segmentation tasks. For example, its ability to represent fine-grained structural information under complex background conditions is limited, and the segmentation accuracy for regions with blurred boundaries and small-scale target regions needs further improvement. Furthermore, soft boundaries often exist between foreground and background in medical images, making it difficult to accurately distinguish target regions from background regions. Simultaneously, the coexistence of salient and non-salient targets during the training phase can easily interfere with the recognition of key features of the model, thus affecting the overall performance of the segmentation model.
[0005] Therefore, how to further enhance the model's ability to represent foreground, background, and blurred boundary regions in medical images while maintaining high computational efficiency, solve the problem of difficulty in distinguishing between soft boundaries between foreground and background, reduce the interference caused by the coexistence of salient and non-salient regions on the model's key feature learning, and improve the accuracy and robustness of medical image segmentation has become an urgent technical problem to be solved. Summary of the Invention
[0006] Purpose of the invention: To address the shortcomings of the existing technology, a lesion segmentation method based on bi-branch coding and foreground-background difference enhancement is proposed.
[0007] The technical solution adopted in this invention is as follows:
[0008] A lesion segmentation method based on bi-branch coding and foreground-background difference enhancement includes the following steps:
[0009] S1: Obtain the publicly available medical segmentation datasets GLAS, Kvasir-SEG, and BUSI, as well as the segmentation results manually labeled by doctors;
[0010] S2: Data preprocessing, data augmentation, and dataset partitioning;
[0011] S3: Construct the DCDB-Net model, which is a lesion segmentation model based on bi-branch coding and foreground-background difference enhancement;
[0012] S4: Train the DCDB-Net model built in S3 and adjust the parameters;
[0013] S5: Test the trained model on the GlaS, Kvasir-SEG, and BUSI datasets.
[0014] Preferably, in step S2, the acquired GlaS, Kvasir-SEG, and BUSI medical images and their corresponding pixel-level labeled masks are preprocessed, data augmented, and the dataset is partitioned. Specifically, this includes: first, the original medical images are resized to meet the input requirements of the constructed DCDB-Net model; preferably, the input images are uniformly adjusted to [size missing]. Then, the images are normalized to reduce the impact of differences in grayscale or color distribution between different datasets. Next, data augmentation is performed on the training samples, including one or more of random rotation, horizontal flipping, vertical flipping, random brightness and contrast transformation, Gaussian noise perturbation, and random region occlusion. Finally, the dataset is divided into training, validation, and test sets according to a preset ratio, and the processed image data and their corresponding segmentation labels are input into the DCDB-Net model for training and testing.
[0015] Preferably, in step S3, the DCDB-Net model is a lesion segmentation model based on dual-branch encoding and foreground-background difference enhancement, including a CNN encoding branch, a VMamba encoding branch, a cross-branch guided interaction fusion module (CGIF), a multi-scale fusion semantic decoupling module (MFSD), a learnable feature contrast enhancement module (LFCE), and a similarity-difference fusion decoder (SDF). The DCDB-Net model first inputs the medical image into both a CNN encoding branch and a VMamba encoding branch. The CNN encoding branch is used to extract local texture information and edge detail features, while the VMamba encoding branch is used to extract long-range dependency features and global semantic information. Then, at the corresponding scale, the cross-branch guided feature fusion module interacts and fuses the output features of the two branches to obtain multi-scale fused features. Next, the multi-scale fusion semantic decoupling module is used to semantically decouple the multi-scale fused features to obtain foreground semantic features, background semantic features, and semantic features of uncertain regions. Subsequently, the fused features and foreground and background guided features are input into a learnable feature contrast enhancement module to obtain differential enhancement features that highlight the foreground region and suppress background interference. Finally, the differential enhancement features are input into a similarity-difference fusion decoder to gradually restore the spatial resolution and output the final medical image segmentation result.
[0016] Preferably, in step S3, the CNN encoding branch includes multiple downsampling units and residual blocks, used to extract local texture features and edge detail features step by step to form hierarchical convolutional features; the VMamba encoding branch includes a PatchEmbedding module, a downsampling module, and a visual state space block, used to extract hierarchical state space features with global context dependencies step by step; the CNN encoding branch and the VMamba encoding branch output feature maps at corresponding scales for subsequent cross-branch guided feature fusion modules to perform feature fusion.
[0017] Preferably, in step S3, the specific operation process of the cross-branch guided feature fusion module fusing CNN coding branch features and VMamba coding branch features is as follows: First, global average pooling and global max pooling are performed on the CNN coding branch features and VMamba coding branch features respectively to generate their respective spatial description information; then, the spatial description information is input into the convolutional transformation unit to generate corresponding cross-branch guided weights; then, the guided weights generated by the CNN coding branch are used to modulate the VMamba coding branch features, and the guided weights generated by the VMamba coding branch are used to modulate the CNN coding branch features to achieve interactive guidance between the two branches; subsequently, the CNN coding branch features enhanced by interactive guidance and the VMamba coding branch features are concatenated and fused in the channel dimension to obtain the initial fused features; the initial fused features are input into the channel attention module CAM for channel weight recalibration, and the spatial attention weight maps corresponding to the CNN coding branch features and the VMamba coding branch features are summed to generate fused guided weights, and the fused features are weighted and enhanced using the fused guided weights, and finally, residual connections are performed with the original fused features to obtain the final fused features and output them for use by subsequent modules.
[0018] Preferably, in step S3, the multi-scale fusion semantic decoupling module includes the following processing steps: First, the features fused by the mid-to-high-level cross-branch guided feature fusion module are selected, scale-aligned, and spliced and fused in the channel dimension; then, the spliced features are adaptively weighted through a channel attention mechanism to obtain shared fused features, and further enhanced with dilated convolution for context; next, the shared fused features are input into the semantic decoupling layer to construct a foreground semantic branch, a background semantic branch, and an uncertain region semantic branch, and foreground features, background features, and uncertain region features are extracted respectively; subsequently, the foreground features, background features, and uncertain region features are convolutionally mapped and progressively upsampled to generate foreground auxiliary prediction maps, background auxiliary prediction maps, and uncertain region auxiliary prediction maps; simultaneously, the foreground features and background features are adjusted to the spatial resolution corresponding to the backbone features at different scales, and then input into the subsequent learnable feature contrast enhancement module for foreground-background difference enhancement; finally, the foreground auxiliary prediction maps, background auxiliary prediction maps, and uncertain region auxiliary prediction maps are used to construct an auxiliary supervision loss to constrain the network's representation ability of the target region, background region, and blurred boundary region.
[0019] Preferably, in step S3, the specific operation flow of the learnable feature contrast enhancement module is as follows: First, the input fusion features are input into the convolutional mapping unit for feature transformation to obtain a basic feature representation, and the basic feature representation is mapped to a feature space of a preset dimension; then, the foreground guiding features and background guiding features are respectively subjected to feature transformation and pooling processing, and foreground attention matrices and background attention matrices are generated through independent linear mapping, and foreground attention weights and background attention weights are obtained through normalization operations; then, the basic feature representation is used as a value feature after linear mapping, and the value feature is expanded locally; using the foreground attention weights and background attention weights... Note that the weights are applied to the expanded value features to obtain foreground enhancement features and background enhancement features. Subsequently, the foreground enhancement features and background enhancement features are explicitly contrasted and fused. The foreground enhancement features are subtracted from the background enhancement features modulated by the learnable contrast intensity coefficient to highlight the discriminative difference between the target region and the background region. Finally, the contrast-fused features are residually connected with the basic feature representation to obtain the difference enhancement features. The difference enhancement features are then input into the convolutional output unit for feature reconstruction to obtain the output features of the learnable feature contrast enhancement module, thereby improving the model's ability to segment target boundaries, fine-grained structures, and foreground-background boundary regions.
[0020] Preferably, in step S3, the specific operation flow of the similarity-difference fusion decoder is as follows: First, the input high-level semantic features are bilinearly upsampled and channel-aligned through convolutional mapping to ensure they have the same spatial resolution and number of channels as the current layer features. Next, the upsampled and channel-aligned high-level semantic features are multiplied element-wise with the current layer features to obtain similarity features. Simultaneously, the upsampled and channel-aligned high-level semantic features are subtracted element-wise from the current layer features, and the absolute value is taken to obtain difference features. Then, the similarity features, difference features, and current layer features are concatenated through channels and fused via convolution to obtain preliminary decoded features. The preliminary decoded features are then weighted and fused with the upsampled and channel-aligned high-level semantic features using residuals to form the current layer decoded features. Subsequently, the current layer decoded features are processed through multiple convolutional units in a residual dense convolutional block for multi-level feature extraction and local feature fusion, progressively restoring spatial details, and combined with a Convolutional Block Attention Module (CBAM). Feature enhancement is performed in both the channel and spatial dimensions. Finally, without the need for an additional output module, the features enhanced by CBAM are used as the current layer's decoding features for subsequent resolution restoration and the generation of the final medical image segmentation prediction results.
[0021] Preferably, in step S4, the initialization of training hyperparameters includes: setting the input image size to 256, the batch size to 8, the number of training epochs to 300, and the initial learning rate to... The number of early stopping rounds was set to 150; the Adam optimizer was used during training; the DiceBCELoss loss function was used for supervision of the final segmentation result, foreground and background branches; the ExclusivityLoss loss function was introduced for supervision of uncertain region branches; a cosine annealing preheating and restart learning rate scheduling strategy was adopted, and the validation set mIoU was used as the basis for saving the optimal model; after training, the trained model weights and training logs were saved for subsequent analysis and testing.
[0022] Preferably, in step S5, the trained DCDB-Net model is tested on the GlaS, Kvasir-SEG, and BUSI datasets. The test images are input into the DCDB-Net model, and the corresponding medical image segmentation results are output. One or more evaluation metrics among mIoU, Dice, Precision, and Recall are used to quantitatively evaluate the model's segmentation performance to verify the model's effectiveness and generalization ability in glandular segmentation, polyp segmentation, and breast ultrasound image segmentation tasks.
[0023] Beneficial effects: This invention effectively alleviates the problem of difficulty in distinguishing soft boundaries between foreground and background, while also reducing the interference caused by the coexistence of salient and non-salient objects during the training phase on the model's key feature recognition, thereby improving the model's feature learning and target discrimination capabilities. Attached Figure Description
[0024] Figure 1 This is a flowchart of a lesion segmentation method based on bi-branch coding and foreground-background difference enhancement according to the present invention.
[0025] Figure 2 Example diagram for a medical image segmentation dataset.
[0026] Figure 3 This is a model structure diagram of a lesion segmentation method based on bi-branch coding and foreground-background difference enhancement according to the present invention.
[0027] Figure 4 This is a structural diagram of a cross-branch guided feature fusion module for a lesion segmentation method based on bi-branch coding and foreground-background difference enhancement according to the present invention.
[0028] Figure 5 This is a visual state space block structure diagram of a lesion segmentation method based on bi-branch coding and foreground-background difference enhancement according to the present invention.
[0029] Figure 6This is a schematic diagram of a learnable feature contrast enhancement module for a lesion segmentation method based on bi-branch coding and foreground-background difference enhancement according to the present invention.
[0030] Figure 7 This is a schematic diagram of the similarity-difference fusion decoder module of a lesion segmentation method based on dual-branch coding and foreground-background difference enhancement according to the present invention.
[0031] Figure 8 Example visualizations of the segmentation results of the method presented in this paper on the GlaS, Kvasir-SEG, and BUSI datasets. Detailed Implementation
[0032] The present invention will be further explained below with reference to the accompanying drawings and specific embodiments.
[0033] This invention proposes a lesion segmentation method based on bi-branch coding and foreground-background difference enhancement. The overall process is as follows: Figure 1 As shown, the specific steps include:
[0034] S1: Obtain the medical image segmentation dataset and the results of manual annotation by doctors.
[0035] We acquired publicly available medical segmentation datasets, including GlaS, Kvasir-SEG, and BUSI, and obtained doctor-manufactured segmentation labels that correspond one-to-one with the original medical images. Specifically, the GlaS dataset is for gland segmentation, the Kvasir-SEG dataset is for polyp segmentation, and the BUSI dataset is for breast ultrasound image segmentation. The doctor-manufactured labels are pixel-level mask labels corresponding to the original medical images. Each label includes at least a target region and a background region. The target region corresponds to the lesion, organ, or tissue to be segmented, and the background region corresponds to non-target regions.
[0036] like Figure 2 As shown, medical images from different datasets exhibit significant differences in imaging modality, texture structure, grayscale distribution, and target morphology. Specifically, the GlaS dataset represents glandular tissue structures, the Kvasir-SEG dataset represents gastrointestinal polyp regions, and the BUSI dataset represents breast ultrasound lesion regions. This invention improves the model's ability to segment lesions with different boundary morphologies and scales by combining these multiple medical segmentation datasets.
[0037] S2: Data preprocessing, data augmentation, and dataset partitioning
[0038] The original medical images and their labeled masks are preprocessed to meet the model input requirements. Specifically, the original images are uniformly adjusted to a preset size; in this embodiment, the input image size is preferably set to 256×256. The images are normalized to reduce the impact of differences in brightness, color, or grayscale distribution between different datasets. Data augmentation is performed on the training samples, including one or more of the following: random rotation, horizontal flipping, vertical flipping, random brightness and contrast changes, Gaussian noise perturbation, and random region occlusion.
[0039] Furthermore, the preprocessed image data and its corresponding label data are divided into training set, validation set and test set according to a preset ratio for model training, parameter adjustment and performance testing.
[0040] S3: Constructing a DCDB-Net model based on dual-branch encoding and foreground-background difference enhancement.
[0041] like Figure 3 As shown, the DCDB-Net model of this invention generally includes a CNN encoding branch, a VMamba encoding branch, a Cross-branch Guided Interaction Fusion (CGIF) module, a Multi-scale Fusion Semantic Decoupling (MFSD) module, a Learnable Feature Contrast Enhancement (LFCE) module, and a Similarity-Difference Fusion decoder (SDF decoder).
[0042] Let the input medical image be ,in, and These represent the height and width of the input image, respectively.
[0043] S3.1: Dual-branch coding feature extraction
[0044] First, input image Simultaneously inputting CNN encoding branch and VMamba encoding branch. The CNN encoding branch is used to extract local texture details, edge contours, and shallow structure information; the VMamba encoding branch is used to extract long-range dependencies and global context information. Let the... The output features of the CNN encoding branch at each scale are , No. The output features of VMamba encoding branches at each scale are: In this embodiment, the feature resolution can be gradually decreased from shallow to deep, for example from... Gradually decrease to This is to form a hierarchical, multi-scale feature representation.
[0045] S3.2: Cross-branch guided interaction integration
[0046] like Figure 4 As shown, the CNN encoding branch features are performed at the corresponding scale. Features of VMamba encoding branches Input the CGI-Fusion module to guide cross-branch interactive fusion.
[0047] Specifically, respectively and Global average pooling and global max pooling are performed to generate guiding description information; then, the corresponding guiding weights are generated through convolutional transformation units. Let the guiding weights generated by the CNN branch be... The bootstrap weight generated by the VMamba branch is The interactive guidance process can then be represented as:
[0048] (1)
[0049] (2)
[0050] in, This represents element-wise multiplication. This represents the activation function.
[0051] Next, the enhanced bi-branch features are fused to obtain:
[0052] (3)
[0053] The fused features are then enhanced by channel-weighted attention module (CAM), and modulated by the sum of guided weights from the CNN and VMamba branches. This modulated feature is then residually connected to the attention-enhanced result of the original fused features to obtain the final fused features. The calculation method can be expressed as follows:
[0054] (4)
[0055] like Figure 3 and Figure 4 As shown in the figure, the fusion symbol in the circle represents the feature fusion operation, which can correspond to feature concatenation or element-wise summation in different modules; "CAM" represents the channel attention module; "CBR" represents the convolutional unit composed of convolution, batch normalization and ReLU activation.
[0056] S3.3: Visual State Space Modeling in the VMamba Encoding Branch
[0057] like Figure 5 As shown, the VMamba encoding branch uses VSS Block for feature modeling. VSS Block includes a normalization layer, a linear mapping layer, a depthwise separable convolutional layer, a SiLU activation layer, and a selective scanning two-dimensional module SS2D.
[0058] Let the input features be Then the VSS Block can be represented as:
[0059] (5)
[0060]
[0061] in, Represents a linear transformation layer. Representation layer normalization, This represents depthwise separable convolution. Indicates the gating branch feature, This indicates the output characteristics of the VSS Block.
[0062] Furthermore, such as Figure 5 The lower part shows that the SS2D module performs multi-directional rearrangement and scanning of the two-dimensional feature map, and then uses a state-space model for sequence modeling. Let the input sequence be... Hidden state is Then the discrete state-space model can be expressed as:
[0063]
[0064] in, The discrete state transition matrix, For discrete input mapping matrix, To output the mapping matrix, This is a directly connected entry. Because VMamba uses a selective scanning mechanism, therefore... , and It can adapt to changes in input content, thereby enhancing the model's ability to jointly model local structure and global context.
[0065] Figure 5 In this context, “Linear” represents a linear projection layer, “DWConv” represents a depthwise convolution, “SiLU” represents a nonlinear activation function, “SS2D” represents a two-dimensional selective scan state space module, and “⊕” represents a residual addition operation.
[0066] S3.4: Multi-scale fusion semantic decoupling
[0067] like Figure 3 As shown at the bottom, this invention performs scale alignment, concatenation, and semantic decoupling processing on mid-to-high-level multi-scale fusion features in the Multi-Scale Fusion Semantic Decoupling (MFSD) module. Let the features participating in the fusion be... , and Among them Using spatial resolution as a reference scale, and Adjust to The same resolution is then used for stitching and fusion along the channel dimension. The process is represented as follows:
[0068] (12)
[0069] in, This indicates that the feature map is adjusted to match the desired image size through upsampling or downsampling operations. Same spatial resolution.
[0070] Subsequently, channel attention and multi-scale convolution enhancements are applied to the fused features to obtain shared fused features:
[0071] (13)
[0072] in, This indicates the channel attention module. This represents the hollow space pyramid pooling module.
[0073] In terms of shared integration characteristics Based on this, foreground branches, background branches, and uncertain region branches are constructed respectively, resulting in:
[0074] (14)
[0075] in, Representing foreground semantic features, Indicates background semantic features, Represents semantic features of uncertain regions. , and These represent three independent learnable mapping functions used to extract shared features. Semantic features representing the foreground, background, and uncertain regions are extracted.
[0076] Furthermore, auxiliary prediction maps are output separately:
[0077]
[0078] in, , and This represents three independent prediction heads used to map corresponding semantic features to class response maps (logits); Up( ) indicates an upsampling operation, used to restore the prediction result to the input resolution.
[0079] S3.5: Learnable Feature Contrast Enhancement
[0080] like Figure 6 As shown, the fusion features After dilated convolution, then with foreground-guided features Background guidance features The input learnable feature contrast enhancement module (LFCE) is used to enhance the difference, highlighting the target region and suppressing background interference.
[0081] First, the input fusion features Perform convolutional mapping to obtain the basic feature representation:
[0082] (18)
[0083] in, This represents a convolutional mapping unit consisting of a convolutional layer, a batch normalization layer, and a ReLU activation function.
[0084] Subsequently, the basic features Value features are obtained through linear mapping, and local neighborhood expansion is performed:
[0085] (19)
[0086] in, This represents a linear mapping operation. This indicates a local neighborhood expansion operation, used to extract features within a local window.
[0087] Next, attention weights are calculated based on foreground-guided features and background-guided features respectively:
[0088] (20)
[0089] (twenty one)
[0090] in:
[0091] Indicates the foreground query mapping parameters; Indicates background query mapping parameters; This represents the normalization operation, used to generate attention weights.
[0092] Subsequently, foreground and background aggregation are performed on the value features:
[0093] (twenty two)
[0094] (twenty three)
[0095] in, This indicates that the unfolded local features will be restored to a spatial feature map.
[0096] Next, differential enhancement features are calculated using explicit contrast enhancement:
[0097] (twenty four)
[0098] in, It is a learnable contrast intensity coefficient used to control the intensity of background suppression.
[0099] To preserve original feature information and improve training stability, residual connections are introduced:
[0100] (25)
[0101] Finally, the enhanced features are processed through convolutional mapping to obtain the output features of the LFCE module:
[0102] (26)
[0103] in, This represents the output features after learnable feature contrast enhancement, which are used as input to the subsequent decoding module to improve the model's ability to segment the target region boundaries and fine-grained structures.
[0104] Figure 6 In this context, "Softmax" indicates normalized attention weight calculation, "Reshape" indicates dimension reshaping operation, and "Fold / Unfold" indicates local neighborhood unfolding and unfolding operations, respectively.
[0105] S3.6: Similarity-Difference Fusion Decoding
[0106] like Figure 7 As shown, the multi-scale features enhanced by LFCE are input into the SDF Decoder for decoding. Let the features of the current layer be... Higher-level features are First, the high-level features are upsampled and then channel aligned:
[0107] (27)
[0108] in, This indicates a bilinear upsampling operation. express Convolution is used for channel mapping.
[0109] Then, similarity features and difference features are constructed:
[0110] (28)
[0111] (29)
[0112] in, This represents element-wise multiplication. This indicates the absolute difference operation.
[0113] Simultaneously retain the features of the current layer. And the three features are concatenated in the channel dimension:
[0114] (30)
[0115] The fused features are then obtained through convolutional mapping:
[0116] (31)
[0117] in, This represents a convolutional unit consisting of convolution, batch normalization, and ReLU activation.
[0118] Then, enhanced features are obtained through residual fusion:
[0119] (32)
[0120] in, These are the learnable residual weight coefficients.
[0121] To further enhance feature representation capabilities, a residual-dense structure is introduced. Let the intermediate feature be... Then there is
[0122] (33)
[0123] (34)
[0124] (35)
[0125] Piecing together dense features:
[0126] (36)
[0127] Then obtain through local feature fusion
[0128] (37)
[0129] Then residual enhancement is performed:
[0130] (38)
[0131] in, This is the residual scaling factor.
[0132] Finally, feature enhancement is performed using channel attention and spatial attention modules:
[0133] (39)
[0134] in, This indicates the channel attention module. This represents the spatial attention module.
[0135] Finally, the decoded features are obtained through residual connections:
[0136] (40)
[0137] The attention-enhanced feature input / output module progressively restores spatial resolution and generates the final medical image segmentation result:
[0138] (41)
[0139] in, Figure 7 The Output block in the diagram represents the output module, which is used to map the decoded features into the final medical image segmentation prediction map.
[0140] S4: Train the DCDB-Net model built in S3 and adjust the parameters.
[0141] Training and parameter optimization were performed on the DCDB-Net model built in stage S3. The hyperparameters were initialized as follows during training: input image size was set to 256×256, batch size to 8, number of training epochs to 300, and initial learning rate to [value missing]. The number of early stopping wheels is set to 150.
[0142] The Adam optimizer is used during training, and the loss function is designed as a combined loss: the DiceBCELoss loss function is used for supervision of the final segmentation result, foreground, and background branches; the ExclusivityLoss loss function is introduced for supervision of uncertain region branches, and its definition is as follows:
[0143] (42)
[0144] in , , These represent the predicted probabilities of the foreground, background, and uncertain regions, respectively. This loss is used to constrain the mutual exclusivity between the categories.
[0145] The learning rate scheduling strategy employs cosine annealing with warm-up restarts. During model training, the mean Intersection over Union (mIoU) on the validation set is used as the metric to select and save the best-performing model weights. After training is complete, the final model weights and complete training logs are saved for subsequent analysis and testing.
[0146] S5: Test the trained model on the GlaS, Kvasir-SEG, and BUSI datasets.
[0147] Figure 8 This paper presents examples of the segmentation performance of this method on three datasets: GlaS, Kvasir-SEG, and BUSI. Each column represents the original image, the gold standard, and the segmentation prediction result, respectively.
[0148] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A lesion segmentation method based on bi-branch coding and foreground-background difference enhancement, characterized in that, Includes the following steps: S1: Obtain the publicly available medical segmentation datasets GLAS, Kvasir-SEG, and BUSI, as well as the segmentation results manually labeled by doctors; S2: Data preprocessing, data augmentation, and dataset partitioning; S3: Construct the DCDB-Net model, which is a lesion segmentation model based on bi-branch coding and foreground-background difference enhancement; S4: Train the DCDB-Net model built in S3 and adjust the parameters; S5: Test the trained model on the GlaS, Kvasir-SEG, and BUSI datasets.
2. The lesion segmentation method based on bi-branch coding and foreground-background difference enhancement according to claim 1, characterized in that, In step S1: the GlaS dataset is a gland segmentation dataset, the Kvasir-SEG dataset is a polyp segmentation dataset, and the BUSI dataset is a breast ultrasound image segmentation dataset; the segmentation label data manually marked by the doctor is a pixel-level annotation mask that corresponds one-to-one with the original medical image; The pixel-level annotation mask includes at least a target region and a background region, wherein the target region is the lesion to be segmented and the background region is a non-target region; the original medical image and the corresponding segmentation label data are consistent in spatial size and are used to construct training samples, validation samples and test samples.
3. The lesion segmentation method based on bi-branch coding and foreground-background difference enhancement according to claim 2, characterized in that, Step S2 includes the following steps: S2.1: Perform size unification processing on the original medical images to ensure that the input images meet the input requirements of the network model; S2.2: Normalize the original medical images to reduce the differences in grayscale or color distribution between different datasets; S2.3: Perform data augmentation on the training samples, wherein the data augmentation includes one or more of the following operations: random rotation, horizontal flipping, vertical flipping, random brightness-contrast transformation, Gaussian noise perturbation, and random region occlusion; S2.4: Divide the dataset into training set, validation set and test set according to the preset ratio; S2.5: Input the processed image data and its corresponding segmentation labels into the DCDB-Net model for training and testing.
4. The lesion segmentation method based on bi-branch coding and foreground-background difference enhancement according to claim 1, characterized in that, The DCDB-Net model described in step S3 includes a CNN encoding branch, a VMamba encoding branch, a cross-branch guided feature fusion module, a multi-scale fusion semantic decoupling module, a learnable feature contrast enhancement module, and a similarity-difference fusion decoder, specifically including the following steps: S3.1: Input the medical image into both the CNN encoding branch and the VMamba encoding branch to extract local detail features and global context-dependent features, respectively; S3.2: At multiple scales, the cross-branch guided feature fusion module is used to interactively fuse the features output by the CNN coding branch and the VMamba coding branch to obtain multi-scale fused features; S3.3: The multi-scale fusion semantic decoupling module is used to perform semantic decoupling processing on the multi-scale features after cross-guided interactive fusion, and the fused features are decomposed into foreground semantic features, background semantic features and uncertain region semantic features. S3.4: Input the fused features output by the cross-branch guided feature fusion module and the foreground and background features output by the multi-scale fusion semantic decoupling module into the learnable foreground-background feature comparison module to obtain differential enhancement features that enhance the foreground region and suppress the background region. S3.5: The enhanced features are input into the similarity-difference fusion decoder. The similarity and difference features between the high-level semantic features and the current layer features are calculated and weighted and fused. At the same time, the convolutional unit and CBAM attention mechanism are combined to enhance the features. The enhanced features are input to the output module to gradually restore the spatial resolution and output the final medical image segmentation result.
5. The lesion segmentation method based on bi-branch coding and foreground-background difference enhancement according to claim 4, characterized in that, In step S3.1, the CNN encoding branch is used to extract local texture and edge detail features, and the VMamba encoding branch is used to extract long-range dependency features and global semantic information. The CNN encoding branch includes multiple downsampling units and residual blocks to form hierarchical convolutional features. The VMamba encoding branch includes a Patch Embedding module, a downsampling module, and a visual state space block to form hierarchical state space features. The CNN encoding branch and the VMamba encoding branch output feature maps at corresponding scales for subsequent cross-branch guided feature fusion modules to perform feature fusion.
6. The lesion segmentation method based on bi-branch coding and foreground-background difference enhancement according to claim 5, characterized in that, The cross-branch guided feature fusion module mentioned in step S3.2 includes the following steps: S3.2.1: Perform global average pooling and global max pooling on the CNN encoding branch features and VMamba encoding branch features respectively to generate corresponding spatial description information; S3.2.2: Input the spatial description information into the convolutional transform unit to generate weight information for cross-branch guidance; S3.2.3: Modulate the VMamba encoding branch features using the guiding weights generated by the CNN encoding branch, and simultaneously modulate the CNN encoding branch features using the guiding weights generated by the VMamba encoding branch; S3.2.4: The CNN coding branch features enhanced by interactive guidance and the VMamba coding branch features are concatenated and fused in the channel dimension to obtain the fused features; the fused features are input into the channel attention module (CAM) for channel weight calculation to recalibrate the importance of different channel features; then, the spatial attention weight maps corresponding to the CNN coding branch features and the VMamba coding branch features are summed to generate fusion guidance weights, and the fused features are weighted and enhanced using the fusion guidance weights, while residual connections are made with the original fused features to obtain the final fused features; S3.2.5: Output the fused multi-scale features for use by subsequent modules.
7. The lesion segmentation method based on bi-branch coding and foreground-background difference enhancement according to claim 6, characterized in that, The multi-scale fusion semantic decoupling module described in step S3.3 includes the following steps: S3.3.1: Select the features fused by the cross-branch guided feature fusion module in the middle and high levels, perform scale alignment, and then perform splicing and fusion in the channel dimension. Adaptively weight the spliced features through the channel attention mechanism to obtain shared fused features. Then, use the hollow space pyramid pooling module to capture multi-scale receptive field information to enhance feature expression ability. S3.3.2: Input the shared fusion features into the semantic decoupling layer to construct a foreground semantic branch, a background semantic branch, and an uncertain region semantic branch, and extract foreground features, background features, and uncertain region features respectively; S3.3.3: Perform convolution mapping and stepwise upsampling on the foreground features, background features and uncertain region features respectively to generate foreground auxiliary prediction map, background auxiliary prediction map and uncertain region auxiliary prediction map; S3.3.4: After adjusting the foreground and background features to the spatial resolution corresponding to the main features at different scales, input them into the subsequent learnable feature contrast enhancement module to enhance the difference between the foreground and background; S3.3.5: Construct an auxiliary supervision loss using the foreground auxiliary prediction map, background auxiliary prediction map, and uncertain region auxiliary prediction map to constrain the network's ability to represent the target region, background region, and region with blurred boundaries.
8. The lesion segmentation method based on bi-branch coding and foreground-background difference enhancement according to claim 7, characterized in that, The learnable feature contrast enhancement module described in step S3.4 includes the following steps: S3.4.1: Input the input fusion features into the convolutional mapping unit for feature transformation to obtain the basic feature representation, and map the basic feature representation to a feature space of a preset dimension; S3.4.2: Perform feature transformation and pooling on the foreground guiding features and background guiding features respectively, and generate foreground attention matrix and background attention matrix respectively through independent linear mapping. Then, obtain foreground attention weight and background attention weight through normalization operation. S3.4.3: The basic feature representation is linearly mapped to the value feature, and the value feature is expanded into a local neighborhood; the expanded value feature is weighted and aggregated using the foreground attention weight and background attention weight respectively to obtain the foreground enhancement feature and the background enhancement feature; S3.4.4: Explicitly contrast-fuse the foreground enhancement features and background enhancement features, subtracting the background enhancement features modulated by the learnable contrast intensity coefficient from the foreground enhancement features to enhance the foreground lesion features and suppress background interference; and perform residual connection between the contrast-fuse features and the basic feature representation to obtain the differential enhancement features; S3.4.5: Input the difference enhancement features into the convolution output unit for feature reconstruction to obtain the output features of the LFCE module, and input the output features into the subsequent decoding module to improve the model's ability to segment target boundaries, fine-grained structures and foreground-background boundary regions.
9. The lesion segmentation method based on bi-branch coding and foreground-background difference enhancement according to claim 8, characterized in that, The similarity-difference fusion decoder described in step S3.5 includes the following steps: S3.5.1: Perform bilinear upsampling on the input high-level semantic features and channel alignment through convolution mapping to make them have the same resolution and number of channels as the current layer features; S3.5.2: Multiply the upsampled and channel-aligned high-level semantic features element-wise with the current layer features to obtain similarity features; S3.5.3: Subtract the upsampled and channel-aligned high-level semantic features from the current layer features element by element and take the absolute value to obtain the differential features; S3.5.4: Concatenate the similarity features, difference features and the upsampled and channel-aligned high-level semantic features through channel concatenation, and obtain the preliminary decoded features through convolution fusion; S3.5.5: The preliminary decoded features and upsampled features are weighted and fused using residuals, and then multi-level feature extraction and local feature fusion are performed through residual dense convolutional blocks; S3.5.6: Input the fused features into the Convolutional Block Attention (CBAM) module for channel and spatial dimension feature enhancement, and finally output the decoded features of the current layer.
10. The lesion segmentation method based on bi-branch coding and foreground-background difference enhancement according to claim 9, characterized in that, In step S4, the initialization of training hyperparameters includes: setting the input image size to 256, the batch size to 8, the number of training epochs to 300, and the initial learning rate to... The number of early stopping rounds was set to 150; the Adam optimizer was used during training; the DiceBCELoss loss function was used for supervision of the final segmentation result, foreground and background branches; the ExclusivityLoss loss function was introduced for supervision of uncertain region branches; a cosine annealing preheating and restart learning rate scheduling strategy was adopted, and the validation set mIoU was used as the basis for saving the optimal model; after training, the trained model weights and training logs were saved for subsequent analysis and testing. In step S5, the trained DCDB-Net model is tested on the GlaS, Kvasir-SEG, and BUSI datasets. The test images are input into the DCDB-Net model, which outputs the corresponding medical image segmentation results. One or more evaluation metrics, including mIoU, Dice, Precision, and Recall, are used to quantitatively evaluate the model's segmentation performance to verify its effectiveness and generalization ability in glandular segmentation, polyp segmentation, and breast ultrasound image segmentation tasks.