Medical image segmentation methods, networks, electronic devices, storage media, and computer program products
Through the synergistic effect of a six-stage encoding and decoding architecture and innovative modules, the problem of accurate segmentation of early gastric cancer lesions has been solved, achieving efficient and accurate lesion segmentation and quantitative analysis, which is suitable for real-time segmentation and quantitative diagnosis of early gastric cancer.
Patent Information
- Application Number
- CN202511029133.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-25
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2045-07-25
AI Technical Summary
Existing medical image segmentation technologies struggle to accurately segment early gastric cancer lesions, especially those with irregular shapes, blurred boundaries, and low contrast. Furthermore, high-performance segmentation models suffer from low computational efficiency, making them difficult to deploy in real-time in clinical hardware environments.
A six-stage encoding and decoding architecture is adopted, which combines the improved convolution module PCMUB, the dynamic attention module DAA, and the spatial channel fusion attention module SCSAM. Through dynamic serpentine convolution and multi-scale feature extraction, accurate segmentation of lesions is achieved.
It improves the pixel-level segmentation accuracy of lesions, overcomes the problem of inefficient representation of irregular boundaries by traditional networks, reduces the number of model parameters, improves computational efficiency, and supports real-time segmentation and quantitative analysis of early gastric cancer.
Smart Images

