A medical image segmentation method based on boundary prior guidance and related equipment
Patent Information
- Application Number
- CN202610804555.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-05
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2046-06-05
AI Technical Summary
部分医学图像分割方法通过增加边界预测分支增强模型对边界的关注,但其通常仅对边界增强分支单独施加边界监督,未进一步约束主分割掩码的边缘与边界增强分支预测结果保持一致,容易出现主分割区域与边界预测结果不匹配的问题
[0020]可理解,本申请提供的基于边界先验引导的医学图像分割方法、装置、电子设备及存储介质,在医学图像分割模型(装置)的输入阶段,先将医学图像生成后续阶段统一使用的边界先验图,在编码阶段和解码阶段中统一使用该边界先验图,使得下采样特征和边界感知融合特征的生成都受到边界先验图的引导,能够在不同网络层级保持边界响应的一致性,减少由于多阶段边缘信息来源不同造成的边界漂移、响应冲突和重复计算问题,提升医学图像分割结果的边界精确度和稳定性,如让模型在病灶或器官的边界处划分得更清楚。同时,在编码阶段下采样过程中,直接根据边界先验图动态融合多尺度跳跃特征和与其对应的由增强后的深层语义特征,使边界信息在分辨率降低之前参与特征选择,从而减少弱边界、细小目标和不规则轮廓在下采样过程中的信息丢失。解码阶段能够利用上采样特征和边界先验图共同筛选浅层特征,即跳跃特征,能够抑制背景纹理干扰,并增强目标边界相关特征。
Smart Images

