Ripple-like image segmentation optimization method driven by edge enhancement and region features
By constructing a four-stage nested state weight key-value network and an interactive dual-scanning mechanism, the edge and region features of the image segmentation method are enhanced, solving the problems of blurred segmentation edges and high computational complexity in complex scenes of existing methods, and achieving efficient image segmentation results.
Patent Information
- Application Number
- CN202510811033.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-17
- Publication Date
- 2026-03-06
- Estimated Expiration
- 2045-06-17
AI Technical Summary
Existing image segmentation methods lack the ability to perceive boundaries and local structures when dealing with complex scenes, resulting in blurred segmentation edges and loss of details. Furthermore, existing models have high computational complexity in high-resolution images, making it difficult to meet the requirements of real-time performance and resource efficiency.
A ripple-style image segmentation optimization method based on edge enhancement and region feature-driven approach is adopted. A four-stage nested state weight key-value network (NSKV) is constructed to extract global features. Dilated convolution and axial convolution are combined to enhance edge and region information. Feature fusion is performed through an interactive dual scanning mechanism to generate high-precision segmentation results.
While maintaining high computational efficiency, it improves the structural awareness and segmentation accuracy of image segmentation, especially in complex structural scenes, enabling accurate segmentation and fast inference.
Smart Images

Figure CN120655664B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to an image segmentation method, specifically a ripple-style image segmentation optimization method based on edge enhancement and region feature-driven approach. It is applicable to multimodal, high-resolution image segmentation tasks and belongs to the field of image segmentation processing technology. Background Technology
[0002] Image segmentation is one of the core tasks in image analysis, widely used in various application scenarios such as object detection, scene understanding, industrial inspection, autonomous driving, and human-computer interaction. The goal of this task is to accurately extract semantically meaningful target regions, such as object contours, structural boundaries, or functional blocks, against complex backgrounds. The segmentation accuracy directly affects the performance of subsequent recognition, analysis, and decision-making.
[0003] Traditional image segmentation methods primarily rely on low-level features such as grayscale, edges, or texture, combined with classic image processing algorithms like thresholding, region growing, and active contouring. These methods exhibit poor robustness in complex scenarios involving image noise, object shape variations, or blurred boundaries, making them unsuitable for demanding applications.
[0004] With the development of deep learning, segmentation models based on convolutional neural networks (CNNs) (such as UNet, UNet++, SegNet, etc.) have made significant progress in multiple visual tasks. CNN structures are good at extracting local features and have strong expressive power, but due to the limited receptive field of convolution operations, the models are insufficient in modeling long-distance dependencies and global contextual relationships, especially in cases of complex spatial relationships or discrete target distributions.
[0005] To overcome the aforementioned problems, models incorporating the Transformer structure have gradually emerged in recent years. Leveraging its global self-attention mechanism, these models can model long-range dependencies, achieving breakthroughs in accuracy. However, the computational complexity of the Transformer's self-attention mechanism increases quadratically with input resolution, limiting its application in high-resolution images. Its high computational cost and memory consumption make it difficult to meet the demands of real-world scenarios with stringent requirements for real-time performance and resource efficiency.
[0006] To further improve modeling efficiency, linear complexity state-space models such as Mamba and ReceptanceWeighted Key Value (RWKV) have been introduced into the field of vision. The Mamba model, relying on the efficient dynamic modeling capability and long sequence dependency capture advantage of the state-space model, has shown significant computational efficiency and modeling potential in temporal information processing. However, in the application of vision tasks, it still generally adopts the modeling paradigm of linear sequence scanning, which fails to fully consider the unique two-dimensional spatial topology and local spatial correlation of image data. The RWKV model combines the advantages of Transformer and RNN, and can efficiently model long sequence features. However, most of the existing RWKV applications in vision tasks directly adopt linear scanning sequence modeling. At present, the application of linear complexity state-space models in the field of image segmentation still has two main problems: (1) lack of boundary and local structure perception capability, resulting in blurred segmentation edges and missing details; (2) the serialization processing method destroys the continuity of two-dimensional space and limits the ability to express structural features.
[0007] In summary, existing image segmentation methods lack the ability to perceive boundary information and local regions, which not only makes it difficult to accurately identify small target regions, but also disrupts the spatial structural continuity of the image and affects the segmentation quality. Summary of the Invention
[0008] The purpose of this invention is to provide a ripple-based image segmentation optimization method driven by edge enhancement and region features. This method simulates the diffusion and echo characteristics of water ripples, starts from the boundary, and expands semantic perception layer by layer to the region and the whole. At the same time, it introduces a two-way interaction mechanism to realize global modulation and local completion of structural information. It can model remote dependencies and temporal context information while maintaining high computational efficiency, thereby improving the overall structural perception and segmentation accuracy, and thus achieving accurate segmentation and fast reasoning in complex structural scenes.
[0009] To achieve the above objectives, this invention provides a ripple-based image segmentation optimization method driven by edge enhancement and region features, comprising the following steps:
[0010] S1: Construct the feature encoding backbone structure; A four-stage nested state weight key value network (NSKV) is adopted as the encoder backbone network structure. After inputting the image, the global image features are first extracted by the convolutional backbone module and divided into multiple blocks and sub-blocks. Then, the semantic association of local regions is modeled by the inner nested state weight key value network of the backbone structure, and the outer nested state weight key value network captures the long-distance dependency between sentence-level blocks. Finally, the feature maps across sub-graph domains are spliced and output.
[0011] S2: Introduce an edge enhancement mechanism; Based on the blocks and sub-blocks of global image features extracted in step S1, construct the boundary information of the structural regions of each block and sub-block to obtain the edge enhancement feature map;
[0012] S3: Introduce a region enhancement mechanism; Based on the edge enhancement feature map provided in step S2, introduce a lightweight region enhancement module with direction selectivity, and obtain the region enhancement feature map by modeling the fine-grained region feature distribution inside the boundary through axial convolution.
[0013] S4: Introduce an interactive dual-scan mechanism; the cross-sub-domain feature map from step S1, the edge enhancement feature map from S2, and the region enhancement feature map from S3 are concatenated and input into the interactive dual-scan module. The cross-sub-domain feature map, the edge enhancement feature map, and the region enhancement feature map are modeled in a multi-directional, bi-branch sequence, and the fused context enhancement feature map is output as the output of the first stage of the encoder. Thereafter, the nested state weight key-value network (NSKV) in step S1 is repeated three times to step S4 to obtain context enhancement feature maps of different scales in the remaining three stages.
[0014] S5: Decoder output segmentation and training process; In the decoder stage, the decoder with a symmetrical structure is gradually upsampled and the channels are restored, and the final semantic segmentation map is generated by combining skip connections and the four-stage context enhancement feature map output from step S4.
[0015] Step S1 of the present invention is as follows:
[0016] The construction of the feature encoding backbone structure in step S1 specifically includes the following steps:
[0017] S11: Construct the convolutional backbone module, divide the input image into multiple blocks and sub-blocks, and extract visual word and visual sentence features through a set of convolutional operations;
[0018] When inputting a 2D image ,in and The height and width of the image are represented respectively, dividing the image into... Image blocks of equal size The size of each image patch is , This represents the resolution of each image patch; each image patch is treated as a visual sentence and then further subdivided. Each equal-sized sub-block is a visual word. The resolution of each visual word is ,Every A visual sentence is composed of visual words.
[0019] (1)
[0020] The segmented visual words and visual sentences are then processed through a series of convolutional operations in the convolutional backbone to generate a spatial shape. The visual word feature map, and the spatial shape as Visual sentence feature maps, where each visual word corresponds to a feature map in the original image. Pixel region, each visual sentence is composed of Composed of visual words;
[0021] S12: Construct a nested state weight key value module. The inner nested state weight key value network processes the local dependencies between visual words, while the outer nested state weight key value network captures the long-distance dependencies between visual sentences and outputs feature maps across sub-graph domains.
[0022] The spatial shapes of the visual words output by the convolutional backbone after step S11 are as follows: For the visual word input in step S11 The word embedding matrix is obtained through linear projection mapping. , (2)
[0023] in: Indicates the first A set of lexical embeddings for a visual sentence;
[0024] Indicates the first The first visual sentence Word embedding;
[0025] Indicates vectorization operation;
[0026] The output is the context-enhanced visual word features, which are used to further construct sentence representations. The nested state-weighted key-value network explores the relationships between visual words.
[0027] (3)
[0028] in: This indicates the total number of such modules. The index of the l-th module, the first module The input is the formula (2) All transformed word embeddings are represented as ;
[0029] The input to the outer nested state-weighted key-value network is the visual sentence embedding set composed of the word embedding sequence extracted by the inner nested state-weighted key-value network based on the structure of the visual sentence input in step S11, obtained through linear aggregation transformation. First, sentence embedding memories are generated as storage for the sentence-level representation sequence. The spatial shape of the visual sentence is as follows: The initial value is set to zero. In each stage of the encoding backbone structure, the word embedding sequence transformed by the nested state-weight key-value network is converted into sentence form through linear projection and then added to the sentence embedding.
[0030] (4)
[0031] In this way, sentence embeddings can be augmented with lexical-level features, and then transformed using an outer nested state-weight key-value network.
[0032] (5)
[0033] An outer nested state-weighted key-value network models the relationships between visual sentence embeddings, yielding feature maps that fuse local details and global structure, exhibiting semantic continuity and spatial awareness. Finally, an encoder can be defined as...
[0034] (6)
[0035] In the nested state weight key-value module of this invention, the inner nested state weight key-value network is used to model the relationships between visual words to capture local information, while the outer nested state weight key-value network captures global information by modeling the relationships between visual sentences. After passing through the nested state weight key-value module encoder, the output of each stage is a feature map corresponding to each visual sentence, and the spatial shape is as follows: The spatial shape is the same as that of the input, and the cross-sub-domain feature map formed by stitching together all the visual sentence feature maps output by the encoder in each stage of step S1 is the global feature map. For ease of subsequent processing, the default number of blocks in each stage of this invention is as follows: Therefore, the total number of nested state-weighted key-value modules is .
[0036] Step S2 of the present invention is as follows:
[0037] The cross-sub-region feature map output in step S1 First, the dilated convolution module is input, which expands the receptive field to enhance structural information in the image, effectively focusing on the spatial contours of large-scale regions such as organs, reducing interference from fine-grained textures, and improving the global structural modeling capability.
[0038] (7)
[0039] This process generates a structurally enhanced version of the feature map. This approach emphasizes the representation of large semantic regions while preserving the spatial continuity and global semantic layout of the image. To further integrate contextual information with lower computational cost and highlight the global structural contours, the feature map undergoes downsampling and upsampling processes. This allows the edge enhancement module to gain a wider field of view while maintaining spatial consistency, thereby generating a coarse-grained global background feature map with semantic guidance capabilities.
[0040] (8)
[0041] This global feature map can be viewed as a background-guided representation, isolating macroscopic regions of interest, suppressing interference from irrelevant regions, and providing contextual support for boundary enhancement. The specific computation of the edge enhancement mapping is achieved by mapping feature maps across sub-domains. Subtract its low-frequency version Obtain boundary feature map , (9)
[0042] This process is similar to high-frequency residual extraction, used to highlight locations of structural changes in the image and to construct boundary saliency maps; finally, edge feature enhancement is performed to combine feature maps across sub-domains. and boundary feature map Element-wise multiplication is performed to weighted enhance the boundary features; the output of this process is an edge-enhanced feature map. , (10)
[0043] It possesses the dual capability of preserving the original structural semantics while enhancing boundary details, providing clear and semantically consistent edge guidance information for subsequent region feature extraction modules.
[0044] Step S3 of the present invention is as follows:
[0045] The edge enhancement feature map extracted in step S2 As input, local spatial patterns are extracted through parallel branches in two directions:
[0046] Features are extracted in the horizontal direction to expand the horizontal receptive field.
[0047] (11)
[0048] Features are extracted in the vertical direction to supplement the vertical regional relationships.
[0049] (12)
[0050] The cross-sub-region feature map output in step S1 For contextual reference, element-wise multiplication is performed using directional features to construct two attention maps with spatial orientation selectivity.
[0051] (13)
[0052] Finally, the enhancement results from the two directions are concatenated along the channel dimension, and then the features are fused through a 1×1 convolution to obtain the final region-aware representation.
[0053] (14)
[0054] It is an enhanced result after structurally refining the model of the region inside the boundary.
[0055] Step S4 of the present invention is as follows:
[0056] The interactive dual-scan mechanism comprises two branches. One branch converts the feature maps across sub-graph domains output from step S1 into two branches. As the original feature map, another branch takes the edge enhancement feature map output from steps S2 and S3. Region Enhancement Feature Map The fused features obtained by concatenating them along the channel dimension are used as the enhanced feature map as the enhancement input. The scan expansion first unfolds the feature maps input from the two branches into a one-dimensional sequence along the four diagonal directions (from top left to bottom right, from bottom right to top left, from top right to bottom left, and from bottom left to top right), ensuring that the sequence maintains spatial continuity.
[0057] (15)
[0058] Where: direction set Indicates the four main diagonal directions;
[0059] Unfold the sequence from the original feature map;
[0060] To enhance the feature map unfolding sequence;
[0061] The original feature map is expanded into a sequence through two branches in each direction. and enhanced feature map unfolding sequence Perform sequence modeling:
[0062] Branch 1 is used to expand the sequence of the original feature map. Modeling, introducing learnable parameters Perform feature residual encoding:
[0063] (16)
[0064] The output sequences from each direction are then concatenated to form the directional modeling sequence of the original path. ;
[0065] Branch 2 is used to expand the enhanced feature map sequence. Modeling, processed in the same way as above:
[0066] (17)
[0067] The output sequences from each direction are then concatenated to form the directional modeling sequence for the enhanced path. ;
[0068] Perform reverse reconstruction operations on the output sequences in each of the four directions to reconstruct the two-dimensional feature maps.
[0069] (18)
[0070] Finally, the two branches are merged to obtain the final output fused feature map. Used for segmentation mask
[0071] (19).
[0072] Step S5 of the present invention is as follows:
[0073] S51: Combine the fusion feature maps obtained in step S4 for each stage. After being separated, the visual sentence feature maps are used as input. To preserve the multi-scale information in the encoding process, the decoder adopts a symmetrical structure and fuses the feature representations of different stages in the encoder through skip connections.
[0074] The fusion feature map output from each stage of step S4 After being separated, they become visual sentence feature maps, and the skip connection features are the output features of encoder layers 1 to 4. As input, each skip connection feature is upsampled and fused using the following modules for skip connection channel alignment (deconvolution, batchnorm, Gelu activation, convolution, batchnorm+gelu); at each stage, upsampling (transposed convolution), 3×3 convolution + BatchNorm + Gelu are used to fuse the upsampled skip connection features, restoring the spatial resolution layer by layer to form a high-precision semantic map; finally, the final semantic segmentation map is generated through 1×1 convolution (channels are mapped to the number of classes) and softmax activation.
[0075] S52: Training is performed using a joint loss function, which mainly includes cross-entropy loss and Dice loss to obtain the final joint loss function;
[0076] Define the joint loss function
[0077] (20)
[0078] in: Represents cross-entropy loss;
[0079] Represents Dice's loss;
[0080] and Masks representing the actual and predicted values, respectively;
[0081] By default, Set the value to 1;
[0082] The cross-entropy loss in the joint loss function is defined as It is suitable for multi-class segmentation and measures the consistency between the predicted classification probability of each pixel and the true label. The total number of pixels. The Dice loss in the joint loss function is defined as follows: It is used to evaluate the degree of overlap between the predicted region and the real region, and is particularly suitable for handling class imbalance problems in medical images. It is a small constant to prevent the denominator from being zero (usually set to...). ).
[0083] To improve segmentation accuracy and boundary fitting ability, this invention optimizes model parameters through multiple loss functions during the training phase, such as cross-entropy loss and Dice loss.
[0084] Compared with existing technologies, this invention introduces edge enhancement and region attention modules on the basis of nested state weight key value network (NSKV), and achieves deep fusion of structural and semantic features through an interactive dual scanning mechanism, which effectively improves the segmentation accuracy and generalization ability of the model in regions with blurred boundaries, large differences in target size, and complex shapes in images.
[0085] The edge enhancement module constructed in this invention adopts dilated convolution and residual enhancement to enhance the perception of structural contours in the image by expanding the receptive field, effectively capturing the global morphological features of the edge region and improving the segmentation robustness of the model under blurred boundaries. At the same time, the region feature module extracts local semantic features in the horizontal and vertical directions based on axial convolution, starting from the boundary, further improving the model's ability to model detailed regions inside the boundary, and significantly enhancing the ability to identify small-scale lesions and deformed regions.
[0086] The interactive dual-scanning mechanism designed in this invention draws on the idea of sequence modeling, which expands the original features and enhanced features into sequences in multiple directions. While maintaining the spatial structure, it realizes multi-scale and multi-branch feature interaction. By modeling long-distance dependencies through the interactive dual-scanning module, it significantly enhances the model's ability to capture cross-regional semantic consistency and avoids boundary fragmentation and prediction bias caused by insufficient local feature modeling.
[0087] This invention designs an upsampling path symmetrical to the encoder in the decoder structure and integrates information from different semantic levels by combining multi-scale skip connections, ultimately generating high-resolution segmentation results through feature fusion. To improve training efficiency and model stability, cross-entropy and Dice loss are jointly introduced for multi-objective optimization, effectively enhancing the model's robustness and boundary fitting ability under different data distributions and organ structures.
[0088] The module proposed in this invention possesses excellent versatility and pluggability, and can be flexibly embedded into various mainstream image segmentation network structures. It is applicable to various types of image segmentation tasks, including medical images, remote sensing images, natural images, and industrial vision. This method balances feature modeling capabilities with computational efficiency, significantly improving the boundary accuracy and region integrity of the segmentation results while maintaining a clear structure and user-friendly deployment. Due to its decoupled module structure and low parameter overhead, it exhibits good engineering adaptability and scalability, making it suitable for image processing systems with different resolutions, modalities, and task requirements, and thus has broad prospects for practical application and widespread adoption. Attached Figure Description
[0089] Figure 1 This is the overall network structure of the image segmentation optimization method of the present invention;
[0090] Figure 2 This is an overall flowchart of the image segmentation optimization of the present invention;
[0091] Figure 3 This is a flowchart illustrating the scanning area module in this invention.
[0092] Figure 4 The following are visualization results of the method of the present invention on the AbdomenMRI dataset, where Figure (a) is the ground truth map of abdominal organs and Figure (b) is the segmentation map obtained by the present invention;
[0093] Figure 5 The figures show the visualization results of the method of the present invention in the Endoscopy dataset, where Figure (a) is the ground truth map of surgical instruments in the endoscopic image and Figure (b) is the segmentation map obtained by the present invention. Detailed Implementation
[0094] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0095] To address the challenges of complex image segmentation tasks, such as blurred target boundaries, diverse morphological variations, and uneven distribution of regional features, this invention proposes a ripple-like image segmentation optimization method based on the collaborative optimization of edge enhancement and regional features. The overall network structure of this invention is shown in Figure 1. The system mainly comprises five parts: an image encoding module, an edge enhancement module, a regional feature extraction module, an interactive fusion module, and a segmentation decoding module. The image encoding module, based on a nested state weight key-value network (NSKV), models local and global semantic features at different granularity levels while preserving multi-scale information representation. This nested design effectively captures short-range dependencies and long-range structural relationships in the image, improving the completeness of feature representation. The edge enhancement module employs dilated convolution and residual strategies to highlight low-frequency structural contour information, suppress fine-grained texture noise, and enhance boundary perception capabilities, making it particularly suitable for target recognition scenarios with blurred boundaries or discontinuous structures. The regional feature extraction module introduces a direction-aware axial convolutional network to further extract regional semantic information within the boundary guided by the boundary, improving the model's segmentation performance for small targets, complex shapes, and blurred regions. To further achieve efficient fusion between boundary and region features, the system introduces an interactive dual-scanning mechanism and employs a multi-directional sequence modeling strategy. It performs bi-branch interactive learning on the original features, boundary enhancement features, and region features, capturing long-distance dependencies and detailed semantic interactions to construct a spatially aware fusion feature map. Finally, the fusion features are input to a symmetrical decoder, which uses skip connections and multi-stage upsampling to reconstruct a high-resolution semantic mask, improving overall segmentation accuracy. When images contain complex structures such as blurred boundaries or heterogeneous regions, the system can automatically adjust the modeling weight of edges and regions, avoiding boundary overfitting or missing region recognition, thus significantly improving the system's adaptability and robustness in real-world scenarios.
[0096] To achieve high-precision recognition and modeling of complex boundary structures and local region features in image segmentation tasks, such as... Figures 1-3 The present invention provides a ripple-like image segmentation optimization method based on edge enhancement and region feature-driven approach, the specific implementation steps of which are as follows:
[0097] S1: Construct a feature encoding backbone structure; A four-stage nested state weight key value network (NSKV) is adopted as the encoder backbone network structure. After inputting the image, the global image features are first extracted by the convolutional backbone module and divided into multiple blocks and sub-blocks. Then, the semantic associations of local regions are modeled by the inner nested state weight key value network of the backbone structure, and the outer nested state weight key value network captures the long-distance dependencies between sentence-level blocks. Finally, the feature maps across sub-graph domains are spliced to achieve the unity of global semantic perception and local detail preservation.
[0098] S11: Construct the convolutional backbone module, divide the input image into multiple blocks and sub-blocks, and extract visual word and visual sentence features through a set of convolutional operations;
[0099] When inputting a 2D image ,in and The height and width of the image are represented respectively, dividing the image into... Image blocks of equal size The size of each image patch is , This represents the resolution of each image patch; each image patch is treated as a visual sentence and then further subdivided. Each equal-sized sub-block is a visual word. The resolution of each visual word is ,Every A visual sentence is composed of visual words.
[0100] (1)
[0101] The segmented visual words and visual sentences are then processed through a series of convolutional operations in the convolutional backbone to generate a spatial shape. The visual word feature map, and the spatial shape as Visual sentence feature maps, where each visual word corresponds to a feature map in the original image. Pixel region, each visual sentence is composed of Composed of visual words;
[0102] S12: Construct a nested state weight key value module. The inner nested state weight key value network processes the local dependencies between visual words, while the outer nested state weight key value network captures the long-distance dependencies between visual sentences and outputs feature maps across sub-graph domains.
[0103] The spatial shapes of the visual words output by the convolutional backbone after step S11 are as follows: For the visual word input in step S11 The word embedding matrix is obtained through linear projection mapping. , (2)
[0104] in: Indicates the first A set of lexical embeddings for a visual sentence;
[0105] Indicates the first The first visual sentence Word embedding;
[0106] Indicates vectorization operation;
[0107] The output is the context-enhanced visual word features, which are used to further construct sentence representations. The nested state-weighted key-value network explores the relationships between visual words.
[0108] (3)
[0109] in: This indicates the total number of such modules. The index of the l-th module, the first module The input is the formula (2) All transformed word embeddings are represented as ;
[0110] The input to the outer nested state-weighted key-value network is the visual sentence embedding set composed of the word embedding sequence extracted by the inner nested state-weighted key-value network based on the structure of the visual sentence input in step S11, obtained through linear aggregation transformation. First, sentence embedding memories are generated as storage for the sentence-level representation sequence. The spatial shape of the visual sentence is as follows: The initial value is set to zero. In each stage of the encoding backbone structure, the word embedding sequence transformed by the nested state-weight key-value network is converted into sentence form through linear projection and then added to the sentence embedding.
[0111] (4)
[0112] In this way, sentence embeddings can be augmented with lexical-level features, and then transformed using an outer nested state-weight key-value network.
[0113] (5)
[0114] An outer nested state-weighted key-value network models the relationships between visual sentence embeddings, yielding feature maps that fuse local details and global structure, exhibiting semantic continuity and spatial awareness. Finally, an encoder can be defined as...
[0115] (6)
[0116] In the nested state weight key-value module of this invention, the inner nested state weight key-value network is used to model the relationships between visual words to capture local information, while the outer nested state weight key-value network captures global information by modeling the relationships between visual sentences. After passing through the nested state weight key-value module encoder, the output of each stage is a feature map corresponding to each visual sentence, and the spatial shape is as follows: The spatial shape is the same as that of the input, and the cross-sub-domain feature map formed by stitching together all the visual sentence feature maps output by the encoder in each stage of step S1 is the global feature map. For ease of subsequent processing, the default number of blocks in each stage of this invention is as follows: Therefore, the total number of nested state-weighted key-value modules is .
[0117] S2: Introduce an edge enhancement mechanism; Based on the blocks and sub-blocks of global image features extracted in step S1, construct the boundary information of the structural regions of each block and sub-block to obtain the edge enhancement feature map;
[0118] The cross-sub-region feature map output in step S1 First, the dilated convolution module is input, which expands the receptive field to enhance structural information in the image, effectively focusing on the spatial contours of large-scale regions such as organs, reducing interference from fine-grained textures, and improving the global structural modeling capability.
[0119] (7)
[0120] This process generates a structurally enhanced version of the feature map. This approach emphasizes the representation of large semantic regions while preserving the spatial continuity and global semantic layout of the image. To further integrate contextual information with lower computational cost and highlight the global structural contours, the feature map undergoes downsampling and upsampling processes. This allows the edge enhancement module to gain a wider field of view while maintaining spatial consistency, thereby generating a coarse-grained global background feature map with semantic guidance capabilities.
[0121] (8)
[0122] This global feature map can be viewed as a background-guided representation, isolating macroscopic regions of interest, suppressing interference from irrelevant regions, and providing contextual support for boundary enhancement. The specific computation of the edge enhancement mapping is achieved by mapping feature maps across sub-domains. Subtract its low-frequency version Obtain boundary feature map , (9)
[0123] This process is similar to high-frequency residual extraction, used to highlight locations of structural changes in the image and to construct boundary saliency maps; finally, edge feature enhancement is performed to combine feature maps across sub-domains. and boundary feature map Element-wise multiplication is performed to weighted enhance the boundary features; the output of this process is an edge-enhanced feature map. , (10)
[0124] It possesses the dual capability of preserving the original structural semantics while enhancing boundary details, providing clear and semantically consistent edge guidance information for subsequent region feature extraction modules.
[0125] S3: Introduce a region enhancement mechanism; Based on the edge enhancement feature map provided in step S2, introduce a lightweight region enhancement module with direction selectivity, and obtain the region enhancement feature map by modeling the fine-grained region feature distribution inside the boundary through axial convolution.
[0126] Specifically as follows:
[0127] The edge enhancement feature map extracted in step S2 As input, local spatial patterns are extracted through parallel branches in two directions:
[0128] Features are extracted in the horizontal direction to expand the horizontal receptive field.
[0129] (11)
[0130] Features are extracted in the vertical direction to supplement the vertical regional relationships.
[0131] (12)
[0132] The cross-sub-region feature maps extracted in step S1 For contextual reference, element-wise multiplication is performed using directional features to construct two attention maps with spatial orientation selectivity.
[0133] (13)
[0134] Finally, the enhancement results from the two directions are concatenated along the channel dimension, and then the features are fused through a 1×1 convolution to obtain the final region-aware representation.
[0135] (14)
[0136] It is an enhanced result after structurally refining the model of the region inside the boundary.
[0137] S4: Introduce an interactive dual-scan mechanism; the cross-sub-domain feature map from step S1, the edge enhancement feature map from S2, and the region enhancement feature map from S3 are concatenated and input into the interactive dual-scan module. The cross-sub-domain feature map, the edge enhancement feature map, and the region enhancement feature map are modeled in a multi-directional, bi-branch sequence, and the fused context enhancement feature map is output as the output of the first stage of the encoder. Thereafter, the nested state weight key-value network (NSKV) in step S1 is repeated three times to step S4 to obtain context enhancement feature maps at different scales in the remaining three stages.
[0138] The specific steps are as follows:
[0139] The interactive dual-scan mechanism comprises two branches. One branch converts the feature maps across sub-graph domains output from step S1 into two branches. As the original feature map, another branch takes the edge enhancement feature map output from steps S2 and S3. Region Enhancement Feature Map The fused features obtained by concatenating them along the channel dimension are used as the enhanced feature map as the enhancement input. The scan expansion first unfolds the feature maps input from the two branches into a one-dimensional sequence along the four diagonal directions (from top left to bottom right, from bottom right to top left, from top right to bottom left, and from bottom left to top right), ensuring that the sequence maintains spatial continuity.
[0140] (15)
[0141] Where the direction set Indicates the four main diagonal directions;
[0142] Unfold the sequence from the original feature map;
[0143] To enhance the feature map unfolding sequence;
[0144] The original feature map is expanded into a sequence through two branches in each direction. and enhanced feature map unfolding sequence Perform sequence modeling:
[0145] Branch 1 is used to expand the sequence of the original feature map. Modeling, introducing learnable parameters Perform feature residual encoding:
[0146] (16)
[0147] The output sequences from each direction are then concatenated to form the directional modeling sequence of the original path. ;
[0148] Branch 2 is used to expand the enhanced feature map sequence. Modeling, processed in the same way as above:
[0149] (17)
[0150] The output sequences from each direction are then concatenated to form the directional modeling sequence for the enhanced path. ;
[0151] Perform reverse reconstruction operations on the output sequences in each of the four directions to reconstruct the two-dimensional feature maps.
[0152] (18)
[0153] Finally, the two branches are merged to obtain the final output fused feature map. Used for segmentation mask
[0154] (19).
[0155] S5: Decoder output segmentation and training process; In the decoder stage, the decoder with a symmetrical structure is gradually upsampled and the channels are restored, and the final semantic segmentation map is generated by combining the skip connections and the four-stage context enhancement feature maps output from step S4.
[0156] The specific steps are as follows:
[0157] S51: Combine the fusion feature maps obtained in step S4 for each stage. After being separated, the visual sentence feature maps are used as input. To preserve the multi-scale information in the encoding process, the decoder adopts a symmetrical structure and fuses the feature representations of different stages in the encoder through skip connections.
[0158] The fusion feature map output from each stage of step S4 After being separated, they become visual sentence feature maps, and the skip connection features are the output features of encoder layers 1 to 4. As input, each skip connection feature is upsampled and fused using the following modules for skip connection channel alignment (deconvolution, batchnorm, Gelu activation, convolution, batchnorm+gelu); at each stage, upsampling (transposed convolution), 3×3 convolution + BatchNorm + Gelu are used to fuse the upsampled skip connection features, restoring the spatial resolution layer by layer to form a high-precision semantic map; finally, the final semantic segmentation map is generated through 1×1 convolution (channels are mapped to the number of classes) and softmax activation.
[0159] S52: Training is performed using a joint loss function, which mainly includes cross-entropy loss and Dice loss to obtain the final joint loss function;
[0160] Define the joint loss function
[0161] (20)
[0162] in: Represents cross-entropy loss;
[0163] Represents Dice's loss;
[0164] and Masks representing the actual and predicted values, respectively;
[0165] By default, Set the value to 1;
[0166] The cross-entropy loss in the joint loss function is defined as It is suitable for multi-class segmentation and measures the consistency between the predicted classification probability of each pixel and the true label. The total number of pixels. The Dice loss in the joint loss function is defined as follows: It is used to evaluate the degree of overlap between the predicted region and the real region, and is particularly suitable for handling class imbalance problems in medical images. It is a small constant to prevent the denominator from being zero (usually set to...). ).
[0167] This invention optimizes model parameters through multiple loss functions during the training phase. The loss functions used in this invention include cross-entropy loss and Dice loss, in order to improve segmentation accuracy and boundary fitting ability. Example
[0168] Medical imaging often presents challenges such as blurred boundaries, varied organ morphologies, and large differences in lesion size, placing higher demands on the structural awareness and detail modeling capabilities of segmentation models. Therefore, in this embodiment, to verify the effectiveness of the proposed ripple-style image segmentation optimization method based on edge enhancement and region feature-driven approaches, this invention selected two publicly available medical image datasets with significant research value—the AbdomenMRI multi-organ segmentation dataset and the Endoscopy endoscopy dataset—for extensive experimentation. The AbdomenMRI dataset contains multiple abdominal cross-sectional MRI images, with labeled regions including organs such as the liver, kidneys, spleen, and pancreas. The image resolution is 256×256, and each image is equipped with a single-channel mask, suitable for evaluating the model's segmentation capabilities under low-contrast and blurred boundary conditions. The Endoscopy dataset aggregates videos from six different data centers, covering various tissue types such as gastroscopy, cystoscopy, gastroesophagectomy, and colonoscopy. The selected image frames have labeled bounding boxes and semantic segmentation masks.
[0169] The experimental setup is as follows: The training and validation sets of this invention are split and merged in a 4:1 ratio for training, containing a total of 800 images for training and 200 images for validation. The optimization objective is to minimize the joint loss function, including Dice loss and cross-entropy loss, and the hyperparameters... The algorithm is set to 1.0. The model uses the Adam optimizer with an initial learning rate of 0.0001, 50 training iterations, and a batch size of 8. In terms of model structure, a four-stage nested state-weighted key-value network (NSKV) is employed, with an embedded block merging module for layer-by-layer downsampling to output multi-scale feature maps. After the encoder, edge enhancement and region enhancement modules are introduced to handle structural boundaries and internal region details, respectively. Finally, an interactive dual-scan module fuses multi-source features before inputting them into a symmetric decoder to generate the segmentation result.
[0170] like Figure 4 and Figure 5 As shown in the figure, (a) represents the ground truth label, and (b) represents the segmentation result of this invention. It can be seen from the figure that the image segmentation method proposed in this invention exhibits good convergence, stability, and boundary awareness on the AbdomenMRI and Endoscopy datasets, and is particularly suitable for complex multi-organ structures. Experimental results further verify the practicality and potential for widespread application of this method in medical image segmentation.
[0171] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claimed invention.
Claims
1. An edge enhancement and region feature driven ripples based image segmentation optimization method, characterized in that, The method comprises the following steps: S1: constructing a feature encoding backbone structure; adopting a four-stage nested state key-value network as an encoder backbone network structure, after inputting an image, firstly extracting global image features through a convolution backbone module and dividing the global image features into multiple blocks and sub-blocks, then modeling the semantic association of local regions through the inner nested state key-value network of the backbone structure, capturing long-distance dependencies between sentence-level blocks through the outer nested state key-value network, and finally splicing and outputting a cross-sub-graph domain feature map; S2: introducing an edge enhancement mechanism; on the basis of the blocks and sub-blocks of the global image features extracted in step S1, the edge enhancement mechanism is used to construct boundary information of structural regions of each block and sub-block, thereby obtaining an edge enhanced feature map; S3: introducing a region enhancement mechanism; on the basis of the edge enhanced feature map provided in step S2, a lightweight region enhancement module with direction selectivity is introduced, the distribution of fine-grained region features in the boundary internal region is modeled through axial convolution, and a region enhanced feature map is obtained; S4: introducing an interactive dual scanning mechanism; the cross-sub-graph domain feature map of step S1, the edge enhanced feature map of S2 and the region enhanced feature map obtained in S3 are spliced and input into an interactive dual scanning module, the cross-sub-graph domain feature map, the edge enhanced feature map and the region enhanced feature map are sequentially modeled in multiple directions and double branches, and a fused context enhanced feature map is output as the output of the first stage of the encoder; Thereafter, the nested state key-value network (NSKV) in step S1 is repeated three times to step S4, and context enhanced feature maps of different scales in the remaining three stages are obtained; S5: output segmentation and training process of the decoder; In the decoder stage, the decoder with a symmetrical structure is used for step-by-step upsampling and channel restoration, and the four-stage context enhanced feature map output in step S4 is combined to generate a final semantic segmentation map.
2. The method of claim 1, wherein, Step S1 is specifically as follows: The construction of the feature encoding backbone structure in step S1 specifically comprises the following steps: S11: constructing a convolution backbone module, dividing the input image into multiple blocks and sub-blocks, and extracting visual word and visual sentence features through a group of convolution operations; When inputting a 2D image , where and represent the height and width of the image respectively, the image is divided into image blocks of equal size , each of which has a size of , , where represents the resolution of each image block; each image block is regarded as a visual sentence, which is further divided into sub-blocks of equal size as visual words , each of which has a resolution of , and each visual word constitutes a visual sentence (1) The segmented visual words and visual sentences are generated into visual word feature maps with a spatial shape of and visual sentence feature maps with a spatial shape of by a set of convolution operations of the convolution backbone, each visual word corresponding to a pixel region in the original image, and each visual sentence being composed of visual words. S12: constructing a nested state key-value module, the inner nested state key-value network processes the local dependency between visual words, the outer nested state key-value network captures the long-distance dependency between visual sentences, and outputs a cross-sub-graph domain feature map; The spatial shape of the visual word output from the convolutional backbone in step S11 is sequentially For the visual word input in step S11 The word embedding matrix is obtained by linear projection mapping , (2) wherein: represents a set of word embeddings of the th visual sentence; representing a first word embedding of a first visual sentence; represents a vectorization operation; The output is a context enhanced visual word feature, which is used to further construct a sentence representation, and the inner nested state key-value network explores the relationship between visual words: (3) wherein: denotes the total number of such modules, is the index of the l-th module, the first module has as input the , all transformed word embeddings are denoted by ; The input of the outer-embedded state-weight key-value network is a visual sentence input in step S11, and the visual sentence embedding set composed of the sentence-level representations obtained by linear aggregation transformation of the word embedding sequence extracted by the inner-embedded state-weight key-value network based on the structure of the visual sentence. First, the sentence embedding memory is generated as the storage of the sentence-level representation sequence, and the spatial shape of the visual sentence is sequentially , the initial value is set to zero In each stage of encoding the main structure, the word embedding sequence converted by the inner-embedded state-weight key-value network is converted into a sentence form by linear projection and then added to the sentence embedding (4) In this way, the sentence embedding is enhanced by the vocabulary-level feature, and then the outer nested state key-value network is used to convert the sentence embedding (5) The outer nested state key-value network models the relationship between visual sentence embeddings, obtains a feature map that integrates local details and global structure, has semantic continuity and spatial perception ability, and finally defines the encoder as (6) In the nested state right key value module, the inner nested state right key value network is used for modeling the relationship between visual words to capture local information, and the outer nested state right key value network is used for modeling the relationship between visual sentences to capture global information. The output of each stage of the nested state right key value module encoder is a feature map corresponding to each visual sentence, and the spatial shape is the same as the spatial shape at the input time. The cross-subgraph domain feature map obtained by splicing all the visual sentence feature maps output by the encoder at each stage of step S1 is the global feature map, and the global feature map is convenient for subsequent operation processing. The number of blocks at each stage is respectively by default. Therefore, the total number of nested state right key value modules is .
3. The method of claim 2, wherein, Step S2 is specifically as follows: the cross-sub-graph domain feature map output by step S1 is input into a first attention module First, the input is passed through a dilated convolution module, which enhances structural information in the image by expanding the receptive field (7) The process generates a structure-enhanced version of the feature map , highlighting large-scale semantic region expression, preserving the spatial continuity and global semantic layout of the image; in order to further integrate context information under lower computational load, while highlighting the global structure profile, the feature map is further down-sampled and up-sampled, enabling the edge enhancement module to maintain spatial consistency while obtaining a wider field of view, thereby generating a coarse-grained global background feature map with semantic guidance capability (8) The global feature map can be regarded as a kind of background guiding representation, isolating the macro interest area and suppressing the interference of irrelevant areas, and providing context support for boundary enhancement; the specific calculation of the edge enhancement mapping is obtained by subtracting the low-frequency version of the cross-subgraph domain feature map from the low-frequency version to obtain the boundary feature map : (9) The process is similar to high-frequency residual extraction, which is used to highlight the positions where there are structural changes in the image for constructing the boundary saliency map; finally, edge feature enhancement is performed to realize the weighted enhancement of the boundary features, and the output of the process is the edge-enhanced feature map and the boundary feature map Element-wise multiplication operation is performed to realize the weighted enhancement of the boundary features, and the output of the process is the edge-enhanced feature map , (10) The dual capability of retaining the original structural semantics while enhancing the boundary details can provide clear and semantically consistent edge guide information for the subsequent region feature extraction module.
4. The method of claim 3, wherein, Step S3 is specifically as follows: extracting the edge enhanced feature map of step S2 As input, local spatial patterns are extracted through two directional parallel branches: The features are extracted in the horizontal direction to expand the horizontal receptive field (11) Features are extracted in the vertical direction to complement the vertical direction region relationship (12) cross-sub-graph domain features extracted in step S1 As a contextual reference, two attention maps with spatial direction selectivity are constructed by element-wise multiplication with directional features (13) Finally, the two direction enhancement results are spliced in the channel dimension, and then the features are fused through 1x1 convolution to obtain the final region perception representation (14) is the enhanced result after modeling the structural refinement of the interior region of the boundary.
5. The method of claim 3, wherein the method further comprises: Step S4 is specifically as follows: The interactive dual scanning mechanism includes two branches, one branch scans the cross-sub-region feature map output by step S1 The other branch scans the edge-enhanced feature map output by steps S2, S3 as the original feature map , and the region-enhanced feature map After splicing in the channel dimension, the obtained fusion feature is the enhanced feature map as the enhanced input; the scanning expansion first expands the feature maps input by the two branches respectively along four diagonal directions into one-dimensional sequences, ensuring that the sequences maintain spatial continuity (15) where: set of directions denotes the four main diagonal directions; unfolding the sequence for the original feature map; To enhance feature map unfolding sequences; unfolding the original feature map by two branches respectively in each direction and the enhanced feature map unfolding sequence sequence modeling: Branch one for unrolling sequence of original feature maps Modeling, introducing learnable parameters Feature residual coding: (16) The sequences of directional outputs are then stitched to form the directional modeling sequence of the original path ; Branch two for unrolling sequence of enhanced feature maps Modeling, same as above processing: (17) The sequences output in each direction are then stitched to form the directional modeling sequence of the augmented path ; Reverse restoration operations are respectively performed on the output sequences of the four directions to reconstruct two-dimensional feature maps (18) The two branches are finally merged to obtain the final output fused feature map for segmenting the mask (19)。 6. The method of claim 3, wherein, Step S5 is specifically as follows: S51: merge the feature maps of each stage obtained in step S4 After being separated, the visual sentence feature maps are taken as input. To preserve the multi-scale information in the encoding process, the decoder adopts a symmetric structure and fuses the feature representations of different levels in the encoder through a skip connection. fused feature map of each stage output by step S4 After being separated again, the visual sentence feature map, the jump connection feature, that is, the output feature of stages 1-4 of the encoder As input, each jump connection feature is fused after being up-sampled by the following modules, which are used for jump connection channel alignment; then, each stage uses up-sampling, 3x3 convolution+BatchNorm+GeLU, fuses the up-sampled jump connection feature, restores the spatial resolution layer by layer, forms a high-precision semantic map; finally, a 1x1 convolution and a softmax activation are used to generate the final semantic segmentation map; S52: Training is performed by using a joint loss function, and the final joint loss function is obtained mainly by including cross-entropy loss and Dice loss; The joint loss function is defined (20) wherein: represents a cross-entropy loss; representing the Dice loss; and mask representing the true values and predicted values, respectively; By default, the value of the parameter is set to 1; The cross-entropy loss in the joint loss function is defined as , which is suitable for multi-class segmentation and measures the consistency of the predicted classification probability of each pixel with the true label, is the number of all pixel points, ; the Dice loss in the joint loss function is defined as , which is used to evaluate the overlap degree of the predicted region and the true region, wherein is a small constant to prevent the denominator from being 0.
7. The method of claim 3, wherein the method further comprises: In the training phase, the model parameters are optimized by multiple loss functions.
Citation Information
Patent Citations
Medical image segmentation method, device and equipment and readable storage medium
CN110689548A
Intelligent inspection device and alarm method
CN118658126A