Figure CN120876862B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical image processing technology. More specifically, this invention relates to a medical image segmentation method, a network, an electronic device, a storage medium, and a computer program product. Background Technology
[0002] Accurate segmentation of early-stage gastric cancer is crucial for clinical diagnosis, but current medical image segmentation technologies face numerous challenges.
[0003] First, segmenting irregular lesions is difficult: early gastric cancer lesions often present with irregular shapes, blurred boundaries and low contrast. Traditional segmentation networks (such as U-Net) have fixed receptive fields that are difficult to adapt to complex geometric shapes and cannot adaptively adjust the range of the receptive field, resulting in inaccurate boundary segmentation and difficulty in accurately distinguishing low-contrast lesions from the background, thus creating a dual bottleneck of segmentation accuracy and robustness.
[0004] Secondly, computational efficiency bottleneck: the large number of parameters in high-performance segmentation models severely restricts their real-time deployment and application in clinical hardware environments.
[0005] Third, the limitations of the attention mechanism: Traditional spatial / channel attention independent computation shows limitations in expressive power and flexibility when capturing the fine local features and complex global context information required for early gastric cancer lesions. In particular, it lacks flexibility in handling irregular boundaries and is difficult to meet the clinical demand for high-precision segmentation.
[0006] Therefore, there is an urgent need for a medical image segmentation method to break through the clinical bottleneck of accurate segmentation of early gastric cancer. Summary of the Invention
[0007] To achieve these objectives and other advantages according to the present invention, a medical image segmentation method is provided, comprising the following steps:
[0008] Step 1: Input the medical image into the encoder path and perform six-stage encoding processing:
[0009] From the first to the third encoding stage: features are extracted sequentially through a standard 3×3 convolutional layer, and the spatial resolution is reduced through a downsampling module;
[0010] From the fourth to the sixth encoding stages: features are extracted sequentially through an improved convolution module and the spatial resolution is reduced through a downsampling module. The improved convolution module performs standard convolution on some channels of the input feature map through a channel splitting mechanism, while the other channels are directly concatenated and residual connected.
[0011] Step 2: After the sixth stage of encoding, the features are processed through a dynamic attention module:
[0012] Dynamic snake convolution processing is performed along the horizontal and vertical directions respectively. The sampling position is dynamically adjusted by a learnable offset. Bidirectional features are fused and a spatial attention map is generated by the Sigmoid activation function.
[0013] Step 3: Input the output of the dynamic attention module into the decoder path and perform a six-stage decoding process:
[0014] From the sixth decoding stage to the fourth decoding stage: the spatial size is restored by the upsampling module, the skip connection features of the corresponding encoding stage optimized by the spatial channel fusion attention module are fused, and the fused features are processed by the improved convolution module;
[0015] From the third decoding stage to the first decoding stage: the spatial size is restored by the upsampling module, the skip connection features of the corresponding encoding stage optimized by the spatial channel fusion attention module are fused, and the fused features are processed by a standard 3×3 convolutional layer;
[0016] Step 4: Perform 3×3 convolution processing on the features output from the first stage of the decoder to generate a single-channel segmentation mask.
[0017] Preferably, the improved convolution module processes the following:
[0018] The input feature map is split into a first subset and a second subset along the channel dimension. The number of channels in the first subset accounts for 1 / ndiv of the total number of channels, where ndiv is an integer from 2 to 4.
[0019] Perform standard 3×3 convolution processing on the first subset, while leaving the second subset unchanged;
[0020] The processed first subset and the unprocessed second subset are concatenated along the channel dimension;
[0021] The concatenated result is added to the original input features using residual addition;
[0022] The summation result is processed sequentially with 1×1 convolution to expand the channel, GELU activation function, and 1×1 convolution to compress the channel.
[0023] Preferably, the dynamic attention module processing includes:
[0024] The input features are processed sequentially by average pooling and 1×1 convolution to aggregate spatial information and extract local region features;
[0025] Features are processed by dynamic serpentine convolution in the horizontal direction, and the horizontal sampling position is adjusted by a learnable offset to capture long-distance dependencies in the horizontal direction.
[0026] Features are processed by dynamic serpentine convolution in the vertical direction, and the vertical sampling position is adjusted by a learnable offset to capture long-distance dependencies in the vertical direction.
[0027] The processed features are subjected to 1×1 convolution to fuse dynamic features in the horizontal and vertical directions, and then the output is normalized by the Sigmoid activation function to generate a spatial attention weight map.
[0028] Preferably, the spatial channel fusion attention module processing includes:
[0029] Multi-scale spatial information is extracted from the input features to generate spatial attention maps in the horizontal and vertical directions, respectively.
[0030] The two spatial attention maps are multiplied element-wise with the original input features to obtain the spatially modulated intermediate features;
[0031] Local spatial reconstruction processing is performed on the spatially modulated intermediate features to reconstruct the ws×ws local region features to the channel dimension, where ws is an integer from 2 to 4;
[0032] Perform 1×1 convolution processing on the recombined features to restore the number of channels to the original number of channels, and then perform group normalization processing with a grouping number of 1;
[0033] Perform spatial self-attention computation on the normalized and dimensionality-reduced features;
[0034] Global pooling is performed on the spatial self-attention results to compress the spatial dimension to 1×1, and then a channel attention map is generated by the Sigmoid activation function.
[0035] Multiply the channel attention map element-wise with the spatially modulated intermediate features.
[0036] Preferably,
[0037] The downsampling module performs group normalization, max pooling, and GELU activation function processing.
[0038] The upsampling module performs group normalization, bilinear interpolation, and GELU activation function processing.
[0039] The medical image segmentation network applied to the aforementioned medical image segmentation method includes:
[0040] The input module is used to receive medical images;
[0041] The encoder module contains a six-stage encoding unit for encoding medical images. The first three encoding stages pass through a standard 3×3 convolutional layer and a downsampling module in sequence, while the last three encoding stages pass through an improved convolutional module and a downsampling module in sequence. The improved convolutional module performs standard convolution on some channels of the input feature map through a channel splitting mechanism, while the other channels are directly concatenated and residually connected.
[0042] The dynamic attention module is used to perform deformable convolution operations on the output features of the sixth encoding stage along the horizontal and vertical directions, respectively. It dynamically adjusts the sampling position through learnable offsets, fuses bidirectional features, and generates a spatial attention map.
[0043] The decoder module contains a six-stage decoding unit for performing decoding processing on the output of the dynamic attention module. The sixth to fourth decoding stages process features through an upsampling module, an improved convolutional module, and a spatial channel fusion attention module. The third to first decoding stages process features through an upsampling module, a standard 3×3 convolutional layer, and a spatial channel fusion attention module. The spatial channel fusion attention module is used to optimize the skip connection features of the corresponding encoding stage.
[0044] The output module is used to perform 3×3 convolution on the output features of the first decoding stage to generate a single-channel segmentation mask.
[0045] Preferably,
[0046] The improved convolutional module includes:
[0047] The channel splitting unit is used to split the input feature map into a first subset and a second subset in the channel dimension according to the ratios of 1 / ndiv and ndiv-1 / ndiv, where ndiv is an integer from 2 to 4;
[0048] The convolution processing unit performs standard 3×3 convolution processing on the first subset, while the second subset remains unchanged.
[0049] The residual connection unit is used to concatenate the processed first subset and the unprocessed second subset along the channel dimension and then add the residual to the original input features;
[0050] The feature transformation unit is used to sequentially perform 1×1 convolution expansion channel processing, GELU activation function processing, and 1×1 convolution compression channel processing on the summation result;
[0051] The dynamic attention module includes:
[0052] The feature aggregation unit is used to perform average pooling and 1×1 convolution on the input features to extract local region features;
[0053] The horizontal convolutional unit is used to process features through dynamic serpentine convolution in the horizontal direction. It adjusts the horizontal sampling position through learnable offsets to capture long-distance dependencies in the horizontal direction.
[0054] Vertical convolutional units are used to process features through dynamic serpentine convolution in the vertical direction. They adjust the vertical sampling position through learnable offsets to capture long-distance vertical dependencies.
[0055] The attention generation unit is used to perform 1×1 convolution on the processed features to fuse the dynamic features in the horizontal and vertical directions, and then normalize the output through the Sigmoid activation function to generate a spatial attention weight map.
[0056] The spatial channel fusion attention module includes:
[0057] Multi-scale spatial attention unit is used to extract multi-scale spatial information from input features and generate spatial attention maps in the horizontal and vertical directions;
[0058] The spatial modulation unit is used to multiply the two-directional spatial attention map with the original input features element by element to obtain the spatially modulated intermediate features;
[0059] The local recombination unit is used to perform a ws×ws local region to channel dimension recombination operation on the intermediate features of spatial modulation, where ws is an integer from 2 to 4.
[0060] The feature processing unit is used to perform 1×1 convolution dimensionality reduction and group normalization processing with a group number of 1 on the recombined features;
[0061] Spatial self-attention unit, used to perform spatial self-attention computation on the normalized and dimensionality-reduced features;
[0062] The channel attention unit is used to perform global pooling on the spatial self-attention results, compressing the spatial dimension to 1×1, and then generating a channel attention map through the Sigmoid activation function;
[0063] The feature fusion unit is used to multiply the channel attention map element-wise with the spatially modulated intermediate features.
[0064] An electronic device includes: at least one processor and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the method.
[0065] A storage medium on which a computer program is stored, which, when executed by a processor, implements the method described thereon.
[0066] A computer program product comprising a computer program that, when executed by a processor, implements the method described. This invention offers at least the following advantages:
[0067] First, this invention preserves multi-scale features through the channel splitting-residual mechanism of PCMUB, adaptively captures boundaries through the deformable snake convolution of DAA, and combines multi-scale feature discrimination of SCSAM to accurately address clinical pain points such as irregular morphology, blurred boundaries, low contrast and artifact interference in early gastric cancer. It achieves a breakthrough in pixel-level segmentation accuracy of lesions, enhances the model's adaptability to complex images, and solves the problem of inefficient representation of irregular boundaries by traditional fixed convolution.
[0068] Secondly, this invention relies on the dynamic modeling capabilities of DAA, and the network can adaptively capture the changing shape, spatial distribution, and contextual relationships of lesions, breaking through the limitations of fixed receptive fields in representing complex geometric morphologies, and providing fine geometric constraints for high-precision segmentation. Simultaneously, through the lightweight design of PCMUB (channel splitting to reduce redundant computation), the number of model parameters and computational complexity are reduced while ensuring or improving segmentation performance, thereby increasing inference speed and breaking through the computing power bottleneck of real-time deployment of high-performance models in clinical hardware environments.
[0069] Third, this invention, with its six-stage encoding and decoding architecture and the synergistic advantages of multiple modules, transforms precise segmentation capabilities into a clinically usable core component. The output lesion mask directly supports doctors in accurately locating lesions, quantitatively analyzing morphological parameters (area, perimeter, etc.), and assisting in treatment planning. This promotes a more reliable and practical development of early gastric cancer computer-aided diagnostic systems, moving from "qualitative labeling" to "quantitative decision support," and provides doctors with precise lesion localization, quantitative analysis, and treatment planning support. Attached Figure Description
[0070] Figure 1 This is a flowchart illustrating one technical solution of the present invention;
[0071] Figure 2 This is a visualization of the black-and-white masking result of an example of the present invention;
[0072] Figure 3 This is a visualization of the color overlay result of an example of the present invention. Detailed Implementation
[0073] The present invention will now be described in further detail with reference to the accompanying drawings, so that those skilled in the art can implement it based on the description.
[0074] It should be understood that terms such as “having,” “comprising,” and “including” as used herein do not exclude the presence or addition of one or more other elements or combinations thereof.
[0075] It should be noted that, unless otherwise specified, the experimental methods described in the following embodiments are all conventional methods, and the reagents and materials described are all commercially available unless otherwise specified, and therefore should not be construed as limiting the present invention.
[0076] like Figure 1 As shown, this invention provides a medical image segmentation method, the core of which lies in achieving accurate lesion segmentation through a six-stage encoding and decoding architecture and three innovative modules, including the following steps:
[0077] Step 1: Input the medical image into the encoder path, such as a 512×512 endoscopic image of early gastric cancer, and perform six-stage encoding processing:
[0078] The first to third encoding stages (Stage 1-3) extract features sequentially through a standard 3×3 convolutional layer and reduce spatial resolution through a downsampling module (DSM). The DSM sequentially performs group normalization, max pooling, and GELU activation function processing to achieve feature standardization and halving of spatial size.
[0079] Encoding stages 4-6: Features are extracted sequentially using the improved convolutional module PCMUB, and the spatial resolution is reduced using the downsampling module DSM. The DSM performs group normalization, max pooling, and GELU activation function processing sequentially to achieve feature standardization and halving of spatial size. The improved convolutional module performs standard convolution on a portion of the input feature map through a channel splitting mechanism, splitting the input feature map into a first subset and a second subset in the channel dimension. The first subset has 1 / n of the total number of channels. div n div For integers between 2 and 4, standard 3×3 convolution processing is performed on the first subset, allowing feature interaction and fusion between channels of the first subset, thereby capturing richer local spatial patterns than independent channel processing. Another part of the channels are passed directly, that is, the second subset remains unchanged and does not undergo spatial convolution operation, forming a feature bypass. The processed first subset and the unprocessed second subset are concatenated along the channel dimension, and the concatenation result is added to the original input features using residual processing. The added result is then processed sequentially with 1×1 convolution to expand the channels, GELU activation function processing, and 1×1 convolution to compress the channels, effectively reducing the amount of computation and enhancing the local feature representation.
[0080] Specifically, the improved convolutional module PCMUB performs the following:
[0081] (1) Input feature map Partial Convolution (PConv) is performed, followed by GELU activation and Batch Normalization (BN). Finally, residual connections are made with the original input to obtain the output feature map of the residual block. ;
[0082] R = BN( ))
[0083] = + R
[0084] (2) Feature extension: for Apply the first 1×1 convolutional layer Next, GELU activation and Batch Normalization (BN) are used to expand the channel dimension, ultimately resulting in the expanded feature map. ;
[0085] = BN( ( ))
[0086] (3) Feature projection: for A second 1×1 convolutional layer is applied, followed by GELU activation and Batch Normalization (BN) to project the channel dimensions back to their original size, resulting in the final output feature map. ;
[0087] = BN( ( ( )))
[0088] Step 2: After the sixth stage of encoding, the features are processed using the Dynamic Attention Module (DAA), including:
[0089] The input features are processed sequentially by average pooling to aggregate spatial information, and then processed by 1×1 convolution to extract local region features.
[0090] Dynamic Axial Feature Extraction: Innovatively, the traditional horizontal and vertical depth-separable convolutions are replaced with dynamic snake convolutions. Dynamic snake convolution processing is performed along the horizontal and vertical directions respectively. Two parallel DSConv (DynamicSnake Convolution) branches: one along the horizontal direction (using DSConv's morph=0 setting) and the other along the vertical direction (using DSConv's morph=1 setting), capture the dynamic dependencies of the input feature map along their respective axes. The sampling position is dynamically adjusted through learnable offsets. Features are processed through dynamic snake convolution in the horizontal direction, and the sampling position in the horizontal direction is adjusted through learnable offsets to capture long-distance dependencies in the horizontal direction. Features are processed through dynamic snake convolution in the vertical direction, and the sampling position in the vertical direction is adjusted through learnable offsets to capture long-distance dependencies in the vertical direction. The dynamic sampling capability enables the module to better align irregular lesion edges and internal structures, rather than being restricted to fixed grid points.
[0091] The processed features are subjected to 1×1 convolution to fuse dynamic features in the horizontal and vertical directions. The output is then normalized by the Sigmoid activation function to generate a spatial attention weight map, which captures global context and irregular boundary features. This reflects the module's assessment of the importance of each spatial location in the input feature map, and is particularly good at highlighting regions related to irregular lesions.
[0092] Specifically, the Dynamic Attention Module (DAA) execution includes:
[0093] (1) Extracting local region features: For the input feature map Perform average pooling Aggregate spatial information and then perform convolution processing. Perform channel processing to obtain intermediate features ;
[0094] = ( ( ))
[0095] (2) Horizontal context capture: In Apply a learnable offset to the top Depth-separable horizontal strip convolution The output of the convolution operation is then passed through the activation function Act to obtain intermediate features. ;
[0096] = Act( ( ))
[0097] Vertical context capture: in Apply a learnable offset to the top Depth-separable vertical strip convolution The output of the convolution operation is then passed through the activation function Act to obtain intermediate features. ;
[0098] = Act( ( ))
[0099] (4) Generate attention weights: for features that integrate long-range contextual information Apply a 1×1 convolution The attention weight map is obtained by normalizing the output to the range (0,1) using the Sigmoid activation function. .
[0100] = Sigmoid( ( ))
[0101] By using the Dynamic Attention Module (DAA) for processing, deformable sampling adaptively aligns the lesion edges, overcoming the limitations of static convolution in representing irregular shapes.
[0102] Step 3: Input the output of the dynamic attention module into the decoder path and perform a six-stage decoding process:
[0103] Stages 6-4: The spatial dimensions are restored by the upsampling module USM. The upsampling module USM performs group normalization, max pooling, and GELU activation function processing. It then fuses the skip connection features of the corresponding encoding stage optimized by the spatial channel fusion attention module SCSAM (the features of Stages 1-5 are processed by SCSAM multi-scale spatial attention and channel attention). Finally, the fused features are processed by the improved convolution module PCMUB.
[0104] From the third decoding stage to the first decoding stage (Stage 3-1): The spatial dimensions are restored through the upsampling module USM. The upsampling module USM performs group normalization, max pooling, and GELU activation function processing, and fuses the skip connection features of the corresponding encoding stage after optimization by the spatial channel fusion attention module SCSAM (the features of Stage 1-5 are processed by SCSAM multi-scale spatial attention and channel attention). The fused features are then processed by a standard 3×3 convolutional layer.
[0105] The Spatial Channel Fusion Attention Module (SCSAM) processing includes:
[0106] Multi-scale spatial information (such as grouped 1D convolutions with kernel sizes of 3, 5, and 7) is extracted from the input features to generate spatial attention maps in the horizontal and vertical directions, respectively.
[0107] The two spatial attention maps are multiplied element-wise with the original input features to obtain the spatially modulated intermediate features;
[0108] Local spatial reconstruction processing is performed on the spatially modulated intermediate features to reconstruct the ws×ws local region features to the channel dimension, where ws is an integer from 2 to 4;
[0109] Perform 1×1 convolution processing on the recombined features to restore the number of channels to the original number of channels, and then perform group normalization processing with a grouping number of 1;
[0110] Perform spatial self-attention computation on the normalized and dimensionality-reduced features;
[0111] Global pooling is performed on the spatial self-attention results to compress the spatial dimension to 1×1, and then a channel attention map is generated by the Sigmoid activation function.
[0112] Multiply the channel attention map element-wise with the spatially modulated intermediate features.
[0113] Specifically, the Spatial Channel Fusion Attention Module (SCSAM) performs the following:
[0114] (1) Multi-semantic spatial information extraction and modulation: from input features Multi-scale spatial information is extracted, a spatial attention map is generated, and the feature map is spatially modulated to obtain intermediate features. . and Indicates based on input features extract H and W Spatial attention maps generated from multi-semantic spatial information of orientation (through pooling, grouped sub-features, shared multi-scale 1D convolution, grouped normalized GN4, and sigmoid). This represents element-wise multiplication;
[0115] = ( ) ( )
[0116] (2) Progressive spatial reorganization and compression: for features after spatial modulation Perform spatial downsampling. This indicates that a local spatial region of ws×ws is reorganized into the channel dimension, followed by... Projecting the number of channels back to its original size, this step reduces the feature map space size from ( H , W ) becomes ( H / ws, W / ws);
[0117] = ( ( ))
[0118] (3) Channel feature learning based on spatial self-attention: in downsampling features Computational space self-attention, for Perform single group Q, K, and V are obtained through the projection layer Proj (implemented by a 1×1 DWConv). This indicates that multi-head self-attention is computed in the downsampled spatial dimension;
[0119] = (Proj( ( )))
[0120] (4) Channel attention generation and application: the intermediate results of spatial self-attention The data converges to the channel dimension, and the final channel attention weights are generated using the Sigmoid algorithm and then applied. To obtain the final output .
[0121] = ( ( ))
[0122] =
[0123] This process employs spatial-channel collaborative attention interaction:
[0124] The spatial attention branch aims to aggregate multi-scale spatial contexts, effectively capturing local structural patterns and broader spatial dependencies on the horizontal and vertical axes. This multi-scale aggregation is particularly valuable for early gastric cancer, as lesions may exhibit different shapes and textures.
[0125] A key innovation of the channel attention branch is the use of a local spatially preserved feature condensation strategy (local reorganization) before self-attention computation. Unlike traditional spatial pooling, which discards fine-grained spatial relationships within the downsampling window, this approach reshapes local pixel neighborhoods into extended channel dimensions. Subsequent 1×1 convolutions then intelligently fuse this rich local spatial information with channel features. This method ensures that the learned channel attention not only captures global channel interdependencies but also remains highly sensitive to the spatial arrangement of features within local regions. This is crucial for accurately identifying and segmenting small, subtle lesions with highly discriminative local context.
[0126] Step 4: Perform 3×3 convolution processing on the features output from the first stage of the decoder to generate a single-channel segmentation mask, thereby achieving pixel-level segmentation of lesions.
[0127] In the above technical solution, the present invention has the following improvements and beneficial effects:
[0128] (1) This invention replaces the traditional convolutional module with PCUMB in the encoder and decoder of the U-Net architecture for early gastric cancer segmentation. The PCUMB of this invention is an improved CMUNeXt Block. The original CMUNeXt Block effectively expands the receptive field while maintaining computational efficiency by combining large kernel depth convolution and efficient 1×1 convolution, which has shown potential in medical image segmentation tasks. However, the original CMUNeXt Block performs independent spatial filtering on all input channels without exploring the local correlation between channels, and applying uniform spatial processing to all channels may be redundant, especially when processing lesions in early gastric cancer images that may exhibit subtle texture and shape changes. The PCUMB of this invention introduces a mechanism based on channel splitting and partial convolution in the internal residual path, replacing the original full-channel depth convolution with more refined and adaptive spatial feature extraction, enhancing the model's ability to capture complex local features in early gastric cancer images, making it more suitable for high-precision medical image segmentation tasks, and has the following beneficial effects:
[0129] Improve computational efficiency: Applying spatial convolution to only a subset of channels reduces computational cost and model parameters while maintaining effective feature extraction capabilities. This is crucial for real-time or rapid segmentation of early gastric cancer images with limited computational resources.
[0130] Enhanced local feature representation: Standard convolution is used on a selected subset of channels, enabling the module to learn local correlations between channels. This is particularly beneficial for identifying small, irregular lesion features in early gastric cancer that may rely on multi-channel joint information.
[0131] Facilitating feature reuse and information flow: Direct transmission of channels without spatial convolution ensures the integrity of the original feature information, helps maintain feature diversity, alleviates information bottlenecks in deep networks, and provides more comprehensive information for subsequent layers.
[0132] (2) In the U-Net architecture, this invention replaces the traditional attention mechanism based on static axial convolution with DAA. The DAA of this invention is an improved Dynamic Axial Attention (DAA). Existing attention mechanisms based on static axial convolution have shortcomings, specifically in the limitations of static receptive fields and standard axial convolution in capturing the features of irregular lesions in early gastric cancer. The DAA of this invention incorporates the idea of deformable convolution into the axial feature aggregation process, enabling it to adaptively adjust the spatial sampling position, thereby capturing the contextual information and boundary features of early gastric cancer lesions more flexibly and accurately, and has the following beneficial effects:
[0133] Powerful ability to capture irregular shapes: The core of DAA lies in its introduction of a dynamic sampling mechanism based on DSConv, which learns the position of each sampling point based on input features. This allows the points of the convolutional kernel to dynamically "bend" or "stretch" according to the content of the input features, forming a deformable "serpentine" sampling path. This enables DAA to adaptively bend and adjust its receptive field, more closely following the actual contour and edges of the lesion, greatly improving the accuracy of capturing the geometric features of irregular lesions.
[0134] More precise boundary focusing capability: Closely related to capturing irregular shapes, dynamic sampling enables the module to more accurately align the boundary between lesions and normal tissue. In the boundary region, features change drastically, and DSConv's offset learning mechanism tends to sample near these locations of significant changes.
[0135] Combining axial efficiency and local dynamics: DAA inherits the advantage of axial attention by decomposing two-dimensional attention into two one-dimensional processes, horizontal and vertical, which is generally more computationally efficient than a fully global attention mechanism. At the same time, by embedding DSConv in the axial process, it compensates for the shortcomings of the original axial attention in terms of local receptive field deformation.
[0136] (3) This invention introduces SCSAM into the U-Net architecture as a powerful feature enhancer. The SCSAM of this invention is an improved spatial-channel collaborative attention module for medical images. Unlike existing purely spatial or channel attention mechanisms, the SCSAM of this invention simultaneously models dependencies along both spatial and channel dimensions, promoting collaborative interaction. This allows the network to dynamically focus on the most informative features across the entire feature map, meeting the unique needs of medical image segmentation tasks, especially for subtle early lesions. It significantly improves the network's ability to identify subtle features of early gastric cancer lesions, thereby improving segmentation accuracy and boundary accuracy, and has the following beneficial effects:
[0137] Achieving collaborative enhancement of attention mechanisms: Traditional attention mechanisms are typically sequential or involve independent computation followed by simple addition / multiplication. The key to SCSAM lies in its parallel computation and joint modulation approach. The spatial attention branch and the channel attention branch independently compute their respective attention maps, but these attention maps are then jointly applied to the input feature map for modulation.
[0138] Enhanced local detail capture: In medical imaging, especially early lesions, crucial diagnostic information often focuses on subtle local textures, shapes, and boundaries. Traditional pooling downsampling loses these details. SCSAM, through default and highlighted Recombination downsampling, transforms local spatial information into channel information, enabling channel attention to perceive local context.
[0139] For stable training with small batches of medical images: Medical image datasets are typically smaller than natural image datasets, so smaller batch sizes are often used during training. SCSAM explicitly uses GroupNorm, making it more suitable for the training environment of medical images. This makes the training process more stable, converges more easily, and the model may generalize better on limited data.
[0140] The present invention also provides a medical image segmentation network, comprising:
[0141] The input module is used to receive medical images;
[0142] The encoder module contains a six-stage encoding unit for encoding medical images. The first three encoding stages pass through a standard 3×3 convolutional layer and a downsampling module (DSM) in sequence, while the last three encoding stages pass through an improved convolutional module (PCMUB) and a downsampling module (DSM) in sequence. The improved convolutional module PCMUB performs standard convolution on some channels of the input feature map through a channel splitting mechanism, while the other channels are directly concatenated and residually connected.
[0143] Specifically, the improved convolutional module PCMUB includes:
[0144] Channel splitting unit, used to split the input feature map in the channel dimension by 1 / n div and n div -1 / n div The proportion is divided into a first subset and a second subset, n div Integers between 2 and 4;
[0145] The convolution processing unit performs standard 3×3 convolution processing on the first subset, while the second subset remains unchanged.
[0146] The residual connection unit is used to concatenate the processed first subset and the unprocessed second subset along the channel dimension and then add the residual to the original input features;
[0147] The feature transformation unit is used to sequentially perform 1×1 convolution expansion channel processing, GELU activation function processing, and 1×1 convolution compression channel processing on the summation result;
[0148] The Dynamic Attention Module (DAA) is used to perform deformable convolution operations on the output features of the sixth encoding stage along the horizontal and vertical directions, respectively. It dynamically adjusts the sampling position through learnable offsets, fuses bidirectional features, and generates a spatial attention map.
[0149] Specifically, the Dynamic Attention Module (DAA) includes:
[0150] The feature aggregation unit is used to perform average pooling and 1×1 convolution on the input features to extract local region features;
[0151] The horizontal convolutional unit is used to process features through dynamic serpentine convolution in the horizontal direction. It adjusts the horizontal sampling position through learnable offsets to capture long-distance dependencies in the horizontal direction.
[0152] Vertical convolutional units are used to process features through dynamic serpentine convolution in the vertical direction. They adjust the vertical sampling position through learnable offsets to capture long-distance vertical dependencies.
[0153] The attention generation unit is used to perform 1×1 convolution on the processed features to fuse the dynamic features in the horizontal and vertical directions, and then normalize the output through the Sigmoid activation function to generate a spatial attention weight map.
[0154] The decoder module contains a six-stage decoding unit for performing decoding processing on the output of the Dynamic Attention Module (DAA). The sixth to fourth decoding stages process features through the Upsampling Module (USM), the Improved Convolutional Module (PCMUB), and the Spatial Channel Fusion Attention Module (SCSAM). The third to first decoding stages process features through the Upsampling Module (USM), a standard 3×3 convolutional layer, and the Spatial Channel Fusion Attention Module (SCSAM). The Spatial Channel Fusion Attention Module (SCSAM) is used to optimize the skip connection features of the corresponding encoding stages.
[0155] Specifically, the Spatial Channel Fusion Attention Module (SCSAM) includes:
[0156] Multi-scale spatial attention unit is used to extract multi-scale spatial information from input features and generate spatial attention maps in the horizontal and vertical directions;
[0157] The spatial modulation unit is used to multiply the two-directional spatial attention map with the original input features element by element to obtain the spatially modulated intermediate features;
[0158] The local recombination unit is used to perform a ws×ws local region to channel dimension recombination operation on the intermediate features of spatial modulation, where ws is an integer from 2 to 4.
[0159] The feature processing unit is used to perform 1×1 convolution dimensionality reduction and group normalization processing with a group number of 1 on the recombined features;
[0160] Spatial self-attention unit, used to perform spatial self-attention computation on the normalized and dimensionality-reduced features;
[0161] The channel attention unit is used to perform global pooling on the spatial self-attention results, compressing the spatial dimension to 1×1, and then generating a channel attention map through the Sigmoid activation function;
[0162] The feature fusion unit is used to multiply the channel attention map element-wise with the spatially modulated intermediate features.
[0163] The output module is used to perform 3×3 convolution on the output features of the first decoding stage to generate a single-channel segmentation mask.
[0164] The above technical solution provides a medical image segmentation network specifically for early gastric cancer endoscopic images. It is an end-to-end segmentation model for accurately locating irregular early lesions. Based on a deep learning framework, it constructs the synergistic effect of three innovative core modules (PCMUB, DAA, SCSAM) through multi-scale feature extraction, dynamic attention weighting, and fine detail reconstruction. This enhances the ability to capture key features and the overall performance of the model, achieving high-precision and robust automatic identification and segmentation of lesion regions.
[0165] The baseline model of this invention references MALU-Net and adopts a six-stage U-shaped architecture. Each stage uses a standard convolution with a kernel size of 3 and incorporates three innovative modules: the improved convolution module PCMUB, the spatial channel fusion attention module SCSAM, and the dynamic attention module DAA.
[0166] This invention employs a basic U-shaped architecture: the network consists of a six-stage downsampling path (encoder) and a six-stage upsampling path (decoder). The encoder is responsible for progressively extracting multi-scale features from the image and reducing the spatial resolution; the decoder then restores the spatial resolution through upsampling and fuses the features from the encoder, ultimately outputting pixel-level segmentation predictions. Skip connections are used to pass features from the encoder at different downsampling levels to the corresponding upsampling levels of the decoder to preserve important spatial information.
[0167] The encoder path of this invention consists of three stages: the first three stages (Stages 1-3) employ standard 3×3 convolutional layers (conv2d(k=3)) followed by a downsampling module (DSM). The DSM includes Group Normalization, Max Pooling, and GELU activation functions for feature normalization and spatial size halving. The latter three stages (Stages 4-6) replace the standard convolutional layers with the PCMUB of this invention, followed by downsampling again using the DSM. The PCMUB is used in this stage to extract deep semantic features more efficiently. At the end of the encoder path (i.e., at Bottleneck, after the DSM in Stage 6), a DAA is integrated to capture global contextual information of the image, which is particularly helpful in understanding the overall anatomical structure of the stomach and the large-scale features of lesions.
[0168] The decoder path of this invention begins with the output of the DAA and first undergoes size restoration through an upsampling module, USM. USM includes Group Normalization, Bilinear Interpolation, and the GELU activation function. Each decoding stage (from Stage 6 to Stage 1) receives upsampled features from the previous decoding stage and fuses them with features from the corresponding stage of the encoder via skip connections (i.e., element-wise addition). After feature fusion, the decoding stages apply corresponding feature processing modules: the decoding stages from Stage 6 to Stage 4 use PCMUB for feature processing; while the decoding stages from Stage 3 to Stage 1 use standard 3×3 convolutional layers (conv2d(k=3)) for feature processing. All these processing modules are followed by an upsampling module, USM.
[0169] Skip connections: SCSAM is strategically integrated into the skip connections from encoder Stage 1 to Stage 5 to optimize and weight the high-resolution features passed from the encoder, making them more discriminative when passed to the decoder for fusion, which helps to restore the fine boundaries and details of lesions.
[0170] Final output layer: The output features of decoder Stage 1 are processed by the final 3×3 convolutional layer to obtain a single-channel segmentation prediction mask (H×W×1).
[0171] In this architecture, PCMUB is responsible for efficient and semantically rich multi-scale feature extraction; DAA captures global dynamic context at Bottleneck; and SCSAM refines and enhances multi-scale spatial information on skip connections. The organic combination of these three modules enables the network to simultaneously balance computational efficiency, geometric adaptability, and detail recovery capabilities, thereby achieving high-precision and robust segmentation of early gastric cancer lesions.
[0172] In one example, 1242 early gastric cancer endoscopic images, 512*512, were collected from a hospital in Handan City. (The images were of varying sizes and were standardized by filling and cropping. After medical image segmentation processing by this invention, a binary segmentation mask of 512*512 was output.)
[0173] To verify the superiority of the technical effects of this invention, grouped experiments and comparisons of technical effects were conducted from different dimensions. One dimension was used to test the gains of PCMUB, DAA, and SCSAM. The existing pure baseline model BLU was used, with PCMUB, DAA, SCSAM, and full-module collaboration (PCMUB, DAA, SCSAM) added respectively. The contribution of each module to segmentation accuracy, efficiency, and robustness was tested through module ablation, verifying the systematic nature of this invention. Another dimension was used to test the mainstream medical segmentation models U-Net, U-Net++, and VM-U-Net with the model of this invention (AdaSegNet), verifying that the innovative architecture of multi-module collaboration is more suitable for the complex segmentation needs of early gastric cancer (irregular shape, low contrast, artifact interference). The results of single-module ablation experiments and the final model are shown in Tables 1-2, and some original endoscopic images and result visualizations are shown in Tables 1-2. Figure 2 As shown.
[0174] The evaluation methods and indicators include:
[0175] Dice coefficient: measures the similarity between the predicted region and the actual region.
[0176] Average Intersection over Union (mIoU): Calculates the ratio of the area of overlap between the predicted region and the actual region to the area of their union, and then averages it across all categories.
[0177] Accuracy: The percentage of pixels that are correctly predicted out of the total number of pixels.
[0178] Sensitivity: The ability to correctly identify positive samples.
[0179] Specificity: The ability to correctly identify negative samples.
[0180] Table 1
[0181] Model mIoU(%) Dice(%) Accuracy (%) Specificity (%) Sensitivity (%) BLU 54.88 70.83 82.79 85.32 77.11 BLU+PCMUB 56.58 72.08 83.51 85.15 79.66 BLU+DAA 56.23 71.83 83.42 84.38 81.49 BLU+SCSAM 56.24 71.61 83.23 85.21 78.53 BLU+PCMUB+DAA+SCSAM 57.44 73.31 83.87 85.19 81.03
[0182] As shown in Table 1, PCMUB reduces redundant computation by channel splitting and residual connection, while preserving multi-scale features and lesion details, resulting in a 1.7% improvement in mIoU and a 1.25% improvement in Dice, thus resolving the contradiction between computational efficiency and feature integrity.
[0183] As shown in Table 1, DAA adaptively captures long-distance dependencies of lesions (such as lobed boundaries) using deformable snake convolution, reduces false negatives, and improves the positive sample recognition rate (sensitivity) by 4.38%, overcoming the limitation of fixed receptive fields in representing complex morphologies.
[0184] As shown in Table 1, SCSAM enhances the feature discrimination of low-contrast lesions, suppresses mucus artifact interference, and stabilizes the negative sample recognition rate (specificity) through local spatial reconstruction and channel attention.
[0185] As shown in Table 1, the PCMUB, DAA, and SCSAM modules work together to form a feature extraction → spatial modeling → context optimization. PCMUB provides efficient features, DAA captures spatial relationships, and SCSAM optimizes discriminative power, driving mIoU to exceed 57.44% (+2.56% from baseline) and Dice to 73.31% (+2.48% from baseline), verifying the scientific nature of the architecture design.
[0186] Table 2
[0187] Model mIoU(%) Dice(%) Accuracy (%) Specificity (%) Sensitivity (%) U-Net 54.98 70.77 83.02 84.55 78.21 U-Net++ 55.42 71.21 83.35 85.01 80.42 VM-U-Net 56.96 72.87 83.91 84.69 81.21 AdaSegNet (This invention) 57.44 73.31 83.87 85.19 81.03
[0188] As shown in Table 2, compared with U-Net, the Dice of the present invention AdaSegNet is improved by 2.54% and the mIoU is improved by 2.46%. This is probably because U-Net relies on a fixed 3×3 convolution, and when faced with jagged boundaries and low contrast in early gastric cancer, the receptive field cannot be adaptively adjusted, resulting in segmentation edge deviation. The present invention, through DAA+PCMUB, accurately adapts to complex shapes and improves the overlap between lesion and real area, proving that the segmentation of the overlapping area between lesion and background is more accurate.
[0189] As shown in Table 2, compared with U-Net++, the Dice of the present invention AdaSegNet is improved by 2.1% and the mIoU is improved by 2.02%. This is probably because U-Net++ optimizes multi-scale skip connections, but fixed convolution + single attention still cannot solve the feature submersion problem of low-contrast lesions. The present invention strengthens the feature discrimination of low-contrast regions through SCSAM, improves the segmentation integrity, makes it easier to distinguish tumors from normal mucosa, and supports the detection of subtle lesions in early gastric cancer.
[0190] As shown in Table 2, compared with VM-U-Net, the Dice of the present invention AdaSegNet is improved by 0.44% and the mIoU is improved by 0.48%. This is probably because VM-U-Net focuses on spatial deformation but lacks channel-level feature optimization and does not adequately handle the overlapping areas of lesions and background (such as the blurred band at the edge of the tumor). The present invention uses SCSAM to more accurately calculate the overlap ratio between the lesion and the real area, enhance the feature discrimination of the overlapping area, improve the regional overlap (mIoU), and assist in clinical quantitative analysis.
[0191] To verify the computational efficiency of core components such as PConv (improved partial convolution), DSConv (dynamic snake convolution), and local spatial reconstruction downsampling in this invention, the existing pure baseline model BLU was used. By comparing the floating-point operations (FLOPs, which measure computational complexity, in GFLOPs) of different module configurations, the balance between performance gain and computational overhead was analyzed. The calculation results are shown in Table 3.
[0192] Table 3
[0193] model BLU+PCMUB (Conv) BLU+PCMUB (PConv) BLU+DAA (Conv) BLU+DAA (DSconv) BLU+SCSAM (MaxPooling) BLU+SCSAM (Recombination) flops 0.351 0.355 0.292 0.319 0.289 0.320
[0194] As shown in Table 3, PConv, DSConv, and recombination downsampling only lead to a slight increase in computational complexity compared to their traditional counterparts. For example, PConv (0.355 GFLOPs) in PCMNB has slightly higher FLOPs than standard convolution (0.351 GFLOPs); while DSConv (0.319 GFLOPs) in DAA only increases FLOPs by 0.027 GFLOPs compared to standard convolution (0.292 GFLOPs). This indicates that although these components bring significant performance improvements (as confirmed by the ablation experiments mentioned above), they introduce only minimal computational overhead, demonstrating their efficiency. This approach overcomes the accuracy bottlenecks of traditional methods in irregular lesion segmentation and low-contrast scene adaptation (e.g., significant improvements in core metrics such as Dice coefficient and sensitivity), while also avoiding the "computational overload trap" common in high-performance models. Whether in clinical scenarios (where real-time segmentation of endoscopic images requires millisecond-level inference) or engineering scenarios (where fill material gradation analysis requires processing large-scale images), it can be stably deployed on conventional hardware (such as clinical workstations and portable engineering devices) to meet practical needs such as accurate segmentation to assist diagnosis and efficient gradation analysis to support decision-making, providing a technical solution that combines accuracy and depth with feasibility.
[0195] To quantitatively evaluate the computational efficiency of the model (AdaSegNet) of this invention, the existing pure baseline model BLU was used. By comparing the floating-point operations (FLOPs, which measure computational complexity, in GFLOPs) of the mainstream segmentation models U-Net, U-Net++, and VM-U-Net, its ability to balance high-precision segmentation and low computational overhead was verified. The calculation results are shown in Table 4.
[0196] Table 4
[0197] Model U-Net U-Net++ VM-U-Net AdaSegNet (This invention) BLU flops 62.52 147.06 4.111 0.3979 0.2895
[0198] As shown in Table 4, the AdaSegNet of this invention exhibits superior computational efficiency, requiring only 0.3979 GFLOPs, which is significantly lower than the traditional U-Net and its variants, including U-Net (62.52 GFLOPs) and U-Net++ (147.06 GFLOPs). Even compared with the lightweight VMU-Net (4.111 GFLOPs), the AdaSegNet of this invention still maintains an efficiency advantage of nearly an order of magnitude.
[0199] As shown in Table 4, the AdaSegNet of this invention integrates PCMUB, DAA, and SCSAM modules on the basis of the BLU backbone network (lightweight U-Net backbone network, 0.2895 GFLOPs), and the increase in total FLOPs is still negligible (from 0.2895 to 0.3979 GFLOPs), which further proves the lightweight and efficient design of AdaSegNet of this invention.
[0200] The invention AdaSegNet achieves high-precision EGC segmentation while maintaining extremely low computational complexity, making it particularly suitable for practical clinical deployments and mobile health applications—effectively meeting the key requirements of real-time processing, lightweight models, and operational efficiency. AdaSegNet's lightweight design is suitable not only for high-end workstations in tertiary hospitals but also for ordinary clinical workstations in primary hospitals, such as portable endoscopy equipment and mobile medical vehicles, operating stably without requiring additional hardware upgrades. This significantly lowers the barrier to technology implementation, especially in remote primary healthcare settings. This low computational dependency allows high-precision gastric cancer segmentation technology to benefit a wider population, overcoming the limitation that high-end technologies can only serve a few institutions.
[0201] Depend on Figure 2 As can be seen, Image is the original endoscopic image containing early gastric cancer lesions. The scene covers clinical challenges such as mucus interference, instrument occlusion, and low-contrast boundaries. GT is the real lesion area annotated by experts, serving as the standard for segmentation accuracy. Ours is the segmentation result (black and white mask) of the AdaSegNet model of this invention. U-Net and VMU-Net are mainstream medical segmentation models.
[0202] The original endoscopic image in the first row shows mucus reflection around the lesion, with jagged and concave boundaries. Ours segmentation contours fit the sharp edges and concavities of GT, accurately capturing irregular boundaries. U-Net and VMU-Net contours are more rounded, losing jagged details. This is likely because DAA adaptively adjusts the sampling position through learnable offsets to fit the jagged boundaries of the lesion, while SCSAM suppresses artifact interference from mucus reflection and enhances the grayscale difference between the lesion and the background.
[0203] The original endoscopic images in the second and third rows show surgical instrument occlusion, resulting in a complex geometric shape of the GT (Geophysical Ground Trace) with an L-shape and sharp corners. Ours segmentation results restore the sharp corners and depressions of the GT, even capturing subtle boundary abrupt changes (such as the small notch in the GT of the second row). U-Net and VMU-Net have smoother contours, but the transitions at the corners are stiff, resulting in the loss of geometric details. This is likely because DAA captures long-distance dependencies (such as the continuity of lesions under instrument occlusion) along the horizontal / vertical directions, while PCMUB preserves multi-scale features, avoiding the loss of features in occluded areas.
[0204] In the original endoscopic image of the fourth row, the lesion color is light (the red area in the image is close to the background gray level), and the lesion is blurred. Ours segmentation contours fit the edges of GT, completely covering the lesion area, while U-Net and VMU-Net contours shrink or deform, losing some low-contrast areas. This is probably because SCSAM enhances the feature discrimination of low-contrast lesions through local spatial reconstruction (ws×ws) and channel attention, while PCMUB retains the slight gray level differences of the original channels, avoiding feature overload.
[0205] Depend on Figure 3 As can be seen, the segmentation results are superimposed on the original endoscopic image as colored regions, preserving the background information of the original endoscopic image, and allowing observation of the spatial correspondence between the segmented regions and the actual lesions. The advantages of Ours are magnified in the figure. The segmentation results are highly consistent with the clinical scene (instrument position, mucus distribution, lesion morphology). DAA dynamic geometric perception, SCSAM anti-interference discrimination, and PCMUB detail preservation enable the accuracy of anti-interference verification in the mucus scene, reducing misdiagnosis. Occlusion scene verification demonstrates geometric reconstruction power, supporting surgical planning. Low contrast scene verification demonstrates subtle recognition power, reducing missed diagnosis.
[0206] In summary, the core application scenarios of this invention focus on the medical and health field, possessing broad deployment potential. Specifically, it can be integrated as a core component into a computer-aided detection and diagnosis system for early gastric cancer under digestive endoscopy, assisting doctors in real-time or offline lesion analysis. Simultaneously, this technology can also be embedded in various medical image analysis and processing software, providing researchers and clinicians with powerful segmentation tools. In more cutting-edge applications, it can serve medical robot-assisted surgery, enabling precise identification and localization of early gastric cancer lesions during surgery.
[0207] (1) Significantly improves segmentation accuracy and robustness:
[0208] High precision: Compared with existing methods, it is expected to achieve a new state-of-the-art (SOTA) level in commonly used segmentation evaluation metrics such as Dice coefficient and miou index, especially in dealing with early gastric cancer lesions with irregular shape, blurred boundaries and low contrast, and can achieve more accurate pixel-level delineation.
[0209] High robustness: The system is more adaptable to image changes caused by different endoscopic equipment, different acquisition conditions, and different individual patient differences, reducing segmentation failures or inaccuracies caused by fluctuations in image quality.
[0210] (2) Optimize clinical user experience and decision support:
[0211] Assisted in precise localization: Provides intuitive and accurate marking of lesion areas to help doctors quickly locate the extent of lesions, especially providing strong support for inexperienced doctors or when dealing with small or hidden lesions.
[0212] Quantitative analysis foundation: Precise segmentation mask is the basis for quantitative analysis of lesion size, shape, and location, providing objective data support for assessing lesion progression, guiding biopsy sampling, and planning the extent of endoscopic resection.
[0213] Reduce doctors' workload: Automated segmentation reduces the time and effort doctors spend on manual delineation, allowing them to focus more on complex diagnostic judgments and treatment planning.
[0214] (3) Reduce the rates of misdiagnosis and missed diagnosis:
[0215] By providing high-precision and robust auxiliary segmentation results, it helps reduce the risk of misdiagnosis or missed diagnosis due to visual fatigue, subjective differences, or hidden lesions.
[0216] (4) Improve clinical applicability and accessibility:
[0217] Due to increased efficiency and potentially lower hardware requirements (compared to equivalent accuracy models that require higher computing resources), the system is easier to integrate into existing medical imaging systems or deploy in environments with relatively limited computing resources, improving the clinical accessibility of the technology.
[0218] The present invention also provides an electronic device, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the at least one processor to perform the method described thereon. This electronic device can be any terminal device including mobile phones, laptops, desktop computers, tablets, PDAs (Personal Digital Assistants), POS (Point of Sales) terminals, in-vehicle computers, etc.
[0219] This invention also provides a storage medium storing a computer program thereon, which, when executed by a processor, implements the method described above. Through the above description of the embodiments, those skilled in the art can clearly understand that this invention can be implemented using software plus necessary general-purpose hardware, or it can be implemented using dedicated hardware including dedicated integrated circuits, dedicated CPUs, dedicated memory, dedicated components, etc. Generally, any function performed by a computer program can be easily implemented using corresponding hardware, and the specific hardware structure used to implement the same function can be diverse, such as analog circuits, digital circuits, or dedicated circuits. However, for this invention, software program implementation is often a better implementation method. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, portable hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of this invention.
[0220] This invention also provides a computer program product comprising a computer program that, when executed by a processor, implements the method described. The computer program (which may also be referred to or described as a program, software, software application, module, software module, script, or code) can be written in any form of programming language, including compiled languages, interpreted languages, declarative languages, or procedural languages, and can be deployed in any form, including as a standalone program or as a module, component, subroutine, or other unit suitable for use in a computing environment. The computer program may, but does not necessarily, correspond to a file in a file system. The program can be stored as a portion of a file containing other programs or data, for example, as one or more scripts in a markup language document; in a single file dedicated to the related program; or in multiple co-files, for example, a file storing one or more modules, subroutines, or code portions. The computer program can be deployed to execute on one or more computers located in one place or distributed across multiple locations and interconnected via a communication network. The processing and logic flows described in this specification can be executed by one or more programmable computers that execute one or more computer programs by processing input data and generating output to run functions.
[0221] The number of devices and processing scale described herein are for the purpose of simplifying the description of the invention. Applications, modifications, and variations of the invention will be readily apparent to those skilled in the art.
[0222] Although embodiments of the present invention have been disclosed above, they are not limited to the applications listed in the specification and embodiments. They can be applied to various fields suitable for the present invention. For those skilled in the art, other modifications can be easily made. Therefore, without departing from the general concept defined by the claims and their equivalents, the present invention is not limited to the specific details and illustrations shown and described herein.
Claims
1. A method of medical image segmentation, characterized by, The method comprises the following steps: Step one, input the medical image into the encoder path, and perform six-stage encoding processing: The first to third encoding stages: sequentially extract features through a standard 3x3 convolution layer, and reduce the spatial resolution through a downsampling module; The fourth to sixth encoding stages: sequentially extract features through an improved convolution module, and reduce the spatial resolution through a downsampling module, wherein the improved convolution module performs standard convolution on part of the channels of the input feature map through a channel splitting mechanism, and the other part of the channels directly passes through the rear splicing and residual connection; Step two, after the sixth-stage encoding processing, process the features through a dynamic attention module: Respectively perform dynamic snake convolution processing along the horizontal direction and the vertical direction, dynamically adjust the sampling position through a learnable offset, fuse the features in the two directions, and generate a spatial attention map through a Sigmoid activation function; Step three, input the output of the dynamic attention module into the decoder path, and perform six-stage decoding processing: The sixth to fourth decoding stages: restore the spatial size through an upsampling module, fuse the jump connection features of the corresponding encoding stages optimized through the spatial channel fusion attention module, and process the fused features through an improved convolution module; The third to first decoding stages: restore the spatial size through an upsampling module, fuse the jump connection features of the corresponding encoding stages optimized through the spatial channel fusion attention module, and process the fused features through a standard 3x3 convolution layer; Step four, perform 3x3 convolution processing on the features output by the first stage of the decoder to generate a single-channel segmentation mask.
2. The medical image segmentation method according to claim 1, characterized in that, The improved convolution module processing includes: splitting the input feature map in a channel dimension into a first subset and a second subset, the first subset having a number of channels that is 1 / n of a total number of channels div , n div is an integer from 2 to 4; Perform standard 3x3 convolution processing on the first subset, and keep the second subset unchanged; Splice the processed first subset and the unprocessed second subset along the channel dimension; Residual add the spliced result and the original input feature; Respectively perform 1x1 convolution to expand the channel, GELU activation function processing, and 1x1 convolution to compress the channel on the added result.
3. The medical image segmentation method according to claim 1, characterized in that, The dynamic attention module processing includes: Respectively perform average pooling processing and 1x1 convolution processing on the input feature to aggregate spatial information and extract local region features; Process the features through horizontal direction dynamic snake convolution, adjust the horizontal direction sampling position through a learnable offset, and capture the long distance dependence in the horizontal direction; Process the features through vertical direction dynamic snake convolution, adjust the vertical direction sampling position through a learnable offset, and capture the long distance dependence in the vertical direction; Perform 1x1 convolution processing on the processed features to fuse the dynamic features in the horizontal and vertical directions, and then normalize the output through a Sigmoid activation function to generate a spatial attention weight map.
4. The medical image segmentation method according to claim 1, characterized in that, The spatial channel fusion attention module processing includes: Extract multi-scale spatial information from the input feature to generate spatial attention maps in the horizontal and vertical directions respectively; Element-wise multiply the two spatial attention maps with the original input feature to obtain spatially modulated intermediate features; Perform local spatial reorganization processing on the spatially modulated intermediate features to reorganize wsxws local region features to the channel dimension, and ws is an integer from 2 to 4; The 1x1 convolution processing is performed on the recombinant feature, the number of channels is restored to the original number of channels, and then the group normalization processing with a group number of 1 is performed; The spatial self-attention calculation is performed on the normalized dimension-reduced feature; The global pooling processing is performed on the spatial self-attention result, the spatial dimension is compressed to 1x1, and then the channel attention map is generated through the Sigmoid activation function; The channel attention map is multiplied with the intermediate feature after the spatial modulation element by element.
5. The medical image segmentation method of claim 1, wherein, The downsampling module performs group normalization processing, maximum pooling processing, and GELU activation function processing; The upsampling module performs group normalization processing, bilinear interpolation processing, and GELU activation function processing.
6. The medical image segmentation network applied to the medical image segmentation method according to any one of claims 1-5, characterized in that, It comprises: an input module for receiving a medical image; an encoder module comprising six-stage encoding units for performing encoding processing on the medical image, wherein the first three encoding stages sequentially pass through a standard 3x3 convolution layer and a downsampling module, and the last three encoding stages sequentially pass through an improved convolution module and a downsampling module, the improved convolution module performing standard convolution on part of the channels of the input feature map through a channel splitting mechanism, and the other part of the channels directly passing through the rear splicing and residual connection; a dynamic attention module for performing deformable convolution operation on the output feature of the sixth encoding stage along the horizontal and vertical directions respectively, dynamically adjusting the sampling position through a learnable offset, fusing the features in both directions, and generating a spatial attention map; a decoder module comprising six-stage decoding units for performing decoding processing on the output of the dynamic attention module, wherein the sixth to fourth decoding stages process the features through the upsampling module, the improved convolution module, and the spatial channel fusion attention module, and the third to first decoding stages process the features through the upsampling module, the standard 3x3 convolution layer, and the spatial channel fusion attention module, the spatial channel fusion attention module being used for optimizing the skip connection features of the corresponding encoding stage; an output module for performing 3x3 convolution on the output feature of the first decoding stage to generate a single-channel segmentation mask.
7. The medical image segmentation network of claim 6, wherein, The improved convolution module comprises: a channel splitting unit configured to split an input feature map into a first subset and a second subset in a channel dimension by 1 / n div and n div -1 / n div , n div is an integer from 2 to 4; a convolution processing unit for performing standard 3x3 convolution processing on the first subset and keeping the second subset unchanged; a residual connection unit for splicing the processed first subset and the unprocessed second subset along the channel dimension, and then performing residual addition with the original input feature; a feature transformation unit for sequentially performing 1x1 convolution to expand the channel, GELU activation function processing, and 1x1 convolution to compress the channel processing on the addition result; The dynamic attention module comprises: a feature aggregation unit for performing average pooling processing and 1x1 convolution processing on the input feature to extract local region features; a horizontal convolution unit for processing the feature through horizontal direction dynamic snake convolution, adjusting the horizontal direction sampling position through a learnable offset, and capturing the horizontal direction long distance dependence; a vertical convolution unit for processing the feature through vertical direction dynamic snake convolution, adjusting the vertical direction sampling position through a learnable offset, and capturing the vertical direction long distance dependence; The attention generation unit is configured to perform 1*1 convolution processing on the processed feature to fuse dynamic features in horizontal and vertical directions, and to normalize an output by using a Sigmoid activation function to generate a spatial attention weight map; The spatial channel fusion attention module comprises: The multi-scale spatial attention unit is configured to extract multi-scale spatial information from the input feature to generate spatial attention maps in horizontal and vertical directions. The spatial modulation unit is configured to multiply the spatial attention maps in the two directions with the original input feature element by element to obtain spatially modulated intermediate features. The local reorganization unit is configured to perform ws*ws local region-to-channel dimension reorganization on the spatially modulated intermediate features, where ws is an integer between 2 and 4. The feature processing unit is configured to perform 1*1 convolution dimension reduction and group normalization with a group number of 1 on the reorganized features. The spatial self-attention unit is configured to perform spatial self-attention calculation on the normalized and dimension-reduced features. The channel attention unit is configured to perform global pooling on the spatial self-attention result to compress the spatial dimension to 1*1, and to generate a channel attention map by using a Sigmoid activation function. The feature fusion unit is configured to multiply the channel attention map with the spatially modulated intermediate features element by element.
8. An electronic device, characterized by The program is executed by the processor to implement the method of any one of claims 1-5. The program is executed by the processor to implement the method of any one of claims 1-5.
9. A storage medium having stored thereon a computer program, characterized in that The program is executed by the processor to implement the method of any one of claims 1-5.
10. Computer program product comprising a computer program, characterized in that,
Citation Information
Patent Citations
Photovoltaic cell defect segmentation method based on edge perception
CN116645338A
Colorectal cancer CT intelligent screening method based on SCSAM attention mechanism
CN117745714A