Dynamic multi-scale medical image segmentation method based on morphological boundary condition gating
By introducing morphological boundary condition gating and dynamic multi-scale segmentation methods, and using boundary features to dynamically adjust the receptive field and branch weights, combined with the global-local discrimination of GAN networks, the problem of insufficient detection of small-scale lesions and boundary details in cerebral hemorrhage CT images by single-scale convolutional networks is solved, achieving more efficient segmentation results.
Patent Information
- Application Number
- CN202511383742.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-26
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2045-09-26
AI Technical Summary
Existing single-scale convolutional neural networks struggle to effectively capture small-scale lesions and boundary details when processing diverse CT images of brain hemorrhage, leading to missed detections or missegmentation. Furthermore, traditional methods fail to fully utilize the boundary information of local lesion regions for branch selection.
A dynamic multi-scale medical image segmentation method based on morphological boundary condition gating is adopted. By using a dynamic multi-branch perception module and a branch weight generator, combined with morphological erosion, dilation difference and high-pass filtering to extract boundary features, the receptive field is dynamically adjusted, and a GAN network is introduced to jointly constrain the global and local discriminators to optimize the segmentation results.
It improves the detection capability of small-scale bleeding areas and blurred boundaries, reduces missed detections and false judgments, and enhances the edge coherence and structural consistency of the segmentation results.
Smart Images