Figure CN122368504B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a medical image segmentation method and related equipment based on boundary prior guidance. Background Technology
[0002] Medical image segmentation is a crucial step in medical image analysis and computer-aided diagnosis. Its purpose is to automatically extract target regions such as lesions, organs, tissues, and cell nuclei from medical images. Accurate medical image segmentation results can assist doctors in lesion localization, quantitative measurement, disease diagnosis, treatment plan development, and efficacy evaluation.
[0003] Target boundaries in medical images typically exhibit characteristics such as weak grayscale variations, similar textures, blurred boundaries, and irregular shapes. To improve medical image segmentation performance, various methods have been employed to enhance U-Net. While these existing improvements offer some performance gains, they still fall short of accurately reconstructing target boundaries in medical images. For instance, existing skip connections easily introduce background noise. Ordinary U-Net directly concatenates shallow features from the encoder module with features from the decoder module. While the shallow features from the encoder module contain rich edge, texture, and spatial details, they also include background textures, false edges, noise, and irrelevant structures. Directly fusing these features can lead to background missegmentation or boundary misclassification.
[0004] Existing methods are prone to losing target boundary information during downsampling. Target boundaries in medical images typically exhibit characteristics such as weak grayscale variations, similar textures, blurred boundaries, and irregular shapes. Traditional max-pooling or stride convolution downsampling, while reducing feature map resolution, may weaken the response of small targets and blurred boundary regions, making it difficult to recover accurate boundaries in subsequent decoding stages.
[0005] Existing multi-scale contextual modeling methods do not adequately utilize boundary information. Traditional multi-scale modules typically expand the receptive field through convolutions at different scales or with different dilation rates to enhance the model's ability to represent targets at different scales. However, such methods usually focus on scale variations and global context, failing to explicitly distinguish and model local texture, global semantics, and boundary responses. This results in enhanced deep semantic features potentially overshadowing fine-grained boundary information.
[0006] Existing boundary-assisted supervision output head methods lack consistency constraints between the main segmentation results and the output head. Some medical image segmentation methods enhance the model's attention to boundaries by adding boundary prediction branches, but these methods typically only apply boundary supervision to the boundary enhancement branch alone, without further constraining the edges of the main segmentation mask to maintain consistency with the prediction results of the boundary enhancement branch. This can easily lead to mismatches between the main segmentation region and the boundary prediction results.
[0007] Existing multi-stage edge guidance methods suffer from inconsistent edge information. Although some edge-guided medical image segmentation methods introduce edge features or boundary prediction results at multiple stages, the edge information at different stages usually comes from different modules or processing stages, and may differ in scale, semantic level, response intensity, and noise distribution. This can easily lead to inconsistencies in edge guidance signals, discontinuous boundary response propagation, and repeated extraction of edge information.
[0008] Therefore, accurately restoring the boundary of the target region is a challenge in medical image segmentation. Summary of the Invention
[0009] This application provides a medical image segmentation method and related equipment based on boundary prior guidance, which improves the boundary accuracy and stability of medical image segmentation results.
[0010] This application provides a medical image segmentation method based on boundary prior guidance, the method comprising: Acquire preprocessed medical images and generate boundary prior maps that are used uniformly in subsequent stages; In the encoding stage, the skip features extracted from the medical image are subjected to boundary-guided downsampling operation based on the boundary prior map to obtain downsampled features. Based on the downsampled features, multiple encoding operations are performed sequentially to obtain the boundary-enhanced bottleneck features and multi-scale skip features. During the skip connection fusion process in the decoding stage, based on the boundary prior map, the multi-scale skip features and their corresponding upsampled features at each scale obtained by upsampling the enhanced deep semantic features at each scale are fused by boundary guidance to obtain multi-scale boundary-aware fusion features. The enhanced deep semantic features are generated from the bottleneck features. After the largest-scale boundary-aware fusion feature in the multi-scale boundary-aware fusion feature is decoded, it is input into the segmentation output head to output the target region segmentation probability map of the medical image.
[0011] In some embodiments, a boundary-guided downsampling operation is performed on the skip features extracted from the medical image based on a boundary prior map to obtain downsampled features. Multiple encoding operations are then performed sequentially based on these downsampled features to obtain boundary-enhanced bottleneck features and multi-scale skip features, including: The medical image is input into the encoder module. The bottleneck features output by the last encoding block and the multi-scale jump features output by other encoding blocks are extracted through multiple encoding blocks of the encoder module. In at least two adjacent encoding blocks, after adjusting the spatial size of the boundary prior map, the previous scale jump features output by the previous encoding block are weighted and pooled according to the boundary prior map to obtain the boundary-enhanced pooling features. The boundary prior map, the boundary-enhanced pooling features, the max pooling features extracted from the previous scale jump features and the average pooling features are concatenated and then three dynamic fusion weights are obtained through the weight generation network. The three dynamic fusion weights are multiplied by the boundary enhancement pooling feature, the max pooling feature, and the average pooling feature respectively, and then added together to obtain the downsampled feature. The downsampled feature is then input into the next coding block to output the jump feature of the next scale, so as to obtain the multi-scale jump feature.
[0012] In some embodiments, based on the boundary prior map, the multi-scale jump features and their corresponding upsampled features at each scale obtained by progressive upsampling of the enhanced deep semantic features are fused using boundary-guided fusion to obtain multi-scale boundary-aware fusion features, including: The enhanced deep semantic features are input into the decoder module, and multi-scale upsampling features are extracted through multiple upsampling modules of the decoder module. The processing order of the decoder module and the encoder module corresponds to the opposite scale change. In at least two adjacent upsampling modules, the spatial size of the boundary prior map is adjusted, and a spatial gating map and a channel gating vector are generated based on the upsampling features of the previous scale, the jump features consistent with its scale, and the projection vector corresponding to the boundary prior map. The multiplication result is obtained by multiplying the spatial gating diagram, the channel gating vector, and the projection vector of the jump feature element by element. Multiply the projection vector of the boundary prior map with the preset boundary prior coefficients to obtain the boundary prior residual term, and inject the boundary prior residual term into the multiplication result to obtain the recalibrated jump feature. The recalibrated jump features are fused with the upsampled features of the previous scale to obtain the boundary-aware fusion features of the previous scale, thus obtaining multi-scale boundary-aware fusion features.
[0013] In some embodiments, prior to the skip connection fusion process in the decoding phase, the method further includes: In the bottleneck layer feature enhancement stage, after adjusting the spatial size of the boundary prior map, the bottleneck features are enhanced by boundary weighting and pooling based on the boundary prior map to obtain the boundary enhanced branch features. The boundary enhancement branch features, along with the main semantic branch features, local branch features, and global context branch features extracted from the bottleneck features, are input into the gated generation network to generate four corresponding branch fusion weights. The enhanced deep semantic features are obtained by weighting and summing the four corresponding dynamic fusion weights with the boundary enhancement branch features, main semantic branch features, local branch features, and global context branch features, respectively.
[0014] In some embodiments, the generation of the boundary prior map includes: The texture, grayscale variation and contour features of medical images can be extracted by learning convolutional branches; High-frequency edge features of medical images are extracted using edge response branching; The boundary prior map is obtained by fusing texture, grayscale variation, contour features and high-frequency edge features and activating them.
[0015] In some embodiments, the method further includes: Obtain the training medical images and their corresponding ground truth segmentation masks; Input the boundary-aware fusion feature with the largest scale among the multi-scale boundary-aware fusion features corresponding to the training medical image into the boundary output head, and output the boundary prediction map. Boundary labels are generated based on the true segmentation mask. Boundary loss is calculated based on the boundary labels and the boundary prediction map. This boundary loss is used to improve the localization capability of the target region's boundaries; or Calculate the cross-entropy loss and Dice loss of the target region segmentation probability map corresponding to the training medical image and the real segmentation mask, and add the two losses to obtain the main segmentation loss. The main segmentation loss is used to improve the accuracy of target region segmentation; or The multi-scale boundary-aware fusion features are input into the corresponding auxiliary supervision output head, and the corresponding multi-scale auxiliary segmentation result map is output. The auxiliary segmentation result map at each scale is compared with the real segmentation mask to calculate the loss, and then weighted and summed to obtain the auxiliary supervised output head loss. The auxiliary supervised output head loss is used to alleviate gradient vanishing and improve the multi-scale boundary-aware fusion feature representation; or The soft boundary response features of the target region segmentation probability map are extracted. The soft boundary response features and the boundary prediction map are compared pixel by pixel. The comparison distance is used as the mask-boundary consistency loss. The mask-boundary consistency loss is used to constrain the boundary response derived from the target region segmentation probability map to be consistent with the boundary output head prediction result.
[0016] In some embodiments, the method further includes: The joint loss is obtained by adding the main segmentation loss, the weighted boundary loss, the auxiliary supervision output head loss, and the mask-boundary consistency loss. The joint loss is used to simultaneously improve the ability to locate the boundary of the target region, the accuracy of the target region segmentation, alleviate gradient vanishing and improve the multi-scale boundary-aware fusion feature representation, and enhance the synergy between the target region segmentation result and the target region boundary prediction.
[0017] This application also provides a medical image segmentation device based on boundary prior guidance, comprising: The boundary prior extraction module is used to acquire preprocessed medical images and generate a boundary prior map that is used uniformly in subsequent stages; The encoder module is used to extract skip features from medical images during the encoding phase; The boundary-aware fusion downsampling module is used to perform boundary-guided downsampling operations on jump features based on the boundary prior map to obtain downsampled features; The encoder module is also used to perform multiple encoding operations based on downsampled features to obtain boundary-enhanced bottleneck features and multi-scale jump features. The bottleneck layer feature enhancement module is used to generate enhanced deep semantic features based on the bottleneck features during the bottleneck layer feature enhancement stage. The decoder module is used, during the decoding stage, to upsample the features at each scale based on the enhanced deep semantic features obtained by upsampling at each level. The boundary-aware guided fusion module is used to perform boundary-guided fusion of multi-scale jump features and their corresponding upsampled features at each scale obtained by upsampling the enhanced deep semantic features in the jump connection fusion process during the decoding stage, based on the boundary prior map, to obtain multi-scale boundary-aware fusion features. The main segmentation output module is used to input the largest-scale boundary-aware fusion feature from the multi-scale boundary-aware fusion features into the segmentation output head after the final decoding operation, and output the target region segmentation probability map of the medical image.
[0018] This application also provides an electronic device, including a processor and a memory, wherein a computer program is stored in the memory, and the computer program is executed by the processor to implement the above-described method.
[0019] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described method.
[0020] Understandably, the medical image segmentation method, apparatus, electronic device, and storage medium based on boundary prior guidance provided in this application generate a boundary prior map from the medical image during the input stage of the medical image segmentation model (apparatus). This boundary prior map is used uniformly in both the encoding and decoding stages, ensuring that the generation of downsampling features and boundary-aware fusion features is guided by the boundary prior map. This maintains consistency in boundary responses across different network layers, reducing boundary drift, response conflicts, and redundant computation caused by different sources of edge information in multiple stages. This improves the boundary accuracy and stability of the medical image segmentation results, such as allowing the model to segment lesions or organs more clearly. Simultaneously, during the downsampling process in the encoding stage, multi-scale jump features and their corresponding enhanced deep semantic features are dynamically fused directly based on the boundary prior map. This allows boundary information to participate in feature selection before resolution reduction, thereby reducing information loss from weak boundaries, small targets, and irregular contours during downsampling. In the decoding stage, upsampling features and the boundary prior map are used to jointly filter shallow features, i.e., jump features, which can suppress background texture interference and enhance target boundary-related features. Attached Figure Description
[0021] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0022] Figure 1 A schematic diagram of the system framework of the medical image segmentation model and medical image segmentation device used in the boundary prior-guided medical image segmentation method provided in the embodiments of this application; Figure 2 A flowchart illustrating a medical image segmentation method based on boundary prior guidance provided in an embodiment of this application; Figure 3 for Figure 1 A block diagram of the boundary prior extraction module of a medical image segmentation model (device); Figure 4 for Figure 1 Block diagram of the boundary-aware fusion downsampling module in a medical image segmentation model (device); Figure 5 for Figure 1 A block diagram of the boundary-aware guided fusion module in a medical image segmentation model (device); Figure 6 for Figure 1 A block diagram of the bottleneck layer feature enhancement module of the medical image segmentation model (device).
[0023] Figure 7 A schematic diagram of the structure of the electronic device provided in this application.
[0024] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0025] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application.
[0026] The terms “first”, “second”, etc. used in this application are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated.
[0027] The relevant technical details are described in further detail below.
[0028] Deep learning-based image segmentation methods have been widely used in the field of medical image processing. Among them, U-Net and its improved models, due to their encoder-decoder module structure and skip connection mechanism, can simultaneously utilize high-level semantic information and low-level spatial detail information, demonstrating good performance in medical image segmentation tasks. U-Net progressively downsamples through the encoder module to extract deep semantic features, progressively upsamples through the decoder module to restore spatial resolution, and uses skip connections to pass shallow features from the encoder module to the decoder module, thereby improving the restoration of target boundaries and detailed regions.
[0029] To improve the performance of medical image segmentation, U-Net has been improved using various methods in the background techniques. However, these methods mostly improve a local part of the network, and boundary information usually only exists as an auxiliary output or local attention. A unified boundary guidance mechanism from input boundary prior, downsampling, skip connection fusion to training constraints has not yet been formed.
[0030] Therefore, there is an urgent need to propose a medical image segmentation method that can explicitly utilize the same boundary prior map in multiple stages of the medical image segmentation model. This method would not only allow the boundary information to exist as an auxiliary supervision at the output end, but also use the same boundary prior map E0 as a unified guiding signal to form continuous and stable collaborative guidance in encoding downsampling, decoding jump fusion, and training constraints. This would improve boundary integrity, regional consistency, and robustness in complex backgrounds.
[0031] The technical solution of this application and how the technical solution of this application solves the technical problem are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0032] like Figure 1 As shown, Figure 1 This is a schematic diagram of the system framework of the medical image segmentation device based on boundary prior guidance provided in this application, and also a schematic diagram of the system framework of the medical image segmentation model. The medical image segmentation model is based on U-Net and is defined as the BAGF-UNet medical image segmentation model in this application. The medical image segmentation method based on boundary prior guidance provided in this application is applied to the BAGF-UNet medical image segmentation model and the medical image segmentation device.
[0033] Please see Figure 1 and Figure 2 , Figure 2 This is a flowchart illustrating a boundary prior-guided medical image segmentation method provided in this application. This method can be applied to semantic segmentation tasks in medical images, such as skin lesion image segmentation, endoscopic polyp image segmentation, microscopic cell nucleus image segmentation, pathological tissue image segmentation, tumor region segmentation, and organ region segmentation. It is particularly suitable for medical image segmentation scenarios with blurred target boundaries, significant target scale variations, strong background texture interference, and high requirements for boundary integrity. The segmentation method may include the following steps: Step S120: Acquire the preprocessed medical image and generate a boundary prior map for use in subsequent stages.
[0034] Specifically, preprocessing includes one or more of the following: image size normalization, grayscale normalization, random flipping, random rotation, brightness perturbation, contrast perturbation, and random cropping. For example, the image size is 256×256, and the number of input channels is 1 or 3. The medical image segmentation model is trained using AdamW or the Adam optimizer, and the initial learning rate can be set to... The batch size can be set to 2, 4 or 8, and the number of training rounds can be set to 30 to 300 rounds depending on the size of the dataset.
[0035] like Figure 1 and 3 As shown, the medical image segmentation model (device) includes a boundary prior extraction module, defined as BAFD. The boundary prior extraction module is used to acquire the preprocessed medical image and generate a boundary prior map that is used uniformly in subsequent stages. The boundary prior extraction module includes a learnable convolutional branch and an edge response branch.
[0036] Texture, grayscale variations, and contour features of medical images are extracted using learnable convolutional branches. For example, the expression for the learnable convolutional branch is: , Represents texture, grayscale variations, and contour features. Representing medical images, express Convolution operation, , Indicates the number of input channels. and These represent the image height and width, respectively.
[0037] High-frequency edge features of medical images are extracted using edge response branching. The Sobel operator, Laplacian operator, or other edge operators can be used to implement edge response branching. For example, the edge response branching expression is: , Indicates high-frequency edge features, This represents the edge operator.
[0038] Finally, texture, grayscale variations, contour features, and high-frequency edge features are fused and activated to obtain a boundary prior map. For example, the fusion expression is: , Representing the boundary prior graph, This indicates concatenation along the channel dimension. This represents the Sigmoid activation function. Used for boundary probability mapping express Convolution operations are used for channel compression and fusion.
[0039] Understandable, boundary prior graph It is generated once during the input phase and serves as a unified boundary reference throughout the encoder and decoder modules. Subsequent encoding and decoding phases only use the boundary prior map. Scaling or feature mapping is performed instead of regenerating other independent edge maps, thereby avoiding boundary response conflicts caused by different sources of edge information at different stages.
[0040] Step S140: In the encoding stage, the skip features extracted from the medical image are subjected to boundary-guided downsampling operation based on the boundary prior map to obtain downsampled features. Based on the downsampled features, multiple encoding operations are performed sequentially to obtain the boundary-enhanced bottleneck features and multi-scale skip features.
[0041] In one implementation, such as Figure 1 and 4As shown, the medical image segmentation model (device) also includes a boundary-aware fusion downsampling module. The medical image is input into the encoder module, which extracts bottleneck features from the last encoding block and multi-scale jump features from other encoding blocks through multiple encoding blocks. Specifically, in at least two adjacent encoding blocks, the boundary-aware fusion downsampling module adjusts the spatial size of the boundary prior map, then performs boundary-weighted enhancement and pooling on the previous-scale jump features output from the previous encoding block based on the boundary prior map to obtain boundary-enhanced pooling features. These boundary-enhanced pooling features are then weighted and fused with the max-pooling and average-pooling features extracted from the previous-scale jump features to obtain downsampling features. The downsampling features are then input into the next encoding block to output the next-scale jump features, thus obtaining multi-scale jump features.
[0042] Specifically, spatial scale refers to image resolution. As the encoder module processes multiple coding blocks in the order of processing, the spatial scale processed by the encoder module decreases sequentially, which means the image resolution decreases sequentially.
[0043] like Figure 4 As shown, the boundary-aware fusion downsampling module includes at least a max-pooling branch, an average-pooling branch, and a boundary-enhancing pooling branch. The expression for the max-pooling branch is: , Indicates a jump characteristic, This represents the max pooling feature. This indicates a max pooling operation. Max pooling branches are used to preserve local strong responses.
[0044] The expression for the average pooling branch is: , This represents the average pooling characteristic. This indicates the average pooling operation, where the average pooling branch is used to retain overall statistical information for the region.
[0045] The expression for the boundary-based boosting pooling branch is: , This means adjusting the boundary prior map to the same scale as the jump features. This indicates element-wise multiplication. This indicates the boundary-enhanced pooling feature.
[0046] Subsequently, the boundary-aware fusion downsampling module performs a weighted fusion of the boundary-enhanced pooling features with the max-pooling and average-pooling features extracted from the previous scale jump features to obtain the downsampling features, specifically: First, the boundary prior map, boundary augmented pooling features, max pooling features extracted from the previous scale jump features, and average pooling features are concatenated, and then three dynamic fusion weights are obtained through a weight generation network.
[0047] For example, the expression for the weight generation network is: ,in, This indicates a normalization operation. , , represent the dynamic fusion weights of max pooling features, average pooling features, and boundary enhancement pooling features, respectively. , , The sum of the three dynamic fusion weights is 1.
[0048] The three dynamically fused weights are then multiplied by the boundary enhancement pooling feature, max pooling feature, and average pooling feature respectively, and then summed to obtain the downsampled feature. For example, the downsampled feature... The expression is .
[0049] It is understandable that replacing the single max pooling downsampling method in U-Net with the boundary-aware fusion downsampling module enables the medical image segmentation model (device) to dynamically select the downsampling method according to the feature attributes of different regions. In regions with strong boundary response, the boundary-aware fusion downsampling module can rely more on the boundary enhancement pooling branch; in the target region or background region, the boundary-aware fusion downsampling module can rely more on the max pooling or average pooling branch.
[0050] Understandably, unlike methods that simply overlay edge information after downsampling, the boundary-aware fusion downsampling module uses the same boundary prior map to participate in downsampling branch selection before the resolution of the previous scale jump feature decreases. This allows the boundary response to be preferentially preserved during the encoding and compression stage. At the same time, this module does not simply overlay edge information after downsampling, but rather dynamically fuses max pooling features, average pooling features, and boundary enhancement pooling features directly based on the boundary prior map during the downsampling process in the encoding stage. This allows the boundary information to participate in feature selection before the resolution decreases, thereby reducing the loss of information from weak boundaries, small targets, and irregular contours during the downsampling process.
[0051] Understandably, the boundary-aware fusion downsampling module dynamically fuses max pooling, average pooling, and boundary-enhanced pooling, which can take into account local strong responses, regional statistical information, and boundary responses, and reduce the loss of boundary information caused by downsampling.
[0052] Step S160: During the skip connection fusion process in the decoding stage, based on the boundary prior map, the multi-scale skip features and their corresponding upsampled features at each scale obtained by progressive upsampling of the enhanced deep semantic features are fused by boundary guidance to obtain multi-scale boundary-aware fusion features.
[0053] In one implementation, please refer to Figure 1 and Figure 5The generation method of multi-scale boundary-aware fusion features is as follows: steps S161 to S165: Step S161: Input the enhanced deep semantic features generated from the bottleneck features into the decoder module, and extract multi-scale upsampling features through multiple upsampling modules of the decoder module.
[0054] Specifically, the spatial scale processed by the multiple decoding blocks and multiple upsampling modules of the decoder module increases sequentially according to the processing order, that is, the image resolution increases sequentially, which is the opposite of the scale change corresponding to the processing order of the encoder module.
[0055] Step S162: In at least two adjacent upsampling modules, adjust the spatial size of the boundary prior map, and generate a spatial gating map and a channel gating vector based on the upsampling features of the previous scale, the jump features consistent with its scale, and the projection vector corresponding to the boundary prior map.
[0056] Specifically, such as Figure 1 and 5 As shown, the medical image segmentation model (device) also includes a boundary-aware guided fusion module, defined as BAGF. The boundary-aware guided fusion module adjusts the spatial size of the boundary prior map using the following formula, projecting the upsampled features from the previous scale, the jump features consistent with its scale, and the boundary prior map to the same channel dimension to obtain the corresponding projection vector.
[0057] , , , in, Indicates upsampling features, , and These represent the three projection vectors corresponding to the jump features, upsampling features, and boundary prior maps, respectively.
[0058] Next, the boundary-aware guided fusion module generates a spatial gating map and a channel gating vector by using the upsampled features from the previous scale, the jump features consistent with its scale, and the projection vectors corresponding to the boundary prior map, according to the following formula.
[0059] , , in, This represents a spatial gating diagram used to weight different spatial locations. This represents the channel gating vector, used to weight different channels. Indicates global average pooling. This represents a multilayer perceptron. This represents the activation function.
[0060] Step S163: Multiply the spatial gating diagram, the channel gating vector, and the projection vector of the jump feature element by element to obtain the multiplication result.
[0061] Step S164: Multiply the projection vector of the boundary prior map with the preset boundary prior coefficients to obtain the boundary prior residual term, and inject the boundary prior residual term into the multiplication result to obtain the recalibrated jump feature.
[0062] For example, the boundary-aware guided fusion module calculates the recalibrated jump features using the following formula.
[0063] , in, This indicates the jump characteristics after recalibration. These represent preset boundary prior coefficients, used to preserve boundary prior information. This represents the boundary prior residual term.
[0064] Step S165: Fuse the recalibrated jump features with the upsampled features of the previous scale to obtain the boundary-aware fusion features of the previous scale, so as to obtain the multi-scale boundary-aware fusion features.
[0065] For example, the boundary-aware guided fusion module calculates the boundary-aware fusion features using the following formula.
[0066]
[0067] in, This represents the boundary-aware fusion feature.
[0068] Understandably, the boundary-aware guided fusion module simultaneously receives skip features from the encoder module, upsampled features from the decoder module, and the same boundary prior map E0 during the decoding stage. Based on these three, it generates a spatial gating map and channel gating vectors to recalibrate the skip features from the encoder module. This is because the boundary prior map it uses differs from the boundary prior map used for downsampling during the encoding stage. Figure 1 Therefore, it is possible to continue using the previous boundary guidance results in the skip fusion stage, suppress background texture and false edge noise, and enhance the relevant features of the target's true boundary.
[0069] Understandably, the boundary-aware guided fusion module performs spatial and channel recalibration on the skip features of the encoder module, which can reduce the interference of shallow background textures, false edges and noise on the decoder module and improve the effectiveness of skip features.
[0070] Step S180: After performing the final decoding operation on the largest scale boundary-aware fusion feature in the multi-scale boundary-aware fusion feature, input it into the segmentation output head to output the target region segmentation probability map of the medical image.
[0071] Specifically, the boundary-aware fusion features from the previous scale are input into the next decoding block, outputting the upsampled features from the next scale. Steps S162 to S165 are repeated to obtain the maximum-scale boundary-aware fusion features. The medical image segmentation model (device) also includes a main segmentation output module, which is used to decode the maximum-scale boundary-aware fusion features into the decoding block of the last decoder module and then input them into the segmentation output head to output the target region segmentation probability map of the medical image.
[0072] Understandably, through the boundary-aware guided fusion module, the medical image segmentation model (device) can utilize deep semantic features to obtain the upsampled features of the decoder module through step-by-step upsampling, and together with the boundary prior map, filter the shallow features of the encoder module, i.e. the skip features, which can suppress background texture interference and enhance the target boundary-related features.
[0073] Understandably, in the above technical solution, during the input stage of the medical image segmentation model (device), a boundary prior map is generated from the medical image for use in subsequent stages. This boundary prior map is used uniformly in both the encoding and decoding stages, ensuring that the generation of downsampling features and boundary-aware fusion features is guided by the boundary prior map. The medical image segmentation model (device) can maintain consistency in boundary responses across different network layers, reducing boundary drift, response conflicts, and redundant computation caused by different sources of edge information in multiple stages. This improves the boundary accuracy and stability of the medical image segmentation results, such as allowing the model to more clearly segment lesions or organ boundaries. Simultaneously, during the downsampling process in the encoding stage, multi-scale jump features and their corresponding enhanced deep semantic features are dynamically fused directly based on the boundary prior map. This allows boundary information to participate in feature selection before resolution reduction, thereby reducing information loss from weak boundaries, small targets, and irregular contours during downsampling. In the decoding stage, upsampling features and the boundary prior map are used to jointly filter shallow features, i.e., jump features, which can suppress background texture interference and enhance target boundary-related features.
[0074] In some embodiments, prior to the skip connection fusion process in the decoding phase, the segmentation method further includes: Step S150: In the bottleneck layer feature enhancement stage, the bottleneck features are enhanced by boundary-guided feature enhancement based on the boundary prior map to obtain the enhanced deep semantic features.
[0075] In one implementation, such as Figure 1As shown, the medical image segmentation model (device) also includes a bottleneck feature enhancement module. This bottleneck layer feature enhancement module can be implemented using one or more of the following: ordinary convolution, dilated convolution, large kernel convolution, strip convolution, lightweight attention module, or state space model module. Figure 6 The local-global boundary context module used in it.
[0076] like Figure 6 As shown, the bottleneck feature enhancement module first adjusts the spatial size of the boundary prior map, then performs boundary weighted enhancement and pooling on the bottleneck features based on the boundary prior map to obtain the boundary enhanced branch features.
[0077] Specifically, such as Figure 6 As shown, the bottleneck feature enhancement module includes a boundary enhancement branch, the expression of which is: , Indicates boundary-enhanced branch features, This indicates a bottleneck characteristic.
[0078] The bottleneck feature enhancement module then performs weighted fusion of the boundary enhancement branch features with the main semantic branch features, local branch features, and global context branch features extracted from the bottleneck features to obtain the enhanced deep semantic features.
[0079] Specifically, such as Figure 6 As shown, the bottleneck feature enhancement module also includes a main semantic branch, local branches, and a global context branch. For example, the expressions for each branch are as follows: , , , in, Indicates main semantic branch features, Representing local branch characteristics and Represents global context branch features. This represents a 3×3 depth-separable convolution function. This indicates a separable convolution function with a hole depth.
[0080] Subsequently, the bottleneck feature enhancement module inputs the boundary enhancement branch features, main semantic branch features, local branch features, and global context branch features into the gating generation network to generate four corresponding branch fusion weights.
[0081] For example, the expression for a gated generative network is: , Branch fusion weights represent the boundary enhancement branch features. The branch fusion weights represent the main semantic branch features. Branch fusion weights represent local branch features. The branch fusion weight represents the global context branch features.
[0082] Finally, the bottleneck feature enhancement module performs a weighted summation of the four corresponding dynamic fusion weights with the boundary enhancement branch features, main semantic branch features, local branch features, and global context branch features to obtain the enhanced deep semantic features.
[0083] For example, the calculation expression for the enhanced deep semantic features is as follows: , This represents the enhanced deep semantic features.
[0084] Understandably, by supplementing local and global contextual information through the bottleneck layer feature enhancement module, the model becomes more suitable for processing medical image targets with large scale variations (such as lesions, organs, or cell nuclei of varying sizes).
[0085] Understandably, the above technical solution utilizes a unified boundary prior map for multi-stage reuse, avoiding repeated edge information extraction during encoding, decoding, or bottleneck layer feature enhancement. This reduces computational redundancy in edge information and minimizes the accumulation of false edges caused by multiple edge extractions. For medical images with blurred boundaries, strong texture interference, or irregular target shapes, this application can improve the stability of boundary response propagation and the structural consistency of segmentation results.
[0086] In some embodiments, the segmentation method further includes: Step S210: Obtain the training medical image and its corresponding real segmentation mask.
[0087] Specifically, the medical image segmentation model (device) also includes a training module (not shown), which is used to obtain training medical images and their corresponding ground truth segmentation masks. For example, the medical image can be a cell nucleus medical image, with the target region being the cell nucleus. If a single cell nucleus medical image contains multiple cell nucleus instance annotations, these annotations are merged into a single binary ground truth segmentation mask, where the cell nucleus region is the foreground and the non-cell nucleus region is the background.
[0088] Step S220: Input the boundary-aware fusion feature with the largest scale among the multi-scale boundary-aware fusion features corresponding to the training medical image into the boundary output head, and output the boundary prediction map.
[0089] Specifically, the medical image segmentation model (device) also includes a boundary output head, which is set after the last decoding block, receives the highest resolution boundary-aware fusion feature output by the last decoding block, and outputs a boundary prediction map.
[0090] Step S230: Generate boundary labels based on the real segmentation mask, and calculate the boundary loss based on the boundary labels and the boundary prediction map. The boundary loss is used to improve the ability to locate the boundary of the target area.
[0091] Specifically, the training module is also used to generate boundary labels based on the true segmentation mask, and calculate the boundary loss based on the boundary labels and the boundary prediction map. For example, the formula for generating the boundary labels is: , Represents the true segmentation mask. This indicates a morphological dilation operation. This indicates a morphological etching operation. Indicates the boundary label.
[0092] The formula for calculating boundary loss is: , Indicates boundary loss. This represents the boundary prediction map.
[0093] In some embodiments, the segmentation method further includes: Step S240: Calculate the cross-entropy loss and Dice loss of the target region segmentation probability map corresponding to the training medical image and the real segmentation mask, and add the two losses to obtain the main segmentation loss. The main segmentation loss is used to improve the accuracy of target region segmentation.
[0094] Specifically, the training module is also used to calculate the cross-entropy loss and Dice loss of the target region segmentation probability map corresponding to the training medical image and the real segmentation mask, and add the two losses to obtain the main segmentation loss, which is used to improve the accuracy of target region segmentation.
[0095] For example, the formula for calculating the main segmentation loss is: , The cross-entropy loss is calculated based on the target region segmentation probability map and the true segmentation mask, combined with the logarithmic loss function. The Dice loss is calculated by combining the intersection of the target region segmentation probability map and the true segmentation mask with the magnitude summation.
[0096] In some embodiments, the segmentation method further includes: Step S250: Input the multi-scale boundary-aware fusion features into the corresponding auxiliary supervision output head, and output the corresponding multi-scale auxiliary segmentation result map.
[0097] Specifically, the medical image segmentation model (device) also includes an auxiliary supervision output head (not shown in the figure). There are multiple auxiliary supervision output heads, which are set after multiple decoding blocks respectively. They receive boundary-aware fusion features of different scales output by multiple decoding blocks and output multi-scale auxiliary segmentation result maps.
[0098] Step S260: Calculate the loss between the auxiliary segmentation result map at each scale and the real segmentation mask, and sum them by weight to obtain the auxiliary supervision output head loss. The auxiliary supervision output head loss is used to alleviate gradient vanishing and improve the multi-scale boundary-aware fusion feature representation.
[0099] Specifically, the training module is also used to calculate the loss of each scale of the auxiliary segmentation result map with the real segmentation mask, and then sum them up by weight to obtain the auxiliary supervision output head loss.
[0100] For example, the expression for the auxiliary supervision output head loss is: , This indicates the output head loss of the auxiliary supervisor. Indicates the number of auxiliary monitoring output heads. Indicates the first The auxiliary segmentation probability map output by the auxiliary supervision output head; This refers to loss functions, such as cross-entropy loss and Dice loss. This represents the weighting coefficient of the loss of the k-th auxiliary supervisor output head.
[0101] In some embodiments, the segmentation method further includes: Step S270: Extract the soft boundary response features of the target region segmentation probability map, compare the soft boundary response features with the boundary prediction map pixel by pixel, and use the comparison distance as the mask-boundary consistency loss. The mask-boundary consistency loss is used to constrain the boundary response derived from the target region segmentation probability map to be consistent with the boundary output head prediction result, which helps to reduce segmentation boundary breakage, boundary offset and region leakage problems.
[0102] Specifically, the training module is also used to extract soft boundary response features from the target region segmentation probability map, compare the soft boundary response features with the boundary prediction map pixel by pixel, and use the comparison distance as the mask-boundary consistency loss. For example, the expression for mask-boundary consistency loss is: , This represents the mask-boundary consistency loss. This represents the probability map for segmenting the target region. Indicates soft boundary response, The distance metric function can be represented by binary cross-entropy, mean squared error, or Dice distance.
[0103] In some embodiments, the segmentation method further includes: Step S280: Add the main segmentation loss, the weighted boundary loss, the auxiliary supervision output head loss, and the mask-boundary consistency loss to obtain the joint loss. The joint loss is used to simultaneously improve the ability to locate the boundary of the target region, the accuracy of target region segmentation, alleviate gradient vanishing and improve the multi-scale boundary-aware fusion feature expression, and constrain the boundary response derived from the target region segmentation probability map to be consistent with the boundary output head prediction result.
[0104] Specifically, the training module is also used to add the main segmentation loss to the weighted boundary loss, the auxiliary supervision output head loss, and the mask-boundary consistency loss to obtain the joint loss.
[0105] For example, , Indicates joint loss, , , These represent the weight coefficients corresponding to the boundary loss, mask-boundary consistency loss, and auxiliary supervision output head loss, respectively. For example, .
[0106] Figure 7 A schematic diagram of the structure of the electronic device provided in this application. Figure 7 As shown, the electronic device 10 includes: Processor 11, memory 12 and bus 13; The memory 12 is used to store the computer program code of the processor 11; The processor 11 is configured to execute the zipper simulation method in any of the foregoing method embodiments by executing the computer program code.
[0107] Optionally, the memory 12 can be either standalone or integrated with the processor 11.
[0108] The memory 12 is connected to the processor 11 via the bus 13 and they communicate with each other.
[0109] Optionally, memory 12 may include random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device.
[0110] Bus 13 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, only one thick line is used in the diagram, but this does not indicate that there is only one bus or one type of bus.
[0111] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0112] The electronic device 10 is used to execute the technical solutions provided in any of the foregoing method embodiments. Its implementation principle and technical effect are similar, and will not be described again here.
[0113] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the medical image segmentation method described above.
[0114] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0115] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A medical image segmentation method based on boundary prior guidance, characterized in that, The methods include: Acquire preprocessed medical images and generate boundary prior maps that are used uniformly in subsequent stages; During the encoding stage, the skip features extracted from the medical image are subjected to boundary-guided downsampling operation based on the boundary prior map to obtain downsampled features. Multiple encoding operations are performed sequentially based on the downsampled features to obtain the boundary-enhanced bottleneck features and multi-scale skip features. During the skip connection fusion process in the decoding stage, based on the boundary prior map, the multi-scale skip features and their corresponding upsampled features at each scale obtained by upsampling the enhanced deep semantic features at each scale are fused by boundary guidance to obtain multi-scale boundary-aware fusion features. The enhanced deep semantic features are generated from the bottleneck features. After the largest scale boundary sensing fusion feature in the multi-scale boundary sensing fusion feature is finally decoded, it is input into the segmentation output head to output the target region segmentation probability map of the medical image. The method further includes: Obtain the training medical images and their corresponding ground truth segmentation masks; Input the boundary-aware fusion feature with the largest scale among the multi-scale boundary-aware fusion features corresponding to the training medical image into the boundary output head, and output the boundary prediction map. Boundary labels are generated based on the true segmentation mask. A boundary loss is calculated based on the boundary labels and the predicted boundary map. This boundary loss is used to improve the ability to locate the boundaries of the target region; or The cross-entropy loss and Dice loss of the target region segmentation probability map corresponding to the training medical image and the real segmentation mask are calculated, and the two losses are added together to obtain the main segmentation loss. The main segmentation loss is used to improve the accuracy of target region segmentation; or The multi-scale boundary-aware fusion features are respectively input into the corresponding auxiliary supervision output head, and the corresponding multi-scale auxiliary segmentation result map is output. The loss is calculated by comparing the auxiliary segmentation result map at each scale with the real segmentation mask, and then weighted and summed to obtain the auxiliary supervised output head loss. This auxiliary supervised output head loss is used to alleviate gradient vanishing and improve the multi-scale boundary-aware fusion feature representation; or The soft boundary response features of the target region segmentation probability map are extracted, and the soft boundary response features are compared with the boundary prediction map pixel by pixel. The comparison distance is used as the mask-boundary consistency loss. The mask-boundary consistency loss is used to constrain the boundary response derived from the target region segmentation probability map to be consistent with the boundary output head prediction result.
2. The method according to claim 1, characterized in that, The step involves performing a boundary-guided downsampling operation on the skip features extracted from the medical image based on the boundary prior map to obtain downsampled features. Multiple encoding operations are then performed sequentially based on these downsampled features to obtain boundary-enhanced bottleneck features and multi-scale skip features, including: The medical image is input into the encoder module. The bottleneck features output by the last encoding block and the multi-scale jump features output by other encoding blocks are extracted through multiple encoding blocks of the encoder module. In at least two adjacent encoding blocks, after adjusting the spatial size of the boundary prior map, the previous scale jump features output by the previous encoding block are weighted and pooled according to the boundary prior map to obtain boundary-enhanced pooling features. The boundary prior map, boundary-enhanced pooling features, max pooling features extracted from the previous scale jump features and average pooling features are concatenated and then three dynamic fusion weights are obtained through a weight generation network. The three dynamic fusion weights are multiplied by the boundary enhancement pooling feature, the max pooling feature, and the average pooling feature respectively, and then added together to obtain the downsampled feature. The downsampled feature is then input into the next coding block to output the jump feature of the next scale, so as to obtain the multi-scale jump feature.
3. The method according to claim 1, characterized in that, The process involves performing boundary-guided fusion on the multi-scale jump features and their corresponding upsampled features at each scale, obtained by progressive upsampling of the enhanced deep semantic features, based on the boundary prior map, to obtain multi-scale boundary-aware fusion features, including: The enhanced deep semantic features are input into the decoder module, and multi-scale upsampling features are extracted through multiple upsampling modules of the decoder module. The processing order of the decoder module and the encoder module corresponds to the opposite scale change. In at least two adjacent upsampling modules, the spatial size of the boundary prior map is adjusted, and a spatial gating map and a channel gating vector are generated based on the upsampling features of the previous scale, the jump features consistent with its scale, and the projection vector corresponding to the boundary prior map. The element-wise multiplication of the spatial gating diagram, the channel gating vector, and the projection vector of the jump feature is performed to obtain the multiplication result; The projection vector of the boundary prior map is multiplied by the preset boundary prior coefficients to obtain the boundary prior residual term. The boundary prior residual term is then injected into the multiplication result to obtain the recalibrated jump feature. The recalibrated jump features are fused with the upsampled features of the previous scale to obtain the boundary-aware fusion features of the previous scale, thus obtaining multi-scale boundary-aware fusion features.
4. The method according to claim 1, characterized in that, Prior to the skip-connection fusion process in the decoding phase, the method further includes: In the bottleneck layer feature enhancement stage, after adjusting the spatial size of the boundary prior map, the bottleneck features are enhanced by boundary weighting and pooling according to the boundary prior map to obtain the boundary enhanced branch features. The boundary enhancement branch features, along with the main semantic branch features, local branch features, and global context branch features extracted from the bottleneck features, are input into the gated generation network to generate four corresponding branch fusion weights. The enhanced deep semantic features are obtained by weighting and summing the four corresponding dynamic fusion weights with the boundary enhancement branch features, main semantic branch features, local branch features, and global context branch features, respectively.
5. The method according to claim 1, characterized in that, The generation of the boundary prior map includes: The texture, grayscale variation and contour features of medical images can be extracted by learning convolutional branches; High-frequency edge features of medical images are extracted using edge response branching; The boundary prior map is obtained by fusing the texture, grayscale variation, and contour features with the high-frequency edge features and activating them.
6. The method according to claim 1, characterized in that, The method further includes: The main segmentation loss is added to the weighted boundary loss, the auxiliary supervision output head loss, and the mask-boundary consistency loss to obtain the joint loss. The joint loss is used to simultaneously improve the ability to locate the boundary of the target region, the accuracy of target region segmentation, alleviate gradient vanishing and improve the multi-scale boundary-aware fusion feature expression, and enhance the synergy between the target region segmentation result and the target region boundary prediction.
7. A medical image segmentation device based on boundary prior guidance, characterized in that, include: The boundary prior extraction module is used to acquire preprocessed medical images and generate a boundary prior map that is used uniformly in subsequent stages; The encoder module is used to extract skip features from medical images during the encoding phase; The boundary-aware fusion downsampling module is used to perform boundary-guided downsampling operations on the jump features based on the boundary prior map to obtain downsampled features; The encoder module is also used to perform multiple encoding operations based on downsampled features to obtain boundary-enhanced bottleneck features and multi-scale jump features. The bottleneck layer feature enhancement module is used to generate enhanced deep semantic features based on the bottleneck features during the bottleneck layer feature enhancement stage. The decoder module is used, during the decoding stage, to upsample the features at each scale based on the enhanced deep semantic features obtained by upsampling at each level. The boundary-aware guided fusion module is used to perform boundary-guided fusion of multi-scale jump features and their corresponding upsampled features at each scale obtained by upsampling the enhanced deep semantic features through stepwise upsampling during the jump connection fusion process in the decoding stage, based on the boundary prior map, to obtain multi-scale boundary-aware fusion features. The main segmentation output module is used to input the largest scale boundary-aware fusion feature from the multi-scale boundary-aware fusion features into the segmentation output head after the final decoding operation, and output the target region segmentation probability map of the medical image. The training module acquires training medical images and their corresponding ground truth segmentation masks. The training module is also used to input the boundary perception fusion feature with the largest scale among the multi-scale boundary perception fusion features corresponding to the training medical image into the boundary output head, and output the boundary prediction map. The training module is also used to generate boundary labels based on the real segmentation mask, and calculate a boundary loss based on the boundary labels and the boundary prediction map. The boundary loss is used to improve the ability to locate the boundaries of the target region; or The training module is also used to calculate the cross-entropy loss and Dice loss of the target region segmentation probability map corresponding to the training medical image and the real segmentation mask, and add the two losses to obtain the main segmentation loss, which is used to improve the accuracy of target region segmentation. or The training module is also used to input the multi-scale boundary-aware fusion features into the corresponding auxiliary supervision output head and output the corresponding multi-scale auxiliary segmentation result map. The training module is also used to calculate the loss of each scale auxiliary segmentation result map with the real segmentation mask, and to sum them by weight to obtain the auxiliary supervision output head loss. The auxiliary supervision output head loss is used to alleviate gradient vanishing and improve the multi-scale boundary-aware fusion feature representation. or The training module is also used to extract the soft boundary response features of the target region segmentation probability map, compare the soft boundary response features with the boundary prediction map pixel by pixel, and use the comparison distance as the mask-boundary consistency loss. The mask-boundary consistency loss is used to constrain the boundary response derived from the target region segmentation probability map to be consistent with the boundary output head prediction result.
8. An electronic device comprising a processor and a memory, wherein the memory stores a computer program, characterized in that, When the computer program is executed by the processor, it implements the method according to any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 6.