Figure CN120876514B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, in particular to a dynamic multi-scale medical image segmentation method based on morphological boundary condition gating. BACKGROUND
[0002] Medical image segmentation is an important technology in the field of computer-aided diagnosis, and is widely used in clinical scenarios such as lesion detection, lesion area quantitative evaluation, and surgical planning. However, for medical images of diseases such as cerebral hemorrhage, the size, edge features and prominence of the lesion area often differ greatly, resulting in insufficient performance of traditional single-scale convolutional neural networks in dealing with diverse lesion features. In particular, for cerebral hemorrhage CT images, small-scale hemorrhagic areas are easily missed or misclassified due to their small proportion in brain tissue, while large-scale hemorrhagic areas are relatively obvious in brain tissue but their shapes are not always regular and their boundaries are prone to be blurred.
[0003] To solve the above problems, the existing technology usually uses stacked fixed-size convolution kernels or dilated convolution modules to expand the receptive field, such as typical dilated spatial pyramid pooling (ASPP) or multi-kernel convolution structure, which can capture context information at different scales to some extent. However, most of these methods only stack fixed structures and do not have the ability to dynamically adjust the receptive field weights according to the input image features. Some existing research has introduced multi-branch convolution kernels and adaptive weight mechanisms, which can generate branch weights according to the input to achieve kernel selection, but the weight generation only relies on global context statistics and does not fully consider the influence of local lesion areas, especially boundary information, on branch selection, so there is still a performance bottleneck in small-scale lesion or boundary detail preservation. SUMMARY
[0004] The present application is to solve the problem that the existing single-scale convolutional neural network has insufficient performance in dealing with diverse lesion features, and its weight generation only relies on global context statistics and does not fully consider the influence of local lesion areas, especially boundary information, on branch selection, so there is still a performance bottleneck in small-scale lesion or boundary detail preservation.
[0005] To solve the above technical problems, the present application is realized by the following technical scheme:
[0006] Scheme one, the present application proposes a dynamic multi-scale medical image segmentation method based on morphological boundary condition gating, which comprises the following steps:
[0007] Step 1, obtain a cerebral hemorrhage CT image, and pre-process the cerebral hemorrhage CT image, the pre-processing is to make slices along the z-axis to generate a transverse image, and perform image enhancement on the transverse image;
[0008] Step 2, input the preprocessed cross-sectional image into a segmentation network, the segmentation network comprising a dynamic multi-branch perception module for extracting multi-scale features using convolution branches of different sizes or hole rates;
[0009] A branch weight generator is configured to dynamically generate the weight of each branch based on the global information of the input image and the boundary features extracted by morphological erosion, dilation difference and high-pass filtering, so as to realize adaptive adjustment of the multi-scale receptive field driven by the local structure condition.
[0010] A boundary refining module is configured to extract edge features using morphological methods and Laplacian high-pass filtering, and to modify the segmentation result based on edge consistency through a learnable convolution residual.
[0011] Step 3, combine the dynamic segmentation loss function, assign different penalty weights according to the size of the bleeding area, and introduce a GAN network, and through the joint discrimination of the global discriminator and the local discriminator, the segmentation result is simultaneously constrained on the overall structure and the local details, and the dynamic multi-scale medical image segmentation based on the morphological boundary condition gate is completed.
[0012] Further, a preferred embodiment is provided, wherein the pre-processing of the brain hemorrhage CT image in step 1 further comprises the step of dividing the brain hemorrhage CT image data set into a training set and a validation set, and the ratio of the training set and the validation set is 8:2.
[0013] Further, a preferred embodiment is provided, wherein step 1 further comprises the step of building a dynamic multi-scale encoder, and the dynamic multi-scale encoder uses three different convolutions as multi-scale different receptive field branches for feature extraction.
[0014] Further, a preferred embodiment is provided, wherein the AdaptiveAvgPool2d function is called to perform global average pooling on the feature map obtained by the dynamic multi-scale encoder, and the variable gp is saved, and the boundary mask map obtained by the boundary refining module is subjected to global average pooling to obtain the boundary feature, and the variable boundary_feat is saved.
[0015] Further, a preferred embodiment is provided, wherein the method for constructing the boundary refining module in step 2 is:
[0016] The input segmentation probability map seg is first subjected to morphological operation, and the dilation operation is realized by using 3 The maximum pooling of 3 The average pooling of 3 implements an erosion operation, and the difference between the two obtains a boundary approximation feature, which is saved as boundary; and the position greater than zero in the boundary is judged to generate a binary boundary mask boundary_mask and save it, and then the input seg is used 3 3 convolution constructs a Laplacian high-pass filter kernel, performs high-pass filtering to extract edge high-frequency features, and performs pixel-by-pixel multiplication with boundary_mask to retain only the effective edge information within the boundary; the retained edge features are input into a learnable convolution residual block, which sequentially passes through a 3x3 convolution, a ReLU activation function, and a 1x1 convolution to obtain a correction value, and the correction value is added to the original input segmentation probability map seg pixel by pixel to output the corrected segmentation result refined.
[0017] Further, a preferred embodiment is provided, which includes the following steps in step 3:
[0018] Step 3.1, input splicing and feature extraction backbone construction, calling the cat function of the torch library to splice the input original medical image and the segmentation mask in the channel dimension to form an input tensor;
[0019] Step 3.2, global average pooling is performed on the feature map feat extracted in step 3.1, and the spatial dimension is compressed to 1 1, retaining global semantic information, using 1 1 convolution for channel fusion to generate a scalar output for judging the overall structural authenticity of the image segmentation result;
[0020] Step 3.3, using 3 3 convolution to extract the continuity and local morphological consistency information of the segmentation boundary in the local region, outputting a local discriminant score map local_out similar in spatial dimension to the input, which is used to capture the microscopic scale of the region boundary detail deviation or local morphological abnormality;
[0021] Step 3.4, generator and trainer adversarial training: the generator is the network constructed by steps 3.1 and 3.2, and the discriminator is the global and local discriminators constructed by steps 3.1, 3.2 and 3.3 in step 3; the discriminator outputs disc_real for the input combination of the original image and the true segmentation image, and outputs disc_fake for the input combination of the original image and the predicted segmentation image, disc_fake participates in the adversarial loss of the generator and the discriminator loss, disc_real participates in the discriminator loss, and the discriminator is enabled to warm up so that the discriminator participates in the discrimination after the 15th iteration of model training.
[0022] Option two, a computer readable storage medium, the computer readable storage medium stores a computer program, the computer program is executed by a processor to realize the steps of the method of option one.
[0023] Option three, a computer device, comprising a memory and a processor, the memory stores a computer program, when the processor runs the computer program stored in the memory, the processor executes the method of option one.
[0024] The present application has the advantages of:
[0025] The morphological boundary condition gated dynamic multi-scale medical image segmentation method provided by the application realizes dynamic matching of multi-scale receptive field to local boundary complex region by introducing a multi-scale receptive field structure in the segmentation network, combining a weight generator to adaptively weight each branch output, and further using lesion boundary features extracted by morphological erosion, inflation difference and high-pass filtering as conditional gating input.
[0026] The morphological boundary condition gated dynamic multi-scale medical image segmentation method provided by the application realizes dynamic matching of multi-scale receptive field to local boundary complex region by introducing a multi-scale receptive field structure in the segmentation network, combining a weight generator to adaptively weight each branch output, and further using lesion boundary features extracted by morphological erosion, inflation difference and high-pass filtering as conditional gating input.
[0027] The morphological boundary condition gated dynamic multi-scale medical image segmentation method provided by the application realizes dynamic matching of multi-scale receptive field to local boundary complex region by introducing a multi-scale receptive field structure in the segmentation network, combining a weight generator to adaptively weight each branch output, and further using lesion boundary features extracted by morphological erosion, inflation difference and high-pass filtering as conditional gating input.
[0028] The morphological boundary condition gated dynamic multi-scale medical image segmentation method provided by the application realizes dynamic matching of multi-scale receptive field to local boundary complex region by introducing a multi-scale receptive field structure in the segmentation network, combining a weight generator to adaptively weight each branch output, and further using lesion boundary features extracted by morphological erosion, inflation difference and high-pass filtering as conditional gating input.
[0029] The morphological boundary condition gated dynamic multi-scale medical image segmentation method provided by the application realizes dynamic matching of multi-scale receptive field to local boundary complex region by introducing a multi-scale receptive field structure in the segmentation network, combining a weight generator to adaptively weight each branch output, and further using lesion boundary features extracted by morphological erosion, inflation difference and high-pass filtering as conditional gating input.
[0030] The present application is also applicable to the application field of medical image segmentation. BRIEF DESCRIPTION OF DRAWINGS
[0031] Figure 1 The flowchart of the morphological boundary condition gated dynamic multi-scale medical image segmentation method according to embodiment nine. DETAILED DESCRIPTION
[0032] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application.
[0033] Embodiment one, the embodiment proposes a dynamic multi-scale medical image segmentation method based on morphological boundary condition gating, the method comprises the following steps:
[0034] Step 1, obtaining a CT image of cerebral hemorrhage, and pre-processing the CT image of cerebral hemorrhage, the pre-processing is to make slices along the z-axis to generate a cross-sectional image, and to perform image enhancement on the cross-sectional image;
[0035] Step 2, inputting the pre-processed cross-sectional image into a segmentation network, the segmentation network comprising a dynamic multi-branch perception module for extracting multi-scale features using convolution branches of different sizes or hole rates;
[0036] The branch weight generator is used to dynamically generate the weights of each branch by the global information of the input image and the boundary features extracted by morphological erosion, expansion difference and high-pass filtering, to realize the adaptive adjustment of the multi-scale receptive field driven by the local structure condition;
[0037] The boundary refining module is used to extract edge features by using morphological methods and Laplace high-pass filtering, and to modify the segmentation results by a learnable convolution residual;
[0038] Step 3, combining a dynamic segmentation loss function, assigning different penalty weights according to the size of the hemorrhagic area, and introducing a GAN network, through the joint discrimination of global discriminator and local discriminator, simultaneously performing consistency constraint on the segmentation results at the overall structure and local detail level, to complete the dynamic multi-scale medical image segmentation based on morphological boundary condition gating.
[0039] Embodiment two, the embodiment is a further limitation of the dynamic multi-scale medical image segmentation method based on morphological boundary condition gating described in embodiment one, and the pre-processing of the CT image of cerebral hemorrhage in step 1 further comprises the step of dividing the CT image data set of cerebral hemorrhage into a training set and a validation set, the ratio of the training set and the validation set being 8:2.
[0040] Embodiment three, the embodiment is a further limitation of the dynamic multi-scale medical image segmentation method based on morphological boundary condition gating described in embodiment one, and step 1 further comprises the step of building a dynamic multi-scale encoder, the dynamic multi-scale encoder using three different convolutions as different receptive field branches of multi-scale for feature extraction.
[0041] Embodiment four, this embodiment is a further limitation of the dynamic multi-scale medical image segmentation method based on morphological boundary condition gating described in embodiment one, calling the AdaptiveAvgPool2d function to perform global average pooling on the feature map obtained by the dynamic multi-scale encoder, and saving it in variable gp, and then performing global average pooling on the boundary mask map obtained by the boundary refining module to obtain boundary features, and saving them in variable boundary_feat.
[0042] Embodiment five, this embodiment is a further limitation of the dynamic multi-scale medical image segmentation method based on morphological boundary condition gating described in embodiment one, the method for constructing the boundary refining module in step 2 is:
[0043] The input segmentation probability map seg is first subjected to morphological operation, using 3 3 maximum pooling to realize the dilation operation, using 3 3 average pooling to realize the erosion operation, and the difference between the two is obtained to obtain the boundary approximation feature, which is saved in boundary; and the positions greater than zero in the boundary are judged to generate a binary boundary mask boundary_mask and save it, then use 3 3 convolution to construct a Laplace high-pass filter kernel, perform high-pass filtering to extract edge high-frequency features, and multiply it with boundary_mask pixel by pixel to retain only the effective edge information within the boundary; input the retained edge features into the learnable convolution residual block, and sequentially pass through a layer of 3
[0044] Embodiment six, this embodiment is a further limitation of the dynamic multi-scale medical image segmentation method based on morphological boundary condition gating described in embodiment one, step 3 includes the following steps:
[0045] Step 3.1, input the splicing and feature extraction backbone, call the cat function of the torch library to splice the input original medical image and segmentation mask in the channel dimension to form an input tensor;
[0046] Step 3.2, perform global average pooling on the feature map feat extracted in step 3.1, compress the spatial dimension to 1 1, retain global semantic information, and use 1 1 convolution to do channel fusion to generate a scalar output, which is used to judge the overall structural authenticity of the image segmentation result;
[0047] Step 3.3, use 3 3. The branch extracts the coherence of the segmentation boundary and the local morphological consistency information in the local region, and outputs a local discriminant score map local_out similar to the input spatial dimension. This branch is used to capture the deviation of the region boundary details or the local morphological abnormalities at the microscopic scale.
[0048] Step 3.4, generator and trainer adversarial training: the generator is the network constructed by step 3.1 and step 3.2, and the discriminator is the global and local discriminator constructed by step 3.1, 3.2 and 3.3 in step 3; the discriminator outputs disc_real for the input combination of the original image and the real segmentation image, and outputs disc_fake for the input combination of the original image and the predicted segmentation image, disc_fake participates in the adversarial loss of the generator and the discriminator loss, disc_real participates in the discriminator loss, and the discriminator is enabled to warm up, so that the discriminator participates in the discrimination after the 15th iteration of model training.
[0049] Embodiment seven, the embodiment provides a computer readable storage medium, the computer readable storage medium stores a computer program, the computer program is executed by a processor to realize the steps of the method in any one of embodiments one to five.
[0050] Embodiment eight, the embodiment provides a computer device, including a memory and a processor, the memory stores a computer program, when the processor runs the computer program stored in the memory, the processor executes the method in any one of embodiments one to five.
[0051] Embodiment nine, the embodiment is used to explain the above-mentioned embodiments one to eight, and the embodiment is specifically:
[0052] Referring to Figure 1 The method of the embodiment is described with reference to Figure 1 As shown in the figure, the method of the embodiment specifically includes the following steps:
[0053] Step 1, in order to segment small hemorrhagic areas while avoiding the network from tending to segment large hemorrhagic areas in the training process, we continue to improve the traditional multi-scale convolution, and introduce morphological boundary features as conditional gated input in the branch weight generator. The boundary feature is obtained by the coarse segmentation result through the boundary refining module in step two. The boundary feature and the global feature of the input image are input into the weight generator together, so as to dynamically adjust the weight of each scale branch, and make the receptive field adaptively match according to the size of different lesions and the complexity of the boundary.
[0054] Step 2, To further improve the boundary consistency of the segmentation result, a boundary residual refinement module is integrated at the end of the network. This module extracts boundary features through dilation, erosion and Laplacian high-pass filtering, which is used for gating in step one and for fine compensation of the final segmentation result. At the same time, this step calls various modules in step one to complete the construction of the backbone network ResUNet.
[0055] Step 3, To improve the robustness of the model and the structural consistency of the segmentation result, a GAN network is introduced. The discriminator uses a combination of global and local discrimination, and through the adversarial game between the generator and the discriminator, it helps to improve the segmentation authenticity of small targets and complex boundaries.
[0056] Further, step 1 includes the following steps:
[0057] Step 1.1, data preprocessing: first save the image path with image_path, and convert it to a grayscale image ('L' mode). Then use the resize function to adjust the image size to 256 256, to ensure the consistency of the image size. Next, call the relpath function to get the relative path of image, and save the path as rel_path. Based on rel_path, get the mask path in mask_dir (mask directory), and then process it as image. Use the array function of the NumPy library to convert image and mask images to numpy arrays and normalize them, and save them as image_np and mask_np. Finally, convert to Tensor tensor, create a sample dictionary to save and return. Encapsulate step 1 as HemorrhageDataset class.
[0058] Step 1.2, divide the dataset: use the variable image_paths to load the image, call the train_test_split function in the scikit-learn library to divide the dataset into training set and validation set in the ratio of 8 to 2 (note: test set is another new data), then call the HemorrhageDataset class in step 1 to process the training set and validation set, save them as train_dataset and val_dataset and return. Define step 2 as load_datasets function.
[0059] Step 1.3, Load dataset: Call the load_datasets function in step 2 to split the dataset and save it as train_dataset and val_dataset. Then use the Dataloader in the pytorch library to create data loaders train_loader and val_loader with batch_size=4, shuffle=True, and num_workers=0.
[0060] Step 1.4, Build a dynamic multi-scale encoder: Define three different convolutions as different receptive field branches of multi-scale. The small_branch branch extracts features with a small receptive field, with kernel_size set to 3 (3 3), padding set to 1, and the branch output saved as small_out; the medium_branch branch extracts features with a medium receptive field, with kernel_size set to 5 (5 5), padding set to 2, and the branch output saved as medium_out; the large_branch branch extracts features with a large receptive field, with kernel_size set to 3 (3 3), padding set to 2, and dilation set to 2 (dilated convolution), and the branch output saved as large_brach.
[0061] Step 1.5, Set boundary gating mechanism: Define a variable cond_in_channels initialized to equal the initial input channel in_channels, and enable boundary gating to let cond_in_channels+1 to ensure the input dimension and subsequent concatenation dimension are consistent. Call the AdaptiveAvgPool2d function to perform global average pooling on the feature map obtained in step 1.4, and save it in the variable gp. Then perform global average pooling on the boundary_mask (boundary mask map) obtained from the boundary refinement module to obtain the boundary feature, and save it in the variable boundary_feat. Call the torch.cat function in the Pytorch library to concatenate the pooled gp and boundary_feat feature information along dim=1.
[0062] Step 1.6, Set weight generator: Use two layers of convolution to generate weights. The first layer uses a 1 1 convolution to compress the features and reduce the computational load, with input channels cond_in_channels and output channels in_channels / 4, then call the ReLU function for nonlinear activation. The second layer uses a 1 The convolution of step 1 reduces the number of channels again, the input channel is the output channel of the last layer, the output channel is 1, and the intermediate dimension is mapped to 3 output weights. Use Softmax (dim=1) to normalize, ensure that the sum of the three output weights is 1, and save the variables w1, w2, and w3.
[0063] Finally, w1 small_out + w2 medium_out + w3 large_out
[0064] Step 1.4, 1.5, 1.6 are encapsulated as DynamicEncoder class.
[0065] Step 1.7, build attention module: similar to the weight generator in step 6, first call AdaptiveAvgPool2d function to perform global average pooling on the input image to extract global features. The first layer uses 1 1 convolution dimension reduction, and then use ReLU for nonlinear activation. The second layer uses 1 1 convolution to reduce dimension again, the number of output channels here is the output channel of each layer of the subsequent ResUNet, and finally use the sigmoid function to normalize to get the weight saved in variable se, and return x se (x is the input feature).
[0066] Step 1.7 is encapsulated as SEBlock class.
[0067] Step 1.8, build residual connection module: judge whether the input channel in_channels is equal to the output channel out_channels, if not, use 1 1 convolution to change the number of input channels so that it can be added to the output later, then use BatchNorm2d for batch normalization, and finally define the variable redidual to save; if equal, do nothing. Define a boolean variable use_attention, call the SEBlock class of step 1.7 if True; if False, do not enable attention mechanism. Define variable out to save the feature map obtained by conv1 and conv2 two convolution layers, then perform residual connection, add the feature map in redidual to the feature map in out. Finally, use ReLU for nonlinear activation and return out.
[0068] conv1: DynamicEncoder class.
[0069] conv2: ConvBlock block, first use 3 3convolutional feature extraction, followed by BatchNorm2d batch normalization, and finally ReLU for non-linear activation.
[0070] Step 1.8, encapsulate as ResidualBlock class.
[0071] Step 1.9, encapsulate encoder and decoder: encoder sets use_boundary_gating parameter, True to enable, False to disable. First call MaxPool2d to quickly reduce spatial size, then call ResidualBlock class to further do context modeling and dynamic receptive field selection on low resolution. Decoder calls ConvTranspose2d function, which uses kernel_size=2 and stride=2 to upsample the feature map obtained by the encoder, and increases the spatial resolution by 2 times. Then for the spatial dimension mismatch caused by the upsampling process, call the interpolate function to adjust the resolution by bilinear interpolation. Perform jump connection, and finally flow the spliced features into ResidualBlock for multi-scale receptive field dynamic fusion and boundary gating. The boudary_mask plays a major role in the decoding stage, using the boundary conditions obtained by morphological operation to dynamically adjust the multi-scale branch weight and enhance the consistency of local boundaries.
[0072] The encoder is encapsulated as EncoderBlock class, and the decoder is encapsulated as DecoderBlock class.
[0073] Further, step 2 includes the following steps:
[0074] Step 2.1, build boundary refinement module: input segmentation probability map seg. First, perform morphological operation on seg, use 3 3max pooling (MaxPool2d) to realize dilation operation, use 3 3average pooling (AvgPool2d) to realize erosion operation, and the difference between the two is the boundary approximation feature, which is saved as boundary. Determine the position of the boundary greater than zero, generate a binary boundary mask boundary_mask and save it. Then use 3 3convolutional building Laplacian high-pass filter kernel, high-pass filter to extract edge high-frequency features, and multiply it with boundary_mask pixel by pixel, only keep the effective edge information within the boundary. Then the reserved edge features are input into the learnable convolutional residual block, and sequentially pass through a 3x3 convolution, a ReLU activation function and a 1x1 convolution to obtain a correction value. Add the correction value and the original input seg pixel by pixel to output the corrected segmentation result refined. Finally, return refined and boundary_mask for branch conditional gating and boundary consistency optimization.
[0075] Step 2.1 encapsulation as Boundary class.
[0076] Step 2.2, input block and preliminary feature extraction: the original image x is first input into the in_block block to extract shallow local features, and the output feature map x1 is used as the basic feature representation of the Encoder stage. The in_block block includes 3 3convolution, ReLU activation function and ResidualBlock, which changes the output channel to 64.
[0077] Step 2.3, multi-scale feature extraction and boundary mask generation in the Encoder stage: input x1 into enc1 to get x2, and enc1 does not use boundary conditional gating. Input x2 through coarse_seg_head to get coarse_seg, which is a 1 1convolution and Sigmoid activation to generate coarse segmentation probability map coarse_seg, and input it into the boundary refinement module in step 2.1 to perform morphological operations and high-pass filtering to generate boundary_mask. Then input x2 and boundary_mask into enc2 to get x3, and input x3 and boundary_mask into enc3 to get x4.
[0078] enc1, enc2, enc3: call the EncoderBlock class in step 1.9 in step 1.
[0079] x2, x3, x4: intermediate feature maps extracted by different depth encoding layers.
[0080] Step 2.4, Decoder stage feature reconstruction and coarse-to-fine cascade refinement: input the deepest encoded feature x4 into dec1, perform skip connection splicing with the x3 feature output by enc3, and at the same time combine boundary_mask to dynamically adjust the multi-scale branch weight through DynamicEncoder, output the reconstructed feature y1. Then input y1 and x2 into dec2 to obtain y2, and input y2 and x1 into dec3 to obtain y3. After completing the preliminary feature reconstruction, y3 and coarse_seg are spliced to form refine input. Finally, refine input refine_block, through the learnable residual fast, the coarse segmentation result is refined and compensated, and refined_seg is output.
[0081] refine_block: 3 3 convolution, ReLU nonlinear activation, ResidualBlock class.
[0082] Step 2.5, final segmentation output and morphological boundary consistency optimization: input refined_seg into boundary refinement module Boundary to further correct the edge details of refine_seg, and finally output final_out as the final segmentation prediction result of the brain hemorrhage area and return.
[0083] Further, step 3 includes the following steps:
[0084] Step 3.1, input splicing and feature extraction backbone construction: call the cat function of the torch library to splice the input original medical image and segmentation mask in the channel dimension, form an input tensor, and the channel number is in_channels=2 (original image + real segmentation image / predicted segmentation image). The input is extracted through a group of 3-layer cascaded convolution modules to extract multi-layer discriminative features, and the intermediate feature map obtained by the extraction backbone is saved as feat, which contains multi-scale spatial and texture discriminative information of the target structure.
[0085] 3-layer cascaded convolution module includes the following:
[0086] First layer: 4 4 convolution, stride 2, output channel number base_channels (64), using LeakyReLU activation.
[0087] Second layer: 4 4 convolution, stride 2, output channel number base_channels 2 (128), using BatchNorm for batch normalization and LeakyReLU activation.
[0088] Third layer: 4 4convolution, stride 2, base_channels output channels 4(256) with BatchNorm for batch normalization and LeakyReLU activation.
[0089] Step 3.2, global structure discriminator branch: global average pooling is performed on the feature map feat extracted in step 3.1, and the spatial dimension is compressed to 1 1, retaining global semantic information. Then use 1 1convolution to do channel fusion to generate scalar output, which is used to distinguish the overall structure authenticity of the image segmentation result. The branch output global_out reflects whether the current output has global consistency features of the real segmentation structure.
[0090] Step 3.3, local boundary discriminator branch: 3 3convolution is used to extract the continuity and local morphological consistency information of the segmentation boundary in the local region, and the output local_out is a local discriminant score map with a spatial dimension similar to the input. This branch is used to capture the microscopic scale of regional boundary detail deviation or local morphological abnormalities.
[0091] Step 3.4, generator and trainer adversarial training: the generator is the network constructed by steps one and two, and the discriminator is the global+local discriminator constructed by steps 3.1-3.3 in step three. The discriminator outputs disc_real for the input combination of the original image+real segmentation image, and outputs disc_fake for the input combination of the original image+predicted segmentation image. disc_fake participates in the adversarial loss of the generator and the discriminator loss, and disc_real participates in the discriminator loss. Enable the discriminator preheating, and let the discriminator participate in the discrimination after the 15th iteration of model training.
[0092] Those skilled in the art can understand that the above description is only preferred embodiments of the present application, and the features described in various embodiments and / or technical solutions of the present disclosure can be combined or combined, even if such combination or combination is not explicitly described in the present disclosure. It is not intended to limit the present application, although the present application has been described in detail with reference to the foregoing embodiments, and those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent replacements for part of the technical features, any modification, equivalent replacement, improvement, etc. within the spirit and principles of the present application shall be included in the protection scope of the present application.
[0093] While the preferred embodiments of the application have been described, additional variations and modifications can be made to these embodiments by those skilled in the art once they have the benefit of the present disclosure. Therefore, the appended claims are intended to encompass within their scope all possible variations and modifications of the preferred embodiments. It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application encompass all such modifications and variations as fall within the scope of the present disclosure and its equivalents.
Claims
1. A dynamic multi-scale medical image segmentation method based on morphological boundary condition gating, characterized in that, The method comprises the following steps: Step 1, obtaining a CT image of cerebral hemorrhage, and pre-processing the CT image of cerebral hemorrhage, the pre-processing being generating a cross-sectional image by slicing along the z-axis, and performing image enhancement on the cross-sectional image; Step 2, inputting the pre-processed cross-sectional image into a segmentation network, the segmentation network comprising: a dynamic multi-branch perception module for extracting multi-scale features by using convolution branches of different sizes or hole rates; a branch weight generator for dynamically generating weights of each branch by jointly regulating global information of an input image and boundary features extracted by morphological erosion, dilation difference and high-pass filtering, so as to realize adaptive adjustment of multi-scale receptive fields driven by local structure conditions; a boundary refining module for extracting edge features by using morphological methods and Laplacian high-pass filtering, and performing edge consistency correction on a segmentation result by a learnable convolution residual; Step 3, combining a dynamic segmentation loss function, assigning different penalty weights according to the size of a hemorrhagic region, and introducing a GAN network, so as to simultaneously perform consistency constraint on a segmentation result at a whole structure and a local detail level by joint discrimination of a global discriminator and a local discriminator, and complete dynamic multi-scale medical image segmentation based on a morphological boundary condition gate; The method for constructing the boundary refining module in step 2 is: Input segmentation probability map seg, first morphological operation is performed on the segmentation probability map seg, using 3 3 max pooling realizes dilation operation, using 3 3 average pooling realizes erosion operation, and the difference between the two is obtained to obtain a boundary approximation feature, which is saved as boundary; It is judged that the position greater than zero in the boundary is generated, a binary boundary mask boundary_mask is saved, and then 3 3 convolution is used to construct a Laplace high-pass filter kernel, high-pass filtering is performed to extract edge high-frequency features, and pixel-by-pixel multiplication is performed with boundary_mask to retain only the effective edge information within the boundary; The retained edge features are input into a learnable convolution residual block, and a layer of 3*3 convolution, a ReLU activation function and a layer of 1*1 convolution are sequentially passed to obtain a correction value, and the correction value is added to the original input segmentation probability map seg pixel by pixel to output the corrected segmentation result refined. Step 3 comprises the following steps: Step 3.1, input splicing and feature extraction backbone construction, calling the cat function of the torch library to splice the input original medical image and the segmentation mask in the channel dimension to form an input tensor; Step 3.2, global average pooling is performed on the feature map feat extracted in step 3.1, and the spatial dimension is compressed to 1 1, the global semantic information is reserved, and 1 1 convolution is used to fuse channels to generate a scalar output, which is used to judge the overall structure authenticity of the image segmentation result; Step 3.3, apply 3 3Convolution extracts the coherence of segmentation boundary and local morphological consistency information in local region, outputs local discriminant score map local_out similar to the input spatial dimension, and the local boundary discriminant branch is used to capture the deviation of region boundary details or local morphological abnormalities at the microscopic scale; Step 3.4, generator and trainer adversarial training: the generator is the network constructed by step 3.1 and step 3.2, the discriminator is the global and local discriminators constructed by step 3.1, 3.2 and 3.3 in step 3; the discriminator outputs disc_real for the input combination of the original image and the real segmentation image, and outputs disc_fake for the input combination of the original image and the predicted segmentation image, disc_fake participates in the adversarial loss of the generator and the discriminator loss, disc_real participates in the discriminator loss, and the discriminator is enabled to warm up and participate in discrimination after the 15th iteration.
2. The dynamic multi-scale medical image segmentation method based on morphological boundary condition gating according to claim 1, characterized in that, In step 1, the pre-processing of the CT image of cerebral hemorrhage further comprises the step of dividing the CT image data set of cerebral hemorrhage into a training set and a validation set, and the ratio of the training set and the validation set is 8:
2.
3. The dynamic multi-scale medical image segmentation method based on morphological boundary condition gating according to claim 1, characterized in that, Step 1 further comprises the step of building a dynamic multi-scale encoder, the dynamic multi-scale encoder uses three different convolutions as multi-scale different receptive field branches for feature extraction.
4. The dynamic multi-scale medical image segmentation method based on morphological boundary condition gating according to claim 3, characterized in that, The AdaptiveAvgPool2d function is called to perform global average pooling on the feature map obtained by the dynamic multi-scale encoder, and the variable gp is saved, and the boundary mask image obtained by the boundary refining module is subjected to global average pooling to obtain boundary features, and the variable boundary_feat is saved.
5. A computer storage medium having stored thereon a computer program, characterized in that The computer program is executed by the processor to realize the method of any one of claims 1-4.
6. A computer device, comprising: It comprises: - a memory, a processor and a computer program stored on the memory and runable on the processor, the processor executing the program to implement the method of any one of claims 1-4.
Citation Information
Patent Citations
MRI medical image correction method and system based on convolutional neural network, and computer readable storage medium
CN119963681A